importing pandas error with jupyter notebook on windows 10 - python

So I deleted and reinstalled the most up to date version of Anaconda Navigator with Python 3.6 on Windows 10. I launched Jupyter notebook and tried to import
1, numpy,
2, matplotlib
and 3, pandas
It was able to import Numpy and Matplotlib but for Pandas it gave me a very long error message as follows. I also use a Mac computer and it seems no problem with importing pandas using the Jupyter Notebook.

from the error message it seems that Pandas is not on of the pre-installed libraries in the Anaconda that you installed. It is the not the problem with the OS. Run the following command:
conda install -c anaconda pandas
then run the import statement.

Related

Importing libraries into jupyter causes it to error: the kernel appears to have died

Doing something as simple as:
import pandas as pd
Causes Jupyter Notebook to crash with: the kernel appears to have died.
I have tested:
import sys
sys.version
Which correctly imports sys, and prints version 3.9.
Trying a few other libraries such as matplotlib, seaborn, and numpy gives the same error.
I have tried installing these liraries in the terminal in jupyter with conda install package, but they are already installed. I have also checked they are up-to-date, which they are.
I'm using the Macbook Air M1 chip, with Anaconda x64 installed.
Not sure what to do from here.

Pandas version is different in Anaconda Navigator and Anaconda Prompt

I tried importing modin in my jupyter notebook. when I run the cell
import modin.pandas as pd
I get the following warning
UserWarning: The pandas version installed 1.2.3 does not match the supported pandas version in Modin 1.2.4. This may cause undesired side effects!
I tried updating my pandas using conda install pandas=1.2.4, it did not work, the command prompt got stuck at 'solving environment' stage for a long time and I had to stop manually. - attached is the screen shot Anaconda Prompt Install. I used pip install pandas==1.2.4, it worked. Now my anaconda prompt shows pandas version as 1.2.4, but my anaconda navigator shows 1.2.3. Attached are screenshots Anaconda Navigator, Anaconda Prompt. How do I resolve this issue/use modin without any warnings?
Any help would be greatly appreciated, Thank you!

How to get librosa.display and matplotlib working in jupyter notebook with anaconda 3.6

