Alteryx Designer Desktop Knowledge Base

Definitive answers from Designer Desktop experts.

Including Wheel Files With Python Tools

NeilR
Alteryx Alumni (Retired)
Created
PRODUCT: Alteryx Designer
VERSION: 2018.2+
LAST UPDATE: 07/25/2018

ATTACHMENT: Word Cloud.yxi


Including Wheel Files With Python Tools

Why?

There are several reasons why you may want to include wheel files with your YXI tool installer, rather than rely on pip to install the tool's dependencies from the internet:

1. To avoid having to install a C compiler for certain packages

Some pip-installed Python packages pulled from the internet require a C compiler to be present on the system - especially on certain versions of Windows. Wheel files can negate this requirement. The wordcloud package is an example (or at least was; the documentation has changed and the issue may have been resolved). A user on Windows 7 was getting the following error when trying to install an early version of the Word Cloud tool that didn't leverage wheel files:

An error occurred during the installation of the Python tool.  Command ""c:\programdata\alteryx\tools\word cloud\scripts\python.exe" -u -c "import setuptools,tokenize;__file__='C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-_3mv1gkm\\wordcloud\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r ', ' ');f.close();exec(compile(code,__file__, 'exec'))" install --record C:\Users\XXX\AppData\Local\Temp\pip-record-ytx42h3y\install-record.txt --single-version-externally-managed --compile --install-headers

That error is incomplete and doesn't pinpoint the problem, but in this case it is due to the lack of a C compiler installed on the system. Changing the requirements.txt file contents from:

cycler==0.10.0 kiwisolver==1.0.1 matplotlib==2.2.2 numpy==1.14.2 Pillow==5.1.0 pyparsing==2.2.0 python-dateutil==2.7.2 pytz==2018.4 six==1.11.0 wordcloud==1.4.1

to:

cycler==0.10.0 kiwisolver==1.0.1 matplotlib==2.2.2 numpy==1.14.2 Pillow==5.1.0 pyparsing==2.2.0 python-dateutil==2.7.2 pytz==2018.4 six==1.11.0 ### wordcloud==1.4.1 ### ./wheels/wordcloud-1.4.1-cp36-cp36m-win_amd64.whl

and including the specific version of the above wheel file resolved the issue.

2. To avoid potential firewall issues

A corporate firewall may interfere with pip grabbing Python packages from the internet. A user trying to install the Word Cloud tool experienced this when they encountered the following error when trying to install the tool:

An error occurred during installation of the Python tool.  Could not find a version that satisfies the requirement cycler==0.10.0 (from -r requirements.txt (line 1)) (from versions: )

Changing the requirements.txt file contents from:

cycler==0.10.0 kiwisolver==1.0.1 matplotlib==2.2.2 numpy==1.14.2 Pillow==5.1.0 pyparsing==2.2.0 python-dateutil==2.7.2 pytz==2018.4 six==1.11.0 ### wordcloud==1.4.1 ### ./wheels/wordcloud-1.4.1-cp36-cp36m-win_amd64.whl

to:

./wheels/cycler-0.10.0-py2.py3-none-any.whl ./wheels/kiwisolver-1.0.1-cp36-none-win_amd64.whl ./wheels/matplotlib-2.2.2-cp36-cp36m-win_amd64.whl ./wheels/numpy-1.14.2-cp36-none-win_amd64.whl ./wheels/Pillow-5.1.0-cp36-cp36m-win_amd64.whl ./wheels/pyparsing-2.2.0-py2.py3-none-any.whl ./wheels/python_dateutil-2.7.2-py2.py3-none-any.whl ./wheels/pytz-2018.4-py2.py3-none-any.whl ./wheels/six-1.11.0-py2.py3-none-any.whl ./wheels/wordcloud-1.4.1-cp36-cp36m-win_amd64.whl

and including wheel files for all dependent packages resolved the issue. This updated Word Cloud tool is attached for reference.

3. To speed up install time

Python packages can be relatively large (all the wheel files required for the Word Cloud tool above add up to 23.5 MB). If you're worried that the downloading of these packages through pip upon the install of your tool will be time consuming (particularly if your internet download speeds may be questionable), then leveraging wheel files may be a good option.

