How to Install PyCaret

Tobias Byland www.byland.info
2023-09-24

As part of my goal to become proficient with Python in addition to R I recently discovered the awesomeness that is Pycaret.

Setting it up was a bit of a hassle as it involved a bit more than just “pip install pycaret”, which is what I am used to from R and which is also what I have so far seen with Python.

But it turns out, that there are some dependencies to older versions of Python/packages, which means these need to be installed explicitely.

So in the end I ended up learning quite a lot of new things about requirements.txt and virtual environments in Python.

And in case someone else is in the same situation I briefly wanted to write what worked for me.

Best to use a virtual environment

As of Sep 2024 the most recent version of pycaret is 3.1.0, which only works with Python 3.10 and some older versions of packages, e.g. numpy<1.24, pandas<2.0.0.

So for me it was worth it setting it up in a virtual environment dedicated to pycaret and containing

A working code example based on this setup can be found here

As a Sidenote

I first wanted to install pycaret using RStudio and the reticulate package as for me this is what I am most used to.

But it turns out that the integration with reticulate seems to be a bit wonky - or at least I wasn’t able to get it up and running.

So I took this as an opportunity to explore Visual Studio Code a bit more and lo and behold, setting up pycaret was incredibly smooth using VSC.

And on top of that, working with VSC was also quite fun, so now I definitely want to get to know it better :)