math/py-numpy + databases/py-MySQLdb compatibility issues
Sergey Akhmatov
sergey at akhmatov.ru
Thu Mar 29 17:17:26 UTC 2018
Hello,
I've experienced very strange problem with two pyhon modules in one script:
Steps to reproduce:
Clean 11.1 amd64 installation.
pkg repo set to pkg+http://pkg.FreeBSD.org/${ABI}/latest
# pkg install py27-numpy py27-MySQLdb
$ python2.7
Python 2.7.14 (default, Mar 15 2018, 01:13:31)
[GCC 4.2.1 Compatible FreeBSD Clang 4.0.0 (tags/RELEASE_400/final
297347)] on freebsd11
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/numpy/__init__.py", line
142, in <module>
from . import add_newdocs
File "/usr/local/lib/python2.7/site-packages/numpy/add_newdocs.py",
line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/site-packages/numpy/lib/__init__.py",
line 8, in <module>
from .type_check import *
File
"/usr/local/lib/python2.7/site-packages/numpy/lib/type_check.py", line
11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/site-packages/numpy/core/__init__.py",
line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: /lib/libgcc_s.so.1: version GCC_4.6.0 required by
/usr/local/lib/gcc6/libgfortran.so.3 not found
---------
BUT, when i import modules in reverse order, it works fine:
Python 2.7.14 (default, Mar 15 2018, 01:13:31)
[GCC 4.2.1 Compatible FreeBSD Clang 4.0.0 (tags/RELEASE_400/final
297347)] on freebsd11
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import MySQLdb
>>>
----------
I've tried to investigate dependencies and found out that
libgfortran.so.3 from gcc6, used by numpy is linked, with libgcc_s.so.1
from gcc6
$ ldd /usr/local/lib/gcc6/libgfortran.so.3
/usr/local/lib/gcc6/libgfortran.so.3:
libquadmath.so.0 => /usr/local/lib/gcc6/libquadmath.so.0
(0x801327000)
libm.so.5 => /lib/libm.so.5 (0x801566000)
libgcc_s.so.1 => /usr/local/lib/gcc6/libgcc_s.so.1 (0x801791000)
libc.so.7 => /lib/libc.so.7 (0x800824000)
And _mysql.so from py-MySQLdb is linked with libgcc_s.so.1 from base system:
$ ldd /usr/local/lib/python2.7/site-packages/_mysql.so
/usr/local/lib/python2.7/site-packages/_mysql.so:
...
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x803572000)
I have no clue if this could actually cause problem.
Could someone please reproduce this behavior and/or give some hints how
to investigate further?
More information about the freebsd-python
mailing list