<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi<div class=""><br class=""></div><div class="">While testing my package on an Amazon cloud instance using the Bioconductor AMI (<a href="https://www.bioconductor.org/help/bioconductor-cloud-ami/" class="">https://www.bioconductor.org/help/bioconductor-cloud-ami/</a>) I ran into the following problem I had not encountered on my work computer (A Mac OS X).</div><div class=""><br class=""></div><div class="">I have a C++ function that makes use of functionality in the igraph package, so to access this I have the following in my function:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Monaco" class="">Environment igraph("package:igraph");</font></div><div class=""><font face="Monaco" class="">Function neighbors = igraph["neighbors”];</font></div></div><div class=""><br class=""></div><div class="">This worked fine on my work machine but gave the following error when tried on the Amazon instance:</div><div class=""><br class=""></div><div class=""><pre tabindex="0" class="GEM3DMTCFGB" id="rstudio_console_output" style="font-family: Monaco, monospace; outline: none; border: none; word-break: break-all; margin-top: 0px; margin-bottom: 0px; -webkit-user-select: text; line-height: 1.45; font-size: 9pt !important; white-space: pre-wrap !important;"><span class=" ace_constant GEM3DMTCPFB" style="color: rgb(197, 6, 11);">Error: cannot convert to environment</span></pre><div class=""><br class=""></div></div><div class="">I was able to reduce the error into trying to get access to a package environment that is installed outside the core package library. The instances created using the Bioconductor AMI have the following package storage structure:</div><div class=""><br class=""></div><div class=""><pre tabindex="0" class="GEM3DMTCFGB" id="rstudio_console_output" style="font-family: Monaco, monospace; outline: none; border: none; word-break: break-all; margin-top: 0px; margin-bottom: 0px; -webkit-user-select: text; line-height: 1.45; font-size: 9pt !important; white-space: pre-wrap !important;"><span class="ace_keyword GEM3DMTCLGB" style="color: blue; white-space: pre; -webkit-user-select: text;">> </span><span class="ace_keyword GEM3DMTCLFB" style="color: blue;">.libPaths()
</span>[1] "/home/ubuntu/R-libs"      "/usr/local/lib/R/library"</pre><div class=""><br class=""></div></div><div class="">Any package residing in usr/local/lib/R/library will be loaded into the environment fine, while any package in /home/ubuntu/R-libs will throw the error.</div><div class=""><br class=""></div><div class="">Minimal example:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Monaco" class="">library(Rcpp)</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><font face="Monaco" class="">cppFunction('</font></div><div class=""><font face="Monaco" class="">  void testFail() {</font></div><div class=""><font face="Monaco" class="">    Environment testEnv("package:boot");</font></div><div class=""><font face="Monaco" class="">  }</font></div><div class=""><font face="Monaco" class="">')</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><font face="Monaco" class="">cppFunction('</font></div><div class=""><font face="Monaco" class="">  void testSucces() {</font></div><div class=""><font face="Monaco" class="">    Environment testEnv("package:stats");</font></div><div class=""><font face="Monaco" class="">  }</font></div><div class=""><font face="Monaco" class="">')</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><font face="Monaco" class="">testFail() # Will give error</font></div><div class=""><font face="Monaco" class="">testSucces() # Will work</font></div></div><div class=""><br class=""></div><div class="">The session:</div><div class=""><pre tabindex="0" class="GEM3DMTCFGB" id="rstudio_console_output" style="font-family: Monaco, monospace; outline: none; border: none; word-break: break-all; margin-top: 0px; margin-bottom: 0px; -webkit-user-select: text; line-height: 1.45; font-size: 9pt !important; white-space: pre-wrap !important;">R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.2 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] Rcpp_0.12.1          BiocInstaller_1.20.0

loaded via a namespace (and not attached):
[1] tools_3.2.2</pre><div class=""><br class=""></div></div><div class="">Best</div><div class=""><br class=""></div><div class="">Thomas Lin Pedersen</div><div class=""><br class=""></div></body></html>