[gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles

Jonathan Moules jonathan-lists at lightpear.com
Wed Oct 11 06:18:00 PDT 2023


Hi List,

So, after more investigation:

* Using Python Anaconda on either Mac or Linux for GDAL (3.7.1), 
`GetSpatialRef` triggers a RunTime Error for all shapefiles (but only 
shapefiles).

* This happens on Ubuntu (two machines), and a Mac, but only under PyCharm.

* Using the exact same `conda` environment as triggers the above: 
running it directly from the terminal works fine.

So there's something about the combination of conda and Pycharm that 
breaks this aspect of GDAL shapefile handling on *nix and Mac.

Any thoughts? Also, who do I actually report this bug to? Is it GDAL, 
Conda, Pycharm, something else?

Cheers,

Jonathan


On 2023-09-28 14:58, Jonathan Moules via gdal-dev wrote:
> Well, it seems that PROJ_DATA isn't set in their environment. But it's 
> not set in mine either (`print(os.environ['PROJ_DATA']`)! So no idea 
> why mine works just fine without it (Windows 11 thing?).
>
> Creating a PROJ_DATA env var didn't fix anything. Even adding it 
> explicitly in Python.
>
> Their log file does have this in at a WARNING level:
>
> `PROJ: proj_create_from_database: Open of 
> /home/user/anaconda3/envs/env1/share/proj failed`
>
> That path has: `drwxrwxr-x` permissions.
>
> To answer Even's earlier question:
>
> `ogrinfo /path/to/shape.shp` works fine on their system.
>
>
>
> On 2023-09-28 12:37, Rahkonen Jukka wrote:
>> Hi,
>>
>> Then they should add that environment if they do not know that they 
>> do not belong to "most users" 
>> https://proj.org/en/9.3/usage/environmentvars.html
>>
>> -Jukka Rahkonen-
>>
>> -----Alkuperäinen viesti-----
>> Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> Puolesta 
>> Jonathan Moules via gdal-dev
>> Lähetetty: torstai 28. syyskuuta 2023 14.10
>> Vastaanottaja: gdal-dev at lists.osgeo.org; Even Rouault 
>> <even.rouault at spatialys.com>
>> Aihe: Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
>>
>> Hi Even,
>>
>> The colleague doesn't have either a PROJ_LIB or a PROJ_DATA 
>> environment variable.
>>
>> I asked another colleague to try it; they're on Ubuntu 20.04, and it 
>> worked for them. I believe using the same setup instructions.
>>
>> Cheers,
>>
>> Jonathan
>>
>> On 2023-09-24 22:37, Jonathan Moules via gdal-dev wrote:
>>> Thanks Even. I don't have access to the machine either as the
>>> colleague is moving to another project. I'll have to see if it fails
>>> for another *nix user.
>>>
>>> On 2023-09-24 22:35, Even Rouault wrote:
>>>> Le 24/09/2023 à 23:22, Jonathan Moules via gdal-dev a écrit :
>>>>>> Also check if the environment isn't messed up regarding PROJ and
>>>>> the PROJ_LIB/PROJ_DATA environment variable
>>>>>
>>>>> Thanks Even; sorry, what does this line mean? I'm guessing you're
>>>>> referring to:
>>>>> https://proj.org/en/9.3/usage/environmentvars.html - what would a 
>>>>> "messed up" one look like?
>>>>>
>>>> Hard to say without access to the machine. Perhaps just try to
>>>> recreate a new Conda env from scratch
>>>>
>>>>
>>> _______________________________________________
>>> gdal-dev mailing list
>>> gdal-dev at lists.osgeo.org
>>> https://list/
>>> s.osgeo.org%2Fmailman%2Flistinfo%2Fgdal-dev&data=05%7C01%7Cjukka.rahko
>>> nen%40maanmittauslaitos.fi%7C1f6517888cb34fa40aed08dbc01389dd%7Cc4f8a6
>>> 3255804a1c92371d5a571b71fa%7C0%7C0%7C638314962370381350%7CUnknown%7CTW
>>> FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6
>>> Mn0%3D%7C3000%7C%7C%7C&sdata=3fVru6K6Ndpkv35FnAbMOlT%2BM96USO7wywqx550
>>> uRUs%3D&reserved=0
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list