Rhino8 Rhinocode can't use pandas

I installed pandas in rhinocode, but the following error prompt appears. Please help me!

  1. Error running script RC
    Exception: Traceback (most recent call last):
    File “rhinocode:///grasshopper/1/d74bcf42-82f2-4e2e-97e0-642278443ab0/13b542ee-d5ef-4137-a0dd-00418337c631”, line 8, in
    File “C:\Users\Administrator.rhinocode\python3.9-1.24\site-envs\default-zXGCrWv5\pandas_init_.py”, line 25, in
    from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as tslib
    File "C:\Users\Administrator.rhinocode\python3.9-1.24\site-envs\default-zXGCrWv5\pandas_libs_init
    .py", line 13, in
    from pandas._libs.interval import Interval
    File “pandas_libs\interval.pyx”, line 1, in init pandas.libs.interval
    File "C:\Users\Administrator.rhinocode\python3.9-1.24\site-envs\default-zXGCrWv5\pandas_libs\tslibs_init
    .py", line 37, in
    from pandas._libs.tslibs.conversion import localize_pydatetime
    File “pandas_libs\tslibs\conversion.pyx”, line 77, in init pandas._libs.tslibs.conversion
    File “pandas_libs\tslibs\parsing.pyx”, line 1, in init pandas._libs.tslibs.parsing
    File “pandas_libs\tslibs\offsets.pyx”, line 1, in init pandas._libs.tslibs.offsets
    File “pandas_libs\tslibs\timedeltas.pyx”, line 77, in init pandas._libs.tslibs.timedeltas
    File “pandas_libs\tslibs\fields.pyx”, line 7, in init pandas._libs.tslibs.fields
    File “”, line 1007, in _find_and_load
    File “”, line 986, in _find_and_load_unlocked
    File “”, line 664, in _load_unlocked
    File “”, line 627, in _load_backward_compatible
    File “”, line 259, in load_module
    File “_strptime.py”, line 268, in
    File “_strptime.py”, line 182, in init
    File “_strptime.py”, line 69, in init
    File “_strptime.py”, line 28, in _getlang
    File “locale.py”, line 593, in getlocale
    File “locale.py”, line 501, in _parse_localename
    ValueError: unknown locale: zh-CN
1 Like

Has this been resolved? I am getting a similar error when trying to run Pandas (“ValueError: unknown locale: en_US”). Running the most recent WIP version, with python 3.9-28.

1 Like

Looking into this: RH-73849 missing locale.py in importing the pandas module

More conversation here Rhino 8 Feature: ScriptEditor (CPython, CSharp) - #372 by enmerk4r

2 Likes

This fixed it for now:

First I downgraded pandas to 2.0

pip install --upgrade --force-reinstall pandas==2.0
  • Then i set the regions to English (united states):
  1. Go to Settings > Time & Language > Language & Region.
  2. Check if English (United States) is available under the Languages section. If it’s not, add it by clicking on “Add a language” and searching for English (United States).
  3. Under Region, ensure that the United States is selected.
  4. Open Control Panel.
  5. Go to Clock and Region > Region.
  6. Click on the Administrative tab.
  7. Click on the Change system locale button.
  8. Make sure English (United States) is selected, and then click OK.

and then I set manually the locale in the Rhino Python script:

import locale
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')

import pandas as pd

2 Likes