Search code examples
pythonubuntunumpynumericf2py

Failed to import Numeric: No module named Numeric in F2PY


When I am trying to use F2PY, I'll get the error:

Failed to import Numeric: No module named Numeric

I know that numeric is dead and instead we should use numpy. But files:

/usr/local/lib/python2.7/dist-packages/f2py2e/src/fortranobject.h and /usr/local/lib/python2.7/dist-packages/f2py2e/f2py2e.py both use the Numeric package. I tried to replace it with numpy, but I was not successful.

I used to use f2py without any problem, but after I formatted my computer and got a fresh copy of Ubuntu, I have this problem.

I also tried to use the option --2d-numpy for f2py like:

f2py -c --fcompiler=intel --2d-numpy -m processoutput processoutput.f

But it didn't work, and it is still looking for numpy.

Thank you for your help.


Solution

  • You can download old versions of Numeric here: http://sourceforge.net/projects/numpy/files/Old%20Numeric/24.2/

    If you install that, I think f2py will be satisfied.