Module Not found when importing PyCaret in Jupyter

19.7k views Asked by At

I'm trying to learn PyCaret but having a problem when trying to import it in Jupyter Lab.

I'm working in a virtualenv and installed pycaret via pip:

pip install pycaret

I can confirm its installed via pip list:

prompt-toolkit            3.0.7
protobuf                  3.13.0
py                        1.9.0
pycaret                   2.1.2
pycparser                 2.20

The very first line in the notebook is:

from pycaret.nlp import *

however this results in:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-7c206b4a9ead> in <module>
----> 1 from pycaret.nlp import *
      2 import psycopg2
      3 import sys, os
      4 import numpy as np
      5 import pandas as pd

ModuleNotFoundError: No module named 'pycaret'

I'm pulling my hair out trying to figure this out and can't find anyone else with something similar. I've tried to import via the python shell as well and that works perfectly.

4

There are 4 answers

0
Foxtrot On

I forgot that you had to install modules via Jupyter.

Following this guide: http://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/index.html

Installing like so:

# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install numpy

Got it working

2
DimpleCh On

I read on the tutorial page of pycaret that to install it through a Jupyter-notebook you should add an exclamation mark in front of the python command in the Jupyter-cell:

!pip install pycaret

0
Nodata On

You should create a seperate environment for installing time series alpha module

after creating a new environment and switching into

pip install pycaret-ts-alpha

and then you will be able to access

https://towardsdatascience.com/announcing-pycarets-new-time-series-module-b6e724d4636c

0
Aravind R On

First Create a new environment conda documentation

Second Download the Pycaret with this instruction

Third check your sklearn version is greater thansklearn>=0.23.2. Because if it's greater PyCaret is not compatible with that.

Nothing works for you? Download directly from github with this command pip install git+https://github.com/pycaret/pycaret.git#egg=pycaret