I'm trying to get Librosa working with python.
Originally I had Python 2.7 installed, I wasn't able to get Librosa working with Python 2.7 so I installed Anaconda (which I've never used before) so that I could have a separate environment (to allow my old programs written in 2.7 to continue to work). I'm trying to use Jupyter notebook which I've also never used before and I finally managed to import Librosa after creating an Anaconda environment with Python 3.6, however I'm not able to import librosa.display
When I googled "importing Librosa.display" apparently I need to install matplotlib first, however importing matplotlib is failing and I'm not sure why. I think it might be failing due to importing PIL /pillow? however I've never specifically used that module before or had to install it separately when using matplotlib so I'm not sure why it's needed.
I tried reinstalling pillow using PIP install in the anaconda python3.6 environment that I created but it didn't work so now stuck and just wondering if anyone can help me?
for the import code as follows
import matplotlib
import librosa
import matplotlib.pyplot as plt
import librosa.display
The program gets stuck on "import matplotlib.pyplot as plt" and the error message I currently have is as follows (prior to reinstalling pillow it didn't work but the message was different):
C:\Users\sh\.conda\envs\signalprocess1\lib\site-packages\PIL\Image.py:130: RuntimeWarning: The _imaging extension was built for another version of Pillow or PIL:
Core version: 8.2.0
Pillow version: 8.1.2
warnings.warn(str(v), RuntimeWarning)
C:\Users\sh\.conda\envs\signalprocess1\lib\site-packages\matplotlib\mathtext.py in <module>()
25
26 import numpy as np
---> 27 from PIL import Image
28 from pyparsing import (
29 Combine, Empty, FollowedBy, Forward, Group, Literal, oneOf, OneOrMore,
C:\Users\sh\.conda\envs\signalprocess1\lib\site-packages\PIL\Image.py in <module>()
111 if __version__ != getattr(core, "PILLOW_VERSION", None):
112 raise ImportError(
--> 113 "The _imaging extension was built for another version of Pillow or PIL:\n"
114 f"Core version: {getattr(core, 'PILLOW_VERSION', None)}\n"
115 f"Pillow version: {__version__}"
ImportError: The _imaging extension was built for another version of Pillow or PIL:
Core version: 8.2.0
Pillow version: 8.1.2
Any help would be great. I don't need to use Jupyter I'm perfectly happy using IDLE if IDLE will work with Librosa and matplotlib through Python 3.6. All I want to do is get Librosa and Matplotlib working so I can analyse signals! I guess if I spend another couple of days on it I'll work it out eventually but it's very annoying spending all this time just trying to get the packages working before I even get to the signal analysis.
thanks!! :)
I'm not sure what I was doing wrong.....
however in the end I got librosa working with anaconda python 3.8 and jupyter on Windows 10 (64) as follows...
Uninstalled anaconda (possibly it wasn't necessary to uninstall it - not sure)
Uninstalled jupyter the best I could (still seemed to be some remnants associated with arcpy)
Installed miniconda the python 3.8 version
Created a new (separate) Conda environment which also used python 3.8
This was done by opening the Conda command prompt then typing......
conda create --name signalpro38 python=3.8
(note that signalpro38 is the name I gave the new environment)
activated the new environment by typing:
conda activate signalpro38
Installed:
matplotlib,
scipy,
numba,
numpy
then
jupyter
into the new environment (signalpro38)
by typing
conda install matplotlib
conda install scipy
etc.
Added the new anaconda environment to jupyter by following the instructions here:
https://medium.com/#nrk25693/how-to-add-your-conda-environment-to-your-jupyter-notebook-in-just-4-steps-abeab8b8d084
opened jupyter and created a new notebook (making sure to choose the name of the new environment signalpro38)
typed code into the new notebook, saved and ran it, to check that the commands
import matplotlib
and
import matplotlib.pyplot as plt
were working ok in jupyter
Closed jupyter and went back to the Conda command prompt (the signalpro38 environment that I had created was still activated)
then installed librosa using
pip install librosa
(note that "conda install librosa" didn't find librosa, however I imagine there is a way to install librosa using conda also)
opened jupyter again and the previously saved notebook file and added
import librosa
import librosa.display
all seems to be working well now! :)
Hopefully this will help someone else! most likely it will help me when I need to do this again one day! :p

Getting Error when Running Python code on Ubuntu

This is my first time to use Ubuntu
I am using Spyder
I am following instructions I find on the ineternet
Now I am stuck
I am trying to get Python Anaconda working on Ubuntu
I installed it
trying now to test my first code
simple code
import pandas as pd
import quandl
df = quandl.get("WIKI/GOOGL")
print(df.head())
but I get ModuleNotFoundError : No Module named pandas
I have installed panadas in both ways
conda install -c anaconda pandas
and
pip3 install pandas
both ways installed
yet I am still getting same error
ModuleNotFoundError : No Module named pandas
In this instance, it appears that all you needed to was restart the kernel. When you install a new package, if you are using ipython, jupyternotebook, or spyder you should restart the kernel. This is why python -c "import pandas" worked, whereas in your python session, it wasn't working.
A running python kernel does not search for new packages since it started running. Starting and stopping will make sure it will find the new packages. There are probably ways to find new packages without restarting the kernel, probably by using some of importlab functions, but not sure if this would be necessary.

No module named Pandas in Jupyter Notebook

I know there is a huge number of questions on this topics, but not even one worked for me, not here, not on github.
I have installed anaconda2 for macOS a few days before. I know pandas come with Anaconda by default, and in the last year I haven't any trouble with any python package on Ubuntu, but now I have a weird problem.
When I run jupyter notebook and import pandas as pd, I got an error: no module named pandas. It's not just about pandas, none of libraries work.
When I try to install pandas with conda, return me Requirement already satisfied. The same with pip.
Also, I have tried to run jupyter notebook with a full path to jupyter package, and doesn't help either.
Probably there is a problem with PATH, but I'm not really good with that and not sure what to do.
But everything works fine when I run iPython in terminal, python in terminal, just doesn't work in jupyter notebook.
> python --version
: Python 2.7.15 :: Anaconda, Inc.
> which python :/anaconda2/bin/python
> which jupyter-notebook:
/anaconda2/bin/jupyter-notebook
> conda env list:
conda environments:
base * /anaconda2
Thanks for any help in advance.
Try this in jupyter cell:
!pip install pandas

Categories

Resources