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.

Pipenv environments not activated via pipenv

See original GitHub issue

Environment data

  • VS Code version: 1.54.3
  • Extension version (available under the Extensions sidebar): v2021.3.658691958
  • OS and version: Windows 10 + [WSL1] Ubuntu 20.04
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): pipenv
  • Relevant/affected Python packages and their versions: none
  • Relevant/affected Python-related VS Code extensions and their versions: none
  • Value of the python.languageServer setting: Jedi

Expected behaviour

Virtual environments created with pipenv should be activated via pipenv shell (pipenv initializes the environment in slightly more steps, most important of which for me personally is loading an .env file).

Actual behaviour

Virtual environments created with pipenv are activated via source /home/user/.local/share/virtualenvs/project-hash/bin/activate.

Steps to reproduce:

  1. Create a folder.
  2. Run pipenv shell in that folder.
  3. Open that folder in VS Code.
  4. Select Python interpreter for the virtual environment created with pipenv.
  5. Open new terminal in VS Code.

Logs

Output for Python in the Output panel

User belongs to experiment group 'pythonaa'
User belongs to experiment group 'pythonSendEntireLineToREPL'
User belongs to experiment group 'pythonNotDisplayLinterPrompt'
User belongs to experiment group 'pythonFindInterpreter'
User belongs to experiment group 'ShowExtensionSurveyPrompt - enabled'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'DeprecatePythonPath - experiment'
> conda --version
> python3.7 ~/.vscode-server/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode-server/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 ~/.vscode-server/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode-server/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-server/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-server/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> conda info --json
> python ~/.vscode-server/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-server/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-server/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-server/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-server/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-server/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
Error 2021-03-17 16:41:27: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file 'vscode-remote://wsl+ubuntu-20.04/home/feakuru/.config/Code/User/settings.json' (Error: Unable to resolve non-existing file 'vscode-remote://wsl+ubuntu-20.04/home/feakuru/.config/Code/User/settings.json')
	at _handleError (/home/feakuru/.vscode-server/bin/2b9aebd5354a3629c3aba0a5f5df49f43d6689f8/out/vs/server/remoteExtensionHostProcess.js:87:151863)
	at async y.readText (/home/feakuru/.vscode-server/extensions/ms-python.python-2021.3.658691958/out/client/extension.js:9:328725)
	at async p.doesFileNeedToBeFixed (/home/feakuru/.vscode-server/extensions/ms-python.python-2021.3.658691958/out/client/extension.js:61:578194)
	at async /home/feakuru/.vscode-server/extensions/ms-python.python-2021.3.658691958/out/client/extension.js:61:577321
	at async Promise.all (index 0)
	at async p.getFilesToBeFixed (/home/feakuru/.vscode-server/extensions/ms-python.python-2021.3.658691958/out/client/extension.js:61:577267)
	at async p.updateTestSettings (/home/feakuru/.vscode-server/extensions/ms-python.python-2021.3.658691958/out/client/extension.js:61:576894)] {
  code: 'FileNotFound'
}
Error 2021-03-17 16:41:27: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file 'vscode-remote://wsl+ubuntu-20.04/home/feakuru/projects/project/.vscode/settings.json' (Error: Unable to resolve non-existing file 'vscode-remote://wsl+ubuntu-20.04/home/feakuru/projects/project/.vscode/settings.json')
	at _handleError (/home/feakuru/.vscode-server/bin/2b9aebd5354a3629c3aba0a5f5df49f43d6689f8/out/vs/server/remoteExtensionHostProcess.js:87:151863)
	at async y.readText (/home/feakuru/.vscode-server/extensions/ms-python.python-2021.3.658691958/out/client/extension.js:9:328725)
	at async p.doesFileNeedToBeFixed (/home/feakuru/.vscode-server/extensions/ms-python.python-2021.3.658691958/out/client/extension.js:61:578194)
	at async /home/feakuru/.vscode-server/extensions/ms-python.python-2021.3.658691958/out/client/extension.js:61:577321
	at async Promise.all (index 1)
	at async p.getFilesToBeFixed (/home/feakuru/.vscode-server/extensions/ms-python.python-2021.3.658691958/out/client/extension.js:61:577267)
	at async p.updateTestSettings (/home/feakuru/.vscode-server/extensions/ms-python.python-2021.3.658691958/out/client/extension.js:61:576894)] {
  code: 'FileNotFound'
}
Starting Jedi Python language engine.
Python interpreter path: ~/.local/share/virtualenvs/project-hash/bin/python
> conda --version

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
karthiknadigcommented, Mar 19, 2021

@feakuru for WSL you have to set that in the WSL settings (see screenshot below). I thought this was a issue with detection, but, as @karrtikr suggested this is not. It is an issue with how commands are sent to the terminal.

image

1reaction
karrtikrcommented, Mar 19, 2021

@feakuru If you check out the terminal in #4404, the pipenv shell and pipenv install commands are sent back to back, with pipenv install sent before pipenv shell has finished execution. That is a problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pipenv environment is not activated using pipenv shell #16988
Set the default integrated terminal to GitBash; Create new Pipenv environment; Set the project interpreter to the adequate venv; Open a new ...
Read more >
pipenv shell, does not activate the virtual environment
Hi, pipenv uses virtualenv. The env that pipenv creates has an activate you can call just like one created with virtualenv, because it...
Read more >
Advanced Usage of Pipenv - Read the Docs
Pipenv comes with a handful of options that can be enabled via shell environment variables. To activate them, simply create the variable in...
Read more >
How to manage your python virtualenvs with Pipenv - Medium
Activate the environment. To open a shell with the already created virtualenv pipenv shell. You would see something like below: Launching subshell in ......
Read more >
Pipenv & Virtual Environments - Python Packaging Authority
It is recommended that users on most platforms should install pipenv from pypi.org using pip install pipenv . ☤ Isolated Installation of Pipenv...
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