Search code examples
dockerdocker-composeapple-m1

M1 Processor: Installing docker compose within docker could not build wheels for pynacl


I am using the latest version of docker 3.5 and unable to have my docker file install docker-compose

ARG docker_compose_version="1.25.3"
RUN pip3 install docker-compose==$docker_compose_version && \
    curl -L "https://raw.githubusercontent.com/docker/compose/${docker_compose_version}/contrib/completion/bash/docker-compose" -o /etc/bash_completion.d/docker-compose

I get the error: ERROR: Could not build wheels for pynacl which use PEP 517 and cannot be installed directly

This seems to work fine on my older intel OSX and on my linux desktop. The issue is only on the the M1 mac arm processors.

Entire error:

#10 9.588   checking for gcc... gcc -pthread
#10 9.588   checking whether the C compiler works... no
#10 9.588   configure: error: in `/tmp/pip-install-u8tfpter/pynacl_4f02866277e7413b8f0576aad924dd8e/build/temp.linux-aarch64-3.9':
#10 9.588   configure: error: C compiler cannot create executables
#10 9.588   See `config.log' for more details
#10 9.588   Traceback (most recent call last):
#10 9.588     File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
#10 9.588       main()
#10 9.588     File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
#10 9.588       json_out['return_val'] = hook(**hook_input['kwargs'])
#10 9.588     File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 204, in build_wheel
#10 9.588       return _build_backend().build_wheel(wheel_directory, config_settings,
#10 9.588     File "/tmp/pip-build-env-hhq_2fbk/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 221, in build_wheel
#10 9.588       return self._build_with_temp_dir(['bdist_wheel'], '.whl',
#10 9.588     File "/tmp/pip-build-env-hhq_2fbk/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 207, in _build_with_temp_dir
#10 9.588       self.run_setup()
#10 9.588     File "/tmp/pip-build-env-hhq_2fbk/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 150, in run_setup
#10 9.588       exec(compile(code, __file__, 'exec'), locals())
#10 9.588     File "setup.py", line 216, in <module>
#10 9.588       setup(
#10 9.588     File "/tmp/pip-build-env-hhq_2fbk/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
#10 9.588       return distutils.core.setup(**attrs)
#10 9.588     File "/usr/local/lib/python3.9/distutils/core.py", line 148, in setup
#10 9.588       dist.run_commands()
#10 9.588     File "/usr/local/lib/python3.9/distutils/dist.py", line 966, in run_commands
#10 9.588       self.run_command(cmd)
#10 9.588     File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
#10 9.588       cmd_obj.run()
#10 9.588     File "/tmp/pip-build-env-hhq_2fbk/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 299, in run
#10 9.588       self.run_command('build')
#10 9.588     File "/usr/local/lib/python3.9/distutils/cmd.py", line 313, in run_command
#10 9.588       self.distribution.run_command(command)
#10 9.588     File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
#10 9.588       cmd_obj.run()
#10 9.588     File "/usr/local/lib/python3.9/distutils/command/build.py", line 135, in run
#10 9.588       self.run_command(cmd_name)
#10 9.588     File "/usr/local/lib/python3.9/distutils/cmd.py", line 313, in run_command
#10 9.588       self.distribution.run_command(command)
#10 9.588     File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
#10 9.588       cmd_obj.run()
#10 9.588     File "setup.py", line 176, in run
#10 9.588       subprocess.check_call(
#10 9.588     File "/usr/local/lib/python3.9/subprocess.py", line 373, in check_call
#10 9.588       raise CalledProcessError(retcode, cmd)
#10 9.588   subprocess.CalledProcessError: Command '['/tmp/pip-install-u8tfpter/pynacl_4f02866277e7413b8f0576aad924dd8e/src/libsodium/configure', '--disable-shared', '--enable-static', '--disable-debug', '--disable-dependency-tracking', '--with-pic', '--prefix', '/tmp/pip-install-u8tfpter/pynacl_4f02866277e7413b8f0576aad924dd8e/build/temp.linux-aarch64-3.9']' returned non-zero exit status 77.
#10 9.588   ----------------------------------------
#10 9.589   ERROR: Failed building wheel for pynacl
#10 9.592   Building wheel for pyrsistent (PEP 517): started
#10 9.758   Building wheel for pyrsistent (PEP 517): finished with status 'done'
#10 9.758   Created wheel for pyrsistent: filename=pyrsistent-0.18.0-cp39-cp39-linux_aarch64.whl size=56358 sha256=8219c122373a1ee20febb5879691942ca538fc7c89be8ce9df4151a30ec8bd41
#10 9.758   Stored in directory: /root/.cache/pip/wheels/dd/c8/61/04c6d218b3691f75353d7f74fed3fbd40e0ee9e2d1e2ce24c6
#10 9.760 Successfully built dockerpty docopt pyrsistent
#10 9.760 Failed to build pynacl
#10 9.760 ERROR: Could not build wheels for pynacl which use PEP 517 and cannot be installed directly

Solution

  • I was able to fix this by swapping python images from python:3.9-slim-buster to python:3.9