Installation of gmpy2 ends with several errors

I have a vServer (just to try it out. It is free so it has nearly no support) and it has python it. It works, but I wanted to use the package gmpy2 now. It has CentOS Linux 7.
So I did

pip3 install gmpy2 --user

and I get:

    Running setup.py install for gmpy2 ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-05dy89op/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-qkdz28ny-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/gmpy2
    copying gmpy2/__init__.py -> build/lib.linux-x86_64-3.6/gmpy2
    running egg_info
    writing gmpy2.egg-info/PKG-INFO
    writing dependency_links to gmpy2.egg-info/dependency_links.txt
    writing top-level names to gmpy2.egg-info/top_level.txt
    reading manifest file 'gmpy2.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'gmpy2.egg-info/SOURCES.txt'
    copying gmpy2/__init__.pxd -> build/lib.linux-x86_64-3.6/gmpy2
    copying gmpy2/gmpy2.h -> build/lib.linux-x86_64-3.6/gmpy2
    copying gmpy2/gmpy2.pxd -> build/lib.linux-x86_64-3.6/gmpy2
    running build_ext
    building 'gmpy2.gmpy2' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I./src -I/usr/include/python3.6m -c src/gmpy2.c -o build/temp.linux-x86_64-3.6/src/gmpy2.o -DSHARED=1
    In file included from src/gmpy2.c:517:
    src/gmpy2.h:82:10: fatal error: mpfr.h: Datei oder Verzeichnis nicht gefunden
       82 | #include <mpfr.h>
          |          ^~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-05dy89op/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-qkdz28ny-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-05dy89op/gmpy2/

I installed mpfr, but it still does not work.
I tried to upgrade pip, but I am not allowed to do that.

It works with numpy and other packages, so why not with gmpy2?

  • How did you install mpfr? If from the OS package repository, you’re probably using an OS where you also need to install the development variant (often the same name plus ‘-dev’ or ‘_devel’ or similar); because only the development package will have the header files.

    – 

  • That German information message is slightly hilarious in the context of all other info messages being in English. I guess it’s Python’s build tools versus the OS.

    – 

  • @9769953 pip install mpfr –user

    – 

  • stackoverflow.com/questions/46437472/… Found in stackoverflow.com/search?q=%22fatal+error%3A+mpfr.h%22

    – 

  • 1

    Also: see gmpy2.readthedocs.io/en/latest/install.html. Which spells it out pretty much what is being told here in the comments.

    – 




Leave a Comment