0

I am currently struggling to get pyproj to initialize when running in PyCharm. Oddly enough, I am able to get it to work in cmd.

The version of pyproj I am using is 1.9.6, and the version of proj4 I am using is 5.2.0.

The following runs without error using the Python interpreter:

import pyproj
pyproj.Proj({'init': 'epsg:26910'})

However, when running from PyCharm the following error is produced:

Traceback (most recent call last):
  File "C:/Users/frankbr/.PyCharmCE2019.2/config/scratches/scratch.py", line 5, in <module>
    pyproj.Proj({'init': 'epsg:26910'})
  File "C:\Users\frankbr\.conda\envs\pyfor_env\lib\site-packages\pyproj\__init__.py", line 362, in __new__
    return _proj.Proj.__new__(self, projstring)
  File "_proj.pyx", line 129, in _proj.Proj.__cinit__
RuntimeError: b'no arguments in initialization list'

Due to other dependencies, and the fact that it runs in cmd (and Travis tests) without error, I am hoping to find a solution that only requires modification to PyCharm.

0

The environmental variable PROJ_LIB needed to be set to the location of the files used by the proj library. In my case that was in the following directory:

'C:\\Users\\frankbr\\.conda\\envs\\pyfor_env\\Library\\share'

Editing the build configuration in PyCharm allows for modification of environmental variables. See this tutorial.

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.