There are two options for installing PyChrono on your computer. The first one uses a prebuilt conda packages and is the recommended way. The second one is for users who need to build the full library from the C++ source.
A) Install precompiled Python modules
We provide precompiled PyChrono modules that can be installed in Python in a single step. PyChrono modules are available both for the latest released code, as well as for the latest version of the code in the git main branch. Conda packages are made available for Linux, Windows and MacOS, and for different versions of Python3.
To install a PyChrono conda module, do the following:
- Install the Anaconda Python distribution.
- Optionally add the
conda-forge
andintel
channels to the list of channels:conda config --add channels https://conda.anaconda.org/conda-forgeconda config --add channels https://conda.anaconda.org/intel Decide which version of the Chrono code (latest release or latest code) you want and for which Python version. Consult the list of available modules on the PyChrono Anaconda Repository and download the appropriate archive (tar.bz2).
PyChrono packages built from a Chrono release version have label 'release'; PyChrono packages built from the latest Chrono development code have label 'main'.
We striongly recommend to use a dedicated conda environment and install the desired Python distribution, necessary dependencies, and PyChrono package under that environment.
For example, to create a
chrono
environment with Python 3.9, use:conda create -n chrono python=3.9Then activate that environment:
conda activate chronoso that all subsequent conda commands occur within that environment.
- Install the necessary dependencies.
Attention: Install the following packages using the versions specified below, in the order given, and before installing the PyChrono conda package itself!
- Intel MKL package (required for PyChrono demos using the Pardiso direct sparse linear solver, for Numpy, and for PythonOCC): conda install -c conda-forge mkl=2020
- Numpy package (required for the Chrono::Sensor module): conda install -c conda-forge numpy=1.24.0
- Irrlicht, for run-time visualization: conda install -c conda-forge irrlicht=1.8.5
- Pythonocc-core, for Chrono::Cascade support: conda install -c conda-forge pythonocc-core=7.4.1
- For Chrono::Sensor support:
- Requires NVIDIA graphics driver 515.xx +
- Install CUDA 11.7: conda install -c nvidia/label/cuda-11.7.0 cuda-toolkit
- install GLFW: conda install -c conda-forge glfw
- Intel MKL package (required for PyChrono demos using the Pardiso direct sparse linear solver, for Numpy, and for PythonOCC):
Install the PyChrono conda package downloaded in step 3 above (for release or development Chrono code, a given operating system, and built for a given Python version):
conda install <pychrono_package>.tar.bz2Note that installing the default conda package (latest package with label 'main' for your current operating system and Python version):
conda install -c projectchrono pychronomay not always work as expected. We strongly recommend downloading the appropriate PyChrono installation archive and install it from a local file as described above.
B) Build Python modules from the C++ API
Advanced users that use the entire Chrono::Engine C++ API can build PyChrono from scratch. This is the preferred way to have the most updated PyChrono, but it is more complicated. Do this:
- install the Chrono API with C++ source code and build it,
- install Python (only Python version 3.2 or greater is supported). Or, if you have hard disk space, better install a full stack like Anaconda
- build the PyChrono module, following these instructions