Libraries installed with pipenv, but ModuleNotFoundError returned - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Libraries installed with pipenv, but ModuleNotFoundError returned (/thread-34821.html) |
Libraries installed with pipenv, but ModuleNotFoundError returned - jpncsu - Sep-04-2021 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 python3 -m pip install --user pipenvThen I ran: pipenv shell I usedpipenv install It seems like the requirements were installed without problem. I confirm this withpipenv graph However, when I run my script withpython3 model_to_green_value.pyI get this 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:
RE: Libraries installed with pipenv, but ModuleNotFoundError returned - snippsat - Sep-04-2021 (Sep-04-2021, 01:01 AM)jpncsu Wrote: However, when I run my script withYou most do this in shell when active,usually on Windows there is python and not python3 When in shell test with python -c "import sys;print(sys.executable)" G:\ λ python -c "import sys;print(sys.executable)" G:\-EtzfjxZG\Scripts\python.exe G:\ λ pip -V pip 21.2.3 from G:\-EtzfjxZG\lib\site-packages\pip (python 3.9)So now over is active and use python version and packages install to this environment. If i exit out. G:\ λ exit G:\div_code\mat_env λ python -c "import sys;print(sys.executable)" C:\python39\python.exe G:\div_code\mat_env λ pip -V pip 21.2.4 from c:\python39\lib\site-packages\pip (python 3.9)So if you outside of shell(active) most point to python version in environment,like eg from editor or it will use default Winnows version. I never use pipenv anymore had to much issues. venv build into Python is easy to use,can use pipx for more options. The best 3-pary of this is in my option Poetry RE: Libraries installed with pipenv, but ModuleNotFoundError returned - jpncsu - Sep-06-2021 Hi, snippsat. Thanks for the reply. (Sep-04-2021, 04:35 PM)snippsat Wrote:I got used to using "python3" because I had two versions of Python on my machine.(Sep-04-2021, 01:01 AM)jpncsu Wrote: However, when I run my script withYou most do this in shell when active,usually on Windows there is (Sep-04-2021, 04:35 PM)snippsat Wrote: I never use pipenv anymore had to much issues.Thank you for mentioning this. I am not very experienced programmer and have almost no experience with package/dependency management. My advisor told me about pipenv and I thought it would be fine. I will investigate Poetry further. I did figure out how to deal with my problem in pipenv. I need to run the script with pipenv run python script.pyinstead of python script.pyThat runs the script with the pipenv environment/settings. jpncsu |