thatdevop
thatdevop

Reputation: 1039

pip install dotenv error code 1 Windows 10

I am in a virtualenv and trying to run through pip installs. I know the code works because outside the virtualenv this code has worked. I am running on a Windows 10 machine. Using the Git Bash terminal or the regular command prompt (have tried as admin and regular user). I am trying to run pip install dotenv or python -m pip install dotenv and neither of the two work. I get the error saying

AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader' During handling of the above exception, another exception occurred:Command "python setup.py egg_info" failed with error code 1 in C:\Users\USER~1\AppData\Local\Temp\pip-build-7bbdcnx2\dotenv\

I have also tried to do things such as python -m pip install setuptools --upgrade un-install setuptools and install it again. restart my computer. and many other things. I'm not too sure what else to try (i've installed flask before this and it worked, I also can install other things like mitmproxy as an example) Any ideas? Again, this is a Windows 10 machine and I just want to install dotenv for Python (version 3.6.4 if it matters). Thank you.

Upvotes: 67

Views: 100887

Answers (3)

Felipe Rigel
Felipe Rigel

Reputation: 11

I had the same issue, specify the python I was using worked for me

python3 -m pip install --upgrade pip    
python3 -m pip install python-dotenv

Or

 python -m pip install --upgrade pip    
 python -m pip install python-dotenv 

Upvotes: 1

for me this error occurred while trying to install pip install dotenv

This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
Encountered error while generating package metadata.

pip3 install python-dotenv worked for me

Upvotes: 5

Morse
Morse

Reputation: 9144

You should install python-dotenv

pip3 install python-dotenv

or

pip install python-dotenv

i.e

C:\Users\USER>pip3 install python-dotenv
Collecting python-dotenv
  Downloading python_dotenv-0.8.2-py2.py3-none-any.whl
Installing collected packages: python-dotenv
Successfully installed python-dotenv-0.8.2

Refer this issue

Upvotes: 210

Related Questions