Opened 6 years ago

Closed 14 months ago

#2039 closed defect (fixed)

Startup Error: G_getenv(): Variable LOCATION_NAME not set

Reported by: akdeakin Owned by: grass-dev@…
Priority: normal Milestone: 6.4.6
Component: Startup Version: 6.4.3 RCs
Keywords: wingrass, python, MAXREPEAT, DLL, msvcr Cc:
CPU: x86-64 Platform: MSWindows 7

Description

GRASS GIS 6.4.3RC2 was downloaded as part of Quantum GIS. When starting GRASS, command line window appears with multiple errors:

ERROR: G_getenv(): Variable LOCATION_NAME not set

I've attached a jpeg of the command window. The window appears briefly before closing and there's a very brief display of opening graphic.

I am running this on my computer at work where I don't have administrative privileges. All installs, uninstalls, etc. have to be done via a technical support request. I wasn't sure whether not having administrative privileges may have anything to do with the errors.

The sample data (e.g., Spearfish60) are stored in c:\Users\deakin\grassdata.

Attachments (2)

Grass64StartupError.JPG (101.6 KB) - added by akdeakin 6 years ago.
Screenshot of Error Command Line Window
CmdWindowErrors.JPG (161.0 KB) - added by akdeakin 6 years ago.
Screenshot of Cmd Line Window following attempt to run grass 64svn

Download all attachments as: .zip

Change History (24)

Changed 6 years ago by akdeakin

Attachment: Grass64StartupError.JPG added

Screenshot of Error Command Line Window

comment:1 Changed 6 years ago by neteler

Keywords: wingrass added

Can you please update to RC4?

http://grass.osgeo.org/news/25/15/GRASS-GIS-6-4-3RC4-released/

A series of wxGUI related errors have been fixed since your installed RC2 version. And, yes, administrator rights are needed to install the software (not to run it, for this normal user rights are the proper way to use the software).

comment:2 Changed 6 years ago by akdeakin

CPU: x86-32x86-64
Milestone: 6.4.36.4.4

I have upgraded to GRASS GIS 6.4.3RC4: WinGRASS-6.4.4svn-r57305-650-Setup.exe

This time, I am trying to launch GRASS on my home computer with full administrative privileges.

I have also installed to the following directory: C:\grass64 and installed the latest Microsoft .NET framework. I also disabled my avast antivirus software. I have reinstalled the MSVCR71.dll to both the System32 and SysWOW64 folders

When I try to launch GRASS GIS 6.4.4svn, a command line window flashes very quickly and then nothing.

Do you have any further things I might try? Thanks for your patience and help.

AKD

comment:3 Changed 6 years ago by hamish

Hi,

it sounds like you have most of the runtime redistributables in place, msvcr100.dll is a new one though. When you installed did you tick the box to install "Important Microsoft Redistributable Libraries" on the same page in the installer as the option to download the sample datasets? Even though you probably have most already it might be a good idea to try that anyway.

To see what the error message is you have to stop the window from closing so fast once it exits. Perhaps the easiest way around that is to open a command window (start button then type "cmd" into the search and click in the "C:\>" icon) and from the DOS prompt change into the grass startup directory then run the startup command by hand.

To make this easy right click on the grass desktop icon and copy and paste out the "start from" directory to the terminal with "cd c:\path\goes\here", I think that points to the c:\grass64\msys dir (for you) but I'm not sure it actually matters.

Then cut and paste the actual startup command into the command terminal, and wait to see the error.

Is it still "LOCATION_NAME not set"? (which should be recoverable) Do any of the other grass session menu items work from the grass menu in start menu -> all programs? For example, if you can start from the text based command session, maybe that fixes the broken/missing "grassrc6" last-settings file which remembers the LOCATION_NAME from the previous session. ?

thanks, Hamish

Changed 6 years ago by akdeakin

Attachment: CmdWindowErrors.JPG added

Screenshot of Cmd Line Window following attempt to run grass 64svn

comment:4 Changed 6 years ago by akdeakin

Hamish,

Thank so much for your detailed suggestions. They are much appreciated!

I did re-download and "install" msvcr100.dll. I uninstalled Grass and re-installed it, making sure to tick the box next to Important Microsoft Redistributable Libraries" on the same page in the installer as the option to download the sample datasets.

While I am able to successfully run the Old TclTk? Gui and Command Line options, I'm still unable to run the new GUI option.

From the DOS command line, when I run grass64svn I get 2 instances of ImportError?: cannot import name MAXREPEAT. Both are preceded by calls to the Python27 library. (E.g., File "C:\grass64\Python27\lib\site.py", line 548 in <module> main <>)

