private-gpt icon indicating copy to clipboard operation
private-gpt copied to clipboard

No module named 'dotenv' when running privateGPT.py (Linux Mint)

Open rotarydialer opened this issue 2 years ago • 3 comments

Note: if you'd like to ask a question or open a discussion, head over to the Discussions section and post it there.

Describe the bug and how to reproduce it I've followed the steps in the README, making substitutions for the version of python I've got installed (i.e., python3.10 instead of just python), but when I execute python3.10 privateGPT.py, I get the error: ModuleNotFoundError: No module named 'dotenv':

$ python3.10 privateGPT.py                     
Traceback (most recent call last):
  File "/home/rotarydialer/projects/privateGPT/privateGPT.py", line 1, in <module>
    from dotenv import load_dotenv
ModuleNotFoundError: No module named 'dotenv'

However, re-running the requirements install says that I already have dotenv installed:

$ pip3 install -r requirements.txt | grep -i dotenv
Requirement already satisfied: python-dotenv==1.0.0 in /home/rotarydialer/.local/lib/python3.8/site-packages (from -r requirements.txt (line 7)) (1.0.0)

...I do note that it's in the 3.8 path, so I'm not sure if this is the issue.

Expected behavior I expect the script to present the Enter a query > prompt, as described in line 75 of the README.

Environment (please complete the following information):

  • OS / hardware: Linux Mint 20.3
  • Python version: 3.10.11
  • Other relevant information: multiple versions of python installed

Additional context Various versions I've got installed:

$ python3.10 --version
Python 3.10.11

$ python3 --version
Python 3.8.10

$ python --version
Python 2.7.18

$ pip --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

$ pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

rotarydialer avatar May 19 '23 06:05 rotarydialer

Looks like an issue with the different python versions. I'd suggest to create a python virtual environment for the project, and install dependencies there.

Here are the steps (just create the venv and activate it, the install requirements) https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments

imartinez avatar May 19 '23 07:05 imartinez

Thanks. Will give that a shot and post an update here, hopefully within 24 hours.

rotarydialer avatar May 19 '23 18:05 rotarydialer

I'm having the same issue on Mac OS 13.3.1, M1, Python 3.11.3.

austingreisman avatar May 20 '23 14:05 austingreisman

Thank you @imartinez, and sorry to hit you with this issue that was unrelated to your code. I didn't know about virtual environments, and my searching before opening this ticket didn't lead me in the right direction, so I really appreciate the guidance. I'll close this out.

rotarydialer avatar May 21 '23 03:05 rotarydialer

I'm having the same issue on Mac OS 13.3.1, M1, Python 3.11.3.

The comment above re: virtual environments solved this particular issue for me.

rotarydialer avatar May 21 '23 03:05 rotarydialer

I dont understand it and I have the same issue on windows

Traceback (most recent call last): File "L:\AIdocReader\privateGPT\privateGPT.py", line 2, in from dotenv import load_dotenv ModuleNotFoundError: No module named 'dotenv'

but have it installed Requirement already satisfied: python-dotenv in c:\users\miro\appdata\local\programs\python\python39\lib\site-packages (1.0.0)

getmad4love avatar May 22 '23 19:05 getmad4love

Same here and Surprising thing is I created it using Venv

sneh3006 avatar Jun 09 '23 20:06 sneh3006

Hello! I tried to downgrade python version to python 2 and used python ingest.py. It works for me!

pedromartip avatar Aug 31 '23 14:08 pedromartip