Installing lavann - probably a linux problem

633 views
Skip to first unread message

Josef Lauri

unread,
Aug 18, 2013, 1:58:07 AM8/18/13
to lav...@googlegroups.com
I was working well with lavaan under R version 2.15. When I upgraded to version 3.0.1 (Good Sport) I had to upgrade the lavaan package. This is what I got when I tried 

install.pckages("lavaan")

Installing package into ‘/home/josef/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Content type 'application/x-gzip' length 272379 bytes (265 Kb)
opened URL
==================================================
downloaded 265 Kb

* installing *source* package ‘lavaan’ ...
** package ‘lavaan’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error : package ‘quadprog’ was built before R 3.0.0: please re-install it
ERROR: lazy loading failed for package ‘lavaan’
* removing ‘/home/josef/R/x86_64-pc-linux-gnu-library/3.0/lavaan’

The downloaded source packages are in
‘/tmp/RtmpcHaMqE/downloaded_packages’
Warning message:
In install.packages("lavaan") :
  installation of package ‘lavaan’ had non-zero exit status

So I tried re-installing quadprog, and I got this.

> install.packages("quadprog")
Installing package into ‘/home/josef/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
Content type 'application/x-gzip' length 33651 bytes (32 Kb)
opened URL
==================================================
downloaded 32 Kb

* installing *source* package ‘quadprog’ ...
** package ‘quadprog’ successfully unpacked and MD5 sums checked
** libs
gfortran  -fvisibility=hidden -fpic  -O3 -pipe  -g  -c aind.f -o aind.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c init.c -o init.o
gfortran -fvisibility=hidden -fpic -O3 -pipe  -g -ffloat-store   -c -o solve.QP.compact.o solve.QP.compact.f
gfortran -fvisibility=hidden -fpic -O3 -pipe  -g -ffloat-store   -c -o solve.QP.o solve.QP.f
gfortran  -fvisibility=hidden -fpic  -O3 -pipe  -g  -c util.f -o util.o
gcc -std=gnu99 -shared -o quadprog.so aind.o init.o solve.QP.compact.o solve.QP.o util.o -lblas -lgfortran -lm -lquadmath -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lblas
collect2: ld returned 1 exit status
make: *** [quadprog.so] Error 1
ERROR: compilation failed for package ‘quadprog’
* removing ‘/home/josef/R/x86_64-pc-linux-gnu-library/3.0/quadprog’

The downloaded source packages are in
‘/tmp/RtmpcHaMqE/downloaded_packages’
Warning message:
In install.packages("quadprog") :
  installation of package ‘quadprog’ had non-zero exit status

This is why I think it might be a problem with the linux installation (I use ubuntu LTS 12.04), because of the "cannot find -lblas" error. Seems like a compilation error.

I also tried the install command with dependencies=TRUE, and I got a much longer response. Basically R downloaded all the packages, but failed to compile successfully any of them. For some it reported that some package was created before version 3.0.0 (as above for quadprog) for most it gave an error while compiling, like

/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas

I would be grateful for any suggestions.

Thanks.

Josef

Josef Lauri

unread,
Aug 18, 2013, 2:06:28 AM8/18/13
to lav...@googlegroups.com
I am getting the same sort of errors if I try to install other packages:

/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas

So it seems like a g++ problem. But I do not know enough linux to be able to fix this.

Josef

Josef Lauri

unread,
Aug 18, 2013, 8:21:39 AM8/18/13
to lav...@googlegroups.com
Found the problem. I had to install r-base-dev. I never had to do that with older versions of R. Probably I used the R which came with the ubuntu I was using, and it was automatically installed. Also, whenever I try to install.packages like "qgraph" the compilation stops several times because of dependencies on other packages which were "installed before Vers 3.0.0" and I had to install these (sometimes these depended on other pre-3.0.0 packages, so I had to drill down deeper). There is surely a more efficient way of doing this but I do not mind as long as I am installing them. And I did not have to do this with versions older than 3.0.0.

So I hope this post could be helpful to R >=3.0.0 users who are not that savvy with linux.

Josef

On Sunday, 18 August 2013 07:58:07 UTC+2, Josef Lauri wrote:

William Murrah

