Trouble with Ubuntu CheckInstall recipe (32 bit)

Hi

I have followed this recipe for installing wxPython 2.9.4.1 in a 32
bit pc with Ubuntu:

http://wiki.wxpython.org/CheckInstall

All the commands end without errors, and I am able to create and
install the packages for wxWidgets and wxPython as detailed in the
recipe. However, when I try to import wx in a Python shell, It returns
this error:

import wx

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/wx/__init__.py", line
45, in <module>
    from wx._core import *
  File "/usr/local/lib/python2.7/dist-packages/wx/_core.py", line 4,
in <module>
    import _core_
ImportError: No module named _core_

I also searched for the module within the system and it's not present,
there is no _core_.py file.

Any idea of what went wrong with the installation? Am I missing any
requirement before installing?

The Arkansas Chuggabug configuration:
- O.S: Ubuntu 12.04 TLS 32-bit
- Processor: AMD Sempron
- RAM: 2.0 GB

Thanks

I found this as a workaround:

import wxversion
versions = wxversion.getInstalled()
print versions
[‘2.9.4-gtk2’, ‘2.8-gtk2-unicode’]

if I do:

wxversion.select(versions[n])
import wx

it does not fail (no ImportError). Now, is it possible to set a system default wx version so it does not throw an ImportError when there’s no wx versions selected?

From wxversion.py:

···

Of course the default wxPython version can also be controlled by
setting PYTHONPATH or by editing the wx.pth path configuration file,
but using wxversion will allow an application to manage the version
selection itself rather than depend on the user to setup the
environment correctly.

Am Montag, 29. April 2013 13:42:23 UTC+2 schrieb Alan Etkin:

I found this as a workaround:

import wxversion
versions = wxversion.getInstalled()
print versions
[‘2.9.4-gtk2’, ‘2.8-gtk2-unicode’]

if I do:

wxversion.select(versions[n])
import wx

it does not fail (no ImportError). Now, is it possible to set a system default wx version so it does not throw an ImportError when there’s no wx versions selected?

From wxversion.py:

Of course the default wxPython version can also be controlled by

Oops, I forgot to read the module's help. Thanks.

Alan Etkin wrote:

I found this as a workaround:

>>> import wxversion
>>> versions = wxversion.getInstalled()
>>> print versions
['2.9.4-gtk2', '2.8-gtk2-unicode']

if I do:

>>> wxversion.select(versions[n])
>>> import wx

it does not fail (no ImportError). Now, is it possible to set a system
default wx version so it does not throw an ImportError when there's no
wx versions selected?

It sounds like the wx.pth file is not being included in your .deb package. It is a generated file that should be installed to your site-packages folder which contains the folder name for the version of wxPython that should be the default. (IOW, that folder is put on the sys.path automatically.) In your case it would contain something like "wx-2.9.4-gtk2"

···

--
Robin Dunn
Software Craftsman

For the record, in case someone else has the same problem:

I also searched for the module within the system and it's not present,
there is no _core_.py file.

The file supposedly needed is _core_.so, (not _core_.py as I stated
before) that belongs to:

/usr/lib/pyshared/python2.7/wx-2.8-gtk2-unicode/wx/_core_.so
/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core_.so
/usr/local/lib/python2.7/dist-packages/wx-2.9.4-gtk2/wx/_core_.so

For my os with two versions of wx, the one provided by Ubuntu and the
other.

It sounds like the wx.pth file is not being included in your .deb
package. It is a generated file that should be installed to your
site-packages folder which contains the folder name for the version of
wxPython that should be the default. (IOW, that folder is put on the
sys.path automatically.)
In your case it would contain something like
"wx-2.9.4-gtk2"

Right (although I have no idea how to check the .deb problem), wx.pth
is set to 2.9

This is the default sys.path output (no PYTHONPATH set) when I run a
Python shell in the console:

/usr/local/lib/python2.7/dist-packages/meta-_-py2.7.egg
/home/spametki
/usr/lib/python2.7
/usr/lib/python2.7/plat-linux2
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages/wx-2.9.4-gtk2
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PIL
/usr/lib/python2.7/dist-packages/gst-0.10
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/pymodules/python2.7
/usr/lib/python2.7/dist-packages/ubuntu-sso-client
/usr/lib/python2.7/dist-packages/ubuntuone-client
/usr/lib/python2.7/dist-packages/ubuntuone-control-panel
/usr/lib/python2.7/dist-packages/ubuntuone-couch
/usr/lib/python2.7/dist-packages/ubuntuone-installer
/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol
/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode

As Torsten noted, setting the PYTHONPATH to whichever package path
present in the system before running the Python shell solves the
problem, or better, using wxversion.select when possible.

The only issue occurs when you try the code posted initially, where
wx.pth is set to 2.9 but there seems to be some routes conflict while
using the import command.

Thanks again

For the record, in case someone else has the same problem:

I also searched for the module within the system and it's not present,
there is no _core_.py file.

The file supposedly needed is _core_.so, (not _core_.py as I stated
before) that belongs to:

/usr/lib/pyshared/python2.7/wx-2.8-gtk2-unicode/wx/_core_.so
/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core_.so
/usr/local/lib/python2.7/dist-packages/wx-2.9.4-gtk2/wx/_core_.so

Maybe you forget to do execute ldconfig (it refreshes the shared library cache)
This should be added as a post-installation step to the .deb, but I
didin't figured out how.

For my os with two versions of wx, the one provided by Ubuntu and the
other.

It sounds like the wx.pth file is not being included in your .deb
package. It is a generated file that should be installed to your
site-packages folder which contains the folder name for the version of
wxPython that should be the default. (IOW, that folder is put on the
sys.path automatically.)
In your case it would contain something like
"wx-2.9.4-gtk2"

Right (although I have no idea how to check the .deb problem), wx.pth
is set to 2.9

The deb generated with checkinstall just does the same as make
install: it puts the wx.pth in /usr/local/lib/python2.7/dist-packages

As that directory is before /usr/lib/python2.7/dist-packages/ in the
PYTHONPATH, I think it takes precedence.

BTW, deb are just a compressed package, you can open it with any archiver.

I think that if 2.9 is installed, it SHOULD NOT take precedence over
2.8, because it will break existing apps (wxGlade, for example)

If anyone know how to solve this issues or how to make a .deb without
this issues, that would be great

Best regards

Mariano Reingart
http://www.sistemasagiles.com.ar

···

On Tue, Apr 30, 2013 at 12:05 PM, Alan Etkin <spametki@gmail.com> wrote:

Maybe you forget to do execute ldconfig (it refreshes the shared library cache)

I did sudo ldconfig before trying the code but it didn’t solve the issue (I saw the warning in the recipe)

More data for debugging, although I don’t really know if it makes any difference.

Regards

$ cat /etc/alternatives/wx.pth
wx-2.8-gtk2-unicode

$ cat /usr/lib/python2.7/dist-packages/wx.pth
wx-2.8-gtk2-unicode

$ cat /usr/lib/wx/python/wx.pth
wx-2.8-gtk2-unicode

$ cat /usr/local/lib/python2.7/dist-packages/wx.pth
wx-2.9.4-gtk2

$ cat /usr/share/pyshared/wx.pth
wx-2.8-gtk2-unicode

$ cat /var/lib/dpkg/alternatives/wx.pth
auto
/usr/lib/wx/python/wx.pth

/usr/lib/wx/python/wx2.8.pth
28