This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
12-28-2016 03:45 PM - edited 03-02-2022 11:46 AM
Looking to install additional R packages? There are multiple ways to do this. One way is to use our Install R Packages app:
Download the Install R Packages app found in the Predictive and ML section of the Community Gallery :
Packages are installed in the user's personal R library folder (example: C:\Users\%windows_account%\Documents\R\win-library\%R_version% where %R_version% is the current R version, like 3.4 for example). It is one for the folders that R searches by default to find available R packages. If installing to a different folder, ensure you have write permissions to that folder.
Another common method would be to use the standard R package install function within the R Tool:
install.packages("package_name", repos="https://cloud.r-project.org")
Note that this function has several options that may be required depending on your environment and the package you are installing. For reference, documentation for this function can be found at this link .
Whatever method you use, don't forget to call that package in your R code, using library() .
Happy Alteryx-ing!
I want to know where should i input the package names i want to install in this workflow
Hi @GaRaGe, You can enter each package name in the Text Box directly underneath where it says, "Provide a comma separated list..."
Then, in the workflow in which you're calling that package, remember to use library().
Please let me know if this answers your question sufficiently, thanks.
Why not just use the plain "R" tool and include it in the script?
e.g. the following line installs numerous packages (note the repo is for Singapore, here is a list to look up from https://cran.r-project.org/mirrors.html )
install.packages(c("stringr","stringdist","RODBC"), repos="http://cran.stat.nus.edu.sg/")
By default they'll go somewhere like this: C:/Users/YourUserName/AppData/Roaming/Alteryx/R-library
If the packages are large, then should probably do something like this (but would need to loop through if more than 1) to check if you need to install or not:
package_name <- "deldir" altx.repo <- getOption("repos") altx.repo["CRAN"] <- "http://cran.rstudio.com" if(package_name %in% rownames(installed.packages())==FALSE){ install.packages(package_name) } require(package_name, character.only=TRUE)
Whenever I am trying to install any packages using R Install Packages tool or R tool I am getting the following errors:
R (17) Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
R (17) Error: package or namespace load failed for 'AlteryxPredictive'
Please help.
hi @arindam2007b, namespace errors often come from a conflict between Alteryx R and another R console, such as RStudio. Please make sure you're installing the packages to the Alteryx library (you can point your RStudio libPaths to the same directory).
Also, are you trying to install AlteryxPredictive? That is included with the Predictive Installer, so you shouldn't need to load it again.
Hi Cristons,
I have an instance of R already installed in my system. But I am loading my packages in the Alteryx R Library(which I think is by default where alteryx loads R packages). I have installed the Alteryxpredictive from the package which is available here in the community, but apart from the available packages which comes along with the Alteryx Predictive packages, I wanted to install some other packages for NLP such as "tidytext". I am using the R tool in alteryx to install these packages and do my analysis, that's where I am facing issue installing the required packages such as "tidytext", "stringi", etc.I tried installing the packages through the tool R-install-packages tool as well but I seem to have the same error messages.
hi @arindam2007b - are you certain that you're loading to your Alteryx R library?
For tidytext, what is the R version of that package? Can you enable all macro messages, and post the specific error messages you get when you try to install tidytext?
Hi CristonS,
Please find below the code which I writing on R tool to install packages, along with the messages which I am getting for the same.
Note: I have reinstalled all the components of Alteryx along with the predictive packages. But I am still having problem installing the required packages using R tool. It would be very helpful if you can help me solve the problem.
hi @arindam2007b - try installing the packages one by one, then testing. And you tried the Install R Packages app on the Gallery, yes?
As a side note, are you installing the 3.3.2 versions of these packages? The version of R that aAlteryx uses is 3.3.2, and until we officially upgrade to a newer version of R (upcoming), we cannot support higher versions of the packages.
@CristonS Any timelines on when the 3.3.3 or 3.3.4 version of R will be available?
How can I run my R scripts in the meantime? Our organization won't be able to downgrade versions. I'm disappointed that Alteryx isn't putting priority to keeping compatibility with current versions of R, especially when we have a workshop of people who use R on a daily basis. We have a team of researchers who will be evaluating Alteryx and this will be a deal breaker.
hi @tonyppham503 - we are currently working on the upgrade, and expect to ship R-3.4 with our 2018.2 release.
In the meantime, which R scripts are you having issues running? Are they calling later versions of the packages?
I am have the same issues as @arindam2007b when I try to install tidytext.
Error: R (1): Error in inDL(x, as.logical(local), as.logical(now), ...) :
Error: R (1): Error: package or namespace load failed for 'AlteryxPredictive'
This is a major error because all my R tools scripts are now failing. Hoping I don't have to spend several days trying to find a hack fix workaround.
hi @robcamp - to where are you installing these packages? To your Alteryx R library, or perhaps a personal library, such as an RStudio library?
Can you enable all macro messages (in your Workflow - Configuration, Runtime tab) to see what additional information it provides?
Are you using the non-Admin version of the software? Do you have write permissions to that directory?
If you're using the Admin version, can you check C:\Program Files\Alteryx\R-3.3.2\library?
Yes, I believe I am using the Admin version.
Is tidytext in C:\Program Files\Alteryx\R-3.3.2\library? Can you try reinstalling that package by specifying that library?
@CristonS, I installed Rcpp using Alteryx's R terminal and it says the package version is now 12.15. However, when I run R in Alteryx, I get the following:
"Info: R (1): namespace 'Rcpp' 0.12.8 is already loaded, but >= 0.12.13 is required"
I closed and restarted Alteryx but it didn't make a difference.
hi @robcamp @tonyppham503 - there are a lot of variables here that could be affecting your issues. For example, your other libraries (from other R consoles you have installed - that's where namespace errors typically come from), the method you're using to install these packages (as well as the versions of the packages), to where you're installing the new packages, read/ write permissions, etc.
I'd recommend posting this question to the Advanced Analytics forum - your questions will get a lot more visibility, and that way people who see this same error will be able to find resolution.
Please include your Alteryx version and specs, any other R consoles you may be using, the full macro messages with errors, and all of your .libPaths() - thanks!
Still unresolved.
Simple test.
Use the .libPaths() command in the Alteryx R Terminal.
PS C:\Program Files\Alteryx\R-3.3.2\bin> R.exe R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > .libPaths() [1] "C:/Program Files/R/R-3.2.3/library" >
Check - Works as expected.
Try the same command in the Alteryx R Tool
Spent yesterday unintall/install versions of Alteryx designer and the predictive tools. Changing system environment variables for R_HOME, R_LIBS_USER. Modifying the Rprofile file in base.
Same result. R Tool and Predictive Analytics are now completely disabled in Alteryx Designer. Frustrated and demoralized.
Hi @CristonS,
I am trying to install an R Package imputeTS for imputing missing values for a Time Series problem that I am working on. I downloaded the "Install the R Package" app and I ran this app a couple of times to install the imputeTS R package. All the runs of the app were successful without any errrors but I am not able to locate the R packages. In the first few attempts, I did not specify the location where I wanted to install this package and was searching for the package in Alteryx folder under "Program Files". I could not find the package in this directory.
Then I specified the folder where I wanted to install the R package and did not find the package at this location either.
Could you provide any inputs on how to go about installing R packages using this app and also how to use the package within a workflow. Can I simply add an R tool from "Developer" Toolset and write library(packagename) to use that package within a workflow?
Regards,
Ashish
This is the code I am using to install R packages within the Alteryx R library -- .libPaths()[3] - in my example. Use the .libPaths() command to discover where the Alteryx R library resides on your machine.
This example is installing the Windows binary of the odbc package with all dependencies.
install.packages("odbc", repos='https://cran.revolutionanalytics.com/', dependencies = TRUE, type="win.binary", lib = .libPaths()[3])
Hi @robcamp,
Thanks for your reply.
I tried installing a package called imputeTS using the command you had provided. However, I ran into an error while trying to do so. The error that I am getting is as follows -
Unable to load the RCPP package - Use the R installer provided by Alteryx
Any ideas how to get past this error?
I already have the RCPP package under my local Alteryx R library.
Ran into this issue with Rcpp too. Here's the solution which worked for me. Thanks to Sydney at Alteryx support.
Hi Rob,
I was able to confirm that the version of Rcpp used by Alteryx is current. Can you please open the R.exe file in C:\Program Files\Alteryx\R-3.3.2\bin as an administrator, and then try running the following code:
install.packages("Rcpp", lib = "C:/Program Files/Alteryx/R-3.3.2/library")
When I run this on my machine after deleting the Rcpp package, my R tool is able to run code without issue.
Please let me know how this goes! Thanks,
Sydney Firmin | Customer Support Engineer Email: support@alteryx.com | community.alteryx.com
Hi @robcamp,
Thanks for a quick response!!
Do you know if this error occurred due to the installation action for imputeTS package which overwrote the existing RCpp package.
If yes, how to install new packages for use in Alteryx without running into such issues again.
Regards,
Ashish
My experience with this error occurs when you are trying to install packages. It doesn't occur on every package install.
Use the code I posted earlier to install packages with the R Tool. I believe this will reduce the risk of this error repeating.
Rob
This might help:
https://stackoverflow.com/questions/43150738/installing-an-r-package-from-local-unzipped-folder
Best,
David
Hi @AshishBhavnani and others,
The error I think is created by running the installation code (install.packages(c('[package]'), repos="http://cran.rstudio.com") twice; the first time it actually works, but the second time it seemingly cannot deal with the fact that packages are already installed and breaks the tool.
I could only find reinstalling everything as a solution online. After a few hours with the very helpful IT staff from MIP, I have found the following workaround: Go to C:\Program Files\Alteryx\R-3.4.4\bin and run the R environment from there and install the package --> (install.packages("[missing package]", lib="C:/Program Files/Alteryx/R-3.4.4/library")
Thanks to Edgar,
Regards,
Charles
Hi @CristonS,
I am using company laptop and do not have admin rights to the default R folder so I am not able to install R packages. I will not get admin rights. What do i do?
Code in Alteryx R in the Insert Code window ->
if("geosphere" %in% rownames(installed.packages())==FALSE){install.packages("geosphere")}
Info: R (4): Installing package into 'C:/Program Files/Alteryx/R-3.4.4/library'
Info: R (4): (as 'lib' is unspecified)
Info: R (4): Warning in install.packages("geosphere") :
Info: R (4): 'lib = "C:/Program Files/Alteryx/R-3.4.4/library"' is not writable
Error: R (4): Error in install.packages("geosphere") : unable to install packages
Error: R (4): Execution halted
hi CristonS
when i installed R packeges, the errors that are shows;
Designer x64 Started running C:\Users\abaad\Desktop\Alteryx macros\Install+R+Packages\Install R Packages.yxwz at 10/12/2019 23:24:54
GenericTool (1) Can't find plugin "AlteryxRPluginEngine.dll"
Output Data (6) Missing Incoming Connection
Designer x64 Finished running Install R Packages.yxwz in 0.6 seconds with 2 errors
GenericTool (1) Can't find plugin "AlteryxRPluginEngine.dll"
I installed the factoextra package from this "install R packages", but when i ran for the hierarchical clustering, it always says there is no available package called factoextra.
I am new to alteryx and know few things about alteryx. I really need some help.
@Radcham
I'll assume you have this line in the top of your code in the R tool.
library(factoextra)
I suggest you take a look at
https://www.theinformationlab.co.uk/2019/01/17/installing-r-packages-both-on-alteryx-designer-and-on...
Good luck.
In case anyone else is falling at the first hurdle like me - to run as an app you need to click the wand icon just to the left of the run button.
This will bring up the dialogue box in the screen-shot above with the text box for adding the comma separated names of the R packages
I am getting errors when trying to use the PDF Input tool, after installing the pdftools package. Can someone help troubleshoot?
I was successful downloading the pdftools package, but when I go back to input the PDF I get the below error:
Error: PDF Input (1): BatchPDFInput (26): Record #1: Tool #2: Error in normalizePath(path.expand(path), winslash, mustWork) :
Error: PDF Input (1): BatchPDFInput (26): Record #1: Tool #2: Execution halted
Error: PDF Input (1): BatchPDFInput (26): Record #1: Tool #2: The R.exe exit code (1) indicated an error.
Error: PDF Input (1): BatchPDFInput (26): The output connection "Output7" was not valid
Info: PDF Input (1): 1 pdfs met criteria and are being processed for input
@ejtesoriero !
I just use a line in an R Tool to install packages. I've attached a tiny workflow that does two things. It finds all your libraries and their locations and also installs packages.
Hmm, seems I cannot add an attachment. Here's my discovery code (in the "get libraries" container), to see which packages are installed and where.
libs <- .libPaths()
length_vector <- vector("integer", length(libs))
loop <- 1
for (lib in libs)
{
temp_dirs <- as.list(list.dirs(path = libs[loop], full.names = FALSE, recursive = FALSE))
length_vector[loop] <- length(temp_dirs)
loop <- loop + 1
}
max_length <- max(length_vector)
loop <- 1
the_dirs <- list.dirs(path = libs[loop], full.names = FALSE, recursive = FALSE)
length(the_dirs) <- max_length
the_library <- as.data.frame(the_dirs)
colnames(the_library) <- c(libs[loop])
loop <- loop + 1
loopy <- c(loop:length(length_vector))
for (loop in loopy)
{
temp_dirs <- list.dirs(path = libs[loop], full.names = FALSE, recursive = FALSE)
length(temp_dirs) <- max_length
temp_library <- as.data.frame(temp_dirs)
colnames(temp_library) <- c(libs[loop])
the_library <- cbind(the_library, temp_library)
}
write.Alteryx(the_library, 1)
Funny thing, I copied this from a workflow I used to duplicate R installs to a new server. One of the packages I needed to install was pdftools. So here's a line from the Container labeled, "install packages."
install.packages("pdftools", repos="http://archive.linux.duke.edu/cran", lib = "C:/ProgramData/Alteryx/R-library")
Hope this helps!
Best,
David
Thanks @David-Carnes - I was successful downloading it and see it in the R-library folder! But still getting errors when I try to input a .pdf. Any idea?
Error: PDF Input (1): BatchPDFInput (26): Record #1: Tool #2: Error in normalizePath(path.expand(path), winslash, mustWork) :
Error: PDF Input (1): BatchPDFInput (26): Record #1: Tool #2: Execution halted
Error: PDF Input (1): BatchPDFInput (26): Record #1: Tool #2: The R.exe exit code (1) indicated an error.
Error: PDF Input (1): BatchPDFInput (26): The output connection "Output7" was not valid
@ejtesoriero !
The problem lies in getting a Blob into the R package. You need to convert it to Base64 binary before the R Tool and convert back into a blob in R.
library(pdftools)
library(base64enc)
the_data <- read.Alteryx("#1",mode="data.frame")
the_vector <- as.vector(the_data[1,1])
the_blob <- base64decode(the_vector, output=NULL)
# Use pdf_text() function to return a character vector
# containing the text for each page of the PDF
txt <- pdf_text(the_blob)
# convert the character vector to a data frame
df_txt <- data.frame(txt)
# output the data frame in steam 1
write.Alteryx(df_txt, 1)
Happy hunting and good luck!
Ciao,
David
No matter what command I run in the R Tool I get the below error:
R (2) Error: package or namespace load failed for 'stringr' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
R (2) Execution halted
R (2) The R.exe exit code (1) indicated an error.
Any help would be appreciated!
@ejtesoriero
I'm not sure, but I would first look at rlang because of the line in the messages that says that you don't have all the dependencies installed that you need.