Skip to content

How to install PyChrono

Mattia Gramuglia edited this page Jul 29, 2025 · 5 revisions

πŸš€ PyChrono Installation Guide

This guide walks you through the installation of PyChrono for use in this project.


🐍 1. Install Anaconda or Miniconda

Follow the official Miniconda installation guide for your platform (Windows, macOS, or Linux).


βš™οΈ 2. Automated Setup

βœ… Windows Users

  1. Download the file install/install_pychrono_windows.txt.

  2. Rename it to install/install_pychrono_windows.bat.

  3. Open Command Prompt and run:

    install_pychrono_windows.bat
  4. ➑️ Skip to Step 5: Copy the Demos and Test the Installation


βœ… Linux Users

  1. Download the file install/install_pychrono_linux.sh.

  2. Open a terminal and make the script executable:

    chmod +x install_pychrono_linux.sh
  3. Run the script:

    ./install_pychrono_linux.sh
  4. ➑️ Skip to Step 6: Run the Code


βœ… MacOS Users

  1. Download the file install/install_pychrono_macos.sh.

  2. Open a terminal and make the script executable:

    chmod +x install_pychrono_macos.sh
  3. Run the script:

    ./install_pychrono_macos.sh
  4. Initialize Conda for zsh shell

    /opt/miniconda3/bin/conda init zsh
  5. Restart the shell

    exec zsh
  6. Activate the PyChrono Conda environment

    conda activate chrono
  7. Set the PYTHONPATH environment variable

    export PYTHONPATH=$(conda info --base)/envs/chrono/share/chrono/python
  8. ➑️ Skip to Step 6: Run the Code

Note

Steps 4-7 need to be run every time you want to use pychrono.


πŸ›  3. Manual Setup Procedure (All Platforms)

πŸ”§ Step 1: Add the conda-forge channel

Open a terminal (Windows users: use PowerShell or Anaconda Prompt):

conda config --add channels http://conda.anaconda.org/conda-forge

πŸ”§ Step 2: Create a new Conda environment

conda create -n chrono python=3.10

Activate the environment:

conda activate chrono

To deactivate:

conda deactivate

Stay in the environment during the following steps.


πŸ”§ Step 3: Install PyChrono dependencies

conda install -c conda-forge numpy=1.24.0
conda install -c conda-forge matplotlib
conda install -c conda-forge irrlicht=1.8.5
conda install -c conda-forge pytz
conda install -c conda-forge scipy

πŸ”§ Step 4: Download and install PyChrono package

Visit the package repo and download the correct version for your platform:

  • macOS: osx-arm64/pychrono-8.0.0-py310_2471.tar.bz2
  • Windows: win-64/pychrono-8.0.0-py310_0.tar.bz2
  • Linux: linux-64/pychrono-8.0.0-py310_0.tar.bz2

After downloading, navigate to the folder (e.g., Downloads) and run:

cd ~/Downloads
conda install pychrono-8.0.0-py310_2471.tar.bz2

Note

macOS users: You may also need to set the PYTHONPATH:

export PYTHONPATH=$HOME/miniconda3/envs/chrono/share/chrono/python

πŸ“ Step 5: Copy the Demos and Test the Installation

  1. Navigate to the folder where you want to save the demo files:

    mkdir ~/pychrono_demos
    cd ~/pychrono_demos
  2. Copy the demo files:

    cp -r $PYTHONPATH/pychrono/demos/* .
  3. Run a demo to verify the installation:

    cd mbs
    python demo_MBS_revolute.py

🚦 Step 6: Run the Code

  1. Clone the repository:

    git clone https://github.com/andrealaffly/UAV_Sim_PyChrono.git
    cd UAV_Sim_PyChrono
  2. Run the simulation:

    python main.py

πŸ“š Wiki Navigation

πŸ“¦ Setup

πŸ“‘ Publications

⏳History and Fun Facts

Clone this wiki locally