cog
cog copied to clipboard
Python packages are not properly linked when python patch version is specified & build.gpu is false
Been trying to build an image with:
build:
gpu: false
python_version: 3.11.2
python_requirements: requirements.cpu.txt
Having inspected the container & the generated the dockerfile, I could fortunately isolate the issue to the python version patch number. When it's set and we're building off a python image that does not handle python using pyenv (which is the case when gpu: true), the entrypoint command (python -m 'cog.server.http') errors that cog is an unknown module.
The PYTHONPATH in the container reads like:
$ python -c "import sys; print(sys.path)"
['', '/usr/local/lib/python311.zip', '/usr/local/lib/python3.11', '/usr/local/lib/python3.11/lib-dynload', '/usr/local/lib/python3.11/site-packages']
$ ls -a /usr/local/lib/python3.11/site-packages
. ..
$ ls -a /usr/local/lib/python3.11.2/site-packages
Cython humanfriendly requests_oauthlib
Cython-3.0.8.dist-info humanfriendly-10.0.dist-info requests_oauthlib-1.3.1.dist-info
Jinja2-3.1.3.dist-info idna rsa
Markdown-3.5.2.dist-info idna-3.6.dist-info rsa-4.9.dist-info
MarkupSafe-2.1.5.dist-info imageio safetensors
...
cc @technillogue