[GRASS-user] g.extension - ERROR: G_getenv(): Variable LOCATION_NAME not set

Not sure if I should be sending this to the mail list or reporting it
as a bug? Seems I am doing everything right, but I still have a lot
to learn. I hope I am missing something easy???

I want to add some extensions for all users on a shared virtual
machine (Gnome, Debian, GRASS 6.4.2RC3 (2012) ). I have run gksudo
'grass64 -gui' and used the GUI for g.extension to install an
extension system wide. Below is the error I received. I checked the
environment settings, and the variable LOCATION_NAME is set.

I then tried the Download Source option -it did download the
i.landsat.toar file, but neither of the listed commands in the output
would work. (The second set of output for this attempt.)

If there isn't a quick answer, would it be easier to just run from
source with GRASS 7? We are currently all logging into the same
virtual machine, so the admin efficiency of being able to deploy a
package isn't a big issue.

Any suggestions? Thanks,
Eric

{{{
(Mon Feb 6 15:32:52 2012)
g.extension.py extension=i.landsat.toar
svnurl=http://svn.osgeo.org/grass/grass-addons/grass6
Fetching <i.landsat.toar> from GRASS-Addons SVN (be patient)...
Compiling...
/usr/local/grass-6.4.2RC3/include/Make/Module.make:25:
warning: overriding commands for target `install'
/usr/local/grass-6.4.2RC3/include/Make/Rules.make:90:
warning: ignoring old commands for target `install'
/usr/local/grass-6.4.2RC3/include/Make/Module.make:25:
warning: overriding commands for target `install'
/usr/local/grass-6.4.2RC3/include/Make/Rules.make:90:
warning: ignoring old commands for target `install'
/usr/local/grass-6.4.2RC3/include/Make/Module.make:25:
warning: overriding commands for target `install'
/usr/local/grass-6.4.2RC3/include/Make/Rules.make:90:
warning: ignoring old commands for target `install'

ERROR: G_getenv(): Variable LOCATION_NAME not set

/usr/local/grass-6.4.2RC3/include/Make/Module.make:25:
warning: overriding commands for target `install'
/usr/local/grass-6.4.2RC3/include/Make/Rules.make:90:
warning: ignoring old commands for target `install'
/usr/local/grass-6.4.2RC3/include/Make/Module.make:25:
warning: overriding commands for target `install'
/usr/local/grass-6.4.2RC3/include/Make/Rules.make:90:
warning: ignoring old commands for target `install'
make[2]: *** [/home/emomsen/GRASSDATA/gksudoLoc/gkMap/.tmp/g
isdev/1894.0/i.landsat.toar/man/man1/i.landsat.toar.1] Error
127
make[1]: *** [mancmd] Error 2
make: *** [cmd] Error 2
ERROR: Compilation failed, sorry. Please check above error messages.
(Mon Feb 6 15:32:55 2012) Command finished (2 sec)
(Mon Feb 6 15:33:20 2012)

g.gisenv -n
GISDBASE=/home/emomsen/GRASSDATA
LOCATION_NAME=gksudoLoc
MAPSET=gkMap
GRASS_GUI=wxpython
(Mon Feb 6 15:33:20 2012) Command finished (0 sec)
}}}

