[GRASS-dev] New attempt to update GRASS for Mac

Michael Barton Michael.Barton at asu.edu
Fri Jul 28 11:05:02 PDT 2017


Sorry if my message was not clear Moritz.

I showed the output of a non-GRASS terminal window, just to show that the GRASS_PYTHON environmental variable was indeed set. I set it in .profile, sourced .profile, and then launched GRASS because GRASS looks for Python when it launches (or at least that is what the start up message indicates).

But GRASS does not recognize GRASS_PYTHON set at the system level. Not sure why this is. It seems that setting it at the system level DOES embed it into the ~/.grass7/rc file. But again, this seems to have no effect on GRASS at launch, where the default system Python is hard coded somewhere.

Setting it from the GRASS terminal is not helpful if my goal is to bundle Python with GRASS inside the Mac app. The reason for doing this is to ensure a clean working environment for all Mac users, without having to download and install extra pieces of the correct version, and to avoid the issue where Mac SIP keeps GRASS from running.

Michael
____________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University

voice:  480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax: 480-965-7671 (SHESC),  480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu















On Jul 28, 2017, at 5:27 AM, Moritz Lennert <mlennert at club.worldonline.be<mailto:mlennert at club.worldonline.be>> wrote:

On 28/07/17 06:19, Michael Barton wrote:
Tried that and it seems to be ignored too. Here is the output from a terminal in the shell (outside GRASS):
Last login: Thu Jul 27 22:04:37 on ttys001
CMB-MacBook-Pro:~ cmbarton$ echo $GRASS_PYTHON
/Applications/anaconda/bin/python
This should make anaconda python (2.7.13) the default.
But here is the output from a GRASS terminal:
GRASS 7.3.svn (nc_spm_08_grass7):~ > echo $GRASS_PYTHON
python

How and where did you set GRASS_PYTHON ? I'm not an expert in MacOSX, but in GNU/Linux if I set 'export GRASS_PYTHON=SomeOtherPython' in one terminal, but launch GRASS in the second terminal, GRASS_PYTHON is not set at GRASS startup and is thus set to 'python' by default.


GRASS 7.3.svn (nc_spm_08_grass7):~ > python
Python 2.7.10 (default, Feb  7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
Also:
GRASS 7.3.svn (nc_spm_08_grass7):~ > echo $GRASS_PYTHONWX
/usr/bin/pythonw2.7
This environmental variable is set inside GRASS somewhere. It does not show up in the shell outside GRASS.
It GRASS ignoring the environmental variable setting for some reason. Is there something hardwired in that insists on looking for Python in /usr/bin?

Launching the 'python' binary in the command line does not interact in any way with the GRASS_PYTHON variable. If you launch 'python', it will launch the first python executable found in PATH.

If you want to see if GRASS_PYTHON correctly runs the python you wanted, then run '$GRASS_PYTHON'.

For example:

export GRASS_PYTHON=/usr/bin/python3.6
GRASS 7.3.svn (ETRS89_LAEA):/data/home/mlennert > python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
GRASS 7.3.svn (ETRS89_LAEA):/data/home/mlennert > $GRASS_PYTHON
Python 3.6.2 (default, Jul 17 2017, 13:39:29)
[GCC 6.4.0 20170704] on linux
Type "help", "copyright", "credits" or "license" for more information.

There is a difference between calling 'python' from a command line in a terminal (even if the GRASS environnement variables are set, i.e. GRASS has been "started") and calling python using $GRASS_PYTHON as is done in the GRASS code.

Moritz

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20170728/7a46ac29/attachment-0001.html>


More information about the grass-dev mailing list