Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode's Python extension does not load the right python interpreter from pyenv #7029

Closed
vict0rsch opened this issue Aug 20, 2019 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@vict0rsch
Copy link

vict0rsch commented Aug 20, 2019

Environment data

  • VS Code version: 1.37.1
  • Extension version (available under the Extensions sidebar): 2019.8.30787
  • OS and version: macOS 10.13.2 (17C88) (High Sierra)
  • Python version (& distribution if applicable, e.g. Anaconda): pyenv 3.7.4
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): None
  • python.jediEnabled: false

Expected behaviour

The default python interpreter is ~/.pyenv/shims/python

When I run which python in my terminal I do get ~/.pyenv/shims/python. python --version does return the expected 3.7.4

Actual behaviour

The interpreter suggests that ~/.pyenv/shims/python is actually 3.6.4. Maybe this also causes a mismatch and this pyenv crash I get

Capture d’écran 2019-08-19 à 17 51 33

Logs

None

Output from Console under the Developer Tools panel, on selecting the interpreter

Capture d’écran 2019-08-19 à 22 12 34

@vict0rsch vict0rsch added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Aug 20, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Aug 20, 2019
@ericsnowcurrently
Copy link
Member

@vict0rsch, thanks for letting us know about this. I have some questions:

  1. how did you install pyenv (homebrew, installer, git clone, etc.)?
  2. do you have any pyenv-related environment variables set (like PYENV_VERSION, PYENV_ROOT)?
  3. what does running pyenv versions tell you?
  4. do you have a .python-version file in your workspace folder? in your home directory?
  5. do you have pyenv init in your shell startup script (e.g. ~/.bashrc)?
  6. do you have multiple copies of pyenv installed?
  7. are you using any pyenv plugins?

Thanks!

@ericsnowcurrently ericsnowcurrently added the info-needed Issue requires more information from poster label Aug 21, 2019
@vict0rsch
Copy link
Author

Hi,

  1. homebrew
  2. I have one: PYENV_SHELL=zsh
  3. ❯ pyenv versions
      system
      2.7.14
      3.4.3
      3.5.4
      3.6.4
      3.6.6
    * 3.7.4 (set by /Users/victor/.pyenv/version)
    
  4. No I do not, neither in my home or working directory
  5. I have eval "$(pyenv init -)" in my .zshrc
  6. I only have 1
  7. No, ~/.pyenv/plugins is empty

@ericsnowcurrently ericsnowcurrently removed the info-needed Issue requires more information from poster label Aug 22, 2019
@ericsnowcurrently
Copy link
Member

@vict0rsch, thanks for the info. We'll work on figuring out what's going on.

Also, when you click on the Python version on the left side of the status bar you should get the list of recognized interpreters. Do all of the ones listed by pyenv versions show up in that list? (A screenshot of that list would be helpful.) From your original message it sounds like you have selected the "3.7.4" entry (but are getting a "3.6.4" interpreter).

@vict0rsch
Copy link
Author

vict0rsch commented Aug 23, 2019

hmmm for some reason now it shows up. I have not updated anything. Maybe some cache entry got changed?

So now I still have the issue of the terminal quitting instantly as it is opened:

2019-08-23 00 57 31

Error says:

❯ source /Users/victor/.pyenv/shims/activate.sh
pyenv: activate.sh: command not found

The `activate.sh' command exists in these Python versions:
  2.7.14

But I don't understand what, in vscode's python extension, triggers this source: python works fine from the terminal, the interpreter too (I can format with black for instance) but somehow opening a terminal does not.

@ericsnowcurrently
Copy link
Member

How are you launching the terminal?

Also, from the screenshot (in the status bar) it looks like you have a system Python activated (selected), rather than a "pyenv" Python. Make sure the interpreter in the status bar has "(pyenv)" in it.

As to the command, "source activate.sh" is used when you have a virtual environment (e.g. venv, virtualenv) is active. For pyenv we do "pyenv shell". Your active Python environment appears to be neither, so it isn't clear what is going on.

@ericsnowcurrently ericsnowcurrently added the info-needed Issue requires more information from poster label Aug 27, 2019
@brettcannon
Copy link
Member

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.

@ghost ghost removed the triage label Oct 9, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants