5

tried reinstalling, uninstalling same thing. Windows 10, python 3.9. Any suggestions? Tried now again and it gave me a returned non-zero exit status 1.

6
  • Are you using pip or installing the packages yourself?
    – scob_
    Dec 21, 2020 at 23:29
  • I'm using pip. Through Git Bash Dec 21, 2020 at 23:30
  • can you add the pip command in the post? Also adding a screenshot/log of the error will help to debug the issue Dec 21, 2020 at 23:37
  • I just did pip install python-dotenv on both a windows and linux machine and had no problems, but you could try installing it manually.
    – scob_
    Dec 21, 2020 at 23:38
  • current command that gives me the status 1 error is : pip install dotenv Dec 21, 2020 at 23:39

3 Answers 3

5

You're trying to install the wrong package.

It's pip install python-dotenv.

See https://pypi.org/project/python-dotenv/

10
  • What version number does it print?
    – scob_
    Dec 21, 2020 at 23:42
  • Requirement already satisfied: python-dotenv in c:\users\tatiana\appdata\roaming\python\python39\site-packages (0.15.0) Dec 21, 2020 at 23:43
  • from os import environ, path from dotenv import load_dotenv basedir=path.abspath(path.dirname(file)) load_dotenv(path.join(basedir, '.env')) thats my config file. I have a env file in the root directory Dec 21, 2020 at 23:46
  • And it still doesn't work when you try importing it now? That might be an issue with your Python setup then (or a developer bug with 3.9), because I tested on two machines (one running 3.8 and the other running 3.7) and it worked fine. Perhaps it's a bug with their version, they said they've added support for Python 3.9 but it might have a bug.
    – scob_
    Dec 21, 2020 at 23:47
  • 1
    took the holiday off. Came back rebuilt everything and now everything works in 3.8. Did I find a bug? Dec 29, 2020 at 8:42
2

Running python -m pip install python-dotenv solved it for me.

0

pip install python-dotenv. If still getting the 'ModuleNotFoundError', it could be that python is trying to access it in the wrong directory.

There are ways to go around this which you can find in this video (talks about pandas, but still same jist) https://www.youtube.com/watch?v=QVZQCvRB9v0&list=PLt07sZ5fS9b5WlkbsOCwzKFQyoPthz69X&index=1, but honestly uninstalling and reinstalling python usually fixes things (you'll have to resetup any virtual environments though).

2
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Destroy666
    May 29 at 0:44
  • Okay awesome. I'll remember that for next time. Aug 8 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.