Where does pipenv install packages?
Question:
Answers:
As per Daniel Roseman’s comment, all I needed to do what tell vscode
about the virtual environment created by pipenv
pipenv installs packages in ~/.local/share/virtualenvs/
To find the complete path, you can run pipenv --venv
The easiest way to load this into VS Code is to:
- open the command palette
CTRL + SHIFT + P
- search for
Python: Select Interpreter
- Select the option indicated by
PipEnv
On windows machines start pipenv pipenv shell
then where python
to get the path to your scripts
/Users//.local/share/virtualenvs//lib/python3.9/site-packages
I spent like 2 hours trying to figure out what I was doing wrong (the files would run but the imports would not resolve). Turns out it’s surprisingly simple.
Go to the root of your project & open up a new terminal. Use the following commands to open a shell and get the location of the virtual environment.
>>> pipenv shell
>>> pipenv --venv
C:Usersgasma.virtualenvsdungeon-generator-MV179gUf
If you open up this in the file explorer, you’ll find exactly where the modules are being installed.
From here, you can create a new .vscode/settings.json
file (still in your project directory) to let VS Code know what’s up.
In my case, I typed this in:
{
"python.autoComplete.extraPaths": ["C:/Users/gasma/.virtualenvs/dungeon-generator-MV179gUf/Lib/site-packages"],
"python.analysis.extraPaths": ["C:/Users/gasma/.virtualenvs/dungeon-generator-MV179gUf/Lib/site-packages"]
}
Make sure your replace the file paths with the one you got from running pipenv --venv
. To run your project, just use python <file>.py
, and to exit the virtual environment, simply type exit
.
As per Daniel Roseman’s comment, all I needed to do what tell vscode
about the virtual environment created by pipenv
pipenv installs packages in ~/.local/share/virtualenvs/
To find the complete path, you can run pipenv --venv
The easiest way to load this into VS Code is to:
- open the command palette
CTRL + SHIFT + P
- search for
Python: Select Interpreter
- Select the option indicated by
PipEnv
On windows machines start pipenv pipenv shell
then where python
to get the path to your scripts
/Users//.local/share/virtualenvs//lib/python3.9/site-packages
I spent like 2 hours trying to figure out what I was doing wrong (the files would run but the imports would not resolve). Turns out it’s surprisingly simple.
Go to the root of your project & open up a new terminal. Use the following commands to open a shell and get the location of the virtual environment.
>>> pipenv shell
>>> pipenv --venv
C:Usersgasma.virtualenvsdungeon-generator-MV179gUf
If you open up this in the file explorer, you’ll find exactly where the modules are being installed.
From here, you can create a new .vscode/settings.json
file (still in your project directory) to let VS Code know what’s up.
In my case, I typed this in:
{
"python.autoComplete.extraPaths": ["C:/Users/gasma/.virtualenvs/dungeon-generator-MV179gUf/Lib/site-packages"],
"python.analysis.extraPaths": ["C:/Users/gasma/.virtualenvs/dungeon-generator-MV179gUf/Lib/site-packages"]
}
Make sure your replace the file paths with the one you got from running pipenv --venv
. To run your project, just use python <file>.py
, and to exit the virtual environment, simply type exit
.