Virtualenv linux wxPython4.1 install failed

Hi all,

I try to install wxPython4.1 (I use virtualenv) with both methods “from sources” or “pip 3 install wxpython”, but each method failed :

First case : (from sources)

(env4.1) [regis@localhost wxPython-4.1.1a1.dev4723+20a2e9a4]$ python3 build.py build
Traceback (most recent call last):
  File "build.py", line 42, in <module>
    from buildtools.config  import Config, msg, opj, posixjoin, loadETG, etg2sip, findCmd, \
ModuleNotFoundError: No module named 'buildtools'
(env4.1) [regis@localhost wxPython-4.1.1a1.dev4723+20a2e9a4]$ 

But I previously have installed " pip3 install buildtools "…

Second case : (with pip3 install)

    Waf: Leaving directory `/tmp/pip-install-duz2b3fv/wxpython/build/waf/3.7/gtk3'
    Build failed
     -> task in '_glcanvas' failed with exit status 1 (run with -v to display more information)
     -> task in '_glcanvas' failed with exit status 1 (run with -v to display more information)
     -> task in '_glcanvas' failed with exit status 1 (run with -v to display more information)
     -> task in '_glcanvas' failed with exit status 1 (run with -v to display more information)
    Command '"/home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/bin/python3" /tmp/pip-install-duz2b3fv/wxpython/bin/waf-2.0.19 --wx_config=/tmp/pip-install-duz2b3fv/wxpython/build/wxbld/gtk3/wx-config --gtk3 --python="/home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/bin/python3" --out=build/waf/3.7/gtk3 configure build ' failed with exit code 1.
    Finished command: build_py (0m5.706s)
    Finished command: build (0m7.137s)
    Command '"/home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/bin/python3" -u build.py build' failed with exit code 1.
    Running setup.py install for wxpython ... error
ERROR: Command errored out with exit status 1: /home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-duz2b3fv/wxpython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-duz2b3fv/wxpython/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-4up5m198/install-record.txt --single-version-externally-managed --compile --install-headers /home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/include/site/python3.7/wxpython Check the logs for full command output.

I thank you for any clue

Note :

[regis@localhost env4.1]$ source ./bin/activate
(env4.1) [regis@localhost env4.1]$ pip3 list
Package          Version
---------------- ----------
attrs            19.3.0
Automat          20.2.0
buildtools       1.0.6
certifi          2020.4.5.1
chardet          3.0.4
constantly       15.1.0
docopt           0.6.2
furl             2.1.0
hyperlink        19.0.0
idna             2.9
incremental      17.5.0
Jinja2           2.11.2
MarkupSafe       1.1.1
numpy            1.18.4
orderedmultidict 1.0.1
Pillow           7.1.2
pip              20.1
PyHamcrest       2.0.2
python-dateutil  2.8.1
redo             2.0.3
requests         2.23.0
setuptools       46.3.0
simplejson       3.17.0
six              1.14.0
SQLAlchemy       1.3.17
Twisted          20.3.0
urllib3          1.25.9
wheel            0.34.2
zope.interface   5.1.0
(env4.1) [regis@localhost env4.1]$ which python3
/home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/bin/python3
(env4.1) [regis@localhost env4.1]$ which pip3
/home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/bin/pip3
(env4.1) [regis@localhost env4.1]$ 

I followed your recipe (which I didn’t know yet), so I launched the command:
https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/index.html

but I still get the following error:

  ../../../../sip/cpp/sipAPI_glcanvas.h:865:198: note: alternatives suggérées: « wxGLCanvas »
       wxGLCanvas(wxWindow *parent, const wxGLAttributes &dispAttrs, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxGLCanvasName, const wxPalette &palette=wxNullPalette)
                                                                                                                                                                                                        ^~~~~~~~~~~~~~
                                                                                                                                                                                                        wxGLCanvas

  Waf: Leaving directory `/tmp/pip-req-build-uzdjx0mz/build/waf/3.7/gtk3'
  Build failed
   -> task in '_glcanvas' failed with exit status 1 (run with -v to display more information)
   -> task in '_glcanvas' failed with exit status 1 (run with -v to display more information)
   -> task in '_glcanvas' failed with exit status 1 (run with -v to display more information)
  Command '"/home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/bin/python3" /tmp/pip-req-build-uzdjx0mz/bin/waf-2.0.19 --wx_config=/tmp/pip-req-build-uzdjx0mz/build/wxbld/gtk3/wx-config --gtk3 --python="/home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/bin/python3" --out=build/waf/3.7/gtk3 configure build ' failed with exit code 1.
  Finished command: build_py (9m27.755s)
  Finished command: build (15m12.972s)
  Command '"/home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/bin/python3" -u build.py build' failed with exit code 1.
  Building wheel for wxPython (setup.py): finished with status 'error'
  ERROR: Failed building wheel for wxPython
  Running setup.py clean for wxPython
  Running command /home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-uzdjx0mz/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-uzdjx0mz/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
  running clean
  'build/lib.linux-x86_64-3.7' does not exist -- can't clean it
  'build/bdist.linux-x86_64' does not exist -- can't clean it
  'build/scripts-3.7' does not exist -- can't clean it
Failed to build wxPython
ERROR: Failed to build one or more wheels
Exception information:
Traceback (most recent call last):
  File "/home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 188, in _main
    status = self.run(options, args)
  File "/home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 185, in wrapper
    return func(self, options, args)
  File "/home/regis/Developpement/Python/GestionConsommation/GestConsoPhoenix4.1.x---1.3.1/env4.1/lib/python3.7/site-packages/pip/_internal/commands/wheel.py", line 189, in run
    "Failed to build one or more wheels"
pip._internal.exceptions.CommandError: Failed to build one or more wheels
Removed build tracker: '/tmp/pip-req-tracker-l8vmhhwo'
(env4.1) [regis@localhost env4.1]$ 

Do you have à clue ?

Do you have the development packages for the Mesa library installed? Depending on your distro they might be named something different, but on a debian-based distro they’re named libgl1-mesa-dev and libglu1-mesa-dev.

  checking for OpenGL headers... found in /usr/include
  checking for GL/gl.h... yes
  checking for GL/glu.h... no
  configure: WARNING: OpenGL libraries not available, disabling support for OpenGL
  checking if the linker accepts --version-script... yes

But was indeed installed the following package :
lib64mesaglu1-devel - Development files for GLU libs​
/usr/include/GL/glu.h
‎ /usr/include/GL/glu_mangle.h
‎ /usr/lib64/libGLU.so
‎ /usr/lib64/pkgconfig/glu.pc

But the glu.h file was missing in the directory.
So I uninstall then install again the package : and then the file was present in the directory…

And the compilation worked out !

Thank you Robin :slight_smile:

Problem Solved

1 Like