Home > front end >  How to install gmpy2 on Google Colab?
How to install gmpy2 on Google Colab?

Time:09-17

I am trying to install "gmpy2" on Google Colab via the command:

!pip3 install gmpy2

I get the error:

Collecting gmpy2
  Downloading gmpy2-2.0.8.zip (280 kB)
     |████████████████████████████████| 280 kB 5.0 MB/s 
Building wheels for collected packages: gmpy2
  Building wheel for gmpy2 (setup.py) ... error
  ERROR: Failed building wheel for gmpy2
  Running setup.py clean for gmpy2
Failed to build gmpy2
Installing collected packages: gmpy2
    Running setup.py install for gmpy2 ... error
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vgotfc49/gmpy2_497ebb8b22424194b2bbd366af5942b6/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vgotfc49/gmpy2_497ebb8b22424194b2bbd366af5942b6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xvhw4sjx/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/gmpy2 Check the logs for full command output.

Google Colab works on Description: Ubuntu 18.04.5 LTS Codename: bionic model name: AMD EPYC 7B12

pip3 --version
pip 21.1.3 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7)

Why can't I install "gmpy2" ? What could be the reasons for this error?

CodePudding user response:

Here's how to install gmpy2:

!apt install libmpc-dev
!pip install gmpy2
  • Related