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

Python.h not found #1

Open
cmbant opened this issue Nov 16, 2022 · 5 comments
Open

Python.h not found #1

cmbant opened this issue Nov 16, 2022 · 5 comments

Comments

@cmbant
Copy link

cmbant commented Nov 16, 2022

Various travis ubuntu configurations give this error installing clik, e.g. see log at

https://app.travis-ci.com/github/CobayaSampler/cobaya/jobs/588625259

There are also a large number of compiler warnings.

@cmbant
Copy link
Author

cmbant commented Nov 16, 2022

On gcc11 recent conda-forge, it instead appears to compile but does not generate lkl files:
https://app.travis-ci.com/github/CobayaSampler/cobaya/jobs/588625261#L3350

@cmbant
Copy link
Author

cmbant commented Jan 24, 2023

This is also the same on baseline gcc11 jammy installation with python 3.11
https://app.travis-ci.com/github/CobayaSampler/cobaya/jobs/594037592

@zachjweiner
Copy link

A long-standing deprecation expired in python 3.11, which is accounted for only in waf>=2.0.24 (the version vendored in this repo is 2.0.22). See this issue for details.

Simple workaround (short of upgrading the vendored version) is to install waf from, e.g., conda-forge; invoking waf [configure/install] ... should pick up this one rather than the bundled one.

The following works (on Linux, at least) and drops clik in the correct site-packages directory to avoid having to mess around manually with sys.path:

conda install numpy scipy cython waf astropy cfitsio gfortran gcc

export CPATH="$CONDA_PREFIX/include:$CPATH"
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib:$CPATH"
waf configure --cfitsio_prefix=$CONDA_PREFIX --pythondir=$(python -c "import site; print(site.getsitepackages()[0])") --pythonarchdir=$CONDA_PREFIX/lib
waf install

It'd be nice to upgrade to a modern build system---for the python wrapper, at the least---that pip knows how to work with (whether pyproject.toml-based, like meson-python, or with setuptools via a setup.py script).

@cmbant
Copy link
Author

cmbant commented Feb 13, 2023

Thanks, with the recent commits with waf update it does seem to build more reliably, but I still see Python.h errors, e.g. with bionic, gcc-7, Python 3.8

https://app.travis-ci.com/github/CobayaSampler/cobaya/jobs/595797856

There are also warnings "FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2).", I don't know if this is related or if explicitly setting it in config would help.

@JesusTorrado
Copy link

In Linux Debian-based systems (Ubuntu, etc), simply install libpython3-dev.

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