Python-config is not set up corresponding to build python version

Although python is correctly set with respect to python version specified for the build, python-config is not:

$ which python
/home/travis/virtualenv/python3.8.3/bin/python
$ which python-config
/opt/pyenv/shims/python-config
$ python-config --cflags
pyenv: python-config: command not found
The `python-config' command exists in these Python versions:

  3.7
  3.7.7
  3.8
  3.8.3

python-config is required to build some python modules, bindings and python embedding software, so it’s crucial to have it in sync with current python version. I suspect it can be fixed by adding it to the virtualenv bin/ or setting an environment variable which would allow shim to dispatch to the correct script. For now, I was able to fix this by adding these lines to before_install:

  - export PYTHONPREFIX="$(dirname $(realpath $(which python)))/.."
  - export PATH="${PYTHONPREFIX}/bin:${PATH}"

But it should work out of the box.

Example build affected by this problem:

Interesting… Am I wrong to assume that virtualenv is supposed to take care of such logistics?

FYI This is the python build logic:

You are not wrong. They dropped this feature in virtualenv v20 because it’s missing from venv:

feature was dropped to bring virtualenv in-line with Python’s built-in venv

This is the case. If you think this should be changed please first raise an issue under http://bugs.python.org/ for venv, and if it is deemed still needed we can add it.

Imprint