oobabooga / text-generation-webui

A Gradio web UI for Large Language Models.
GNU Affero General Public License v3.0
40.6k stars 5.31k forks source link

ERROR:Failed to load the extension "openai". #4010

Closed thistleknot closed 9 months ago

thistleknot commented 1 year ago

Describe the bug

ERROR:Failed to load the extension "openai". when I try to load it from cli

Is there an existing issue for this?

Reproduction

this might be related to another issue (can't install requirements.txt) https://github.com/oobabooga/text-generation-webui/issues/4005#issuecomment-1728717754

Screenshot

image

Logs

Output generated in 13.28 seconds (6.18 tokens/s, 82 tokens, context 6, seed 286069800)
Closing server running on port: 7860
2023-09-20 20:35:26 INFO:Loading the extension "gallery"...
2023-09-20 20:35:26 INFO:Loading the extension "openai"...
2023-09-20 20:35:27 ERROR:Failed to load the extension "openai".
Traceback (most recent call last):
  File "/data/text-generation-webui/modules/extensions.py", line 36, in load_extensions
    exec(f"import extensions.{name}.script")
  File "<string>", line 1, in <module>
  File "/data/text-generation-webui/extensions/openai/script.py", line 24, in <module>
    import speech_recognition as sr
ModuleNotFoundError: No module named 'speech_recognition'

Thanks for being a Gradio user! If you have questions or feedback, please join our Discord server and chat with us: https://discord.gg/feTf9x3ZSB
Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.
127.0.0.1 - - [20/Sep/2023 20:41:52] code 404, message Not Found
127.0.0.1 - - [20/Sep/2023 20:41:52] "POST /v1/completions HTTP/1.1" 404 -
127.0.0.1 - - [20/Sep/2023 20:42:38] code 404, message Not Found
127.0.0.1 - - [20/Sep/2023 20:42:38] "POST /v1//completions HTTP/1.1" 404 -
127.0.0.1 - - [20/Sep/2023 20:44:28] code 404, message Not Found
127.0.0.1 - - [20/Sep/2023 20:44:28] "POST /v1//chat/completions HTTP/1.1" 404 -
127.0.0.1 - - [20/Sep/2023 20:44:42] code 404, message Not Found
127.0.0.1 - - [20/Sep/2023 20:44:42] "POST /v1//chat/completions HTTP/1.1" 404 -
Traceback (most recent call last):
  File "/data/text-generation-webui/server.py", line 229, in <module>
    time.sleep(0.5)
KeyboardInterrupt

(textgen) [root@pve0 text-generation-webui]#
(textgen) [root@pve0 text-generation-webui]#
(textgen) [root@pve0 text-generation-webui]# python server.py --api --listen --extensions openai
2023-09-20 20:45:32 INFO:Loading the extension "openai"...
2023-09-20 20:45:33 ERROR:Failed to load the extension "openai".
Traceback (most recent call last):
  File "/data/text-generation-webui/modules/extensions.py", line 36, in load_extensions
    exec(f"import extensions.{name}.script")
  File "<string>", line 1, in <module>
  File "/data/text-generation-webui/extensions/openai/script.py", line 24, in <module>
    import speech_recognition as sr
ModuleNotFoundError: No module named 'speech_recognition'
Starting streaming server at ws://0.0.0.0:5005/api/v1/stream
2023-09-20 20:45:33 INFO:Loading the extension "gallery"...
Starting API at http://0.0.0.0:5000/api
Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.

System Info

oracle linux 8
heroygt commented 1 year ago

+1

korkota commented 1 year ago

I've similar issue:

To create a public link, set `share=True` in `launch()`.
Closing server running on port: 7860
2023-09-26 10:53:01 INFO:Loading the extension "gallery"...
2023-09-26 10:53:01 INFO:Loading the extension "openai"...
2023-09-26 10:53:01 ERROR:Failed to load the extension "openai".
Traceback (most recent call last):
  File "F:\Projects\text-generation-webui\modules\extensions.py", line 36, in load_extensions
    exec(f"import extensions.{name}.script")
  File "<string>", line 1, in <module>
  File "F:\Projects\text-generation-webui\extensions\openai\script.py", line 7, in <module>
    import extensions.openai.completions as OAIcompletions
  File "F:\Projects\text-generation-webui\extensions\openai\completions.py", line 3, in <module>
    import tiktoken
ModuleNotFoundError: No module named 'tiktoken'
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
thistleknot commented 1 year ago

pip install tiktoken sentence_transformers

On Tue, Sep 26, 2023 at 1:09 AM Alexey Korkota @.***> wrote:

I've similar issue:

To create a public link, set share=True in launch(). Closing server running on port: 7860 2023-09-26 10:53:01 INFO:Loading the extension "gallery"... 2023-09-26 10:53:01 INFO:Loading the extension "openai"... 2023-09-26 10:53:01 ERROR:Failed to load the extension "openai". Traceback (most recent call last): File "F:\Projects\text-generation-webui\modules\extensions.py", line 36, in load_extensions exec(f"import extensions.{name}.script") File "", line 1, in File "F:\Projects\text-generation-webui\extensions\openai\script.py", line 7, in import extensions.openai.completions as OAIcompletions File "F:\Projects\text-generation-webui\extensions\openai\completions.py", line 3, in import tiktoken ModuleNotFoundError: No module named 'tiktoken' Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch().

— Reply to this email directly, view it on GitHub https://github.com/oobabooga/text-generation-webui/issues/4010#issuecomment-1735040755, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHKKOWS2JDLFWAJEC65VFDX4KESVANCNFSM6AAAAAA5A3Y57Q . You are receiving this because you authored the thread.Message ID: @.***>

happyme531 commented 1 year ago

https://github.com/oobabooga/text-generation-webui/issues/3974#issue-1899918708

korkota commented 1 year ago

pip install tiktoken sentence_transformers On Tue, Sep 26, 2023 at 1:09 AM Alexey Korkota @.> wrote: I've similar issue: To create a public link, set share=True in launch(). Closing server running on port: 7860 2023-09-26 10:53:01 INFO:Loading the extension "gallery"... 2023-09-26 10:53:01 INFO:Loading the extension "openai"... 2023-09-26 10:53:01 ERROR:Failed to load the extension "openai". Traceback (most recent call last): File "F:\Projects\text-generation-webui\modules\extensions.py", line 36, in load_extensions exec(f"import extensions.{name}.script") File "", line 1, in File "F:\Projects\text-generation-webui\extensions\openai\script.py", line 7, in import extensions.openai.completions as OAIcompletions File "F:\Projects\text-generation-webui\extensions\openai\completions.py", line 3, in import tiktoken ModuleNotFoundError: No module named 'tiktoken' Running on local URL: http://127.0.0.1:7860 To create a public link, set share=True in launch(). — Reply to this email directly, view it on GitHub <#4010 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHKKOWS2JDLFWAJEC65VFDX4KESVANCNFSM6AAAAAA5A3Y57Q . You are receiving this because you authored the thread.Message ID: @.>

I've tried to install all dependencies from openai/requirements.txt but an api responded 503. Now I'm using 1.6.0, and it just works.

yohaskan commented 1 year ago

Same thing here Titoken first, and after a manual pip3 install -r requirements.txt 2023-09-26 16:28:52 ERROR:Failed to load the extension "openai". Traceback (most recent call last): File "E:\PROJETS\AI-Text\modules\extensions.py", line 36, in load_extensions exec(f"import extensions.{name}.script") File "", line 1, in File "E:\PROJETS\AI-Text\extensions\openai\script.py", line 9, in import extensions.openai.embeddings as OAIembeddings File "E:\PROJETS\AI-Text\extensions\openai\embeddings.py", line 6, in from sentence_transformers import SentenceTransformer

mallory303 commented 1 year ago

I guess that's a global extension loading problem, because I can't load any extensions, I've got the same error message:

...line 36, in load_extensions exec(f"import extensions.{name}.script")

lklk1111 commented 1 year ago

version 1.6 : work ok last version 1.6.1 : this openai extension error, can't install tiktoken

deevis commented 1 year ago

Make sure you're in the active miniconda environment before pip installing...

For those of you on windows:

.\cmd_windows.bat
pip install tiktoken sentence_transformers SpeechRecognition
goocy commented 1 year ago

Thanks, this helped under Linux too: ./cmd_linux.sh, and pip install [whatever's missing].

digizun commented 12 months ago

To summarize:

in my linux install this "fixed" the issue maybe it just needs to be added to the right requirements file.

conda activate installer_files/env/ pip install tiktoken sentence_transformers SpeechRecognition sse_starlette conda deactivate

kentative commented 11 months ago

I am seeing the same issue but running with Docker. I would have to modify requirements.txt and re-run docker compose up --build?

lafintiger commented 11 months ago

I am having this issue as well.

2023-12-09 15:47:49 INFO:Loading the extension "openai"... 2023-12-09 15:47:49 ERROR:Failed to load the extension "openai". Traceback (most recent call last): File "/Users/lafintiger/aidev/text-generation-webui/modules/extensions.py", line 36, in load_extensions exec(f"import extensions.{name}.script") File "", line 1, in File "/Users/lafintiger/aidev/text-generation-webui/extensions/openai/script.py", line 14, in from sse_starlette import EventSourceResponse ModuleNotFoundError: No module named 'sse_starlette'

I have install sse_starlette and its dependencies.

Thoughts anyone?

iceburgcrm commented 11 months ago

Try: pip install tiktoken sentence_transformers SpeechRecognition sse_starlette

github-actions[bot] commented 9 months ago

This issue has been closed due to inactivity for 6 weeks. If you believe it is still relevant, please leave a comment below. You can tag a developer in your comment.