Fail to deploy, module not found
clueeng
FREEOP

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

Solved$10 Bounty

Pinned Solution

gabztoo
FREE

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

  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.

3 Replies

gabztoo
FREE

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

  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.


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.

clueeng
FREEOP

a month ago

thank you! I feel a bit stupid now haha


clueeng

thank you! I feel a bit stupid now haha

gabztoo
FREE

a month ago

No problem! Just send a message if you need anything else. Approving the response would be a great help. smile emoji


Status changed to Solved noahd about 1 month ago


Loading...