FS#32072  [pythonscipy] Import problems with pythonscipy and python 3.3
Attached to Project:
Community Packages
Opened by Vlad Seghete (vlsd)  Thursday, 18 October 2012, 22:41 GMT
Last edited by Jelle van der Waa (jelly)  Saturday, 17 November 2012, 12:43 GMT
Opened by Vlad Seghete (vlsd)  Thursday, 18 October 2012, 22:41 GMT
Last edited by Jelle van der Waa (jelly)  Saturday, 17 November 2012, 12:43 GMT

Details
After upgrading to python3.3 scipy is experiencing crippling
problems. Notably, in my case, when I try and import
scipy.integrate I get the following:
>>> import scipy >>> import scipy.integrate Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.3/sitepackages/scipy/integrate/__init__.py", line 50, in <module> from .quadrature import * File "/usr/lib/python3.3/sitepackages/scipy/integrate/quadrature.py", line 5, in <module> from scipy.special.orthogonal import p_roots File "/usr/lib/python3.3/sitepackages/scipy/special/__init__.py", line 532, in <module> from .lambertw import lambertw File "lambertw.pyx", line 24, in init scipy.special.lambertw (scipy/special/lambertw.c:1588) ValueError: level must be >= 0 There is a similar bug posted on the scipy dev trac [1], which makes me think that this is probably an upstream bug. Packages involved: * python 3.3.01, pythonscipy 0.11.0, pythonnumpy 1.7.01 Steps to reproduce: run the following: python3.3 c 'import scipy.integrate' [1] http://projects.scipy.org/scipy/ticket/1739 
This task depends upon
Closed by Jelle van der Waa (jelly)
Saturday, 17 November 2012, 12:43 GMT
Reason for closing: Fixed
Additional comments about closing: fixed by patching
Saturday, 17 November 2012, 12:43 GMT
Reason for closing: Fixed
Additional comments about closing: fixed by patching
The index argument to __import__() now defaults to 0 instead of 1 and no longer support negative values. It was an oversight when PEP 328 was implemented that the default value remained 1. If you need to continue to perform a relative import followed by an absolute import, then perform the relative import using an index of 1, followed by another import using an index of 0. It is preferred, though, that you use importlib.import_module() rather than call __import__() directly.
As a data point, if I import something directly ("import numpy", "import scipy") things work. if I import one of my own modules with no relative imports from the directory the module is in, _most_of them work; e.g. if I go to my .../numpy_ext directory (see below) and "import npe_fits", it works. If I attempt to import that same working module from an alternate directory, then I get something like this:
In [2]: import numpy_ext.npe_fits as fits

ImportError Traceback (most recent call last)
<ipythoninput2f1197ac680f1> in <module>()
> 1 import numpy_ext.npe_fits as fits
/home/ressler/Python/Common/numpy_ext/__init__.py in <module>()
5 from .npe_convenience import *
6 from .npe_obsolete import *
> 7 from .npe_bbflux import *
8 from .npe_fitting import *
9 from .npe_fits import *
/home/ressler/Python/Common/numpy_ext/npe_bbflux.py in <module>()
108 av_rl=av_rlx[q]
109
> 110 from scipy.interpolate import splrep,splev
111 def drainelee(w) :
112 """Return the extinction values from a DraineLee curve between 0.1 and 1000 um
/usr/lib/python3.3/sitepackages/scipy/interpolate/__init__.py in <module>()
146 """
147
> 148 from .interpolate import *
149 from .fitpack import *
150
/usr/lib/python3.3/sitepackages/scipy/interpolate/interpolate.py in <module>()
11 dot, poly1d, asarray, intp
12 import numpy as np
> 13 import scipy.special as spec
14 import math
15
/usr/lib/python3.3/sitepackages/scipy/special/__init__.py in <module>()
526
527 from .basic import *
> 528 from . import specfun
529 from . import orthogonal
530 from .orthogonal import *
ImportError: cannot import name specfun
http://pkgbuild.com/~jelle/pythonscipy0.11.03x86_64.pkg.tar.xz
>>> import scipy.stats
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.3/sitepackages/scipy/stats/__init__.py", line 321, in <module>
from .stats import *
File "/usr/lib/python3.3/sitepackages/scipy/stats/stats.py", line 199, in <module>
from . import distributions
ImportError: cannot import name distributions
Thanks!
Were your changes patches to the upstream code or something in the Arch build files?