On 06/21/2011 01:01 AM, Ralf Gommers wrote:
On Tue, Jun 21, 2011 at 3:55 AM, Bruce Southey <bsout...@gmail.com
<mailto:bsout...@gmail.com>> wrote:
On Mon, Jun 20, 2011 at 2:43 PM, Ralf Gommers
<ralf.gomm...@googlemail.com <mailto:ralf.gomm...@googlemail.com>>
wrote:
>
>
> On Mon, Jun 20, 2011 at 8:50 PM, Bruce Southey
<bsout...@gmail.com <mailto:bsout...@gmail.com>> wrote:
>>
>> I copied the files but that just moves the problem. So that
patch is
>> incorrect.
>>
>> I get the same errors on Fedora 15 supplied Python3.2 for numpy
1.6.0 and
>> using git from 'https://github.com/rgommers/numpy.git'. Numpy
is getting
>> Fedora supplied Atlas (1.5.1 does not).
>>
>> It appears that there is a misunderstanding of the PEP because
'SO' and
>> 'SOABI' do exactly what the PEP says on my systems:
>
> It doesn't on OS X. But that's not even the issue. As I
explained before,
> the issue is that get_config_var('SO') is used to determine the
extension of
> system libraries (such as liblapack.so) and python-related ones
(such as
> multiarray.cpython-32m.so <http://multiarray.cpython-32m.so>).
And the current functions don't do mindreading.
>>
>> >>> from distutils import sysconfig sysconfig.get_config_var('SO')
>> '.cpython-32m.so'
>> >>> sysconfig.get_config_var('SOABI')
>> 'cpython-32m'
>>
>> Consequently, the name, 'multiarray.pyd', created within numpy
is invalid.
>
> I removed the line in ctypeslib that was trying this, so I think
you are not
> testing my patch.
>
> Ralf
>
>>
>> Looking the code, I see this line which makes no sense given
that the
>> second part is true under Linux:
>>
>> if (not is_python_ext) and 'SOABI' in
>> distutils.sysconfig.get_config_vars():
>>
>> So I think the 'get_shared_lib_extension' function is wrong and
probably
>> unneeded.
>>
>>
>> Bruce
>>
Just to show that this is the new version, I added two print
statements in the 'get_shared_lib_extension' function:
>>> from numpy.distutils.misc_util import get_shared_lib_extension
>>> get_shared_lib_extension(True)
first so_ext .cpython-32mu.so
returned so_ext .cpython-32mu.so
'.cpython-32mu.so'
>>> get_shared_lib_extension(False)
first so_ext .cpython-32mu.so
returned so_ext .so
'.so'
This all looks correct. Before you were saying you were still getting
'multiarray.pyd', now your error says 'multiarray.so'. So now you are
testing the right thing. Test test_basic2() in test_ctypeslib was
fixed, but I forgot to fix it in two other places. I updated both my
branches on github, please try again.
The reason for the same location is obvious because all the patch does
is move the code to get the extension into that function. So the
'get_shared_lib_extension' function returns the extension '.so' to the
load_library function. However that name is wrong under Linux as it
has to be 'multiarray.cpython-32mu.so
<http://multiarray.cpython-32mu.so>' and hence the error in the same
location. I did come across this thread
'http://bugs.python.org/issue10262' which indicates why Linux is
different by default.
So what is the actual name of the multiarray shared library with
the Mac?
If it is ' 'multiarray.so' then the correct name is "libname +
sysconfig.get_config_var('SO')" as I previously indicated.
It is, and yes that's correct. Orthogonal to the actual issue though.
Ralf
While the test now pass, you have now changed an API for load_library.
This is not something that is meant to occur in a bug-fix release as
well as the new argument is undocumented. But I do not understand the
need for this extra complexity when "libname +
sysconfig.get_config_var('SO')" works on Linux, Windows and Mac.
Bruce
$ git clone git://github.com/rgommers/numpy.git numpy
$ cd numpy
$ git checkout sharedlib-ext
Switched to branch 'sharedlib-ext'
$ git branch -a
master
* sharedlib-ext
remotes/origin/1.5.x
remotes/origin/HEAD -> origin/master
remotes/origin/compilation-issues-doc
remotes/origin/doc-noinstall
remotes/origin/maintenance/1.4.x
remotes/origin/maintenance/1.5.x
remotes/origin/maintenance/1.6.x
remotes/origin/master
remotes/origin/sharedlib-ext
remotes/origin/sharedlib-ext-1.6.x
remotes/origin/swigopts
remotes/origin/ticket-1218-array2string
remotes/origin/ticket-1689-fromstring
remotes/origin/ticket-99
remotes/origin/warn-noclean-build
[built and installed numpy]
$ python3
Python 3.2 (r32:88445, Feb 21 2011, 21:11:06)
[GCC 4.6.0 20110212 (Red Hat 4.6.0-0.7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'2.0.0.dev-Unknown'
>>> np.test()
Running unit tests for numpy
NumPy version 2.0.0.dev-Unknown
NumPy is installed in /usr/lib64/python3.2/site-packages/numpy
Python version 3.2 (r32:88445, Feb 21 2011, 21:11:06) [GCC 4.6.0
20110212 (Red Hat 4.6.0-0.7)]
nose version 1.0.0
...F..............F.....E..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................K............................................................................................................................................................................................K..................................................................................................K......................K..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................../usr/lib64/python3.2/site-packages/numpy/lib/format.py:575:
ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/tmphws7d4'>
mode=mode, offset=offset)
.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................../usr/lib64/python3.2/subprocess.py:460:
ResourceWarning: unclosed file <_io.BufferedReader name=3>
return Popen(*popenargs, **kwargs).wait()
/usr/lib64/python3.2/subprocess.py:460: ResourceWarning: unclosed file
<_io.BufferedReader name=8>
return Popen(*popenargs, **kwargs).wait()
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
======================================================================
ERROR: test_datetime_divide (test_datetime.TestDateTime)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/usr/lib64/python3.2/site-packages/numpy/core/tests/test_datetime.py",
line 762, in test_datetime_divide
assert_equal(tda / tdb, 6.0 / 9.0)
TypeError: internal error: could not find appropriate datetime inner
loop in true_divide ufunc
======================================================================
FAIL: Test custom format function for each element in array.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/usr/lib64/python3.2/site-packages/numpy/core/tests/test_arrayprint.py", line
86, in test_format_function
"[0x0L 0x1L 0x2L]")
File "/usr/lib64/python3.2/site-packages/numpy/testing/utils.py",
line 313, in assert_equal
raise AssertionError(msg)
AssertionError:
Items are not equal:
ACTUAL: '[0x0 0x1 0x2]'
DESIRED: '[0x0L 0x1L 0x2L]'
======================================================================
FAIL: test_datetime_as_string (test_datetime.TestDateTime)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/usr/lib64/python3.2/site-packages/numpy/core/tests/test_datetime.py",
line 1001, in test_datetime_as_string
'1959')
File "/usr/lib64/python3.2/site-packages/numpy/testing/utils.py",
line 313, in assert_equal
raise AssertionError(msg)
AssertionError:
Items are not equal:
ACTUAL: b'1959'
DESIRED: '1959'
----------------------------------------------------------------------
Ran 3578 tests in 36.278s
FAILED (KNOWNFAIL=4, errors=1, failures=2)
<nose.result.TextTestResult run=3578 errors=1 failures=2>
>>>
>>> from numpy.distutils.misc_util import get_shared_lib_extension
>>> get_shared_lib_extension(True)
'.cpython-32mu.so'
>>> get_shared_lib_extension(False)
'.so'
>>> load_library('multiarray',
'/usr/lib64/python3.2/site-packages/numpy/core/', True)
<CDLL
'/usr/lib64/python3.2/site-packages/numpy/core/multiarray.cpython-32mu.so',
handle a5a070 at 17dd9d0>
>>> load_library('multiarray',
'/usr/lib64/python3.2/site-packages/numpy/core/')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.2/site-packages/numpy/ctypeslib.py", line
124, in load_library
raise exc
File "/usr/lib64/python3.2/site-packages/numpy/ctypeslib.py", line
121, in load_library
return ctypes.cdll[libpath]
File "/usr/lib64/python3.2/ctypes/__init__.py", line 415, in __getitem__
return getattr(self, name)
File "/usr/lib64/python3.2/ctypes/__init__.py", line 410, in __getattr__
dll = self._dlltype(name)
File "/usr/lib64/python3.2/ctypes/__init__.py", line 340, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/lib64/python3.2/site-packages/numpy/core/multiarray.so:
cannot open shared object file: No such file or directory
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion