Start your journey with Alteryx Machine Learning - Take our Interactive Lesson today!
Start your learning journey with Alteryx Machine Learning Interactive Lessons
Go to LessonsJust for context, im a complete beginner in git. Im trying to run a simple python script (.py) file from git using the Alteryx Python tool. However, Im an error message is returned which im not able to solve. Below are more details of my issue. Any help will be appreciated, thank you!
For testing, the python script (https://github.com/gjunhao/AlteryxTest) is made out of a single line: print("hello git")
Within the Alteryx Python tool (running as administrator), i have the code:
from ayx import Alteryx Alteryx.installPackages(package="git+https://github.com/gjunhao/AlteryxTest.git") |
(with reference to https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Python-Tool-How-to-install-additional-...)
When i run the workflow, the following error is returned:
Collecting git+https://github.com/gjunhao/AlteryxTest.git Cloning https://github.com/gjunhao/AlteryxTest.git to c:\users\XXX admin\appdata\local\temp\pip-req-build-tl_wd8tj ERROR: Command errored out with exit status 1: command: 'c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\XXX Admin\\AppData\\Local\\Temp\\pip-req-build-tl_wd8tj\\setup.py'"'"'; __file__='"'"'C:\\Users\\XXX Admin\\AppData\\Local\\Temp\\pip-req-build-tl_wd8tj\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\XXX Admin\AppData\Local\Temp\pip-pip-egg-info-70s8utd2' cwd: C:\Users\XXX Admin\AppData\Local\Temp\pip-req-build-tl_wd8tj\ Complete output (5 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\tokenize.py", line 392, in open buffer = _builtin_open(filename, 'rb') FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\XXX Admin\\AppData\\Local\\Temp\\pip-req-build-tl_wd8tj\\setup.py' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
--------------------------------------------------------------------------- CalledProcessError Traceback (most recent call last) <ipython-input-2-cc645952831d> in <module> 2 3 from ayx import Alteryx ----> 4 Alteryx.installPackages(package="git+https://github.com/gjunhao/AlteryxTest.git") c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\ayx\export.py in installPackage(package, install_type, debug, **kwargs) 131 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. 132 """ --> 133 __installPackages__(package, install_type=install_type, debug=debug, **kwargs) 134 135 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', 'git+https://github.com/gjunhao/AlteryxTest.git']' returned non-zero exit status 1.
You can try to use command line to clone the Alteryx Test Folder/Package into the following location:
C:\Program Files\Alteryx\bin\Miniconda3\envs\DesignerBaseTools_vEnv\Lib\site-packages
Once you have done that, you should be able to import the needed package by using import AlteryxTest
Hello
To run Python scripts from Github, you need to clone or download the repository containing the script. Once you have the script on your local machine, you can run it using the command line or terminal by using the command "python [script name].py". You may need to install any required dependencies or libraries before running the script.