'Jupyter Notebook unable to recognize pandas library: Python
I use Windows operating system both personally in my home and at office. The Jupyter Notebook in my personal laptop is able to recognize pandas library. I can read csv file, assign it's content to a numpy array and do many things.
I run the same Jupyter Notebook file in my office. Latest version of pandas is installed and wheel is also installed.
Now, the confusing part is If I run the code in python console, it looks like this.
Absolutely no error at all.
The same thing in my office's Jupyter Notebook looks like this. It cannot find pandas.
What could be wrong with my Jupyter Notebook in office's computer? I have restarted the kernel, opened in new browser to no avail.
Thanks in Advance
Edit 1
Jupyter Notebook already has pandas and wheel. I can see them when I run !pip list
command. I even tried to upgrade if there is any latest version of pandas.
The pandas and wheel in Jupyter Notebook and my local installation has exactly same version installed.
Both are on same directory: D:\Projects\Python\DataVisualization
And the problem still persists. :(
#Edit 2
As suggested by some SO users, I created a virtual environment named VE. On that virtual environment, I installed pandas. Along with pandas other libraries were also installed, i.e. pytz, six, python-dateutil and numpy.
I opened Jupyter Notebook from the virtual environment. Verified that pandas is installed there. And tried to import pandas. Yet the same error.
May be something is just wrong with my Chrome browser. It is controlled by system admins and I just can't uninstall and install it at my own volition. Let's see.
# Edit 3
I tried Jupyter Notebook on Microsoft Edge and it is reporting the same error. So no fault of Chrome.
Solution 1:[1]
I could not figure out exactly what caused the issue. But the issue vanished after doing a fresh install of Anaconda.
Solution 2:[2]
Pandas is not included with the Jupiter library. You likely have it installed on your local laptop globally. You need to
pip install pandas
on whatever environment/ terminal you are launching jupyter from
Solution 3:[3]
I had a problem with one notebook using pandas and other notebook failing to import it in VS Code. It happened because I've chosen different versions of Python: the global version had it (so pip indicated it's installed), and another had not.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Merin Nakarmi |
Solution 2 | Alireza Tajadod |
Solution 3 | namespace |