Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundError #165

Closed
federicotorrielli opened this issue Jun 20, 2024 · 14 comments
Closed

FileNotFoundError #165

federicotorrielli opened this issue Jun 20, 2024 · 14 comments

Comments

@federicotorrielli
Copy link

No module named 'ballyregan'
Traceback (most recent call last):
  File "/home/paperspace/MidLLMan/backend/api.py", line 12, in <module>
    from llm_handler import LLMHandler
  File "/home/paperspace/MidLLMan/backend/llm_handler.py", line 6, in <module>
    from poe_api_wrapper import PoeApi
  File "/home/paperspace/miniforge3/envs/midllman/lib/python3.10/site-packages/poe_api_wrapper/__init__.py", line 5, in <module>
    from .llm import LLM_PACKAGE
  File "/home/paperspace/miniforge3/envs/midllman/lib/python3.10/site-packages/poe_api_wrapper/llm.py", line 4, in <module>
    from .openai.api import start_server
  File "/home/paperspace/miniforge3/envs/midllman/lib/python3.10/site-packages/poe_api_wrapper/openai/api.py", line 13, in <module>
    with open(DIR + "\\models.json", "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/paperspace/miniforge3/envs/midllman/lib/python3.10/site-packages/poe_api_wrapper/openai\\models.json'

To fix this, please make it so it is not OS-dependent:

import os

DIR = os.path.dirname(os.path.realpath(__file__))

with open(os.path.join(DIR, "models.json"), "r") as f:
    # ...
@snowby666
Copy link
Owner

Thanks for your report. This is resolved in v1.4.9

@realnoob007
Copy link

The error might still exists in the latest version. I am currently using poe-api-wrapper==1.4.9 and get the same error when running openai/api.py

@snowby666 snowby666 reopened this Jun 21, 2024
@snowby666
Copy link
Owner

The error might still exists in the latest version. I am currently using poe-api-wrapper==1.4.9 and get the same error when running openai/api.py

can you specify your os and python version?

@snowby666
Copy link
Owner

Ah I've found the problem. When building binary dist the json files got ignored

@realnoob007
Copy link

The error might still exists in the latest version. I am currently using poe-api-wrapper==1.4.9 and get the same error when running openai/api.py

can you specify your os and python version?

running on windows 11, python 3.11

@snowby666
Copy link
Owner

I've just updated the setup.py config, it should work now.

@realnoob007
Copy link

I've just updated the setup.py config, it should work now.

Yes, it works now, thanks.

@edisonzf2020
Copy link

edisonzf2020 commented Jun 22, 2024

Still has the bug with ubuntu22.04 + python3.10

python ./poe_api_wrapper/openai/api.py 
No module named 'ballyregan'
2024-06-22 16:47:28,001 INFO     Starting server at tcp:port=8000:interface=127.0.0.1
2024-06-22 16:47:28,001 INFO     HTTP/2 support not enabled (install the http2 and tls Twisted extras)
2024-06-22 16:47:28,001 INFO     Configuring endpoint tcp:port=8000:interface=127.0.0.1
2024-06-22 16:47:28,001 INFO     Listening on TCP address 127.0.0.1:8000
^C2024-06-22 16:47:33,953 INFO     Killed 0 pending application instances

@snowby666
Copy link
Owner

Still has the bug with ubuntu22.04 + python3.10

python ./poe_api_wrapper/openai/api.py 
No module named 'ballyregan'
2024-06-22 16:47:28,001 INFO     Starting server at tcp:port=8000:interface=127.0.0.1
2024-06-22 16:47:28,001 INFO     HTTP/2 support not enabled (install the http2 and tls Twisted extras)
2024-06-22 16:47:28,001 INFO     Configuring endpoint tcp:port=8000:interface=127.0.0.1
2024-06-22 16:47:28,001 INFO     Listening on TCP address 127.0.0.1:8000
^C2024-06-22 16:47:33,953 INFO     Killed 0 pending application instances

That's working
ballyregan is for poe-api-wrapper[proxy]
You can still use the lib normally or install the proxy version and the msg will be gone

@edisonzf2020
Copy link

but no work

python ./poe_api_wrapper/openai/api.py
No module named 'ballyregan'
2024-06-22 23:33:22,066 INFO     Starting server at tcp:port=8020:interface=0.0.0.0
2024-06-22 23:33:22,066 INFO     HTTP/2 support not enabled (install the http2 and tls Twisted extras)
2024-06-22 23:33:22,067 INFO     Configuring endpoint tcp:port=8020:interface=0.0.0.0
2024-06-22 23:33:22,067 INFO     Listening on TCP address 0.0.0.0:8020
2024-06-22 23:34:07,851 INFO     HTTP Request: GET https://poe.com "HTTP/2 403 Forbidden"
2024-06-22 23:34:07.852 | INFO     | poe_api_wrapper.bundles:init_window:21 - Initializing web data
2024-06-22 23:34:07.853 | INFO     | poe_api_wrapper.bundles:init_window:41 - Web data initialized
2024-06-22 23:34:07.853 | ERROR    | poe_api_wrapper.async_api:load_bundle:111 - Failed to load bundle. Reason: 'NoneType' object has no attribute 'group'
2024-06-22 23:34:08,556 INFO     HTTP Request: GET https://poe.com/api/settings "HTTP/2 200 OK"
2024-06-22 23:34:08.557 | ERROR    | poe_api_wrapper.async_api:connect_ws:248 - Failed to get channel settings. Reason: Sending request SubscriptionsMutation failed.  Error log: TypeError('can only concatenate str (not "NoneType") to str')
2024-06-22 23:34:10,262 INFO     HTTP Request: GET https://poe.com/api/settings "HTTP/2 200 OK"
2024-06-22 23:34:10.265 | ERROR    | poe_api_wrapper.async_api:connect_ws:248 - Failed to get channel settings. Reason: Sending request SubscriptionsMutation failed.  Error log: TypeError('can only concatenate str (not "NoneType") to str')
172.16.0.12:48952 - - [22/Jun/2024:23:34:11] "POST /v1/chat/completions" 500 21
2024-06-22 23:34:12,107 ERROR    Exception inside application: Rate limit exceeded for sending requests to poe.com. Please try again later.
Traceback (most recent call last):
  File "/home/fanai/.conda/envs/poe/lib/python3.10/asyncio/tasks.py", line 232, in __step
    result = coro.send(None)
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/routing.py", line 776, in app
    await route.handle(scope, receive, send)
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle
    await self.app(scope, receive, send)
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/starlette/routing.py", line 72, in app
    response = await func(request)
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app
    raw_response = await run_endpoint_function(
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
  File "/opt/works/AI/poe/poe_api_wrapper/openai/api.py", line 65, in chat_completions
    client = await AsyncPoeApi(token).create()
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/poe_api_wrapper/async_api.py", line 90, in create
    await self.connect_ws()
  File "/home/fanai/.conda/envs/poe/lib/python3.10/site-packages/poe_api_wrapper/async_api.py", line 243, in connect_ws
    raise RuntimeError("Rate limit exceeded for sending requests to poe.com. Please try again later.")
RuntimeError: Rate limit exceeded for sending requests to poe.com. Please try again later.

@snowby666
Copy link
Owner

Seems like the wrapper couldn't get the formkey. Try passing it manually:

from poe_api_wrapper import PoeServer

tokens = {
"p-b": "XXXXXXX",
"p-lat": "XXXXXXXX",
"formkey": "XXXXXXX"
}

PoeServer(tokens=tokens)

@edisonzf2020
Copy link

again, same errors

python api.py
No module named 'ballyregan'
2024-06-23 11:57:27,936 INFO     Starting server at tcp:port=8030:interface=127.0.0.1
2024-06-23 11:57:27,936 INFO     HTTP/2 support not enabled (install the http2 and tls Twisted extras)
2024-06-23 11:57:27,936 INFO     Configuring endpoint tcp:port=8030:interface=127.0.0.1
2024-06-23 11:57:27,937 INFO     Listening on TCP address 127.0.0.1:8030
127.0.0.1:46670 - - [23/Jun/2024:11:57:35] "GET /v1/models" 200 14868
2024-06-23 11:57:44,143 INFO     HTTP Request: GET https://poe.com "HTTP/2 403 Forbidden"
2024-06-23 11:57:44.146 | INFO     | poe_api_wrapper.bundles:init_window:21 - Initializing web data
2024-06-23 11:57:44.148 | INFO     | poe_api_wrapper.bundles:init_window:41 - Web data initialized
2024-06-23 11:57:44.148 | ERROR    | poe_api_wrapper.async_api:load_bundle:111 - Failed to load bundle. Reason: 'NoneType' object has no attribute 'group'
2024-06-23 11:57:44,423 INFO     HTTP Request: GET https://poe.com/api/settings "HTTP/2 200 OK"
2024-06-23 11:57:44.425 | ERROR    | poe_api_wrapper.async_api:connect_ws:248 - Failed to get channel settings. Reason: Sending request SubscriptionsMutation failed.  Error log: TypeError('can only concatenate str (not "NoneType") to str')
2024-06-23 11:57:45,700 INFO     HTTP Request: GET https://poe.com/api/settings "HTTP/2 200 OK"
2024-06-23 11:57:45.701 | ERROR    | poe_api_wrapper.async_api:connect_ws:248 - Failed to get channel settings. Reason: Sending request SubscriptionsMutation failed.  Error log: TypeError('can only concatenate str (not "NoneType") to str')
127.0.0.1:46682 - - [23/Jun/2024:11:57:46] "POST /v1/chat/completions" 500 21
2024-06-23 11:57:46,951 ERROR    Exception inside application: Rate limit exceeded for sending requests to poe.com. Please try again later.
Traceback (most recent call last):
  File "/root/miniconda3/envs/poe/lib/python3.10/asyncio/tasks.py", line 232, in __step
    result = coro.send(None)
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/routing.py", line 776, in app
    await route.handle(scope, receive, send)
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle
    await self.app(scope, receive, send)
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/starlette/routing.py", line 72, in app
    response = await func(request)
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app
    raw_response = await run_endpoint_function(
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
  File "/opt/poe/poe_api_wrapper/openai/./api.py", line 65, in chat_completions
    client = await AsyncPoeApi(token).create()
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/poe_api_wrapper/async_api.py", line 90, in create
    await self.connect_ws()
  File "/root/miniconda3/envs/poe/lib/python3.10/site-packages/poe_api_wrapper/async_api.py", line 243, in connect_ws
    raise RuntimeError("Rate limit exceeded for sending requests to poe.com. Please try again later.")
RuntimeError: Rate limit exceeded for sending requests to poe.com. Please try again later.

@snowby666
Copy link
Owner

Can you check your tokens again if they are correct and try this example ^^:

from poe_api_wrapper import PoeApi

tokens = {
   ...
}
client = PoeApi(tokens)

for chunk in client.send_message("a2", "Hello!"):
      print(chunk["response"], flush=True, end="")

@edisonzf2020
Copy link

check p-b p-lat poe-formkey again
try your example:

(poe) root@mail:/opt/poe# python check.py 
No module named 'ballyregan'
2024-06-23 14:30:12.309 | INFO     | poe_api_wrapper.bundles:init_window:21 - Initializing web data
2024-06-23 14:30:12.311 | INFO     | poe_api_wrapper.bundles:init_window:41 - Web data initialized
2024-06-23 14:30:12.311 | ERROR    | poe_api_wrapper.api:load_bundle:92 - Failed to load bundle. Reason: 'NoneType' object has no attribute 'group'
2024-06-23 14:30:12.584 | ERROR    | poe_api_wrapper.api:connect_ws:228 - Failed to get channel settings. Reason: Sending request SubscriptionsMutation failed.  Error log: TypeError('can only concatenate str (not "NoneType") to str')
2024-06-23 14:30:13.827 | ERROR    | poe_api_wrapper.api:connect_ws:228 - Failed to get channel settings. Reason: Sending request SubscriptionsMutation failed.  Error log: TypeError('can only concatenate str (not "NoneType") to str')
Traceback (most recent call last):
  File "/opt/poe/check.py", line 8, in <module>
    client = PoeApi(tokens)
  File "/opt/poe/poe_api_wrapper/api.py", line 75, in __init__
    self.connect_ws()
  File "/opt/poe/poe_api_wrapper/api.py", line 223, in connect_ws
    raise RuntimeError("Rate limit exceeded for sending requests to poe.com. Please try again later.")
RuntimeError: Rate limit exceeded for sending requests to poe.com. Please try again later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants