<div dir="ltr"><div class="gmail_quote"><div>Hi </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> > The model I need to use (which I did not write) requires python 2.7.<br>
> > I had tried pip install previously but then it still fails with ImportError: No module named grass.script.<br>
> > Do you know what could be causing that?<br>
<br>
Interestingly, our docker containers just started to suffer from a<br>
similar (same?) problem:<br>
<br>
File "/scripts/test_grass_session.py", line 3, in <module><br>
import grass.script as grass<br>
ModuleNotFoundError: No module named 'grass'<br>
<br>
Weird, we need to investigate.<br></blockquote><div><br></div><div>Grass_session works for me with both python2.7 and 3 in a Osgeo environment with grass 7.8.3</div><div>For me, the import modules work in this order in both python versions after pip installation.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><i>>>> import grass_session<br>>>> from grass_session import Session</i></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><i>>>> import grass.script as grass</i></blockquote><div><br></div><div>For the final script to work, you will have to set environment variables, GISBIN (grass78 root folder) , GISRC (.grassrc78 file in demo location) and add grass78 'lib', 'bin' and 'scripts' folders to PATH variable.</div><div><div>I run the script in python 3, where it worked without setting GISBIN and GISRC variables. I have only tested this approach in Windows 10 yet, and should work fine in Linux as well.</div></div><div><br></div><div>Regards</div><div><br></div><div>Sajid</div><div><br></div><div><br></div></div></div>