Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

installing pandas in python 2.7, ubuntu 12.04 [closed]

when i initially ran

  $ pip install pandas

it gave me an error that i don't have permissions. then when i tried

  $ sudo pip install pandas

it gave me this -

  fatal error: Python.h: No such file or directory

After some search, i came across this command

  $ sudo pip install -U pandas

after a very, very verbose output, it gave the same error but this time it prompted me that i might need/want to install python-dev & python-setuptools after installing python-dev, pip install pandas worked fine and without a hitch!

So, my question is, does anyone know why this problem occurred?! Has this occurred before?! and what does the -U in $ pip install -U ... stand for?! it isn't mentioned in the help page for pip, i checked!

Also, i know that there's a log file for at /home/user/.pip/pip.log but instead of appending error messages to the log file, it gets rewritten each time there's pip runs into a problem.

Is there anyway to fix this?! Also, can i make pip log every install as well and not just the ones that went wrong! instead of having to do

  $ pip install ... >> LOG_FILE

everytime!

EDIT 1 : turns out i didn't do enough research, i found that Python.h isn't necessarily installed by default though i have them installed.

But i'd still like to know what the -U stands for and how to keep a log file in pip.

like image 993
Poruri Sai Rahul Avatar asked Jun 19 '13 15:06

Poruri Sai Rahul


People also ask

Why pandas is not working in Python?

In most cases this error in Python generally raised: You haven't installed Pandas explicitly with pip install pandas. You may have different Python versions on your computer and Pandas is not installed for the particular version you're using.


1 Answers

You always need the python-dev package to compile Python C extensions such as the ones in Pandas. When you install Python from source, they're installed along, but not with the Ubuntu package.

From pip install --help:

-U, --upgrade         Upgrade all packages to the newest available version
like image 103
Fred Foo Avatar answered Oct 21 '22 10:10

Fred Foo