Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Manage packages for Python Tool with CONDA in Alteryx Designer 19.3

DavidM
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
14 REPLIES 14
ricco
7 - Meteor

Thanks A lot. this helped me to come one step further to finally make it work (I hope):


At the moment my code stops with the following error:

 

from fbprophet import Prophet

 

In c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\matplotlib\mpl-data\stylelib\_classic_test.mplstyle: 
The text.latex.preview rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
In c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\matplotlib\mpl-data\stylelib\_classic_test.mplstyle: 
The mathtext.fallback_to_cm rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
In c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\matplotlib\mpl-data\stylelib\_classic_test.mplstyle: Support for setting the 'mathtext.fallback_to_cm' rcParam is deprecated since 3.3 and will be removed two minor releases later; use 'mathtext.fallback : 'cm' instead.
In c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\matplotlib\mpl-data\stylelib\_classic_test.mplstyle: 
The validate_bool_maybe_none function was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
In c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\matplotlib\mpl-data\stylelib\_classic_test.mplstyle: 
The savefig.jpeg_quality rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
In c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\matplotlib\mpl-data\stylelib\_classic_test.mplstyle: 
The keymap.all_axes rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
In c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\matplotlib\mpl-data\stylelib\_classic_test.mplstyle: 
The animation.avconv_path rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
In c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\matplotlib\mpl-data\stylelib\_classic_test.mplstyle: 
The animation.avconv_args rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.

 

 

m = Prophet()

 


---------------------------------------------------------------------------
AttributeError Traceback (most recent call last) <ipython-input-9-8c192ddbcb3b> in <module> ----> 1 m = Prophet() #Insantiate prophet model 2 m.fit(train_df); #Train our model by invoking its fit method on our training dataset c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\fbprophet\forecaster.py in __init__(self, growth, changepoints, n_changepoints, changepoint_range, yearly_seasonality, weekly_seasonality, daily_seasonality, holidays, seasonality_mode, seasonality_prior_scale, holidays_prior_scale, changepoint_prior_scale, mcmc_samples, interval_width, uncertainty_samples, stan_backend) 139 self.fit_kwargs = {} 140 self.validate_inputs() --> 141 self._load_stan_backend(stan_backend) 142 143 def _load_stan_backend(self, stan_backend): c:\program files\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\fbprophet\forecaster.py in _load_stan_backend(self, stan_backend) 152 self.stan_backend = StanBackendEnum.get_backend_class(stan_backend)(logger) 153 --> 154 logger.debug("Loaded stan backend: %s", self.stan_backend.get_type()) 155 156 def validate_inputs(self): AttributeError: 'Prophet' object has no attribute 'stan_backend'

 

 Anybody has an idea how I can resolve this issue?

Best

Ricco

saveeshkumar
9 - Comet

Hi,

Could you please share me installation process of CONDA on Alteryx system.

ricco
7 - Meteor

 

follow these three steps in your terminal:

:\Users\username>cd C:\Program Files\Alteryx\bin\Miniconda3\Scripts

C:\Program Files\Alteryx\bin\Miniconda3\Scripts>activate JupyterTool_vEnv

(JupyterTool_vEnv) C:\Program Files\Alteryx\bin\Miniconda3\Scripts>conda install -c conda-forge fbprophet

 

rewaza
7 - Meteor

I had a similar issue with the different package (paramiko) and I solved it with these steps:

 

run CMD as admin

cd C:\Program Files\Alteryx\bin\Miniconda3\Scripts

C:\Program Files\Alteryx\bin\Miniconda3\Scripts>activate DesignerBaseTools_vEnv

(DesignerBaseTools_vEnv) C:\Program Files\Alteryx\bin\Miniconda3\Scripts>conda install -c conda-forge paramiko

Proceed ([y]/n)? y

 

Done!

 

SravyaThoomu
5 - Atom

Perfect ! Thank you.

Labels