Deploy FastAPI with local library dependencies
ptav
HOBBYOP

8 days 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 8 days ago


xmrafonso
FREETop 5% Contributor

8 days ago

Hey, are you sure the libs are included?


diogoribeirodev
FREETop 5% Contributor

8 days ago

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


ptav
HOBBYOP

8 days 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
FREETop 5% Contributor

8 days 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.


Loading...