HELP! Error message in running library(semPlot).

Hi everybody! I'm a new user of R Studio.
I am interested in SEM analysis, so I tried to install the package "semPlot".

After having done:

install.packages("semPlot")
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/semPlot_1.1.2.tgz'
Content type 'application/x-gzip' length 344192 bytes (336 KB)
==================================================
downloaded 336 KB

The downloaded binary packages are in
	/var/folders/8n/gpg02l1x2q70kspllm78xvqm0000gp/T//RtmpepvPkc/downloaded_packages

I try to run library(semPlot), and R Studio tells me:

Error: package or namespace load failed for ‘semPlot’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 object 'vI' not found 

What should I do?

P.S.: my Mac version is : MacOS Sierra 10.12.6,
R Studio version: 1.2.5033

1 Like

I don't have a definitive answer, but based on googling object vI not found, this is not a problem with semPlot specifically, but it looks like this can happen when something has gone wrong with a package installation.

Based on looking at some of the linked pages, you could try reinstalling semPlot with install.packages("semPlot", dependencies=TRUE). If that doesn't resolve the issue, try update.packages(checkBuilt=TRUE) (note that this will update all installed packages).

Thanks for replying. Unfortunately, no one of your suggestions worked.

Doing

`install.packages("semPlot", dependencies=TRUE)`

then I run library(semPlot), and it gives me back the same error.

Then,

update.packages(checkBuilt=TRUE)

Saying "Yes" to all updates and Yes to "Do you want to install from sources the packages which need compilation? (Yes/no/cancel)"

Then:

.....clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: error: unsupported option '-fopenmp'
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘qgraph’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/qgraph’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/qgraph’
* installing *source* package ‘sp’ ...
** package ‘sp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c Rcentroid.c -o Rcentroid.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from Rcentroid.c:28:
In file included from ./sp.h:13:
/Library/Frameworks/R.framework/Resources/include/R.h:55:11: fatal error: 'stdlib.h' file not found
# include <stdlib.h> /* Not used by R itself, but widely assumed in packages */
          ^~~~~~~~~~
1 error generated.
make: *** [Rcentroid.o] Error 1
ERROR: compilation failed for package ‘sp’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/sp’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/sp’

The downloaded source packages are in
	‘/private/var/folders/8n/gpg02l1x2q70kspllm78xvqm0000gp/T/RtmpleWzt4/downloaded_packages’
Warning messages:
1: In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  installation of package ‘qgraph’ had non-zero exit status
2: In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  installation of package ‘sp’ had non-zero exit status
> library(semPlot)
Error: package or namespace load failed for ‘semPlot’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 object 'vI' not found 

So the problem is not solved. Any other solutions?

I solved it. The problem consisted in some missing packages on Mac OS (unsupported option '-fopenmp').
To make it work, I downloaded home brew at https://brew.sh/, then running from terminal application:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

then

sudo chown -R $(whoami) /usr/local/share/zsh /usr/local/share/zsh/site-functions

then

`brew install cmake gcc`

After that, trying to install "qgraph" on R Studio, it finally worked and as well as library(semPlot).

:slight_smile:

1 Like

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