10 views
Skip to first unread message

Kurt Smith

unread,
Aug 8, 2010, 2:33:26 PM8/8/10
to fwrap...@googlegroups.com, Antony Hallam
On Sun, Aug 8, 2010 at 5:11 AM, Antony Hallam <trha...@gmail.com> wrote:
> I get an error for all tests which looks like,
>
> ======================================================================
> ERROR: wrapping all_char.f90
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "runtests.py", line 208, in runTest
> self.runCompileTest_distutils()
> File "runtests.py", line 217, in runCompileTest_distutils
> __import__(self.projname)
> File "all_char_fwrap.pyx", line 25, in all_char_fwrap
> (all_char_fwrap.c:3504)
> NameError: np
>
> Cheers
> Tony

Hi Tony,

Strange error -- probably something simple I need to fix. I'll need
some more info:

What versions of Cython, Numpy & Python are you using? What platform
are you on?

What is the exact commandline you're using to run the tests?

What is the output of:

$ fwrapc.py --help-fcompiler

On your system? Which fortran compiler are you using?


Thanks,

Kurt

Kurt Smith

unread,
Aug 8, 2010, 7:05:44 PM8/8/10
to fwrap...@googlegroups.com
On Sun, Aug 8, 2010 at 5:48 PM, Antony Hallam <trha...@gmail.com> wrote:
> Hey Kurt,
>
> Answers bellow:

>
> On 9 August 2010 04:33, Kurt Smith <kwms...@gmail.com> wrote:
>>
>> On Sun, Aug 8, 2010 at 5:11 AM, Antony Hallam <trha...@gmail.com> wrote:
>> > I get an error for all tests which looks like,
>> >
>> > ======================================================================
>> > ERROR: wrapping all_char.f90
>> > ----------------------------------------------------------------------
>> > Traceback (most recent call last):
>> >  File "runtests.py", line 208, in runTest
>> >    self.runCompileTest_distutils()
>> >  File "runtests.py", line 217, in runCompileTest_distutils
>> >    __import__(self.projname)
>> >  File "all_char_fwrap.pyx", line 25, in all_char_fwrap
>> > (all_char_fwrap.c:3504)
>> > NameError: np
>> >
>> > Cheers
>> > Tony
>>
>> Hi Tony,
>>
>> Strange error -- probably something simple I need to fix.  I'll need
>> some more info:
>>
>> What versions of Cython, Numpy & Python are you using?  What platform
>> are you on?
>
> The platform is Linuxmint 9 x64 with Python 2.6.x , not sure about Numpy or
> Cython but should be fairly recent.

For numpy, try this:

$ python -c "import numpy; print numpy.version.version"

And for Cython:

$ cython -V

