pyproj: pyproj.Proj(..) raising RuntimeError: 'Invalid argument'

I have problems with the latest version of pyproj:

>>> import pyproj
>>> pyproj.__version__
'1.9.4'
>>> pyproj.Proj('+init=epsg:4326 +no_defs=True')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda\envs\test_pyproj3\lib\site-packages\pyproj\__init__.py", lin
e 347, in __new__
    return _proj.Proj.__new__(self, projstring)
  File "_proj.pyx", line 84, in _proj.Proj.__cinit__ (_proj.c:1190)
RuntimeError: b'Invalid argument'

I am on Windows and installed pyproj using conda. I was wondering if this was an error in the conda package, but I tried several different packages (the default channel + ioos and JimInCO channels), but got the same error for all. When downgrading to 1.9.3 (available in the JimInCO channel for win64), the error was gone.

The above was with python 3.4. On python 2.7, I see the same error with the default package of 1.9.4 (but it works for 1.9.2), and here, the ioos package of 1.9.4 also works.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 21 (4 by maintainers)

Most upvoted comments

I think can replicate what @joernu76 describes, with miniconda on Windows:

pyproj                    1.9.5.1          py36haf3c679_3    conda-forge

Copying the files from ...\Library\share to ...\share\proj as a workaround seems to fix my install.

I may have a related, new problem on Anaconda3 Windows with version 1.9.5.1-py36hb98d9bb_1 The value of pyproj.datadir.pyproj_datadir is

“C:/Users/icg174/Anaconda3\share\proj”

while the data is actually located in

C:/Users/icg174/Anaconda3/Library/share/

so both the formatting of the path seperators is off and the reference to the PROJ_DIR is missing as well as that there is a discrepancy between the listed and actual data path.

The last build version 1.9.5.1-py36_0 has the data files in a subdirectory of the package and also checks on the value of PROJ_DIR.

I had the same issue and resolved it by installed the conda package from anaconda.org as follows:

conda install -c https://conda.anaconda.org/ioos pyproj

I ran into this problem in 64 bit Windows 10, Python 2.7. I had installed pyproj from the ioos channel as others have suggested and received version 1.9.4. This did not work for me - I got the same error mentioned in the original post.

I went with a different solution: upgrade pyproj to 1.9.5 using the .whl file available on Christoph Gohlke’s website. It’s not very neat, but it did the job.