How to fix “ImportError: No module named wxversion” on Linux

Question: I was trying to run a Python application on [insert your Linux distro], but I got an 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/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
Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

Leave a comment

Your email address will not be published. Required fields are marked *