<div dir="ltr"><div>Hi Vishal,</div><div><br></div><div>The executable on Windows is not called "grass" like on Linux but "grass8" or "grass83" (to avoid a strange Python import error). That should do the trick. If not, try simply providing a full path yourself including the extension (C:\...\...bat).</div><div><br></div><div>Best,</div><div>Vaclav<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 27 Sept 2023 at 21:20, Vishal Mehta via grass-user <<a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I'm trying to follow this setup:<div><a href="https://github.com/ncsu-geoforall-lab/GIS714-assignments/blob/main/GRASS_GIS_Foundations/JupyterOnWindows_Tutorial.ipynb" target="_blank">https://github.com/ncsu-geoforall-lab/GIS714-assignments/blob/main/GRASS_GIS_Foundations/JupyterOnWindows_Tutorial.ipynb</a><br></div><div><br></div><div>I have stand-alone GRASS GIS 8.3 installed in Windows in C:\GRASS GIS 8.3</div><div><br></div><div>I followed the 7 setup steps (changing set path to reflect that its installed in C:\GRASS GIS 8.3</div><div>Then when i run this first part:</div><div><br></div><div>import os<br>import subprocess<br>import sys<br><br># Ask GRASS GIS where its Python packages are.<br>sys.path.append(<br> subprocess.check_output(["grass", "--config", "python_path"], text=True).strip()<br>)<br><br># Import GRASS packages<br>import grass.script as gs<br>import grass.jupyter as gj<br></div><div>--</div><div>I get the following error:</div><div><pre style="font-size:13px;color:rgba(0,0,0,0.87);border:medium;margin-top:0px;margin-bottom:0px;padding:0px;overflow:auto;word-break:break-all"><span style="color:rgb(178,43,49);font-weight:bold">---------------------------------------------------------------------------</span>
<span style="color:rgb(178,43,49);font-weight:bold">FileNotFoundError</span> Traceback (most recent call last)
Cell <span style="color:rgb(0,116,39);font-weight:bold">In[1], line 7</span>
<span style="color:rgb(0,162,80)"> 3</span> <span style="font-weight:bold;color:rgb(0,135,0)">import</span> <span style="font-weight:bold;color:rgb(0,0,255)">sys</span>
<span style="color:rgb(0,162,80)"> 5</span> <span style="color:rgb(95,135,135)"># Ask GRASS GIS where its Python packages are.</span>
<span style="color:rgb(0,162,80)"> 6</span> sys<span style="color:rgb(98,98,98)">.</span>path<span style="color:rgb(98,98,98)">.</span>append(
<span style="color:rgb(0,116,39);font-weight:bold">----> 7</span> <span style="background-color:rgb(221,182,43)">subprocess</span><span style="background-color:rgb(221,182,43);color:rgb(98,98,98)">.</span><span style="background-color:rgb(221,182,43)">check_output</span><span style="background-color:rgb(221,182,43)">(</span><span style="background-color:rgb(221,182,43)">[</span><span style="background-color:rgb(221,182,43);color:rgb(175,0,0)">"</span><span style="background-color:rgb(221,182,43);color:rgb(175,0,0)">grass</span><span style="background-color:rgb(221,182,43);color:rgb(175,0,0)">"</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43);color:rgb(175,0,0)">"</span><span style="background-color:rgb(221,182,43);color:rgb(175,0,0)">--config</span><span style="background-color:rgb(221,182,43);color:rgb(175,0,0)">"</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43);color:rgb(175,0,0)">"</span><span style="background-color:rgb(221,182,43);color:rgb(175,0,0)">python_path</span><span style="background-color:rgb(221,182,43);color:rgb(175,0,0)">"</span><span style="background-color:rgb(221,182,43)">]</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">text</span><span style="background-color:rgb(221,182,43);color:rgb(98,98,98)">=</span><span style="background-color:rgb(221,182,43);font-weight:bold;color:rgb(0,135,0)">True</span><span style="background-color:rgb(221,182,43)">)</span><span style="color:rgb(98,98,98)">.</span>strip()
<span style="color:rgb(0,162,80)"> 8</span> )
<span style="color:rgb(0,162,80)"> 10</span> <span style="color:rgb(95,135,135)"># Import GRASS packages</span>
<span style="color:rgb(0,162,80)"> 11</span> <span style="font-weight:bold;color:rgb(0,135,0)">import</span> <span style="font-weight:bold;color:rgb(0,0,255)">grass</span><span style="font-weight:bold;color:rgb(0,0,255)">.</span><span style="font-weight:bold;color:rgb(0,0,255)">script</span> <span style="font-weight:bold;color:rgb(0,135,0)">as</span> <span style="font-weight:bold;color:rgb(0,0,255)">gs</span>
File <span style="color:rgb(0,116,39);font-weight:bold">C:\GRASS GIS 8.3\Python39\lib\subprocess.py:424</span>, in <span style="color:rgb(96,198,200)">check_output</span><span style="color:rgb(0,101,202);font-weight:bold">(timeout, *popenargs, **kwargs)</span>
<span style="color:rgb(0,162,80)"> 421</span> empty <span style="color:rgb(98,98,98)">=</span> <span style="color:rgb(175,0,0)">b</span><span style="color:rgb(175,0,0)">'</span><span style="color:rgb(175,0,0)">'</span>
<span style="color:rgb(0,162,80)"> 422</span> kwargs[<span style="color:rgb(175,0,0)">'</span><span style="color:rgb(175,0,0)">input</span><span style="color:rgb(175,0,0)">'</span>] <span style="color:rgb(98,98,98)">=</span> empty
<span style="color:rgb(0,116,39);font-weight:bold">--> 424</span> <span style="font-weight:bold;color:rgb(0,135,0)">return</span> run(<span style="color:rgb(98,98,98)">*</span>popenargs, stdout<span style="color:rgb(98,98,98)">=</span>PIPE, timeout<span style="color:rgb(98,98,98)">=</span>timeout, check<span style="color:rgb(98,98,98)">=</span><span style="font-weight:bold;color:rgb(0,135,0)">True</span>,
<span style="color:rgb(0,162,80)"> 425</span> <span style="color:rgb(98,98,98)">*</span><span style="color:rgb(98,98,98)">*</span>kwargs)<span style="color:rgb(98,98,98)">.</span>stdout
File <span style="color:rgb(0,116,39);font-weight:bold">C:\GRASS GIS 8.3\Python39\lib\subprocess.py:505</span>, in <span style="color:rgb(96,198,200)">run</span><span style="color:rgb(0,101,202);font-weight:bold">(input, capture_output, timeout, check, *popenargs, **kwargs)</span>
<span style="color:rgb(0,162,80)"> 502</span> kwargs[<span style="color:rgb(175,0,0)">'</span><span style="color:rgb(175,0,0)">stdout</span><span style="color:rgb(175,0,0)">'</span>] <span style="color:rgb(98,98,98)">=</span> PIPE
<span style="color:rgb(0,162,80)"> 503</span> kwargs[<span style="color:rgb(175,0,0)">'</span><span style="color:rgb(175,0,0)">stderr</span><span style="color:rgb(175,0,0)">'</span>] <span style="color:rgb(98,98,98)">=</span> PIPE
<span style="color:rgb(0,116,39);font-weight:bold">--> 505</span> <span style="font-weight:bold;color:rgb(0,135,0)">with</span> Popen(<span style="color:rgb(98,98,98)">*</span>popenargs, <span style="color:rgb(98,98,98)">*</span><span style="color:rgb(98,98,98)">*</span>kwargs) <span style="font-weight:bold;color:rgb(0,135,0)">as</span> process:
<span style="color:rgb(0,162,80)"> 506</span> <span style="font-weight:bold;color:rgb(0,135,0)">try</span>:
<span style="color:rgb(0,162,80)"> 507</span> stdout, stderr <span style="color:rgb(98,98,98)">=</span> process<span style="color:rgb(98,98,98)">.</span>communicate(<span style="color:rgb(0,135,0)">input</span>, timeout<span style="color:rgb(98,98,98)">=</span>timeout)
File <span style="color:rgb(0,116,39);font-weight:bold">C:\GRASS GIS 8.3\Python39\lib\subprocess.py:951</span>, in <span style="color:rgb(96,198,200)">Popen.__init__</span><span style="color:rgb(0,101,202);font-weight:bold">(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask)</span>
<span style="color:rgb(0,162,80)"> 947</span> <span style="font-weight:bold;color:rgb(0,135,0)">if</span> <span style="color:rgb(0,135,0)">self</span><span style="color:rgb(98,98,98)">.</span>text_mode:
<span style="color:rgb(0,162,80)"> 948</span> <span style="color:rgb(0,135,0)">self</span><span style="color:rgb(98,98,98)">.</span>stderr <span style="color:rgb(98,98,98)">=</span> io<span style="color:rgb(98,98,98)">.</span>TextIOWrapper(<span style="color:rgb(0,135,0)">self</span><span style="color:rgb(98,98,98)">.</span>stderr,
<span style="color:rgb(0,162,80)"> 949</span> encoding<span style="color:rgb(98,98,98)">=</span>encoding, errors<span style="color:rgb(98,98,98)">=</span>errors)
<span style="color:rgb(0,116,39);font-weight:bold">--> 951</span> <span style="background-color:rgb(221,182,43);color:rgb(0,135,0)">self</span><span style="background-color:rgb(221,182,43);color:rgb(98,98,98)">.</span><span style="background-color:rgb(221,182,43)">_execute_child</span><span style="background-color:rgb(221,182,43)">(</span><span style="background-color:rgb(221,182,43)">args</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">executable</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">preexec_fn</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">close_fds</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 952</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">pass_fds</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">cwd</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">env</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 953</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">startupinfo</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">creationflags</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">shell</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 954</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">p2cread</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">p2cwrite</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 955</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">c2pread</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">c2pwrite</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 956</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">errread</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">errwrite</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 957</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">restore_signals</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 958</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">gid</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">gids</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">uid</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">umask</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 959</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">start_new_session</span><span style="background-color:rgb(221,182,43)">)</span>
<span style="color:rgb(0,162,80)"> 960</span> <span style="font-weight:bold;color:rgb(0,135,0)">except</span>:
<span style="color:rgb(0,162,80)"> 961</span> <span style="color:rgb(95,135,135)"># Cleanup if the child failed starting.</span>
<span style="color:rgb(0,162,80)"> 962</span> <span style="font-weight:bold;color:rgb(0,135,0)">for</span> f <span style="font-weight:bold;color:rgb(175,0,255)">in</span> <span style="color:rgb(0,135,0)">filter</span>(<span style="font-weight:bold;color:rgb(0,135,0)">None</span>, (<span style="color:rgb(0,135,0)">self</span><span style="color:rgb(98,98,98)">.</span>stdin, <span style="color:rgb(0,135,0)">self</span><span style="color:rgb(98,98,98)">.</span>stdout, <span style="color:rgb(0,135,0)">self</span><span style="color:rgb(98,98,98)">.</span>stderr)):
File <span style="color:rgb(0,116,39);font-weight:bold">C:\GRASS GIS 8.3\Python39\lib\subprocess.py:1420</span>, in <span style="color:rgb(96,198,200)">Popen._execute_child</span><span style="color:rgb(0,101,202);font-weight:bold">(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session)</span>
<span style="color:rgb(0,162,80)"> 1418</span> <span style="color:rgb(95,135,135)"># Start the process</span>
<span style="color:rgb(0,162,80)"> 1419</span> <span style="font-weight:bold;color:rgb(0,135,0)">try</span>:
<span style="color:rgb(0,116,39);font-weight:bold">-> 1420</span> hp, ht, pid, tid <span style="color:rgb(98,98,98)">=</span> <span style="background-color:rgb(221,182,43)">_winapi</span><span style="background-color:rgb(221,182,43);color:rgb(98,98,98)">.</span><span style="background-color:rgb(221,182,43)">CreateProcess</span><span style="background-color:rgb(221,182,43)">(</span><span style="background-color:rgb(221,182,43)">executable</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">args</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 1421</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43);color:rgb(95,135,135)"># no special security</span>
<span style="color:rgb(0,162,80)"> 1422</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43);font-weight:bold;color:rgb(0,135,0)">None</span><span style="background-color:rgb(221,182,43)">,</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43);font-weight:bold;color:rgb(0,135,0)">None</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 1423</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43);color:rgb(0,135,0)">int</span><span style="background-color:rgb(221,182,43)">(</span><span style="background-color:rgb(221,182,43);font-weight:bold;color:rgb(175,0,255)">not</span><span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">close_fds</span><span style="background-color:rgb(221,182,43)">)</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 1424</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">creationflags</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 1425</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">env</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 1426</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">cwd</span><span style="background-color:rgb(221,182,43)">,</span>
<span style="color:rgb(0,162,80)"> 1427</span> <span style="background-color:rgb(221,182,43)"> </span><span style="background-color:rgb(221,182,43)">startupinfo</span><span style="background-color:rgb(221,182,43)">)</span>
<span style="color:rgb(0,162,80)"> 1428</span> <span style="font-weight:bold;color:rgb(0,135,0)">finally</span>:
<span style="color:rgb(0,162,80)"> 1429</span> <span style="color:rgb(95,135,135)"># Child is launched. Close the parent's copy of those pipe</span>
<span style="color:rgb(0,162,80)"> 1430</span> <span style="color:rgb(95,135,135)"># handles that only the child should have open. You need</span>
<span style="color:rgb(0,116,39);font-weight:bold"> (...)</span>
<span style="color:rgb(0,162,80)"> 1433</span> <span style="color:rgb(95,135,135)"># pipe will not close when the child process exits and the</span>
<span style="color:rgb(0,162,80)"> 1434</span> <span style="color:rgb(95,135,135)"># ReadFile will hang.</span>
<span style="color:rgb(0,162,80)"> 1435</span> <span style="color:rgb(0,135,0)">self</span><span style="color:rgb(98,98,98)">.</span>_close_pipe_fds(p2cread, p2cwrite,
<span style="color:rgb(0,162,80)"> 1436</span> c2pread, c2pwrite,
<span style="color:rgb(0,162,80)"> 1437</span> errread, errwrite)
<span style="color:rgb(178,43,49);font-weight:bold">FileNotFoundError</span>: [WinError 2] The system cannot find the file specified</pre></div><div><br></div><div>Can someone help figure out what the issue is?</div><div>Thanks,</div><div>Vishal</div></div>
_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
</blockquote></div>