I've installed the package Pillow outside the virtual environment created using pipenv. But when I try to make migrations for my django project in this environment, it says Pillow is not installed and asks to install it. I think I installed pillow globally but it is not accessible by the pipenv virtual environment. I'm using python 3.8 and use sublime3 as editor.
Asked
Active
Viewed 2,064 times
4
-
Can you print out sys.path from within your venv? What's the location of your global pillow? – Azamat Galimzhanov Apr 14 '20 at 15:47
-
That's by design that virtualenvs can't access system-wide installed modules. To prevent this behavior, use `--system-site-packages` when creating the virtualenv. For pipenv I think the flag is `--site-packages` – jordanm Apr 14 '20 at 15:56
-
Correct. Can recreate a new python env with --system-site-packages as recommended above to include global packages. Then in future if you would like packages only in your environment be sure to have your env activated before doing a pip install – Josh Apr 14 '20 at 16:35
-
@AzamatGalimzhanov I can print out sys.path within my venv. Location of global pillow is c:\Program Files\Python38\Lib\Site-packages, should I add this path to my venv?How? – Gagan karanth Apr 14 '20 at 16:50
-
1It is solved. I changed include-system-site-packages to true in pyvenv.cfg file – Gagan karanth Apr 14 '20 at 17:05
1 Answers
1
Packages installed globally are not available in a virtual environment.
You can install django using command python -m pip install Django
.
List all installed packages available using pip list
.

Aditya Bandal
- 41
- 1
- 4