[GRASS-dev] GRASS, ArcGIS, and Python incompatibilties

I thought I’d seen this somewhere on the list, but I can’t seem to find it. If there is a posted answer, perhaps someone could point me to it. Otherwise, hopefully, someone can offer an answer.

I’m working with a colleague who has Windows 7 and ArcGIS installed. He installed GRASS for Windows, but it won’t launch due to some combination of Python/wxPython incompatibility. We’re pretty sure that it has to do with the version of Python he had to install with ArcGIS. The ArcGIS Python is 2.6, but GRASS for Windows comes with Python 2.7. Is there some configuration setting to get around this?

Michael


C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Corporation for Atmospheric Research
303-497-2889 (voice)

Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

Michael,

check whether any of these two items under Troubleshooting for MS Windows applies:
http://courses.ncsu.edu/mea582/common/GIS_anal_assign/GIS_Anal_Aintro.html
(it may be the dll issue - that is what some of my students had to do last semester).
Otherwise, we had 50 students running GRASS along ArcGIS on their own laptops
successfully, for which I am enormously grateful to all who have contributed to WinGRASS
installer success.

Helena

Helena Mitasova
Associate Professor
Department of Marine, Earth, and Atmospheric Sciences
2800 Faucette Drive, Rm. 1125 Jordan Hall
North Carolina State University
Raleigh, NC 27695-8208
hmitaso@ncsu.edu

"All electronic mail messages in connection with State business which are sent to or received by this account are subject to the NC Public Records Law and may be disclosed to third parties.”

On Jun 28, 2012, at 5:02 PM, Michael Barton wrote:

I thought I'd seen this somewhere on the list, but I can't seem to find it. If there is a posted answer, perhaps someone could point me to it. Otherwise, hopefully, someone can offer an answer.

I'm working with a colleague who has Windows 7 and ArcGIS installed. He installed GRASS for Windows, but it won't launch due to some combination of Python/wxPython incompatibility. We're pretty sure that it has to do with the version of Python he had to install with ArcGIS. The ArcGIS Python is 2.6, but GRASS for Windows comes with Python 2.7. Is there some configuration setting to get around this?

Michael
_____________________
C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Corporation for Atmospheric Research
303-497-2889 (voice)

Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

Michael Barton wrote:

I thought I'd seen this somewhere on the list, but I can't seem to find
it. If there is a posted answer, perhaps someone could point me to it.
Otherwise, hopefully, someone can offer an answer.

I'm working with a colleague who has Windows 7 and ArcGIS installed. He
installed GRASS for Windows, but it won't launch due to some combination
of Python/wxPython incompatibility. We're pretty sure that it has to do
with the version of Python he had to install with ArcGIS. The ArcGIS
Python is 2.6, but GRASS for Windows comes with Python 2.7. Is there
some configuration setting to get around this?

GRASS 7 should be able to use any of 2.5, 2.6, or 2.7. The Windows
installer tries to force the use of a bundled version, so you may need
to undo that first (remove it's bundled Python, unset any PYTHONHOME
or PYTHONPATH variables, etc).

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

Don't you need to have the wxPython that GRASS was compiled with? And doesn't this wxPython have to match the Python version?

Michael

On Jun 29, 2012, at 1:49 PM, Glynn Clements wrote:

Michael Barton wrote:

I thought I'd seen this somewhere on the list, but I can't seem to find
it. If there is a posted answer, perhaps someone could point me to it.
Otherwise, hopefully, someone can offer an answer.

I'm working with a colleague who has Windows 7 and ArcGIS installed. He
installed GRASS for Windows, but it won't launch due to some combination
of Python/wxPython incompatibility. We're pretty sure that it has to do
with the version of Python he had to install with ArcGIS. The ArcGIS
Python is 2.6, but GRASS for Windows comes with Python 2.7. Is there
some configuration setting to get around this?

GRASS 7 should be able to use any of 2.5, 2.6, or 2.7. The Windows
installer tries to force the use of a bundled version, so you may need
to undo that first (remove it's bundled Python, unset any PYTHONHOME
or PYTHONPATH variables, etc).

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

_____________________
C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Consortium for Atmospheric Research
303-497-2889 (voice)

Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

Michael Barton wrote:

Don't you need to have the wxPython that GRASS was compiled with?
And doesn't this wxPython have to match the Python version?

GRASS isn't "compiled" with any version of Python, i.e. it doesn't
have any binaries which link against the Python DLL/DSO.

At one time there were binary modules for the wx GUI's nviz and vdigit
components, and the SWIG wrappers, but those have all since been
eliminated.

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

Does this mean that we no longer *have* to bundle wxPython with the Mac binaries? That they will work with whatever wxPython is installed (assuming it is within the range of supported versions, of course) regardless of what it was compiled with?

