Coming from a python playground and being a big fan of virtualenv and ofcourse, a rookie in R, I intended to have a similar setup in my R projects and packages with the aid of packrat. (At least it seemed intuitive.)
So far, without packrat, I would run "Clean and Rebuild" on my package in RStudio and things worked as expected.
But now I have packrat installed and initialized on the project, which in turn, routes all the subsequent installs to the lib folder in the /packrat dir. This again is working as expected.
Now the issue is with rebuilding my package (which is btw, installed into the packrat by means of packrat::install() )
Every time I run "Clean and Rebuild" I get the following error in the Build window of RStudio:
==> roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace'))
Error in loadNamespace(name) : there is no package called ‘roxygen2’
Calls: suppressPackageStartupMessages ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
Exited with status 1.
In reality, I have devtools, roxygen2 and other packages (including my own) installed with packrat.
What Am I missing?
Related
I'm trying to install jupyter_nbextensions_configurator on windows10 for python3.7 using conda.
An error occurred while installing the package.
I have already tried to reinstall anaconda,but the problem still occurs.
ERROR conda.core.link:_execute(700): An error occurred while installing package 'conda-forge::jupyter_nbextensions_configurator-0.4.1-py37_0'.
Rolling back transaction: done
LinkError: post-link script failed for package conda-forge::jupyter_nbextensions_configurator-0.4.1-py37_0
location of failed script: C:\Users\Cesare\Anaconda3\Scripts\.jupyter_nbextensions_configurator-post-link.bat
I want to know how to install it successfully.
I too was facing the same problem. Here's the output when I tried cloning the base environment [Running as Administrator]:
(base) PS C:\WINDOWS\system32> conda create --name django --clone base
WARNING: A conda environment already exists at 'C:\Users\Tanishk\anaconda3\envs\django'
Remove existing environment (y/[n])? y
Source: C:\Users\Tanishk\anaconda3
Destination: C:\Users\Tanishk\anaconda3\envs\django
The following packages cannot be cloned out of the root environment:
- conda-forge/win-64::conda-4.9.2-py38haa244fe_0
- defaults/win-64::conda-build-3.20.5-py38_1
- defaults/win-64::conda-env-2.6.0-1
Packages: 305
Files: 2077
Preparing transaction: done
Executing transaction: done
ERROR conda.core.link:_execute(698): An error occurred while installing package 'defaults::openssl-1.1.1h-he774522_0'.
Rolling back transaction: done
CondaError: Cannot link a source that does not exist. C:\Users\Tanishk\anaconda3\pkgs\openssl-1.1.1h-he774522_0\Library\bin\openssl.exe
Running `conda clean --packages` may resolve your problem.
()
You will notice the package giving me problem is different than yours, but the ERROR remains the same (ERROR conda.core.link).
Here's how I solved it:
Google the package mentioned in the ERROR. In my case it was openssl-1.1.1h-he774522_0
Open the result from Anaconda Files (should likely be the first search result):
anaconda / packages / openssl 1 - Files :: Anaconda Cloud
Ctrl+F to find the package in the list.
Download the compressed package to your local Downloads folder.
Backup the contents of the installed erroneous package *C:\Users\Tanishk\anaconda3\pkgs\openssl-1.1.1h-he774522_0* somewhere.
Copy the contents of the de-compressed downloaded package into the *C:\Users\Tanishk\anaconda3\pkgs\openssl-1.1.1h-he774522_0* folder.
Re-try in Anaconda prompt with whatever you got stuck at.
Note:
After step 7, I got another same error but for a different package this time (vs2015_runtime-14.16.27012-hf0eaf9b_3). I performed the same steps for this package too --> Google -- Download -- Replace old content. And I was able to run things successfully after that.
I suggest to google the package because if you search for the package name on Anaconda itself, it will ask you to login first.
I have had
library(compiler)
compiler::enableJIT(3)
in ~/.Rprofile for years; now that I upgraded to 3.2.1 I get this on startup:
Error in frameTypes(env) : not a proper evaluation environment
Calls: <Anonymous> -> <Anonymous> -> makeCenv -> structure -> frameTypes
> q()
Warning message:
restarting interrupted promise evaluation
I don't see anything relevant in NEWS.
Replacing 3 with 2 in compiler::enableJIT(3) removes the error.
However, I would prefer my loops to be compiled too.
Suggestions?
PS. I observe the same behavior on MacOSX 10.10.4 (R downloaded from cran) and CentOS 6.6 (R installed using yum).
It's a subtle "thinko" (confusing the base namespace environment with the base environment) in the new fast topenv() function which made it into the source code of R in January ... it would really have been great if you had upgraded sooner..... or even tried "R-devel" so this buglet would never have seen the light of day in a released version of R.
Please, please, all ye readers : Do help open source projects such as R by at least using the very latest released versions, .. even better, do occasionally run everyting with "R-devel" --- the development version of R, available via svn, git and most conveniently for installation from the daily snapshot tarballs at http://stat.ethz.ch/R/daily/
This is my first time building an R package, and doing it with the help of devtools and roxygen2. After writing a simple func in the R directory and making a DESCRIPTION file with devtools, I try to build and reload for the first time but I get an error -
==> devtools::document(roclets=c('rd', 'collate', 'namespace'))
First time using roxygen2 4.0. Upgrading automatically...
Documentation completed
==> R CMD INSTALL --no-multiarch --with-keep.source TestPack
...
ERROR: a 'NAMESPACE' file is required
Which is odd because I have selected in my build configurations that roxygen2 should be making this for me. A man directory is made when building and reloading but nothing else.
I recently updated to R 3.1.3 and I am building a package using RStudio and packrat. I am trying to re-build my package using RStudio's in built "Build and Reload" tool, but it won't work. I keep receiving the following error:
Updating standaRd documentation
Loading standaRd
Error in (function (dep_name, dep_ver = NA, dep_compare = NA) :
Dependency package ggplot2 not available.
Calls: suppressPackageStartupMessages ... <Anonymous> -> load_all -> load_depends -> mapply -> <Anonymous>
Execution halted
Exited with status 1.
The thing is, I have ggplot2 installed in all places including my local libraries and my packrat libraries for this project for both R 3.1.2 and R 3.1.3. I have tried loading them in to no avail.
Also, using devtools::build() and devtools::document() both work, so I am assuming that this is an RStudio issue?
I am using RStudio Version 0.99.235. I also cannot see any of my documentation for my package and it doesn't appear to be in my packrat library.
I have since uninstalled R 3.1.3 and reverted back to R 3.1.2 and I am still getting the same issue.
These are my dependencies:
Depends:
R (>= 3.1.2),
ggplot2 (>= 1.0.0),
grid
packrat doesn't seem to be great at handling this, and I always fail to find the documentation I'm looking for. I managed to get it to install packages for the new version, but I don't know exactly which steps were crucial and in which order.
packrat.lock contained a reference to the old RVersion. This can be updated by hand, but packrat::snapshot() also did it for me. I tried packrat::restore() after this and didn't see a new directory for the R version in PROJECT/packrat/lib/ARCH/. I tried restarting and reloading RStudio, the project and packrat a few times and eventually got it to install packages in there. One more project reload and the packages could be seen.
I think there is a "blessed" command sequence for this and it was easier for me in the past.
It may worth to use the renv package instead of packrat.
From https://rstudio.github.io/renv/articles/renv.html
The goal is for renv to be a robust, stable replacement for the
Packrat package, with fewer surprises and better default behaviors.
When I click "Build & Reload" on the Build tab within RStudio, I get the following error:
==> devtools::document(roclets=c('rd', 'collate', 'namespace'))
Error in loadNamespace(name) : there is no package called 'devtools'
Calls: suppressPackageStartupMessages ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
Exited with status 1.
But when I just enter devtools::document(roclets=c('rd', 'collate', 'namespace')) directly into the console, it works.
In addition, if I uncheck "Build & Reload" under "Automatically roxygenize when running:" in the Build Tools -> Roxygen config, the error disappears.
I've installed the latest devtools with devtools::install_github("hadley/devtools"). I'm using Windows.
If anyone has an suggestions, thank you in advance!
I had to uncheck "Build & Reload" under "Automatically reoxygenize when running:" in the Build Tools -> Roxygen Configure menu. Installing devtools in the program files/r/3.2.3/lib helped, but it still wanted all the dependencies there as well. Using packrat didn't seem to help either..
Here's a convenient solution based on mathematical.coffee's comment:
Just run this from Rstudio:
writeLines("install.packages('devtools', repos = 'https://cran.rstudio.com/')", "inst.R")
system("Rscript --vanilla inst.R")
I encountered this problem multiple times and also with other packages related to devtools (e.g. knitr in the devtools::check()). As it was getting on my nerves, I tried to install devtools in other location of .libPaths(), i.e. in the first standard one (in my case it was /usr/local/lib/R/site-library/). It was telling me that I needed sudo rights. I gave them (as I was utterly annoyed by this) but still, it is needed a large number of dependencies. Therefore, my practical solution was to sudo-copy my "special" R library folder into the standard one. The following code fixed all my problems:
sudo cp -rf /home/myname/R/x86_64-pc-linux-gnu-library/3.4/* /usr/local/lib/R/site-library/
I would like to point out that this is the only effective solution I found. Even so, it lacks elegance and I would definitely prefer if the guys from Rstudio provide a way to link Rstudio to a personally-defined library. It was already my case on startup and I had to add my personal lib to .libPaths() in the file Rprofile.site which is run every time on R startup, but this did not solve the above problem anyhow.
I encounter the same issue, what I solve in the latest version of Rstudio is :
Build -> Configure Build Tools -> Build Tools -> Press Configure Button -> Uncheck "Source
and binary package builds"