So, I upgraded from Python 2.7.4 to 2.7.5, but I'm getting the same response.

Given that I can access Grass through the Old TclTk? Gui, this isn't a priority...I'm just curious, now. ;-)

Thanks, again. I really appreciate your help and your rapid response.

Sincerely, AKD

comment:5 in reply to:  4 Changed 6 years ago by mlennert

Replying to akdeakin:

Hamish,

Thank so much for your detailed suggestions. They are much appreciated!

I did re-download and "install" msvcr100.dll. I uninstalled Grass and re-installed it, making sure to tick the box next to Important Microsoft Redistributable Libraries" on the same page in the installer as the option to download the sample datasets.

While I am able to successfully run the Old TclTk? Gui and Command Line options, I'm still unable to run the new GUI option.

From the DOS command line, when I run grass64svn I get 2 instances of ImportError?: cannot import name MAXREPEAT. Both are preceded by calls to the Python27 library. (E.g., File "C:\grass64\Python27\lib\site.py", line 548 in <module> main <>)

So, I upgraded from Python 2.7.4 to 2.7.5, but I'm getting the same response.

This had happened before and was diagnosed at the time as a Python issue [1], but with version Python < 2.4. Are you sure that the Python used by your GRASS installation is the system wide one ? It might a Python version embedded in QGIS ?

To make sure, if that is possible for you, you might want to try to uninstall all Python installations on your machine + QGIS + GRASS and then reinstall only GRASS from the standalone GRASS installer.

[1] http://lists.osgeo.org/pipermail/grass-user/2013-May/068106.html

comment:6 Changed 6 years ago by helena

For my colleagues this problem appears for GRASS7svn and I believe that also for GRASS64svn. It does not seem to be a problem with GRASS6.4.3RC* installed through Helmut's installer. It appears that ADK has been using the svn snapshots - do you still have this problem if you try the latest GRASS6.4.3RC4 from here? http://grass.osgeo.org/grass64/binary/mswindows/native/

For the record, this is what my colleagues found (which indicates python version conflict with ArcGIS, already discussed on the list): GRASS 7 needs Python 2.7. I have several Python 2.7 installed on my machine, so we started looking at that. Now Richard has found that GRASS 7 works perfectly on Windows 7 and 8 until ArcGIS 10.1 is installed. Then, when ArcGIS 10.1 is installed, GRASS 7 exits immediately upon starting. Actually, if you pause this jing video at 6 seconds, it shows 'importError: cannot import name MAXREPEAT'

http://screencast.com/t/q2kzQbMNP

We have tried, unsuccessfully, the fixes we could find online for the MAXREPEAT error. We were wondering if you could communicate this with the developers to see if they have some ideas about how to tackle this problem.

comment:7 in reply to:  6 Changed 6 years ago by hellik

Replying to helena: [...]

Now Richard has found that GRASS 7 works perfectly on Windows 7 and 8 until ArcGIS 10.1 is installed. Then, when ArcGIS 10.1 is installed, GRASS 7 exits immediately upon starting. Actually, if you pause this jing video at 6 seconds, it shows 'importError: cannot import name MAXREPEAT'

confirmed.

ArcGIS 10.0 used C:\Python26\ArcGIS10.0 ArcGIS 10.1 uses C:\Python27\ArcGIS10.1

WinGRASS (osgeo4w/standalone uses C:\OSGeo4W\apps\Python27)

so no python version interference with ArcGIS 10.0, but then with ArcGIS 10.1. e.g. I'm unable here on my laptop to start WinGRASS7-standalone

it shows 'importError: cannot import name MAXREPEAT'

that's a lib mixing between ArcGIS 10.1-Python27 and WinGRASS-Python27

there is a discussion on the way to solve this.

http://lists.osgeo.org/pipermail/grass-dev/2013-July/065197.html

best regards Helmut

comment:8 in reply to:  6 ; Changed 6 years ago by neteler

Replying to helena: ...

For the record, this is what my colleagues found (which indicates python version conflict with ArcGIS, already discussed on the list): GRASS 7 needs Python 2.7. I have several Python 2.7 installed on my machine, so we started looking at that. Now Richard has found that GRASS 7 works perfectly on Windows 7 and 8 until ArcGIS 10.1 is installed. Then, when ArcGIS 10.1 is installed, GRASS 7 exits immediately upon starting. Actually, if you pause this jing video at 6 seconds, it shows 'importError: cannot import name MAXREPEAT'

