Installing the latest release
Installing PyCaret is the first step towards building your first machine learning model in PyCaret. Installation is easy and takes only a few minutes. All dependencies are also installed with PyCaret. Click here to see the complete list of dependencies.
In order to avoid potential conflicts with other packages it is strongly recommended to use a virtual environment, e.g. python3 virtualenv (see python3 virtualenv documentation) or conda environments. Using an isolated environment makes it possible to install a specific version of pycaret and its dependencies independently of any previously installed Python packages. See an example below of how to create a conda environment and install PyCaret.
#create a conda environment conda create --name yourenvname python=3.6 #activate environment conda activate yourenvname #install pycaret pip install pycaret==2.0 #create notebook kernel connected with the conda environment python -m ipykernel install --user --name yourenvname --display-name "display-name"
Following libraries have been removed from hard dependency in PyCaret 2.0. Hence they must be installed separately when specific functionalities are being used. See code below on how to install these dependencies.
# install shap for interpret_model functionality pip install shap # if build for shap fails using pip: conda install -c conda-forge shap # install awscli for deploy_model functionality pip install awscli # install psutil for system logging pip install psutil
PyCaret Nightly Build
PyCaret is a fast-evolving machine learning library. Often, you want to have access to the latest features but want to avoid compiling PyCaret from source or waiting for the next release. Fortunately, you can now install pycaret-nightly using pip.
We highly recommend to install pycaret-nightly in a virtual environment to avoid conflicts.
# create a conda environment conda create --name yourenvname python=3.6 # activate environment conda activate yourenvname # install pycaret pip install pycaret-nightly # update pycaret-nightly pip install --upgrade pycaret-nightly # create notebook kernel connected with the conda environment python -m ipykernel install --user --name yourenvname --display-name "display-name"
Recommended Environment for use
You can use PyCaret in your choice of Integrated Development Environment (IDE) but since it uses html and several other interactive widgets, it is optimized for use within notebook environment, be it Jupyter Notebook, Jupyter Lab, Azure Notebooks or Google Colab.
FROM python:3.7-slim WORKDIR /app ADD . /app RUN apt-get update && apt-get install -y libgomp1 RUN pip install --trusted-host pypi.python.org -r requirements.txt CMD pytest #replace it with your entry point.
Building from source
You can also download the source file from the link below and use the pip installer to install the package from a downloaded file. To install the package using the source file, download the file and use the command line or notebook environment to run the below cell of code.
# install using source file pip install C:/path_to_download/pycaret-version.tar.gz # install directly from git (stable release) pip install https://github.com/pycaret/pycaret.git
For Google Colab
PyCaret uses interactive plotting ability. In order to render interactive plots in Google Colab, run the below line of code in your colab notebook.
#For Google Colab only from pycaret.utils import enable_colab enable_colab()
For MAC OS
MAC users will have to install LightGBM separately using Homebrew, or can be built using CMake and Apple Clang or gcc. See the instructions below:
- Install CMake (3.16 or higher)
>> brew install cmake
- Install OpenMP
- >> brew install libomp
- Run the following command in terminal:
git clone --recursive https://github.com/microsoft/LightGBM ; cd LightGBM mkdir build ; cd build cmake .. make -j4
Try this next
Was this page helpful?