elliptic-shiho / primefac-fork

a fork of primefac(https://pypi.python.org/pypi/primefac) module
78 stars 12 forks source link

Building wheel for gmpy3 fails #8

Closed colematt closed 3 years ago

colematt commented 3 years ago

I followed the directions in README.md to install the module, however the build fails when it can't find gmp.h. My system information is as follows:

The software is all coming from apt.

Command input and output on failure is as follows:

sudo pip3 install git+git://github.com/elliptic-shiho/primefac-fork@master
Collecting git+git://github.com/elliptic-shiho/primefac-fork@master
  Cloning git://github.com/elliptic-shiho/primefac-fork (to revision master) to /tmp/pip-req-build-4_em0k1g
  Running command git clone -q git://github.com/elliptic-shiho/primefac-fork /tmp/pip-req-build-4_em0k1g
Collecting factordb-pycli
  Downloading factordb-pycli-1.3.0.tar.gz (4.0 kB)
Collecting gmpy2
  Downloading gmpy2-2.0.8.zip (280 kB)
     |████████████████████████████████| 280 kB 1.7 MB/s 
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from primefac==1.1.1.post2) (1.14.0)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from factordb-pycli->primefac==1.1.1.post2) (2.22.0)
Building wheels for collected packages: primefac, factordb-pycli, gmpy2
  Building wheel for primefac (setup.py) ... done
  Created wheel for primefac: filename=primefac-1.1.1.post2-py3-none-any.whl size=23568 sha256=e960334901f393d507bd178ca44ab66f7574be23637e3b90ee9355089eef2e18
  Stored in directory: /tmp/pip-ephem-wheel-cache-z9ip89e8/wheels/6e/92/63/8ac902d6aef2564e71e4148849dd1d382e6e92370b407ea106
  Building wheel for factordb-pycli (setup.py) ... done
  Created wheel for factordb-pycli: filename=factordb_pycli-1.3.0-py3-none-any.whl size=4612 sha256=03f339b58b7bf192f673cce847ffe4ed5aca5ef21184da6c54c3434993ea193d
  Stored in directory: /root/.cache/pip/wheels/e5/e7/3d/4ff57c8630b64469dc8642fc035531dc89b0c3250af2256c7d
  Building wheel for gmpy2 (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7y7e57_n/gmpy2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7y7e57_n/gmpy2/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-lkmnha8w
       cwd: /tmp/pip-install-7y7e57_n/gmpy2/
  Complete output (14 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'gmpy2' extension
  creating build
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/src
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITHMPFR -DWITHMPC -I/usr/include/python3.8 -c src/gmpy2.c -o build/temp.linux-x86_64-3.8/src/gmpy2.o
  In file included from src/gmpy2.c:426:
  src/gmpy.h:106:12: fatal error: gmp.h: No such file or directory
    106 | #  include "gmp.h"
        |            ^~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for gmpy2
  Running setup.py clean for gmpy2
Successfully built primefac factordb-pycli
Failed to build gmpy2
Installing collected packages: factordb-pycli, gmpy2, primefac
    Running setup.py install for gmpy2 ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7y7e57_n/gmpy2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7y7e57_n/gmpy2/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-rnffo0sc/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/gmpy2
         cwd: /tmp/pip-install-7y7e57_n/gmpy2/
    Complete output (14 lines):
    running install
    running build
    running build_ext
    building 'gmpy2' extension
    creating build
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/src
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITHMPFR -DWITHMPC -I/usr/include/python3.8 -c src/gmpy2.c -o build/temp.linux-x86_64-3.8/src/gmpy2.o
    In file included from src/gmpy2.c:426:
    src/gmpy.h:106:12: fatal error: gmp.h: No such file or directory
      106 | #  include "gmp.h"
          |            ^~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7y7e57_n/gmpy2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7y7e57_n/gmpy2/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-rnffo0sc/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/gmpy2 Check the logs for full command output.

Am I doing something wrong? It seems that maybe gmpy or factordb-pycli either failed to install or weren't installed, which README.md promises should have happened as part of the build.

elliptic-shiho commented 3 years ago

@colematt gmpy needs GNU GMP library. It seems GMP is not installed on your environment. Please retry pip after installed libgmp-dev package.

# I forgot to write this to README, sorry.

colematt commented 3 years ago

@elliptic-shiho this was the hint I needed to fix it, and I have a completed installation now, thanks! But I in fact had to install three packages: libgmp-dev, libmpfr-dev and libmpc-dev. I'd recommend adding those to the README.

Again, thanks for the assistance.