Recover config.log after failed `pip install`

51 Views Asked by At

I'm trying to install (that is: compile) wxpython for Python 3.7.17 (Which I know is out of support but I have a module which works with nothing else and requires wxpython). I'm trying to get everything set up with pipenv, on Kubuntu 20.04.

Ultimately, though, the problem is the same as with `pip install':

$ pip install wxpython --verbose
Using pip 23.1.2 from /home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/lib/python3.7/site-packages/pip (python 3.7)
Collecting wxpython
  Using cached wxPython-4.2.1.tar.gz (73.7 MB)
  Running command python setup.py egg_info
[...]
5 minutes o  Running command: build_py
  Checking for /tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/bin/waf-2.0.24...
  "/home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/bin/python" /tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/bin/waf-2.0.24 --wx_config=/tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/build/wxbld/gtk3/wx-config --gtk3 --python="/home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/bin/python" --out=build/waf/3.7/gtk3 configure build
  Setting top to                           : /tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b
  Setting out to                           : /tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/build/waf/3.7/gtk3
  Checking for 'gcc' (C compiler)          : /usr/bin/gcc
  Checking for 'g++' (C++ compiler)        : /usr/bin/g++
  Checking for program 'python'            : /home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/bin/python
  Checking for python version >= 3.7.0     : 3.7.17
  python-config                            : /home/<user>/.pyenv/shims/python3.7-config
  Asking python-config for pyext '--cflags --libs --ldflags' flags : not found
  The configuration failed
  (complete log in /tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/build/waf/3.7/gtk3/config.log)
  Command '"/home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/bin/python" /tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/bin/waf-2.0.24 --wx_config=/tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/build/wxbld/gtk3/wx-config --gtk3 --python="/home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/bin/python" --out=build/waf/3.7/gtk3 configure build ' failed with exit code 1.
  Finished command: build_py (0m1.53s)
  Finished command: build (4m48.646s)
  Command '"/home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/bin/python" -u build.py build' failed with exit code 1.
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.f busy compile messages...
[...]
  Running command: build_py
  Checking for /tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/bin/waf-2.0.24...
  "/home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/bin/python" /tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/bin/waf-2.0.24 --wx_config=/tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/build/wxbld/gtk3/wx-config --gtk3 --python="/home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/bin/python" --out=build/waf/3.7/gtk3 configure build
  Setting top to                           : /tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b
  Setting out to                           : /tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/build/waf/3.7/gtk3
  Checking for 'gcc' (C compiler)          : /usr/bin/gcc
  Checking for 'g++' (C++ compiler)        : /usr/bin/g++
  Checking for program 'python'            : /home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/bin/python
  Checking for python version >= 3.7.0     : 3.7.17
  python-config                            : /home/<user>/.pyenv/shims/python3.7-config
  Asking python-config for pyext '--cflags --libs --ldflags' flags : not found
  The configuration failed
  (complete log in /tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/build/waf/3.7/gtk3/config.log)
  Command '"/home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/bin/python" /tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/bin/waf-2.0.24 --wx_config=/tmp/pip-install-lpx0170p/wxpython_26a8ccd1be434df39a5b7b00b435a37b/build/wxbld/gtk3/wx-config --gtk3 --python="/home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/bin/python" --out=build/waf/3.7/gtk3 configure build ' failed with exit code 1.
  Finished command: build_py (0m1.53s)
  Finished command: build (4m48.646s)
  Command '"/home/<user>/.local/share/virtualenvs/myvenv-_8TM2tw_/bin/python" -u build.py build' failed with exit code 1.
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

I'm struggling to figure out what went wrong, and have two possible leads:

1: what does the line Asking python-config for pyext '--cflags --libs --ldflags' flags : not found tell me? Who or what was not found? The only mention I find of this is this question, which has no answer, and the manpage for python-config. I've just checked that --enable-shared flag was in fact set when Python was compiled, (by recompiling with the flag explicitly specified).

2: Directly below that, it says that (complete log in /tmp/pip-install-lpx0170p.../config.log). However, that is a temporary directory which is deleted when the pip terminates, and that means it's gone before anyone gets a chance to look. Is there a way to prevent deletion of that log?

1

There are 1 best solutions below

0
Zak On

It turns out that the issue was that python-config did not run at all, and it was related to the fact that I was trying to compile wxpython for Python 3.7.17 (because I need to use a package that only works on 3.7), but of course I don't want to replace my system Python installation with an out-of-maintenance Python. The log that is mentioned in the error message is still not findable, but the crucial clue was the line

Asking python-config for pyext '--cflags --libs --ldflags' flags : not found

I tried running just python-config and got a message that python-config was defined for Python 3.7.17:

~> which python-config
/home/username/.pyenv/shims/python-config
~> python-config
pyenv: python-config: command not found

The `python-config' command exists in these Python versions:
  3.7.17

Note: See 'pyenv help global' for tips on allowing both

I have no idea why it then didn't just go and run it, since that was my active pyenv, but for some reason or another there must have been some ambiguity about whether to use the version in python 3.7.17 (installed via pyenv in userspace) or the system version (3.8, which is also on the system).

The following line solved the issue:

pyenv global 3.7.17

This globally sets the provided version to be the default Python version, and afterwards, python-config runs:

~> which python-config
/home/username/.pyenv/shims/python-config
~> python-config
Usage: /home/username/.pyenv/versions/3.7.17/bin/python-config --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir

Still looks weird to me that which returns exactly the same thing but now it can run. It was also running directly before I had the Python 3.7 pyenv set up. Either way, wxpython compiled without further errors after this.

Since I don't want 3.7 to stay my default Python version, I now need to figure out how to unset the pyenv global thing, but I'm relieved to have finally cracked this nut.