Weird Install Error: wxPython

Greetings,

I have a weird error whenever I try to run any of the wxPython demos, after compiling the packages from source.

This is a CentOS 4.3 install. I'm very particular where everything goes so as not to run into any OS-supplied components.

Python is here: /opt/Python-2.4.3
wxWidgets is here: /opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly (as compiled from the wxPython sources)

After building and installing wxWidgets, I built wxPython like so:

/opt/Python-2.4.3/bin/python ./setup.py build_ext --debug WX_CONFIG=/opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly/bin/wx-config UNICODE=1

Then, I installed it like this:

/opt/Python-2.4.3/bin/python ./setup.py install WX_CONFIG=/opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly/bin/wx-config

And, when I try to run a demo, I get this error:

/opt/Python-2.4.3/bin/python ./Notebook.py
Traceback (most recent call last):
   File "./Notebook.py", line 4, in ?
     import wx
   File "/opt/Python-2.4.3/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/__init__.py", line 42, in ?
     from wx._core import *
   File "/opt/Python-2.4.3/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core.py", line 4, in ?
     import _core_
ImportError: libwx_gtk2d_xrc-2.6.so.0: cannot open shared object file: No such file or directory

Any idea what's going on here?

Thanks,
-Josh

Joshua Kramer wrote:

Greetings,

I have a weird error whenever I try to run any of the wxPython demos, after compiling the packages from source.

This is a CentOS 4.3 install. I'm very particular where everything goes so as not to run into any OS-supplied components.

Python is here: /opt/Python-2.4.3
wxWidgets is here: /opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly (as compiled from the wxPython sources)

After building and installing wxWidgets, I built wxPython like so:

/opt/Python-2.4.3/bin/python ./setup.py build_ext --debug WX_CONFIG=/opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly/bin/wx-config UNICODE=1

Then, I installed it like this:

/opt/Python-2.4.3/bin/python ./setup.py install WX_CONFIG=/opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly/bin/wx-config

And, when I try to run a demo, I get this error:

/opt/Python-2.4.3/bin/python ./Notebook.py
Traceback (most recent call last):
  File "./Notebook.py", line 4, in ?
    import wx
  File "/opt/Python-2.4.3/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/__init__.py", line 42, in ?
    from wx._core import *
  File "/opt/Python-2.4.3/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core.py", line 4, in ?
    import _core_
ImportError: libwx_gtk2d_xrc-2.6.so.0: cannot open shared object file: No such file or directory

Any idea what's going on here?

By default the path to the wx shared libs is not embedded in the wxPython extension modules, so the dynamic loader will just look in the standard paths and in any paths specified by the LD_LIBRARY_PATH environment variable. You can either set that variable to include /opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly/lib, add the path to /etd/ld.so.conf and rerun ldconfig, or rebuild wxPython giving the --rpath=/opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly/lib option to the build_ext setup command.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

environment variable. You can either set that variable to include /opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly/lib, add the path to /etd/ld.so.conf and rerun ldconfig, or rebuild wxPython giving the --rpath=/opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly/lib option to the build_ext setup command.

Excellent, thanks for the help. Now, the question is this: why is the wxPython NOT looking for Unicode wxWidgets libs? All of my wx libs are Unicode, I think; for example wxPython looks for

libwx_gtk2d_xrc-2.6.so.0

when I really have

libwx_gtk2ud_xrc-2.6.so.0

As I can see from the line I supplied above, I am enabling Unicode by setting UNICODE=1 on the build command line:

/opt/Python-2.4.3/bin/python ./setup.py build_ext --debug WX_CONFIG=/opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly/bin/wx-config UNICODE=1

Any ideas?

Thanks,
-Josh

Joshua Kramer wrote:

environment variable. You can either set that variable to include /opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly/lib, add the path to /etd/ld.so.conf and rerun ldconfig, or rebuild wxPython giving the --rpath=/opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly/lib option to the build_ext setup command.

Excellent, thanks for the help. Now, the question is this: why is the wxPython NOT looking for Unicode wxWidgets libs? All of my wx libs are Unicode, I think; for example wxPython looks for

libwx_gtk2d_xrc-2.6.so.0

when I really have

libwx_gtk2ud_xrc-2.6.so.0

As I can see from the line I supplied above, I am enabling Unicode by setting UNICODE=1 on the build command line:

/opt/Python-2.4.3/bin/python ./setup.py build_ext --debug WX_CONFIG=/opt/Python-2.4.3/wxWidgets-2.6.3-PythonOnly/bin/wx-config UNICODE=1

Near the begining of setup.py's output there is a line that starts with "Using flags:" What is the rest of the line? What do you get if you run "wx-config --list " + those flags?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Near the begining of setup.py's output there is a line that starts with "Using flags:" What is the rest of the line? What do you get if you run "wx-config --list " + those flags?

Actually, I was able to fix this by setting UNICODE=1 in the config.py file... now things work as they should!

Thanks again for the help.

Cheers,
-Josh

ImportError: libwx_gtk2d_xrc-2.6.so.0: cannot open shared object file: No such file or directory

Ok, I got past that error. Now, whenever I try to run an app using wxWidgets, I get this traceback:

Traceback (most recent call last):
   File "./SPE.py", line 48, in ?
     import ConfigParser, sys, os, wx
   File "/opt/Python-2.4.4-OR-EL5/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/__init__.py", line 45, in ?
     from wx._core import *
   File "/opt/Python-2.4.4-OR-EL5/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 4, in ?
     import _core_
ImportError: /opt/Python-2.4.4-OR-EL5/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_core_.so: undefined symbol: PyUnicodeUCS2_FromEncodedObject

I've searched the entire source tree for the symbol, and the only place it's present is _core_.so . How do I resolve or get rid of the reference to this symbol?

Thanks,
-J

Josh wrote:

ImportError: libwx_gtk2d_xrc-2.6.so.0: cannot open shared object file: No such file or directory

Ok, I got past that error. Now, whenever I try to run an app using wxWidgets, I get this traceback:

Traceback (most recent call last):
  File "./SPE.py", line 48, in ?
    import ConfigParser, sys, os, wx
  File "/opt/Python-2.4.4-OR-EL5/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/__init__.py", line 45, in ?
    from wx._core import *
  File "/opt/Python-2.4.4-OR-EL5/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 4, in ?
    import _core_
ImportError: /opt/Python-2.4.4-OR-EL5/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_core_.so: undefined symbol: PyUnicodeUCS2_FromEncodedObject

I've searched the entire source tree for the symbol, and the only place it's present is _core_.so . How do I resolve or get rid of the reference to this symbol?

Any time there is a missing UCS2 or UCS4 symbol it usually means that you are running with a different Python than what wxPython (or other extension module) was built with, and that the two Pythons had different configure options when they were built. One had --enable-unicode=ucs4 and one had --enable-unicode=ucs2.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!