{{{
emomsen@gisdev:~$ sudo make MODULE_TOPDIR=/usr/local/grass-6.4.2RC3
ARCH_DISTDIR=/home/emomsen/GRASSDATA/gksudoLoc/gkMap/.tmp/gisdev/10530.0/i.landsat.toar
INST_DIR=/root/.grass6/addons install
[sudo] password for emomsen:
make: *** No rule to make target `install'. Stop.

emomsen@gisdev:~$ cd GRASSDATA/gksudoLoc/gkMap/.tmp/gisdev/10530.0
emomsen@gisdev:~/GRASSDATA/gksudoLoc/gkMap/.tmp/gisdev/10530.0$ ls
i.landsat.toar

emomsen@gisdev:~/GRASSDATA/gksudoLoc/gkMap/.tmp/gisdev/10530.0$ sudo
make MODULE_TOPDIR=/usr/local/grass-6.4.2RC3
BIN=/home/emomsen/GRASSDATA/gksudoLoc/gkMap/.tmp/gisdev/10530.0/i.landsat.toar/bin
HTMLDIR=/home/emomsen/GRASSDATA/gksudoLoc/gkMap/.tmp/gisdev/10530.0/i.landsat.toar/docs/html
MANDIR=/home/emomsen/GRASSDATA/gksudoLoc/gkMap/.tmp/gisdev/10530.0/i.landsat.toar/man/man1
SCRIPTDIR=/home/emomsen/GRASSDATA/gksudoLoc/gkMap/.tmp/gisdev/10530.0/i.landsat.toar/scripts
ETC=/home/emomsen/GRASSDATA/gksudoLoc/gkMap/.tmp/gisdev/10530.0/i.landsat.toar/etc/i.landsat.toar
make: *** No targets specified and no makefile found. Stop.
}}}

Eric wrote:

Not sure if I should be sending this to the mail list or
reporting it as a bug? Seems I am doing everything right,
but I still have a lot to learn. I hope I am missing something
easy???

usually a bug report would be good, but g.extension is still
a work in progress, so the mailing list is fine too.

I want to add some extensions for all users on a shared
virtual machine (Gnome, Debian, GRASS 6.4.2RC3 (2012) ).
I have run gksudo 'grass64 -gui'

I would hesitate to run GRASS as root. You might make it the
owner of some files or a mapset which belongs to a regular user.
(maybe set up an admin account to look after the PERMANENT mapset
in a multi-user location?)

and used the GUI for g.extension to install an
extension system wide. Below is the error I
received.

simple work-around first: run g.extension as your regular user
and then sudo copy the resulting binary from $GRASS_ADDON_PATH
into $GISBASE/bin/. done! (make sure it is chmod a+rx)

I checked the environment settings, and the
variable LOCATION_NAME is set.

I then tried the Download Source option -it did download the
i.landsat.toar file,

(note i.landsat.toar is now in the grass 6.5 source code too)

but neither of the listed commands in
the output would work. (The second set of output for this
attempt.)

If there isn't a quick answer, would it be easier to just
run from source with GRASS 7?

note i.landsat.toar is present in grass 6.5svn too.
(and don't use trunk for work that really matters; it's
experimental)

We are currently all logging into the same virtual machine,
so the admin efficiency of being able to deploy a package
isn't a big issue.

Any suggestions? Thanks,

try g.extension from the command prompt, it's a different version
than the one which runs from the GUI. Specifically it has a -s
flag to install system-wide (same as the GUI version), but also
a -u flag to install system-wide using sudo for the install step. AFAIK these are not terribly well tested so any feedback would
be appreciated.

ERROR: G_getenv(): Variable LOCATION_NAME not set

this generally happens because it didn't think you were in grass
at the time.

if you installed from .deb packages, make sure the grass-dev
package is installed too.

if you installed from source you can copy the i.landsat.toar
source code dir into the imagery/ dir in the grass source code,
then run "make" from in there.

Hamish

Thanks Hamish for these answers and suggestions. In the meantime we did end up installing version 7, so I haven’t had a chance to test it on 6.4 yet.

I was only running as root for installing the extension - I did create a new mapset just to start grass since the root account didn’t have access to any of the other mapsets. I hope this is OK.

Regarding version 7: is the issue stability, that sometimes it won’t work at all? I am a graduate student, so down time is not critical. But if experimental means the calculations could be incorrect, I guess that would be more important. One of the other students is pushing for version 7 since they like the new features.

Should spgrass work with version 7? I saw comments in the mail archive from over a year ago that GRASS ↔ R was much better in version 6 compared to version 7, is the situation improved now? (It didn’t work when I first tried it, but I have not taken time to check the details yet…)

-Eric

On Wed, Feb 8, 2012 at 12:52 AM, Hamish <hamish_b@yahoo.com> wrote:

Eric wrote:

Not sure if I should be sending this to the mail list or
reporting it as a bug? Seems I am doing everything right,
but I still have a lot to learn. I hope I am missing something
easy???

usually a bug report would be good, but g.extension is still
a work in progress, so the mailing list is fine too.

I want to add some extensions for all users on a shared
virtual machine (Gnome, Debian, GRASS 6.4.2RC3 (2012) ).
I have run gksudo ‘grass64 -gui’

I would hesitate to run GRASS as root. You might make it the
owner of some files or a mapset which belongs to a regular user.
(maybe set up an admin account to look after the PERMANENT mapset
in a multi-user location?)

and used the GUI for g.extension to install an
extension system wide. Below is the error I
received.

simple work-around first: run g.extension as your regular user
and then sudo copy the resulting binary from $GRASS_ADDON_PATH
into $GISBASE/bin/. done! (make sure it is chmod a+rx)

I checked the environment settings, and the
variable LOCATION_NAME is set.

I then tried the Download Source option -it did download the
i.landsat.toar file,

(note i.landsat.toar is now in the grass 6.5 source code too)

but neither of the listed commands in
the output would work. (The second set of output for this
attempt.)

If there isn’t a quick answer, would it be easier to just
run from source with GRASS 7?

note i.landsat.toar is present in grass 6.5svn too.
(and don’t use trunk for work that really matters; it’s
experimental)

We are currently all logging into the same virtual machine,
so the admin efficiency of being able to deploy a package
isn’t a big issue.

Any suggestions? Thanks,

try g.extension from the command prompt, it’s a different version
than the one which runs from the GUI. Specifically it has a -s
flag to install system-wide (same as the GUI version), but also
a -u flag to install system-wide using sudo for the install step. AFAIK these are not terribly well tested so any feedback would
be appreciated.

ERROR: G_getenv(): Variable LOCATION_NAME not set

this generally happens because it didn’t think you were in grass
at the time.

if you installed from .deb packages, make sure the grass-dev
package is installed too.

if you installed from source you can copy the i.landsat.toar
source code dir into the imagery/ dir in the grass source code,
then run “make” from in there.

Hamish