[GRASS-dev] Errors when trying to start wxpython GUI

Dear GRASS people,

I've successfully compiled and installed GRASS 6.4.0 svn
(status of 7th July 2010). While the tcltk GUI runs fine,
any attempt to start the wxpython GUI produces one of the
following error messages:

either:

  ERROR: wxGUI requires wxPython. No module named wxversion

or (after having specified the path to wxversion.py via
  export PYTHONPATH=...):

  'import site' failed; use -v for traceback
  Traceback (most recent call last):
    File "/home/conradt/usr/local/grass-6.4.0svn/etc/wxpython/wxgui.py", line 23, in <module>
      import os
  ImportError: No module named os

Interestingly, the same messages appear when setting PYTHONPATH
to anything else (even non-existing paths).

I already re-built wxpython, which compiles without complaint.
Maybe the problem has something to do with having all my self-
compiled stuff under /home/conradt/usr/local/ while Python (2.6)
resides in /usr/bin/, to which only root may install. But all
my attempts of explicit PATH statements failed (so far).

Does anybody have a better idea what to do?

The machine has an SLES-11 x86_64 GNU/Linux running on Intel Xeon.

Best regards,
conradt

Tobias Conradt wrote:

I've successfully compiled and installed GRASS 6.4.0 svn
(status of 7th July 2010). While the tcltk GUI runs fine,
any attempt to start the wxpython GUI produces one of the
following error messages:

either:

  ERROR: wxGUI requires wxPython. No module named wxversion

or (after having specified the path to wxversion.py via
  export PYTHONPATH=...):

  'import site' failed; use -v for traceback
  Traceback (most recent call last):
    File "/home/conradt/usr/local/grass-6.4.0svn/etc/wxpython/wxgui.py", line 23, in <module>
      import os
  ImportError: No module named os

Interestingly, the same messages appear when setting PYTHONPATH
to anything else (even non-existing paths).

This suggests that your Python installation is broken, and is relying
upon PYTHONPATH to find the standard library. It should be able to
find the standard library without any PYTHONPATH setting.

If you're trying to use a "non-installed" version of Python, use
PYTHONHOME to tell Python where to find itself.

--
Glynn Clements <glynn@gclements.plus.com>

Dear Glynn, thanks for the quick reply!

The Python I use is system-wide installed in /usr/bin.

I've tried it with PYTHONHOME=/usr/lib64/python2.6 and
PYTHONHOME=/usr/lib64 to show the way to the standard
libraries, and I've tried PYTHONHOME=/usr/bin to tell
Python where to find itself. The result kept stable:

  'import site' failed; use -v for traceback
  Traceback (most recent call last):
    File "/home/conradt/usr/local/grass-6.4.0svn/etc/wxpython/wxgui.py", line 23, in <module>
      import os
  ImportError: No module named os

Best regards,
conradt

Glynn Clements wrote:

Tobias Conradt wrote:

I've successfully compiled and installed GRASS 6.4.0 svn
(status of 7th July 2010). While the tcltk GUI runs fine,
any attempt to start the wxpython GUI produces one of the
following error messages:

either:

  ERROR: wxGUI requires wxPython. No module named wxversion

or (after having specified the path to wxversion.py via
  export PYTHONPATH=...):

  'import site' failed; use -v for traceback
  Traceback (most recent call last):
    File "/home/conradt/usr/local/grass-6.4.0svn/etc/wxpython/wxgui.py", line 23, in <module>
      import os
  ImportError: No module named os

Interestingly, the same messages appear when setting PYTHONPATH
to anything else (even non-existing paths).

This suggests that your Python installation is broken, and is relying
upon PYTHONPATH to find the standard library. It should be able to
find the standard library without any PYTHONPATH setting.

If you're trying to use a "non-installed" version of Python, use
PYTHONHOME to tell Python where to find itself.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Today, I made a completely new installation of Python (2.7) in
my local path, re-built and -installed NumPy, wxWidgets and wxPython.
Then I re-configured, -built and -installed GRASS.
Requesting g.gui wxpython still leads to:

  ERROR: wxGUI requires wxPython. No module named wxversion

Having set PYTHONHOME=/home/conradt/usr/local makes no difference,
any other setting now produces an *altered error message*:

  ImportError: No module named site

Any clues?

Best, conradt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkw9lVsACgkQ+3JZ/B5uEZeyagCghnuMvCDmpZ/IgUyrMUTIw+rO
OdcAn3/BieK3rq7PwCVtPF8rSS4zhXzU
=6V9t
-----END PGP SIGNATURE-----

Tobias Conradt wrote:

Having set PYTHONHOME=/home/conradt/usr/local makes no difference,
any other setting now produces an *altered error message*:

  ImportError: No module named site

Any clues?

Still a broken Python installation. The "site" module is part of the
standard library. It's loaded automatically by the Python interpreter,
before it starts processing the script, so any problem locating the
standard library will manifest itself as an error in loading the site
module.

You would be better off asking on the Python mailing list.

--
Glynn Clements <glynn@gclements.plus.com>

Finally, I managed to solve it!

The error was not a broken Python, but an incomplete wxPython installation!
Python had well been accessed, as long as I didn't mess around with PYTHONPATH;
it just couldn't find the wx stuff.

Thanks anyway for the time you took looking on my problem!

Best regards,
conradt

Glynn Clements wrote:

Tobias Conradt wrote:

Having set PYTHONHOME=/home/conradt/usr/local makes no difference,
any other setting now produces an *altered error message*:

  ImportError: No module named site

Any clues?

Still a broken Python installation. The "site" module is part of the
standard library. It's loaded automatically by the Python interpreter,
before it starts processing the script, so any problem locating the
standard library will manifest itself as an error in loading the site
module.

You would be better off asking on the Python mailing list.

--
"Das, wobei unsere Berechnungen versagen,
nennen wir Zufall."
                                  --- Albert Einstein

+----------------------------------------------------+
| |
| Tobias Conradt Diplom-Geooekologe |
| Geo-ecologist (MSc) |
| Fon: +49-331-288-2666 |
| |
| Potsdam-Institut fuer Klimafolgenforschung (PIK) |
| Potsdam-Institute for Climate Impact Research |
| |
| http://www.pik-potsdam.de |
| |
| Forschungsbereich 2 Klimawirkung & Vulnerabilitaet |
| Research Domain 2 Climate Impacts & Vulnerabilities|
| |
| gpg key: |
| www.pik-potsdam.de/~conradt/pubkey_conradt.asc |
| key fingerprint: |
| BE37 BCA9 F654 AC27 AB6C 7795 FB72 59FC 1E6E 1197 |
| |
+----------------------------------------------------+