Link Search Menu Expand Document
PyXAI
Papers Video GitHub EXPEKCTATION About

Installation by Cloning the GitHub repository

github

An alternative to PyPi is to clone the code from GitHub.

Here is an illustration 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 last version of pip:

python3 -m pip install --upgrade pip

With setuptools > 58.2.0 version

python3 -m pip install -e .

executes the setup.py inside the pyxai directory, compiles the C++ code and installs dependencies.

With setuptools <= 58.2.0 version

Install dependencies

python3 -m pip install dill
python3 -m pip install docplex
python3 -m pip install lightgbm
python3 -m pip install lxml
python3 -m pip install matplotlib
python3 -m pip install numpy
python3 -m pip install pandas
python3 -m pip install pycsp3
python3 -m pip install pyqt6
python3 -m pip install python-sat[pblib,aiger]
python3 -m pip install shap
python3 -m pip install termcolor
python3 -m pip install wheel
python3 -m pip install wordfreq
python3 -m pip install xgboost

Compile the C++ code (python C extension):

python3 setup.py install --user

Of course, for this step, you need a C++ compiler and python-dev to be installed.

SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

This warning may occur if you do not have a version <= 58.2.0 of setuptools.

Unfortunately, the compiled C extensions are not linked with a virtual environment, therefore you must type (we consider here that the virtual environment is in the ‘env’ directory and you are in the ‘PyXAI’ directory):

cp build/lib.linux-x86_64-3.6/c_explainer.cpython-36m-x86_64-linux-gnu.so env/lib/python3.6/site-packages/.

The effect of this depends on your python version (here: 3.6) and your hardware architecture.

PyXAI’s graphical interface

Since V1.0.10, PyXAI’s graphical interface is independent and no longer required, to resolve compatibility issues with PyQt6. Of course, you can still manage pictorial explanations without the graphical interface (for this, more information is given in 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

Test

Finally, you can test an example:

python3 examples/DT/BuilderOrchids.py