Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Python tool - Error while importing a sklearn module

igoorgabriel
6 - Meteoroid

Guys, looking at the alteryx page about the python tool, it states that we can use the scikit-learn lib.

 

Maybe i'm doing something wrong or doesn't apply to my version: 2019.3.2.15763

 

But when I try to import, pops out an error.

 

The import: 
from sklearn.metrics import mean_absolute_error

 

It also happen when I try just a full import:
import sklearn

 

The error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-5b9632b5019b> in <module>
      1 from ayx import Alteryx
----> 2 from sklearn.metrics import mean_absolute_error

c:\program files\alteryx 2019.3\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\sklearn\__init__.py in <module>
     74 else:
     75     from . import __check_build
---> 76     from .base import clone
     77     from .utils._show_versions import show_versions
     78 

c:\program files\alteryx 2019.3\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\sklearn\base.py in <module>
     14 
     15 from . import __version__
---> 16 from .utils import _IS_32BIT
     17 
     18 _DEFAULT_TAGS = {

c:\program files\alteryx 2019.3\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\sklearn\utils\__init__.py in <module>
     15 from .murmurhash import murmurhash3_32
     16 from .class_weight import compute_class_weight, compute_sample_weight
---> 17 from . import _joblib
     18 from ..exceptions import DataConversionWarning
     19 from .deprecation import deprecated

c:\program files\alteryx 2019.3\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\sklearn\utils\_joblib.py in <module>
      6     # joblib imports may raise DeprecationWarning on certain Python
      7     # versions
----> 8     import joblib
      9     from joblib import logger
     10     from joblib import dump, load

ModuleNotFoundError: No module named 'joblib'

 

2 REPLIES 2
porter_samu
6 - Meteoroid

@igoorgabriel have you tried Alteryx.installPackages("joblib")?

igoorgabriel
6 - Meteoroid

Yeap, already tried, but also returned an error.

 

But on my enviroment I need to work only with the basics already installed by Alteryx, can't rely on package installation.

 

That's why using scikit-learn would save my life hahahahah because it's listed as ground lib for Python Tool

 

---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
c:\program files\alteryx 2019.3\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\ayx\Utils.py in runSubprocess(args_list, debug)
     57     try:
---> 58         result = subprocess.check_output(args_list, stderr=subprocess.STDOUT)
     59         if debug:

c:\program files\alteryx 2019.3\bin\miniconda3\envs\jupytertool_venv\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs)
    355     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
--> 356                **kwargs).stdout    357 

c:\program files\alteryx 2019.3\bin\miniconda3\envs\jupytertool_venv\lib\subprocess.py in run(input, timeout, check, *popenargs, **kwargs)
    437             raise CalledProcessError(retcode, process.args,
--> 438                                      output=stdout, stderr=stderr)    439     return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command '['c:\\program files\\alteryx 2019.3\\bin\\miniconda3\\envs\\jupytertool_venv\\python.exe', '-m', 'pip', 'install', 'joblib']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-8-c9fa045958ce> in <module>
      2 # script here (only missing packages will be installed)
      3 from ayx import Package
----> 4 Package.installPackages(['joblib'])

c:\program files\alteryx 2019.3\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\ayx\Package.py in installPackages(package, install_type, debug)
    107     pip_install_result = runSubprocess(
    108             [python_exe, "-m", "pip"] + pip_args_list,
--> 109             debug=debug
    110             )
    111 

c:\program files\alteryx 2019.3\bin\miniconda3\envs\jupytertool_venv\lib\site-packages\ayx\Utils.py in runSubprocess(args_list, debug)
     81     # if any errors, print them to output
     82     except subprocess.CalledProcessError as e:
---> 83         output_msg = e.output.decode("utf-8").strip()
     84         if debug:
     85             print("[Subprocess failed.]")

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe7 in position 210: invalid continuation byte
Labels