Knowledge Base/Canopy/Specific Canopy Package Issues

wxPython 2.8 and 2.9

Jonathan March
posted this on December 11, 2012, 16:00

(Updated May 6, 2014)

EPD 7.x and most versions of Canopy ship with wxPython 2.8, not 2.9, because of numerous compatibility issues with 2.9. 

However wxPython 2.8 cannot not work at all on any 64-bit Python for OSX, including 64-bit EPD/Canopy for OS X, and never will, due to fundamental incompatibilities. Therefore this "computational" 64-bit version of EPD ships without any version of wxPython.

For now, wxPython 2.9 for Mac OS X (32- or 64-bit) can be downloaded from the EPD repository by registered Enthought users, and used as bleeding-edge, experimental software.

WxPython 2.9 is also included in 64-bit Canopy for OS X. However please note that code written for WxPython 2.8 will not necessarily work in WxPython 2.9. See the WxPython 2.9 migration guide (http://wxpython.org/migrationguide.php).

We recommend that users who do not have a large wx-specific code base use the Qt backend rather than wx. This can be done using either Pyside or PyQt interface package, both available to EPD subscribers. (PyQt is not available for OS X 64-bit.)

Wx program running on Canopy 1.4 on OS X "Please run with a Framework build of python"

Due to a build error in Canopy 1.4, wx-based programs will not run from the command line, but will give the above error. (They will run ok from within the Canopy GUI.) This error will be fixed in Canopy 1.5. Meanwhile, you can fix the bug yourself with the following commands at a Terminal prompt (assuming Canopy-64 and the default User Python environment path):

cd ~/Library/Enthought/Canopy_64bit/User/bin
cp pythonw python

Canopy: Import error on Linux, fixed in Canopy 1.0.3

On newer linuxes (Ubuntu 12:04, Fedora 18), import wx fails in Canopy due to compatibility problems with glib bundled with Canopy (as a Qt dependency for RH5) and the system gtk used by wx.  This is a known issue with the Canopy Linux beta installers and was  fixed in a Canopy 1.0.3.

Ubuntu 13.10 - Import error

ImportError: /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0: undefined symbol: g_type_class_adjust_private_offset

We do not expect an immediate solution for this problem.

 

Comments

User photo
Adam Carreon

Hello,

I am curious to know if the Ubuntu 13.10+ - Import Error has received a solution yet?

My Import Error is slightly different but the source is the same I believe:

ImportError: Matplotlib backend_wx and backend_wxagg require wxPython >=2.8

I know my code works properly on Windows, MacOS, and older versions of Ubuntu so I am assuming that trying to fix my problem through my code would not be the most beneficial. Also, there is a lot of wx references in my code soI would like to avoid switching backends. Thanks for your help! Have a great day!

January 9, 2014, 14:16
User photo
Jonathan March
Enthought

@Adam, sorry, we do not expect to support wx 2.8 on Ubuntu 13.10+ in the near future, due to ABI incompatibilities. I have updated the article to reflect this, also the fact that we have not yet worked on wx 2.9 compatibility issues because Qt is a much higher priority for an every-increasing proportion of our users.

January 9, 2014, 19:58
User photo
Jean de la Croix Ki

Hi, I'm using canopy 1.3.0 (64bits) on fedora 20, and when I import wxPython using import wx I got this error : 

Traceback (most recent call last):
File "drawing.py", line 8, in <module>
import wx
File "/home/jea/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/wx/__init__.py", line 45, in <module>
from wx._core import *
File "/home/jea/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/wx/_core.py", line 4, in <module>
import _core_
ImportError: /lib64/libpango-1.0.so.0: undefined symbol: g_type_class_adjust_private_offset

 

How can I fix this? Thanks

March 20, 2014, 06:14
User photo
Marc-Antoine Drouin

Hi,

I'm using canopy 1.3.0 (64 bit) on a fedora 20.I also had the error: ImportError: Matplotlib backend_wx and backend_wxagg require wxPython >=2.8

It seems I managed to fix the problem by commenting the line "backend      : WXAgg" in the file Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc

 

March 31, 2014, 08:35
User photo
Lori Jonestrask

What is the status on wxPython compatibility?  I am working on a wxPython app which worked great with an older version of the academic EPD distribtion. With the free Canopy distribution, the gui freezes and crashes.  Will there be an update to Canopy that addresses this?  Or, is there a way that I can change to an older version of wxPython?  Canopy is currently using version 2.9.2.4 of wxPython.  If anyone has had any success with Canopy and wxPython, I'd love to hear about it.  Thanks!

April 29, 2014, 16:48
User photo
Jonathan March
Enthought

@Lori,

The main compatibility issue with wxPython in Canopy is that you need to change the Canopy backend, which defaults to Qt. See https://support.enthought.com/entries/26437875-Using-Wx-WxPython-in...

Canopy itself uses Qt, not Wx 2.8 or 2.9, and we recommend QT for all new development. The issue comes up only in your user application, in what backend you choose, as described in the above article.

Edit: Re "change to an older version of wxPython". If you are using 32-bit Canopy in OSX, then yes, in the package manager. If you are using 64-bit Canopy in OSX, then no, this is technically impossible.

April 29, 2014, 17:08
User photo
Lori Jonestrask

Thanks for this response!  I tried changing the Canopy backend, as described in the article, but the behavior of my GUI did not change (i.e., I could still open it to the first window, but when I click on the second window everything freezes up).  Also, my problem persists if I run my GUI on the command line as well, so I think it is not an IPython issue per se, but actually something in the Canopy Python package.  Do you have any other suggestions for what I should try?

I will consider QT for future development, and I'll give the package manager a try.  

April 29, 2014, 17:32
User photo
Lori Jonestrask

@Jonathan Switching to the earlier version of wxPython was successful.  Will this be an option in the 64 bit Canopy in the future?

April 29, 2014, 18:07
User photo
Jonathan March
Enthought

@Lori, no, WxPython 2.8 is fundamentally incompatible with 64-bit OSX because of changes which Apple made in their graphics when switching to 64 bits (eliminating "Carbon" support). WxPython 2.9 makes the leap so if you are committed to Wx on OSX-64 you will need to convert your program to wxpython 2.9.

April 29, 2014, 18:21
User photo
Lori Jonestrask

@Jonathan, thanks again, this is really helpful.  Do you think the compatibility issues between wxPython 2.9 and Canopy will be fixed in the near future?

April 29, 2014, 22:46
User photo
Jonathan March
Enthought

@Lori, what "compatibility issues between wxPython 2.9 and Canopy"? Does your app run under wxPython 2.9 with any other Python distribution? Canopy Python is just Python 2.7.6. To repeat "you will need to convert your program to wxPython 2.9". See http://wxpython.org/migrationguide.php.

 

April 30, 2014, 11:01
User photo
Jonathan March
Enthought

@Lori -- Added section "Wx program running on Canopy 1.4 on OS X - Please run with a Framework build of python" which hopefully will resolve your problems. Sorry for the trouble!

May 6, 2014, 17:56
User photo
Lori Jonestrask

@Jonathan -- Do you know if or when Canopy will support a more recent version of wxPython 2.9?  Thanks!

June 18, 2014, 12:45
User photo
Yueteng HU

I ran into the same question with "ImportError: Matplotlib backend_wx and backend_wxagg require wxPython >=2.8"

 

@Marc-Antoine Drouin's solution doesn't work for me.

 

Here's how I fixed the problem, which I hope will be useful for others in future

1. In Terminal: gedit Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc

2. Edit the line "backend      : WXAgg" into "backend      : QtAgg"

3. Save and exit

October 8, 2014, 06:15