gptscript-ai / gptscript

Build AI assistants that interact with your systems
https://gptscript.ai
Apache License 2.0
3.03k stars 269 forks source link

Windows - Not able to get python based tools to work without having VCRUNTIME140.DLL installed. #298

Closed sangee2004 closed 3 months ago

sangee2004 commented 5 months ago

gptscript version - v0.0.0-dev-cb54f3b0-dirty Set up - Windows 11 Pro VM on Azure.

Steps to reproduce the problem:

  1. Execute gptscript that has uses remote python based tool.
    
    tools: github.com/sangee2004/testrepo/pythontool

greetings

2. gptscript execution fails with `exit status 0xc0000135`

.\gptscript.exe --disable-cache --debug .\testpython2.gpt { "level": "debug", "logger": "/pkg/loader", "msg": "opened testpython2.gpt", "time": "2024-04-26T20:22:28Z" } { "level": "debug", "logger": "/pkg/loader", "msg": "opened https://raw.githubusercontent.com/sangee2004/testrepo/807de896c266c9bfd3af2ae1b2459caa38b07d18/pythontool/tool.gpt", "time": "2024-04-26T20:22:28Z" } { "input": "", "level": "debug", "logger": "/pkg/monitor", "msg": "Run started", "program": { "name": ".\testpython2.gpt", "entryToolId": "testpython2.gpt:1", "toolSet": { "https://raw.githubusercontent.com/sangee2004/testrepo/807de896c266c9bfd3af2ae1b2459caa38b07d18/pythontool/tool.gpt:1": { "name": "test-tool", "description": "greetings", "modelName": "gpt-4-turbo-preview", "internalPrompt": null, "instructions": "#!/usr/bin/env python3 ${GPTSCRIPT_TOOL_DIR}/main.py", "id": "https://raw.githubusercontent.com/sangee2004/testrepo/807de896c266c9bfd3af2ae1b2459caa38b07d18/pythontool/tool.gpt:1", "localTools": { "test-tool": "https://raw.githubusercontent.com/sangee2004/testrepo/807de896c266c9bfd3af2ae1b2459caa38b07d18/pythontool/tool.gpt:1" }, "source": { "location": "https://raw.githubusercontent.com/sangee2004/testrepo/807de896c266c9bfd3af2ae1b2459caa38b07d18/pythontool/tool.gpt", "lineNo": 1, "repo": { "VCS": "git", "Root": "https://github.com/sangee2004/testrepo.git", "Path": "pythontool", "Name": "tool.gpt", "Revision": "807de896c266c9bfd3af2ae1b2459caa38b07d18" } }, "workingDir": "https://raw.githubusercontent.com/sangee2004/testrepo/807de896c266c9bfd3af2ae1b2459caa38b07d18/pythontool" }, "testpython2.gpt:1": { "modelName": "gpt-4-turbo-preview", "internalPrompt": null, "tools": [ "github.com/sangee2004/testrepo/pythontool" ], "instructions": "greetings", "id": "testpython2.gpt:1", "toolMapping": { "github.com/sangee2004/testrepo/pythontool": "https://raw.githubusercontent.com/sangee2004/testrepo/807de896c266c9bfd3af2ae1b2459caa38b07d18/pythontool/tool.gpt:1" }, "localTools": { "": "testpython2.gpt:1" }, "source": { "location": "testpython2.gpt", "lineNo": 1 }, "workingDir": "." } } }, "runID": "1", "time": "2024-04-26T20:22:28Z" } { "id": "1", "input": "", "level": "info", "logger": "/pkg/monitor", "msg": "started [main]", "parentID": "", "time": "2024-04-26T20:22:28Z", "toolID": "testpython2.gpt:1" } { "id": "1", "level": "info", "logger": "/pkg/monitor", "msg": "sent [main]", "parentID": "", "time": "2024-04-26T20:22:28Z", "toolID": "testpython2.gpt:1" } { "completionID": "1", "id": "1", "level": "debug", "logger": "/pkg/monitor", "msg": "debug", "parentID": "", "request": { "model": "gpt-4-turbo-preview", "messages": [ { "role": "system", "content": "\nYou are task oriented system.\nYou receive input from a user, process the input from the given instructions, and then output the result.\nYour objective is to provide consistent and correct results.\nYou do not need to explain the steps taken, only provide the result to the given instructions.\nYou are referred to as a tool.\nYou don't move to the next step until you have a result.\n\ngreetings" } ], "temperature": 0, "tools": [ { "type": "function", "function": { "name": "pythontool", "description": "greetings", "parameters": null } } ] }, "time": "2024-04-26T20:22:28Z", "toolID": "testpython2.gpt:1" } content [1] content | Waiting for model response... content [1] content | tool call pythontool -> {} { "cached": false, "completionID": "1", "id": "1", "level": "debug", "logger": "/pkg/monitor", "msg": "debug", "parentID": "", "response": { "role": "assistant", "content": [ { "toolCall": { "index": 0, "id": "call_5EnNNOsKJ7vtoFxrpM9zRN6U", "function": { "name": "pythontool", "arguments": "{}" } } } ] }, "time": "2024-04-26T20:22:30Z", "toolID": "testpython2.gpt:1" } { "id": "call_5EnNNOsKJ7vtoFxrpM9zRN6U", "input": "{}", "level": "info", "logger": "/pkg/monitor", "msg": "started [test-tool(2)]", "parentID": "1", "time": "2024-04-26T20:22:30Z", "toolID": "https://raw.githubusercontent.com/sangee2004/testrepo/807de896c266c9bfd3af2ae1b2459caa38b07d18/pythontool/tool.gpt:1" } { "level": "debug", "logger": "/pkg/repos", "msg": "Runtime python3.12 supports [/usr/bin/env python3 ${GPTSCRIPT_TOOL_DIR}/main.py]", "time": "2024-04-26T20:22:30Z" } { "level": "info", "logger": "/pkg/repos/git", "msg": "Cloning https://github.com/sangee2004/testrepo.git", "time": "2024-04-26T20:22:30Z" } Cloning into bare repository 'C:\Users\sangeetha\AppData\Local\cache\gptscript\repos\git\repos\f557c026c70814ea3835f8b3d3c822fa589fbf5fc02cb6fab23841b5b00072a0'... remote: Enumerating objects: 6, done. remote: Counting objects: 100% (6/6), done. remote: Compressing objects: 100% (5/5), done. remote: Total 6 (delta 0), reused 1 (delta 0), pack-reused 0 Receiving objects: 100% (6/6), done. { "level": "info", "logger": "/pkg/repos/git", "msg": "Fetching 807de896c266c9bfd3af2ae1b2459caa38b07d18 at https://github.com/sangee2004/testrepo.git", "time": "2024-04-26T20:22:31Z" } From https://github.com/sangee2004/testrepo

