Alteryx Designer Knowledge Base

Definitive answers from Designer experts.
Check out our powerful new search update! You can read more here. Please let us know if you have any feedback by creating a topic here.

How To: Use Alteryx.installPackages() in Python tool


How To: Use Alteryx.installPackages() in Python tool


Installing a package from the Python tool is an important task. In this article, we will review all the possible functionality included with the Python method Alteryx.installPackages().




  • Product - Alteryx Designer
    • Version  ≥ 2018.3


Background Information


First of all, don't get confused: you can use either Alteryx.installPackage(), Alteryx.installPackages(), or Package.installPackages() to achieve same result.


By default, packages are installed under:


%ALTERYX%\bin\Miniconda3\PythonTool_venv\Lib\site-packages until 2019.2

%ALTERYX%\bin\Miniconda3\envs\JupyterTool_vEnv\Lib\site-packages for 2019.3+



C:\Program Files\Alteryx\bin\Miniconda3\PythonTool_venv


As a result, you may need to start Designer with administrator rights if the installation folder does not allow write access to a standard account, like for an admin version for example.


Typically, people use installPackage() with a single argument (the package name(s)). But, looking at the method itself, there are in fact 3 parameters:


Parameter Comment
package A string or list of strings of package name(s)
install_type Optional: default value: "install". Pip command to use.

Optional: default value: False

Add some details to the output


Function signature:





Alteryx.installPackages(package, install_type=None, debug=None, **kwargs)





In reality, Alteryx.installPackages() is nothing more than a wrapper for the pip (Python Package Manager) command. 


This means that following command:








is interpreted as:


up to 2019.2:




%ALTERYXDIR%\bin\miniconda3\pythontool_venv\scripts\python.exe -m pip install logger





for 2019.3+:




%ALTERYXDIR%\bin\miniconda3\envs\jupytertool_venv\python.exe -m pip install logger





This can be seen using debug parameter:



 Output (duplicates due to debug mode):

Executing subprocess: install logger
[Executing subprocess: c:\users\xxxx\appdata\local\alteryx\bin\miniconda3\pythontool_venv\scripts\python.exe -m pip install logger ]
[Subprocess success!]
Collecting logger
Installing collected packages: logger
Successfully installed logger-1.4
Collecting logger
Installing collected packages: logger
Successfully installed logger-1.4


Procedure: Standard Installation


In this case, only the package argument is specified. 






# With one package

# With multiple packages

# With a specific version

# Without cache enable to ensure that package is downloaded before installation
Alteryx.installPackage(package="logger",install_type="install --no-cache-dir")






Procedure: Installation from GitHub


Git must be installed on the machine to use this method. It could be downloaded from

Instead of the package name, specify git URL prefixed with git+.












Procedure: Installation of a Module in the User Folder


This method uses parameter --user to specify that package must be installed in user folder (%APPDATA%/Python/Python36 as per






        install_type="install --user")






Now, in order to use it, package location must be added to default path: %APPDATA%\Python\Python36\site-packages







import os,sys

import logger






Procedure: Installation of a Module in a Different Folder


This method uses parameter --target to specify the destination and creates it if needed.






        install_type="install --target=C:\\ProgramData\\PythonLibs")





Now, in order to use it, the package needs to be imported using Alteryx.importPythonModule(%MODULE_PATH%) [2018.4 and above]






logger = Alteryx.importPythonModule("C:\\ProgramData\\PythonLibs\\logger")"Logger installed successfully")




Remark: With this method, a module does not appear as installed in PythonTool environment




Procedure: Installation from local directory or tar.gz


The package must exist in a place accessible by the machine (such as C:\Users\<YOUR USERNAME>\Documents\Personal\PythonPckg).






Alteryx.installPackages(package="file: <your directory\filetoinstall.tar.gz>")







Procedure: Installation with a proxy in place


This allows the option of adding a proxy and proxy credentials to the installation argument. Credentials can be left off or included depending on the environment.






#No password and username
Alteryx.installPackages(package="<mypackage>",install_type="install --proxy proxy.server:port") 

#With password and username
Alteryx.installPackages(package="<mypackage>",install_type="install --proxy [user:passwd@]proxy.server:port") 






Procedure: Installation from Wheels


In this case, we use --no-index and --find-links with the local repository to ensure that package is not going to be downloaded.




Here, C:\ProgramData\PythonWheels contains following files (numpy and Pillow are dependencies of wordcloud):






                       install_type="install --no-index --find-links=C:\\ProgramData\\PythonWheels")






Procedure: Uninstall Package(s)


Specify uninstall as the install_type parameter and either a string with the package name or a list of strings with package names.






# For a single package
Alteryx.installPackages(package="wordcloud", install_type="uninstall")

# For multiple packages
Alteryx.installPackages(package=["wordcloud","pillow"], install_type="uninstall")






Procedure: Download Wheels or Archive Files


In this case, the command to use is download instead of the default install. One may also specify a destination folder with parameter --dest






Alteryx.installPackages(package="wordcloud",install_type="download --dest=C:\\ProgramData\\PythonWheels")






Procedure: List the Currently Installed Modules


The following procedure provides a basic way to list the module names and versions installed along with Python tool.




from ayx import Alteryx
import re
from pandas import DataFrame
import io
from contextlib import redirect_stdout

with io.StringIO() as current_output, redirect_stdout(current_output):
    packages = ( (item for item in out_row.split("=") if item) 
    for out_row in re.split(string=current_output.getvalue(),pattern=r"\r*\n") if out_row)
    output_df = DataFrame(packages ,columns=["package","version"])






Example of result:






Additional Resources



This article is awesome! Thanks for all the help @PaulN




How would one adapt this


                       install_type="install --no-index --find-links=C:\\ProgramData\\PythonWheels")


to a network drive that has spaces in some of the folder names...


So far I have 

install_type='install --no-index --find-links="\\\\d\\w\\Space Here\\Alteryx\\Systems\\For System Use\\Hyper API"')


But I get the error

Command '['c:\\users\\name\\appdata\\local\\alteryx\\bin\\miniconda3\\pythontool_venv\\scripts\\python.exe', '-m', 'pip', 'install', '--no-index', '--find-links="\\\\dfs\\wtops\\Space', 'Here\\Alteryx\\Systems\\For', 'System', 'Use\\Hyper', 'API"', 'hyperapi']' returned non-zero exit status 1.


I tried multiple ways with quotes. Is using network drive even possible? I wish whoever made this didn't put spaces in file path names.


Thanks for the article. The machine I use doesn't have admin rights to intall any s/w. 

In that case am not able to run my codes that were running in IDE to adapt to alteyx due to package unavailability. 

Its practically not possible for us to freely develop codes using the Alteryx python module when we have user restrictions on installing the packages. Having admin rights is the only way to install the packages to miniconda in Alteryx? 


Can anything be done on this?  

If this is not doable, I would suggest to have all the basic packages for data analysis pre installed in the Alteryx bundle without which this feature is not gonna be of great value add to the tool. 




Installing collected packages: soupsieve, beautifulsoup4
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\program files\\alteryx\\bin\\miniconda3\\envs\\jupytertool_venv\\Lib\\site-packages\\soupsieve'
Consider using the `--user` option or check the permissions.


CalledProcessError: Command '['c:\\program files\\alteryx\\bin\\miniconda3\\envs\\jupytertool_venv\\python.exe', '-m', 'pip', 'install', 'beautifulsoup4']' returned non-zero exit status 1.




After going through the same things, yes you absolutely need t o have an admin install this for you. I tried every work around I could think of, and at the end of the day had to wait for the admin to get back from vacation so I could get some tools installed.