I am running the latest anaconda on ubuntu linux. Everything was working ok until this week. I can't import pandas on python3. I could last week using the same programs. I've tried it on python called from the bash and also from spyder and jupyter, and I get a message that it can't find pandas. I've tried reinstalling pandas using both pip and conda, and it said that it was correctly installed.
Any suggestions?
Thank you.
Howard
You can create a new environment on Anaconda and then install pandas in that environment. Otherwise, try re-installing Anaconda.
Related
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.
I am new to python and I am trying to make a simple stock market program using pandas to import the data. I have installed Anaconda which said that it installed pandas along with it, as well as Python 2.7. I use PyCharm as my IDE. When I run:
import pandas as pd
from pandas_datareader import data
I receive the error message
import pandas as pd
ImportError: No module named pandas
I am not sure why it is giving me this error message so any help would be greatly appreciated
When entering the command to run your file, make sure you specify which version of python you're using. For example, instead of python filename.py, use python3 filename.py or python2 filename.py
Try to install it using sudo ...
sudo pip3 install pandas
for ubuntu ... it worked got me. pip or pip3 .. as per your requirement.
You need to pip install pandas and things will work.
Your issue is that pandas is not installed locally on your computer. Luckily, this is a simple task to accomplish by opening up either a Terminal or Command Prompt (depending on your OS), and typing in the command pip install pandas. This will install pandas and you will be good to go!
The issue is that Anaconda installs a Python version of its own, and likely the Python version is Python 3. When you use PyCharm IDE as your editor, you are using another version of Python (Python2). For my Mac, Anaconda's Python is installed under /anaconda3/bin and my default Python is installed under /usr/bin/python.
I recommend you either config PyCharm to use Anaconda's Python, or use Anaconda's Jupyter your project. Jupyter is arguably a stronger tool considering that you are doing data analytics task.
Also, for Anaconda's python, you shoud use conda install pandas instead of pip install pandas to install additional packages. This is not necessary this time since it's already installed.
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
I'm following a practical machine learning tutorial and I am already stuck on the second video. https://www.youtube.com/watch?v=JcI5Vnw0b2c&t=195s
import pandas as pd
import Quandl
df = Quandl.get('WIKI/GOOGL')
print(df.head())
When I run the same code as the man in the video, all I get is
ModuleNotFoundError: No module named 'pandas'
I'm on Windows 10 using Visual Studio 2017 and I already did pip install pandas. I have python 3.6.1 installed.
pip 9.0.1 from C:\Program Files\Anaconda3\lib\site-packages (python 3.6).
pandas (0.19.2).
Python 3.6.0 :: Anaconda 4.3.0 (64-bit)
I had a similar problem which I fixed by doing
pip3 install pandas
Instead of
pip install pandas
I had this problem as well and tried a few different things until I realized my python path under settings.json (python.pythonPath) was incorrect and pointing to the wrong directory. The path should be to where the Python.exe file is under programs.
To make sure that you're using the same pip as your python, execute the pip with whole path from python directory i.e.
C:\Program Files\Anaconda3\lib\site-packages (python 3.6)\pip install pandas
This will install the pandas in the same directory
Or C:\Python365\pip install pandas
Or C:\Python27\pip install pandas
Whichever Python you wand to use and install the pandas
If you want to use a specific version of Python in Windows cmd, just add the path of that Python in System Variables.
For python 3.7, type following in CMD:
CD C:\Users\[path]\Continuum\anaconda3\Lib\site-packages
then:
pip3 install pandas
In my case, I installed panda instead of pandas. My installation was missing the last letter s.
My problem was running pandas from an ipython shell. The error message from the original post kept cropping up, despite having pandas installed. Then I started reading messages (see below). Installing ipython in the virtual environment didn't help, BUT deactivating the virtual environment and activating it again did.
➜ ipython
/.../python3.10/site-packages/IPython/core/interactiveshell.py:887: UserWarning:
Attempting to work in a virtualenv. If you encounter problems, please install
IPython inside the virtualenv.
I think you can use conda update pandas and it should get the most current version for you dist.
Or, pip install --update pandas
Also in python 3 quandl will be lowercase.
Edit.. pandas in on ver. 0.21.0 currently.
I signed up for a statistics udemy course which uses jupyter running the stock numpy package out of anaconda.
Numpy is working when I run python 3.4.4 in pycharm, but it will not work in either anaconda2 nor anaconda3.. this makes no sense because numpy comes stock as part of the anaconda library.
When I try importing numpy in jupyter, running a local instance of a python 2 script, I get this:
Thinking I could sidestep the error using a IDE, I tried pycharm and I got this:
Numpy is part of the anaconda default library which I'm running, so I checked and made sure the numpy package was there via the Anaconda Prompt using 'conda list'...
Why won't it import successfully?
Before I uninstall and reinstall everything, does anyone have any ideas?
Yayyyy. I figured it out. So I had several different python versions before I was running python through anaconda/jupyter. As a result, the tethering in-between the additional package libraries to the version of python running was shifty. For example, I may have had numpy working configured to 3.4 but not 2.7..
anyways, to break down the steps I took, I uninstalled all instances of python (both anaconda and normal versions). Then I deleted the old 3.4 libraries from my C drive. Then I installed anaconda 2.7.11 again, tested importing numpy and got the same error. Then I thought to myself, what if the packages are installed separate from the python library and their configuration didn't get reset via the reinstall.. so via the anaconda prompt I typed:
pip uninstall numpy
which removed the package I was having trouble with. and then :
pip install numpy
which downloaded and reset a whole new instance of the package. Then I tested importing numpy in both the anaconda prompt and jupyter = both worked.
I'm very happy that this ended up working out as I can continue on as planned. For anyone else who experiences a similar problem, I would try uninstalling, then reinstalling the problem causing package via pip commands - this step seemed to have the most impact on fixing the problem. Then if that doesn't work proceed to uninstall and reinstall the environments in intervals.
You can try using the following command:
pip install numpy --upgrade
This will uninstall old installed version of numpy and install a new version. This command solved my issue.
try activating you base conda environment before starting jupyter.
>activate root
>jupyter notebook