Different package versions in terminal and jupyter notebook

In terminal window,

conda list numpy


numpy                     1.19.5                   pypi_0    pypi


conda list scikit-learn


scikit-learn              0.23.2                   pypi_0    pypi

While in jupyter notebook,

Since I want to use pycaret library, I need a lower version of numpy and sklearn.
I am using Anaconda and I have used python -m ipykernel install --user --name pycaret_env --display-name "pycaret_env"to add kernel to jupyter notebook.

How can I deal with this situation?

Beyond mention of using Anaconda, you don’t provide how or on what kind of machine you are doing this. Plus you are vague on what you’ve already done beyond the one line.

As described here, that command is to “create notebook kernel connected with the conda environment”. You’d already have to be operating in that environment within your terminal. So seeing different things is concerning. Be that as it may, it seems you just want to be using pycaret from within your notebook? From within the notebook you are working in, have you tried running the following?

%pip install pycaret

Restart the kernel and test if import pycaret now works.
If that fails to allow the import to work now, try:

%conda install pycaret

For dealing with the packages, you can now use the pip and conda magics from within the notebook. See my recent post here about these magics.

1 Like