You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi thanks for this amazing project, it is actually more accurate than langchain one and pandasAI, but i observe this issue excpecially when running on windows system.
fromcodeinterpreterapiimportCodeInterpreterSessionfromcodeinterpreterapi.schemaimportFileasyncdefmain():
# context manager for auto start/stop of the sessionasyncwithCodeInterpreterSession(openai_api_key="openai-api-key") assession:
# define the user requestuser_request="Analyze this dataset and plot something interesting about it."files= [
File.from_path(r'C:\Users\myuser\Desktop\myai\uploaded-files\b699c5b9-ea83-42e9-ac61-5c6fa738214a.csv'),
]
# generate the responseresponse=awaitsession.generate_response(
user_request, files=files
)
# output to the userprint("AI: ", response.content)
forfileinresponse.files:
file.show_image()
if__name__=="__main__":
importasyncioasyncio.run(main())
Traceback (most recent call last):
File "c:\Users\Al-amin I\Desktop\SafAI\e.py", line 28, in <module>
asyncio.run(main())
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "c:\Users\Al-amin I\Desktop\SafAI\e.py", line 7, in main
async with CodeInterpreterSession(openai_api_key="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") as session:
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\site-packages\codeinterpreterapi\session.py", line 190, in __aenter__
await self.astart()
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\site-packages\codeinterpreterapi\session.py", line 31, in astart
await self.codebox.astart()
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\site-packages\codeboxapi\box\localbox.py", line 111, in astart
self.subprocess = await asyncio.create_subprocess_exec(
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\asyncio\subprocess.py", line 218, in create_subprocess_exec
transport, protocol = await loop.subprocess_exec(
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1675, in subprocess_exec
transport = await self._make_subprocess_transport(
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 394, in _make_subprocess_transport
transp = _WindowsSubprocessTransport(self, protocol, args, shell,
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\asyncio\base_subprocess.py", line 36, in __init__
self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 896, in _start
self._proc = windows_utils.Popen(
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_utils.py", line 153, in __init__
super().__init__(args, stdin=stdin_rfd, stdout=stdout_wfd,
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Al-amin I\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1440, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002A2591FF9A0>
Hmm I am not 100% sure because I dont have a windows system and it looks like the problem has something todo with windows. But I guess that some binary for starting the jupyter kernel with the codebox-api is missing. Maybe you can try in a different python environment or just use cloud hosted solutions like Github Codespaces or Goodle Colab.
But also maybe someone else using windows has some ideas what todo
AI: Sorry, something went while generating your response.Please try again or restart the session.
Even if we got passed this issue I've still got that result above. On Linux VPS too have the same result.
Is there any debug mode available so that we know where the issue might happen? I mean its a good library but the way its currently working we won't be able to use it in production if it can suddenly produces random issues.
In an environment where a virtual environment is created with the venv module, if I run venv/Scripts/activate and then python main.py, it works fine, but if I run venv/Scripts/python main.py without running venv/Scripts/activate, I get an error similar to this.
Then you don't get the basic error output for stuff that is happening in the CodeBox.
I review the code, such as below
def from_path(cls, path: str):
if not path.startswith("/"):
path = f"./{path}"
with open(path, "rb") as f:
path = path.split("/")[-1]
return cls(name=path, content=f.read())
but Windows path like as r"C:\b699c5b9-ea83-42e9-ac61-5c6fa738214a.csv" , r"C:\b699c5b9-ea83-42e9-ac61-5c6fa738214a.csv" or "C:/b699c5b9-ea83-42e9-ac61-5c6fa738214a.csv", not start with "".
I think it may be worked out it when using "from pathlib import PurePath" to find the path and add elif clause.
Activity
shroominic commentedon Jul 17, 2023
@Al-aminI Thanks!:)
Can you tell me what code you were trying to run and maybe you got a traceback this would help a lot!
Al-aminI commentedon Jul 17, 2023
shroominic commentedon Jul 18, 2023
Hmm I am not 100% sure because I dont have a windows system and it looks like the problem has something todo with windows. But I guess that some binary for starting the jupyter kernel with the codebox-api is missing. Maybe you can try in a different python environment or just use cloud hosted solutions like Github Codespaces or Goodle Colab.
But also maybe someone else using windows has some ideas what todo
savire commentedon Jul 22, 2023
AI: Sorry, something went while generating your response.Please try again or restart the session.
Even if we got passed this issue I've still got that result above. On Linux VPS too have the same result.
Is there any debug mode available so that we know where the issue might happen? I mean its a good library but the way its currently working we won't be able to use it in production if it can suddenly produces random issues.
shroominic commentedon Jul 22, 2023
You can enable more details for the session.generate_response method
https://github.com/shroominic/codeinterpreter-api/blob/66759f263f497c691ada5cefbdf89edc3e642baa/codeinterpreterapi/session.py#L171C9-L171C38
Then you don't get the basic error output for stuff that is happening in the CodeBox.
rakkyo150 commentedon Jul 22, 2023
In an environment where a virtual environment is created with the
venv
module, if I runvenv/Scripts/activate
and thenpython main.py
, it works fine, but if I runvenv/Scripts/python main.py
without runningvenv/Scripts/activate
, I get an error similar to this.savire commentedon Jul 23, 2023
Yeah I've already using the toggle from the main class.
Also just a note for you, might be helpful for others too. Those error message might appears if the user does not have access yet to GPT-4.
Although probably not intended passing an older model like GPT-3.5 at least will make sure the libs are working.
v479038280 commentedon Jul 27, 2023
I GOT THE SAME QUESTION.
Roych13 commentedon Sep 21, 2023
I review the code, such as below
but Windows path like as r"C:\b699c5b9-ea83-42e9-ac61-5c6fa738214a.csv" , r"C:\b699c5b9-ea83-42e9-ac61-5c6fa738214a.csv" or "C:/b699c5b9-ea83-42e9-ac61-5c6fa738214a.csv", not start with "".
I think it may be worked out it when using "from pathlib import PurePath" to find the path and add elif clause.