I think Debian/Ubuntu/Linuxmint package an older version of Cython
that may not have full numpy support yet, which would possibly explain
the error. Fwrap works with Cython >= 0.11.3, and likely works with
0.11. Versions around 0.9.8 are iffy (haven't tested).

>
>>
>> What is the exact commandline you're using to run the tests?
>

> I only got "test ERROR" when I ran your readme command line entry so I just
> ran
> "python runtests.py" with no arguments so I got a verbose output to see what
> was going on.


>
>>
>> What is the output of:
>>
>> $ fwrapc.py --help-fcompiler
>

> I am on a different computer at the moment so this will have to wait.


>
>>
>> On your system?  Which fortran compiler are you using?
>>

> gfortran4.4
>
>>
>> Thanks,
>>
>> Kurt
>
>

Antony Hallam

unread,
Aug 9, 2010, 6:45:49 AM8/9/10
to fwrap...@googlegroups.com
Kurt,

Just following up from before, I have:

tony@orion ~/Downloads/fwrap-0.1.0 $ cython -V
Cython version 0.11.2
tony@orion ~/Downloads/fwrap-0.1.0 $ python -c "import numpy; print
numpy.version.version"
1.3.0

I will try to update cython to 0.11.3

Cheers
Tony

On 09/08/10 09:05, Kurt Smith wrote:
> On Sun, Aug 8, 2010 at 5:48 PM, Antony Hallam<trha...@gmail.com> wrote:
>
>> Hey Kurt,
>>
>> Answers bellow:
>>
>> On 9 August 2010 04:33, Kurt Smith<kwms...@gmail.com> wrote:
>>
>>> On Sun, Aug 8, 2010 at 5:11 AM, Antony Hallam<trha...@gmail.com> wrote:
>>>
>>>> I get an error for all tests which looks like,
>>>>
>>>> ======================================================================
>>>> ERROR: wrapping all_char.f90
>>>> ----------------------------------------------------------------------
>>>> Traceback (most recent call last):
>>>> File "runtests.py", line 208, in runTest
>>>> self.runCompileTest_distutils()
>>>> File "runtests.py", line 217, in runCompileTest_distutils
>>>> __import__(self.projname)
>>>> File "all_char_fwrap.pyx", line 25, in all_char_fwrap
>>>> (all_char_fwrap.c:3504)
>>>> NameError: np
>>>>
>>>> Cheers
>>>> Tony
>>>>
>>> Hi Tony,
>>>
>>> Strange error -- probably something simple I need to fix. I'll need
>>> some more info:
>>>

>>> What versions of Cython, Numpy& Python are you using? What platform

Kurt Smith

unread,
Aug 9, 2010, 12:42:56 PM8/9/10
to fwrap...@googlegroups.com
On Mon, Aug 9, 2010 at 5:45 AM, Antony Hallam <trha...@gmail.com> wrote:
> Kurt,
>
> Just following up from before, I have:
>
> tony@orion ~/Downloads/fwrap-0.1.0 $ cython -V
> Cython version 0.11.2
> tony@orion ~/Downloads/fwrap-0.1.0 $ python -c "import numpy; print
> numpy.version.version"
> 1.3.0
>
> I will try to update cython to 0.11.3

I'm having a really hard time reproducing the error; please update to
0.11.3 and let me know if you have success.

Kurt

> --
> You received this message because you are subscribed to the Google Groups
> "Fwrap Users" group.
> To post to this group, send email to fwrap...@googlegroups.com.
> To unsubscribe from this group, send email to
> fwrap-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/fwrap-users?hl=en.
>
>

Antony Hallam

unread,
Aug 9, 2010, 4:22:12 PM8/9/10
to fwrap...@googlegroups.com
The cython website lists 0.12.1 as the latest release. Is 0.13 a beta?

Antony Hallam

unread,
Aug 9, 2010, 4:34:41 PM8/9/10
to fwrap...@googlegroups.com
Sorry Kurt,

Disregard that last email, I updated Cython to 0.12.1 and reran the
tests with the same results.

I was wondering if it is a problem with my paths? On my system I set.

export F90=/usr/bin/gfortran
export LDFLAGS='-L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran'

does that sound right? If it is not the right gfortran library, my
output from /usr for find . -name *fortran* is:

tony@orion /usr $ find . -name *fortran*
./lib/libgfortran.so.3
./lib/libgfortran.so.3.0.0
./lib/python2.6/dist-packages/numpy/distutils/mingw/gfortran_vs2003_hack.c
./lib/python2.6/dist-packages/numpy/f2py/crackfortran.py
./lib/python2.6/dist-packages/numpy/f2py/src/fortranobject.h
./lib/python2.6/dist-packages/numpy/f2py/src/fortranobject.c
./lib/python2.6/dist-packages/numpy/f2py/crackfortran.pyc
./lib/gcc/x86_64-linux-gnu/4.4/32/libgfortran.a
./lib/gcc/x86_64-linux-gnu/4.4/32/libgfortran.so
./lib/gcc/x86_64-linux-gnu/4.4/32/libgfortranbegin.a
./lib/gcc/x86_64-linux-gnu/4.4/libgfortran.a
./lib/gcc/x86_64-linux-gnu/4.4/libgfortran.so
./lib/gcc/x86_64-linux-gnu/4.4/libgfortranbegin.a
./share/pyshared/numpy/distutils/mingw/gfortran_vs2003_hack.c
./share/pyshared/numpy/f2py/crackfortran.py
./share/pyshared/numpy/f2py/src/fortranobject.h
./share/pyshared/numpy/f2py/src/fortranobject.c
./share/man/man1/x86_64-linux-gnu-gfortran-4.4.1.gz
./share/man/man1/x86_64-linux-gnu-gfortran.1.gz
./share/man/man1/gfortran.1.gz
./share/man/man1/gfortran-4.4.1.gz
./share/icons/Lush/scalable/mimetypes/gnome-mime-text-x-fortran.svg
./share/icons/Amaranth/scalable/mimetypes/gnome-mime-text-x-fortran.svg
./share/kde4/apps/katepart/syntax/fortran.xml
./share/gedit-2/plugins/snippets/fortran.xml
./share/gtksourceview-2.0/language-specs/fortran.lang
./share/apps/katepart/syntax/fortran.xml
./share/mime/text/x-fortran.xml
./share/nano/fortran.nanorc
./share/doc/gfortran
./share/doc/libgfortran3
./share/doc/gfortran-4.4
./share/doc/gfortran-multilib
./share/doc/gcc-4.4-base/fortran
./share/doc/gcc-4.4-base/test-summaries/gfortran.sum.gz
./share/doc/gfortran-4.4-multilib
./bin/gfortran
./bin/gfortran-4.4
./bin/x86_64-linux-gnu-gfortran-4.4
./bin/x86_64-linux-gnu-gfortran


On 10/08/10 02:42, Kurt Smith wrote:

Kurt Smith

unread,
Aug 9, 2010, 5:06:53 PM8/9/10
to fwrap...@googlegroups.com
On Mon, Aug 9, 2010 at 3:34 PM, Antony Hallam <trha...@gmail.com> wrote:
> Sorry Kurt,
>
> Disregard that last email, I updated Cython to 0.12.1 and reran the tests
> with the same results.

I assume you still get the "NameError: np" error?

Could you do the following? (assuming your F90 and LDFLAGS are set as
you said, that should work fine):

python runtests.py -vvvv --fcompiler=gnu95 --no-cleanup >runtests.out 2>&1

Then zip up the runtests.out file and send it to me. That will have
all the output in one place and I can take a look at it.

>
> I was wondering if it is a problem with my paths? On my system I set.
>
> export F90=/usr/bin/gfortran
> export LDFLAGS='-L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran'

This seems like a (strange) issue with the cython wrappers, not the
fortran compiler.

Kurt

Antony Hallam

unread,
Aug 9, 2010, 5:55:14 PM8/9/10
to fwrap...@googlegroups.com
Here is the output you requested.

Funny story, fwrap runs fine on my laptop which should be at least
software wise, very similar to my desktop. WEIRD!

runtests.tar

Kurt Smith

unread,
Aug 9, 2010, 6:02:38 PM8/9/10
to fwrap...@googlegroups.com
Could you try the following? I've distilled it to a test that might
zero-in on the bug.

Unpack the attached file (tar zxvvf test-cimport.tgz) and do:

$ cd test-cimport

Take a look at the makefile (and the cython sources, if you don't
trust me ;-). You might need to change the python command based on
your system.

If everything looks good do:

$ make

And let me know if there are any errors (the last line should be "@@@
from tci @@@" in the output from the make command).

Thanks!

Kurt

test-cimport.tgz

Antony Hallam

unread,
Aug 9, 2010, 6:11:54 PM8/9/10
to fwrap...@googlegroups.com
Unfortunately it fails again, but here is the output:

tony@orion ~/Downloads/test-cimport $ make
rm -r build tci.so tci.c
rm: cannot remove `build': No such file or directory
rm: cannot remove `tci.so': No such file or directory
rm: cannot remove `tci.c': No such file or directory
make: [clean] Error 1 (ignored)
python setup.py build_ext --inplace
running build_ext
cythoning tci.pyx to tci.c
building 'tci' extension
creating build
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC
-I/usr/lib/python2.6/dist-packages/numpy/core/include
-I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
/usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:
warning: �_import_array� defined but not used
tci.c:707: warning: �__pyx_k_3� defined but not used
tci.c:708: warning: �__pyx_k_4� defined but not used
tci.c:728: warning: �__pyx_k_24� defined but not used
tci.c:734: warning: �__pyx_k_26� defined but not used
tci.c:735: warning: �__pyx_k_27� defined but not used
tci.c:749: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but
not used
tci.c:1507: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__�
defined but not used
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
-L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
build/temp.linux-x86_64-2.6/tci.o -o
/home/tony/Downloads/test-cimport/tci.so
python -c "import tci"


Traceback (most recent call last):

File "<string>", line 1, in <module>
File "tci.pyx", line 1, in tci (tci.c:2419)
np.import_array()
NameError: np
make: *** [all] Error 1

Cheers
Tony

Kurt Smith

unread,
Aug 9, 2010, 6:21:53 PM8/9/10
to fwrap...@googlegroups.com
On Mon, Aug 9, 2010 at 5:11 PM, Antony Hallam <trha...@gmail.com> wrote:
> Unfortunately it fails again, but here is the output:
>
> tony@orion ~/Downloads/test-cimport $ make
> rm -r build tci.so tci.c
> rm: cannot remove `build': No such file or directory
> rm: cannot remove `tci.so': No such file or directory
> rm: cannot remove `tci.c': No such file or directory
> make: [clean] Error 1 (ignored)
> python setup.py build_ext --inplace
> running build_ext
> cythoning tci.pyx to tci.c
> building 'tci' extension
> creating build
> creating build/temp.linux-x86_64-2.6
> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
> -Wstrict-prototypes -fPIC
> -I/usr/lib/python2.6/dist-packages/numpy/core/include
> -I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
> /usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:
> warning: ‘_import_array’ defined but not used
> tci.c:707: warning: ‘__pyx_k_3’ defined but not used
> tci.c:708: warning: ‘__pyx_k_4’ defined but not used
> tci.c:728: warning: ‘__pyx_k_24’ defined but not used
> tci.c:734: warning: ‘__pyx_k_26’ defined but not used
> tci.c:735: warning: ‘__pyx_k_27’ defined but not used
> tci.c:749: warning: ‘__pyx_pf_5numpy_7ndarray___getbuffer__’ defined but not
> used
> tci.c:1507: warning: ‘__pyx_pf_5numpy_7ndarray___releasebuffer__’ defined

> but not used
> gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
> -L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
> build/temp.linux-x86_64-2.6/tci.o -o
> /home/tony/Downloads/test-cimport/tci.so
> python -c "import tci"
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> File "tci.pyx", line 1, in tci (tci.c:2419)
> np.import_array()
> NameError: np
> make: *** [all] Error 1

Good! Now we've isolated the error.

Do the following:

in tci.pyx, change the order of the top 2 lines to read:

#######################
import numpy as np
np.import_array()

print "@@@ from tci @@@"
#######################

And do a 'make' again, let me know if this works.

Thanks,

Kurt

Antony Hallam

unread,
Aug 9, 2010, 6:33:06 PM8/9/10
to fwrap...@googlegroups.com
Hey Kurt,

Different error this time; apparently numpy doesn't contain the function
import_arrayrm -r build tci.so tci.c


python setup.py build_ext --inplace
running build_ext
cythoning tci.pyx to tci.c
building 'tci' extension
creating build
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC
-I/usr/lib/python2.6/dist-packages/numpy/core/include
-I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
/usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:

warning: �_import_array� defined but not used
tci.c:707: warning: �__pyx_k_3� defined but not used
tci.c:708: warning: �__pyx_k_4� defined but not used
tci.c:728: warning: �__pyx_k_24� defined but not used
tci.c:734: warning: �__pyx_k_26� defined but not used
tci.c:735: warning: �__pyx_k_27� defined but not used
tci.c:749: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but
not used
tci.c:1507: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__�

defined but not used
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
-L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
build/temp.linux-x86_64-2.6/tci.o -o
/home/tony/Downloads/test-cimport/tci.so
python -c "import tci"
Traceback (most recent call last):
File "<string>", line 1, in <module>

File "tci.pyx", line 2, in tci (tci.c:2432)
np.import_array()
AttributeError: 'module' object has no attribute 'import_array'


make: *** [all] Error 1


Cheers
Tony

On 10/08/10 08:21, Kurt Smith wrote:
> On Mon, Aug 9, 2010 at 5:11 PM, Antony Hallam<trha...@gmail.com> wrote:
>
>> Unfortunately it fails again, but here is the output:
>>
>> tony@orion ~/Downloads/test-cimport $ make
>> rm -r build tci.so tci.c
>> rm: cannot remove `build': No such file or directory
>> rm: cannot remove `tci.so': No such file or directory
>> rm: cannot remove `tci.c': No such file or directory
>> make: [clean] Error 1 (ignored)
>> python setup.py build_ext --inplace
>> running build_ext
>> cythoning tci.pyx to tci.c
>> building 'tci' extension
>> creating build
>> creating build/temp.linux-x86_64-2.6
>> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
>> -Wstrict-prototypes -fPIC
>> -I/usr/lib/python2.6/dist-packages/numpy/core/include
>> -I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
>> /usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:

>> warning: �_import_array� defined but not used
>> tci.c:707: warning: �__pyx_k_3� defined but not used
>> tci.c:708: warning: �__pyx_k_4� defined but not used
>> tci.c:728: warning: �__pyx_k_24� defined but not used
>> tci.c:734: warning: �__pyx_k_26� defined but not used
>> tci.c:735: warning: �__pyx_k_27� defined but not used
>> tci.c:749: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but not
>> used
>> tci.c:1507: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__� defined

Ondrej Certik

unread,
Aug 9, 2010, 6:35:39 PM8/9/10
to fwrap...@googlegroups.com
On Mon, Aug 9, 2010 at 3:33 PM, Antony Hallam <trha...@gmail.com> wrote:
> Hey Kurt,
>
> Different error this time; apparently numpy doesn't contain the function
> import_arrayrm -r build tci.so tci.c
> python setup.py build_ext --inplace
> running build_ext
> cythoning tci.pyx to tci.c
> building 'tci' extension
> creating build
> creating build/temp.linux-x86_64-2.6
> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
> -Wstrict-prototypes -fPIC
> -I/usr/lib/python2.6/dist-packages/numpy/core/include
> -I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
> /usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:
> warning: ‘_import_array’ defined but not used
> tci.c:707: warning: ‘__pyx_k_3’ defined but not used
> tci.c:708: warning: ‘__pyx_k_4’ defined but not used
> tci.c:728: warning: ‘__pyx_k_24’ defined but not used
> tci.c:734: warning: ‘__pyx_k_26’ defined but not used
> tci.c:735: warning: ‘__pyx_k_27’ defined but not used
> tci.c:749: warning: ‘__pyx_pf_5numpy_7ndarray___getbuffer__’ defined but not
> used
> tci.c:1507: warning: ‘__pyx_pf_5numpy_7ndarray___releasebuffer__’ defined

> but not used
> gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
> -L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
> build/temp.linux-x86_64-2.6/tci.o -o
> /home/tony/Downloads/test-cimport/tci.so
> python -c "import tci"
> Traceback (most recent call last):
>  File "<string>", line 1, in <module>
>  File "tci.pyx", line 2, in tci (tci.c:2432)
>    np.import_array()
> AttributeError: 'module' object has no attribute 'import_array'

I am pretty sure that Kurt meant:

cimport numpy as np

instead of

import numpy as np

Ondrej

Antony Hallam

unread,
Aug 9, 2010, 6:41:34 PM8/9/10
to fwrap...@googlegroups.com
On 10/08/10 08:35, Ondrej Certik wrote:
> On Mon, Aug 9, 2010 at 3:33 PM, Antony Hallam<trha...@gmail.com> wrote:
>
>> Hey Kurt,
>>
>> Different error this time; apparently numpy doesn't contain the function
>> import_arrayrm -r build tci.so tci.c
>> python setup.py build_ext --inplace
>> running build_ext
>> cythoning tci.pyx to tci.c
>> building 'tci' extension
>> creating build
>> creating build/temp.linux-x86_64-2.6
>> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
>> -Wstrict-prototypes -fPIC
>> -I/usr/lib/python2.6/dist-packages/numpy/core/include
>> -I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
>> /usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:
>> warning: �_import_array� defined but not used
>> tci.c:707: warning: �__pyx_k_3� defined but not used
>> tci.c:708: warning: �__pyx_k_4� defined but not used
>> tci.c:728: warning: �__pyx_k_24� defined but not used
>> tci.c:734: warning: �__pyx_k_26� defined but not used
>> tci.c:735: warning: �__pyx_k_27� defined but not used
>> tci.c:749: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but not
>> used
>> tci.c:1507: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__� defined

>> but not used
>> gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
>> -L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
>> build/temp.linux-x86_64-2.6/tci.o -o
>> /home/tony/Downloads/test-cimport/tci.so
>> python -c "import tci"
>> Traceback (most recent call last):
>> File "<string>", line 1, in<module>
>> File "tci.pyx", line 2, in tci (tci.c:2432)
>> np.import_array()
>> AttributeError: 'module' object has no attribute 'import_array'
>>
> I am pretty sure that Kurt meant:
>
> cimport numpy as np
>
> instead of
>
> import numpy as np
>
> Ondrej
>
>
If I do that, then i get this error:

rm -r build tci.so tci.c
python setup.py build_ext --inplace
running build_ext
cythoning tci.pyx to tci.c
building 'tci' extension
creating build
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC
-I/usr/lib/python2.6/dist-packages/numpy/core/include
-I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
/usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:

warning: �_import_array� defined but not used
tci.c:703: warning: �__pyx_k_3� defined but not used
tci.c:704: warning: �__pyx_k_4� defined but not used
tci.c:724: warning: �__pyx_k_24� defined but not used
tci.c:730: warning: �__pyx_k_26� defined but not used
tci.c:731: warning: �__pyx_k_27� defined but not used
tci.c:745: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but
not used
tci.c:1503: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__�

defined but not used
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
-L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
build/temp.linux-x86_64-2.6/tci.o -o
/home/tony/Downloads/test-cimport/tci.so
python -c "import tci"
Traceback (most recent call last):
File "<string>", line 1, in <module>

File "tci.pyx", line 2, in tci (tci.c:2415)


np.import_array()
NameError: np
make: *** [all] Error 1


Cheers
Tony

Kurt Smith

unread,
Aug 9, 2010, 6:43:11 PM8/9/10
to fwrap...@googlegroups.com

No.

There is a pxd file with

'cimport numpy as np'

in it that should take care of this.

For some reason Tony's system isn't cimporting the pxd file and I
can't figure it out.

Tony, do the following (sorry for how annoying this is, but I've never
come across this error before and can't reproduce it on my box):

tci.pxd:
#-----------------------
cimport numpy as cnp
#-----------------------

tci.pyx:
#-------------------------
import numpy as np
cnp.import_array()

print "@@@ from tci @@@"

#--------------------------

And do another 'make'

Kurt

Ondrej Certik

unread,
Aug 9, 2010, 6:46:24 PM8/9/10
to fwrap...@googlegroups.com

Right, this should tell us if it can see "cnp". The error message is
weird though --- from the last output, it seems that

cimport numpy as np
np.import_array()

produces


Traceback (most recent call last):
File "<string>", line 1, in <module>

File "tci.pyx", line 2, in tci (tci.c:2415)
np.import_array()
NameError: np

Which is weird to me.

Ondrej

Antony Hallam

unread,
Aug 9, 2010, 6:46:40 PM8/9/10
to fwrap...@googlegroups.com
On 10/08/10 08:43, Kurt Smith wrote:
> On Mon, Aug 9, 2010 at 5:35 PM, Ondrej Certik<ond...@certik.cz> wrote:
>
>> On Mon, Aug 9, 2010 at 3:33 PM, Antony Hallam<trha...@gmail.com> wrote:
>>
>>> Hey Kurt,
>>>
>>> Different error this time; apparently numpy doesn't contain the function
>>> import_arrayrm -r build tci.so tci.c
>>> python setup.py build_ext --inplace
>>> running build_ext
>>> cythoning tci.pyx to tci.c
>>> building 'tci' extension
>>> creating build
>>> creating build/temp.linux-x86_64-2.6
>>> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
>>> -Wstrict-prototypes -fPIC
>>> -I/usr/lib/python2.6/dist-packages/numpy/core/include
>>> -I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
>>> /usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:
>>> warning: �_import_array� defined but not used
>>> tci.c:707: warning: �__pyx_k_3� defined but not used
>>> tci.c:708: warning: �__pyx_k_4� defined but not used
>>> tci.c:728: warning: �__pyx_k_24� defined but not used
>>> tci.c:734: warning: �__pyx_k_26� defined but not used
>>> tci.c:735: warning: �__pyx_k_27� defined but not used
>>> tci.c:749: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but not
>>> used
>>> tci.c:1507: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__� defined
Sorry Kurt,

Another error:
tony@orion ~/Downloads/test-cimport $ make


rm -r build tci.so tci.c
python setup.py build_ext --inplace
running build_ext
cythoning tci.pyx to tci.c
building 'tci' extension
creating build
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC
-I/usr/lib/python2.6/dist-packages/numpy/core/include
-I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
/usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:

warning: �_import_array� defined but not used
tci.c:709: warning: �__pyx_k_3� defined but not used
tci.c:710: warning: �__pyx_k_4� defined but not used
tci.c:730: warning: �__pyx_k_24� defined but not used
tci.c:736: warning: �__pyx_k_26� defined but not used
tci.c:737: warning: �__pyx_k_27� defined but not used
tci.c:751: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but
not used
tci.c:1509: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__�

defined but not used
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
-L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
build/temp.linux-x86_64-2.6/tci.o -o
/home/tony/Downloads/test-cimport/tci.so
python -c "import tci"
Traceback (most recent call last):
File "<string>", line 1, in <module>

File "tci.pyx", line 2, in tci (tci.c:2433)
cnp.import_array()
NameError: cnp


make: *** [all] Error 1


Note: I tried the tests on my laptop, and it didn't matter where the
********
import numpy as np
********
statement was, it still ran ok.

Cheers
Tony

Ondrej Certik

unread,
Aug 9, 2010, 6:48:15 PM8/9/10
to fwrap...@googlegroups.com
On Mon, Aug 9, 2010 at 3:46 PM, Antony Hallam <trha...@gmail.com> wrote:
> On 10/08/10 08:43, Kurt Smith wrote:
>>
>> On Mon, Aug 9, 2010 at 5:35 PM, Ondrej Certik<ond...@certik.cz>  wrote:
>>
>>>
>>> On Mon, Aug 9, 2010 at 3:33 PM, Antony Hallam<trha...@gmail.com>  wrote:
>>>
>>>>
>>>> Hey Kurt,
>>>>
>>>> Different error this time; apparently numpy doesn't contain the function
>>>> import_arrayrm -r build tci.so tci.c
>>>> python setup.py build_ext --inplace
>>>> running build_ext
>>>> cythoning tci.pyx to tci.c
>>>> building 'tci' extension
>>>> creating build
>>>> creating build/temp.linux-x86_64-2.6
>>>> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
>>>> -Wstrict-prototypes -fPIC
>>>> -I/usr/lib/python2.6/dist-packages/numpy/core/include
>>>> -I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
>>>>
>>>> /usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:
>>>> warning: ‘_import_array’ defined but not used
>>>> tci.c:707: warning: ‘__pyx_k_3’ defined but not used
>>>> tci.c:708: warning: ‘__pyx_k_4’ defined but not used
>>>> tci.c:728: warning: ‘__pyx_k_24’ defined but not used
>>>> tci.c:734: warning: ‘__pyx_k_26’ defined but not used
>>>> tci.c:735: warning: ‘__pyx_k_27’ defined but not used
>>>> tci.c:749: warning: ‘__pyx_pf_5numpy_7ndarray___getbuffer__’ defined but
>>>> not
>>>> used
>>>> tci.c:1507: warning: ‘__pyx_pf_5numpy_7ndarray___releasebuffer__’
> warning: ‘_import_array’ defined but not used
> tci.c:709: warning: ‘__pyx_k_3’ defined but not used
> tci.c:710: warning: ‘__pyx_k_4’ defined but not used
> tci.c:730: warning: ‘__pyx_k_24’ defined but not used
> tci.c:736: warning: ‘__pyx_k_26’ defined but not used
> tci.c:737: warning: ‘__pyx_k_27’ defined but not used
> tci.c:751: warning: ‘__pyx_pf_5numpy_7ndarray___getbuffer__’ defined but not
> used
> tci.c:1509: warning: ‘__pyx_pf_5numpy_7ndarray___releasebuffer__’ defined

> but not used
> gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
> -L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
> build/temp.linux-x86_64-2.6/tci.o -o
> /home/tony/Downloads/test-cimport/tci.so
> python -c "import tci"
> Traceback (most recent call last):
>  File "<string>", line 1, in <module>
>  File "tci.pyx", line 2, in tci (tci.c:2433)
>    cnp.import_array()
> NameError: cnp
> make: *** [all] Error 1

I have never seen this before either. Maybe it's time to ask at cython-users.

Ondrej

Antony Hallam

unread,
Aug 9, 2010, 6:56:33 PM8/9/10
to fwrap...@googlegroups.com
On 10/08/10 08:48, Ondrej Certik wrote:
> On Mon, Aug 9, 2010 at 3:46 PM, Antony Hallam<trha...@gmail.com> wrote:
>
>> On 10/08/10 08:43, Kurt Smith wrote:
>>
>>> On Mon, Aug 9, 2010 at 5:35 PM, Ondrej Certik<ond...@certik.cz> wrote:
>>>
>>>
>>>> On Mon, Aug 9, 2010 at 3:33 PM, Antony Hallam<trha...@gmail.com> wrote:
>>>>
>>>>
>>>>> Hey Kurt,
>>>>>
>>>>> Different error this time; apparently numpy doesn't contain the function
>>>>> import_arrayrm -r build tci.so tci.c
>>>>> python setup.py build_ext --inplace
>>>>> running build_ext
>>>>> cythoning tci.pyx to tci.c
>>>>> building 'tci' extension
>>>>> creating build
>>>>> creating build/temp.linux-x86_64-2.6
>>>>> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
>>>>> -Wstrict-prototypes -fPIC
>>>>> -I/usr/lib/python2.6/dist-packages/numpy/core/include
>>>>> -I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
>>>>>
>>>>> /usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:
>>>>> warning: �_import_array� defined but not used
>>>>> tci.c:707: warning: �__pyx_k_3� defined but not used
>>>>> tci.c:708: warning: �__pyx_k_4� defined but not used
>>>>> tci.c:728: warning: �__pyx_k_24� defined but not used
>>>>> tci.c:734: warning: �__pyx_k_26� defined but not used
>>>>> tci.c:735: warning: �__pyx_k_27� defined but not used
>>>>> tci.c:749: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but
>>>>> not
>>>>> used
>>>>> tci.c:1507: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__�
>> warning: �_import_array� defined but not used
>> tci.c:709: warning: �__pyx_k_3� defined but not used
>> tci.c:710: warning: �__pyx_k_4� defined but not used
>> tci.c:730: warning: �__pyx_k_24� defined but not used
>> tci.c:736: warning: �__pyx_k_26� defined but not used
>> tci.c:737: warning: �__pyx_k_27� defined but not used
>> tci.c:751: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but not
>> used
>> tci.c:1509: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__� defined

>> but not used
>> gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
>> -L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
>> build/temp.linux-x86_64-2.6/tci.o -o
>> /home/tony/Downloads/test-cimport/tci.so
>> python -c "import tci"
>> Traceback (most recent call last):
>> File "<string>", line 1, in<module>
>> File "tci.pyx", line 2, in tci (tci.c:2433)
>> cnp.import_array()
>> NameError: cnp
>> make: *** [all] Error 1
>>
> I have never seen this before either. Maybe it's time to ask at cython-users.
>
> Ondrej
>
>
Could I do some sort of a diff between my laptop and my desktop to
identify whether anything is missing like dependencies or on my PYTHONPATH?

Kurt Smith

unread,
Aug 9, 2010, 7:07:23 PM8/9/10
to fwrap...@googlegroups.com

Yep. I'll give it a stab over there (hopefully Tony comes along).

>
> Ondrej

Antony Hallam

unread,
Aug 9, 2010, 7:10:46 PM8/9/10
to fwrap...@googlegroups.com
On 10/08/10 09:07, Kurt Smith wrote:
On Mon, Aug 9, 2010 at 5:48 PM, Ondrej Certik <ond...@certik.cz> wrote:
  
On Mon, Aug 9, 2010 at 3:46 PM, Antony Hallam <trha...@gmail.com> wrote:
    
On 10/08/10 08:43, Kurt Smith wrote:
      
On Mon, Aug 9, 2010 at 5:35 PM, Ondrej Certik<ond...@certik.cz> �wrote:

        
On Mon, Aug 9, 2010 at 3:33 PM, Antony Hallam<trha...@gmail.com> �wrote:

          
Hey Kurt,

Different error this time; apparently numpy doesn't contain the function
import_arrayrm -r build tci.so tci.c
python setup.py build_ext --inplace
running build_ext
cythoning tci.pyx to tci.c
building 'tci' extension
creating build
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC
-I/usr/lib/python2.6/dist-packages/numpy/core/include
-I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o

/usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:
warning: �_import_array� defined but not used
tci.c:707: warning: �__pyx_k_3� defined but not used
tci.c:708: warning: �__pyx_k_4� defined but not used
tci.c:728: warning: �__pyx_k_24� defined but not used
tci.c:734: warning: �__pyx_k_26� defined but not used
tci.c:735: warning: �__pyx_k_27� defined but not used
tci.c:749: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but
not
used
tci.c:1507: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__�
defined
but not used
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
-L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
build/temp.linux-x86_64-2.6/tci.o -o
/home/tony/Downloads/test-cimport/tci.so
python -c "import tci"
Traceback (most recent call last):
�File "<string>", line 1, in<module>
�File "tci.pyx", line 2, in tci (tci.c:2432)
� �np.import_array()
AttributeError: 'module' object has no attribute 'import_array'

            
 ~/Downloads/test-cimport $ make
rm -r build tci.so tci.c
python setup.py build_ext --inplace
running build_ext
cythoning tci.pyx to tci.c
building 'tci' extension
creating build
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC
-I/usr/lib/python2.6/dist-packages/numpy/core/include
-I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
/usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:
warning: �_import_array� defined but not used
tci.c:709: warning: �__pyx_k_3� defined but not used
tci.c:710: warning: �__pyx_k_4� defined but not used
tci.c:730: warning: �__pyx_k_24� defined but not used
tci.c:736: warning: �__pyx_k_26� defined but not used
tci.c:737: warning: �__pyx_k_27� defined but not used
tci.c:751: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but not
used
tci.c:1509: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__� defined
but not used
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
-L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
build/temp.linux-x86_64-2.6/tci.o -o
/home/tony/Downloads/test-cimport/tci.so
python -c "import tci"
Traceback (most recent call last):
�File "<string>", line 1, in <module>
�File "tci.pyx", line 2, in tci (tci.c:2433)
� �cnp.import_array()
NameError: cnp
make: *** [all] Error 1
      
I have never seen this before either. Maybe it's time to ask at cython-users.
    
Yep.  I'll give it a stab over there (hopefully Tony comes along).

  
Ondrej

--
You received this message because you are subscribed to the Google Groups "Fwrap Users" group.
To post to this group, send email to fwrap...@googlegroups.com.
To unsubscribe from this group, send email to fwrap-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fwrap-users?hl=en.


    
  

Kurt,

I think you understand the error a little more then I do. If you post on cython users I will follow your lead.

Cheers
Tony
--
Regards Tony Hallam 19 Hefferan St Fairfield 4103 0407394671

Kurt Smith

unread,
Aug 9, 2010, 7:51:28 PM8/9/10
to fwrap...@googlegroups.com
One more thing to try.

See the attached file; let me know the results, thanks.

Kurt

On Mon, Aug 9, 2010 at 6:10 PM, Antony Hallam <trha...@gmail.com> wrote:
> On 10/08/10 09:07, Kurt Smith wrote:
>
> On Mon, Aug 9, 2010 at 5:48 PM, Ondrej Certik <ond...@certik.cz> wrote:
>
>
> On Mon, Aug 9, 2010 at 3:46 PM, Antony Hallam <trha...@gmail.com> wrote:
>
>
> On 10/08/10 08:43, Kurt Smith wrote:
>
>

> On Mon, Aug 9, 2010 at 5:35 PM, Ondrej Certik<ond...@certik.cz>  wrote:


>
>
>
> On Mon, Aug 9, 2010 at 3:33 PM, Antony Hallam<trha...@gmail.com>  wrote:
>
>
>
> Hey Kurt,
>
> Different error this time; apparently numpy doesn't contain the function
> import_arrayrm -r build tci.so tci.c
> python setup.py build_ext --inplace
> running build_ext
> cythoning tci.pyx to tci.c
> building 'tci' extension
> creating build
> creating build/temp.linux-x86_64-2.6
> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
> -Wstrict-prototypes -fPIC
> -I/usr/lib/python2.6/dist-packages/numpy/core/include
> -I/usr/include/python2.6 -c tci.c -o build/temp.linux-x86_64-2.6/tci.o
>
> /usr/lib/python2.6/dist-packages/numpy/core/include/numpy/__multiarray_api.h:968:

> warning: ‘_import_array’ defined but not used
> tci.c:707: warning: ‘__pyx_k_3’ defined but not used
> tci.c:708: warning: ‘__pyx_k_4’ defined but not used
> tci.c:728: warning: ‘__pyx_k_24’ defined but not used
> tci.c:734: warning: ‘__pyx_k_26’ defined but not used
> tci.c:735: warning: ‘__pyx_k_27’ defined but not used
> tci.c:749: warning: ‘__pyx_pf_5numpy_7ndarray___getbuffer__’ defined but
> not
> used
> tci.c:1507: warning: ‘__pyx_pf_5numpy_7ndarray___releasebuffer__’


> defined
> but not used
> gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
> -L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
> build/temp.linux-x86_64-2.6/tci.o -o
> /home/tony/Downloads/test-cimport/tci.so
> python -c "import tci"
> Traceback (most recent call last):

>  File "<string>", line 1, in<module>

>  File "tci.pyx", line 2, in tci (tci.c:2432)

> warning: ‘_import_array’ defined but not used
> tci.c:709: warning: ‘__pyx_k_3’ defined but not used
> tci.c:710: warning: ‘__pyx_k_4’ defined but not used
> tci.c:730: warning: ‘__pyx_k_24’ defined but not used
> tci.c:736: warning: ‘__pyx_k_26’ defined but not used
> tci.c:737: warning: ‘__pyx_k_27’ defined but not used
> tci.c:751: warning: ‘__pyx_pf_5numpy_7ndarray___getbuffer__’ defined but not
> used
> tci.c:1509: warning: ‘__pyx_pf_5numpy_7ndarray___releasebuffer__’ defined


> but not used
> gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
> -L/usr/lib/gcc/x86_64-linux-gnu/4.4/ -lgfortran
> build/temp.linux-x86_64-2.6/tci.o -o
> /home/tony/Downloads/test-cimport/tci.so
> python -c "import tci"
> Traceback (most recent call last):

>  File "<string>", line 1, in <module>

>  File "tci.pyx", line 2, in tci (tci.c:2433)

test-cimport.tgz

Antony Hallam

unread,
Aug 9, 2010, 8:34:27 PM8/9/10
to fwrap...@googlegroups.com
>> warning: �_import_array� defined but not used
>> tci.c:707: warning: �__pyx_k_3� defined but not used
>> tci.c:708: warning: �__pyx_k_4� defined but not used
>> tci.c:728: warning: �__pyx_k_24� defined but not used
>> tci.c:734: warning: �__pyx_k_26� defined but not used
>> tci.c:735: warning: �__pyx_k_27� defined but not used
>> tci.c:749: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but
>> not
>> used
>> tci.c:1507: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__�
>> warning: �_import_array� defined but not used
>> tci.c:709: warning: �__pyx_k_3� defined but not used
>> tci.c:710: warning: �__pyx_k_4� defined but not used
>> tci.c:730: warning: �__pyx_k_24� defined but not used
>> tci.c:736: warning: �__pyx_k_26� defined but not used
>> tci.c:737: warning: �__pyx_k_27� defined but not used
>> tci.c:751: warning: �__pyx_pf_5numpy_7ndarray___getbuffer__� defined but not
>> used
>> tci.c:1509: warning: �__pyx_pf_5numpy_7ndarray___releasebuffer__� defined
Kurt,

I think I may have cracked this, it appears there was a package conflict
between the new and old cython. It would read the new version in some
directories and the old version everywhere else. Go figure ey?? Sorry
about mucking your around like this but everything appears to be fine now.

Cheers
Tony

Reply all
Reply to author
Forward
0 new messages