Hello,

I have written a C-extension for python that uses arrays from python, does 
calculations on them and returns a result on that.

I have now also added the possibility to provide numpy arrays. However this is 
not a requirement. Python arrays (lists) are still allowed also. I check in the 
C-code which kind of arrays are provided.

That all works ok, but I have one problem. In the initialisation function for 
the extension I call import_array to initialise the numpy library.
The problem is if numpy is not installed on the system, that this call 
generates a message and an error and the rest of the routine is aborted.
Via the source code of numpy I discovered that import_array is in fact a macro 
that calls _import_array and checks its return value to give the message.
But even it I call _import_array myself and check for the return code, after 
the initialisation routine has finished I still get the message 'No module 
named numpy.core.multiarray'.

How can I test if numpy is installed on the system from the extension so that I 
do not active the numpy functionality and that it is still able to use my 
extension, but then without numpy support?

I have searched in the manual and documentation, searched in google, but I do 
not find an answer on that question.
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to