https://prefect.io logo
p

Philip Harman

09/06/2023, 6:50 PM
Hello! I'm looking to add a library like shown below. Is there a way to do this in the CLI or UI? Our infra engineer has been managing libraries & dependencies by modifying the base Docker file, but if there's another way to add libraries it would speed up processes for my team.
Copy code
RUN python -m spacy download en_core_web_sm
n

Nate

09/06/2023, 6:51 PM
hey @Philip Harman - is there a line in your dockerfile something like
Copy code
RUN pip install ".[extra1,extra2]"
or
Copy code
RUN pip install -r requirements.txt
?
p

Philip Harman

09/06/2023, 6:55 PM
@Nate we have manually listed the pip installs (so I think similar to your first line). We can continue adding to this file, I'm just wondering if there's another way to add libraries (ex. in the UI)
n

Nate

09/06/2023, 7:00 PM
the first line is showing the installation of a local package and its extras, for example, to install the `dev` extra of `prefect` after cloning the repo, you can do
Copy code
pip install ".[dev]"
so this would install the
requirements.txt
as well as whats in here in my mind, you shouldnt have to edit the Dockerfile when a particular python dependency changes, your Dockerfile should just
pip install
a file (pyproject.toml or requirements.txt) so that your image has those deps baked in, and rebuild the image when your deps change (i.e. when you edit the requirements.txt that hold your dependencies)
p

Philip Harman

09/06/2023, 7:58 PM
Okay, makes sense - thank you!