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