Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arch Linux and Python #21

Closed
waldeir opened this issue Mar 23, 2020 · 7 comments
Closed

Arch Linux and Python #21

waldeir opened this issue Mar 23, 2020 · 7 comments

Comments

@waldeir
Copy link

waldeir commented Mar 23, 2020

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

@williamjameshandley
Copy link

Thank you very much for this hint @waldeir, you saved me a lot of time.

@ylikx this package is incredible.

@ylikx
Copy link
Owner

ylikx commented Mar 26, 2020

@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!

@williamjameshandley
Copy link

williamjameshandley commented Mar 27, 2020

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).

@waldeir
Copy link
Author

waldeir commented Mar 27, 2020

Thank you very much for this hint @waldeir, you saved me a lot of time.

@ylikx this package is incredible.

You are welcome!

@waldeir
Copy link
Author

waldeir commented Mar 27, 2020

@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!

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.

@ylikx
Copy link
Owner

ylikx commented Apr 1, 2020

@williamjameshandley @waldeir Thanks a lot for the clarification!

@ylikx ylikx closed this as completed in 1a1f556 May 20, 2020
@ylikx
Copy link
Owner

ylikx commented Jun 14, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants