I'm getting ModuleNotFoundError: No module named 'dotenv'
error. I did install python-dotenv
as suggested in other posts but it still gives error. How to fix it?
My code
import os
import json
import openai
import pandas as pd
from dotenv import load_dotenv
load_dotenv()
...
Error
(.venv) ~/ROOT/Python/finetunechat/openai $ pip list | grep dotenv
python-dotenv 0.21.1
(.venv) ~/ROOT/Python/finetunechat/openai $ python 1.py
Traceback (most recent call last):
File "1.py", line 7, in <module>
from dotenv import load_dotenv
ModuleNotFoundError: No module named 'dotenv'
(.venv) ~/ROOT/Python/finetunechat/openai $
Make sure it's installed in the same virtual environment (venv) as your project
Before running that command ensure your venv is live by running:
For Mac/Linux
For Windows
Also try reopening the project after installing
Hope this helps!