packrat init in an existing project does not initialise - r

I have a working project on Rstudio Server and I want to freeze all packages into the actual working versions to avoid future issues due to global library updates.
So I run
> packrat::init()
Initializing packrat project in directory: - "~/R/statistics"
After a while all packages are downloaded and installed with no apparent issue. So I run a command to get status:
packrat::status()
and I get:
Error: This project has not yet been packified. Run 'packrat::init()' to init packrat.
Restarted R session, Rstudio and even server, but to no avail. Same message no matter I insisted. Maybe this is not the correct procedure to add packrat to an existing project but packrat documentation is not very complete.
Rstudio Server version 1.1.456
R version : 3.4.4

Related

deployment of shiny app fails due to cmake

I have a shiny app that uses nloptr , which in turns needs cmake. I installed it locally and everything works, when I try to publish it to an private rsconnect server, it fails with the following error:
[Connect] 2022/12/06 14:24:08.680333733 CMake was not found on the PATH. Please install CMake: ...
So it is clear that the compiler is missing, is there any solution besides asking the server admin to install cmake or a way for R to install it?

lazy-load database '../R/NymbulCredentials.rdb' is corrupt

I am trying to install a package from GitHub in support of deploying an app to shinyapps.io. If I download the package onto my machine, then it installs without issue. However, if I execute the command (in RStudio):
devtools::install_github(repo="rlmoore0/NMDeploy", subdir="NymbulCredentials")
then I get an error message: Error in (function (n) :
lazy-load database '../R/NymbulCredentials.rdb' is corrupt
This GitHub repo is public, so anyone can try running this command from within R/RStudio with devtools installed. I am on a Windows box running R 3.6.3, Win10.
Any suggestions?
I have looked at questions from other people with similar problems and based on the responses to them, I have tried:
Closing and restarting R/RStudio
Executing the command devtools::unload("NymbulCredentials")
Executing the command unloadNamespace("NymbulCredentials")
Removing the installation library the package is being installed to as referenced by .libPaths() and trying a fresh directory as the installation location.
The error still persists.

ERROR conda.core.link:_execute(700): An error occurred while installing package 'conda-forge::jupyter_nbextensions_configurator-0.4.1-py37_0'

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.

Install R in conda environment offline

I have access to a headless, air-gapped server, where I have Anaconda installed.
The default R on server is located at /usr/local/bin/R with version 3.1.2.
On one of my environments, I wish to install R, along with certain packages. I downloaded R version 3.5.1 source files from Anaconda repository and ran the command
conda install Downloads/r-3.5.1-r351_0.tar.bz2
which executed successfully
Downloading and Extracting Packages
################################################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
However, when I check if R is installed inside the environment, I still get the previous location and version. How can I access the newly installed R ?
As suggested in comments section, I installed the dependencies separately (r-base >=3.5.1,<3.5.2.0a0, r-recommended 3.5.1.*) and the problem was solved.

Installing R on Apache Zeppelin

I'm trying to install Apache Zeppelin on my old computer that runs Ubuntu. So far, I'm able to install Zeppelin very easily by cloning the latest 0.6.0 snapshot release using
git clone https://github.com/apache/incubator-zeppelin.git
cd incubator-zeppelin
mvn clean package -DskipTests
but I want to have R on Zeppelin. Supposedly, the 0.6.0 snapshot has two R interpreters, but when I run the R tutorial (the pre-made note that uses %r), I get this list of errors.
I followed several guides to try and install R as an interpreter, but each one resulted in some kind of error. I tried this instructional:
http://www.r-bloggers.com/interactive-data-science-with-r-in-apache-zeppelin-notebook/, and got a build failure on "R Interpreter". The error message was
"dependency 'evaluate' is not available for package 'rzeppelin'
* removing '/home/rebecca/Zeppelin-With-R/R/lib/rzeppelin'"
and then a bit lower down
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default) on project zeppelin-zrinterpreter: Command execution failed. Process exited with an error: 1
I also tried this Stack Overflow guide: Anyone tried to add R interpreter onto Apache Zeppelin?, and while I was able to run incubator-zeppelin, I received an error when I used either the %spark.r or %r interpreter tags, saying both "interpreter not found" and "prefix not found". Spark doesn't work either after following the first solution, getting the same error mentioned in the second solution (the jar file not being there), and then trying the second solution.
Does anyone have a guide for installing R onto the newest version of Zeppelin? I'm very flexible in the way I can install it. I can run other operating systems onto my computer, and I also have Virtual Box installed on my other computer, which is a mac.
There is currently a bug in the latest HEAD of zeppelin that was recently introduced and prevents the R interpreter from launching cleanly
Did anyone created a Zeppelin Jira Issue for that?
For me it is working on Zeppelin branch-0.6
build Zeppelin with r profile: -DskipTests -Prthis will...
create a directory 'R' in git repo root
copy the 'zeppelin-rinterpreter*.jar' into git_repo_root/interpreter/spark
build Zeppelin with build distro profile: e.g. -DskipTests -Pbuild-distr -Pspark-1.6 -Phadoop-2.6
use zeppelin-distribution/target/zeppelin*.tar.gz for installation
ensure both 1.1 and 1.2 are present in your zeppelin installation
The error you're getting is that you need to have the R package evaluate installed. You can install this simply by launching R and typing install.packages('evaluate').
That said, your excerpt mentions the directory Zeppelin-with-R. That's my repo, which is the R interpreter in the form when it was accepted into Zeppelin. That is version 0.5.6, not 0.6.0. There is currently a bug in the latest HEAD of zeppelin that was recently introduced and prevents the R interpreter from launching cleanly. Your best bet for now is to use the one from my repo and install clean, without trying to pull-in from Zeppelin HEAD.

Resources