srusskih / SublimeJEDI

awesome Python autocompletion with SublimeText
MIT License
938 stars 109 forks source link

Latest update doesn't allow for using a different python_interpreter without a virtualenv #250

Closed vshotarov closed 6 years ago

vshotarov commented 6 years ago

So, the _pythoninterpreter that I have specified in my user settings is

"python_interpreter": "C:\\Program Files\\Autodesk\\Maya2017\\bin\\mayapy.exe",

Previously, that was working fine, but with the latest update from Package Control this now gives me the following error

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 591, in on_query_completions
    res = callback.on_query_completions(v, prefix, locations)
  File "C:\Users\vasils\AppData\Roaming\Sublime Text 3\Packages\Jedi - Python autocompletion\sublime_jedi\completion.py", line 178, in on_query_completions
    ask_daemon(view, self._show_completions, 'autocomplete', locations[0])
  File "C:\Users\vasils\AppData\Roaming\Sublime Text 3\Packages\Jedi - Python autocompletion\sublime_jedi\utils.py", line 34, in ask_daemon
    DAEMONS[window_id] = Daemon(settings=get_settings(view))
  File "C:\Users\vasils\AppData\Roaming\Sublime Text 3\Packages\Jedi - Python autocompletion\sublime_jedi\utils.py", line 76, in __init__
    environment._get_python_prefix(python_interpreter),
  File "C:\Users\vasils\AppData\Roaming\Sublime Text 3\Packages\Jedi - Python autocompletion\dependencies\jedi\api\environment.py", line 295, in create_environment
    return Environment(path, _get_executable_path(path, safe=safe))
  File "C:\Users\vasils\AppData\Roaming\Sublime Text 3\Packages\Jedi - Python autocompletion\dependencies\jedi\api\environment.py", line 308, in _get_executable_path
    raise InvalidPythonEnvironment("%s seems to be missing." % python)
jedi.api.environment.InvalidPythonEnvironment: C:\Program Files\Autodesk\Maya2017\bin\Scripts\python.exe seems to be missing.

I understand this is due to the added support for virtual environments, but it seems like now there is no way to use a Python interpreter which is not the one in PATH without specifying a virtualenv as well.

Not sure what the best way to approach this would be, though, as I do see the benefits of having the virtualenv automatically inferred from the interpreter.

srusskih commented 6 years ago

@vshotarov thanks for report. will look what I can do with this.

srusskih commented 6 years ago

@davidhalter you might be interested in the case then create_environment does not works (:

code from the plugin

environment.create_environment(
                environment._get_python_prefix(python_interpreter),
            )
srusskih commented 6 years ago

@vshotarov Could you please check if #251 works for you?

vshotarov commented 6 years ago

@srusskih yes, #251 does fix the problem! Thanks a lot for looking into it that quickly!

davidhalter commented 6 years ago

We're working on it. @blueyed had worked on https://github.com/davidhalter/jedi/pull/1108. It's not finished AFAIK but it's going to improve. This looks pretty similar to some issues we're having with anaconda.

char9e commented 6 years ago

I am experiencing the same issue on IronPython 2.7.8 64 bit using the latest install from package control.


  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 462, in run_callback
    expr()
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 701, in <lambda>
    run_callback('on_hover', callback, lambda: callback.on_hover(v, point, hover_zone))
  File "C:\Sublime Text 3\Packages\Jedi - Python autocompletion\sublime_jedi\helper.py", line 107, in on_hover
    point)
  File "C:\Sublime Text 3\Packages\Jedi - Python autocompletion\sublime_jedi\utils.py", line 34, in ask_daemon
    DAEMONS[window_id] = Daemon(settings=get_settings(view))
  File "C:\Sublime Text 3\Packages\Jedi - Python autocompletion\sublime_jedi\utils.py", line 77, in __init__
    python_interpreter
  File "C:\Sublime Text 3\Packages\Jedi - Python autocompletion\dependencies\jedi\api\environment.py", line 67, in __init__
    self.version_info = self._get_version()
  File "C:\Sublime Text 3\Packages\Jedi - Python autocompletion\dependencies\jedi\api\environment.py", line 80, in _get_version
    raise InvalidPythonEnvironment()
  jedi.api.environment.InvalidPythonEnvironment
davidhalter commented 6 years ago

Did it ever work with IronPython? It's not supported by Jedi officially.

char9e commented 6 years ago

@davidhalter Thanks a lot. I was hoping to use it for IronPython Stubs https://github.com/gtalarico/ironpython-stubs/wiki/Sublime. Now looking at it gain, it looks like I misunderstood - it didn't actually require IronPython as the interpreter.