Closed rakeshphys closed 8 years ago
I'm having this same issue now that I patched #14.
Just for completeness, it's not OS X specific: I'm experiencing this on Linux too.
In [1]: %load_ext fortranmagic
/home/fdodev/miniconda3/envs/py34/lib/python3.4/site-packages/IPython/utils/path.py:264: UserWarning: get_ipython_cache_dir has moved to the IPython.paths module
warn("get_ipython_cache_dir has moved to the IPython.paths module")
In [2]: %%fortran
...: subroutine foo
...: end
...:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-f1fd164a03d9> in <module>()
----> 1 get_ipython().run_cell_magic('fortran', '', 'subroutine foo\nend\n')
/home/fdodev/miniconda3/envs/py34/lib/python3.4/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
2291 magic_arg_s = self.var_expand(line, stack_depth)
2292 with self.builtin_trap:
-> 2293 result = fn(magic_arg_s, cell)
2294 return result
2295
/home/fdodev/miniconda3/envs/py34/lib/python3.4/site-packages/fortranmagic.py in fortran(self, line, cell)
/home/fdodev/miniconda3/envs/py34/lib/python3.4/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/home/fdodev/miniconda3/envs/py34/lib/python3.4/site-packages/fortranmagic.py in fortran(self, line, cell)
363
364 self._code_cache[key] = module_name
--> 365 module = imp.load_dynamic(module_name, module_path)
366 self._import_all(module, verbosity=args.verbosity)
367
ImportError: /home/fdodev/.cache/ipython/fortran/_fortran_magic_c4c4e6b95608557f83493040db65cd39.cpython-34m.so: cannot open shared object file: No such file or directory
These are the contents of the cache directory:
$ ls ~/.cache/ipython/fortran/ -l
total 4
-rw-r--r-- 1 fdodev fdo 19 2015-12-01 16:56 _fortran_magic_c4c4e6b95608557f83493040db65cd39.f90
This consistently fails on Python 3 with IPython 2.x, 3.x and 4.x. On the contrary, on Python 2 works fine in all cases.
Sorry for the noise, but I found out what's going on. This is actually a consequence of #9: when using Python 3, f2py
refers to the system binary and f2py3
should be used.
$ source activate py27
discarding /home/fdodev/miniconda3/bin from PATH
prepending /home/fdodev/miniconda3/envs/py27/bin to PATH
(py27)$ which f2py
/home/fdodev/miniconda3/envs/py27/bin/f2py
(py27)$ source deactivate
discarding /home/fdodev/miniconda3/envs/py27/bin from PATH
$ source activate py34
discarding /home/fdodev/miniconda3/bin from PATH
prepending /home/fdodev/miniconda3/envs/py34/bin to PATH
(py34)$ which f2py
/usr/bin/f2py
(py34)$ which f2py
f2py f2py3
(py34)fdodev@vmppgsdev:~> which f2py3
/home/fdodev/miniconda3/envs/py34/bin/f2py3
I am getting 'dlopen' import error when I try to use Fortran magic. I am using Anaconda distribution for Python 3.4 in OS X 10.11.1. I installed Fortran magic by shell command 'pip install -U fortran-magic'.
%load_ext fortranmagic /Users/rakesh/Applications/anaconda/lib/python3.4/site-packages/IPython/utils/path.py:264: UserWarning: get_ipython_cache_dir has moved to the IPython.paths module warn("get_ipython_cache_dir has moved to the IPython.paths module")
%%fortran subroutine f1(x, y, z) real, intent(in) :: x,y real, intent(out) :: z z = sin(x+y) end subroutine f1
ImportError Traceback (most recent call last)