Deploy FastAPI with local library dependencies
ptav
HOBBYOP

4 months ago

The requirements.txt file includes editable installation in the local path ./libs/my-library. The deploy script fails because the path is not found. The file does exist and install perfectly locally:

ERROR: Invalid requirement: './libs/sharepoint-files': Expected package name at the start of dependency specifier

./libs/sharepoint-files

^ (from line 17 of requirements.txt)

Hint: It looks like a path. File './libs/sharepoint-files' does not exist.

$10 Bounty

4 Replies

Status changed to Awaiting Railway Response Railway 4 months ago


xmrafonso
FREE

4 months ago

Hey, are you sure the libs are included?


diogoribeirodev
FREE

4 months ago

Make sure to commit the library to your repo, else it will never find it.


ptav
HOBBYOP

4 months ago

The libraries are there but neither ./libs/... or /app/libs/... seem to work. Have eventually resolved it by creating a docker container instead of deploying directly. But would still like to understand the issue


diogoribeirodev
FREE

4 months ago

It could be a path issue, since the build context root is different.

For example this might work in local:

-e ../my_lib

But on Railway the path must be relative to the repo root, e.g.:

-e ./my_lib

Using docker works because it guarantees your local dependency is included because you copy everything.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...