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.

Terminals don't have the virtualenv activated on reopening a workspace with a terminal

See original GitHub issue

VS Code version

1.63.2

Extension version

2021.12.1559732655

OS type

Windows

OS version

10.0.19044.0

Python distribution

python.org

Python version

3.10.1

Language server

Default

Expected behaviour

On reopening a previously opened workspace that had terminals open and uses a virtualenv, the newly started terminal has the virtualenv activated.

Actual behaviour

The virtualenv is not activated, I have to close and reopen a new terminal for the virtualenv to be activated, or activate it manually.

This can be particularly annoying when accidentally executing a pip command polluting the global environment by accident.

Steps to reproduce

  1. Open any folder with Python code.
  2. Create a virtualenv and select it as the Python interpreter for the extension.
  3. Open a terminal.
  4. Close VS Code.
  5. Reopen VS Code.

image

Logs

Experiment ‘pythonaacf’ is active Experiment ‘pythonTensorboardExperiment’ is active Experiment ‘PythonPyTorchProfiler’ is active Experiment ‘pythonDeprecatePythonPath’ is active

conda info --json ~/prj/cypcap/venv/bin/python ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py Python interpreter path: ./venv/bin/python /bin/python3 ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py /usr/bin/python3 ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py Starting Pylance language server. conda --version

Code of Conduct

  • I agree to follow this project’s Code of Conduct

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
lucamarra-beecommented, Feb 23, 2022

It’s not enabled by default.

I solved my issue using this setting: image (3)

0reactions
karthiknadigcommented, Sep 7, 2022

We have addressed environment activation issues in the recent releases. Please, try with the latest release and let us know if this is continuing to occur.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I activate a virtualenv inside PyCharm's terminal?
Go to Settings, Terminal, Default shell and add /K <path-to-your-activate. bat> .
Read more >
Pycharm Terminal fails to activate virtual env
When I click Terminal, it does not activate the virtualenv environment. How to recreate: I create a new project, selecting the option to......
Read more >
Gitpodifying — The Ultimate Guide
So I cloned their repository, and looked at their README for a way to build their code. After activating a Python 3.7 virtual...
Read more >
How to Set Up Virtualenv with Virtualenvwrapper on Ubuntu ...
Close and reopen your terminal when you're done. To create a virtual environment in Python3 and activate it immediately, use this command in ......
Read more >
Python/Virtual environment - ArchWiki
virtualenv is a tool used to create an isolated workspace for a Python application. It has various advantages such as the ability to...
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