aleaxit / gmpy

General Multi-Precision arithmetic for Python 2.6+/3+ (GMP, MPIR, MPFR, MPC)
https://gmpy2.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
519 stars 86 forks source link

ImportError: undefined symbol mpz_limbs_write #333

Closed tanjuntao closed 1 year ago

tanjuntao commented 2 years ago

I'm working on CentOS 7.8 and using yum to install the gmp, mpfr and mpc libraries. But the latest version of mpc library provided by yum is 1.0.1, which is lower than the required minimum version of 1.0.3, so I have to choose to install these three libraries from source code.

I follow the official tutorial and successfully install gmp-5.1.0, mpfr-3.1.1 and mpc-1.1.0 in directory /usr/local/lib (I'm the root user). Then I use the following command

# python3 setup.py install

with no --prefix argument to compile the gmpy2 library, and also successfully install it in directory '/usr/local/lib64/python3.6/site-packages/gmpy2-2.1.3-py3.6-linux-x86_64.egg'.

But here is the problem:

[root@zhaohang ~]# python3 
Python 3.6.8 (default, Nov 16 2020, 16:55:22) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmpy2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib64/python3.6/site-packages/gmpy2-2.1.3-py3.6-linux-x86_64.egg/gmpy2/__init__.py", line 1, in <module>
    from .gmpy2 import *
ImportError: /usr/local/lib64/python3.6/site-packages/gmpy2-2.1.3-py3.6-linux-x86_64.egg/gmpy2/gmpy2.cpython-36m-x86_64-linux-gnu.so: undefined symbol: mpz_limbs_write
>>> 

the gmpy2 module can't be imported properly in Python, I have no idea where this problem come from.

Hope to receive some advise from your guys.

casevh commented 2 years ago

It may take me a few days to test on an older version of Linux. However, github compiles all the supported pre-compiled binary wheels for Linux when a change is pushed. Can you try selecting "Actions" and then select the completed workflow with a description of "Build Wheels #...". There should be a link to download a "wheels" file on the next page. Find the file that you need (probably gmpy2-2.13-cp36-cp36m-manylinux_2_17_x84_64.manylinux2014_x86_64.whl) and install it using pip.

tanjuntao commented 2 years ago

Thanks for your help! This works for me now!

skirpichev commented 1 year ago

Probably, this can be closed?