#47276: Scipy packages not importing ("cannot import" .integrate, .specfun, .special, .sparse) --------------------------------+-------------------- Reporter: alison.mansheim@… | Owner: sean@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.3 Resolution: | Keywords: Port: py-scipy | --------------------------------+-------------------- Description changed by mf2k@…: Old description:
I have had this problem with every version of scipy I've tried since 0.14.0 (currently am running the latest 15.1). Each time scipy and dependencies installed cleanly using macports for py27 on mac OSX 10.6.8. After upgrading to 0.14.0, some of the functions will not import ( those inside scipy.integrate, .specfun, .special, .sparse). I tried uninstalling and re-installing everything and still no luck. I found some older threads that reported a similar problem for older versions, but then closed because they were fixed in an upgrade.
For example, when I run a function that uses scipy.integrate.quad():
In [10]: cosmo.ProjectedLength(0.5) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-10-38d57df266ec> in <module>() ----> 1 cosmo.ProjectedLength(0.5) /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/cluster_tools/cosmo.pyc in ProjectedLength(z, h, Om, Ol) 58 Assumes small angles (i.e.: Da*Theta = Projected Length, i.e. sin(Theta)=Theta) 59 """ ---> 60 return Da(z,h,Om,Ol)/3437.75 #given that 1 radian = 3437.75 arcminutes 61 62 def lensgeo(zl,zs,h=0.7,Om=0.3,Ol=0.7): /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/cluster_tools/cosmo.pyc in Da(z, h, Om, Ol) 38 Returns the cosmological angular diameter distance (in units of Mpc) 39 """ ---> 40 f0 = scipy.integrate.quad(lambda x: chi(x,Om,Ol),0,z)[0] 41 #f0 = Integral(chi(x,Om,Ol),(x,0,z)) 42 da = c/(100.0*h)/(1+z)*f0.n() AttributeError: 'module' object has no attribute 'integrate'
When I try to import one of the packages I also get an error:
In [15]: import scipy.integrate --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-15-4d37fa311919> in <module>() ----> 1 import scipy.integrate /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/scipy/integrate/__init__.py in <module>() 49 from __future__ import division, print_function, absolute_import 50 ---> 51 from .quadrature import * 52 from .odepack import * 53 from .quadpack import * /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/scipy/integrate/quadrature.py in <module>() 4 'cumtrapz','newton_cotes'] 5 ----> 6 from scipy.special.orthogonal import p_roots 7 from scipy.special import gammaln 8 from numpy import sum, ones, add, diff, isinf, isscalar, \ /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/scipy/special/__init__.py in <module>() 547 548 from .basic import * --> 549 from . import specfun 550 from . import orthogonal 551 from .orthogonal import * ImportError: cannot import name specfun
I looked in the scipy directories and the /integrate/quadrature.pyc and special/orthogonal.pyc and /special/specfun.so exist. I had similar problems that I traced to other .so's, so I thought there was an issue with my compiler, but I thought macports would have detected this. I did not have this problem with older versions of scipy.
I posted this problem on scipy git and they replied "You can try asking the macports people for support with their Scipy packaging."
I would appreciate any help you can offer! There are a lot of useful packages that rely on these functions.
Thank you, Alison
New description: I have had this problem with every version of scipy I've tried since 0.14.0 (currently am running the latest 15.1). Each time scipy and dependencies installed cleanly using macports for py27 on mac OSX 10.6.8. After upgrading to 0.14.0, some of the functions will not import ( those inside scipy.integrate, .specfun, .special, .sparse). I tried uninstalling and re-installing everything and still no luck. I found some older threads that reported a similar problem for older versions, but then closed because they were fixed in an upgrade. For example, when I run a function that uses scipy.integrate.quad(): {{{ In [10]: cosmo.ProjectedLength(0.5) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-10-38d57df266ec> in <module>() ----> 1 cosmo.ProjectedLength(0.5) /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/cluster_tools/cosmo.pyc in ProjectedLength(z, h, Om, Ol) 58 Assumes small angles (i.e.: Da*Theta = Projected Length, i.e. sin(Theta)=Theta) 59 """ ---> 60 return Da(z,h,Om,Ol)/3437.75 #given that 1 radian = 3437.75 arcminutes 61 62 def lensgeo(zl,zs,h=0.7,Om=0.3,Ol=0.7): /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/cluster_tools/cosmo.pyc in Da(z, h, Om, Ol) 38 Returns the cosmological angular diameter distance (in units of Mpc) 39 """ ---> 40 f0 = scipy.integrate.quad(lambda x: chi(x,Om,Ol),0,z)[0] 41 #f0 = Integral(chi(x,Om,Ol),(x,0,z)) 42 da = c/(100.0*h)/(1+z)*f0.n() AttributeError: 'module' object has no attribute 'integrate' }}} When I try to import one of the packages I also get an error: {{{ In [15]: import scipy.integrate --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-15-4d37fa311919> in <module>() ----> 1 import scipy.integrate /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/scipy/integrate/__init__.py in <module>() 49 from __future__ import division, print_function, absolute_import 50 ---> 51 from .quadrature import * 52 from .odepack import * 53 from .quadpack import * /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/scipy/integrate/quadrature.py in <module>() 4 'cumtrapz','newton_cotes'] 5 ----> 6 from scipy.special.orthogonal import p_roots 7 from scipy.special import gammaln 8 from numpy import sum, ones, add, diff, isinf, isscalar, \ /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/scipy/special/__init__.py in <module>() 547 548 from .basic import * --> 549 from . import specfun 550 from . import orthogonal 551 from .orthogonal import * ImportError: cannot import name spec fun }}} I looked in the scipy directories and the /integrate/quadrature.pyc and special/orthogonal.pyc and /special/specfun.so exist. I had similar problems that I traced to other .so's, so I thought there was an issue with my compiler, but I thought macports would have detected this. I did not have this problem with older versions of scipy. I posted this problem on scipy git and they replied "You can try asking the macports people for support with their Scipy packaging." I would appreciate any help you can offer! There are a lot of useful packages that rely on these functions. Thank you, Alison -- -- Ticket URL: <https://trac.macports.org/ticket/47276#comment:2> MacPorts <https://www.macports.org/> Ports system for OS X