R crashes when reading geopackage files with st_read (sf package) in macOS

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

R crashes when reading geopackage files with st_read (sf package) in macOS

Manuel Spínola
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: R crashes when reading geopackage files with st_read (sf package) in macOS

Roger Bivand
Administrator
Please refer to the associated sf issue on github: https://github.com/r-spatial/sf/issues/1606 for completeness. Please confirm that you are not using the MacOS sf CRAN binary package, but have installed GDAL, PROJ and GEOS yourself. Please also confirm that you see the same error with every GPKG file.

--
Roger Bivand
Norwegian School of Economics
Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway
[hidden email]


________________________________________
Fra: R-sig-Geo <[hidden email]> på vegne av Manuel Spínola <[hidden email]>
Sendt: onsdag 31. mars 2021 17.55
Til: r-sig-geo
Emne: [R-sig-Geo] R crashes when reading geopackage files with st_read (sf package) in macOS

Dear list members,

When reading geopackages files with st_read (sf package) RStudio crashes (R
session aborted) in macOS.  Any suggestions to fix this problem?

Should I ask this question to the macOS group (r-sig-mac)?

library(sf)
Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1


library(spData)


world = st_read(system.file("shapes/world.gpkg", package = "spData"))




--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
[hidden email] <[hidden email]>
[hidden email]
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: R crashes when reading geopackage files with st_read (sf package) in macOS

Roger Bivand
Administrator
Further, with R 4.0.4 on Rosetta but with CRAN binary packages, there is no problem. It is most likely that the problem is caused by user-installed upstream software components, and sf or rgdal installed from source, possibly with libsqlite3 also installed from source. Please report back if any other drivers fail - RSQLite does not use local binaries, but bundles the software library itself.

--
Roger Bivand
Norwegian School of Economics
Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway
[hidden email]


________________________________________
Fra: R-sig-Geo <[hidden email]> på vegne av Roger Bivand <[hidden email]>
Sendt: onsdag 31. mars 2021 18.25
Til: Manuel Spínola; r-sig-geo
Emne: Re: [R-sig-Geo]  R crashes when reading geopackage files with st_read (sf package) in macOS

Please refer to the associated sf issue on github: https://github.com/r-spatial/sf/issues/1606 for completeness. Please confirm that you are not using the MacOS sf CRAN binary package, but have installed GDAL, PROJ and GEOS yourself. Please also confirm that you see the same error with every GPKG file.

--
Roger Bivand
Norwegian School of Economics
Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway
[hidden email]


________________________________________
Fra: R-sig-Geo <[hidden email]> på vegne av Manuel Spínola <[hidden email]>
Sendt: onsdag 31. mars 2021 17.55
Til: r-sig-geo
Emne: [R-sig-Geo] R crashes when reading geopackage files with st_read (sf package) in macOS

Dear list members,

When reading geopackages files with st_read (sf package) RStudio crashes (R
session aborted) in macOS.  Any suggestions to fix this problem?

Should I ask this question to the macOS group (r-sig-mac)?

library(sf)
Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1


library(spData)


world = st_read(system.file("shapes/world.gpkg", package = "spData"))




--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
[hidden email] <[hidden email]>
[hidden email]
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: R crashes when reading geopackage files with st_read (sf package) in macOS

Manuel Spínola
In reply to this post by Roger Bivand
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: R crashes when reading geopackage files with st_read (sf package) in macOS

Roger Bivand
Administrator
On Wed, 31 Mar 2021, Manuel Spínola wrote:

> Thank you very much Roger.
>
> I reinstalled the sf and rgdal packages from binaries and the problem
> persisted.

This must be either because you did not remove all of the traces of the
previous attempts. If sf failed, then
https://cran.r-project.org/web/checks/check_results_sf.html
would show errors for MacOS.

>
> To install GDAL, PROJ and GEOS i followed the instructions in the sf github
> site.

Please avoid installing the source package unless there is functionality
not provided by the CRAN binary.

>
> Yes, the problem is with several geopackages files.  I see the problem also
> with st_write when working trying to save a file in geopackage format.
>

Which other drivers are affected - if only GPKG, then libsqlite3 is the
most likely culprit. However, unless you must have facilities only
available by source install, avoid source installs.

> I can read the files without problem with readOGR.
>

Installed as the CRAN binary or source?

Roger

> Manuel
>
> El mié, 31 mar 2021 a las 10:26, Roger Bivand (<[hidden email]>)
> escribió:
>
>> Please refer to the associated sf issue on github:
>> https://github.com/r-spatial/sf/issues/1606 for completeness. Please
>> confirm that you are not using the MacOS sf CRAN binary package, but have
>> installed GDAL, PROJ and GEOS yourself. Please also confirm that you see
>> the same error with every GPKG file.
>>
>> --
>> Roger Bivand
>> Norwegian School of Economics
>> Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway
>> [hidden email]
>>
>>
>> ________________________________________
>> Fra: R-sig-Geo <[hidden email]> på vegne av Manuel
>> Spínola <[hidden email]>
>> Sendt: onsdag 31. mars 2021 17.55
>> Til: r-sig-geo
>> Emne: [R-sig-Geo] R crashes when reading geopackage files with st_read (sf
>> package) in macOS
>>
>> Dear list members,
>>
>> When reading geopackages files with st_read (sf package) RStudio crashes (R
>> session aborted) in macOS.  Any suggestions to fix this problem?
>>
>> Should I ask this question to the macOS group (r-sig-mac)?
>>
>> library(sf)
>> Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
>>
>>
>> library(spData)
>>
>>
>> world = st_read(system.file("shapes/world.gpkg", package = "spData"))
>>
>>
>>
>>
>> --
>> *Manuel Spínola, Ph.D.*
>> Instituto Internacional en Conservación y Manejo de Vida Silvestre
>> Universidad Nacional
>> Apartado 1350-3000
>> Heredia
>> COSTA RICA
>> [hidden email] <[hidden email]>
>> [hidden email]
>> Teléfono: (506) 8706 - 4662
>> Personal website: Lobito de río <
>> https://sites.google.com/site/lobitoderio/>
>> Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway.
e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: R crashes when reading geopackage files with st_read (sf package) in macOS

