Pandas import error: Unable to import required dependencies

Hi everyone,

I tried to import pandas in a CPython script, but unfortunately I got the following error message:

Error -> Unable to import required dependencies:
pytz: cannot import name 'Mapping' from 'collections' (C:\Users\zennersl\AppData\Roaming\pyRevit-Master\bin\cengines\CPY3123\python312.zip\collections\__init__.pyc)

My script looks like this:

#! python3

import sys

sys.path.append(r"C:\\Users\\zennersl\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages")

try:
    import pandas as pd
    print("Pandas is installed")
except ImportError as e:
    print("Error -> ", e)

Can someone help me resolve this issue?

Cheers,
Lucien

Hi! which Revit version are you trying to use this script with? I’ve been having issues loading basically anything in Revit 25 (.NET 8) and beyond with pyRevit 5.1

Notion

Consider using the subprocess module

Hello Danail
I’m using the following Revit version:

  • Build Version: 24.2.0.63
  • Build Number: 20231029_1515(x64)
  • Revit Version Number: 2024.2.0

Hi Jean
I’m sorry, I don’t fully understand the solution you’re proposing.

These are my settings for pyRevit:

$

What do you mean by: “Consider using the subprocess module”. Or rather, how can I use this module? Unfortunately, this is not clear to me from the example script. Is it a line of code I should implement or something I should change in my settings?