community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

Install R Packages

Community Content Engineer
Community Content Engineer
Created on

Looking to install additional R packages?  Here's how!

 

Download the Install R Packages app found in the Predictive District of the Gallery:
 
install R packages app.JPG
 
 Open  Install+R+Packages.yxzp and run the app.  Provide a comma-delimited list of the packages you'd like to install:
 
 
R_install_package.png
 
 

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.

 

And don't forget to call that package in your R code, using library().


Happy Alteryx-ing!

 
Comments
Asteroid

I want to know where should i input the package names i want to install in this workflow

Community Content Engineer
Community Content Engineer

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.

Atom

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)
Alteryx Partner

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.

Community Content Engineer
Community Content Engineer

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.

Alteryx Partner

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.

Community Content Engineer
Community Content Engineer

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?

Alteryx Partner

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.

 

Alteryx_errors.pngAlteryx_R_tool_codes.pngAlteryx_workflow.png

Community Content Engineer
Community Content Engineer

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.

Asteroid

@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. 

Community Content Engineer
Community Content Engineer

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?  

Meteor

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.

Community Content Engineer
Community Content Engineer

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?

Meteor
Info: R (1): unable to load shared object /AppData/Roaming/Alteryx/R-library/rlang/libs/x64/rlang.dll': Info: R (1): LoadLibrary failure: The specified procedure could not be found. The library is there.
Community Content Engineer
Community Content Engineer

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?

Meteor

Yes, I believe I am using the Admin version.

rlang.png

 

Community Content Engineer
Community Content Engineer

Is tidytext in C:\Program Files\Alteryx\R-3.3.2\library?  Can you try reinstalling that package by specifying that library?

Meteor
@CristonS Do you have any other suggestions? My current situation is a result of trying to update the tidytext package.
Asteroid

@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. 

Community Content Engineer
Community Content Engineer

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!

Asteroid
Meteor

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

 

libpaths.png

 

libpaths_error.png

 

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. 

Asteroid

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

Meteor

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])
Asteroid

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.

Meteor

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

Asteroid

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

Meteor

@AshishBhavnani,

 

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

Meteor
Is there a way to change the repos to an offline directory of packages? I do not have access to the internet on the machine I am using Alteryx/R, but have downloaded packages to a folder on my computer.

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

Meteoroid

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

Atom

hi 

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"