Skip to content

Python interpreter or virtual environments not being listed when opening a specific folder #18437

Closed

Description

Issue Type: Bug

Behaviour

Expected vs. Actual

Expected: Python installation should be detected and a list of the Python interpreter and any virtual environment shouldbe displayed.

Actual: When opening a specific folder, the Python installation is not detected. A pop up stating that Python is not installed comes up. No available Python interpreters or virtual environments are shown.

Steps to reproduce:

  1. Open folder: C:\Users\user_name\Desktop\University\4. Spring 2022[CS-1205] Algorithm Design and Analysis (Professor Name)\code
  2. Open a .py file

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.7
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): PipEnv
  • Value of the python.languageServer setting: Default
User Settings


defaultLS: {"defaultLSType":"Pylance"}

downloadLanguageServer: true

envFile: "<placeholder>"

venvPath: "<placeholder>"

venvFolders: "<placeholder>"

condaPath: "<placeholder>"

pipenvPath: "<placeholder>"

poetryPath: "<placeholder>"

languageServer: "Pylance"

linting
• enabled: true
• cwd: "<placeholder>"
• Flake8Args: "<placeholder>"
• flake8Enabled: false
• flake8Path: "<placeholder>"
• lintOnSave: true
• banditArgs: "<placeholder>"
• banditEnabled: false
• banditPath: "<placeholder>"
• mypyArgs: "<placeholder>"
• mypyEnabled: false
• mypyPath: "<placeholder>"
• pycodestyleArgs: "<placeholder>"
• pycodestyleEnabled: false
• pycodestylePath: "<placeholder>"
• prospectorArgs: "<placeholder>"
• prospectorEnabled: false
• prospectorPath: "<placeholder>"
• pydocstyleArgs: "<placeholder>"
• pydocstyleEnabled: false
• pydocstylePath: "<placeholder>"
• pylamaArgs: "<placeholder>"
• pylamaEnabled: false
• pylamaPath: "<placeholder>"
• pylintArgs: "<placeholder>"
• pylintPath: "<placeholder>"

sortImports
• args: "<placeholder>"
• path: "<placeholder>"

formatting
• autopep8Args: "<placeholder>"
• autopep8Path: "<placeholder>"
• provider: "autopep8"
• blackArgs: "<placeholder>"
• blackPath: "<placeholder>"
• yapfArgs: "<placeholder>"
• yapfPath: "<placeholder>"

testing
• cwd: "<placeholder>"
• debugPort: 8000
• nosetestArgs: "<placeholder>"
• nosetestsEnabled: undefined
• nosetestPath: "<placeholder>"
• promptToConfigure: true
• pytestArgs: "<placeholder>"
• pytestEnabled: false
• pytestPath: "<placeholder>"
• unittestArgs: "<placeholder>"
• unittestEnabled: false
• autoTestDiscoverOnSaveEnabled: true

terminal
• activateEnvironment: true
• executeInFileDir: "<placeholder>"
• launchArgs: "<placeholder>"

experiments
• enabled: true
• optInto: []
• optOutFrom: []

insidersChannel: "off"

tensorBoard
• logDirectory: "<placeholder>"

Extension version: 2022.0.1786462952
VS Code version: Code 1.64.0 (5554b12acf27056905806867f251c859323ff7e9, 2022-02-03T04:22:20.678Z)
OS version: Windows_NT x64 10.0.22000
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (8 x 1800)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.86GB (1.12GB free)
Process Argv --crash-reporter-id 6c73aa67-01c6-431e-8394-db5f8769137e
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
pythonvspyl392cf:30425750
pythontb:30283811
pythonvspyt551cf:30345471
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30433059
pythonvs932:30410667
vs360:30404995
vsrem710:30416614

