Early bird tickets for Inspire 2023 are now available! Discounted pricing closes on January 31st. Save your spot!

Alteryx Designer Discussions

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

Python statsmodel.api error

pgdelafuente
7 - Meteor

Need help using this library in Python

 

Appreciate your response

 

import statsmodels.formula.api as sm

 

--------------------------------------------------------------------------- ImportError Traceback (most recent call last) in ----> 1 import statsmodels.formula.api as sm 2 c:\users\10007781\appdata\local\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\statsmodels\formula\api.py in 13 from statsmodels.robust.robust_linear_model import RLM 14 rlm = RLM.from_formula ---> 15 from statsmodels.discrete.discrete_model import MNLogit 16 mnlogit = MNLogit.from_formula 17 from statsmodels.discrete.discrete_model import Logit c:\users\10007781\appdata\local\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\statsmodels\discrete\discrete_model.py in 43 44 from statsmodels.base.l1_slsqp import fit_l1_slsqp ---> 45 from statsmodels.distributions import genpoisson_p 46 47 try: c:\users\10007781\appdata\local\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\statsmodels\distributions\__init__.py in 1 from .empirical_distribution import ECDF, monotone_fn_inverter, StepFunction ----> 2 from .edgeworth import ExpandedNormal 3 from .discrete import genpoisson_p, zipoisson, zigenpoisson, zinegbin c:\users\10007781\appdata\local\alteryx\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\statsmodels\distributions\edgeworth.py in 5 import numpy as np 6 from numpy.polynomial.hermite_e import HermiteE ----> 7 from scipy.misc import factorial 8 from scipy.stats import rv_continuous 9 import scipy.special as special ImportError: cannot import name 'factorial'

3 REPLIES 3
PaulN
Alteryx Alumni (Retired)

Hi @pgdelafuente,

 

Thank you for posting.

 

I have looked for your error message on Google and found a incompatibility issue: https://github.com/statsmodels/statsmodels/issues/5759

 

Could you please try the following:

 

1. Stop Alteryx Designer

 

2. Rename folder %ALTERYX_DIRECTORY%\bin\Miniconda3\envs\JupyterTool_vEnv\Lib\site-packages\scipy to scipy.old (replace %ALTERYX_DIRECTORY% with your installation folder)

 

3. Start Alteryx Designer as administrator if you have an admin version and, as usual otherwise

 

4. Drag a Python tool to the canvas, enter following code and run the cell

from ayx import Alteryx
Alteryx.installPackages('scipy==1.2.1')

 

5. Test your  code again:

import statsmodels.formula.api as sm

 

Remark: You might need to install extra packages like patsy for example 

 

Thanks,

 

PaulN

pgdelafuente
7 - Meteor

Thanks @PaulN 

 

I was able to fix the issues using your feedback.

 

Now im having problem with XGBoost 🙂

 

#StayHome

 

Pablo

PaulN
Alteryx Alumni (Retired)

Hi @pgdelafuente,

 

Thanks for the feedback.

 

Could you please create a different thread for the XGBoost issue?

 

Best,

 

Paul Noirel

Sr Customer Support Engineer, Alteryx

Labels