'ERROR: Could not build wheels for coincurve, which is required to install pyproject.toml-based projects

Error while installing bit using Termux on a Samsung Galaxy s10 Android 12 which is not rooted

~ $ pip3 install bit                                    Collecting bit
  Using cached bit-0.8.0-py3-none-any.whl (68 kB)
Collecting requests                                       Using cached requests-2.27.1-py2.py3-none-any.whl (63 kB)                                                     Collecting coincurve>=4.3.0
  Using cached coincurve-17.0.0.tar.gz (2.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done            Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting asn1crypto
  Using cached asn1crypto-1.5.0-py2.py3-none-any.whl (105 kB)                                                   Collecting cffi>=1.3.0
  Using cached cffi-1.15.0-cp310-cp310-linux_aarch64.whlCollecting urllib3<1.27,>=1.21.1                          Using cached urllib3-1.26.8-py2.py3-none-any.whl (138 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting charset-normalizer~=2.0.0
  Using cached charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.3-py3-none-any.whl (61 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Building wheels for collected packages: coincurve
  Building wheel for coincurve (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for coincurve (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [64 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-3.10
      creating build/lib.linux-aarch64-3.10/coincurve
      copying coincurve/types.py -> build/lib.linux-aarch64-3.10/coincurve
      copying coincurve/ecdsa.py -> build/lib.linux-aarch64-3.10/coincurve
      copying coincurve/_windows_libsecp256k1.py -> build/lib.linux-aarch64-3.10/coincurve
      copying coincurve/keys.py -> build/lib.linux-aarch64-3.10/coincurve
      copying coincurve/context.py -> build/lib.linux-aarch64-3.10/coincurve
      copying coincurve/flags.py -> build/lib.linux-aarch64-3.10/coincurve
      copying coincurve/__init__.py -> build/lib.linux-aarch64-3.10/coincurve
      copying coincurve/utils.py -> build/lib.linux-aarch64-3.10/coincurve
      copying coincurve/py.typed -> build/lib.linux-aarch64-3.10/coincurve
      running build_clib
      Can't exec "aclocal": No such file or directory at /data/data/com.termux/files/usr/share/autoconf/Autom4te/FileUtils.pm line 274.
      autoreconf: error: aclocal failed with exit status: 1
      Traceback (most recent call last):
        File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/data/data/com.termux/files/usr/lib/python3.10/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 "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 244, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 229, in _build_with_temp_dir
          self.run_setup()
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 281, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 264, in <module>
          setup(
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 155, in setup
          return distutils.core.setup(**attrs)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 148, in setup
          return run_commands(dist)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
          dist.run_commands()
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
          self.run_command(cmd)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
          cmd_obj.run()
        File "setup.py", line 97, in run
          _bdist_wheel.run(self)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 299, in run
          self.run_command('build')
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
          cmd_obj.run()
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-idl32cqz/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
          cmd_obj.run()
        File "setup.py", line 154, in run
          subprocess.check_call([autogen], cwd=absolute('libsecp256k1'))
        File "/data/data/com.termux/files/usr/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/data/data/com.termux/files/usr/tmp/pip-install-pgwmnz6f/coincurve_5ace6eabc71247daaa71de70d4272038/libsecp256k1/autogen.sh']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for coincurve
Failed to build coincurve
ERROR: Could not build wheels for coincurve, which is required to install pyproject.toml-based projects

I've already installed wheel but it's still not working and try some others things but did work neither (I don't remember sorry). I'm using Python 3.10.2 and pip 22.0.4 Everything is normally up to date

Anyone know how can I solve this?



Solution 1:[1]

Update pip3 and install wheel. Then try installing coincurve individually.

pip3 install --upgrade pip3

pip3 install wheel

pip3 install coincurve

Solution 2:[2]

Try this: Worked for me on a Xiaomi Poco with LineageOS 18.1 (Android 11).

One needs to install some dependendencies in order to build the coincurve module. Then use pip to install the coincurve module with --no-binary all option, which tells pip to compile the module's binaries itself instead of trying to download them, guaranteeing that the binaries will match your processor architecture (and perhaps operating system?).

pkg update
pkg install build-essential
pkg install binutils
pip install coincurve --no-binary all

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 The Guru
Solution 2