# Getting SublimeLinter to Work with pyenv and zsh

7 thoughts
last posted Oct. 31, 2014, 7:43 p.m.
0
get stream as: markdown or atom
0

Sublime Text 3

I install Package Controller along with the following packages:

My user preferences:

0

So in my exuberance on getting my new system all setup, I failed to actually check that the linters in SublimeLinter were actually working.

Initial debugging indicates that it's not picking up my shell's PATH or finding the Python either in my current virtualenv from where I launched the editor from using subl or the Python pyenv should be pointing to.

0

So I turned debug mode on and look at the console in ST3 and see some curious bits:

SublimeLinter: user shell: /bin/zsh
SublimeLinter: computed PATH using /bin/zsh:
/Users/paltman/bin
/usr/local/share/npm/bin
/usr/local/share/python
/usr/local/bin
/usr/bin
/bin
/usr/local/sbin
/usr/sbin
/sbin
/usr/X11/bin
/Users/paltman/.local/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin


and then:

SublimeLinter: find_posix_python: python => /usr/bin/python
SublimeLinter: find_python: system python = /usr/bin/python
SublimeLinter: find_python: available version = {'major': 2, 'minor': 7}


and then when I open a python file:

SublimeLinter: find_python(version=None, script='flake8', module=None)
SublimeLinter: find_python: default python = /usr/bin/python
SublimeLinter: find_python: available version = {'major': 2, 'minor': 7}
SublimeLinter: find_python: 'flake8' path = None
SublimeLinter: find_python: <= (None, None, 2, 7)
SublimeLinter: WARNING: flake8 deactivated, cannot locate 'flake8@python'

0

it's clear that it's pointing to the wrong python. /usr/bin/python is not the python installed and managed by pyenv or in my virtualenv.

But it's also clear from the initial dump that my path isn't correct.

0

When I run which python I get /usr/local/opt/pyenv/shims/python and my PATH has /usr/local/opt/pyenv/shims as one of the very first things.

0

I think have narrowed it down to be due to the fact that the penv python shim is loaded during the rc phase while SublimeLinter loads a login shell when only loads env and then profile.

1

Ok, figured it out. Apparently there are a lot of issues with this combination and how SublimeLinter ferret outs the path.

It's less than ideal but in the User settings for the SublimeLinter, I added the following to the paths for OS X:

"paths": {
"linux": [],
"osx": [
"/usr/local/Cellar/pyenv/20141012/versions/2.7.8/bin/"
],
"windows": []
},


This points to the pyenv I created for the installed Python.