Valentyn
Valentyn

Reputation: 729

Installation of wxPython on Python 3.7 on Ubuntu 18.04

I am having problems with installing wxPython4 on Python 3.7.5

$ pip3 install wxpython
Defaulting to user installation because normal site-packages is not writeable
Collecting wxpython
  Using cached wxPython-4.1.0.tar.gz (65.8 MB)
Requirement already satisfied: pillow in ./.local/lib/python3.7/site-packages (from wxpython) (7.1.2)
Requirement already satisfied: six in ./.local/lib/python3.7/site-packages (from wxpython) (1.14.0)
Requirement already satisfied: numpy in ./.local/lib/python3.7/site-packages (from wxpython) (1.18.4)
Building wheels for collected packages: wxpython
  Building wheel for wxpython (setup.py) ... \


....

      File "/usr/lib/python3/dist-packages/Cython/Compiler/ExprNodes.py", line 2844
        await = None
              ^
    SyntaxError: invalid syntax

I am not sure what is the problem. The changes made in Python3, so await is a special keyword now. Is it somehow confusing Python2 with Python3?

If I do what was recommended here

https://askubuntu.com/questions/1073145/how-to-install-wxpython-4-ubuntu-18-04

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.

I get a different error

    In [1]: import wx                                                                                                                                                                                                                 
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-03faa7660341> in <module>
----> 1 import wx

/usr/lib/python3/dist-packages/wx/__init__.py in <module>
     15 # Import all items from the core wxPython module so they appear in the wx
     16 # package namespace.
---> 17 from wx.core import *
     18 
     19 

/usr/lib/python3/dist-packages/wx/core.py in <module>
     10 """
     11 
---> 12 from ._core import *
     13 
     14 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

ModuleNotFoundError: No module named 'wx._core'

which probably due to dependencies missing.

Upvotes: 1

Views: 2198

Answers (2)

Suspended
Suspended

Reputation: 1190

Consider installing it with python 2.7. Also, keep your python dependencies well separated (if you do not yet), cause if you don't, problems are likely to happen due to dependency conflicts. I installed it like this:

sudo apt install python2.7
virtualenv --python=/usr/bin/python2.7 <path/to/new/virtualenv/>
cd <virtualenv path>
source bin/activate
pip install setuptools
pip install -U \
  -f https://extras.wxpython.org/wxPython4/extras/linux/gtk2/ubuntu-18.04 \
  wxPython

pip selected correct version to install too. After that I installed wxFormBuilder. No problems either :)

Upvotes: 0

expectedAn
expectedAn

Reputation: 98

I think this is due to the issue of incompatibility between Cython 0.26 and Python 3.7. See this answer about SerpentAI.

Upvotes: 1

Related Questions