[Numpy-discussion] error importing a f2py compiled module.

Pearu Peterson pearu@cens.ioc...
Mon Jun 23 06:00:10 CDT 2008

On Mon, June 23, 2008 10:38 am, Fabrice Silva wrote:
> Dear all
> I've tried to run f2py on a fortran file which used to be usable from
> python some months ago.
> Following command lines are applied with success (no errors raised) :
>         f2py -m modulename -h tmpo.pyf --overwrite-signature  tmpo.f
>         f2py -m modulename -c --f90exec=/usr/bin/f95 tmpo.f

First, it is not clear what compiler is f95. If it is gfortran, then
use the command
  f2py -m modulename -c --fcompiler=gnu95 tmpo.f

If it is something else, check the output of

  f2py -c --help-fcompiler

and use appropiate --fcompiler switch.

Second, I hope you realize that the first command has no effect to
the second command. If you have edited the tmpo.pyf file, then use
the following second command:

  f2py tmpo.pyf  -c --fcompiler=gnu95 tmpo.f

> The output of these commands is available here:
> http://paste.debian.net/7307
> When importing in Python with "import modulename", I have an
> ImportError:
>         Traceback (most recent call last):
>           File "Solveur.py", line 44, in <module>
>             import modulename as Modele
>         ImportError: modulename.so: failed to map segment from shared
>         object: Operation not permitted
> How can that be fixed ? Any suggestion ?

I don't  have ideas what is causing this import error. Try
the instructions above, may be it is due to some compile object


More information about the Numpy-discussion mailing list