question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Selected pipenv virtualenv is written to python.pythonPath

See original GitHub issue

Since 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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:12

github_iconTop GitHub Comments

3reactions
kimadelinecommented, Apr 21, 2021

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:

"python.experiments.optInto": [        
        "DeprecatePythonPath - experiment"
]
0reactions
sidneydemoraescommented, May 7, 2021

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:

"python.experiments.optInto": [        
        "DeprecatePythonPath - experiment"
]

I had the same issue and confirm this solution works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get path of virtual environment in pipenv - Stack Overflow
The following should give you the paths $ pipenv --where /home/wonder/workspace/myproj $ pipenv --venv /home/wonder/PyEnvs/myproj-BKbQCeJj.
Read more >
Pipenv & Virtual Environments
Pipenv is a dependency manager for Python projects. If you're familiar with Node.js' npm or Ruby's bundler, it is similar in spirit to...
Read more >
pipenv install --python path/to/specific doesn't seem to work ...
The virtualenv creation process seems to work fine, but when I start pipenv shell , it seems to be using python 2.7.6.
Read more >
How to manage your python virtualenvs with Pipenv - Medium
Select an env · Open settings · Go to project interpreter · If you have a pipenv that you want to share across...
Read more >
Pipenv & Virtual Environments
This guide is written for Python 3, however, these instructions should work ... for a Python workflow like virtualenv, pipenv, tox, and similar...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found