6

I am trying to install the wxPython 4 on my Ubuntu 18.04 machine.

sudo pip install wxpython

I get this warning first

    The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

and eventually error

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-SyaTU1/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-bzIjlK/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-SyaTU1/wxpython/

I had similar problem with wxPython3 and the solution was to install it with get

sudo apt-get install python-wxgtk-3.0

I also was able to install wxPython 4 for Python 3 but not for Python 2.7 (instructions)

Also, I am very confused why it takes so much CPU to install wxpython

sudo pip install wxpython

see this image

10

After waiting long enough the process was complete and I got wxPython 4 installed.

  • run

    sudo apt install make gcc libgtk-3-dev libwebkitgtk-dev libwebkitgtk-3.0-dev libgstreamer-gl1.0-0 freeglut3 freeglut3-dev python-gst-1.0 python3-gst-1.0 libglib2.0-dev ubuntu-restricted-extras libgstreamer-plugins-base1.0-dev
    
  • sudo pip install wxpython or sudo pip3 install wxpython

  • wait for a while for it to install

after completion, you will see this message.

The directory '/home/user-ii-6/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

The directory '/home/user-ii-6/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting wxpython
  Downloading https://files.pythonhosted.org/packages/dd/31/bd55ab40e406a026a7fda0bb5eb61f466682544ae91ac26267c750f5e618/wxPython-4.0.3.tar.gz (68.5MB)
    100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 68.5MB 929kB/s 
Requirement already satisfied: six in ./.local/lib/python2.7/site-packages (from wxpython) (1.11.0)
Requirement already satisfied: PyPubSub in ./.local/lib/python2.7/site-packages (from wxpython) (4.0.0)
Requirement already satisfied: typing in ./.local/lib/python2.7/site-packages (from PyPubSub->wxpython) (3.6.6)
Installing collected packages: wxpython
  Running setup.py install for wxpython ... done
Successfully installed wxpython-4.0.3
| improve this answer | |
3

Since there are various options for distro and wx port (GTK2 or GTK3) then the files can not all be located in the same folder for easy access by pip. This simply just means that you'll need to drill down a little further to find the URL to give to pip. For example, to get the GTK3 wxPython builds for Ubuntu 18.04 (and 16.10, LinuxMint 18, and probably others) you can use a pip command like this:

pip install -U \ -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 \ wxPython

Of course you can always download the wheel file yourself and then use pip to install your local copy of the file.

| improve this answer | |
  • In the end, this was the only solution which worked for me. Lubuntu 18.04 users, I grabbed wxPython-4.0.6-cp37-cp37m-linux_x86_64.whl using wget, then installed (very fast!) with sudo pip3 install wxPython-4.0.6-cp37-cp37m-linux_x86_64.whl. – rdtsc Sep 11 '19 at 15:05
3

First I found it by:

sudo apt search python3-wx

I installed the latest wxpython with:

sudo apt-get install python3-wxgtk4.0 python3-wxgtk-webview4.0 python3-wxgtk-media4.0

You may also try synaptic to install it that way if you prefer.

| improve this answer | |
0

if any one revised this error

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main

try this

sudo apt install make gcc libgtk-3-dev libwebkitgtk-dev libwebkitgtk-3.0-dev libgstreamer-gl1.0-0 freeglut3 freeglut3-dev python-gst-1.0 python3-gst-1.0 libglib2.0-dev ubuntu-restricted-extras libgstreamer-plugins-base1.0-dev
sudo apt-get install python-wxgtk3.0
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.