Michael

On Jun 30, 2012, at 4:32 PM, Glynn Clements wrote:

Michael Barton wrote:

Don't you need to have the wxPython that GRASS was compiled with?
And doesn't this wxPython have to match the Python version?

GRASS isn't "compiled" with any version of Python, i.e. it doesn't
have any binaries which link against the Python DLL/DSO.

At one time there were binary modules for the wx GUI's nviz and vdigit
components, and the SWIG wrappers, but those have all since been
eliminated.

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

_____________________
C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Consortium for Atmospheric Research
303-497-2889 (voice)

Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

I guess technically it could use the system wxpython. But I can think of a few reasons to still bundle wxpython:

- bug fixes in later versions than the system version that greatly affect use in GRASS (I don't remember, but I think there were some?)

- consistency of behavior across system versions from having the same wxpython

- 64bit support in wxpython 2.9 when GRASS is happy with 2.9 (or whatever the release version is, 2.10?)

- simply that wxpython is not included in the system starting with OS X 10.7

On Jun 30, 2012, at 10:28 PM, Michael Barton wrote:

Does this mean that we no longer *have* to bundle wxPython with the Mac binaries? That they will work with whatever wxPython is installed (assuming it is within the range of supported versions, of course) regardless of what it was compiled with?

Michael

On Jun 30, 2012, at 4:32 PM, Glynn Clements wrote:

Michael Barton wrote:

Don't you need to have the wxPython that GRASS was compiled with?
And doesn't this wxPython have to match the Python version?

GRASS isn't "compiled" with any version of Python, i.e. it doesn't
have any binaries which link against the Python DLL/DSO.

At one time there were binary modules for the wx GUI's nviz and vdigit
components, and the SWIG wrappers, but those have all since been
eliminated.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"This is a question about the past, is it? ... How can I tell that the past isn't a fiction designed to account for the discrepancy between my immediate physical sensations and my state of mind?"

- The Ruler of the Universe

Michael Barton wrote:

Does this mean that we no longer *have* to bundle wxPython with the
Mac binaries? That they will work with whatever wxPython is installed
(assuming it is within the range of supported versions, of course)
regardless of what it was compiled with?

That should be the case.

GRASS should only require that you have a suitable version of Python
with suitable versions of the necessary modules (primarily wxPython
and NumPy).

One issue with unbundling is that installing the additional components
may be considered inconvenient on platforms which lack package
management facilities.

OTOH, bundling has issues of its own, mainly that you may get
conflicts between the bundled version and the "system" version.

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

at work, we use ArcGIS (Python 2.6), GRASS GIS (Python 2.7) QGIS (Python 2.7)
and a standard Python (version 2.5) installed on Windows XP without problem
(in the Windows Registry, only Python 2.5 and the Python 2.6 of ArcGIS)

*Arcpy*
- has no wxPython module:
  >>> import wx
   Runtime error <type 'exceptions.ImportError'>: No module named wx
  >>> from wxPython.wx import *
  Runtime error <type 'exceptions.ImportError'>: No module named wxPython.wx
  >>> from wxPython import *
  Runtime error <type 'exceptions.ImportError'>: No module named wxPython

- but we can use modules of Python 2.5 (without dlls...)
  >>> import subprocess
  >>> argument= str(geom)
  >>> trait =
subprocess.Popen(['C:/Python25/python.exe','d:/test/testshapely.py',argument],
stdout=subprocess.PIPE)
>>> wkt= trait.stdout.read()
>>> print wkt
'LINESTRING (232278.9235196237900000....

*QGIS or GRASS GIS*
The same thing is true (see
http://www.portailsig.org/content/qgis-lancer-des-scripts-python-ou-des-commandes-shell-depuis-la-console-python-ou-avec-scrip
http://www.portailsig.org/content/qgis-lancer-des-scripts-python-ou-des-commandes-shell-depuis-la-console-python-ou-avec-scrip
, in French)

When we try to use Arcpy in GRASS GIS or QGIS, the error message is
  import sys
  sys.path.append('C:\\Program Files\\ArcGIS\\Desktop10.0\\arcpy\\')
  sys.path.append('C:\\Program Files\\ArcGIS\\Desktop10.0\\Bin\\')
  import arcpy
  Traceback (most recent call last):
....
  *ImportError: Module use of python26.dll conflicts with this version of
Python*.

same thing if i use subprocess.Popen

If i do the same thing in ArcPy
    sys.path.append('C:\\Program Files\\GRASS
6.4.2\\Python27\\Lib\\site-packages')
    import wx
    Traceback (most recent call last):
    ...
    *ImportError: Module use of python27.dll conflicts with this version of
Python*.

so i do not think that the problem comes from the different versions of
Python

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/GRASS-ArcGIS-and-Python-incompatibilties-tp4984692p4984776.html
Sent from the Grass - Users mailing list archive at Nabble.com.

At work we use

Windows 7 ( Arcgis 10 SP4 and GRASS) without any problem

Sent from my iPhone
David Alvarez

On Jun 29, 2012, at 4:32 AM, gene <martin.laloux@gmail.com> wrote:

at work, we use ArcGIS (Python 2.6), GRASS GIS (Python 2.7) QGIS (Python 2.7)
and a standard Python (version 2.5) installed on Windows XP without problem
(in the Windows Registry, only Python 2.5 and the Python 2.6 of ArcGIS)

*Arcpy*
- has no wxPython module:

import wx

  Runtime error <type 'exceptions.ImportError'>: No module named wx

from wxPython.wx import *

Runtime error <type 'exceptions.ImportError'>: No module named wxPython.wx

from wxPython import *

Runtime error <type 'exceptions.ImportError'>: No module named wxPython

- but we can use modules of Python 2.5 (without dlls...)

import subprocess
argument= str(geom)
trait =

subprocess.Popen(['C:/Python25/python.exe','d:/test/testshapely.py',argument],
stdout=subprocess.PIPE)

wkt= trait.stdout.read()
print wkt

'LINESTRING (232278.9235196237900000....

*QGIS or GRASS GIS*
The same thing is true (see
http://www.portailsig.org/content/qgis-lancer-des-scripts-python-ou-des-commandes-shell-depuis-la-console-python-ou-avec-scrip
http://www.portailsig.org/content/qgis-lancer-des-scripts-python-ou-des-commandes-shell-depuis-la-console-python-ou-avec-scrip
, in French)

When we try to use Arcpy in GRASS GIS or QGIS, the error message is
import sys
sys.path.append('C:\\Program Files\\ArcGIS\\Desktop10.0\\arcpy\\')
sys.path.append('C:\\Program Files\\ArcGIS\\Desktop10.0\\Bin\\')
import arcpy
Traceback (most recent call last):
....
*ImportError: Module use of python26.dll conflicts with this version of
Python*.

same thing if i use subprocess.Popen

If i do the same thing in ArcPy
   sys.path.append('C:\\Program Files\\GRASS
6.4.2\\Python27\\Lib\\site-packages')
   import wx
   Traceback (most recent call last):
   ...
   *ImportError: Module use of python27.dll conflicts with this version of
Python*.

so i do not think that the problem comes from the different versions of
Python

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/GRASS-ArcGIS-and-Python-incompatibilties-tp4984692p4984776.html
Sent from the Grass - Users mailing list archive at Nabble.com.
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Glynn Clements wrote

remove it's bundled Python, unset any PYTHONHOME or PYTHONPATH variables,
etc).

I repeat, I think this is not the problem. We are running QGIS 1.7.4, 1.8,
GRASS GIS 6.2.4 and 7 dev, ArcGIS 10 and standard Python 2.5 without problem
(Windows XP)

Each version of Python (2.5,2.6 and 2.7) works independently without problem
.

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/GRASS-ArcGIS-and-Python-incompatibilties-tp4984692p4984993.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Michael Barton wrote

Does this mean that we no longer *have* to bundle wxPython with the Mac
binaries? That they will work with whatever wxPython is installed
(assuming it is within the range of supported versions, of course)
regardless of what it was compiled with?

it would be easy but no, because wxPython is not a pure Python library (only
with Python files). It use wxWidgets (C++ library)

*Be sure to use the same version of Python to run the script that you
would like to use the wxPython binaries with*

from http://wxpython.org/builddoc.php

The Mac OS X version, for example, is only available in 32-bit mode because
WxWidgets probably uses Carbon library, which is not available in 64-bit
mode. "This, in turn, means that using it in Python requires you to launch
Python in 32-bit mode (Python is a universal binary with both 32-bit and
64-bit versions of itself available in the same binary file, so it can be
launched in either mode) from
http://stackoverflow.com/questions/2565201/wxpython-incompatible-with-snow-leopard
http://stackoverflow.com/questions/2565201/wxpython-incompatible-with-snow-leopard
)

If you look at the downloads of the binaries of wxPython, there are also
versions for Windows 32bits, and Windows 64bits for example
see also http://wiki.wxpython.org/TentativeRoadmap
http://wiki.wxpython.org/TentativeRoadmap
It may be that the problem, but if we don't know the error message...

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/GRASS-ArcGIS-and-Python-incompatibilties-tp4984692p4985133.html
Sent from the Grass - Users mailing list archive at Nabble.com.