Help: namespace ‘lavaan’ is not available and has been replaced?

1,393 views
Skip to first unread message

Armin Pircher Verdorfer

unread,
Aug 10, 2018, 6:10:24 AM8/10/18
to lavaan
Hi, folks

I've got a weired problem with installing lavaan. No matter which R version ( for mac) I use, I 'm constantly getting the following warning in R Studio:

Warning in install.packages :
  package ‘lavaan’ is not available (for R version X.X.X)


When I check directly in R, I get the following warning:

Warning: namespace ‘lavaan’ is not available and has been replaced
by .GlobalEnv when processing object ‘fit1’

I never got this problem before and it all started after installing the "apaTables" package.
I have tried everything (e.g., I reinstalled R and R Studio) but the problem keeps driving me nuts.

Any help is GREATLY appreciated as I have spent the whole morning trying to fix this problem and tracking down forums for help but everything has proved unhelpful.

cheers, Armin






Edward Rigdon

unread,
Aug 10, 2018, 9:04:33 AM8/10/18
to lav...@googlegroups.com
What does sessionInfo() tell you about your R environment?

--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.

Armin Pircher Verdorfer

unread,
Aug 10, 2018, 11:38:42 AM8/10/18
to lavaan
I reinstalled an old R version again (3.2.1). the session info command yields the following result:

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

loaded via a namespace (and not attached):
[1] tools_3.2.1

Christopher D Desjardins

unread,
Aug 10, 2018, 11:40:25 AM8/10/18
to lav...@googlegroups.com

Hi Armin,

lavaan requires a newer R.

Depends: R (≥ 3.4)


So, I would recommend downloading the latest R and giving it another shot.

Armin Pircher Verdorfer

unread,
Aug 10, 2018, 12:12:06 PM8/10/18
to lavaan
Unfortunately, the problem persists...no matter wich R version I use (I now use 3.3.3 which is the most recent version for my mac system).
I'm pretty sure though this issue has nothing to do with lavaan, but with my R environment...

Christopher D Desjardins

unread,
Aug 10, 2018, 12:23:44 PM8/10/18
to lav...@googlegroups.com

lavaan depends on R version 3.4 or higher. At version 3.3.3, you can't use the newer lavaan. I am guessing a package tried to install a newer version of lavaan and now you've lost the older version of lavaan.

If you don't need the newest features, you could download a tarball from here: https://cran.r-project.org/src/contrib/Archive/lavaan/ and install it from source. I would recommend downloading lavaan_0.5-23.1097.tar.gz (since it predates 3.3.3)

1. Download the tarball to your Downloads folder.

2. Open a Terminal and type: cd ~/Downloads

3. Type: R CMD INSTALL lavaan_0.5-23.1097.tar.gz

This should install. You might need to install Xcode but I don't think lavaan uses C, C++, or fortran (or something else that needs to be compiled).

You may also be able to install a newer version of R from source (https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Installing-R-under-Unix_002dalikes).

Chris

Armin Pircher Verdorfer

unread,
Aug 10, 2018, 12:36:38 PM8/10/18
to lavaan
Update: I think the problem started when I was installing the apaTables package. R Studio asked my "Do you want to install from sources the package which needs compilation?" 
I said yes, silly me! Any idea how Ican get rid of this whole mess and how I can restore R to the state it was yesterday? (just uninstalling and reinstalling it did'nt work so far)

Roxana Chiappa Baros

unread,
Jul 23, 2020, 10:17:30 AM7/23/20
to lavaan
Dear Lavaan community. 
I am just starting to use Lavaan and I cannot install the package. I have tried several options commented in the group. 
I updated R version to the latest one and I just tried to upload lavaan from source, I still get this message
"  ERROR: dependencies 'mnormt', 'quadprog' are not available for package 'lavaan'
* removing 'C:/Users/s1900308/Documents/R/win-library/3.6/lavaan'
Warning in install.packages :
  installation of package ‘C:/Users/s1900308/Downloads/lavaan_0.5-23.1097.tar.gz’ had non-zero exit status "

Any other step I should take? 

Yves Rosseel

unread,
Jul 27, 2020, 4:26:53 AM7/27/20
to lav...@googlegroups.com
> * removing 'C:/Users/s1900308/Documents/R/win-library/3.6/lavaan'

You seem to still use R 3.6. Remove it, so that you are using the latest
version (4.0.2).

Yves.
Reply all
Reply to author
Forward
0 new messages