[GRASS-user] Pandas installation in GRASS GIS environment

dheerajchand.com dheeraj at dheerajchand.com
Mon Dec 20 10:04:20 PST 2021


Here's what I'm seeing in the GRASS that I just installed from the same installer.  The commands at the terminal show me:

1. The location of the python being executed
2. The location of the pip being executed
3. Which error happens when I try to install pandas
4. Changing the shell to zsh
5. Checking whether that changed the python available
6. Error when I try to install pandas

As I suspected, the application Python is not able to use pip install to install pandas.  The next step is to determine how to 

1) change the Python that builds with GRASS
2) give that Python access to the system framework libraries that allow things to build

If it's feasible, the easiest way to use OSGEO things on Mac is with Docker containers. Does that help at all?

Dheeraj


GRASS 7.8.6 (test):~ > which python
/Applications/GRASS-7.8.app/Contents/Resources/bin/python
GRASS 7.8.6 (test):~ > which pip
/Applications/GRASS-7.8.app/Contents/Resources/bin/pip
GRASS 7.8.6 (test):~ > pip install pandas
/Applications/GRASS-7.8.app/Contents/Resources/bin/pip: line 4: import: command not found
/Applications/GRASS-7.8.app/Contents/Resources/bin/pip: line 5: import: command not found
from: can't read /var/mail/pip._internal.cli.main
/Applications/GRASS-7.8.app/Contents/Resources/bin/pip: line 10: syntax error near unexpected token `('
/Applications/GRASS-7.8.app/Contents/Resources/bin/pip: line 10: `    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])'
GRASS 7.8.6 (test):~ > echo $SHELL
/bin/bash
GRASS 7.8.6 (test):~ > chsh -s /usr/local/bin/zsh
Changing shell for dheerajchand.
Password for dheerajchand: 
chsh: Credentials could not be verified, username or password is invalid.  Credentials could not be verified, username or password is invalid.
GRASS 7.8.6 (test):~ > chsh -s /usr/local/bin/zsh
Changing shell for dheerajchand.
Password for dheerajchand: 
chsh: /usr/local/bin/zsh: non-standard shell
GRASS 7.8.6 (test):~ > which python
/Applications/GRASS-7.8.app/Contents/Resources/bin/python
GRASS 7.8.6 (test):~ > pip install pandas
/Applications/GRASS-7.8.app/Contents/Resources/bin/pip: line 4: import: command not found
/Applications/GRASS-7.8.app/Contents/Resources/bin/pip: line 5: import: command not found
from: can't read /var/mail/pip._internal.cli.main
/Applications/GRASS-7.8.app/Contents/Resources/bin/pip: line 10: syntax error near unexpected token `('
/Applications/GRASS-7.8.app/Contents/Resources/bin/pip: line 10: `    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])'
GRASS 7.8.6 (test):~ > 

> On Dec 20, 2021, at 8:20 AM, Dheeraj Chand <dheeraj at dheerajchand.com> wrote:
> 
> Let me try this when I get to my desk. My suspicion is that the Python that GRASS is using does not have Pandas and that the path inside the self-contained binary’s terminal does not easily give you access to the foundation libraries you’ll need to install it. 
> 
> Let me check and let you know. 
> 
> Sent from my iPhone
> 
>> On Dec 20, 2021, at 7:57 AM, Gioia Blayer <gioia.blayer at mail.huji.ac.il> wrote:
>> 
>> 
>> Thank you all for the reply and help,
>> 
>> Veronica - I tried according to the link sent but unfortunately it still doesn't work.
>> 
>> Dheeraj - I downloaded GRASS GIS 7.8.6 from the link on the website https://grass.osgeo.org/download/mac/ <https://grass.osgeo.org/download/mac/> and followed the instructions given. Is this what you meant?
>> 
>> Overall I am able to install Add-ons, it's just with the add-ons that depend on python packages (like r.area.createweight that depends on pandas and scikit-learn) that I have difficulty in installing the relevant packages in GRASS GIS python environment. Maybe I'm missing something - I will try to remove and re-install the program from scratch.
>> 
>> Thanks again!
>> 
>> 
>> On Mon, Dec 20, 2021 at 3:19 PM Dheeraj Chand <dheeraj at dheerajchand.com <mailto:dheeraj at dheerajchand.com>> wrote:
>> This may also depend on how you have built GRASS on Mac. There are a few ways to do it, all of which are a big pain! Which technique did you use?
>> 
>> Sent from my iPhone
>> 
>>> On Dec 20, 2021, at 5:42 AM, Veronica Andreo <veroandreo at gmail.com <mailto:veroandreo at gmail.com>> wrote:
>>> 
>>> 
>>> Hi Gioia,
>>> 
>>> Have you tried with `pip3 install pandas` in the terminal? I guess the pandas you use within pycharm is in a virtualenv or so, and grass might not have access to it. I do not use Mac but I found this: https://www.geeksforgeeks.org/how-to-install-python-pandas-on-macos/ <https://www.geeksforgeeks.org/how-to-install-python-pandas-on-macos/>
>>> 
>>> hope that helps
>>> Vero
>>> 
>>> El dom, 19 dic 2021 a las 15:33, Gioia Blayer (<gioia.blayer at mail.huji.ac.il <mailto:gioia.blayer at mail.huji.ac.il>>) escribió:
>>> Hello everyone, 
>>> 
>>> I am trying to install the module r.area.createweight in GRASS GIS version 7.8.6 on macOS Monterey 12.1. When I run the command g.extension r.area.createweight from the console in GRASS GIS I get the following error:
>>> 
>>> Fetching <r.area.createweight> from GRASS GIS Addons repository (be patient)...
>>> ERROR: Pandas is not installed
>>> Compiling...
>>> [make: *** [r.area.createweight.tmp.html] Error 1
>>> ERROR: Compilation failed, sorry. Please check the above error messages.
>>> 
>>> I do have Pandas because I use it for python in pycharm, but I do not understand how to install Pandas in the GRASS GIS environment. 
>>> Hope someone can help me with this, I feel it's something quick and technical but I'm new to grass gis, so it takes me some time to learn it.
>>> 
>>> Thank you in advance for the time and help!
>>> _______________________________________________
>>> grass-user mailing list
>>> grass-user at lists.osgeo.org <mailto:grass-user at lists.osgeo.org>
>>> https://lists.osgeo.org/mailman/listinfo/grass-user <https://lists.osgeo.org/mailman/listinfo/grass-user>
>>> _______________________________________________
>>> grass-user mailing list
>>> grass-user at lists.osgeo.org <mailto:grass-user at lists.osgeo.org>
>>> https://lists.osgeo.org/mailman/listinfo/grass-user <https://lists.osgeo.org/mailman/listinfo/grass-user>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20211220/0976529c/attachment-0001.html>


More information about the grass-user mailing list