forpy
forpy copied to clipboard
Matplotlib Example Fails
I'm attempting to run the Matplotlib Example using forpy installed on an iMacPro running Mac OS X Mojave (ver. 10.14.5) under the Anaconda distribution for Python 3.7.
Building the example (see the attached file Example1.F90.txt) was successful, but running a.out results with:
(base) Samuels-Mac-Pro:Matplotlib_example user$ touch *.F90
(base) Samuels-Mac-Pro:Matplotlib_example user$ gfortran -c forpy_mod.F90
(base) Samuels-Mac-Pro:Matplotlib_example user$ gfortran Example1.F90 forpy_mod.o python3-config --ldflags
(base) Samuels-Mac-Pro:Matplotlib_example user$ ./a.out
Could not find platform independent libraries
Current thread 0x00000001099ea5c0 (most recent call first):
Program received signal SIGABRT: Process abort signal.
Backtrace for this error: #0 0x106edb39d #1 0x106eda82b #2 0x7fff59843b5c Abort trap: 6 (base) Samuels-Mac-Pro:Matplotlib_example user$
Any suggestions?
Hi, I'd guess it might be something along the lines as described in https://github.com/SpaceVim/SpaceVim/issues/1296 (see also the links in there). Unfortunately I don't have access to a Mac and can't try to reproduce the issue.
You can check the paths where Python looks for modules using this code:
program paths
use forpy_mod
implicit none
integer :: ierror
type(list) :: paths
ierror = forpy_initialize()
ierror = get_sys_path(paths)
ierror = print_py(paths)
end program
Hi, I'd guess it might be something along the lines as described in SpaceVim/SpaceVim#1296 (see also the links in there). Unfortunately I don't have access to a Mac and can't try to reproduce the issue.
You can check the paths where Python looks for modules using this code:
program paths use forpy_mod implicit none integer :: ierror type(list) :: paths ierror = forpy_initialize() ierror = get_sys_path(paths) ierror = print_py(paths) end program
I try this example on windows, and also it only works when put the compiled executable in the path where python.exe located, in my case, "C:\IntelSWTools\intelpython3", it seems that the compiled executable only tries to find python libs in current path.
This should be fixed by setting the PYTHONHOME environment variable.
On Windows: https://docs.python.org/3.7/using/windows.html#configuring-python https://docs.python.org/3.7/using/windows.html#finding-modules
On Mac:
export PYTHONHOME=<path to your python distribution>