Skip to content

The Python extension does not suggest virtual environments from pyenv #15457

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

Closed
MattisTrygstad opened this issue Feb 19, 2021 · 3 comments
Closed
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@MattisTrygstad
Copy link

MattisTrygstad commented Feb 19, 2021

Environment data

  • VS Code version: 1.53.2
  • Extension version (available under the Extensions sidebar): v2021.2.576481509
  • OS and version: MacOS 10.14.5
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pyenv virtualenv
  • Relevant/affected Python packages and their versions: N/A
  • Relevant/affected Python-related VS Code extensions and their versions: N/A
  • Value of the python.languageServer setting: Pylance

Expected behaviour

All environments created using pyenv virtualenv are listed as options when selecting interpreter.

Actual behaviour

Only system installations and the pyenv installations of Python 3.8.6 is suggested, not any of the virtual environments created. I have tried reinstalling VS Code, the Python extension, as well as pyenv and virtualenv (using homebrew). The .pyenv folder is located at /Users/username/.pyenv. This has never been an issue for me before today.

Steps to reproduce:

  1. Install VS Code 1.53.2
  2. Install Python and Pylance extensions
  3. Install pyenv and virtualenv using homebrew
  4. Install Python 3.8.6 with pyenv
  5. Create a new enironment using pyenv virtualenv
  6. Restart VS Code
  7. The created environment is not suggested when selecting an interpreter

Logs

N/A

Please let me know if you need any further information regarding this issue.

@MattisTrygstad MattisTrygstad added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Feb 19, 2021
@MattisTrygstad
Copy link
Author

This is my current User settings related to Python from settings.json:

  "python.linting.enabled": true,
  "files.autoSave": "off",
  "python.languageServer": "Pylance",
  "editor.formatOnPaste": true,
  "python.formatting.provider": "autopep8",
  "python.formatting.autopep8Args": ["--ignore=E501"],
  "python.showStartPage": false,
  "[python]": {
    "editor.defaultFormatter": "ms-python.python"
  },
  "files.exclude": {
    "**/__pycache__": true
  },
  "python.autoComplete.extraPaths": ["${workspaceFolder}/src"],
  "python.analysis.extraPaths": ["${workspaceFolder}/src"],
  "python.pythonPath": "/Users/username/.pyenv/shims/python",
  "pylance.insidersChannel": "daily",
  "python.analysis.typeCheckingMode": "off",
  "python.analysis.autoImportCompletions": true

@MattisTrygstad MattisTrygstad changed the title The Python extension does suggest virtual environments from pyenv The Python extension does not suggest virtual environments from pyenv Feb 19, 2021
@brybalicious
Copy link

brybalicious commented Feb 19, 2021

I am having the opposite problem on windows 10 with WSL 2, using visual studio code insiders.

I finally set up pyenv so that pyenv shims come first in the path, and added a symlink so that python in usr/bin/python points to usr/bin/python3 and thus system python is available when running pyenv versions.

Now, however, in visual studio code insiders, the system python doesn't show up as an available interpreter (which I would imagine should be found automatically in usr/bin/python. I can add it manually though, but it doesn't persist beyond one session. Should I be making another issue for this?

@brettcannon
Copy link
Member

This is a duplicate of #15439

@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Feb 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2021
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
Projects
None yet
Development

No branches or pull requests

3 participants