Selected pipenv virtualenv is written to python.pythonPath
See original GitHub issueSince some time (I can’t say when exactly) the virutalenv is not recognized in my project. I open the project folder with vs code and as soon as the python extension is loaded, the system wide installation of python is recognized as interpreter, although there is a pipfile in my project folder.
Environment data
- VS Code version: 1.54.1
- Extension version (available under the Extensions sidebar): v2021.2.636928669
- OS and version: Windows 10, 20H2
- Python version (& distribution if applicable, e.g. Anaconda): 3.7.3
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): pipenv virutalenv
- Value of the
python.languageServer
setting: Pylance
Expected behaviour
the virutalenv is recognized and I don’t have to set the “python.pythonPath” setting explicitly.
Actual behaviour
The system-wide Python installation is selected as interpreter. When I change the interpreter to the pipenv virtualenv, the absolute path is entered into my settings.json. This is problematic because the virutalenv is in my user directory and so the path is not correct for all developers involved.
Details
The corresponding virtualenv is marked as “(cached)” in the interpreter selection.
I already tried the following commands:
- Python: Clear Workspace Interpreter Settings
- Python: Reset Stored Info for Untrusted Interpreters
both had no effect.
i also reinstalled vs code and deleted the folders in %appdata%, but still the virutalenv was not detected.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:12
Top GitHub Comments
Ahhhh my apologies I made a typo! I meant to reuse the json snippet but didn’t replace the experiment, it was supposed to be:
I had the same issue and confirm this solution works.