11

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.

Poruri Sai Rahul
  • 281
  • 1
  • 4
  • 8
  • 6
    Why is this off-topic? It's about installing programming tools and libraries. – Fred Foo Jun 19 '13 at 20:43
  • 2
    This is of interest to programmers first and foremost (not sysadmins). Those who closed this question should think a moment "where else would this go" and "well aren't python programmers interested in this?" – WestCoastProjects Jun 18 '15 at 21:17
  • I don't get why it's off-topic either. The real problem is it's asking at least 3-4 different questions at once, so closing as "too broad" or an aggressive edit would be more appropriate. – Ixrec Jun 18 '15 at 21:19
  • 1
    btw I followed the answer below "python-dev package is necessary" - and now i'm set. I'm happy this question is here. – WestCoastProjects Jun 18 '15 at 21:23

1 Answers1

2

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
Fred Foo
  • 355,277
  • 75
  • 744
  • 836
  • yeah, i just read that the python-dev package is necessary. i'm just going through pip install --help right now but any comments on how to keep the log file from being rewritten?! – Poruri Sai Rahul Jun 19 '13 at 15:31
  • @rahul.poruri: Have you tried `pip --log`? – Fred Foo Jun 19 '13 at 16:15
  • 1
    /home/user/.pip/pip.log is the default pip log file and when i link it using pip ... --log = /home/user/.pip/pip.log, it seems to work i.e the pip file isn't being re-written but it's being appended to. In the case when pip fails, the log file is being rewritten. – Poruri Sai Rahul Jun 19 '13 at 16:44