-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Selected pipenv virtualenv is written to python.pythonPath #15634
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 @Urkallinger, thank you for reaching out! We made some changes to interpreter discovery (#12020), could you give them a try? To do so, open your machine's "python.experiments.optInto": [
"pythonDiscoveryModule"
], |
Hi @kimadeline, I have copied the setting into my settings. I also deleted the entry "python.pythonPath" from the workspace settings. After that I restarted vs code. Unfortunately the system wide Python was selected as interpreter again. I have installed pipenv (version 2020.11.15) in my system-wide Python. When I call the following command with it, it gives me the correct path to virtualenv in my user directory: |
Sorry for the response delay, and thank you for your patience! A couple of things here:
|
My environment is correctly detected and offered in the dropdown: As soon as I select my environment then, I get the entry
in my workspace settings. If I delete this entry, the system-wide python installation ( |
Could you copy here the output for Also, just to confirm, how did you create your virtual environment? Does the issue happen with newly created environments as well? |
Output panel
how did you create your virtual environment? The virtualenv is created and also updated as follows (these steps are automated by a python script):
Does the issue happen with newly created environments as well? Yes, even then this behavior occurs.
The system-wide python is now selected as interpreter. If I select the just created virutalenv, the path is entered in the settings. If I delete the entry, the system-wide python is selected again. The problem occurs on the notebook I have from my company. Can it be a permission problem? |
I may have misunderstood your issue 🙈 Can you try setting the following in your global settings.json:
and then reload VS Code and select your interpreter? |
Sorry, my title was indeed misleading. You had recommended the experiment "pythonDiscoveryModule" to me some time ago.
I tried it back then, unfortunately without success. I tried it again today with the current version of the Python Extension (v2021.4.765268190). But it still does not work. As before, in my workspace settings |
Ahhhh my apologies I made a typo! I meant to reuse the json snippet but didn't replace the experiment, it was supposed to be:
|
With the |
Thank you for reporting back, glad to hear it works now! |
I had the same issue and confirm this solution works. |
Since some time (I can't say when exactly) the virutalenv is not recognized in my project. I open the project folder with vs code and as soon as the python extension is loaded, the system wide installation of python is recognized as interpreter, although there is a pipfile in my project folder.
Environment data
python.languageServer
setting: PylanceExpected behaviour
the virutalenv is recognized and I don't have to set the "python.pythonPath" setting explicitly.
Actual behaviour
The system-wide Python installation is selected as interpreter.
When I change the interpreter to the pipenv virtualenv, the absolute path is entered into my settings.json.
This is problematic because the virutalenv is in my user directory and so the path is not correct for all developers involved.
Details
The corresponding virtualenv is marked as "(cached)" in the interpreter selection.
I already tried the following commands:
both had no effect.
i also reinstalled vs code and deleted the folders in %appdata%, but still the virutalenv was not detected.
The text was updated successfully, but these errors were encountered: