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.
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
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
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
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
Related
Hi everyone, I'm trying to create a network visualization with python using the networkx package. Unfortunately I'm getting a "AttributeError: module 'scipy.sparse' has no attribute 'coo_array'" at the end of my code. I've tried to fix it but every help in the internet points towards upgrading pip or conda which I've done and still get the same error. I'm using jupyter notebooks - any help would be greatly appreciated!
#Prerequisites
import sys
!{sys.executable} -m pip install --user networkx
!{sys.executable} -m pip install --user numpy
!{sys.executable} -m pip install --user pandas
pip install notebook --upgrade
conda upgrade notebook
import networkx as nx
import numpy as np
import pandas as pd
from pathlib import Path
from pandas import DataFrame
#Read in Source File - NB this must match the schema requirements
df_InputData = pd.read_excel("/Users/paulkruse/Desktop/FR/Fr1.xlsx")
Src_Column = 'Source ID'
Tgt_Column = 'Target ID'
print(df_InputData);
#Nodes are positioned using the Fruchterman-Reingold force-directed algorithm.
Q = nx.Graph()
arr_SrcTgt= np.array(df_InputData[[Src_Column, Tgt_Column]])
print(arr_SrcTgt);
Q.add_edges_from(arr_SrcTgt)
dict_Coords = nx.spring_layout(Q)
It seems that your scipy version is out of date. The most recent version 1.8.1 certainly has coo_array function. One way to resolve this should be to upgrade scipy. If you're doing this from inside jupyter notebook, then use
!pip install --user scipy==1.8.1
Make sure to restart kernel after installation.
Hi everyone im currently facing problems with importing NumPy in jupyter notebook.
My first line of code was import numpy as np it resulted into giving me:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-8b972f5c2406> in <module>
----> 1 import numpy as np
After that my second option was to install NumPy which I did using !pip3 install numpy and that gave me Requirement already satisfied: NumPy in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (1.19.0)
Can someone let me know if I should re-download pip or something is wrong in my files? Thank you.
Check what version of python is your jupyter running.
Its highly likely that its running python 2.x.
If so, try using !pip install numpy instead of !pip3 install numpy.
You need to go to your Terminal, and execute !pip install numpy or pip3 install numpy depending on which version of Python you are using.
In the terminal, check for your python version using below command:
python --version
if you are using version 2 or 3:
python -m pip install numpy
if you are using version 3 or higher:
python3 -m pip install numpy
This way you know about where the package will be installed
I cannot import pandas_datareader on my jupyter notebook(via anaconda, python3) on my windows 10 laptop. It has been installed and I can see the file but It's having errors with importing into the jupyter notebook file. Any help?
I have tried :
pip install pandas-datareader ,
pip3 install pandas-datareader ,
conda install -c anaconda pandas-datareader
I expect the the code to run smoothly however I get
ModuleNotFoundError Traceback (most recent call last)
in ()
----> 1 import pandas_datareader
ModuleNotFoundError: No module named 'pandas_datareader'
Most obvious reason can be that you are using differnt enviroments(kernels) for jupyter notebook and others. Try running this code inside jupyter notebook empty project:
try:
from pip._internal.operations import freeze
except ImportError: # if your pip version is bigger then 10
from pip.operations import freeze
requirements = freeze.freeze()
for i in requirements:
print(i)
and check if there are your's missing imports
You have to run CMD Prompt from Anaconda navigator or find it from Start menu. Then use this command:
conda install pandas_datareader
I underwent similar difficulties and successfully fixed thanks to this post - Trouble installing some libraries in python (oauth2client and gspread) Conda is installing packagies to environment for Anaconda which is obviously different than pip uses.
I have technically already installed pandas-profiling using
pip install pandas-profiling
But when I try to import it, I get the following error:
import numpy as np
import pandas as pd
import pandas_profiling
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-e1a23f2a6f04> in <module>()
1 import numpy as np
2 import pandas as pd
3 import pandas_profiling
ModuleNotFoundError: No module named 'pandas_profiling'
First Error Image
So I tried installing it in Jupyter Notebook and got the following error as well:
import sys
!{sys.executable} -m pip install pandas-profiling
Collecting pandas-profiling
Could not find a version that satisfies the requirement pandas-profiling
(from versions: )
No matching distribution found for pandas-profiling
Second Error Image
I am also unable to install it using conda for both as I am unable to establish a connection to conda.anaconda.org for some reason.
To others who are looking to resolve this issue try these alternate steps :
Run pip install pandas-profiling command in a separate cell in the jupyter notebook.
After this just restart the kernal and run again. This should definitely work. Worked for me.
Based on the comments I was able to figure out the issue. I had to install jupyter notebook outside of the Anaconda root env and open it from the terminal.
pip3 install jupyter notebook
Once I did that it imported properly.
Steps:
Download the ZIP
Open Anaconda Prompt and go to the directory and extract the files to a folder
cd
C:\Users\farah\Downloads\pandas-profiling-master\pandas-profiling-master
Then type python setup.py install
Now you can use:
import pandas_profiling as pp
df = pd.read_csv('1234.csv')
pp.ProfileReport(df)
Reference: Pandas profiling
!pip install pandas_profiling # Run this from Jupytor notebook Ignore the warnings if any
from pandas_profiling import ProfileReport #restart the kernel if throws error
ProfileReport(df)
Note: This worked for me on Windows 10
From Anaconda Prompt:
conda install -c conda-forge pandas-profiling
I am using python 2.7.6 and trying to import pandas but Jupyter notebook gives me following
error--
ImportError Traceback (most recent call
last) in ()
----> 1 import pandas
/usr/local/lib/python2.7/dist-packages/pandas/init.py in
()
21
22 # numpy compat
---> 23 from pandas.compat.numpy import *
24
25 try:
/usr/local/lib/python2.7/dist-packages/pandas/compat/numpy/init.py
in ()
22 'your numpy version is {0}.\n'
23 'Please upgrade numpy to >= 1.9.0 to use '
---> 24 'this pandas version'.format(_np_version))
25
26
ImportError: this version of pandas is incompatible with numpy < 1.9.0
your numpy version is 1.8.2. Please upgrade numpy to >= 1.9.0 to use
this pandas version
while I have numpy 1.14.1
$ pip freeze
numpy==1.14.1
pandas==0.22.0
pip-magic==0.2.3
python-dateutil==2.6.1
pytz==2018.3
six==1.11.0
I have tried uninstalling and then reinstalling numpy and pandas from ubuntu terminal as well as Jupyter's terminal but unable to solve the error, any help would be appreciated. Thanks.
I could imagine that you have different versions of Python on your computer. In the Jupyter Notebook try running
import sys
sys.executable
This will show you which Python interpreter is used
EDIT:
You can install a new kernel for jupyter that uses the correct Python interpreter. First get a list of the existing kernels that you have:
Type jupyter kernelspec list. If the wanted interpreter is not there you will have to install it. To do so use python -m ipykernel install --name <Kernelname> --display-name <Displayname> Note that the python interpreter you are using to run this command must be the python interpreter that you want to be used by the kernel.
Now you are set up!
Start a new notebook and you will find that you can choose this new kernel
After trying multiple things I was able to resolve it.
The issue here was that python2.7 had older version of numpy i.e. 1.8.2 as the error in the question reports.
In python shell I found the path of numpy in use as follow.
import numpy
print numpy.__path__
the output was this path
/usr/local/lib/python2.7/dist-packages/numpy
went to /usr/local/lib/python2.7/dist-packages and deleted numpy using
sudo rm -r numpy
then staying in dist-packages directory I installed numpy 1.14.1 simply with pip.
sudo pip install numpy==1.14.1
this solved my problem.
One way to make sure that you use the right version or jupyter is the -m option of python:
-m mod : run library module as a script (terminates option list)
If this shows NumPy 1.14:
python -m pip freeze
starting jupyter like this should also give you the same version:
python -m jupyter notebook
you can find what versions of python are on your system and in what order they are searched with:
which -a python
Why don't you rm -rf the numpy library and install the version he is asking you too.
sudo pip install numpy==1.14.1