How to run pandas in GH2

I have used pip install pandas already
numpy can run, but what happen to pandas?

1 Like

Hi Wilson,

There was a similar issue posted about this the other day.

To be clear, you are referring to GH1 correct? not Grasshopper 2.0

still cannot :frowning:

image

Have the same issue here, locale is set and Path has been set but still doesnā€™t work

Have found that Pandas will import if I:

  • pip install directly using ā€œpython.exe -m pip install pandasā€ for the rhinocode python.exe file
  • delete the folder in site-envs and restart Rhino 8

But then if I close Rhino 8 and open it again, I get the same issue as shown above again.

1 Like

I have the same issue and I have tried all ā€¦ any updates on how to solve it?

Does setting locale before importing pandas help? BTW the Python 3 runtime attempts to do this when launching so itā€™d be great if you can test:

import locale
locale.setlocale(locale.LC_ALL, 'en_US')

import pandas

Also run RhinoCodeLogs after launching Rhino and see if a line similar to this exists. It should report your locale:

Info XX/XX/2024 XX:XX:XX AM [RhinoCode] Python locale is ('English_United States', 'utf8')

This didnā€™t fix the problem for me. Are there any updates?

Thanks,

LS

How about this?

Update on my end. I was struggling with this and itā€™s not an option to change computer settings to get it to work. So I first tried change locale and it didnā€™t work, but as stupid and simple as it may sound - a simple restart of Rhino and it worked without messing with ANY settings.

This was my code log: 'Info 02/12/2024 14:21:04 [RhinoCode] Python locale is ('English_Denmark', '1252')t

1 Like

Hello I once solved this problem but I think its not that simple.
Iā€™m teaching students in Korea. And I tried to apply same way as I solved this problem to my studentsā€™ 5 computers.
Some of them work, but the others not. I had no time to fix each caes, so I gave up to work with pandas, just export it with json.
This problem has to do with multiple environmental conditions. I hope next release solve this.

@timonielsen Do you know what was the locale before and after? I can try setting my machine to your older locale to see if I can replicate this

Check out these images


1 Like

So pandas is only working when locale is set to en_US?

In my experience, No.
Itā€™s because the locale default set is following windowā€™s locale, so we should change it to Linux locale
In my case, I live in Korea. If I print default locale by locale.getlocale() Iā€™ll get Korean_Korea.949, So I need to change it to ko_KR.
It doesnā€™t matter with Country.

2 Likes

@ģ“ģ‹ ķ›„ I can confirm this. Currently Rhino corrects en-US to en_US on launch.

Ok it works now,
need to setlocale to en_US first
if I didnā€™t and import pandas, it will fail, and I need to restart rhino8 again, no matter I set en_US again

1 Like

it doesnt work :frowning:

@Huy_Vu The editor tried to install pandas or openpyxl and has failed hence the ā€˜Corrupt environmentā€™ message. Would you mind running this in a fresh Rhino and send me the RhinoCodeLogs command report after running this script?

1 Like