Install Certifai Toolkit
Prerequisites
- Download the Certifai toolkit
- Python 3.7 or 3.8 (For M1 macs use Python 3.8)
- Conda or another virtual environment manager (Required for Windows users and recommended for all others)
- Windows users must use PowerShell and have access to the folder where the toolkit was unzipped.
ALERT
When installing the toolkit, Mac users should run commands in bash rather than zsh.
Install the Certifai Toolkit
Set your context to the toolkit folder where you unzipped the contents of the Certifai Toolkit .zip during the download process.
cd <path-to-folder-where-toolkit-was-unzipped>Example
cd certifaiCreate a Python 3.7 or 3.8 virtual environment.
conda create -n certifai python=<version number>Example
conda create -n certifai python=3.8Activate the newly created environment.
conda activate certifai(To enable the use of Jupyter notebooks) Install the base requirements.
conda install --file requirements.txtInstall the CERTIFAI packages.
On MAC or Linux:
Install the Certifai component packages. (This may take a couple of minutes to run.)
pip install packages/all/*Install the Certifai packages specific to your python version. MAKE SURE TO USE THE SAME VERSION OF PYTHON that you specified when you created the virtual environment. (To check Python version enter
python --version
in your terminal or command prompt.)pip install packages/[your_python_version]/*EXAMPLE:
If you are using python version 3.8, run:
pip install packages/python3.8/*
For Windows Powershell:
Install the CERTIFAI packages compatible with all supported Python versions.
Get-ChildItem .\packages\all\*.zip | ForEach-Object -Process { pip install $_ }Install the Certifai packages specific to your Python version. You should replace the
python3.8
in the example below with the Python version you are using.Get-ChildItem .\packages\python3.8\*.zip | ForEach-Object -Process { pip install $_ }
Verify that the Certifai CLI and client libraries are installed successfully.
certifai -hA usage statement is displayed if the Certifai CLI has been installed successfully.
Info
The Certifai Toolkit contains Python wheel distributions
of the the client packages under packages/wheels/
. These wheels are included for installation on Databricks clusters
or environments where source distributions (.zip
) are not supported.
Special Setup instructions for optional dependencies
If you would like to perform shap-based based Explainability or Explanation analyses,
you must install shap>=0.31.0
. This may require a working C/C++ compiler (e.g. gcc) if pre-built binaries are not
available for your system on PyPI or Conda Forge.
shap
can be installed during the Toolkit installation by including the shap
extras during step 5 above.
On MAC or Linux:
pip install packages/[your_python_version]/cortex-certifai-engine-<version image>.zip[shap]
Example
pip install packages/python3.8/cortex-certifai-engine-1.3.14-90-g934e7cbe-py3.8.11.zip[shap]
For Windows Powershell:
pip install .\packages\[your_python_version]\cortex-certifai-engine-[version image].zip[shap]
Example
pip install .\packages\python3.8\cortex-certifai-engine-1.3.14-90-g934e7cbe-py3.8.11.zip[shap]
The SHAP notebook available in the cortex-certifai-examples repository offers an example of shap based analyses.
Info
shap
can optionally be installed via conda, however issues such as incompatible environments can arise when using
both conda and pip to install related depdencies (see https://www.anaconda.com/blog/using-pip-in-a-conda-environment).
For this reason, we suggest installing shap
using pip as described above. If you reach an incompatible environment by
installing shap
via conda, it may be best to fully recreate your python environment.
Special Setup instructions for Certifai Enterprise
If you want to perform the following actions for your Certifai Enterprise installation, you must install cortex-certifai-common
with additional depdencies for your platform.
This gives you the ability to:
- Push results directly to your configured cloud storage
- Use the Certifai CLI to get scans or use cases
- Use the Certifai CLI to get or set a baseline for a use case that is in cloud storage
Run this installation after you complete step 5 above.
AWS & RHOS:
pip install packages/all/cortex-certifai-common-<version image>.zip[s3]AZURE:
pip install packages/all/cortex-certifai-common-<version image>.zip[azure]GCP:
pip install packages/all/cortex-certifai-common-<version image>.zip[gcp]Example
pip install packages/all/cortex-certifai-common-1.2.14-59-g6a03e8fb.zip[s3]
Info
You can get the <version-image.zip>
by:
- Running
ls packages/all
and copying the image and tag forcortex-certifai-common
- Opening your toolkit folder in a file explorer window and opening
packages/all
to find thecortex-certifai-common
image and tag - Opening your toolkit folder in a file explorer window and opening
version.txt
file. Use the image and tag id beside "Scanner Build".
Next Steps
- Go to Import the Certifai remote configuration to download and set up the
certifai-kubeconfig.json
which allows you to work with remote scans.