Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package or namespace load failed for 'sf' in dyn.load #1158

Closed
boboshaq opened this issue Sep 27, 2019 · 6 comments
Closed

package or namespace load failed for 'sf' in dyn.load #1158

boboshaq opened this issue Sep 27, 2019 · 6 comments

Comments

@boboshaq
Copy link

Hi,
when I try install sf package I get error:

Error: package or namespace load failed for 'sf' in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/user/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-sf/00new/sf/libs/sf.so':
  /home/user/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-sf/00new/sf/libs/sf.so: undefined symbol: _Z33OGRCreateCoordinateTransformationP19OGRSpatialReferenceS0_
Error: loading failed
Execution halted
ERROR: loading failed

I have Centos 7.7 with gdal-2.4.2, proj-6.2.0, pkgconfig-0.27.1, R-3.6.0.
What can I do, to install package "sf" successfully ?

@rsbivand
Copy link
Member

Read the README about multiple installations of external libraries. You have multiple versions of GDAL on your system.

@boboshaq
Copy link
Author

I read this post, but I don't understand what I should do to fix this problem.
I have those multiple libraries i /usr/lib64 :

libgeos-3.4.2.so
libgeos.so -> libgeos-3.4.2.so
libgeos_c.so -> libgeos_c.so.1.8.2
libgeos_c.so.1 -> libgeos_c.so.1.8.2
libgeos_c.so.1.8.2

I should just remove one of them?
How to remove GDAL instalation from system?

@boboshaq
Copy link
Author

boboshaq commented Oct 1, 2019

OK I delete all files created during installation proj and gdal from /usr/local/bin,etc,include,lib,lib64,share and I run installation again. It help me.

Instalation package SF on Centos 7 is very difficult, because proj and gdal are very old in repositories and You must install them from sources. Then You must edit /etc/ld.so.conf file and create PKG_CONFIG_PATH environment variable before instalation starts. Then, in R, You must specify paths to specific files from proj instalation folder, for eg.: install.packages("sf", configure.args = "--with-proj-include=/proj_home/include --with-proj-lib=/proj_home/lib --with-proj-api=no")
To understand this, it take me about 3 weeks !! Maybe You should create some HOWTO manual for installation SF on Centos 7.
Regards!

@beedawg1985
Copy link

@boboshaq Im attempting to install sf on Centos 7 and running into problems. I've overcome most but am left with:

Error: package or namespace load failed for ‘sf’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/.../x86_64-redhat-linux-gnu-library/3.6/sf/libs/sf.so':
  /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /anaconda/envs/py35/lib/libpng16.so.16)

Did you find a way to get around this one?!

@boboshaq
Copy link
Author

Hi,
It was a long time ago, so I don't remember exactly how I was doing it. I may tell you steps that I take.

  1. install proj from sources
  2. install gdal
  3. edit /etc/ld.so.conf and put there path to libraries from proj (eg /../../proj/6.2.0/lib)
  4. run command ldconfig or logout and login to get those settings visible
  5. set environment variable PKG_CONFIG_PATH with path to file: proj.pc with should be in proj instalation home folder in /lib/pkgconfig (eg export PKG_CONFIG_PATH=/../../proj/6.2.0/lib/pkgconfig) - pkgconfig should been installed in system
  6. open R and run install.packages command with options: --with-proj-include --with-proj-lib --with-proj-api=no (eg install.packages("sf", configure.args = "--with-proj-include=/path/to/proj/6.2.0/include --with-proj-lib=/path/to/proj/6.2.0/lib --with-proj-api=no"))

I assume that You have package ZLIB in version 1.2.9 in your system :)

@beedawg1985
Copy link

beedawg1985 commented Feb 26, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants