pyca / pynacl

Python binding to the Networking and Cryptography (NaCl) library
https://pynacl.readthedocs.io/
Apache License 2.0
1.07k stars 230 forks source link

Building on Docker not working #696

Closed rolf-d2i closed 2 years ago

rolf-d2i commented 2 years ago

Build fails on Docker when trying to use the following (below is Docker code, possible missing some libs)

FROM python:3-alpine run pip install --upgrade pip RUN apk add gcc musl-dev python3-dev libffi-dev openssl-dev RUN pip install cryptography RUN apk add make RUN pip install pynacl

Work around is to use the following instead of "pip install pynacl" to use a prebuilt libsodium library RUN apk add libsodium RUN apk add libsodium-dev RUN SODIUM_INSTALL=system pip install pynacl

The build crashes for some reason in the Docker container, this could need a fix. Same problem exists in python:3 container.

ghost commented 2 years ago

It would be really nice to see musllinux wheels for pynacl.

twbecker commented 2 years ago

Can confirm. Error is quite nondescript also:

  make: *** [Makefile:514: all-recursive] Error 127
  Traceback (most recent call last):
    File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 230, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 158, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 216, in <module>
      setup(
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 155, in setup
      return distutils.core.setup(**attrs)
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 148, in setup
      return run_commands(dist)
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
      dist.run_commands()
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
      self.run_command(cmd)
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/_distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/tmp/pip-build-env-jf3yebx_/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
      cmd_obj.run()
    File "setup.py", line 184, in run
      subprocess.check_call(["make"] + make_args, cwd=build_temp)
    File "/usr/local/lib/python3.8/subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['make']' returned non-zero exit status 2.
  ----------------------------------------
  ERROR: Failed building wheel for pynacl
reaperhulk commented 2 years ago

Building libsodium requires make in addition to the C compiler itself. However, we've now shipped a musl wheel with 1.5.0.

twbecker commented 2 years ago

@reaperhulk make is installed in my output above.

reaperhulk commented 2 years ago

You'll be able to see the output if you add -v to see what the actual failure within make is.

ghost commented 2 years ago

Awesome, thank you!