Ubuntu – Problems installing pandas

dependenciespackage-managementpythonsoftware installation

I am trying to install pandas on Ubuntu 14.04. I seem to have a problem with dependencies, but I haven't been able to install them. I am trying to install pandas via pip as follows:

vroni@zargedu4:~$ pip install pandas

And this is the error message:

SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.

If I try to install python-dev this happens:

vroni@zargedu4:~$ sudo apt-get install python-dev
python-dev :Depends: libpython-dev (= 2.7.5-5ubuntu3) but it is not installable
            Depends: python2.7-dev (>= 2.7.5-1~) but it is not installable

It basically misses these dependencies. Trying to install them only leads me to new messages like this.

vroni@zargedu4:~$ sudo apt-get install libpython-dev
libpython-dev : Depends: libpython2.7-dev (>= 2.7.5-1~) but it is not installable

and so on.

vroni@zargedu4:~$ sudo apt-get install libpython2.7-dev
libpython2.7-dev : Depends: libpython2.7-stdlib (= 2.7.6-8) but 2.7.6-8ubuntu0.2 should be installed
                Depends: libpython2.7 (= 2.7.6-8) but 2.7.6-8ubuntu0.2 should be installed
                Depends: libexpat1-dev but it is not installable

until I try..

vroni@zargedu4:~$ sudo apt-get install libpython2.7-stdlib=2.7.6-8ubuntu0.2

Then the answer is: it is already the newest version.

libpython2.7-stdlib is already the newest version.

I don't quite understand what's the problem here. I also tried:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -f

and

sudo apt-get -f install

and afterwards tried to install pandas again. but nothing seems to work.

Best Answer

Pandas is in the default repositories for all currently supported versions of Ubuntu. To install it open the terminal and type:

sudo apt install python-pandas  # for Python 2.x in Ubuntu 18.04 and earlier 

or

sudo apt install python3-pandas # for Python 3.x  

pandas is a Python package providing fast, flexible, and expressive data structures designed to make working with "relational" or "labeled" data both easy and intuitive. It aims to be the fundamental high-level building block for doing practical, real world data analysis in Python.

Related Question