Skip to content

Select interpreter popup does not shown any system, pyenv or virtualenv choice. #15439

Closed

Description

@erongd

Environment data

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

[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]

Expected behaviour

When click on select interpreter, the popup should shown all installed python interpreter including system, brew, pyenv and also virtualenv created under pyenv.

Actual behaviour

The select interpreter popup only shown the one interpreter under "/usr/bin/python3", no other interpreters shown like it use to be. However if manually select the desired interpreter/virtualenv through the system dialog box, everything else in python development seems to work just fine.

The extension output the following in the output window complaining of not able to resolve symbolic link, even though all those symbolic link are valid and create by default installation methods include system, brew or pyenv.

Error 2021-02-17 22:56:52: Failed to resolve symbolic link: [Error: ENOENT: no such file or directory, lstat '../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7'] {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: '../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7'
}

Error 2021-02-17 22:56:52: Failed to resolve symbolic link: [Error: ENOENT: no such file or directory, lstat '../Cellar/python@3.9/3.9.1_8/bin/python3'] {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: '../Cellar/python@3.9/3.9.1_8/bin/python3'
}
Error 2021-02-17 22:56:52: Failed to resolve symbolic link: [Error: ENOENT: no such file or directory, lstat '../Cellar/python@3.9/3.9.1_8/bin/python3.9'] {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: '../Cellar/python@3.9/3.9.1_8/bin/python3.9'
}

BTW, I tested the same setup on linux or windows, it works fine.

