Installation by Cloning the GitHub repository
An alternative to PyPi is to clone the code from GitHub.
Here is an example for Linux. We assume that Python 3 is installed, and consequently ‘pip3’ is also installed. In a console, type:
git clone https://github.com/crillab/pyxai.git
You may need to update the environment variable ‘PYTHONPATH’, by typing for example:
export PYTHONPATH="${PYTHONPATH}:${PWD}/.."
Get the latest version of pip:
python3 -m pip install --upgrade pip
Installing
Run the following command inside the cloned pyxai directory. It compiles the C++ extension and installs all dependencies:
python3 -m pip install -e .
With setuptools ≤ 58.2.0 (pre-2021 toolchains),
pip install -e .may not compile the C extension correctly. Upgrade setuptools first:python3 -m pip install --upgrade setuptools.
If you are using a virtual environment, the compiled C extension must be copied manually into it (replace
3.xwith your Python version and adjust the architecture suffix accordingly):cp build/lib.linux-x86_64-3.x/c_explainer.cpython-3x-x86_64-linux-gnu.so env/lib/python3.x/site-packages/.
PyXAI’s graphical interface
Since V1.0.10, PyXAI’s graphical interface is independent and no longer required, to resolve compatibility issues with PyQt6. You can still use pictorial explanations without the graphical interface — more information is available on the Visualization page.
python3 -m pip install pyqt6
To use PyXAI’s graphical interface, you may need to install:
sudo apt install ffmpeg libsm6 libxext6 qt6-base-dev libxcb-cursor0 -y
Verifying the installation
python3 -c "import pyxai; print(pyxai.__version__)"
You can also run an example:
python3 examples/DT/BuilderOrchids.py