From owner-freebsd-python@freebsd.org Thu Mar 29 17:17:26 2018 Return-Path: Delivered-To: freebsd-python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC4A8F6444C for ; Thu, 29 Mar 2018 17:17:26 +0000 (UTC) (envelope-from sergey@akhmatov.ru) Received: from dutch.chaklun.ru (dutch.chaklun.ru [IPv6:2a01:7c8:aab0:135::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D7F579424 for ; Thu, 29 Mar 2018 17:17:26 +0000 (UTC) (envelope-from sergey@akhmatov.ru) Received: from [212.65.69.61] (helo=[127.0.0.1]) by dutch.chaklun.ru with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1 (FreeBSD)) (envelope-from ) id 1f1bAz-0003v5-6b for freebsd-python@freebsd.org; Thu, 29 Mar 2018 20:17:25 +0300 To: freebsd-python@freebsd.org From: Sergey Akhmatov Subject: math/py-numpy + databases/py-MySQLdb compatibility issues Message-ID: <2d4f1843-fc9d-f03d-ab09-8e293e2a4d2a@akhmatov.ru> Date: Thu, 29 Mar 2018 20:17:23 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Mar 2018 17:17:26 -0000 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 "", line 1, in   File "/usr/local/lib/python2.7/site-packages/numpy/__init__.py", line 142, in     from . import add_newdocs   File "/usr/local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in     from numpy.lib import add_newdoc   File "/usr/local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in     from .type_check import *   File "/usr/local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in     import numpy.core.numeric as _nx   File "/usr/local/lib/python2.7/site-packages/numpy/core/__init__.py", line 26, in     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?