ImportError: No module named wx

Nara Narasimhan wrote:

Step 1
  downloaded python 2.4.1 source, built, and installed fine.

____________________________________________________________
Step 2
  Tried the 2.6.0.1 gtk2 ansi versions of the RPMs for fc2:
  
Did a couple of experiments such as setting PYTHONPATH and
doing a soft link of wx in the site-packages dir, but could
not fix the "no module named wx" issue. So decided to
remove (rpm -e) the RPMs.

Those RPMs are built with Python 2.4.1 installed from the RPMs at http://www.python.org/2.4.1/rpms.html. So they will put Python 2.4 into the /usr prefix instead of the /usr/local prefix that your build was installed to. If you use the RPMs for Python then the RPMs for wxPython should work fine.

____________________________________________________________
Step 3
  Lets try building from source: erased (rpm -e) the RPMs,
  downloaded 2.6.0.1 source, did standard configure, make, make install
  (read through Robin's build and install notes, did not see need
   for any particular changes to my env.)

If all you did was the configure, make, make install then you didn't read the instructions closly enough. All you did was build and install the wxWidgets libs, not wxPython.

Question: There is no libwx-2.6-gtk2-ansi.so.* here. Should there be?

No. The unicode libs are named with a libwx_gtk2u_* prefix. The absence of the 'u' means that it is an ansi build.

______________________________
Step 3.1

I'll skip all the rest of the questions since you don't have wxPython built/installed yet.

···

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

Qua, 2005-06-01 às 18:24 -0700, Nara Narasimhan escreveu:

[root@nonhpnnl lib]# ls
libwx_base-2.6.so libwx_gtk2_html-2.6.so
libwx_base-2.6.so.0 libwx_gtk2_html-2.6.so.0
libwx_base-2.6.so.0.0.0 libwx_gtk2_html-2.6.so.0.0.0
libwx_base_net-2.6.so libwx_gtk2_media-2.6.so
libwx_base_net-2.6.so.0 libwx_gtk2_media-2.6.so.0
libwx_base_net-2.6.so.0.0.0 libwx_gtk2_media-2.6.so.0.0.0
libwx_base_xml-2.6.so libwx_gtk2_qa-2.6.so
libwx_base_xml-2.6.so.0 libwx_gtk2_qa-2.6.so.0
libwx_base_xml-2.6.so.0.0.0 libwx_gtk2_qa-2.6.so.0.0.0
libwx_gtk2_adv-2.6.so libwx_gtk2_xrc-2.6.so
libwx_gtk2_adv-2.6.so.0 libwx_gtk2_xrc-2.6.so.0
libwx_gtk2_adv-2.6.so.0.0.0 libwx_gtk2_xrc-2.6.so.0.0.0
libwx_gtk2_core-2.6.so python2.4
libwx_gtk2_core-2.6.so.0 wx
libwx_gtk2_core-2.6.so.0.0.0

[root@nonhpnnl lib]# ls wx
config include

Question: There is no libwx-2.6-gtk2-ansi.so.* here. Should there be?

No, those are correct.

If I had understand you correctly, you only install the wxwidgets part.
You must build and install the wxPython part or just build it and set
the PYTHONPATH to wxPython-src-2.6.0.1/wxPython if I'am not wrong.

Ricardo

Thanks Robin, I will try the python RPM + wxPython RPMs combo.
Will reply back here on the results of that.

/Nara

···

--- Robin Dunn <robin@alldunn.com> wrote:

Nara Narasimhan wrote:

> Step 1
> downloaded python 2.4.1 source, built, and installed fine.
>

> ____________________________________________________________
> Step 2
> Tried the 2.6.0.1 gtk2 ansi versions of the RPMs for fc2:
>
> Did a couple of experiments such as setting PYTHONPATH and
> doing a soft link of wx in the site-packages dir, but could
> not fix the "no module named wx" issue. So decided to
> remove (rpm -e) the RPMs.

Those RPMs are built with Python 2.4.1 installed from the RPMs at
http://www.python.org/2.4.1/rpms.html. So they will put Python 2.4 into
the /usr prefix instead of the /usr/local prefix that your build was
installed to. If you use the RPMs for Python then the RPMs for wxPython
should work fine.

