[GRASS-user] Trying to use GRASS with Jupyter note books in Windows

Vishal Mehta vishalm1975 at gmail.com
Fri Sep 29 15:33:41 PDT 2023


Thanks Markus,
I installed bash kernel; and it seems that it is there (#lsmagic lists bash
as one of the cell magics)

but I get the error below:

##bash
g.list type=rast

---------------------------------------------------------------------------CalledProcessError
                       Traceback (most recent call last)
Cell In[20], line 1----> 1 get_ipython().run_cell_magic('bash', '',
'g.list rast\n')

File C:\GRASS GIS
8.3\Python39\lib\site-packages\IPython\core\interactiveshell.py:2493,
in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
2491 with self.builtin_trap:   2492     args = (magic_arg_s, cell)->
2493     result = fn(*args, **kwargs)   2495 # The code below prevents
the output from being displayed   2496 # when using magics with
decorator @output_can_be_silenced   2497 # when the last Python token
in the expression is a ';'.   2498 if getattr(fn,
magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File C:\GRASS GIS
8.3\Python39\lib\site-packages\IPython\core\magics\script.py:154, in
ScriptMagics._make_script_magic.<locals>.named_script_magic(line,
cell)    152 else:    153     line = script--> 154 return
self.shebang(line, cell)

File C:\GRASS GIS
8.3\Python39\lib\site-packages\IPython\core\magics\script.py:314, in
ScriptMagics.shebang(self, line, cell)    309 if args.raise_error and
p.returncode != 0:    310     # If we get here and p.returncode is
still None, we must have    311     # killed it but not yet seen its
return code. We don't wait for it,    312     # in case it's stuck in
uninterruptible sleep. -9 = SIGKILL    313     rc = p.returncode or
-9--> 314     raise CalledProcessError(rc, cell)
CalledProcessError: Command 'b'g.list rast\n'' returned non-zero exit
status 127.

--


Also I am unable to install extensions r.stream.distance:

!g.extension r.stream.distance

as well as through the GUI


both give me a "cannot find executable git" error


Best,

Vishal



On Fri, Sep 29, 2023 at 11:53 AM Markus Neteler <neteler at osgeo.org> wrote:

> On Thu, Sep 28, 2023 at 10:09 PM Vishal Mehta <vishalm1975 at gmail.com>
> wrote:
> >
> > Thanks Markus and Vaclav,
> >
> > This is what worked for me on Windows:
> > # Ask GRASS GIS where its Python packages are.
> > sys.path.append(
> >     subprocess.check_output(["C:\GRASS GIS 8.3/grass83.bat", "--config",
> "python_path"], text=True).strip()
> > )
>
> Perfect, added to the Wiki page, too.
>
> > Also, can I use bash within the jupyter notebook?
>
> Seems yes, after:
>
> pip install bash_kernel
>
> Markus
>


-- 
Vishal K. Mehta, PhD
Sr. Scientist
Stockholm Environment Institute - US
501 D St
Davis CA 95616
https://www.sei.org/people/vishal-mehta/ <http://www.sei-us.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20230929/4aa53a33/attachment.htm>


More information about the grass-user mailing list