Forums

How to install Bigfloat on pythonanywhere

I'm a bit lost with installing bigfloat. When I try to install it using "pip install bigfloat" but I keep getting this error. Is there something I am neglecting to do?

running build_ext building 'mpfr' extension creating build/temp.linux-x86_64-2.7 x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c mpfr. c -o build/temp.linux-x86_64-2.7/mpfr.o mpfr.c:344:18: fatal error: mpfr.h: No such file or directory #include "mpfr.h" ^ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


Failed building wheel for bigfloat Running setup.py clean for bigfloat Failed to build bigfloat Installing collected packages: bigfloat Running setup.py install for bigfloat ... error Complete output from command /usr/local/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-build-sIShbP/bigfloat/setup.py ';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-N3iTVQ-re cord/install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build/lib.linux-x86_64-2.7 creating build/lib.linux-x86_64-2.7/bigfloat copying bigfloat/context.py -> build/lib.linux-x86_64-2.7/bigfloat copying bigfloat/rounding_mode.py -> build/lib.linux-x86_64-2.7/bigfloat copying bigfloat/ieee.py -> build/lib.linux-x86_64-2.7/bigfloat copying bigfloat/init.py -> build/lib.linux-x86_64-2.7/bigfloat copying bigfloat/core.py -> build/lib.linux-x86_64-2.7/bigfloat creating build/lib.linux-x86_64-2.7/bigfloat/test copying bigfloat/test/testall_.py -> build/lib.linux-x86_64-2.7/bigfloat/test copying bigfloat/test/test_mpfr.py -> build/lib.linux-x86_64-2.7/bigfloat/test copying bigfloat/test/init__.py -> build/lib.linux-x86_64-2.7/bigfloat/test copying bigfloat/test/test_bigfloat.py -> build/lib.linux-x86_64-2.7/bigfloat/test copying bigfloat/test/test_context.py -> build/lib.linux-x86_64-2.7/bigfloat/test copying bigfloat/test/test_rounding_mode.py -> build/lib.linux-x86_64-2.7/bigfloat/test running build_ext building 'mpfr' extension creating build/temp.linux-x86_64-2.7 x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c mpf r.c -o build/temp.linux-x86_64-2.7/mpfr.o mpfr.c:344:18: fatal error: mpfr.h: No such file or directory #include "mpfr.h" ^ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Command "/usr/local/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-build-sIShbP/bigfloat/setup.py';exec(compile(getattr(t okenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-N3iTVQ-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-sIShbP/bigfloat/

Bigfloat uses the GNU MPFR library which we don't have installed on PythonAnywhere. You could try installing MPFR from source into your home directory and linking against that when you pip install.

I am fairly new to Python--how would I install MPFR from source into my home directory and link against it? Thanks.

I tried to use pip install --user mpfr but I get this message: Collecting mpfr Could not find a version that satisfies the requirement mpfr (from versions: ) No matching distribution found for mpfr

MPFR is not a Python package. It is a C library that is used by Bigfloat. You'll have to compile it into your home directory - there may be instructions either in the MPFR documentation or in the bigfloat documentation.