> ____________________________________________________________
> Step 3
> Lets try building from source: erased (rpm -e) the RPMs,
> downloaded 2.6.0.1 source, did standard configure, make, make install
> (read through Robin's build and install notes, did not see need
> for any particular changes to my env.)

If all you did was the configure, make, make install then you didn't
read the instructions closly enough. All you did was build and install
the wxWidgets libs, not wxPython.

>
> Question: There is no libwx-2.6-gtk2-ansi.so.* here. Should there be?

No. The unicode libs are named with a libwx_gtk2u_* prefix. The
absence of the 'u' means that it is an ansi build.

>
> ______________________________
> Step 3.1

I'll skip all the rest of the questions since you don't have wxPython
built/installed yet.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

/Nara Narasimhan

e-mail nara19@yahoo.com
phone 510 623 9230
fax 510 770 1377

__________________________________
Discover Yahoo!
Have fun online with music videos, cool games, IM and more. Check it out!
http://discover.yahoo.com/online.html

Thanks Robin, I will try the python RPM + wxPython RPMs combo.
Will reply back here on the results of that.

/Nara

···

--- Nara Narasimhan <nara19@yahoo.com> wrote:
___________________________________________________________________
Ok, here is how far I got after installing the python2.4 from
pydotorg and th wxPython2.6.0.1 for python2.4 rpms. The good
news is that it got past the "No module named wx" error, but
hit a snag later.

nara@orwell demo]$ python2.4 Main.py
Traceback (most recent call last):
  File "Main.py", line 32, in ?
    import wx # This module uses the new wx namespace
  File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/__init__.py", line
44, in ?
    from wx._core import *
  File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core.py", line 4,
in ?
    import _core_
ImportError: /usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core_.so:
undefined symbol: PyUnicodeUCS4_AsEncodedString

______________________________________________________________
Here are the rpms I have:

[root@orwell dnld]# rpm -q python2.4
python2.4-2.4.1-1pydotorg
[root@orwell dnld]# rpm -q wxPython-common-gtk2-ansi-2.6.0.1-fc2_py2.4
wxPython-common-gtk2-ansi-2.6.0.1-fc2_py2.4
[root@orwell dnld]# rpm -q wxPython2.6-gtk2-ansi-2.6.0.1-fc2_py2.4
wxPython2.6-gtk2-ansi-2.6.0.1-fc2_py2.4

_______________________________________________________________
Googling PyUnicodeUCS4_AsEncodedString, I see
<a
ActiveStatehttp://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/2589812>
this </a>
from Robin Dunn:

Craig Howard wrote:

I'm using the 2.6 Fedora Core rpm on Slackware linux. I get the following

error when attem
pting to start the wx demo.

  
from wx._core import *
   File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core.py", line

4, in ?

     import _core_
ImportError: /usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core_.so:

undefined sym
bol: PyUnicodeUCS4_AsEncodedString

What is the solution?

The Python on Fedora is configured with --enable-unicode=ucs4 and the
Python on your machine was not. Extension modules that use any of the
unicode functions in the Python API and are compiled with one are not
compatible with the other, so you will need to do one of the following:

1) Use one of the other sets of wxPython RPMs, although I don't think
that any of them in the 2.6 release built for Python 2.4 are using the
default ucs mode... However the mdk102 binaries in the newer preview
builds *do*. http://starship.python.net/crew/robind/wxPython/daily/

2) Compile wxPython yourself for your machine.

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

_________________________________________________________________
What next?

1. use the unicode pair of wxPython rpms? OR
2. Build wxPython libs fresh from source on my fc3?

I will try both, in that order, while I wait for an answer.

Regards
/Nara Narasimhan

--- Robin Dunn <robin@alldunn.com> wrote:

> Nara Narasimhan wrote:
>
> > Step 1
> > downloaded python 2.4.1 source, built, and installed fine.
> >
>
> > ____________________________________________________________
> > Step 2
> > Tried the 2.6.0.1 gtk2 ansi versions of the RPMs for fc2:
> >
> > Did a couple of experiments such as setting PYTHONPATH and
> > doing a soft link of wx in the site-packages dir, but could
> > not fix the "no module named wx" issue. So decided to
> > remove (rpm -e) the RPMs.
>
> Those RPMs are built with Python 2.4.1 installed from the RPMs at
> http://www.python.org/2.4.1/rpms.html. So they will put Python 2.4 into
> the /usr prefix instead of the /usr/local prefix that your build was
> installed to. If you use the RPMs for Python then the RPMs for wxPython
> should work fine.
>
> > ____________________________________________________________
> > Step 3
> > Lets try building from source: erased (rpm -e) the RPMs,
> > downloaded 2.6.0.1 source, did standard configure, make, make install
> > (read through Robin's build and install notes, did not see need
> > for any particular changes to my env.)
>
> If all you did was the configure, make, make install then you didn't
> read the instructions closly enough. All you did was build and install
> the wxWidgets libs, not wxPython.
>
> >
> > Question: There is no libwx-2.6-gtk2-ansi.so.* here. Should there be?
>
> No. The unicode libs are named with a libwx_gtk2u_* prefix. The
> absence of the 'u' means that it is an ansi build.
>
> >
> > ______________________________
> > Step 3.1
>
> I'll skip all the rest of the questions since you don't have wxPython
> built/installed yet.
>
> --
> Robin Dunn
> Software Craftsman
> http://wxPython.org Java give you jitters? Relax with wxPython!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
>
>

/Nara Narasimhan

e-mail nara19@yahoo.com
phone 510 623 9230
fax 510 770 1377

__________________________________
Discover Yahoo!
Have fun online with music videos, cool games, IM and more. Check it out!
http://discover.yahoo.com/online.html

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

/Nara Narasimhan

e-mail nara19@yahoo.com
phone 510 623 9230
fax 510 770 1377

__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail

Robin Dunn wrote:

Those RPMs are built with Python 2.4.1 installed from the RPMs at http://www.python.org/2.4.1/rpms.html. So they will put Python 2.4 into the /usr prefix instead of the /usr/local prefix that your build was installed to. If you use the RPMs for Python then the RPMs for wxPython should work fine.

another option is to install the wxPython rpm with a --relocate, to put it in /usr/local. This doesn't quite work, as the path to the wx *.sos is hard codeed. However this can be fixed with a soft link from where they are in /usr/local/lib to where wxPython is looking for them in /usr/lib.

Yet another option is to rebuild the rpm from the srpm. This is easier than building from the tarball.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Nara Narasimhan wrote:

Ok, here is how far I got after installing the python2.4 from
pydotorg and th wxPython2.6.0.1 for python2.4 rpms. The good
news is that it got past the "No module named wx" error, but
hit a snag later.

nara@orwell demo]$ python2.4 Main.py
Traceback (most recent call last):
  File "Main.py", line 32, in ?
    import wx # This module uses the new wx namespace
  File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/__init__.py", line
44, in ?
    from wx._core import *
  File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core.py", line 4,
in ?
    import _core_
ImportError: /usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core_.so:
undefined symbol: PyUnicodeUCS4_AsEncodedString

Hmm... Sorry, I thought that I had worked out the kinks there and gotten the Python unicode configure flag consistent with the available packages. Something must have changed somewhere, I'll check into it...

···

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

Robin Dunn wrote:

Nara Narasimhan wrote:

Ok, here is how far I got after installing the python2.4 from
pydotorg and th wxPython2.6.0.1 for python2.4 rpms. The good
news is that it got past the "No module named wx" error, but
hit a snag later.

nara@orwell demo]$ python2.4 Main.py
Traceback (most recent call last):
  File "Main.py", line 32, in ?
    import wx # This module uses the new wx namespace
  File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/__init__.py", line
44, in ?
    from wx._core import *
  File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core.py", line 4,
in ?
    import _core_
ImportError: /usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core_.so:
undefined symbol: PyUnicodeUCS4_AsEncodedString

Hmm... Sorry, I thought that I had worked out the kinks there and gotten the Python unicode configure flag consistent with the available packages. Something must have changed somewhere, I'll check into it...

