Missing dependencies (numpy) when importing pandas - python

I'm following a Python tutorial where pandas is used and I'm running into a dependency issue that I can't figure out.
To install pandas, I ran:
pip install pandas
But when I open a python session and try to import pandas I get an error message saying "Missing required dependencies ('numpy')" despite the fact that I see it getting installed when I run the pip command to install pandas.
Help would be appreciated. Thanks.
Edit: Full error message posted below:
PS C:\Python> python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\__init__.py", line 19, in <module>
    "Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']

try to install Anaconda 3 (it works on Windows and Linux), it contains all the useful libraries like panda, numpy... so you don't have to download or rebuild yourself

Related

ModuleNotFoundError: No module named 'statsmodels.miscmodels.ordinal_model'

I want to build a Ordered Probit model using statsmodel package in python. Used the following code to import:
from statsmodels.miscmodels.ordinal_model import OrderedModel
but getting a following error:
ModuleNotFoundError: No module named 'statsmodels.miscmodels.ordinal_model'
I have updated the package as well but the error persists.
well,u can install this package in this way:
pip install git+https://github.com/statsmodels/statsmodels
pip install --upgrade --no-deps statsmodels worked for me.
I know it is a pretty old discussion board, but I hope my post can be helpful.
I recently ran into the same issue. and solved by doing the following:
pip3 install git+https://github.com/statsmodels/statsmodels. Just like #AudiR8 mentioned. However, if you are using an IDE with python version 3.0 +, use pip3 is better.
Make sure the package is installed in the correct directory then turn off the IDE.
Reopen it and it should be working.
Hope it can be helpful!
An option that helped me was to restore my console's settings to default and then it worked. My IDE in particular was Spyder
You can try use this instead from statsmodels.discrete.discrete_model import OrderedModel

Getting a Module not found error when installing various packages

I am trying to import various modules, like nltk and pandas, using Jupyter notebook. While I have created a virtual environment and installed the packages (I received an all packages installed message on terminal), I keep getting that error on Jupyter notebook. Could I get help for this please? Thanks!(this is what the error looks like:
https://i.stack.imgur.com/rwkqW.png)
We need more information are you using anaconda or are you not are you using pip3? Perhaps if you are try " sudo pip3 install pandas. "

Unable to install Pandas on Pycharm, Recieving error

I am trying to get Pandas to work on my Pycharm environment. I have installed it through the command:
pip install pandas
But when I run the code in my environment, import pandas as pd
I get the error:
No module named 'pandas'
When I try to install it using the project interpreter in Pycharm, I get the error:
error occurred when installing package 'pandas'
EDIT:
I didn't state what happens when I look into this error. I click 'Details'.
Then it says:
AttributeError: module 'pip' has no attribute 'main'
Perhaps this may tell us something about the issue
The error is identical to the one reported here Module pip has no attribute 'main'
For pip version 10.x and higher you should update Pycharm to 2018.2.
Or simply run pip in a terminal outside of Pycharm
Which Python version are you using? If you are using Python3, then the correct command is pip3 install pandas.
Make sure that the pip command you are calling refers to the same python that you are running. Try pip -V for more information.
-Update your pycharm to the latest version
-Update pip to the latest version and ensure its same as the python.exc
-Run pip install pandas command as an administrator
-Try installing pandas again
Apparently, you installed Pandas for python2 by pip. For python3, you need to use pip3.
However, it doesn't matter regarding your problem. Probably, you don't choose the right project interpreter.
For Pycharm, it supports the system python(2 and 3), as well as the virtual environment. You may install the Pandas module in system python, but use the virtual environment as default.
Simple solution
Make sure you select the interpreter you want (system or
virtualenv);
Check package list, if there is Pandas module;
If yes, refresh the project list;
If not, simply click + to search Pandas and install it to your
project interpreter.

No module named pandas

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.

ModuleNotFoundError: No module named '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.

Categories

Resources