Closed waldeir closed 4 years ago
Thank you very much for this hint @waldeir, you saved me a lot of time.
@ylikx this package is incredible.
@waldeir thanks a lot for the info. I didn't try on Arch Linux, maybe python3-config --ldflags
does not give the flags for the Python version that you want to use. Are you using Anaconda? Did you do conda activate
?
@williamjameshandley Thank you very much!
Arch linux is a little bit idiosyncratic (and controversial) when it comes to its treatment of python, the main complication is that python
means python3
rather than python2
.
These commands on my arch linux system show the main problem:
$~ python --version
Python 3.8.2
$~ which python
/usr/bin/python
$~ which python-config
/usr/bin/python-config
$~ python-config --ldflags
-L/usr/lib -lcrypt -lpthread -ldl -lutil -lm -lm
$~ ls /usr/lib/libpython*
/usr/lib/libpython2.7.so /usr/lib/libpython3.5m.so.1.0 /usr/lib/libpython3.8.so
/usr/lib/libpython2.7.so.1.0 /usr/lib/libpython3.6m.so /usr/lib/libpython3.8.so.1.0
/usr/lib/libpython3.5m.so /usr/lib/libpython3.6m.so.1.0 /usr/lib/libpython3.so
which is that the python-config
(and python3-config
) don't actually point to a python library, and you need to point explicitly to libpython3.8
, as there is no libpython
at all.
@williamjameshandley Thank you very much!
I'm currently using this to call tensorflow from one of the cosmology standard fortran codes (CosmoMC).
Thank you very much for this hint @waldeir, you saved me a lot of time.
@ylikx this package is incredible.
You are welcome!
@waldeir thanks a lot for the info. I didn't try on Arch Linux, maybe
python3-config --ldflags
does not give the flags for the Python version that you want to use. Are you using Anaconda? Did you doconda activate
?@williamjameshandley Thank you very much!
No, i am not using anaconda. I am using the "python" (which provides python 3.8), python-matplotlib and python-numpy packages from the arch linux official repositories.
@williamjameshandley @waldeir Thanks a lot for the clarification!
Starting with Python 3.8 python3-config --ldflags
does not output the -lpythonX.Y
flag anymore. Use python3-config --ldflags --embed
instead. (--embed is not available before Py 3.8). See issue #26
In order to run the basic example in arch linux it is necessary do add the flag -lpython3.8. Assuming you are using bash, the command should be:
gfortran intro_to_forpy.F90 forpy_mod.o `python3-config --ldflags` -lpython3.8