从包中调用时,导入时Scipy崩溃

时间:2019-03-09 19:31:35

标签: python python-3.x numpy scipy

我正在尝试使用以下python 3软件包:https://gitlab.com/revaz/pNbody/

自从更新到numpy 1.16.2以来,我有些崩溃,不知道为什么会发生。

我彻底重新安装了pNbody软件包,并且在运行测试test/ut_test_main.py时,从软件包中导入名为cosmo的模块时调用from scipy import optimize时,代码崩溃了: / p>

Traceback (most recent call last):
  File "./ut_test_main.py", line 63, in <module>
    nb = pn.Nbody(rt1, ftype='gadget')
  File "/home/mivkov/.local/lib/python3.6/site-packages/pNbody-5.0-py3.6-linux-x86_64.egg/pNbody/main.py", line 185, in __init__
    self.find_format(ftype)
  File "/home/mivkov/.local/lib/python3.6/site-packages/pNbody-5.0-py3.6-linux-x86_64.egg/pNbody/main.py", line 334, in find_format
    self.import_check_ftype(formatfile)
  File "/home/mivkov/.local/lib/python3.6/site-packages/pNbody-5.0-py3.6-linux-x86_64.egg/pNbody/main.py", line 278, in import_check_ftype
    mod = __import__(module_name)
  File "/home/mivkov/.local/lib/python3.6/site-packages/pNbody-5.0-py3.6-linux-x86_64.egg/config/formats/gadget.py", line 24, in <module>
    from pNbody import units, ctes, cosmo, thermodyn
File "/home/mivkov/.local/lib/python3.6/site-packages/pNbody-5.0-py3.6-linux-x86_64.egg/pNbody/cosmo.py", line 22, in <module>
    from scipy import optimize
  File "/home/mivkov/.local/lib/python3.6/site-packages/scipy/optimize/__init__.py", line 387, in <module>
    from ._minimize import *
  File "/home/mivkov/.local/lib/python3.6/site-packages/scipy/optimize/_minimize.py", line 28, in <module>
    from ._trustregion_krylov import _minimize_trust_krylov
  File "/home/mivkov/.local/lib/python3.6/site-packages/scipy/optimize/_trustregion_krylov.py", line 2, in <module>
    from ._trlib import (get_trlib_quadratic_subproblem)
  File "/home/mivkov/.local/lib/python3.6/site-packages/scipy/optimize/_trlib/__init__.py", line 1, in <module>
    from ._trlib import TRLIBQuadraticSubproblem
  File "__init__.pxd", line 918, in init scipy.optimize._trlib._trlib
RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject

真正让我困惑的是,当我在另一个脚本中导入cosmo模块时,一切工作正常,例如在存储库中的文件test/ut_test_cosmo.py中。那一个很好用。

此外,当我仅在终端中运行python3并尝试导入导致错误的相同scipy模块时,一切似乎都正常运行:

Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy import optimize
>>> from scipy.optimize import *

工作顺利。

我不知道在哪里查找错误,我很高兴得到任何提示。 我已经验证过,我总是通过打印numpy.__file__scipy.__file来调用相同的scipy(1.2.1版)和numpy文件,现在我完全不了解了。

编辑:新信息

我制作了一个新的virtualenv并从头开始安装了所有内容(numpy,scipy,pNbody及其依赖项)。 numpy 1.16仍然存在该问题,但numpy 1.15似乎仍然存在。

仍然不知道在哪里查找此错误。

0 个答案:

没有答案