RuntimeError: b'no arguments in initialization list'

可紊 提交于 2019-12-05 11:48:36
Trish

Is there an initial crs defined? I ran into the same problem only when I passed only the epsg command: gdf.to_crs('epsg:4326').

As you show

my_geoseries.crs = {'init' :'epsg:3857'}

should be the first step and then transforming to

gdf = gdf.to_crs({'init': 'epsg:4326'})

If you are working in ArcGIS you could also check in the properties whether the initial epsg is defined ?

great that was the answer thank you

Stone Shi

to make sure this is pyproj error rather than geopandas.

import pyproj
pyproj.Proj("+init=epsg:4326")

if the above runtime error is the same, we can be sure this error is due to pyproj.

just conda remove pyproj and install it with pip.

pip install pyproj

at least this works for me.

Today(July 30), I resintalled from miniconda, conda remove pyproj did not work for me, instead I pip uninstall pyproj and pip install pyproj makes everything fine.

The problem is problably within the pyproj instalation of Anaconda on Windows platform. Just like Stephen said, solution is to edit the path in "datadir.py" (located in ...Anaconda3\Lib\site-packages\pyproj).

Correct path is ".../Anaconda3/Library/share". Make sure full path is complete (may contain username etc.). I also needed to change \ to /. This change worked for me. Yes and after this change, it is necesary to restart Spyder (or whatever you use).

I'm using Pycharm. I had to use a combination of both Stone Shi's remark and Dorregaray's.

import pyproj
pyproj.Proj("+init=epsg:4326")
> RuntimeError: b'no arguments in initialization list'

According to Stone Shi, the above proves that it's a pyproj err. So I used Pycharm->Settings and reinstalled pyproj. Then

import pyproj
pyproj.Proj("+init=epsg:4326")
> RuntimeError: b'no arguments in initialization list'

So, it's a pyproj err but Pycharm->Settings reinstalling pyproj does not help me.

I then edited my C:\Anaconda3\Lib\site-packages\pyproj\datadir.py from:

pyproj_datadir="C:/Anaconda3\share\proj"

to Dorregaray's:

pyproj_datadir="C:\Anaconda3\Library\share"

Then test again:

import pyproj
pyproj.Proj("+init=epsg:4326")
>Process finished with exit code 0

No Runtime Error!

Then test on my

wgs84  = data.to_crs({'init': 'epsg:4269'})
>Process finished with exit code 0
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!