[SciPy-Dev] Scipy on Python 3
Christoph Gohlke
cgohlke at uci.edu
Tue Sep 14 00:23:58 EDT 2010
On 9/11/2010 6:10 PM, Pauli Virtanen wrote:
> Hi,
>
> I flushed the Python 3 branch containing work from me and David to SVN
> trunk. Scipy now builds with Python 3, and all tests pass, except for
> scipy.weave which still needs to be ported.
>
> More testing is welcome. I suspect Scipy's test suite does not cover all
> of the code, so there might be some work left to do. You'll probably need
> the latest 1.5.x branch Numpy to build, due to some fixes in Numpy's
> distutils that are not in 1.5.0.
>
> Pauli
>
Thank you and David for making this available.
Will numscons eventually be ported to Python 3? So far numscons has been
the most reliable way to build scipy with Microsoft C and Intel Fortran
compilers.
Anyway, I succeeded building scipy 0.9 rev 6805 on Python 3.1 for
Windows (64 bit) using the distutils method after applying some bold
fixes. Most problems encountered are not Python 3 specific. The attached
patch gives a hint what needs to be addressed.
I am using this site.cfg with numpy 1.5.0 svn rev 8714:
[mkl]
include_dirs = C:/Program Files (x86)/Intel/Compiler/11.1/067/mkl/include
library_dirs = C:/Program Files
(x86)/Intel/Compiler/11.1/067/mkl/em64t/lib;C:/Program Files
(x86)/Intel/Compiler/11.1/067/lib/intel64
mkl_libs =
mkl_lapack95_lp64,mkl_blas95_lp64,mkl_intel_lp64,mkl_intel_thread,mkl_core,libiomp5md,libifportmd
lapack_libs =
mkl_lapack95_lp64,mkl_blas95_lp64,mkl_intel_lp64,mkl_intel_thread,mkl_core,libiomp5md,libifportmd
The problem with this configuration is that numpy.distutils expects all
the libraries to be found in a single directory, which is not the case.
Hence it claims that MKL is not available. A quick solution is to copy
libiomp5md.lib and libifportmd.lib from '.../lib/intel64' to
'.../mkl/em64t/lib'.
In order for numpy.distutils to find the ifort compiler, call
"ifortvars.bat intel64 vs2008" before "python setup.py build".
The Visual C compiler reproducibly crashes while compiling
scipy\special\cephes\polevl.c. Running the build command twice works.
Scipy\interpolate\interpnd.c uses the C99 fmax() function, which is
unknown to msvc9. Using max() instead of fmax().
The atlas_version.c files in scipy/lib/lapack/ and scipy/lib/blas/ are
not Python 3 compatible. Using the atlas_version.c file from
scipy/linalg, which has been ported.
Atlas_version.c needs 'NO_ATLAS_INFO' defined when using MKL. Using
"define_macros = [('NO_ATLAS_INFO', 1)]" when defining the extension in
setup.py.
Removing 'lsame.c' from the SuperLU source files in
scipy/sparse/linalg/dsolve/setup.py. lsame is provided by MKL.
Scipy/optimize/lbfgsb/routines.f and
scipy/sparse/linalg/eigen/arpack/ARPACK/UTIL/second.f use the etime
function, which can not be resolved even though libifportmd is linked.
Probably some underscore/case issue. Boldly replacing the function call
with a constant for now.
Scipy.test() crashes during sparse matrix slicing. See
<http://projects.scipy.org/scipy/ticket/1210>. Deleting
scipy\sparse\tests\test_base.py for now.
Below is the the test output. Looks good. The TestODR and TestNdimage
failures are known. See <http://projects.scipy.org/scipy/ticket/678> and
<http://projects.scipy.org/scipy/ticket/1238>.
--
Christoph
Running unit tests for scipy
NumPy version 1.5.0
NumPy is installed in X:\Python31\lib\site-packages\numpy
SciPy version 0.9.0.dev6805
SciPy is installed in X:\Python31\lib\site-packages\scipy
Python version 3.1.2 (r312:79149, Mar 20 2010, 22:55:39) [MSC v.1500 64
bit (AMD64)]
nose version 0.11.0
<snip>
======================================================================
ERROR: test suite for <module 'test_streams' from
'X:\Python31\lib\site-packages\scipy\io\matlab\tests\test_streams.py'>
----------------------------------------------------------------------
Traceback (most recent call last):
File "X:\Python31\lib\site-packages\nose\suite.py", line 173, in run
self.tearDown()
File "X:\Python31\lib\site-packages\nose\suite.py", line 295, in tearDown
self.teardownContext(ancestor)
File "X:\Python31\lib\site-packages\nose\suite.py", line 311, in
teardownContext
try_run(context, names)
File "X:\Python31\lib\site-packages\nose\util.py", line 453, in try_run
return func()
File
"X:\Python31\lib\site-packages\scipy\io\matlab\tests\test_streams.py",
line 47, in teardown
os.unlink(fname)
WindowsError: [Error 32] The process cannot access the file because it
is being
used by another process:
'c:\\users\\gohlke\\appdata\\local\\temp\\tmppbkhkm'
======================================================================
ERROR: Failure: ImportError (No module named c_spec)
----------------------------------------------------------------------
Traceback (most recent call last):
File "X:\Python31\lib\site-packages\nose\failure.py", line 27, in runTest
reraise(self.exc_class, self.exc_val, self.tb)
File "X:\Python31\lib\site-packages\nose\_3.py", line 7, in reraise
raise exc_class(exc_val).with_traceback(tb)
File "X:\Python31\lib\site-packages\nose\loader.py", line 372, in
loadTestsFromName
addr.filename, addr.module)
File "X:\Python31\lib\site-packages\nose\importer.py", line 39, in
importFromPath
return self.importFromDir(dir_path, fqname)
File "X:\Python31\lib\site-packages\nose\importer.py", line 84, in
importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "X:\Python31\lib\site-packages\scipy\weave\__init__.py", line
13, in <module>
from .inline_tools import inline
File "X:\Python31\lib\site-packages\scipy\weave\inline_tools.py",
line 5, in <module>
from . import ext_tools
File "X:\Python31\lib\site-packages\scipy\weave\ext_tools.py", line
7, in <module>
from . import converters
File "X:\Python31\lib\site-packages\scipy\weave\converters.py", line
5, in <module>
from . import c_spec
File "X:\Python31\lib\site-packages\scipy\weave\c_spec.py", line 380,
in <module>
import os, c_spec # yes, I import myself to find out my __file__
location.
ImportError: No module named c_spec
======================================================================
FAIL: test_extrema03 (test_ndimage.TestNdimage)
extrema 3
----------------------------------------------------------------------
Traceback (most recent call last):
File
"X:\Python31\lib\site-packages\scipy\ndimage\tests\test_ndimage.py",
line 3153, in test_extrema03
self.assertTrue(numpy.all(output1[2] == output4))
AssertionError: False is not True
======================================================================
FAIL: test_lorentz (test_odr.TestODR)
----------------------------------------------------------------------
Traceback (most recent call last):
File "X:\Python31\lib\site-packages\scipy\odr\tests\test_odr.py",
line 292, in test_lorentz
3.7798193600109009e+00]),
File "X:\Python31\lib\site-packages\numpy\testing\utils.py", line
774, in assert_array_almost_equal
header='Arrays are not almost equal')
File "X:\Python31\lib\site-packages\numpy\testing\utils.py", line
618, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Arrays are not almost equal
(mismatch 100.0%)
x: array([ 1.00000000e+03, 1.00000000e-01, 3.80000000e+00])
y: array([ 1.43067808e+03, 1.33905090e-01, 3.77981936e+00])
======================================================================
FAIL: test_multi (test_odr.TestODR)
----------------------------------------------------------------------
Traceback (most recent call last):
File "X:\Python31\lib\site-packages\scipy\odr\tests\test_odr.py",
line 188, in test_multi
0.5101147161764654, 0.5173902330489161]),
File "X:\Python31\lib\site-packages\numpy\testing\utils.py", line
774, in assert_array_almost_equal
header='Arrays are not almost equal')
File "X:\Python31\lib\site-packages\numpy\testing\utils.py", line
618, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Arrays are not almost equal
(mismatch 100.0%)
x: array([ 4. , 2. , 7. , 0.4, 0.5])
y: array([ 4.37998803, 2.43330576, 8.00288459, 0.51011472, 0.51739023])
======================================================================
FAIL: test_pearson (test_odr.TestODR)
----------------------------------------------------------------------
Traceback (most recent call last):
File "X:\Python31\lib\site-packages\scipy\odr\tests\test_odr.py",
line 235, in test_pearson
np.array([ 5.4767400299231674, -0.4796082367610305]),
File "X:\Python31\lib\site-packages\numpy\testing\utils.py", line
774, in assert_array_almost_equal
header='Arrays are not almost equal')
File "X:\Python31\lib\site-packages\numpy\testing\utils.py", line
618, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Arrays are not almost equal
(mismatch 100.0%)
x: array([ 1., 1.])
y: array([ 5.47674003, -0.47960824])
======================================================================
FAIL: test_pdist_minkowski_3_2_iris_float32 (test_distance.TestPdist)
Tests pdist(X, 'minkowski') on iris data. (float32)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"X:\Python31\lib\site-packages\scipy\spatial\tests\test_distance.py",
line 837, in test_pdist_minkowski_3_2_iris_float32
self.assertTrue(within_tol(Y_test1, Y_right, eps))
AssertionError: False is not True
----------------------------------------------------------------------
Ran 4203 tests in 39.045s
FAILED (KNOWNFAIL=8, SKIP=41, errors=2, failures=5)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: scipy_py3_msvc9.patch
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20100913/8a4179dd/attachment.ksh>
More information about the SciPy-Dev
mailing list