← Click to open in Google Colab
Setup Guide#
Welcome! This notebook is a step-by-step guide to install c4dynamics and import the package to use in your programs.
There are three main ways to install c4dynamics:
From
PyPI(pip)Directly from
GitHubUsing
pyproject.toml
Python Version#
c4dynamics requires Python 3.8–3.12.
Virtual Environment#
If you want to install and run c4dynamics in a virtual environment, follow this guide before proceeding to next steps: How to Install Multiple Python Versions on your Computer and use them with VSCode.
PyPI#
c4dynamics is published to PyPI, install it using pip:
[ ]:
!pip install c4dynamics
This approach is the most direct and easy, and automatically installs the package dependencies.
GitHub#
If you want the newest features, install the latest GitHub version (unstable).
To download the latest GitHub version, you can use git or download the ZIP archive from the GitHub page:
Using
git
[ ]:
!git clone https://github.com/C4dynamics/C4dynamics.git
From the GitHub page
If you don’t have git installed, you can download the repo manually. Go to the page of the repo, press the Code button and then select Download ZIP:
Whether you downloaded it using git clone or manually through the repo page, add the base directory (the folder where c4dynamics is stored) to the python path (replace /path/to/your/directory with the actual path, such as /home/user/c4dynamics on Linux or C:\Users\User\c4dynamics on Windows):
[ ]:
import sys
sys.path.append('/path/to/your/directory')
Now, change the current directory and install the dependencies:
[ ]:
!cd /path/to/your/directory
!pip install -r requirements.txt
pyproject.toml#
The third option to install c4dynamics lets you modify the source code and have the changes reflected immediately without reinstalling.
Download c4dynamics (follow steps 1 or 2 in the previous section - GitHub).
Change directory:
[ ]:
!cd /path/to/your/directory
For basic installation (running examples and using c4dynamics in your programs):
[ ]:
!pip install -e .
Where /path/to/your/directory is the root directory of c4dynamics.
For development and documentation, install the dev extras:
[ ]:
!pip install "c4dynamics[dev]"
Verify Installation#
[ ]:
import c4dynamics
print(c4dynamics.__version__)
Now you can import c4dynamics and use it in your programs:
[ ]:
import c4dynamics as c4d