I have a shiny program in R that works great. But I am having trouble deploying it to shinyapps.io.
The javascript error console gives me the following error:
Listening on http://127.0.0.1:46574
Downloading github repo jlisic/saAlloc#master
Installing saAlloc
'/usr/lib/R/bin/R' --vanilla CMD INSTALL \
'/tmp/RtmpvmoFM3/devtools2c6b564aad/jlisic-saAlloc-62692fc' \
--library='/usr/local/lib/R/site-library' --install-tests
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/site-library’
Error : Command failed (1)
There is nothing fancy about my package it just has a default Makevars file. Any help or suggestions would be appreciated.
I have also been struggling with this issue, and I just found a working answer in the shinyapps.io Google users group by #Yihui. Quoting his post:
You should not install the package inside your app (i.e. do not call
install_github() in your app code). Just install it locally, and
shinyapps.io will figure out how to install it on the server.
https://groups.google.com/d/msg/shinyapps-users/5S8jTJ-SeHM/HCPGUjYVUM4J
Removing the devtools::install_github() line in server.R worked for me. Back end magic!
EDIT: The reason why this works is explained in more detail in this rsconnect issue: https://github.com/rstudio/rsconnect/issues/88
Related
Following this question, I am trying to install the package (running R64 as admin on Windows):
devtools::install_github("markhwhiteii/processr")
or
devtools::install_github("cardiomoon/processR")
However, I get the error message:
Error: Failed to install 'processr' from GitHub:
(converted from warning) cannot remove prior installation of package 'digest'
no matter which update option I select. Running the command .libPaths() I found the packages installation folder C:/Program Files/R/R-3.6.2/library and manually deleted the digest package and reinstalled it with package.install("digest"). But I still get the same error! I would appreciate it if you could help me understand what is the problem and how I can resolve it.
The simplest solution is to say no when install_github asks if it should replace digest.
If it still fails for some reason (and I can't see why; neither package requires a specific version of digest and you've reinstalled it in any case), then the problem is that devtools itself uses digest, so it can't be removed as long as devtools is loaded. So you can't use install_github.
You have a couple of options:
Clone the repo, then from the command line, run R CMD INSTALL . in that directory. Note that you'll need to insert the path to your R executable.
Install from the GitHub archive of the master branch: install.packages("https://github.com/markhwhiteii/processr/archive/master.tar.gz")
The steps to install the markhwhiteii/processr package:
install.packages("devtools")
library(devtools)
install.packages("https://github.com/markhwhiteii/processr/archive/master.tar.gz")
for testing the instalation:
library(processr)
processr::model1
Sent a PR on the GitHub repo.
and if you want to run R in the Jupyter environment just follow the instructions to install and regsiter the kernel:
install.packages('IRkernel')
IRkernel::installspec()
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.
My app works perfectly when I run it locally, but when I host it in shinyapps.io this error comes out:
An error has occurred
The application failed to start.
Error in value[3L] : there is no package called ‘shinyjs’
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> Anonymous
I have two more apps online with the same ui.R and server.R layouts and both work fine. Even if I avoid the code involving shinyjs, it shows the app in the browser but the same error appears in the app log with the package openxlsx. The other two almost-identical apps working perfect got me completely lost.
In my experience, the issue happens in RStudio projects with a DESCRIPTION file, when the offending package (e.g. shinyjs) is NOT included in the Imports section of the DESCRIPTION file.
I know this answer is late but in case is useful, here it is:
1.- Open a terminal and run: sudo R
2.- I installed shinyjs: install.packages("shinyjs", dependencies=TRUE)
3.- Create shinyjs directory: mkdir /usr/local/lib/R/site-library/shinyjs
4.- cd /usr/local/lib/R/site-library/shinyjs
4.- copy the shinyjs folder from the active username home R directory:
cp /home/username/R/x86_64-pc-linux-gnu-library/3.5/shinyjs/* -r .
Go to your web browsers and it will open your app.
Note. Be sure to change username for correct value and remember to set the privileges.
When you deploy your app on shinyapps.io the serve has to understand where the packages were installed from. The two most common sources of package installations probably are:
CRAN
Github
Looking at the documentation you see that Github packages must be installed with devtools. I have had the same issue you face because I had packages installed with remotes or pak, simply reinstall the packages locally you need using either install.packages for CRAN versions and devtools for dev versions and re-deploy:
install.packages("openxlsx")
# install.packages("devtools")
devtools::install_github("daattali/shinyjs")
I am having a tough time installing R-packages that are not available in the Anaconda repositories. My attempts so far can be found here How to install R-packages not in the conda repositories?.
Currently, I am trying to build the R-package rafalib for conda by following the instructions from this article under the heading Building a conda R package.
The first part works fine.
conda skeleton cran rafalib
Out:
Tip: install CacheControl to cache the CRAN metadata
Fetching metadata from http://cran.r-project.org/
Writing recipe for rafalib
Done
The build command runs into errors
conda build r-rafalib
Out:
Removing old build environment
Removing old work directory
BUILD START: r-rafalib-1.0.0-r3.2.2_0
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: ......
Solving package specifications: .
Error: Packages missing in current linux-64 channels:
- r 3.2.2*
- r-rcolorbrewer
I have r 3.2.2-64bit installed via conda and it runs without problems. I also already have r-colorbrewer installed via conda and I can use that package without issues in R. Why am I getting these errors when trying to build a conda package?
I am on Linux (Antergos, an Arch derivative) with kernel 4.4.5-1-ARCH.
UPDATE 2015/04/19
Thanks to this answer, I found out that I could include the dependencies by building them separately in the same directory as the package I want to install. That didn't work for me, but I also read that I can include a channel in the build command with -c, just as when installing. So now I do:
conda build -c r r-rafalib
This gets passed all the dependency problems, but after fetching, extracting and linking packages, it fails. Here is the end of the error message.
Removing old work directory
Source cache directory is: /home/joel/anaconda2/conda-bld/src_cache
Downloading source to cache: rafalib_1.0.0.tar.gz
Downloading http://cran.r-project.org/src/contrib/rafalib_1.0.0.tar.gz
rafalib_1.0.0. 100% |#######################| Time: 0:00:00 4.87 MB/s
Success
Extracting download
Package: r-rafalib-1.0.0-r3.2.2_0
source tree in: /home/joel/anaconda2/conda-bld/work/rafalib
+ mv DESCRIPTION DESCRIPTION.old
+ grep -v '^Priority: ' DESCRIPTION.old
+ /home/joel/anaconda2/envs/_build/bin/R CMD INSTALL --build .
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
Command failed: /bin/bash -x -e /home/joel/drafts/r-rafalib/build.sh
The error sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook is the same as I encounter when using install.packages() as reported here.
There is some related discussion in this thread. I have tried to get around this error by installing different versions of ncurses, including this patched version, and I have tried to link the readline libraries, as suggested here, but I keep running into the same error. I'm quite lost at this point and any help to solve this would be greatly appreciated.
Although I started out with a different problem, the final solution turned out to be the same as I posted elsewhere How to install R-packages not in the conda repositories?. I am adding it here for completeness.
In the end, I got around the rl_event_hookproblems by following the approach recommended here and symlinking anaconda's libreadline to the system one:
mv ~/anaconda3/lib/libreadline.s.6.2 ~/anaconda3/lib/libreadline.s.6.2.bak
ln -s /usr/lib/libreadline.so.6.3 ~/anaconda3/lib/libreadline.s.6.2
I am still having troubles installing some dependency heavy R-packages due to failure to load shared objects when using install.packages() from withing R. However, simpler packages work fine and I can get most of the dependency heavy packages from anacondas R-repositories.
I've been having trouble downloading the shinyapps package on my windows computer. I've updated my versions of R and studio, tried the devtools download devtools::install_github('rstudio/shinyapps') and I've also tried the manual download of the shinyapps-master.zip (github.com/rstudio/shinyapps/archive/master.zip) and using install_local() all to no avail.
Here is the error I get with each method:
Installing shinyapps
"C:/Program Files/R/R-3.1.1/bin/i386/R" --vanilla CMD INSTALL \
"C:\Users\MyName\AppData\Local\Temp\Rtmpma2fl1\devtools10cc1745fe7\shinyapps-master" \
--library="C:/Program Files/R/R-3.1.1/library" --install-tests
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Error: Command failed (1)
After doing the excellent tutorial for shiny I would love to be able to use shinyapps.io but can't so far due to this. Any ideas? Much appreciated!
The app does not like the fact that R is installed in a directory that includes a space. I recommend reinstalling R to a location without a space, e.g. c:/R/.
I got a similar problem. I deleted the shinyapp folder first and then the file with that name. All my packages are saved in ~/Documents/R/win-library/3.1 folder on Windows 7 PC as I have not specified the lib folder. Then I installed the shinyapps package again using devtools::install_github('rstudio/shinyapps') command in R. HTH