Fail to deploy, module not found
clueeng
FREEOP

5 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

from dotenv import load_dotenv

Solved$10 Bounty

Pinned Solution

gabztoo
FREE

5 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

  1. Open your requirements.txt
  2. Replace:
pydotenv  

with:

python-dotenv  
  1. Save the file and redeploy the project

Once the correct package is installed, your app should start normally.

3 Replies

gabztoo
FREE

5 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

  1. Open your requirements.txt
  2. Replace:
pydotenv  

with:

python-dotenv  
  1. Save 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_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 1. Open your `requirements.txt` 2. Replace: ``` pydotenv ``` with: ``` python-dotenv ``` 3. Save the file and redeploy the project Once the correct package is installed, your app should start normally.

clueeng
FREEOP

5 months ago

thank you! I feel a bit stupid now haha


clueeng

thank you! I feel a bit stupid now haha

gabztoo
FREE

5 months 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 5 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...