Activity

  1. tashi21 commented on Feb 4, 2022

    @tashi21
    Author

    Moving the folder to another folder (in this case the Desktop) worked. No errors were being shown. Is the problem in the way my earlier folder is named? It seems unlikely because everything was working all fine until my VSCode was updated to the January release. Right until then it was working with no issues.

  2. TJKlein commented on Feb 4, 2022

    @TJKlein

    I have the same issue with VSCode (Mac). The item in the status bar, where one previously could select the interpreter has disappeared. For me, there is no pop-up warning of no installation. It just uses the default Python environment and there is no option of changing it.

    I could fix it by deleting VSCode (from the application folder) and installing it again. Then it worked and showed the different Python enviroments.

  3. brettcannon commented on Feb 4, 2022

    @brettcannon
    Member

    Tassilo Klein (@TJKlein) this actually isn't the same issue for you as you're probably in an experiment we are running; see #18283 .

  4. karrtikr commented on Feb 4, 2022

    @karrtikr

    Paritosh Panda (@tashi21) That could indeed be the case, can you provide the logs as mentioned in the issue template in the scenario when this issue was happening?

    Logs

    Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

    XXX
    

  5. tashi21 commented on Feb 4, 2022

    @tashi21
    Author
    Experiment 'pythonaacf' is active
    Experiment 'pythonTensorboardExperiment' is active
    Experiment 'pythonSurveyNotificationcf' is active
    Experiment 'PythonPyTorchProfiler' is active
    Experiment 'pythonDeprecatePythonPath' is active
    [ERROR 2022-1-5 4:32:5.252]: Failed to initialize source map support in extension
    [ERROR 2022-1-5 4:32:6.56]: SyntaxError: Invalid regular expression: /c:(\\|/)Users(\\|/)tashi(\\|/)Desktop(\\|/)Ashoka(\\|/)4. Spring 2022(\\|/)[CS-1205] Algorithm Design and Analysis (Debayan Gupta)(\\|/)code/: Range out of order in character class
        at new RegExp (<anonymous>)
        at replaceMatchesWithCharacter (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:56:17)
        at d.getDisplayCommands (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:40:23)
        at d.logProcess (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:30:33)
        at s.emit (events.js:315:20)
        at shellExec (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\proc.ts:47:14)
        at Object.result [as shellExecute] (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\pythonEnvironments\common\externalDependencies.ts:19:20)
        at Object.t.getInterpreterInfo (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\pythonEnvironments\base\info\interpreter.ts:44:11)
        at c.result [as workerFunc] (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\pythonEnvironments\base\info\environmentInfoService.ts:21:5)
        at start (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\utils\workerPool.ts:27:27)
    [ERROR 2022-1-5 4:32:6.994]: SyntaxError: Invalid regular expression: /c:(\\|/)Users(\\|/)tashi(\\|/)Desktop(\\|/)Ashoka(\\|/)4. Spring 2022(\\|/)[CS-1205] Algorithm Design and Analysis (Debayan Gupta)(\\|/)code/: Range out of order in character class
        at new RegExp (<anonymous>)
        at replaceMatchesWithCharacter (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:56:17)
        at d.getDisplayCommands (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:40:23)
        at d.logProcess (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:30:33)
        at s.emit (events.js:315:20)
        at shellExec (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\proc.ts:47:14)
        at Object.result [as shellExecute] (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\pythonEnvironments\common\externalDependencies.ts:19:20)
        at Object.t.getInterpreterInfo (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\pythonEnvironments\base\info\interpreter.ts:44:11)
        at c.result [as workerFunc] (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\pythonEnvironments\base\info\environmentInfoService.ts:21:5)
        at start (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\utils\workerPool.ts:27:27)
    Python interpreter path: ~\.virtualenvs\Python-mngXoFa0\Scripts\python.exe
    [ERROR 2022-1-5 4:32:7.174]: getActivatedEnvironmentVariables SyntaxError: Invalid regular expression: /c:(\\|/)Users(\\|/)tashi(\\|/)Desktop(\\|/)Ashoka(\\|/)4. Spring 2022(\\|/)[CS-1205] Algorithm Design and Analysis (Debayan Gupta)(\\|/)code/: Range out of order in character class
        at new RegExp (<anonymous>)
        at replaceMatchesWithCharacter (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:56:17)
        at d.getDisplayCommands (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:40:23)
        at d.logProcess (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:30:33)
        at s.emit (events.js:315:20)
        at shellExec (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\proc.ts:47:14)
        at P.getActivatedEnvironmentVariablesImpl (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\interpreter\activation\service.ts:157:51)
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
    [ERROR 2022-1-5 4:32:7.248]: SyntaxError: Invalid regular expression: /c:(\\|/)Users(\\|/)tashi(\\|/)Desktop(\\|/)Ashoka(\\|/)4. Spring 2022(\\|/)[CS-1205] Algorithm Design and Analysis (Debayan Gupta)(\\|/)code/: Range out of order in character class
        at new RegExp (<anonymous>)
        at replaceMatchesWithCharacter (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:56:17)
        at d.getDisplayCommands (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:40:23)
        at d.logProcess (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:30:33)
        at s.emit (events.js:315:20)
        at shellExec (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\proc.ts:47:14)
        at Object.result [as shellExecute] (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\pythonEnvironments\common\externalDependencies.ts:19:20)
        at Object.t.getInterpreterInfo (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\pythonEnvironments\base\info\interpreter.ts:44:11)
        at c.result [as workerFunc] (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\pythonEnvironments\base\info\environmentInfoService.ts:21:5)
        at start (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\utils\workerPool.ts:27:27)
    [ERROR 2022-1-5 4:32:7.353]: SyntaxError: Invalid regular expression: /c:(\\|/)Users(\\|/)tashi(\\|/)Desktop(\\|/)Ashoka(\\|/)4. Spring 2022(\\|/)[CS-1205] Algorithm Design and Analysis (Debayan Gupta)(\\|/)code/: Range out of order in character class
        at new RegExp (<anonymous>)
        at replaceMatchesWithCharacter (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:56:17)
        at d.getDisplayCommands (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:40:23)
        at d.logProcess (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\logger.ts:30:33)
        at s.emit (events.js:315:20)
        at shellExec (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\process\proc.ts:47:14)
        at Object.result [as shellExecute] (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\pythonEnvironments\common\externalDependencies.ts:19:20)
        at Object.t.getInterpreterInfo (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\pythonEnvironments\base\info\interpreter.ts:44:11)
        at c.result [as workerFunc] (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\pythonEnvironments\base\info\environmentInfoService.ts:21:5)
        at start (c:\Users\tashi\.vscode\extensions\ms-python.python-2022.0.1786462952\src\client\common\utils\workerPool.ts:27:27)
    [ERROR 2022-1-5 4:32:8.248]: No python is installed or a refresh has not already been triggered
    Starting Pylance language server.
    [ERROR 2022-1-5 4:32:9.311]: No python is installed or a refresh has not already been triggered
    Diagnostic Code: NoPythonInterpretersDiagnostic, Message: Python is not installed. Please download and install Python before using the extension.
    
    Linter 'pylint' is not installed. Please install it or select another linter".
    SyntaxError: Invalid regular expression: /c:(\\|/)Users(\\|/)tashi(\\|/)Desktop(\\|/)Ashoka(\\|/)4. Spring 2022(\\|/)[CS-1205] Algorithm Design and Analysis (Debayan Gupta)(\\|/)code/: Range out of order in character class
    [ERROR 2022-1-5 4:33:7.396]: No python is installed or a refresh has not already been triggered
    
  6. added
    area-environmentsFeatures relating to handling interpreter environments
    bugIssue identified by VS Code Team member as probable bug
    investigatingWe are looking into the cause of the issue
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Feb 5, 2022
  7. karrtikr commented on Apr 11, 2022

    @karrtikr

    Fixed with #18878, should be out in the pre-release version of the extension in a day. To try it:

    image

  8. locked as resolved and limited conversation to collaborators on May 12, 2022
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 buginvestigatingWe are looking into the cause of the issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions