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
Try running it in the console of grass. It should have the correct paths and python available, and it would install at the right place. We aren’t using the system python.
Otherwise, assuming it is installed through the osgeo4w installer, some Python packages can be installed there, but there is only one version available for each, which isn’t always the latest, but might work. Otherwise, through the OSGeo4w shell, you could install inside the pip used for all osgeo4w software.
Maybe the pip needs to be installed separately if it isn’t there yet.
Si kit learn is available at version 1.4.2, and pip is at 24.0.
It’s probably safer for a student to install through the osgeo4w installer, to survive upgrades, and it will help make sure all versions of packages installed will work together across the softwares.
Thanks Edouard. The console cannot find pip on Windows. And it cannot find it on my Mac either, even though the terminal can.
Does an osgeo4w installation provide paths within GRASS to utilities like pip? I’ve had some students have problems with the complexity of this installer.
I’ve also encountered this on Windows and have found ways to use pip both through osgeo4w and through the standalone installer. Drawing from some tutorials I wrote for a class a while ago (this one and this one) for installing the python dependencies of grass.jupyter, there are two ideas that might help:
With the standalone, make sure they are running GRASS as an administrator. Otherwise, it will install on the system version of Python instead of the GRASS-installed version.
From the terminal window, try “python -m pip install {packagename}” which, I think, helps specify to use the GRASS version of pip/Python.
Thanks Edouard. The console cannot find pip on Windows. And it cannot find it on my Mac either, even though the terminal can.
Does an osgeo4w installation provide paths within GRASS to utilities like pip? I’ve had some students have problems with the complexity of this installer.