3

I have downloaded pandas from this site then unzipped it in site-packages and run python setup.py for installing pandas.

Pandas was installed successfully.

After that I tried importing pandas into the Python window of ArcMap and it gives me the following error.

>>> import pandas
Runtime error 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named pandas
7

Pandas requires compilation. If you don't have an appropriate compiler and build dependencies installed, you'll need to install a precompiled version.

Pandas depends on numpy. The Numpy application binary interface (ABI) is not forward compatible which means you can't use a version of Pandas that was compiled against a later version of numpy even though the application programming interface (API) is compatible.

Current versions of Pandas were compiled against numpy 1.8.1, so you can use them in ArcGIS 10.4 which requires numpy 1.9.2. This means you can use the methods described in Gene's answer.

However, ArcGIS 10.2 and 10.3 require numpy 1.7.1. Although the current versions of pandas are compatible with the numpy 1.7+ API, as they were compiled against numpy 1.8.1, they will not work with the numpy 1.7.1 installed by ArcGIS. If you install a newer version that was compiled against numpy 1.8.1, importing pandas will fail with the exception: ValueError: numpy.dtype has the wrong size, try recompiling.

If you want to install Pandas to use with ArcGIS 10.2 and 10.3, you need to use the older version 0.13 that was compiled against numpy 1.7.1. This version can't be installed with pip. Instead, download the appropriate installer executable and run it manually.

And please note that upgrading numpy is dangerous and you are likely to break your ArcGIS installation if you try (unless you set up a virtualenv).

  • This is the medicine for arcmap indeed! thanks luke :) – SIslam Aug 12 '16 at 19:15
4

You don't install pandas with pip, you use the classical python setup.py installinstead (see How can I install pyproj into arcpy?)

If you installed it with pip the command would have been:

pip install pandas # automatic download and installation

With Windows and ArcPy, they are problems when you want to install a module with C dependencies with setup.py install

  • pandas needs the compilation of many C libraries and Windows has no compiler by default
  • pandas depends on a specific version of Numpy (Windows binaries built against NumPy 1.8.1)

Therefore you can install it with setup.py

That is why whl-files were created (pandas-0.17.1-cp27-none-win32.whl for example)

If you have pip (How do I install pip on Windows?) and whl (Window: How do I install a Python package with a .whl file?) installed

The classic Python solution is (but it is not valid for ArcPy, look at the comments and the answer of Luke) :

pip install pandas -> download and install the adequate whl file

Or download pandas-0.17.1-cp27-none-win32.whl or pandas-0.17.1-cp27-none-win_amd64.whl and

pip install pandas-0.17.1-cp27-none-win32.whl -> install the whl file
  • 2
    If using ArcGIS 10.2 or 10.3, you need precompiled pandas 0.13 which is built against numpy 1.7.1 pypi.python.org/pypi/pandas/0.13.1 or you'll get a ValueError: numpy.dtype has the wrong size, try recompiling exception. – user2856 Mar 12 '16 at 18:37
  • I don't use Windows, nor ArcPy, sorry and thanks for the precision for ArcPy users (the version of Numpy is very old -> Numpy 1.10.x now) – gene Mar 12 '16 at 18:50
  • 1
    Don't do it! You might end up having to reinstall ArcGIS. Follow Luke's suggestion. – Tom Mar 12 '16 at 20:29
  • 1
    @gene, my comment was in reference to your entire answer, not to your comment that the numpy version is old. Your answer will not work with an ArcGIS installation of Python. In fact, it will break the ArcGIS installation (including Python). – Tom Mar 14 '16 at 14:34
  • 1
    not very "pythonic" the ArcGIS installation of Python... – gene Mar 14 '16 at 15:58
1

I have ArcGIS 10.3 and Windows 7 and this is how i installed Pandas:

  1. Install pip: I followed Installing Packages, under section "Install pip, setuptools, and Wheel" -> "Otherwise". So i downloaded get-pip.py, opened windows command prompt, navigated to C:\Python27\ArcGIS10.3 and typed python C:\path\to\file\get-pip.py
  2. Install pandas: In windows command prompt i entered python -m pip install pandas. This installed a newer version of numpy and pandas

I can now use pandas in ArcMap python console and in imported scripts in Modelbuilder. So I did not need to specify any particular version of pandas or numpy for it to work.

-1

If you use PyCharm go to: File | Settings

then from setting window click Project then Project Interpreter then add pandas package

  • Welcome to GIS SE! As a new user be sure to take the Tour to learn about our focussed Q&A format. There is no mention of PyCharm being used in the question, and instead the user appears to be trying to do this from the Python Window of ArcMap. – PolyGeo Sep 20 '18 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.