SuppTracker deployment failing with httpx dependency conflict and ImportError
kg-97
HOBBYOP

2 months ago

Hi Railway team,

I'm experiencing deployment failures with my SuppTracker project. After examining the logs and deployment history, I've identified two specific issues:

Issue #1: httpx Dependency Conflict (Build Failure)

The build process fails with this error:

```

ERROR: Cannot install httpx==0.24.1 and httpx==0.27.2 because these package versions have conflicting dependencies.

The conflict is caused by:

The user requested httpx==0.27.2

The user requested httpx==0.24.1

```

This appears to be caused by duplicate httpx entries in requirements.txt with different versions.

Issue #2: ImportError During Runtime (Deployment Crash)

When the app attempts to start, it crashes with:

```

ImportError: cannot import name 'Source' from 'api.models' (/app/api/models.py)

```

This happens at line 12 in risk_api.py:

```python

from api.models import Compound, Interaction, Source

```

Project Details:

- Project ID: 604157dc-6454-4dff-8e6e-8df5d05578a1

- Service: supptracker (FastAPI Python application)

- Recent deployment attempts show a pattern of crashes and restarts

- The build issue was partially addressed in recent commits, but the runtime error persists

Could you please help me understand:

1. Best practices for resolving Python dependency conflicts in Railway builds?

2. Why the ImportError persists even after the build succeeds?

3. Any Railway-specific considerations for FastAPI deployments?

Thanks for your assistance!

Solved$10 Bounty

1 Replies

dev
MODERATOR

2 months ago

For issue 1, you'll need to remove the duplicate entry for httpx in your requirements.txt because the two entries conflict with one another

For issue 2, this is an issue within your code, it's saying that it cannot find anything named Source from the models.py script, most likely case is that it's not defined in models.py

To answer your questions:
1. You'll need to solve dependency conflicts in your requirements.txt, luckily the one youre experiencing is easy to solve - you just need to remove the duplicate entry

  1. The building state and running state is very seperate, especially for python where you dont compile anything during build process. If you're using Railpack or Nixpacks then the build process just constructs the environment where your code will run even if that code doesn't work properly meaning the environment can be built (meaning building is sucessful) but the code within that environment can be problematic. Leading to code errors at runtime even after a succesful build.

  2. Not that I can think of, other than the basics of ensuring youre listening on the correct host 0.0.0.0 and port PORT env variable (standard practice)


Status changed to Solved dev 2 months ago


Loading...