Perhaps this helps (http://grasswiki.osgeo.org/wiki/WinGRASS_errors):

Q: Error message "ImportError: cannot import name MAXREPEAT"

A: A system-wide Python installation (2.7.2, independent of GRASS) may cause the trouble. Replacing this system-wide Python installation with version 2.7.4, instead of 2.7.2, solved the problem.

comment:9 in reply to:  8 ; Changed 6 years ago by mlennert

Replying to neteler:

Replying to helena: ...

For the record, this is what my colleagues found (which indicates python version conflict with ArcGIS, already discussed on the list): GRASS 7 needs Python 2.7. I have several Python 2.7 installed on my machine, so we started looking at that. Now Richard has found that GRASS 7 works perfectly on Windows 7 and 8 until ArcGIS 10.1 is installed. Then, when ArcGIS 10.1 is installed, GRASS 7 exits immediately upon starting. Actually, if you pause this jing video at 6 seconds, it shows 'importError: cannot import name MAXREPEAT'

Perhaps this helps (http://grasswiki.osgeo.org/wiki/WinGRASS_errors):

Q: Error message "ImportError: cannot import name MAXREPEAT"

A: A system-wide Python installation (2.7.2, independent of GRASS) may cause the trouble. Replacing this system-wide Python installation with version 2.7.4, instead of 2.7.2, solved the problem.

Could someone check what exact version ArcGIS installs. I suspect < 2.7.4.

Unfortunately, the Python launcher discussed in the thread Helmut points to in comment:7 seems to only take into account minor version numbers, but not revision numbers, so there does not seem to be a way to distinguish between two versions of 2.7 on the machine.

Is it possible to uninstall the python installed by ESRI ?

One option would probably be to delete the registry key entries of the ESRI Python version, install a more recent Python (e.g. 2.7.5) and install the Python launcher.

comment:10 in reply to:  9 ; Changed 6 years ago by hellik

Replying to mlennert:

Could someone check what exact version ArcGIS installs. I suspect < 2.7.4.

have a look at http://trac.osgeo.org/grass/ticket/2015#comment:6

=> it's the system wide python 2.7.2 installed by ArcGIS10.1. 

Unfortunately, the Python launcher discussed in the thread Helmut points to in comment:7 seems to only take into account minor version numbers, but not revision numbers, so there does not seem to be a way to distinguish between two versions of 2.7 on the machine.

see also http://trac.osgeo.org/grass/ticket/2015#comment:6

Is it possible to uninstall the python installed by ESRI ?

only if you deinstall ArcGIS ...

One option would probably be to delete the registry key entries of the ESRI Python version, install a more recent Python (e.g. 2.7.5) and install the Python launcher.

but then ArcGIS is unusable ... ok, it's not open source ... ;o)

comment:11 in reply to:  10 ; Changed 6 years ago by hellik

Replying to hellik:

Unfortunately, the Python launcher discussed in the thread Helmut points to in comment:7 seems to only take into account minor version numbers, but not revision numbers, so there does not seem to be a way to distinguish between two versions of 2.7 on the machine.

see also http://trac.osgeo.org/grass/ticket/2015#comment:6

just forgotten, according to the launcher manual it should be possible.

comment:12 in reply to:  11 Changed 6 years ago by hellik

Replying to hellik:

Replying to hellik:

Unfortunately, the Python launcher discussed in the thread Helmut points to in comment:7 seems to only take into account minor version numbers, but not revision numbers, so there does not seem to be a way to distinguish between two versions of 2.7 on the machine.

see also http://trac.osgeo.org/grass/ticket/2015#comment:6

just forgotten, according to the launcher manual it should be possible.

mmmhhh reading http://docs.python.org/3/using/windows.html#customizing-default-python-versions ... not sure anymore...should be tested

comment:13 in reply to:  10 ; Changed 6 years ago by mlennert

Replying to hellik:

Replying to mlennert:

Could someone check what exact version ArcGIS installs. I suspect < 2.7.4.

have a look at http://trac.osgeo.org/grass/ticket/2015#comment:6

=> it's the system wide python 2.7.2 installed by ArcGIS10.1. 

Unfortunately, the Python launcher discussed in the thread Helmut points to in comment:7 seems to only take into account minor version numbers, but not revision numbers, so there does not seem to be a way to distinguish between two versions of 2.7 on the machine.

see also http://trac.osgeo.org/grass/ticket/2015#comment:6

Is it possible to uninstall the python installed by ESRI ?

only if you deinstall ArcGIS ...

One option would probably be to delete the registry key entries of the ESRI Python version, install a more recent Python (e.g. 2.7.5) and install the Python launcher.

but then ArcGIS is unusable

Is this because of a specific pythonpath they register ?

comment:14 in reply to:  13 Changed 6 years ago by hellik

Replying to mlennert:

Is this because of a specific pythonpath they register ?

some ESRI-additions or custom site-packages

comment:15 Changed 6 years ago by hamish

Keywords: python added

Hi,

AFAIK we use "$GRASS_PYTHON" "$SCRIPT.py" everywhere now, and as long as we didn't miss any, so registry associations with other system Python installations shouldn't matter since python.exe is called with its full path. the trouble might be instead that the order of the PYTHONPATH is picking up the alternate install before the grass install. You might try editing the lines of the python code just before the traceback's line number and add a "print sys.path" to show the path order. Right now we are adding the grass paths to the end of that, may we need to be inserting them at the start of the list instead.

so sys.path.append() -> sys.path.insert(1,) ?

see also : http://stackoverflow.com/questions/10095037/why-use-sys-path-appendpath-instead-of-sys-path-insert1-path

"virtualenv is a tool to create isolated Python environments."

Hamish

comment:16 in reply to:  15 Changed 6 years ago by mlennert

Replying to hamish:

AFAIK we use "$GRASS_PYTHON" "$SCRIPT.py" everywhere now, and as long as we didn't miss any, so registry associations with other system Python installations shouldn't matter since python.exe is called with its full path.

This works for the GUI, but $GRASS_PYTHON is not usable when calling a module from the command line. This is why calling python scripts from the command line does not work in Windows. The same is true for scripts calling scripts.

This is why we started looking into the Python launcher as a solution, and the Python launcher does seem to be using the registry, not only for file association, but also for the definition of PYTHONPATH.

the trouble might be instead that the order of the PYTHONPATH is picking up the alternate install before the grass install. You might try editing the lines of the python code just before the traceback's line number and add a "print sys.path" to show the path order. Right now we are adding the grass paths to the end of that, may we need to be inserting them at the start of the list instead.

In my installation, when I try echo %PYTHONPATH% on the command line, I get the GRASS paths at the beginning.

so sys.path.append() -> sys.path.insert(1,) ?

see also : http://stackoverflow.com/questions/10095037/why-use-sys-path-appendpath-instead-of-sys-path-insert1-path

"virtualenv is a tool to create isolated Python environments."

;-) http://lists.osgeo.org/pipermail/grass-dev/2013-July/065212.html

comment:17 Changed 6 years ago by annakrat

The discussion continued in another ticket (#1941). It seems that Martin solved the MAXREPEAT problem (do we need to test more?). It's not clear to me if the original problem in description is also solved?

comment:18 in reply to:  17 ; Changed 6 years ago by annakrat

Replying to annakrat:

The discussion continued in another ticket (#1941). It seems that Martin solved the MAXREPEAT problem (do we need to test more?). It's not clear to me if the original problem in description is also solved?

So there is another MAXREPEAT problem. When you run g.extension wrapper or in python console:

grass.read_command('g.extension.py', flags='l')

you get nothing because of the MAXREPEAT error. But at least you can still install extension through the the module dialog and command line.

comment:19 in reply to:  18 Changed 6 years ago by annakrat

Replying to annakrat:

Replying to annakrat:

The discussion continued in another ticket (#1941). It seems that Martin solved the MAXREPEAT problem (do we need to test more?). It's not clear to me if the original problem in description is also solved?

So there is another MAXREPEAT problem. When you run g.extension wrapper or in python console:

grass.read_command('g.extension.py', flags='l')

you get nothing because of the MAXREPEAT error. But at least you can still install extension through the the module dialog and command line.

This applies to both standalone and OSGeo4W.

comment:20 Changed 5 years ago by hamish

Summary: Startup ErrorStartup Error: G_getenv(): Variable LOCATION_NAME not set

comment:21 Changed 3 years ago by neteler

Milestone: 6.4.46.4.6

comment:22 Changed 14 months ago by wenzeslaus

Keywords: MAXREPEAT DLL msvcr added
Resolution: fixed
Status: newclosed

The original report might be a duplicate of #613 or #1286 or it is some other issue likely fixed or not applicable in 7.x. The discussion became a place for other startup errors, namely MAXREPEAT and missing DLLs which are now fixed, so closing as fixed.

Note: See TracTickets for help on using tickets.