I've installed and configured Jedi autocomplete v0.12.0 on Sublime Text 3 v3.1.1. In Jedi user settings, I've set python_interpreter
to point to python version in virtualenvs
.
"python_interpreter": "/home/username/.virtualenvs/cv3/bin/python"
The problem is that in /dependencies/jedi/api/environment.py
, the method _assert_safe
does not recognize the virtualenv path as safe.
def _assert_safe(executable_path, safe):
if safe and not _is_safe(executable_path):
raise InvalidPythonEnvironment(
"The python binary is potentially unsafe.")
The _assert_safe
method calls the method def _is_safe(executable_path)
which also returns false. The code in these two methods is pretty simple and I understand what is happening, I just don't see any solution. For testing purposes I added the virtualenv
Python path to PYTHONPATH
environment variable, it didn't make any difference.
The only solution I could find was to launch Sublime
from terminal under the virtualenv
. In terminal:
$ workon virtualenv_name
$ subl
Now _is_safe(executable_path)
method can find virtualenv
Python executable and returns True
.