I am trying to install some python requirements from a local package directory containing wheel archives. I am installing the requirements inside a Docker container.
The steps I'm following are:
$ pip install wheel
# wheel runs, outputs .whl files to wheelhouse directory
$ pip wheel --wheel-dir wheelhouse -r requirements.txt
Then, inside my Dockerfile
:
ADD requirements.txt /tmp/requirements.txt
ADD wheelhouse /tmp/wheelhouse
# install requirements. Leave file in /tmp for now - may be useful.
RUN pip install --use-wheel --no-index --find-link /tmp/wheelhouse/ -r /tmp/requirements.txt
This works - and all the requirements are installed correctly:
# 'app' is the name of my built docker image
$ docker run app pip list
...
psycopg2 (2.5.1)
...
However, if I actually try running something inside the container that uses psycopg2
, then I get the following:
Error loading psycopg2 module: /usr/local/lib/python2.7/site-packages/psycopg2/_psycopg.so: undefined symbol: PyUnicodeUCS4_AsUTF8String
I presume that this is something to do with the way in which the wheels were built - I ran pip wheel
on the container host machine (Ubuntu 12.04).
How can I fix this - using wheels significantly reduces the time taken to build the container image, so I don't want to revert to installing packages if I can help it?