Activity

  1. added
    triage-neededNeeds assignment to the proper sub-team
    bugIssue identified by VS Code Team member as probable bug
    on Feb 18, 2021
  2. InterelaySolutions commented on Feb 18, 2021

    @InterelaySolutions

    Can also confirm this is happening to us. Rolling back to the previous version of the python extension fixes it for now.

  3. danieldorosz commented on Feb 18, 2021

    @danieldorosz

    +1. Have rolled back for now.

  4. marhoy commented on Feb 18, 2021

    @marhoy

    +1 For me as well. The "Python: Select Interpreter" dialog does not list any of the pyenv virtualenv environments.
    Downgrading to version v2021.1.502429796 solves the problem.

  5. karthiknadig commented on Feb 18, 2021

    @karthiknadig
    Member

    Have you manually opted into experiments? Check for this setting "python.experiments.optInto" = ["All"]. We have a new discovery mechanism, and it might be failing. You can opt into specific experiments if you need that. If you are NOT opted in any experiment let us know, there might be some interference going on with the new discovery module and the old one.

  6. danieldorosz commented on Feb 18, 2021

    @danieldorosz
  7. karthiknadig commented on Feb 18, 2021

    @karthiknadig
    Member

    @braineruption Can you try this and see if it helps? "python.experiments.optInto": ["pythonDiscoveryModule"]

  8. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Feb 18, 2021
  9. albireox commented on Feb 18, 2021

    @albireox

    I don't see any difference between having

    "python.experiments.enabled": true,
    "python.experiments.optInto": ["pythonDiscoveryModule"]
    

    or not.

  10. karthiknadig commented on Feb 18, 2021

    @karthiknadig
    Member

    José Sánchez-Gallego (@albireox) Can you share the paths to the interpreters that it is failing to detect? Also, can you share PYENV specific environment variable values?

  11. albireox commented on Feb 18, 2021

    @albireox

    It seems to be failing to detect all the pyenv virtualenvs from installations that are not conda. Apparently it finds the pyenv installations and venvs from conda:

    Screen Shot 2021-02-18 at 12 23 48

    but not others such as ~/.pyenv/versions/3.9.1/bin/python ~/.pyenv/versions/flicamera/bin/python. These are my pyenv versions:

      system
      2.7.13
      2.7.17
      2.7.18
      2.7.9
      3.10.0a5
      3.7.6
      3.8.3
      3.8.3/envs/sdsstools
      3.8.5
      3.8.6
      3.8.6/envs/archon-38
      3.9.0
      3.9.1
      3.9.1/envs/archon
      3.9.1/envs/basecam
      3.9.1/envs/cherno
      3.9.1/envs/datamodel
      3.9.1/envs/flicamera
      3.9.1/envs/jaeger
      3.9.1/envs/roboscheduler
      3.9.1/envs/sdssdb
      3.9.1/envs/tree
      3.9.1/envs/tron
      STUI
      STUI2
      archon
      archon-38
      basecam
      cerebro
      cherno
      chernosim
      clu
      coordio
      datamodel
      default
      drift
    * flicamera (set by /Users/albireo/Documents/Code/sdss5/flicamera/.python-version)
      fliswarm
      fps_monitor
      jaeger
      mangadesign
      miniconda3-latest
      miniconda3-latest/envs/3.9.0
      miniconda3-latest/envs/STUI
      miniconda3-latest/envs/STUI2
      miniconda3-latest/envs/cerebro
      miniconda3-latest/envs/chernosim
      miniconda3-latest/envs/clu
      miniconda3-latest/envs/coordio
      miniconda3-latest/envs/default
      miniconda3-latest/envs/drift
      miniconda3-latest/envs/fliswarm
      miniconda3-latest/envs/fps_monitor
      miniconda3-latest/envs/mangadesign
      miniconda3-latest/envs/pydl
      miniconda3-latest/envs/target_selection
      pydl
      roboscheduler
      sdssdb
      sdsstools
      target_selection
      tree
      tron
    

    And the environment variables

    Screen Shot 2021-02-18 at 12 26 46

    My system also has Python installations from homebrew, but I don't use them for development.

  12. 11 remaining items

  13. robsgreen commented on Feb 19, 2021

    @robsgreen

    I'm having the same issue. It seems that the discovery mechanism isn't able to follow symlinks any more.

    A workaround that I've found is to use "Enter Interpreter Path..." and enter the full path to the env's binary without going through the symlink. For example, to use the venv my-env:

    $ ls -l ~/.pyenv/versions/my-env
    lrwxr-xr-x  1 rob  staff  42 Feb 19 11:02 ~/.pyenv/versions/my-env -> ~/.pyenv/versions/3.8.6/envs/my-env

    In the "Enter Interpreter Path..." input, use:
    ~/.pyenv/versions/3.8.6/envs/my-env/bin/python

  14. albireox commented on Feb 19, 2021

    @albireox

    This seems fixed to me in the latest vscode-python insiders either with "python.experiments.optInto": ["pythonDiscoveryModule"] or without it, although I'm seeing some differences in the names of the venvs depending on whether the experiment is on or not.

  15. karthiknadig commented on Feb 19, 2021

    @karthiknadig
    Member

    We just pushed a point release with a fix for this. Please try and let us know.

  16. albireox commented on Feb 19, 2021

    @albireox

    Point release also works for me.

  17. erongd commented on Feb 19, 2021

    @erongd
    Author

    Point release also works for me too.

  18. robsgreen commented on Feb 19, 2021

    @robsgreen

    Works for me, thanks!

  19. karrtikr commented on Feb 19, 2021

    @karrtikr

    Glad it worked, closing this now. If it still happens let us know and we'll reopen the issue.

  20. LeoAzLiu commented on Feb 20, 2021

    @LeoAzLiu

    Do not work for me. 😢
    I use pyenv-win on window 10. The "pyenv" function never worked for me but the version v2021.2.576481509. I was exciting when I found it worked. Now it gone again. Is anything I need to config with my scene(pyenv-win)? Thanks!

  21. danieldorosz commented on Feb 20, 2021

    @danieldorosz

    Yup, worked for me too. Thanks for the quick turnaround.

  22. karthiknadig commented on Feb 20, 2021

    @karthiknadig
    Member

    laz (@LeoAzLiu) pyenv-win is detected in the new experimental version of the discovery code. You can get that by opting into it, ad this to your user settings:

    "python.experiments.enabled": true,
    "python.experiments.optInto": ["pythonDiscoveryModule"]
    

    image

  23. LeoAzLiu commented on Feb 21, 2021

    @LeoAzLiu

    Karthik Nadig (@karthiknadig) Thanks a lot. It works great! By the way I think the pyenv-win is supported. Why the issue #15304 is still marked as "needs decision"? It is just a little confuse. But it is OK. It works! Thanks again! 👍

  24. ulises-castro commented on Mar 31, 2021

    @ulises-castro

    For my case, What it was worked:

    "python.defaultInterpreterPath": "/home/{USER}/.pyenv/versions/{PROJECT}/bin/python",
    "python.experiments.enabled": true,
    "python.experiments.optInto": [
        "pythonDiscoveryModule"
    ]
    
  25. ravigomez commented on Aug 16, 2021

    @ravigomez

    For my case, What it was worked:

    "python.defaultInterpreterPath": "/home/{USER}/.pyenv/versions/{PROJECT}/bin/python",
    "python.experiments.enabled": true,
    "python.experiments.optInto": [
        "pythonDiscoveryModule"
    ]
    

    For me it worked on windows. I used "python.defaultInterpreterPath": "%USERPROFILE%.pyenv\pyenv-win\bin"

  26. locked as resolved and limited conversation to collaborators on Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions