Search code examples
pipwxpythongoogle-colaboratory

Wxpython installation failed on Google Colab


I want to install wxpython package on Google Colab. I have run the following command on Google Colab in python notebook and received the following error. Can anybody suggest what I am missing to install wxpython on Google Colab

!pip install wxPython

Collecting wxPython
Downloading 

https://files.pythonhosted.org/packages/b9/8b/31267dd6d026a082faed35ec8d97522c0236f2e083bf15aff64d982215e1/wxPython-4.0.7.post2.tar.gz (68.9MB) |████████████████████████████████| 68.9MB 52kB/s Requirement already satisfied: pillow in /usr/local/lib/python3.6/dist-packages (from wxPython) (4.3.0)

Requirement already satisfied: six in /usr/local/lib/python3.6/dist-packages (from 
wxPython) (1.12.0)

Requirement already satisfied: 
numpy in /usr/local/lib/python3.6/dist-packages (from wxPython) (1.17.4)

 Requirement already satisfied: olefile in /usr/local/lib/python3.6/dist-packages 
 (from pillow->wxPython) (0.46)

Building wheels for collected packages: wxPython

Building wheel for wxPython (setup.py) ... error

ERROR: Failed building wheel for wxPython

Running setup.py clean for wxPython Failed to build wxPython Installing collected packages: wxPython Running setup.py install for wxPython ... error

ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install- z3213grr/wxPython/setup.py'"'"'; file='"'"'/tmp/pip-install-z3213grr/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-f7ov3ut6/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.


Solution

  • SHORT ANSWER: It cant be done and makes no sense. Why again do you want to run wxPython in the cloud (where there is no desktop to show a GUI on)?

    LONGER ANSWER: What is your specific usecase?

    I would be completely surprised if:

    • wxPython would be installable on Google Colab
    • even if you would manage to install, wx would do anything useful for you

    As Google Colab runs jupyter notebooks/kernels for you in the cloud, there is no desktop where you could show the wxPython GUI elements.

    EDIT1: QUESTION:

    What is a reasonable GUI for jupyter notebooks?

    As jupyter notebooks are a GUI by and in itself, and a rather decent one, I would honestly not advise to use kernels to make a GUI, it will be rather brittle.

    Look at ipywidgets and voila. What it essentially does is starting up a kernel, running the content of a notebook ans strip all input cells, but you still can interact with the kernel using widgets.