3

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.

Foxtrot
  • 53
  • 1
  • 1
  • 5

4 Answers4

3

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

Nodata
  • 31
  • 2
1

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

Foxtrot
  • 53
  • 1
  • 1
  • 5
1

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

Aravind R
  • 835
  • 1
  • 7
  • 14
0

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

Tengis
  • 2,721
  • 10
  • 36
  • 58
DimpleCh
  • 11
  • 4
  • The exclamation point use is outdated. The magic commands for `pip` and `conda` were added to insure installation occurs in the environment that the notebook is using for the kernel. See [here](https://discourse.jupyter.org/t/why-users-can-install-modules-from-pip-but-not-from-conda/10722/4?u=fomightez) for more about these modern magic commands added in the last few years. **In short, use `%pip install pycaret` or similar** when installing from inside a notebook. – Wayne Aug 04 '22 at 15:53
  • Plus, because automagics are usually enabled by default in modern Jupyter. No symbol in front of `pip` or `conda` inside a cell in the notebook will invoke the recommended magic command getting used behind the scenes. So use of no symbol in front of `pip` or `conda` inside a notebook is better than an exclamation point **these days**. Being explicit with the magic symbol though is always best for future you and others following along later. – Wayne Aug 04 '22 at 15:57