-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip packages not getting cached #25
Comments
Packages are not cached because doing that results in them bloating out the image, as they would live in a lower layer. Deleting them in a higher layer doesn't free up any space the image is still just as fat. For speeding up build times, you are better off relying on creating a Python wheelhouse which contains wheel versions of all packages that you require. The wheelhouse directory can then be injected into a build in some way with packages installed from it, with fallback to PyPi if necessary. The wheelhouse directory is then deleted when done in the same layer to avoid bloating the image. |
FWIW, Glyph has posted on this topic before at: and I have also posted about it as well.
The newer versions of docker images for Python I had been working on incorporated support for using a Python wheelhouse. |
I should have chosen a better title; what I mean is that pip packages are not being installed in their own I'll check out the wheelhouse idea though, seems like an interesting workaround! |
In the general case, the other issue is that a |
That does make sense, although if I'm not mistaken you could probably use a build argument that makes the |
So I tried the wheelhouse approach and I'm running into some issues, so I must have done something wrong somewhere. I created a
Any clues? |
When those images were originally written, the concept of build arguments didn't exist in docker. As to trying to do the wheelhouse, where are trying to do that? That image probably doesn't have a new enough Because Docker Inc blocked me from being able to build that image any more on Docker hub using automated builds, it has been neglected. The intent was to replace it with a newer image with it done differently that could be built using automated builds, but I have had next to no interest from Python community in all the work I have been doing on creating better docker images for using with Python, so has been little incentive. |
The commands above were run on my local machine. The image I'm running has pip 9.0.1. I'm not sure what I did, but it suddenly worked. I did rebuild my wheelhouse from inside the image instead of from my local machine in order to have the correct wheels. |
Okay so even when I add |
The way things are right now, the pip packages are not getting cached, which often adds unnecessary build time since the packages don't change often. It would be better to run it first thing from the Dockerfile instead of in a script to leverage Docker's caching mechanism, as explained here: https://www.aptible.com/documentation/enclave/tutorials/faq/dockerfile-caching/pip-dockerfile-caching.html
The text was updated successfully, but these errors were encountered: