-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Can't autodetect pipenv in WSL #12482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @kimadeline, thanks for your response. I would like to apologize in advance for my incompetence - I'm going through the AWS course that uses Python for automation, so my experience with it is tiny and I'm just trying to figure out what is going on. To your question - yes I can select pipenv manually from the list of available interpreters, but from reading instructions on the internet I thought that that was supposed to happen automatically. Now I'm curious why wouldn't anybody want to select the correct interpreter by default, but I wasn't able to find any insight on that. There is still a small issue with this - if I select interpreter manually, the first bash window that opens automatically does not activate virtual env, while all bash windows I create manually are activating it. But even more to that - it seems like pipenv doesn't really like that it's executed inside a virtual environment (it complains when I run something using Overall, it seems like this issue I've reported is not actually an issue and this thread can be closed. But I still have a feeling that I'm doing something wrong. The fact that pipenv interpreter is not selected by default and the fact that pipenv and vs code aren't really well integrated (besides pylint install) Leeds me to believe that I'm not using Python + VSCode the way most people use it. So is the problem in me using WSL, me using pipenv, or me using combination of them in a fundamentally wrong way? Thanks again for your answer and sorry for bothering you with silly questions. |
Hi @astashko, Don't apologize, these are not silly questions! We all start somewhere, so thank you for working with me to find a solution 😊 We don't automatically select pipenv environments the first time the Python extension activates in a workspace, you'll have to pick it manually from the list of interpreters. Once set, the extension should remember the interpreter you chose every time it gets activated in the workspace by opening a Python file (the extension doesn't automatically activate if there are no files open, see #4765). Is the pipenv interpreter remembered, or do you have to re-select it every time the extension activates?
Setting
Could you elaborate a bit on that? Do you also have repro steps and sample code (a sample repository would be great) I could use to try and replicate this issue? |
Following this issue, I have it too. Whenever I create a new python project and I open it in VSCode with If you could help me with some workaround to this I would appreciate it much because sometimes I forgot to set the correct interpreter and gives me so much errors. Thanks |
Hi @scratchmex, thank you for reaching out! Could you copy here the output for A couple of things to note here:
|
New pipenv project without Starting Jedi Python language engine.
Python interpreter path: ~/.local/share/virtualenvs/backend-vQU3uVba/bin/python I don't know from where it is taking that python interpreter path (it is also activating it when opening integrated shell) because the only Python setting I have is ❯ where python
/home/ivan/.local/share/virtualenvs/backend-vQU3uVba/bin/python
/usr/bin/python That virtualenv is the previous pipenv interpreter I'm referring to, as in EVERY new project it selects that specific venv. This is my whole {
"python.linting.flake8Enabled": true,
"python.venvPath": "~/.local/share/virtualenvs",
"editor.fontFamily": "FiraCode NF, Consolas, 'Courier New', monospace",
"editor.fontSize": 15,
"python.formatting.provider": "black"
} The solution was to remove the problematic venv but if you could guide me to some troubleshoot of why was it selecting that specific venv I would appreciate it. Thanks |
Could you copy the beginning of the logging output, including the When you type This environment is most likely selected because the extension tries to locate different types of environments (global python install, conda install, virtual environment in the current workspace, among others), and tries to guess which environment would be the most appropriate. In your case, the guess is incorrect 🙂 What happens if you add a value to the Thanks! |
With normal WSL I get |
Closing since the original issue was caused by our pipenv changes, and second issue should be addressed by refactoring our environment discovery #12020 (could not repro either). |
Environment data
Expected behaviour
When I open remote folder that contains Pipfile, pipfile interpreter is autodetected and virtual env activated
Actual behaviour
The interpreter is non-pipenv 3.8.2
Steps to reproduce:
pip3 install pipenv
.pipenv --three
.pipenv install boto3
.Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
; turn on source maps to make any tracebacks be useful by runningEnable source map support for extension debugging
)The text was updated successfully, but these errors were encountered: