How can I use the pandas package in Python in Forio?

I uploaded the source code from here: https://github.com/pandas-dev/pandas/tree/master/pandas
And I uploaded the required dependencies package (pytz and dateutil).
I now see this error:

C extension: No module named ‘pandas._libs.interval’ not built. If you want to import pandas from the source directory, you may need to run ‘python setup.py build_ext --inplace --force’ to build the C extensions first.

I’m wondering if the above is possible, or if there’s something I’ve done wrong so far.

Hi,

Forio’s python setup includes NumPy and SciPy but not pandas by default.

We support third party libraries which are pure python. Include them in the “model” folder and they can be used by the model.

In this case, where to install you need to compile C libraries this is more difficult. For Forio Epicenter Large and above, you can create a custom environment with specific libraries pre-loaded. Contact us at support@forio.com if this is of interest and we can provide more details.

In most cases this error in Python generally raised:

  • You haven’t installed Pandas explicitly with pip install pandas.
  • You may have different Python versions on your computer and Pandas is not installed for the particular version you’re using.

You can run the following command in your Linux/MacOS/Windows terminal.

pip install pandas

To be sure you are not having multiple Python versions that are confusing, you should run following commands:

python3 -m pip install pandas
python3 -c 'import pandas'

Thanks, Steve!

Appreciate the feedback. This is good advice to install pandas on your development machine when building the model.

When running on the Forio server, you will not have access to a command line. The python model is run (internally) in a sandboxed docker container with a standard python environment. Some libraries are included such as numpy and scipy. (details here.

To run your model on Forio that uses other third party libraries (such as pandas), include those libraries in the model folder and they will be included in the path. Forio can also work with customers on a team plan to create special images which contain additional libraries automatically – contact us at support@forio.com for details.

WILL