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.

Detect virutal envs recursively in all sub-directories in the workspace

See original GitHub issue

This issue is similar to #2470 but the solution doesn’t apply to me. I tried changing the “python.venvPath”: “${workspaceFolder}/venv” in setting.json but it didn’t help. As it can be seen in the screenshot, I can use the virtual environment using terminal.

Environment data

  • VS Code version: 1.45.1
  • Extension version (available under the Extensions sidebar): 2020.5.80290
  • OS and version: ubuntu 18.04 (Linux x64 4.15.0-101-generic)
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.6.9
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
  • Relevant/affected Python packages and their versions: XXX
  • Relevant/affected Python-related VS Code extensions and their versions: XXX
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info #3977): true
  • Value of the python.languageServer setting: “Microsoft”

Expected behaviour

Clicking on the interpretor on the left bottom should show all available interpretors including virtual environments.

Actual behaviour

virtual environment are not detected.

Steps to reproduce:

  1. click on the interpretor selection on the left bottom image

Logs

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
karthiknadigcommented, Jun 18, 2020

@PooyaJln With python.venvPath we only look in the immediate sub-directories. So if the venv folder is two levels down we will not automatically detect it. This would be an enhancement to how we detect virtual envs in the workspace.

1reaction
luabudcommented, Jun 18, 2020

Thanks for bringing this up, folks! I opened https://github.com/microsoft/vscode-docs/issues/3789 so we can update our docs to reflect that 😊

@yuvadm our plan is to deprecate the pythonPath setting, so you’ll still be able to select interpreters per workspace but that info won’t be stored in the settings.json file. We have this change on as an experiment, you can learn more about it here: https://github.com/microsoft/vscode-python/wiki/AB-Experiments#experiment---deprecatepythonpath

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Virtual Environments: A Primer
In this tutorial, you'll learn how to work with Python's venv module to create and manage separate virtual environments for your Python ...
Read more >
Copy file recursively to all deepest subdirectories
Solution: On the directory containing bar , find . -type d -links 2 -exec cp bar {} \;. Your original attempt find ....
Read more >
How to Search for Files Recursively into Subdirectories
You can do it with find only: find . -name '*.xml' . is the current directory. If you need to search in another...
Read more >
gitignore syntax - how to exclude virtualenv sub-directories?
This will ignore all sub directories in the venv folder. ... Pycharm for example asks where you want to set up a virtual...
Read more >
Using Python environments in VS Code
When you install into a virtual environment, any packages you install are installed only in that subfolder. When you then run a Python...
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