Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Can't import statsmodels.api due to a dependency error in Alteryx Designer 2018.3


I am currently working on a workflow that requires the python package 'statsmodels'. I get this error when I try to import this library:


ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-24-9ceb4aea083e> in <module>()
----> 1 import statsmodels.api

c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\statsmodels\ in <module>()
      3 from . import tools
      4 from import add_constant, categorical
----> 5 from . import regression
      6 from .regression.linear_model import OLS, GLS, WLS, GLSAR
      7 from .regression.recursive_ls import RecursiveLS

c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\statsmodels\regression\ in <module>()
----> 1 from .linear_model import yule_walker
      3 from statsmodels import PytestTester
      4 test = PytestTester()

c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\statsmodels\regression\ in <module>()
     46                                           cache_readonly,
     47                                           cache_writable)
---> 48 import statsmodels.base.model as base
     49 import statsmodels.base.wrapper as wrap
     50 from statsmodels.emplike.elregress import _ELRegOpts

c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\statsmodels\base\ in <module>()
     13 from import ValueWarning, \
     14     HessianInversionWarning
---> 15 from statsmodels.formula import handle_formula_data
     16 from statsmodels.compat.numpy import np_matrix_rank
     17 from statsmodels.base.optimizer import Optimizer

c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\statsmodels\formula\ in <module>()
----> 5 from .formulatools import handle_formula_data

c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\statsmodels\formula\ in <module>()
      1 from statsmodels.compat.python import iterkeys
      2 import as data_util
----> 3 from patsy import dmatrices, NAAction
      4 import numpy as np

ModuleNotFoundError: No module named 'patsy'

So I tried to install this patsy module with Alteryx.installPackages('patsy') and that results in the error:


Collecting patsy
  Cache entry deserialization failed, entry ignored
  Downloading (231kB)
Requirement already satisfied: numpy>=1.4 in c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages (from patsy)
Requirement already satisfied: six in c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages (from patsy)
Installing collected packages: patsy
Traceback (most recent call last):
  File "c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\pip\", line 215, in main
    status =, args)
  File "c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\pip\commands\", line 342, in run
  File "c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\pip\req\", line 784, in install
  File "c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\pip\req\", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\pip\req\", line 1064, in move_wheel_files
  File "c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\pip\", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\pip\", line 316, in clobber
  File "c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\pip\utils\", line 83, in ensure_dir
  File "C:\Program Files\Alteryx\bin\Miniconda3\lib\", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\alteryx\\bin\\miniconda3\\pythontool_venv\\Lib\\site-packages\\patsy'

CalledProcessError                        Traceback (most recent call last)
<ipython-input-23-af54b9079754> in <module>()
----> 1 Alteryx.installPackages('patsy')

c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\ayx\ in installPackage(package, *args, **kwargs)
     33     This function will install a package or list of packages into the virtual environment used by the Python tool. If using an admin installation of Alteryx, you must run Alteryx as administrator in order to use this function and install packages.
     34     '''
---> 35     __installPackages__(package, *args, **kwargs)
     37 # these are the same function.

c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\ayx\ in installPackages(package, install_type)
     64         result = subprocess.check_output(
     65             [sys.executable, "-m", "pip"] + pip_args_list,
---> 66             stderr = subprocess.STDOUT
     67             )
     68         # print the output

C:\Program Files\Alteryx\bin\Miniconda3\lib\ in check_output(timeout, *popenargs, **kwargs)
    335     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
--> 336                **kwargs).stdout

C:\Program Files\Alteryx\bin\Miniconda3\lib\ in run(input, timeout, check, *popenargs, **kwargs)
    416         if check and retcode:
    417             raise CalledProcessError(retcode, process.args,
--> 418                                      output=stdout, stderr=stderr)
    419     return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command '['c:\\program files\\alteryx\\bin\\miniconda3\\pythontool_venv\\scripts\\python.exe', '-m', 'pip', 'install', 'patsy']' returned non-zero exit status 2.

What can I do to get access to statsmodels in Alteryx?



Hey @pimp_fada


Could you try installing patsy from the command prompt and see if that works?


1. Run command prompt as administrator

2. cd "C:\Program Files\Alteryx\bin\Miniconda3\PythonTool_venv\Scripts"

3. activate pythontool_env

4. pip install patsy


I will try that and report