4

I am trying to install pyproj. I downloaded the zip folder on this page pyproj.

Then I copied it to C:\Python27\ArcGIS10.3\Lib. However, when I try to import the module, I get the message ImportError: No module named pyproj.

I also tried to run the setup.py, but I get the message ImportError: No module named setuptools. I read somewher that it is working when I install Basemap, which is part of Matplotlib, but I cannot find pyproj there. Any help?

  • 1
    Have you tried it in C:\Python27\ArcGIS10.3\Lib\site-packages? – countryman Jan 26 '16 at 14:16
  • Yes, I tried that first but without success. – Alex Jan 27 '16 at 8:33
7

For that, you must know the real Python world and the modern way to install modules.

1) The pyproj module needs the compilation of many C libraries and Windows has no compiler by default as in Linux or Mac OS X so you can't install the module with setuptools , easy_install or pip, the traditional way to install modules or unzipping the folder in C:\Python27\ArcGIS10.x\Lib\site-packages :

2) Christoph Gohlke's Unofficial Windows Binaries for Python Extension Packages has a pyproj compiled version ready for Windows but it is a ,whl file (pyproj-1.9.5-cp27-none-win32.whl)

Therefore, you need to install pip (How do I install pip on Windows?) and after Window: How do I install a Python package with a .whl file?

Then

pip install pyproj-1.9.5-cp27-none-win32.whl

or other whl file (pyproj-1.9.5-cp27-none-win_amd64.whl)

New

To install a Python module (in the site-packages of the Python installation):

a) if it is a simple pure Python module (geojson for example)

1) the classical way
- unzip the zip file (or tgz or)
- open a terminal or a command window in the unzipped folder and

python setup.py install 

You need setuptools if you want to manage all the eventual dependencies automatically (download and installation)

2) the new way (directly from Internet and you need setuptools)
- easy_install geojson
- pip install geojson

They install all the eventual dependencies automatically.

3) you can unzip the file and copy the resulting folder in the site-package folder but there is no management of the eventual dependencies.

b) if it is a complicated module or a module with C libraries (pyproj) or Fortran or...

1) this solution needs a compiler available to compile the C files into .dll or .pyd files (for Windows)
2) same for easy_install or pure pip install
3) you cannot simply copy the resulting folder (no compiled files)
4) the solution of pip and the .whl files

A wheel is a ZIP-format archive with a specially formatted filename and the .whl extension.

It is designed to contain all the necessary files. The contents of pyproj-1.9.5-cp27-none-win32.whl is

enter image description here

You recognize a .pyd file. You can try
- pip install pyproj -> it works if pip can download an adequate .whl file (for Windows) from the Python Package Index
- pip install pyproj-1.9.5-cp27-none-win32.whl -> the file downloaded
- unzipping the whl file in the site-packages folder -> no eventual dependencies management

c) With Anaconda

You can use the solutions 1), 2), 3) and 4) but Anaconda uses another package manager conda easier for the beginners
- conda install pyproj with the management of all the dependencies

If the Python version are the same (Python 2.7.x, 32 or 64 bits) you can try to copy the pyproj folder from the Anaconda distribution to the ArcGIS Python distribution.

  • I tried option 1) yesterday and today again. However, I am kind of stuck. I tried the unzipped folder, but there is no init.py. And I tried the pyproj folder which is in the folder lib, which is in the unzipped pyproj folder. The first option doesn't work as there is the missing init.py and the second option doesn't work as the _int.py doesn't manage to import the right scripts. I will try option 2) now, but I would like to manage option 1) aswell. Any suggestions what I am doing wrong? – Alex Jan 27 '16 at 8:40
  • Well, option 2) worked, but only as I had installed Anaconda first as the python directory of anaconda was recognized but not of ArcGIS. It still would be nice to go without whl. – Alex Jan 27 '16 at 10:24
  • You don't need option 2) with Anaconda, simply use conda install pyproj . With ArcPy, you need to install pip in the Python distribution of ArcGIS and, sorry, but the whl format is becoming a standard in the Python world. – gene Jan 27 '16 at 15:54
  • Ok, thanks. So, I guess I can live with whl-files. I just thought as it is an unoffical binary...and I always thought you just need to copy a folder into the python directory to "install" a python module...However could you please give me same more details about option 1? – Alex Jan 28 '16 at 8:05
  • look in my answer, please – gene Jan 28 '16 at 17:52

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.