Hello, I have a python server using jsonnet that isn't able to pip install jsonnet when building in docker. It works fine locally on OSX, but the code below is getting failures:
Dockerfile:
FROM python:3.7-slim-buster
COPY ./app /app
WORKDIR /app
RUN python3 -m pip install -r requirements.txt // also used pip install -r requirements
CMD ["python3", "app.py"]
requirements.txt:
Click==7.0
Flask==1.1.1
itsdangerous==1.1.0
Jinja2==2.10.3
jsonnet==0.14.0 // also tried 0.11.0 because of this issue - https://github.com/google/jsonnet/issues/586
MarkupSafe==1.1.1
Werkzeug==0.16.0
I've tried building from different the python alpine base image as well. Every time I get this error (or two):
Building wheels for collected packages: jsonnet
Building wheel for jsonnet (setup.py): started
Building wheel for jsonnet (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mj06wfis/jsonnet/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mj06wfis/jsonnet/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-nkq3_7r5 --python-tag cp37
cwd: /tmp/pip-install-mj06wfis/jsonnet/
Complete output (4 lines):
running bdist_wheel
running build
running build_ext
error: [Errno 2] No such file or directory: 'make': 'make'
----------------------------------------
ERROR: Failed building wheel for jsonnet
Running setup.py clean for jsonnet
Failed to build jsonnet
Installing collected packages: Click, Werkzeug, itsdangerous, MarkupSafe, Jinja2, Flask, jsonnet
Running setup.py install for jsonnet: started
Running setup.py install for jsonnet: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mj06wfis/jsonnet/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mj06wfis/jsonnet/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-f1kg_4ia/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-mj06wfis/jsonnet/
Complete output (4 lines):
running install
running build
running build_ext
error: [Errno 2] No such file or directory: 'make': 'make'
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mj06wfis/jsonnet/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mj06wfis/jsonnet/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-f1kg_4ia/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
The python package needs to compile Jsonnet, so you need build tools for pip install command to work - you need Make, gcc and g++.
I'm not familiar with this docker image, but my understanding is that it's based on Ubuntu. If that's right adding the following before the pip command is likely to fix your problem:
RUN apt-get install build-essential
Thanks. That did it (along with RUN apt-get update)
Thanks. That did it (along with
RUN apt-get update)
RUN apt-get update
RUN apt-get install -y build-essential
worked for me. Thanks.
Most helpful comment
The python package needs to compile Jsonnet, so you need build tools for
pip installcommand to work - you need Make, gcc and g++.I'm not familiar with this docker image, but my understanding is that it's based on Ubuntu. If that's right adding the following before the pip command is likely to fix your problem: