Python installation

In case you want to use Codac only with Python, then the installation procedure is simply:

  1. Dependencies: Ensure you have a supported version of Python (>=3.8).

  2. Install pip: For Ubuntu or Debian-like systems:

    sudo apt install python3-pip
    

    For other systems, you can usually install pip with something similar to:

    python -m pip install pip
    
  3. Install via pip: Use the following command to install Codac:

    pip install codac
    

You can also update and test your Codac Python package:

  • Update via pip: Use the following command to update your already installed Codac package:
    pip install codac --upgrade
    
  • Testing the installation: In order to verify that your installation is working properly in Python, you can run:
    pip install numpy sympy
    python -m unittest discover codac.tests
    

Troubleshooting

Depending on your configuration, you may encounter difficulties when installing the Codac Python package. Here are a few tips to help you.

python vs python3, pip vs pip3 commands

You may need to use python3 instead of python command depending on your configuration. Same applies to the pip command, which may be pip3 in some cases.

Debian Bookworm, Ubuntu 24.04 and possibly other configurations

pip install ... or pip3 install ... commands may only work inside virtual environments or with --break-system-packages parameter, e.g.:
pip3 install --break-system-packages codac

Python package dependencies for Ubuntu or Debian-like systems

If available, prefer sudo apt install python3-mypackage instead of pip install mypackage commands to install Python package dependencies for Ubuntu or Debian-like systems, to avoid breaking the system packages. However, not all the packages are available with apt.

macOS Big Sur and later (x86_64)

Python wheels provided for Catalina or earlier may need to be installed with something similar to:
sudo pip3 install --upgrade vibes # Add here any other non-binary wheels dependencies...
sudo pip3 install --upgrade --nodeps --platform macosx_10_9_x86_64 --only-binary=:all: --target=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages codac

Depending on the way Python was installed, the path to specify after --target may differ, e.g. if Python was installed from https://www.python.org/ftp/python/3.10.4/python-3.10.4-macos11.pkg, it may be /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages. Otherwise, run python3 -m site to check the site-packages full path in sys.path list. Also, the value 10_9 may need to be changed to 10_14 (or possibly another value) for some Python versions.

Finally, note that unsupported configurations can still probably follow the instructions from Building a local Python binding for Codac, for building the Codac Python binding locally on your machine.