Can't load packages as 'shared object ‘stringi.so’ not found'.

Hi everyone,

I'm very new to R and definitely do not have a knack for this but need to use it for my dissertation so I hope you can forgive me for not knowing what is going on.

I've been following Andy field's tutorials and have been trying to load tidyverse and here packages in r studio and keep getting this error message on my markdown:

Error: package or namespace load failed for ‘tidyverse’ in library.dynam(lib, package, package.lib): shared object ‘stringi.so’ not found

In my consol it then gives me this message at the same time:

Warning: package ‘stringi’ has no 'package.rds' in Meta/Error: package or namespace load failed for ‘tidyverse’ in library.dynam(lib, package, package.lib):
shared object ‘stringi.so’ not found

I've tried deleting and reinstalling stringi as suggested in other forums. I've moved it from the spot where it initially downloaded into my library and still no luck. I've also tried downloading the package "stringi.so" in case that was the issue (have no clue if that's a real package or not) but it said there isn't a version of that for my version of R.

A bit of extra context if it helps. I previously had R on my computer but was getting frustrated so in a moment of rage I deleted R, R studio and my library file before downloading so I don't know if that is the issue. Or perhaps it is because I'm using the latest version of R and R studio as of this positing data (that being R version 4.2.1 and R studio version 2022.07.0). Am also using a MacBook.

I'm very lost and would really appreciate any help as I need to get started on my data analysis soon and this is starting to stress me out!

Thanks for your support,
L

Successfully installing stringi should have solved the problem so maybe the installation process is failing. Can you post the command you are using to install and the complete console output you get?

Hi thanks for your response, i looked over the installation process as you suggested and managed to find the issue.

Apologies for not having great formating on the forum still trying to learn that. Hope this is the correct way to paste what I did.

Quick note, this section "xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun" repeated a bunch of times so I deleted them for brevity.

> install.packages("stringi")

  There is a binary version available but the source version is later:
        binary source needs_compilation
stringi  1.7.6  1.7.8              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘stringi’

trying URL 'https://cran.rstudio.com/src/contrib/stringi_1.7.8.tar.gz'
Content type 'application/x-gzip' length 8032287 bytes (7.7 MB)
==================================================
downloaded 7.7 MB

* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
** using staged installation
checking for R_HOME... /Library/Frameworks/R.framework/Resources
checking for R... /Library/Frameworks/R.framework/Resources/bin/R
checking for endianness... little
checking for R >= 3.1.0 for C++11 use... yes
checking for R < 3.4.0 for CXX1X flag use... no
checking for cat... /bin/cat
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

checking for local ICUDT_DIR... icu69/data
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/private/var/folders/md/sypj6n0x40zb7qxcxry8cb5w0000gn/T/RtmpTcNrp4/R.INSTALL14a0f94503eb/stringi':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘stringi’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/stringi’
Warning in install.packages :
  installation of package ‘stringi’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/md/sypj6n0x40zb7qxcxry8cb5w0000gn/T/RtmpfYLver/downloaded_packages’
> 

I found that the issue arose when I type yes in response to this:

  There is a binary version available but the source version is later:
        binary source needs_compilation
stringi  1.7.6  1.7.8              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘stringi’

But when I typed no it installed normally and everything has been running fine since. I think the clue was when I saw this section of the error message.

configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘stringi’

I figured it had something to do with configuring, not that I have any clue what that means. But typing No in response to that question seemed to load it fine, as per below:

> install.packages("stringi")

  There is a binary version available but the source version is later:
        binary source needs_compilation
stringi  1.7.6  1.7.8              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) no
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/stringi_1.7.6.tgz'
Content type 'application/x-gzip' length 14390020 bytes (13.7 MB)
==================================================
downloaded 13.7 MB


The downloaded binary packages are in
	/var/folders/md/sypj6n0x40zb7qxcxry8cb5w0000gn/T//RtmpfYLver/downloaded_packages
> 

So hopefully if anyone else has the same issue this will help. Thanks for your help andresrcs, really appreciate it. Big weight off my shoulders!

Cheers,
-L

This means you are missing Xcode in your system (not an R package) so you can't compile packages from source. For compiling packages you need to install Xcode in your system and the recommended development tools for macOS systems.
https://mac.r-project.org/tools/

If the latest package version is not needed, installing an older version from a binary (as you did by answering "no") is the easiest walk around for this problem.

thanks so much! very helpful

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.