R
RunPod11mo ago
georg

Import PIL (pillow image library) in rp_handler.py

Hey everyone, i try to use a tool from the PIL module to process my generated image before sending back in the handler. Unfortunately i get a
Module no found Error
Module no found Error
although the library is installed in my network volume and is written in my requirements.txt of the handler. when i connect to my handler via web terminal and start in the command line python, i also cannot import PIL. So is it necessary to link some python libraries manually from my network volume to my handler or what is the best practice here?
Solution:
Whatever is in your network volume isn’t just available on ur serverless for python packages This is bc when the docker initializes, and it gets python it will set it’s python packages to be something like /somewhere/packages. But not under runpod-volume/package....
Jump to solution
2 Replies
Solution
justin
justin11mo ago
Whatever is in your network volume isn’t just available on ur serverless for python packages This is bc when the docker initializes, and it gets python it will set it’s python packages to be something like /somewhere/packages. But not under runpod-volume/package. Thus, what you should do is not worry about keeping this PIL in your network-volume instead for you docker file try to just pip install it during the build process instead of ur dockerfile that way it will just be automatically there. Prob if you have something like a: COPY requirements.txt . In your dockerfile just add the pip install -r command to install stuff under it
ashleyk
ashleyk11mo ago
How did you install it on your network volume? If its a venv, its important to remember that a network volume is mounted at /workspace in GPU cloud, but /runpod-volume in serverless.
Want results from more Discord servers?
Add your server