Reputation: 3690
Trying to install m2crypto in a Dockerfile:
FROM python:3.7
RUN pip install m2crypto
I'm getting the following error output (truncated):
Step 7/8 : RUN pip install m2crypto
---> Running in 1204096f1488
Collecting m2crypto
Downloading https://files.pythonhosted.org/packages/23/93/1c1a887f956ec38d691af110d38059e234fc941019e0c074a66a10846813/M2Crypto-0.34.0.tar.gz (1.1MB)
Building wheels for collected packages: m2crypto
Building wheel for m2crypto (setup.py): started
Building wheel for m2crypto (setup.py): finished with status 'error'
ERROR: Complete output from command /usr/local/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ptf_nqd5/m2crypto/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-w9seu9sh --python-tag cp37:
ERROR: running bdist_wheel
...
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -I/tmp/pip-install-ptf_nqd5/m2crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-x86_64-3.7/SWIG/_m2crypto_wrap.o -Wno-deprecated-declarations -DTHREADING
SWIG/_m2crypto_wrap.c: In function ‘_wrap__STACK_num_set’:
SWIG/_m2crypto_wrap.c:9506:19: error: dereferencing pointer to incomplete type ‘struct stack_st’
if (arg1) (arg1)->num = arg2;
^~
... lots more errors ...
ERROR: Command "/usr/local/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ptf_nqd5/m2crypto/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xq22_pd8/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-ptf_nqd5/m2crypto/
Full output at https://pastebin.com/3bmdGvdx.
Am I doing something wrong?
Upvotes: 2
Views: 1332
Reputation: 3690
Solved it on my own by following the installation instructions:
FROM python:3.7
RUN apt-get update
RUN apt-get install -y build-essential
RUN apt-get install -y python3-dev
RUN apt-get install -y swig
RUN pip install m2crypto
libssl-dev
is mentioned in the instructions but is already present. apt-get update
is required, or build-essential
won't be found. -y
is required because python3-dev
is large, and apt-get install
will otherwise prompt "do you want to install? [Y/n]".
I'm sure many other variations of this will also work, using other base images. But this does work.
Upvotes: 4