Install wxPython with pip

I looked at this answer which isn’t quite what I need:

I need to install wxpython via pip, but none of the distros here:

https://extras.wxpython.org/wxPython4/extras/linux/gtk3/

match this command:

python3 -m pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/<distro>/ wxPython

How can I install it with pip?

python-wxpython 4.2.1 is available in the Manjaro extra repository. Is there a reason why you are trying to avoid the repository version?

2 Likes

I’m trying to avoid system-bloat. As this is a Python package I would prefer to contain it within venv/virtualenv.

Why should they?
Why are you trying to install like this?
Does not pip have built in repositories?

note: I guess the search function is deprecated
ERROR: XMLRPC request failed [code: -32500]
RuntimeError: PyPI no longer supports β€˜pip search’ (or XML-RPC search). Please use Search results Β· PyPI (via a browser) instead. See https://warehouse.pypa.io/api-reference/xml-rpc.
html#deprecated-methods for more information.


So … it would be
(inside your virtual environment)

pip install wxPython

So you are installing the same thing, but through a different package manager?
That doesnt avoid bloat … but it does spread things around.
(when you go to clean things in the future … basic suggestions might include paccache … but that wont touch this other package manager … to mention nothing of dependencies etc)

It may make sense if you want a β€˜development environment’ that you dont want to overlap at all with system packages or something similar.

Otherwise I dont really understand the intention here.

If it really is for vague β€˜cleanliness’ then its probably not as desirable as you think.


A quick quote on virtual environments:

So be sure thats actually what you want.
(ex: If you want wxPython to be available to the wider system then you dont want a virtual env)

They provide instructions for building your own wheel.

… I dont really get how thats relevant?

At least not as a contradiction.

Here … fine … I did it in a virtenv just to show;

$ mkdir -p tmppy
$ cd tmppy/
$ python -m venv testenv
$ cd testenv/
$ source bin/activate
(testenv) $ pip install wxPython
Collecting wxPython
  Downloading wxPython-4.2.1.tar.gz (73.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 73.7/73.7 MB 8.9 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pillow (from wxPython)
  Obtaining dependency information for pillow from https://files.pythonhosted.org/packages/66/9c/2e1877630eb298bbfd23f90deeec0a3f682a4163d5ca9f178937de57346c/pillow-10.2.0-cp311-cp311-manylinux_2_28_x86_64.whl.metadata
  Downloading pillow-10.2.0-cp311-cp311-manylinux_2_28_x86_64.whl.metadata (9.7 kB)
Collecting six (from wxPython)
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting numpy (from wxPython)
  Obtaining dependency information for numpy from https://files.pythonhosted.org/packages/5a/62/007b63f916aca1d27f5fede933fda3315d931ff9b2c28b9c2cf388cd8edb/numpy-1.26.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
  Downloading numpy-1.26.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.2/61.2 kB 2.5 MB/s eta 0:00:00
Downloading numpy-1.26.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.3/18.3 MB 9.4 MB/s eta 0:00:00
Downloading pillow-10.2.0-cp311-cp311-manylinux_2_28_x86_64.whl (4.5 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 6.9 MB/s eta 0:00:00
Building wheels for collected packages: wxPython
  Building wheel for wxPython (pyproject.toml) ... done
  Created wheel for wxPython: filename=wxPython-4.2.1-cp311-cp311-linux_x86_64.whl size=145574302 sha256=7055e68a58a55ba6fc5f8115308e8896ff73de96db99c98b21089b61a2772e61
  Stored in directory: ~/.cache/pip/wheels/47/56/e2/3029fc67c00478b2ecc3a07f4315db447ef1d7abf0dc44516b
Successfully built wxPython
Installing collected packages: six, pillow, numpy, wxPython
Successfully installed numpy-1.26.3 pillow-10.2.0 six-1.16.0 wxPython-4.2.1

Though I still wonder if thats really what OP wants.


PS. For the binary URL thing … and guessing at fedora being the β€˜closest’ … if it were really needed … I dont see the issue either;

The path does exist (and match the written string … just replacing <distro>)

https://extras.wxpython.org/wxPython4/extras/linux/gtk3/fedora-38

I stand corrected. :face_with_open_eyes_and_hand_over_mouth:

thank you for testing. The reason I opened the ticket was because of what @Takakage mentioned:

That is why I assumed it can only be installed by fetching the binary for specific distros.

I am testig experimental software, if it doesn’t work, I will just delete the virtualenv. With pacman, Id need to know all the deps of the py-package and manually remove them too, which is the system-bloat I want to avoid.

If you read pacman manpages, you would know how to do it without anything β€œmanual”.

Do not use pip, it is mixed with your pacman system.

Use pipx, which creates an environment in your home directory and prevents conflict with the pacman system.

Edit:

Fix a typo