Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Manage packages for Python Tool with CONDA in Alteryx Designer 19.3

Highlighted
Alteryx
Alteryx

Hi everyone,

 

Alteryx Designer in 2019.3 has introduced some changes to how Python environment for (not only) Python Code tool is managed.  Finally this allows us to utilize conda, which was (to my best knowledge) not possible in previous versions. Unfortunately for packages management at this time only (env not yet), but still awesome!

 

image.png 

 

For those of you who don't know Conda - Conda is an open source package management system and environment management system. Find out more at https://docs.conda.io/projects/conda/en/latest/index.html

 

Why should you care about conda?

Well, Python Code tool in Alteryx relies on pip to fetch packages when you call the Alteryx.installPackages().

 

What if that does not work for whatever reason? Maybe the package is only available at anaconda.org, or maybe you need to work with non-Python dependencies which pip simply won't install.

 

While we are at it - Pip installs Python packages whereas conda installs packages which may contain software written in any language. It does not mean that pip and conda cannot coexist, you can actually rely on both to manage your environment. Its just that the two together are stronger than either of them alone.

 

Note: Currently there is a hardcoded conda env for Python code tool and you cannot simply change this. 

It will be something like "C:\Program Files\Alteryx\bin\Miniconda3\envs\JupyterTool_vEnv"

Currently conda is limited to allow package management, not yet env management.

 

So why do I bother writing all this?

 

image.png

 

I had a problem installing Facebook's Prophet package to do some time series modelling. There were issues with pystan C++ compiler not working correctly, only CONDA INSTALL works...

 

So.... CONDA to the rescue. Take the following code snippets as just a sample of what you can achieve.

You can check out more here on packages management, or use this nice cheatsheet.

 

You should be easily able to utilize CONDA from CMD (C:\Program Files\Alteryx\bin\Miniconda3\Scripts\conda.exe) to install the package you need... (Use this reference on Conda's website for more details)

 

 

conda init cmd.exe             #You need to init the cmd.exe env, requires restart of cmd
conda info --envs              #List all your available envs

 

 image.png

 

 

conda activate JupyterTool_vEnv             #Activate the env of your choice
conda list         #This will give you list of all currently installed packages

 

 

image.png

 

conda install -c conda-forge fbprophet   #This did the trick to install package i needed

 

 

image.png

 

Just like Batman said....

 

image.png

David Matyas
Sales Engineer
Alteryx
Highlighted
Alteryx
Alteryx

Just in time! Great post David

Highlighted
8 - Asteroid

Great post @DavidM and I look forward to using this tool.

However, I wonder if you had any resolution for the Command Line error I am receiving when following instructions below "Program is not recognized as an internal or external command, operable program or batch file."

- we do not have admin rights on laptop, not sure if this plays a factor

 

 

jdbartosh_2-1582978550250.png

 

 

adding @CharlieS who was helping me at local user group. 

Highlighted
Alteryx
Alteryx

Hi @jd,

 

I believe this will be permissions related. Can you please try to escalate with your IT to add you permissions to call CONDA.EXE in the directory you have printscreened?

 

Cheers

dm

David Matyas
Sales Engineer
Alteryx
Highlighted
7 - Meteor

FYI: After installing fbprophet and when I ran

 

import pandas as pd
from fbprophet import Prophet

 

I ran into a warning: Importing plotly failed. Interactive plots will not work

 

Running:  pip install --upgrade plotly  seems to fix the issue.

 

 

###########################

 

I will retract my previous comment because I'm not sure if that is necessary...Sorry!

 

But here is an issue that I ran into

 

When I ran 

 

import matplotlib.pyplot as plt
m.plot(forecast)
plt.xlim('2014-01-01','2022-01-01')

 

I got an error  : 

ConversionError: Failed to convert value(s) to axis units: '2014-01-01'

Running the following :

 

pd.plotting.register_matplotlib_converters()

 

I was able to fix the error. Additional info is found here 

 

Thanks,

Dhanushka

 

 

Highlighted
7 - Meteor

I am trying to run the conda exe but all that happens is a screen pops up quickly and then disappears. Is this possibly permission related?

Highlighted
Alteryx
Alteryx
Hey Trettelap,

I would suggest that you actually run CMD first, set the path to where CONDA is located and call if from the CMD.

This should work.

David Matyas | Sales Engineer
Alteryx Prague, Czech Republic
Mobile: +420 725 919 975
Email: dmatyas@alteryx.com | www.alteryx.com<>

[cid:C839E3C8-2DCA-4CEB-AC26-67832AAB33A0@extendthereach.com]
David Matyas
Sales Engineer
Alteryx
Highlighted
7 - Meteor

Got it... thank you! @DavidM 

Highlighted
7 - Meteor

Thank you for this.

 

conda activate JupyterTool_vEnv does not work, I have to use conda activate C:/"Program Files"/Alteryx/bin/Miniconda3/envs/JupyterTool_vEnv

Highlighted
7 - Meteor

I am new to Anaconda, and somehow I could not install fbprophet just by following the steps posted. Here is how I finally installed it - 

 

  • Step 1 - Right click Anaconda Prompt and run as administrator

 

  • Step 2 - Find your path to JupyterTool_vEnv, using command conda info --envsXiaoqi_0-1590109494860.png 

I have to install the package in environment 'JupyterTool_vEnv', or it won't work in Alteryx.

 

  • Step 3 - Activate JupyterTool_vEnv, using command conda activate <your full path to JupyterTool_vEnv here> 
    Example: conda activate C:/"Program Files"/Alteryx/bin/Miniconda3/envs/JupyterTool_vEnv

 

  • Step 4 - Install fbprophet, using command conda install -c conda-forge fbprophet If you get error message like figure below...Xiaoqi_1-1590109949881.png 

try running this command conda config --set ssl_verify no and then re-run the install command.

Labels