2 months ago
Despite adding a requirements.txt, and checking the loads to see if it downloads the modules (which it seems to do) it crashes on deploy
pip install -r requirements.txt
Collecting pymysql (from -r requirements.txt (line 1))
Downloading pymysql-1.1.2-py3-none-any.whl.metadata (4.3 kB)
Collecting flask (from -r requirements.txt (line 2))
Downloading flask-3.1.2-py3-none-any.whl.metadata (3.2 kB)
Collecting pydotenv (from -r requirements.txt (line 3))...
File "/app/connexion_db.py", line 4, in <module>
from dotenv import load_dotenv
Pinned Solution
2 months ago
Your project is deploying correctly, but it crashes when the app starts because a required Python package is missing.
In your code you have:
from dotenv import load_dotenv
This function comes from the package python-dotenv.
However, in your requirements.txt you installed:
pydotenv
These two packages are different, and pydotenv does not provide load_dotenv, which causes the crash.
How to fix
Open your
requirements.txtReplace:
pydotenvwith:
python-dotenvSave the file and redeploy the project
Once the correct package is installed, your app should start normally.
3 Replies
2 months ago
Your project is deploying correctly, but it crashes when the app starts because a required Python package is missing.
In your code you have:
from dotenv import load_dotenv
This function comes from the package python-dotenv.
However, in your requirements.txt you installed:
pydotenv
These two packages are different, and pydotenv does not provide load_dotenv, which causes the crash.
How to fix
Open your
requirements.txtReplace:
pydotenvwith:
python-dotenvSave the file and redeploy the project
Once the correct package is installed, your app should start normally.
gabztoo
Your project is deploying correctly, but it crashes when the app starts because a required Python package is missing.In your code you have:from dotenv import load_dotenvThis function comes from the package python-dotenv.However, in your requirements.txt you installed:pydotenvThese two packages are different, and pydotenv does not provide load_dotenv, which causes the crash.How to fixOpen your requirements.txtReplace:pydotenvwith:python-dotenvSave the file and redeploy the projectOnce the correct package is installed, your app should start normally.
a month ago
thank you! I feel a bit stupid now haha
clueeng
thank you! I feel a bit stupid now haha
a month ago
No problem! Just send a message if you need anything else. Approving the response would be a great help. 
Status changed to Solved noahd • about 1 month ago