I've just double checked and the pydotorg RPM *does* have the same ucs4 unicode setting as the others, and so should be compatible with the wxPython RPMs. Are you sure that the python2.4 you excuted was the one from the RPM and not the one you built yourself?

  # python2.4
  Python 2.4.1 (#1, Apr 1 2005, 16:45:07)
  [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import sys
  >>> sys.maxunicode
  1114111
  >>>
  >>> import wx
  >>> wx.__file__
  '/usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/__init__.pyc'
  >>>

# rpm -qa | grep python2.4
python2.4-2.4.1-1pydotorg
python2.4-devel-2.4.1-1pydotorg
python2.4-tools-2.4.1-1pydotorg
python2.4-tkinter-2.4.1-1pydotorg

# rpm -qa | grep wx
wxPython-common-gtk2-ansi-2.6.0.1-fc2_py2.4
wxPython2.6-gtk2-ansi-2.6.0.1-fc2_py2.4

···

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

re:

Are you sure that the python2.4 you excuted was the one
from the RPM and not the one you built yourself?

You are likely right. The machine I ran that on is at home, but
I have a nearly identically configured machine at work, and
loading the 2.4.1 python RPMs, 2.6.0.1 wxPython RPMs, and
running /usr/bin/python2.4 got me going fine. The demo
came right up, when I typed:

cd /home/nara/dnld/wxPython-2.6.0.1/demo # wxPython demo dir
/usr/bin/python2.4 Main.py

I will repeat this process later on my home machine.

Thanks a heap.

You might want to mention the fact that people should use the
python2.4 RPMs from pydotorg along with the fc2 wxPython RPMS,
rather than building python2.4 from source,
right on the wxPython.org download page.

/Nara

FYI, my python2.4 and rpms are the same as the ones you show:

[nara@nonhpnnl demo]$ rpm -qa | grep python2.4
python2.4-devel-2.4.1-1pydotorg
python2.4-tools-2.4.1-1pydotorg
python2.4-tkinter-2.4.1-1pydotorg
python2.4-2.4.1-1pydotorg

[nara@nonhpnnl demo]$ rpm -qa | grep wxPython
wxPython-common-gtk2-ansi-2.6.0.1-fc2_py2.4
wxPython2.6-gtk2-ansi-2.6.0.1-fc2_py2.4

And sys.maxunicode checks out:
[nara@nonhpnnl demo]$ /usr/bin/python2.4
Python 2.4.1 (#1, Apr 1 2005, 16:45:07)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import sys
sys.maxunicode

1114111

Robin Dunn wrote:
> Nara Narasimhan wrote:
>
>> Ok, here is how far I got after installing the python2.4 from
>> pydotorg and th wxPython2.6.0.1 for python2.4 rpms. The good
>> news is that it got past the "No module named wx" error, but
>> hit a snag later.
>>
>>
>> nara@orwell demo]$ python2.4 Main.py
>> Traceback (most recent call last):
>> File "Main.py", line 32, in ?
>> import wx # This module uses the new wx namespace
>> File
>> "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/__init__.py", line
>> 44, in ?
>> from wx._core import *
>> File
>> "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core.py", line 4,
>> in ?
>> import _core_
>> ImportError:
>> /usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core_.so:
>> undefined symbol: PyUnicodeUCS4_AsEncodedString
>
>
> Hmm... Sorry, I thought that I had worked out the kinks there and
> gotten the Python unicode configure flag consistent with the available
> packages. Something must have changed somewhere, I'll check into it...

I've just double checked and the pydotorg RPM *does* have the same ucs4
unicode setting as the others, and so should be compatible with the
wxPython RPMs. Are you sure that the python2.4 you excuted was the one
from the RPM and not the one you built yourself?

  # python2.4
  Python 2.4.1 (#1, Apr 1 2005, 16:45:07)
  [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import sys
  >>> sys.maxunicode
  1114111
  >>>
  >>> import wx
  >>> wx.__file__
  '/usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/__init__.pyc'
  >>>

# rpm -qa | grep python2.4
python2.4-2.4.1-1pydotorg
python2.4-devel-2.4.1-1pydotorg
python2.4-tools-2.4.1-1pydotorg
python2.4-tkinter-2.4.1-1pydotorg

# rpm -qa | grep wx
wxPython-common-gtk2-ansi-2.6.0.1-fc2_py2.4
wxPython2.6-gtk2-ansi-2.6.0.1-fc2_py2.4

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

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

/Nara Narasimhan

e-mail nara19@yahoo.com
phone 510 623 9230
fax 510 770 1377

···

--- Robin Dunn <robin@alldunn.com> wrote:

__________________________________
Discover Yahoo!
Find restaurants, movies, travel and more fun for the weekend. Check it out!
http://discover.yahoo.com/weekend.html