Python, unable to import Pandas in Python3Component

Hello,

Like many other colleagues, we are still facing the error : "1. Error running script: partially initialized module ‘pandas’ has no attribute ‘_pandas_datetime_CAPI’ (most likely due to a circular import) [40:1]" when trying to import pandas.

Are there any stable solutions to come? Does anyone knows if this problem is at Rhino’s side?

It seems very hard to fix.

Thank you,

LS

Hi, I’m not sure about the technical explanation, but this method is very effective for me. You can check out this link: Gmsh in Grasshopper - #6 by Rh-3d-p

Hi, thanks for your help :slight_smile: Unfortunately it seems this didnt work for pandas explicitly. It did the job for numpy tho.

So my question remains: What is going on with the Pandas package?

Also tried with pandas 2.0 instead of 2.2 but I get the locale problem. I do think this problem is on rhino’s side. Can someone confirm?

1 Like

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

Hope this might be usefull for anyone.

Leandre Sassi

1 Like