unread,
Aug 18, 2013, 3:51:34 PM8/18/13
to lav...@googlegroups.com
When you installed R 3.0, did you re-install all R packages? If not, I wonder if this is related to your problems. See this link for an easy way to do it.

Josef Lauri

unread,
Aug 19, 2013, 7:00:21 AM8/19/13
to lav...@googlegroups.com
Yes, it definitely seems to be related because it indicates possibly a new need for installing new packages in R 3.0.0. Thanks for the link! It seems that the basic packages have been re-installed. But at least if not I know what I have to do.

Josef

Imran Ramzan

unread,
Mar 5, 2019, 10:47:14 AM3/5/19
to lavaan
i facing the same issue while installing the Lavaan, can you please help me that how i can fix it. Thank...



install.packages("C:/Users/Imran/Downloads/lavaan_0.6-3.zip", repos = NULL, type = "win.binary")
Installing package into ‘C:/Users/Imran/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
package ‘lavaan’ successfully unpacked and MD5 sums checked


Christopher David Desjardins

unread,
Mar 5, 2019, 10:56:24 AM3/5/19
to lavaan

Hi Imran,
What is the error message? What happens when you run:

library(lavaan)

What’s the output from the following

R.version

--
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.

Imran Ramzan

unread,
Mar 5, 2019, 11:14:42 AM3/5/19
to lavaan
Hi Christopher, thanks for feedback. I am using Window7 to analyse CFA. For that, i have to install the lavaan package in rstudio.

When i open the rstudio and give the following command:

install.packages("lavaan")

It gives following message:

install.packages("lavaan")
Installing package into ‘C:/Users/Imran/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/lavaan_0.6-3.zip'
Content type 'application/zip' length 2640771 bytes (2.5 MB)
downloaded 2.5 MB

package ‘lavaan’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\Imran\AppData\Local\Temp\Rtmp02mdp6\downloaded_packages


And when i run the command of

library(lavaan)

it reports following message:

> library(lavaan)
Error: package or namespace load failed for ‘lavaan’ in runHook(".onLoad", env, package.lib, package):
 lazy-load database 'C:/Users/Imran/Documents/R/win-library/3.5/mnormt/R/mnormt.rdb' is corrupt
In addition: Warning message:
In runHook(".onLoad", env, package.lib, package) :
  internal error -3 in R_decompress1

Christopher David Desjardins

unread,
Mar 5, 2019, 11:20:57 AM3/5/19
to lavaan
Hi Imran,
Can you do the following,

1. Close RStudio.
2. Open RStudio.
3. Run `install.packages("lavaan")` make sure lavaan isn't loaded before you do this.
4. Try and load lavaan: `library(lavaan)`

Do you still get the same error message?

Imran Ramzan

unread,
Mar 5, 2019, 11:42:00 AM3/5/19
to lavaan
Yes Christopher, issue still persist. :( Could you please assist me as i have to run CFA. please...

Christopher D Desjardins

unread,
Mar 5, 2019, 11:44:40 AM3/5/19
to lav...@googlegroups.com

What is your version or R? Can you load any packages that you've installed? For example, does

install.packages("car")

library(car)

Work? If this fails, this seems like a Windows problem. Also, note that lavaan requires a newer version of R (R >= 3.4). So, if you have an old version of R that could be the problem, too.

Chris

Imran Ramzan

unread,
Mar 5, 2019, 12:28:53 PM3/5/19
to lavaan
I am using the latest R version.. Version 1.1.463 – © 2009-2018 RStudio, Inc.  and R3.5.2 

I guess, there is issue in installing other packages as well :(

Christopher David Desjardins

unread,
Mar 5, 2019, 1:55:10 PM3/5/19
to lavaan
Hi Imran,
Unless someone else can help you on here, I would suggest asking this on the R-help mailing list. I'm guessing the issue is because of Windows. I am sure someone can figure it out for you though.
Chris

koenig...@gmail.com

unread,
Mar 5, 2019, 2:34:01 PM3/5/19
to lavaan
Hi Imran,

can you delete (and reinstall) the 'mnormt' package?
Your original error message refers to this package.

If all else fails, try a fresh installation of R and RStudio.

Fingers crossed!
Chris
Reply all
Reply to author
Forward
0 new messages