[Rd] Package Dependency

Paul Johnson pauljohn32 at gmail.com
Tue Dec 1 20:19:30 CET 2015


Lately, I see a dependency problem with R-3.2 systems.
install.packages allows dependencies, but they are not installed so
the install fails.

I see this a lot with students who are able to install packages like
ggplot2 but then can't load it because a dependency "stringi" is
missing.  Those students are generally using Windows, but today I
reproduced the same on RedHat Linux with R-3.2.2.

desiredPackages is a big vector of packages to install. This is using
a trick that one of R Core taught me about 15 years ago...




> installedPackages <- rownames (installed.packages() )

> alreadyHave <- desiredPackages %in% installedPackages


> install.packages(desiredPackages[!alreadyHave],
+                                             dependencies = c("Depends"),
+                                             lib = TARGETLIB)
trying URL 'http://rweb.crmda.ku.edu/cran/src/contrib/DiagrammeR_0.8.1.tar.gz'
Content type 'application/x-gzip' length 3438156 bytes (3.3 MB)
==================================================
downloaded 3.3 MB

trying URL 'http://rweb.crmda.ku.edu/cran/src/contrib/emplik_1.0-2.tar.gz'
Content type 'application/x-gzip' length 199124 bytes (194 KB)
==================================================
downloaded 194 KB

trying URL 'http://rweb.crmda.ku.edu/cran/src/contrib/glmc_0.2-4.tar.gz'
Content type 'application/x-gzip' length 19721 bytes (19 KB)
==================================================
downloaded 19 KB

trying URL 'http://rweb.crmda.ku.edu/cran/src/contrib/sem_3.1-6.tar.gz'
Content type 'application/x-gzip' length 156194 bytes (152 KB)
==================================================
downloaded 152 KB

trying URL 'http://rweb.crmda.ku.edu/cran/src/contrib/OpenMx_2.3.1.tar.gz'
Content type 'application/x-gzip' length 2537264 bytes (2.4 MB)
==================================================
downloaded 2.4 MB

ERROR: dependency 'visNetwork' is not available for package 'DiagrammeR'
* removing '/panfs/pfs.acf.ku.edu/crmda/tools/lib64/R/3.2/site-library/DiagrammeR'


However, I can manually install that individual package



> install.packages("visNetwork",
+                                             dependencies = c("Depends"),
+                                             lib = TARGETLIB)
trying URL 'http://rweb.crmda.ku.edu/cran/src/contrib/visNetwork_0.1.2.tar.gz'
Content type 'application/x-gzip' length 1828012 bytes (1.7 MB)
==================================================
downloaded 1.7 MB

* installing *source* package 'visNetwork' ...
** package 'visNetwork' successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (visNetwork)

The downloaded source packages are in
    '/library/tmp/RtmpBImblN/downloaded_packages'


After that, I start over,  the install of the desiredPackages vector
proceeds, but hits another snag:

install.packages(desiredPackages[!alreadyHave],
                                            dependencies = c("Depends"),
+ +                                             lib = TARGETLIB)
trying URL 'http://rweb.crmda.ku.edu/cran/src/contrib/DiagrammeR_0.8.1.tar.gz'
Content type 'application/x-gzip' length 3438156 bytes (3.3 MB)
==================================================
downloaded 3.3 MB

trying URL 'http://rweb.crmda.ku.edu/cran/src/contrib/sem_3.1-6.tar.gz'
Content type 'application/x-gzip' length 156194 bytes (152 KB)
==================================================
downloaded 152 KB

trying URL 'http://rweb.crmda.ku.edu/cran/src/contrib/OpenMx_2.3.1.tar.gz'
Content type 'application/x-gzip' length 2537264 bytes (2.4 MB)
==================================================
downloaded 2.4 MB

* installing *source* package 'DiagrammeR' ...
** package 'DiagrammeR' successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (DiagrammeR)
ERROR: dependency 'StanHeaders' is not available for package 'OpenMx'


Go back, install just that one

> install.packages("StanHeaders", dependencies = c("Depends"), lib = TARGETLIB)
trying URL 'http://rweb.crmda.ku.edu/cran/src/contrib/StanHeaders_2.8.0.tar.gz'
Content type 'application/x-gzip' length 479231 bytes (467 KB)
==================================================
downloaded 467 KB

* installing *source* package 'StanHeaders' ...
** package 'StanHeaders' successfully unpacked and MD5 sums checked
** inst
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (StanHeaders)

The downloaded source packages are in
    '/library/tmp/RtmpBImblN/downloaded_packages'

I don't recall seeing this problem until the last few months.

-- 
Paul E. Johnson
Professor, Political Science        Director
1541 Lilac Lane, Room 504      Center for Research Methods
University of Kansas                 University of Kansas
http://pj.freefaculty.org              http://crmda.ku.edu



More information about the R-devel mailing list