The following frequently fails in Rstudio but I can't figure out exactly when/why...
reticulate::use_virtualenv("myrpyenv")
pa<-reticulate::import("pyarrow") # this fails
pq<-reticulate::import("pyarrow.parquet") # this fails
pc<-reticulate::import("pyarrow.compute") # this fails
ds<-reticulate::import("pyarrow.dataset") # this fails
adlfs<-reticulate::import("adlfs")$AzureBlobFileSystem #this works
abfs<-adlfs(connection_string=Sys.getenv("Synblob")) #this works
The failure is Error in py_module_import(module, convert = convert) : ImportError: DLL load failed while importing lib: The specified procedure could not be found.
Clearing the environment and Restarting R is insufficient to make it work. I need to spawn new session to make it work. It always works in Rgui (as opposed to Rstudio).
I've unchecked Restore .RData into workspace at startup and changed Save workspace to .RData on exit to Never.
There seems to be something that is hanging around that breaks it but I can't figure out what.
i just set up R to work with Jupyter notebooks in vscode but it is marking the first string of my kernels in red.
The message I get is:
Failed to run diagnostics: ! error in callr subprocess
Caused by error:
! Full file exclusions must be character vectors of length 1. items: 1 are not! lintr
if i uninstall languageserver package then it disappears but vscode asks me to reinstall it and then it comes back
how do i get rid of this?
This is not an answer..
Just information about a similar problem
Could you try to run the R code below:
lintr::use_lintr(type = "tidyverse")
see https://github.com/r-lib/lintr/blob/main/README.md#lintr-file-example for reference.
I think it creates a .lintr file that defines a default behaviour for lintr within your project directory.So you might need to run the code above each time you have a new project
I recently updated R to the latest release: 3.4.0. R is installed on a network location H:/. Now something weird is happening when I try to install a local binary package:
filename <- paste0("R:/path/independeR_", versions, ".zip")
install.packages(filename,
repos = NULL, type = "source",
lib = gsub("\\\\\\\\networkpath/home/[[:alpha:]]*/",
"H:/", .libPaths()[1]))
Both H:/ and R:/ are network locations. In .libPaths() the default location is in the H:/ location, but it shows with the entire network adress. In the call to install.packages I substituted this.
The code above fails, with the following output:
'\\networkpath\home\JDUB~PN6\DOCU~UZL\R\R-34~TN4.0' is not recognized as an internal or external command,
operable program or batch file.
Warning in install.packages :
running command '"//networkpath/home/JDUB~PN6/DOCU~UZL/R/R-34~TN4.0/bin/x64/R" CMD INSTALL -l "H:\Documents\R\R-3.4.0\library" "R:/path/independeR_0.1.8.zip"' had status 1
Warning in install.packages :
installation of package ‘R:/path/independeR_0.1.8.zip’ had non-zero exit status
There is two things that surprise me here. The directorynames are all jumbled up (DOCU~UZL instead of Documents etc), but for some reason Command promt seems fine with that. The more interesting thing is the following:
When I try to put the command "//networkpath/home/JDUB~PN6/DOCU~UZL/R/R-34~TN4.0/bin/x64/R" CMD INSTALL -l "H:\Documents\R\R-3.4.0\library" "R:/path/independeR_0.1.8.zip" directly into Command Prompt, the output is very similar:
C:\Users\jdubbeldam>"//networkpath/home/JDUB~PN6/DOCU~UZL/R/R-34~TN4.0/b
in/x64/R" CMD INSTALL -l "H:\Documents\R\R-3.4.0\library" "R:/path/independeR_0.1.8.zip"
'\\networkpath\home\JDUB~PN6\DOCU~UZL\R\R-34~TN4.0' is not recognized as
an internal or external command,
operable program or batch file.
For some reason CMD seems to cut off the path to the command halfway through. I guess that this is because the command is too long. When I try the same command, but with H:/Documents/R/R-3.4.0/bin/x64/R, the installation goes just fine.
I would like to be able to automatically install this package from a script, so I would like a solution to this problem from within R. Is there a way to get R to use the shorter H:/Documents/R/R-3.4.0/bin/x64/R?
I was having problems with updating packages, while searching I found that there is a reported bug affecting getting the timestamps from files in Windows 10:
https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17261
Starting in R 3.4.0, file.info sometimes returns for mtime,
atime and ctime for directories. It seems to have something to do
with sharing. This affects functions that use file.mtime like
update.packages.
Reproduce:
Try file.info() with a random directory. If it returns a legitimate
file time, open a windows explorer window and navigate to the
directory, then run the call again and it will return s.
In some cases it returns s even if the directory is not open (or
in the path of an open explorer window), but this is not consistent.
With a comment of Tomas Kalibera:
Thank you for the report, this is a known bug that has been fixed
recently in R-devel
I found that when I closed the file explorer windows the timestamps worked correctly and didn't show up as NA's.
This may be a lead for why your code isn't working.
I managed to make the following work. However, I think it is extremely ugly, and would still like to see if it is possible to do it someway else.
filename <- paste0("R:/path/independeR_", versions, ".zip")
cmd <- file.path(gsub("//networkpath/home/[[:alnum:]]*/", "H:/",
gsub("//networkpath/home/[[:alnum:]]*~[[:alnum:]]*/",
"H:/", R.home())), "bin/x64/R")
libname <- gsub("\\\\\\\\networkpath/home/[[:alpha:]]*/",
"H:/", .libPaths()[1])
call <- paste(paste0('"', cmd, '"'),
"CMD",
"INSTALL",
"-l",
paste0('"', libname, '"'),
"--no-lock",
paste0('"', filename, '"'),
sep = " ")
system(call)
I had to mess around with my R version to be able to get my secure gateway to connect to R mirrors. I did this by adding http_proxy=http://servername to both the properties tab in the R icon, and also by doing:
Sys.setenv(http_proxy=http://servername)
in Rstudio. Could get this to work in R, but not Rstudio. anyway no problem - I can install packages from within R, point RStudio at R and load the package. good.
So I try to create a (default) .Rmd file in Rstudio - when I run knitr, I get the following:
Error: 24:17: unexpected '/'
24: http_proxy=http:/
^
Execution halted
I can only imagine I am getting this because I messed around setting up the proxy. Would this make sense?
How do I clear/unset any proxy server in Rstudio?
Quote the string:
Sys.setenv(http_proxy = "http://servername")
If your on Windows, configure your proxy in IExplorer and use setInternet2(TRUE) function in your script to use IExplorer's proxy settings.
My R script worked fine in RStudio (Version 0.98.1091) on Windows 7. Then I restarted my laptop, entered again in RStudio and now it provides the following error messages each time I want to execute my code:
cl <- makeCluster(mc); # build the cluster
Error: could not find function "makeCluster"
> registerDoParallel(cl)
Error: could not find function "registerDoParallel"
> fileIdndexes <- gsub("\\.[^.]*","",basename(SF))
Error in basename(SF) : object 'SF' not found
These error messages are slightly different each time I run the code. It seems that RStudio cannot find any function that is used in the code.
I restarted R Session, cleaned Workspace, restarted RStudio. Nothing helps.
It must be noticed that after many attempts to execute the code, it finally was initialized. However, after 100 iterations, it crashed with the message related to unavailability of localhost.
Add library(*the package needed/where the function is*) for each of the packages you're using.