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.

Doesn't recognize venv of python

See original GitHub issue

Hi. I noticed that vs-code-runner doesn’t seem to recognize venv environment in python while VS Code’s terminal does so by default.

My purpose is that code runner will recognize python’s venv automatically.

In my case, I created .vscode and venv file on working directory, and more detail is following:

Working Directory:
   |---main.py ...etc
   |
   |--- .vscode
   |       |--- launch.json
   |       |--- settings.json
   |
   |--- venv
          |--- bin
          |--- include
          |--- lib
          |--- lib64
          |--- pip-selfcheck.json
          |--- pyvenv.cfg

I think I need additional setting and tried it again and again with little change,

for example, I noted on settings.json as following:

 "code-runner.executorMap": {
    "python": "source $workspaceRoot/venv/bin/activate && python",
}

However, I couldn’t achieve it. What should I do for it?

The key bind of this program is fascinating, so I’d like to solve this problem indeed.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
yaseralnajjarcommented, May 5, 2018

Too old… but maybe someone else got stuck in Windows, just add this line to your workspace settings:

"code-runner.executorMap": {"python": "call venv\\scripts\\activate.bat && python"}

2reactions
formulahendrycommented, Dec 17, 2017

Good to know you have found a solution. You could try to run it in the VS Code Integrated Terminal:

{
    "code-runner.runInTerminal": true
}

If your Integrated Terminal is /bin/bash, your previous command should work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode does not recognize venv - Stack Overflow
1. Open Settings in VSCode. · 2. Search for "python.terminal.activateEnvironment" · 3. If unchecked/unticked, then check/tick for both "User" and ...
Read more >
Configure a virtual environment | PyCharm Documentation
The main purpose of virtual environments is to manage settings and dependencies of a particular project regardless of other Python projects.
Read more >
Manage Python environments and interpreters - Visual Studio ...
If no environments appear, it means Visual Studio failed to detect any Python installations in standard locations. For example, you might have ...
Read more >
Python Virtual Envrironment in VS Code - YouTube
Python #VSCodeSetting up a python virtual environment in VS Code can be tricky, especially selecting the python interpreter appropriate for ...
Read more >
Solve Python Virtualenv: is not recognized as an internal or ...
In this tutorial, I would like to show you the python problem solution that “' virtualenv ' is not recognized as an internal...
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