How?

  1. Create or locate the required wheel files. Pythonwheels.com is a popular source, but unofficial repos are widely available, such as the aforementioned repo for the particular wordcloud wheel we needed above. Make sure they are compatible with Python 3.6.0 (the version included with Alteryx 2018.2) and 64-bit Windows.
  2. Follow directions for creating the YXI, with the following additions just prior to creating the zip archive:
    1. Create a subfolder called wheels and place the wheel files within this folder.
    2. Alter the requirements.txt file to refer to the wheel file. For example changewordcloud==1.4.1 to ./wheels/wordcloud-1.4.1-cp36-cp36m-win_amd64.whl.
Attachments
Comments
AshleyO
6 - Meteoroid

@NeilR Thanks Neil. Excellent guide.

 

Is there support for multiple versions of Python and architectures or does Alteryx only support one (python 3.6 + 64bit)?

 

It isn't clear if multiple wheels need to be bundled to cover all permutations, perhaps Alteryx may wish to consider adding proper package management to ensure the yxi files don't get too large.

 

As an alternative, I used the following process to install the Python wheel for all users and plugins.

Open Powershell as Admin
cd C:\Program Files\Alteryx\bin\Miniconda3\Scripts
If necessary: Run .\ipython.exe. Get version number. 3.6 on my machine. exit to quit.
Download the appropriate wheel from https://www.lfd.uci.edu/~gohlke/pythonlibs/. Ensure right python version and system architecture.
Install with .\pip.exe install "<path_to_wheel>.whl"
NeilR
Alteryx Alumni (Retired)

Hi @AshleyO,

 

The Python SDK only supports the version of Python included with Alteryx, currently 3.6. Therefore you don't need to include multiple wheels to cover all permutations. Also to be clear, including wheels is not required, but is an option given some of the considerations noted above.

joejoe317
8 - Asteroid

@NeilR  I have a general question about whl files.

 

We are currently on server 2019.1 

 

I was trying to get the hyper api tool with tableau to work with python. I have in Pycharm, but am now taking that concept to alteryx (hopefully).

 

They provide a whl file that I installed on my machine venv for pycharm, but not with the alteryx virtual environment, so I suppose that would be step 1.

 

But ultimately I will need this to work on alteryx server. I do not have access to the server, so what do I need to do in order to get this to work on server. 

 

I can make requests for installation if needed, but I would really need to be able to detail how to install it to the person that is in charge. 

 

Could you point me to some resources on how this would be done? can I simply use 

 

Package.installPackages(['pandas','numpy']) but with the location of the file that is on a shared drive?

 

 

NeilR
Alteryx Alumni (Retired)

@joejoe317 if you have made a custom Python tool and packaged it as a YXI (Alteryx installable tool file), then your Server admin can install it in the same manner you would with Designer, namely, RDP onto the Windows Server that is hosting Alteryx Server, open Alteryx Designer, and open the YXI file. I believe the admin will also need to repeat this process for each worker node.

joejoe317
8 - Asteroid

@NeilR I think this might have been the wrong thread to replay to, but it was the only documentation on how to install a whl file.

 

I havent created a custom tool. I am trying to use it in the included python tool in alteryx. Sorry for the confusion. 

 

Just assume I do not know what I'm doing, which I really don't at this point.

 

I do know that I am able to install in my actual (not alteryx) environment using Script\pip install [path to whl file]

 

I do not know how this translates to doing it on my local machine, or later when I have to have the system admin install it.

 

Does that make sense?

 

 

NeilR
Alteryx Alumni (Retired)

@joejoe317 yes makes sense. I think conceptually you need to do the same thing on Server that you're doing in Designer in order for the published workflows to run successfully. So however you're installing the wheel files locally, your admin will need to do the same on Server. Across all worker nodes.

joejoe317
8 - Asteroid

@NeilR  Thanks for the response,

 

I actually found this article here https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/How-To-Use-Alteryx-installPackages-...

 

the only problem is I have spaces in my directory, and also its a network drive, so am having a little issue with the formatting. If you have experience with spaces in directories, could you take a look at my response on this thread?

 

Thanks!

 

-Joe

NeilR
Alteryx Alumni (Retired)

Sorry don't know the answer to that but you're in good hands with @PaulN.