How to fix "ImportError: No module named wxversion" on Linux

Last updated on July 21, 2020 by Dan Nanni

Question: I was trying to run a Python application on [insert your Linux distro], but I got the following error:
ImportError: No module named wxversion.
How can I solve this error in the Python program?
Looking for python... 2.7.9 - Traceback (most recent call last):
  File "/home/dev/playonlinux/python/check_python.py", line 1, in 
    import os, wxversion
ImportError: No module named wxversion
failed tests

This error indicates that your Python application is GUI-based, relying on a missing Python module called wxPython. wxPython is a Python extension module for the wxWidgets GUI library, popularly used by C++ programmers to design GUI applications. The wxPython extension allows Python developers to easily design and integrate GUI within any Python application.

To solve this import error, you need to install wxPython on your Linux, as described below.

Install wxPython on Debian, Ubuntu or Linux Mint

$ sudo apt-get install python-wxgtk2.8

Install wxPython on Fedora

$ sudo yum install wxPython

Install wxPython on CentOS or RHEL

wxPython is available on the EPEL repository of CentOS/RHEL, not on base repositories. Thus, first enable EPEL repository on your system, and then use yum command.

$ sudo yum install wxPython

Install wxPython on Arch Linux

$ sudo pacman -S wxpython

Install wxPython on Gentoo

$ emerge wxPython

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean