Import Error

Dear graph_tool users,

I try to use graph_tool on my Mac OS X 10.6.8.
I used Macport to install py-27-graph-tool and it seems to work perfectly.
But now, when I try to import graph_tool, I have successively 2 errors:

Python 2.7.6 (default, Nov 12 2013, 13:10:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

1)

import graph_tool as gt

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/__init__.py", line 96, in <module>
    import scipy.stats
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/stats/__init__.py", line 324, in <module>
    from .stats import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/stats/stats.py", line 242, in <module>
    import scipy.special as special
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/special/__init__.py", line 531, in <module>
    from ._ufuncs import *
  File "__init__.pxd", line 155, in init scipy.special._ufuncs (scipy/special/_ufuncs.c:20976)
ValueError: numpy.dtype has the wrong size, try recompiling

2)

import graph_tool.all as gt

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/__init__.py", line 96, in <module>
    import scipy.stats
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/stats/__init__.py", line 324, in <module>
    from .stats import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/stats/stats.py", line 242, in <module>
    import scipy.special as special
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/special/__init__.py", line 533, in <module>
    from .basic import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/special/basic.py", line 12, in <module>
    from ._ufuncs import ellipkm1, mathieu_a, mathieu_b, iv, jv, gamma, psi, zeta, \
ImportError: cannot import name ellipkm1

Could you help me solve this problem?

Best regards,
Sandrine

attachment.html (3.37 KB)

Hi,

That kind of things happen when your numpy version is not the same as
the one used to compile graph-tool..

Maybe you can try to get the newer version of numpy and scipy (or older
ones if this problem appeared after you upgraded).

Hope it helps,

Guillaume

attachment.html (4.98 KB)

Dear graph_tool users,

I try to use graph_tool on my Mac OS X 10.6.8.
I used Macport to install py-27-graph-tool and it seems to work perfectly.
But now, when I try to import graph_tool, I have successively 2 errors:

Python 2.7.6 (default, Nov 12 2013, 13:10:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

1)

*>>> import graph_tool as gt*
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/__init__.py", line 96, in <module>
    import scipy.stats
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/stats/__init__.py", line 324, in <module>
    from .stats import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/stats/stats.py", line 242, in <module>
    import scipy.special as special
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/special/__init__.py", line 531, in <module>
    from ._ufuncs import *
  File "__init__.pxd", line 155, in init scipy.special._ufuncs (scipy/special/_ufuncs.c:20976)
*ValueError: numpy.dtype has the wrong size, try recompiling*

2)

*import graph_tool.all as gt*

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/__init__.py", line 96, in <module>
    import scipy.stats
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/stats/__init__.py", line 324, in <module>
    from .stats import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/stats/stats.py", line 242, in <module>
    import scipy.special as special
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/special/__init__.py", line 533, in <module>
    from .basic import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/special/basic.py", line 12, in <module>
    from ._ufuncs import ellipkm1, mathieu_a, mathieu_b, iv, jv, gamma, psi, zeta, \
*ImportError: cannot import name ellipkm1*

// Could you help me solve this problem?

Do you observe the sample problems simply by importing scipy, without
graph-tool? For instance:

    >>> import scipy
    >>> import scipy.stats

If you observe the same problem, then clearly the problem would be with
scipy. You should try simply re-installing it.

If you still have the same problems afterwards, I suggest you contact
the macports maintainers, and report a bug:

    https://trac.macports.org/auth/login/?next=/newticket

Best,
Tiago

Hello,

Thank you for your suggestions. Actually, there were 2 versions
of scipy and numpy installed on my computer.
So, I uninstalled and re-install everything (scipy, numpy, graph_tool).
Unfortunately, I observe the same problem.

I will now contact the macports maintainers, as you suggest.

Best regards,

Sandrine

attachment.html (4.47 KB)