[GRASS-user] Python in GRASS on Windows

I have a student who is interested in using some of the modeling tools available in GRASS extensions. These require some Python tools (e.g., scikit-learn) to be installed in her GRASS environments.

For me (on a Mac), I can just pip install -U scikit-learn from the GRASS terminal. But when she does this, the Windows terminal can’t find pip. This seems to be just a path problem but I don’t know how to troubleshoot it on Windows. She has installed Python via Anaconda and can use Python in GRASS via the Python console, but this does not seem to help in this case (conda can’t be found from the GRASS Windows terminal). Can someone point us to a guide of how to install Python packages into the GRASS environment on Windows and/or adjust the path so that the Windows terminal can access Python utilities?

Thanks
Michael


C. Michael Barton
Associate Director, School of Complex Adaptive Systems (https://scas.asu.edu)
Professor, School of Human Evolution & Social Change (https://shesc.asu.edu)
Director, Center for Social Dynamics & Complexity (https://complexity.asu.edu)
Arizona State University
Tempe, AZ 85287-2701
USA

Executive Director, Open Modeling Foundation (https://openmodelingfoundation.github.io)
Director, Network for Computational Modeling in Social & Ecological Sciences (https://comses.net)

personal website: http://www.public.asu.edu/~cmbarton

Hi Michael,

I managed to install python packages in windows and use them from grass using uv. I installed uv in the PowerShell following the documentation, and then installed the tool I need (in this case itzi) with uv tool install. Then it could run from the grass terminal. I guess this would work from a python script too.

uv does install the packages in their own environment, so you might need to do some work to set up grass from within, but it is worth a try.