[notice] A new release of pip is available: 23.3.2 -> 24.0 [notice] To update, run: C:\Users\sangeetha\AppData\Local\cache\gptscript\repos\runtimes\python\95223bbea48009fc7d259386d46c711e02d2fa531478c2d9de5aa6deef99edd1.download\python\python.exe -m pip install --upgrade pip { "level": "info", "logger": "/pkg/repos/runtimes/python", "msg": "Creating virtualenv in C:\Users\sangeetha\AppData\Local\cache\gptscript\repos\runtimes\venv\29e60b89a5a313899bb8c1affa83a63ae228532c35d8701170e1a9da56f5df80", "time": "2024-04-26T20:23:00Z" } { "cached": false, "completionID": "1", "id": "call_5EnNNOsKJ7vtoFxrpM9zRN6U", "level": "debug", "logger": "/pkg/monitor", "msg": "debug", "parentID": "1", "response": { "err": { "Stderr": null }, "output": "" }, "time": "2024-04-26T20:23:05Z", "toolID": "https://raw.githubusercontent.com/sangee2004/testrepo/807de896c266c9bfd3af2ae1b2459caa38b07d18/pythontool/tool.gpt:1" } { "err": "exit status 0xc0000135", "level": "debug", "logger": "/pkg/monitor", "msg": "Run stopped", "output": "", "runID": "1", "time": "2024-04-26T20:23:05Z" } 2024/04/26 20:23:05 exit status 0xc0000135



**Note:**

To get around this issue , I had to install `VCRUNTIME140.DLL` using https://aka.ms/vs/17/release/vc_redist.x64.exe. After this , i am able to get the python tool to work as expected.
drpebcak commented 5 months ago

This might still be a thing, but can you try again? We've switched out the version of python we are using on windows, so this might not be a problem anymore.

sangee2004 commented 5 months ago

Tested with gptscript version v0.0.0-dev-ec6d147b-dirty . I am still getting the following error when trying to execute python based tools in Windows 11 Pro VM on Azure without installing VCRUNTIME140.DLL using https://aka.ms/vs/17/release/vc_redist.x64.exe.

PS C:\Users\sangeetha\gptscript> .\gptscript.exe .\testpython2.gpt
01:03:39 started  [main]
01:03:39 sent     [main]
         content  [1] content | Waiting for model response...
         content  [1] content | tool call pythontool -> {}
         content  [1] content | tool call pythontool -> {}
01:03:40 started  [test-tool(2)] [input={}]
01:03:40 Fetching 807de896c266c9bfd3af2ae1b2459caa38b07d18 at https://github.com/sangee2004/testrepo.git
01:03:40 started  [test-tool(3)] [input={}]
01:03:41 Checking out 807de896c266c9bfd3af2ae1b2459caa38b07d18 to C:\Users\sangeetha\AppData\Local\cache\gptscript\repos\807de896c266c9bfd3af2ae1b2459caa38b07d18\python3.12
01:03:41 Creating virtualenv in C:\Users\sangeetha\AppData\Local\cache\gptscript\repos\runtimes\venv\687446f50e5b26d131cae44a450d454844961263c6aabff8453b65686e6fee77
01:03:41 Fetching 807de896c266c9bfd3af2ae1b2459caa38b07d18 at https://github.com/sangee2004/testrepo.git
01:03:41 usage    [total=155] [prompt=112] [completion=43]
2024/05/17 01:03:41 exit status 0xc0000135
PS C:\Users\sangeetha\gptscript> cat .\testpython2.gpt
tools: github.com/sangee2004/testrepo/pythontool

greetings
drpebcak commented 5 months ago

Too bad, well in that case it isn't really a bug.. just needs a documentation update to let people know about the dependency.

cjellick commented 3 months ago

@drpebcak did you say we could make this a dependency in winget?

drpebcak commented 3 months ago

Yes, this has been done.

sangee2004 commented 3 months ago

This is already available as dependency now.