Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Python Tool Error

taylormgruendel
8 - Asteroid

Hi all,

 

I'm working on a use case that takes in Excel data and converts it into a PDF using a batch macro. The batch macro includes the Python tool. It keeps throwing the same error, anyone know how I could fix this? Thanks!

 

Error: Python (5): ---------------------------------------------------------------------------
CalledProcessError Traceback (most recent call last)
<ipython-input-1-6d6b99668050> in <module>
9
10 from ayx import Alteryx, Package
---> 11 Package.installPackages(['PyPDF2'])
12
13 from PyPDF2 import PdfFileWriter, PdfFileReader
c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\ayx\Package.py in installPackages(package, install_type, debug)
200 print(pip_install_result["msg"])
201 if not pip_install_result["success"]:
--> 202 raise pip_install_result["err"]
c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\ayx\Utils.py in runSubprocess(args_list, debug)
118
119 try:
--> 120 result = subprocess.check_output(args_list, stderr=subprocess.STDOUT)
121 if debug:
122 print("[Subprocess success!]")
c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs)
409 kwargs['input'] = '' if kwargs.get('universal_newlines', False) else b''
410
--> 411 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
412 **kwargs).stdout
413
c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs)
510 retcode = process.poll()
511 if check and retcode:
--> 512 raise CalledProcessError(retcode, process.args,
513 output=stdout, stderr=stderr)
514 return CompletedProcess(process.args, retcode, stdout, stderr)
CalledProcessError: Command '['c:\\program files\\alteryx\\bin\\miniconda3\\envs\\designerbasetools_venv\\python.exe', '-I', '-m', 'pip', 'install', 'PyPDF2']' returned non-zero exit status 1.

 

2 REPLIES 2
apathetichell
20 - Arcturus

Have you tried running as an admin- CalledProcessError: Command '['c:\\program files\\alteryx\\bin\\miniconda3\\envs\\designerbasetools_venv\\python.exe', '-I', '-m', 'pip', 'install', 'PyPDF2']' returned non-zero exit status 1. means that you had an issue in your pip command. I'd recommend installing necessary packages once- and then testing to see if they are installed prior to reinstalling. I'd recommend installing the necessary packages prior to trying to run as a macro.

taylormgruendel
8 - Asteroid

Thank you @apathetichell ! I ended up using Alteryx.installPackages(package="PyPDF2", install_type= "install --user"), and it worked.

Labels
Top Solution Authors