jincept jincept - 6 months ago 98
Python Question

Problems installing Pandas

I am unable to install Pandas on my Linux server. I am using virtualenv but I tried installing Pandas without that but no luck.

root@host:~# uname -a
Linux host 3.13.0-61-generic #100-Ubuntu SMP Wed Jul 29 11:21:34 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


Numpy installs with a lot of warnings.

You are using pip version 6.0.8, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting numpy
Using cached numpy-1.11.0.tar.gz
Running from numpy source directory.
Installing collected packages: numpy
Running setup.py install for numpy
...(truncated)
/tmp/pip-build-q8d07pgn/numpy/numpy/distutils/system_info.py:1652: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
warnings.warn(BlasSrcNotFoundError.__doc__)
/tmp/pip-build-q8d07pgn/numpy/numpy/distutils/system_info.py:1542: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
warnings.warn(AtlasNotFoundError.__doc__)
/tmp/pip-build-q8d07pgn/numpy/numpy/distutils/system_info.py:1553: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
warnings.warn(LapackNotFoundError.__doc__)
/tmp/pip-build-q8d07pgn/numpy/numpy/distutils/system_info.py:1556: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
warnings.warn(LapackSrcNotFoundError.__doc__)
/usr/local/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
Successfully installed numpy-1.11.0


Pandas install fails completely:

You are using pip version 6.0.8, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pandas
Using cached pandas-0.18.1.tar.gz
package init file 'pandas/io/tests/sas/__init__.py' not found (or not a regular file)
warning: no directories found matching 'examples'
Requirement already satisfied (use --upgrade to upgrade): python-dateutil>=2 in /usr/local/lib/python3.4/site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in /usr/local/lib/python3.4/site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.0 in /app01/html/jay/.virtualenvs/dj/lib/python3.4/site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /usr/local/lib/python3.4/site-packages (from python-dateutil>=2->pandas)
Installing collected packages: pandas
Running setup.py install for pandas
...(truncated)
`gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app01/html/jay/.virtualenvs/dj/lib/python3.4/site-packages/numpy/core/include -I/usr/local/include/python3.4m -c pandas/src/testing.c -o build/temp.linux-x86_64-3.4/pandas/src/testing.o -Wno-unused-function

gcc -pthread -shared build/temp.linux-x86_64-3.4/pandas/src/testing.o -lm -o build/lib.linux-x86_64-3.4/pandas/_testing.cpython-34m.so

skipping 'pandas/msgpack/_packer.cpp' Cython extension (up-to-date)

building 'pandas.msgpack._packer' extension

creating build/temp.linux-x86_64-3.4/pandas/msgpack

gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -D__LITTLE_ENDIAN__=1 -Ipandas/src/msgpack -Ipandas/src/klib -Ipandas/src -I/app01/html/jay/.virtualenvs/dj/lib/python3.4/site-packages/numpy/core/include -I/usr/local/include/python3.4m -c pandas/msgpack/_packer.cpp -o build/temp.linux-x86_64-3.4/pandas/msgpack/_packer.o -Wno-unused-function

gcc: error trying to exec 'cc1plus': execvp: No such file or directory

error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/app01/html/jay/.virtualenvs/dj/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-oi7a9h9i/pandas/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-e5lrr_if-record/install-record.txt --single-version-externally-managed --compile --install-headers /app01/html/jay/.virtualenvs/dj/include/site/python3.4" failed with error code 1 in /tmp/pip-build-oi7a9h9i/pandas


I tried creating swap file just to eliminate memory issues, that did not help.

I am able to install pandas with

sudo apt-get install python-pandas


But this install pandas for system default Python 2.7. I am using python 3.4 in virtual environment.

Any suggestions?

Answer

I noticed that my errors started with this:

You are using pip version 6.0.8, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting numpy
  Using cached numpy-1.11.0.tar.gz
    Running from numpy source directory.
Installing collected packages: numpy
  Running setup.py install for numpy
Note: if you need reliable uninstall behavior, then install
with pip instead of using `setup.py install`:
  - `pip install .`       (from a git repo or downloaded source
                           release)
  - `pip install numpy`   (last Numpy release on PyPi)

This finally fixed my problem:

Upgrading pip globally (old pip version 6.0.8 to new version 8.1.2):

sudo pip3 install --upgrade pip

In virtualenv,

pip3 install numpy pip3 install pandas