Manuel Spínola
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: R crashes when reading geopackage files with st_read (sf package) in macOS

Roger Bivand
Administrator
On Wed, 31 Mar 2021, Manuel Spínola wrote:

> Thank you very much Roger.
>
> I can read shapefile without any problem with st_read.
>
> I think it works for both versions, but definitely is working with the
> binary version.

I really feel that you should remove all traces of your source installs of
PROJ, GDAL and GEOS and anything they installed, and should rely only on
CRAN binary packages. Do not accept any suggestions to install R packages
from source. However, if other software that you use regularly needs PROJ,
GDAL, GEOS, they may be present and may interfere with R packages. CRAN
binary packages are built static, so do not need other dylibs, but have
files under share/ in their own space that may conflict.

>
> How can I work around the problem with libsqlite3?

How was the version of libsqlite3 that GDAL links to installed? How would
one

>
> How can I install the GDAL, PROJ and GEOS without being from source?
>

What do you need them for - if only for R packages, just don't install
them.

A further alternative - consider installing from

https://r-spatial.r-universe.dev/ui#builds

These track the development versions of packages, but should be OK.

Please report back whether any of these can read (and write) GPKG.

Roger

> Best,
>
> Manuel
>
>
> El mié, 31 mar 2021 a las 13:07, Roger Bivand (<[hidden email]>)
> escribió:
>
>> On Wed, 31 Mar 2021, Manuel Spínola wrote:
>>
>>> Thank you very much Roger.
>>>
>>> I reinstalled the sf and rgdal packages from binaries and the problem
>>> persisted.
>>
>> This must be either because you did not remove all of the traces of the
>> previous attempts. If sf failed, then
>> https://cran.r-project.org/web/checks/check_results_sf.html
>> would show errors for MacOS.
>>
>>>
>>> To install GDAL, PROJ and GEOS i followed the instructions in the sf
>> github
>>> site.
>>
>> Please avoid installing the source package unless there is functionality
>> not provided by the CRAN binary.
>>
>>>
>>> Yes, the problem is with several geopackages files.  I see the problem
>> also
>>> with st_write when working trying to save a file in geopackage format.
>>>
>>
>> Which other drivers are affected - if only GPKG, then libsqlite3 is the
>> most likely culprit. However, unless you must have facilities only
>> available by source install, avoid source installs.
>>
>>> I can read the files without problem with readOGR.
>>>
>>
>> Installed as the CRAN binary or source?
>>
>> Roger
>>
>>> Manuel
>>>
>>> El mié, 31 mar 2021 a las 10:26, Roger Bivand (<[hidden email]>)
>>> escribió:
>>>
>>>> Please refer to the associated sf issue on github:
>>>> https://github.com/r-spatial/sf/issues/1606 for completeness. Please
>>>> confirm that you are not using the MacOS sf CRAN binary package, but
>> have
>>>> installed GDAL, PROJ and GEOS yourself. Please also confirm that you see
>>>> the same error with every GPKG file.
>>>>
>>>> --
>>>> Roger Bivand
>>>> Norwegian School of Economics
>>>> Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway
>>>> [hidden email]
>>>>
>>>>
>>>> ________________________________________
>>>> Fra: R-sig-Geo <[hidden email]> på vegne av Manuel
>>>> Spínola <[hidden email]>
>>>> Sendt: onsdag 31. mars 2021 17.55
>>>> Til: r-sig-geo
>>>> Emne: [R-sig-Geo] R crashes when reading geopackage files with st_read
>> (sf
>>>> package) in macOS
>>>>
>>>> Dear list members,
>>>>
>>>> When reading geopackages files with st_read (sf package) RStudio
>> crashes (R
>>>> session aborted) in macOS.  Any suggestions to fix this problem?
>>>>
>>>> Should I ask this question to the macOS group (r-sig-mac)?
>>>>
>>>> library(sf)
>>>> Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
>>>>
>>>>
>>>> library(spData)
>>>>
>>>>
>>>> world = st_read(system.file("shapes/world.gpkg", package = "spData"))
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Manuel Spínola, Ph.D.*
>>>> Instituto Internacional en Conservación y Manejo de Vida Silvestre
>>>> Universidad Nacional
>>>> Apartado 1350-3000
>>>> Heredia
>>>> COSTA RICA
>>>> [hidden email] <[hidden email]>
>>>> [hidden email]
>>>> Teléfono: (506) 8706 - 4662
>>>> Personal website: Lobito de río <
>>>> https://sites.google.com/site/lobitoderio/>
>>>> Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
>>>>
>>>>         [[alternative HTML version deleted]]
>>>>
>>>> _______________________________________________
>>>> R-sig-Geo mailing list
>>>> [hidden email]
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>>
>>>
>>>
>>>
>>
>> --
>> Roger Bivand
>> Department of Economics, Norwegian School of Economics,
>> Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway.
>> e-mail: [hidden email]
>> https://orcid.org/0000-0003-2392-6140
>> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
>
>
>
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway.
e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway