Sep-04-2021, 01:01 AM
I am using pipenv v2021.5.29 to create an environment for running a script. I have a requirements.txt script with all the packages needed. The contents of the requirements.txt are at bottom of post.
I installed pipenv with
requirements.txt:
I installed pipenv with
python3 -m pip install --user pipenvThen I ran:
pipenv shell
Output:Creating a virtualenv for this project...
Pipfile: C:\Users\john\Documents\programming\imseg\Pipfile
Using C:/OSGeo4W/bin/python3.exe (3.9.5) to create virtualenv...
[ ===] Creating virtual environment...created virtual environment CPython3.9.5.final.0-64 in 742ms
creator CPython3Windows(dest=C:\Users\john\.virtualenvs\imseg-cT2t34Fc, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\john\AppData\Local\pypa\virtualenv)
added seed packages: pip==21.2.2, setuptools==57.4.0, wheel==0.36.2
activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator
Successfully created virtual environment!
Virtualenv location: C:\Users\john\.virtualenvs\imseg-cT2t34Fc
Launching subshell in virtual environment...
Microsoft Windows [Version 10.0.19043.1165]
(c) Microsoft Corporation. All rights reserved.
I usedpipenv install
Output:Installing dependencies from Pipfile.lock (a70a42)...
================================ 19/19 - 00:00:37
It seems like the requirements were installed without problem. I confirm this withpipenv graph
Output:Cython==0.29.24
GitPython==3.1.18
- gitdb [required: >=4.0.1,<5, installed: 4.0.7]
- smmap [required: >=3.0.1,<5, installed: 4.0.0]
matplotlib==3.4.2
- cycler [required: >=0.10, installed: 0.10.0]
- six [required: Any, installed: 1.16.0]
- kiwisolver [required: >=1.0.1, installed: 1.3.1]
- numpy [required: >=1.16, installed: 1.21.1]
- pillow [required: >=6.2.0, installed: 8.3.1]
- pyparsing [required: >=2.2.1, installed: 2.4.7]
- python-dateutil [required: >=2.7, installed: 2.8.2]
- six [required: >=1.5, installed: 1.16.0]
opencv-python==4.5.3.56
- numpy [required: >=1.19.3, installed: 1.21.1]
pandas==1.3.1
- numpy [required: >=1.17.3, installed: 1.21.1]
- python-dateutil [required: >=2.7.3, installed: 2.8.2]
- six [required: >=1.5, installed: 1.16.0]
- pytz [required: >=2017.3, installed: 2021.1]
rawpy==0.16.0
- numpy [required: Any, installed: 1.21.1]
torchvision==0.10.0
- numpy [required: Any, installed: 1.21.1]
- pillow [required: >=5.3.0, installed: 8.3.1]
- torch [required: ==1.9.0, installed: 1.9.0]
- typing-extensions [required: Any, installed: 3.10.0.0]
However, when I run my script withpython3 model_to_green_value.pyI get this
Error:Traceback (most recent call last):
File "C:\Users\john\Documents\programming\imseg\model_to_green_value.py", line 14, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
I'm using Windows 10. I'm new to virtual environments and pipenv. I thought that installing pipenv and using it the way I have is the correct procedure for recreating the environment in which to run the script, so I don't know why this error occurs. How do I fix this? requirements.txt:
Output:#
# These requirements were autogenerated by pipenv
# To regenerate from the project's Pipfile, run:
#
# pipenv lock --requirements
#
-i https://pypi.org/simple
cycler==0.10.0
cython==0.29.24; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
gitdb==4.0.7; python_version >= '3.4'
gitpython==3.1.18
kiwisolver==1.3.1; python_version >= '3.6'
matplotlib==3.4.2
numpy==1.21.1
opencv-python==4.5.3.56
pandas==1.3.1
pillow==8.3.1
pyparsing==2.4.7; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
python-dateutil==2.8.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pytz==2021.1
rawpy==0.16.0
six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
smmap==4.0.0; python_version >= '3.5'
torch==1.9.0
torchvision==0.10.0
typing-extensions==3.10.0.0; python_version < '3.8'