Installing Pandas in ArcPy

9310
5
03-02-2015 01:30 AM
Leo_KrisPalao
New Contributor II

Hi Arcpy Users,

Just want to inquire how can I properly install Pandas python package in ArcPy. I am having a hard time installing it. I just wanted to get the pandas to work so I can work easier with my CSV.

Is this has something to do with my pip installation?

Thanks,

-Leo

I am using this command:

>>> pip install pandas

and it returns this message:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.


C:\Users\lpalao>pip install pandas
Traceback (most recent call last):
  File "C:\Python27\ArcGIS10.2\Scripts\pip-script.py", line 9, in <module>
    load_entry_point('pip==6.0.8', 'console_scripts', 'pip')()
  File "build\bdist.win32\egg\pkg_resources.py", line 339, in load_entry_point
  File "build\bdist.win32\egg\pkg_resources.py", line 2470, in load_entry_point
  File "build\bdist.win32\egg\pkg_resources.py", line 2184, in load
  File "C:\Python27\ArcGIS10.2\lib\site-packages\pip-6.0.8-py2.7.egg\pip\__init__.py", line 13, in <
module>
    from pip.utils import get_installed_distributions, get_prog
  File "C:\Python27\ArcGIS10.2\lib\site-packages\pip-6.0.8-py2.7.egg\pip\utils\__init__.py", line 22
, in <module>
    from pip._vendor import pkg_resources, six
  File "C:\Python27\ArcGIS10.2\lib\site-packages\pip-6.0.8-py2.7.egg\pip\_vendor\__init__.py", line
61, in load_module
    __import__(name)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\pip-6.0.8-py2.7.egg\pip\_vendor\pkg_resources\__ini
t__.py", line 79, in <module>
    import pip._vendor.packaging.specifiers
  File "C:\Python27\ArcGIS10.2\lib\site-packages\pip-6.0.8-py2.7.egg\pip\_vendor\packaging\specifier
s.py", line 274, in <module>
    class Specifier(_IndividualSpecifier):
  File "C:\Python27\ArcGIS10.2\lib\site-packages\pip-6.0.8-py2.7.egg\pip\_vendor\packaging\specifier
s.py", line 373, in Specifier
    re.VERBOSE | re.IGNORECASE,
  File "C:\Python27\ArcGIS10.2\lib\re.py", line 190, in compile
    return _compile(pattern, flags)
  File "C:\Python27\ArcGIS10.2\lib\re.py", line 242, in _compile
    raise error, v # invalid expression
sre_constants.error: nothing to repeat

Then when I import pandas (>>> import pandas) it returns the message below:

>>> import numpy
>>> import pandas
numpy.ufunc has the wrong size, try recompiling
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Python27\ArcGIS10.2\lib\site-packages\pandas-0.15.2-py2.7-win32.egg\pandas\__init__.py", line 7, in <module>
    from . import hashtable, tslib, lib
  File "pandas\src\numpy.pxd", line 865, in init pandas.hashtable (pandas\hashtable.c:22988)
ValueError: numpy.ufunc has the wrong size, try recompiling
0 Kudos
5 Replies
DanPatterson_Retired
MVP Emeritus

An alternate site, but here are the requirements from this page

http://www.lfd.uci.edu/~gohlke/pythonlibs/

I don't use it, but I have installed other modules from this site with no problem

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

In you want to start branching out into installing additional Python packages, I encourage you to read Installing Packages from the Python Packing User Guide

0 Kudos
NathanielRoth
New Contributor III

I found that to successfully install pandas for use with ArcGIS 10.3 I had to install a newer version of numpy (upgrade from 1.7 to 1.9). In doing that, I had to make sure to use pip in a command window with administrative permissions.

0 Kudos
KerryAlley
Occasional Contributor

If you are ok with using an older version of pandas, the installation process I used was relatively simple:

I installed pandas by running an executable installation file (built with distutils) downloaded from pypi.python.org via download links on the pandas homepage​.  The key for me was choosing an older version of pandas that was built using the same version of NumPy that I was already running.

To find out what version of numpy you are running, import NumPy and then type:

numpy.version.full_version

Although pandas 15.2 is the latest release, it (the executable installation file) requires NumPy 1.8.1.  I'm running ArcMap 10.2 which comes with NumPy 1.7.1.  I browsed through the older releases of pandas (listed on the right hand pandas homepage) until I found a release that was based on NumPy 1.7.1, which happened to be pandas 12.0​.  It was only later that I realized that the pandas 13.0 and 13.1 were also based on NumPy 1.7.1, but I didn't bother to change it.

Although python-dateutil and pytz are listed as pandas 15.2 dependencies, I think they aren't for pandas 12.0 since I didn't bother installing them.

I hope that helps!

Kerry

NathanielRoth
New Contributor III

Having played with it fairly intensively for a few days now, I've had no issues with upgrading the numpy version installed as part of my arcgis python install to 1.9.

0 Kudos