ioam / topographica

A general-purpose neural simulator focusing on topographic maps.
topographica.org
BSD 3-Clause "New" or "Revised" License
53 stars 32 forks source link

Repeated Numpy warning: Using deprecated NumPy API #559

Closed davidljung closed 10 years ago

davidljung commented 10 years ago

Hello. After following the directions for 'installing' topographica from github on Ubuntu 14.04 LTS, I receive repeated Numpy warnings. I installed the dependencies using apt-get and cloned the repositories.

I can run an interactive session by invoking ./topographica and the session outputs:

$ ./topographica -a -c "generate_example('gcal_10000.typ')"``
...
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from /home/ubuntu/.cache/scipy/python27_compiled/sc_0c2671ff316a54a9e8e81f695ff0bf8c0.cpp:22:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

This is running in a newly installed Ubuntu AWS EC2 instance.

jbednar commented 10 years ago

Yes, those annoy us too. They aren't to do with Topographica itself, but come from the weave module from scipy that we use:

$ python
Python 2.6.6 (r266:84292, Nov 21 2013, 12:39:37) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
>>> from scipy import weave
>>> weave.inline('')
In file included from /usr/lib64/python2.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728,
                 from /usr/lib64/python2.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib64/python2.6/site-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from /afs/inf.ed.ac.uk/user/j/jbednar/.python26_compiled/sc_67933097fdd75c33d4a8510b92e036030.cpp:22:
/usr/lib64/python2.6/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
>>> 

Unfortunately, I can't make much sense of what the numpy developers say about the warnings:

https://github.com/numpy/numpy/issues/3008

and we still see them with the latest version of numpy and weave that we have tested.

From the message text, it sounds like the message would go away if weave is recompiled with the suggested #define, but I certainly don't want to have to be custom-compiling weave! If you find a solution that doesn't require that, then please let us know!

jlstevens commented 9 years ago

These warnings have annoyed me to the point where I had to find a way to shut them up.

I simply added:

inline_named_params['extra_compile_args'].append('-w')

To line 130 of topo/misc/inlinec.py.

Can I commit this?

It is bad in general to disable warnings but this one is both annoying and out of our control...

jbednar commented 9 years ago

Ok, as long as the purpose for it is clearly labeled in an comment, stating that we should try removing it with each subsequent release to remove it as soon as it is no longer necessary.

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.

jbednar commented 9 years ago

I found a more specific way to do it, using -wno-cpp, which at least only silences #warning messages, not all warnings, and so I've committed that.

quantum6 commented 5 years ago

define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION

jbednar commented 5 years ago

Sure, you can define that, but in this case the warnings are generated from the underlying weave library, not from topographica, so the way to fix it with #define would have to be to recompile weave, not topographica. That's not something we'd do in this project...