test1.py contains:
import sys
print 'ok'
test2.py contains:
import sys
import numpy as np
print 'ok'
Both python test1.py
and python test2.py
work fine.
When I'm in MATLAB, system('python test1.py')
works while system('python test2.py')
doesn't work and throw the following error message:
>> system('python test2.py')
Traceback (most recent call last):
File "test.py", line 3, in <module>
import numpy as np
File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 13, in <module>
from polynomial import *
File "/usr/lib/python2.7/dist-packages/numpy/lib/polynomial.py", line 17, in <module>
from numpy.linalg import eigvals, lstsq
File "/usr/lib/python2.7/dist-packages/numpy/linalg/__init__.py", line 48, in <module>
from linalg import *
File "/usr/lib/python2.7/dist-packages/numpy/linalg/linalg.py", line 23, in <module>
from numpy.linalg import lapack_lite
ImportError: /afs/csail.mit.edu/system/common/matlab/2012a/sys/os/glnxa64/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3gf)
Full stack:
I use Matlab 2012a x64 on Ubuntu 12.04 with Python 2.7. Any idea why Python called from MATLAB fails to import non-standard Python libraries (here Numpy, but I had the same issue with Scipy)? Note that everything works fine on my Windows computer.