Getting "No module named numpy" when loading "numpy.pxd" on Ubuntu linux 64

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting "No module named numpy" when loading "numpy.pxd" on Ubuntu linux 64

Parkway
Environment: Ubuntu 12.04, virtualenv (1.9.1), Python 2.7.3, Numpy 1.7.0, Cython 1.8

PyInstaller generates an executable  (--onedir) without errors.  Running the program:

(bs)$ ./myprogram_linux64

gives the error:

Traceback (most recent call last):
  File "<string>", line 9, in <module>
  File "/home/ubuntu/Programs/pyinstaller-2.0/PyInstaller/loader/pyi_importers.py", line 404, in load_module
    module = imp.load_module(fullname, fp, filename, self._c_ext_tuple)
  File "myserver.pyx", line 24, in init myserver (//home//ubuntu//Programs//mypyx/myserver.c:2844)
  File "/home/ubuntu/Programs/pyinstaller-2.0/PyInstaller/loader/pyi_importers.py", line 404, in load_module
    module = imp.load_module(fullname, fp, filename, self._c_ext_tuple)
  File "numpy.pxd", line 155, in init myresult (//home//ubuntu//Programs//mypyx/myresult.c:7875)
 
ImportError: No module named numpy

It seems as if PyInstaller is failing to load the Cython numpy.pxd module.  Adding the tuple:

a.binaries + [("numpy.pxd", "//home//ubuntu//bs//lib//python2.7//site-packages//Cython//Includes//numpy.pxd", "EXTENSION"), ...]

doesn't change the outcome.

Any ideas where the problem lies?

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Getting "No module named numpy" when loading "numpy.pxd" on Ubuntu linux 64

Martin Zibricky
dbv píše v Čt 21. 03. 2013 v 15:33 -0700:
> doesn't change the outcome.
>
> Any ideas where the problem lies?

Could it be that pyinstaller expects the .so suffix for python
extensions?

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Getting "No module named numpy" when loading "numpy.pxd" on Ubuntu linux 64

Parkway
"numpy.pxd" comes as-is with the Cython distribution.  

From the Cython documentation:

Cython generates .c files from .pyx source files.  The .c files are then compiled (with a C compiler) to .so for linux and .pyd for Windows.extensions which can be import'ed into Python (http://docs.cython.org/src/quickstart/build.html).

A .pxd file are like C-header files that contain Cython declarations, which can be imoprted into a .pyx module using cimport.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Getting "No module named numpy" when loading "numpy.pxd" on Ubuntu linux 64

Martin Zibricky
dbv píše v Čt 21. 03. 2013 v 16:50 -0700:
> A .pxd file are like C-header files that contain Cython declarations,
> which can be imoprted into a .pyx module using cimport.

Then you need to compile these files with C compiler that will produce
numpy.so and then you could use this Python C extension in your code.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Getting "No module named numpy" when loading "numpy.pxd" on Ubuntu linux 64

Parkway
With a cimport numpy, Cython imports numpy.pxd which contains compile-time information, during compilation and then creates the .so and .pyd binaries.  So, still a bit clueless about why numpy is not being imported.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Getting "No module named numpy" when loading "numpy.pxd" on Ubuntu linux 64

Parkway
Martin:  
Got it to work.  The pathex needed a path to the numpy directory in addition to the site-packages directory.
Btw, the executable is generating debug messages even though debug is not set.  Is this because the pyinstaller-develop version is being used?

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.