How to install pandas from pip on windows cmd?

Question:

I am trying to install pandas using pip to run some pandas-based Python programs. I already installed pip. I tried googling and SO’ing but didn’t find a solution to this error. Can somebody share your inputs on this?

C:> pip install pandas

Error:

pip is not recognized as an internal or external command, operable program or batch file.
Asked By: Teja

||

Answers:

Please Ensure you are using a virtualEnv this is how :

virtualenv -p python3 envname

source env/bin/activate
pip install pandas

on windows you have to add scripts exe in the CLASSPATH
in order to use pip command

C:Python34Scriptspip3.exe

i suggest you to use MINGW he can gives you a better environment to work with python

Answered By: Hilmi Reda

Since both pip nor python commands are not installed along Python in Windows, you will need to use the Windows alternative py, which is included by default when you installed Python. Then you have the option to specify a general or specific version number after the py command.

C:> py      -m pip install pandas  %= one of Python on the system =%
C:> py -2   -m pip install pandas  %= one of Python 2 on the system =%
C:> py -2.7 -m pip install pandas  %= only for Python 2.7 =%
C:> py -3   -m pip install pandas  %= one of Python 3 on the system =%
C:> py -3.6 -m pip install pandas  %= only for Python 3.6 =%

Alternatively, in order to get pip to work without py -m part, you will need to add pip to the PATH environment variable.

C:> setx PATH "%PATH%;C:<pathtopythonfolder>Scripts"

Now you can run the following command as expected.

C:> pip install pandas

Troubleshooting:


Problem:

connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

Solution:

This is caused by your SSL certificate is unable to verify the host server. You can add pypi.python.org to the trusted host or specify an alternative SSL certificate. For more information, please see this post. (Thanks to Anuj Varshney for suggesting this)

C:> py -m pip install --trusted-host pypi.python.org pip pandas

Problem:

PermissionError: [WinError 5] Access is denied

Solution:

This is a caused by when you don’t permission to modify the Python site-package folders. You can avoid this with one of the following methods:

  • Run Windows Command Prompt as administrator (thanks to DataGirl’s suggestion) by:

    1. Windows-Key + R to open run
    2. type in cmd.exe in the search box
    3. CTRL + SHIFT + ENTER
    4. An alternative method for step 1-3 would be to manually locate cmd.exe, right click, then click Run as Administrator.
  • Run pip in user mode by adding --user option when installing with pip. Which typically install the package to the local %APPDATA% Python folder.

C:> py -m pip install --user pandas
C:> py -m venv c:pathtonewvenv
C:> <pathtothenewvenv>Scriptsactivate.bat
Answered By: Taku

install pip, securely download get-pip.py

Then run the following:

python get-pip.py

On Windows, to get Pandas running,follow the step given in following link

https://github.com/svaksha/PyData-Workshop-Sprint/wiki/windows-install-pandas

Answered By: Ajay Singh

Assuming you are using Windows OS.

All you need to add the pip.exe path to the Environment Variables (Path).

Generally, you can find it under ..PythonScripts folder.

For me it is, C:Program FilesPython36Scripts

Answered By: Raj

Reply to abccd and Question to anyone:

The command: C:Python34Scripts>py -3 -m pip install pandas
executed just fine. Unfortunately, I can’t import Pandas.

Directory path: C:usersmynamedownloadsminiconda3libsite-packages

My Question: How is it that Pandas’ dependency packages(numpy, python-dateutil, pytz, six) also having the same above directory path are able to import just fine but Pandas does not?

import pandas

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    import pandas
ImportError: No module named 'pandas'

I finally got Pandas reinstalled and imported with the help of the following web pages: *http://pandas.pydata.org/pandas-docs/stable/pandas.pdf (Pages 403 and 404 of 2215 … 2.2.2 Installing Pandas with Miniconda)
*https://conda.io/docs/user-guide/install/download.html *https://conda.io/docs/user-guide/getting-started.html

After installing Miniconda, I created a new environment area to get Pandas reinstalled and imported. This new environment included the current Python version 3.6.3. I could not import Pandas using Python 3.4.4.

Answered By: inhoser

In my opinion, the issue is because the environment variable is not set up to recognize pip as a valid command.

In general, the pip in Python is at this location:

C:UsersuserAppDataLocalProgramsPythonPython36Scripts > pip

So all we need to do is go to Computer Name> Right Click > Advanced System Settings > Select Env Variable then under system variables > reach to Path> Edit path and add the Path by separating this path by putting a semicolon after the last path already was in the Env Variable.

Now run Python shell, and this should work.

Answered By: Rahul Yadav

If you are a windows user:
make sure you added the script(dir) path to environment variables
C:Python34Scripts
for more how to set path vist

Answered By: Arslan Ahmad khan

pip install pandas
make sure, this is ‘pandas’ not ‘panda’

If you are not able to access pip, then got to C:Python37Scripts and run pip.exe install pandas.

Alternatively, you can add C:Python37Scripts in the env variables for windows machines.
Hope this helps.

Answered By: Jyoti

Use pip install pandas or python -m pip install pandas in Python directory.

Answered By: EpicPy
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.