chrisrude / oobabot

A Discord bot which talks to Large Language Model AIs running on oobabooga's text-generation-webui
MIT License
98 stars 33 forks source link

Cannot import name 'GenericAlias' from partially initialized module 'types' -- circular import? #90

Closed CHA0SiUM closed 4 months ago

CHA0SiUM commented 4 months ago

Hi! Python neophyte here (but I did get text-generation-webui working, so I've got that goin' for me, which is nice). I tried installing oobabot, and if I try to run it, I get this circular import error:

Traceback (most recent call last): File "C:\Python312\Lib\site-packages\oobabot\oobabot.py", line 8, in import asyncio File "C:\Python312\Lib\asyncio__init.py", line 8, in from .base_events import * File "C:\Python312\Lib\asyncio\base_events.py", line 18, in import concurrent.futures File "C:\Python312\Lib\concurrent\futures__init__.py", line 8, in from concurrent.futures._base import (FIRST_COMPLETED, File "C:\Python312\Lib\concurrent\futures_base.py", line 7, in import logging File "C:\Python312\Lib\logging\init.py", line 26, in import sys, os, time, io, re, traceback, warnings, weakref, collections.abc File "C:\Python312\Lib\re\init__.py", line 124, in import enum File "C:\Python312\Lib\enum.py", line 3, in from types import MappingProxyType, DynamicClassAttribute File "C:\Python312\Lib\site-packages\oobabot\types.py", line 9, in import typing File "C:\Python312\Lib\typing.py", line 27, in import contextlib File "C:\Python312\Lib\contextlib.py", line 7, in from functools import wraps File "C:\Python312\Lib\functools.py", line 22, in from types import GenericAlias ImportError: cannot import name 'GenericAlias' from partially initialized module 'types' (most likely due to a circular import) (C:\Python312\Lib\site-packages\oobabot\types.py)

After some googling in the dark, I tried renaming types.py to something else (and had to rename it in a bunch of your .py files), but that didn't seem to do it for me. I've since reverted the changes but... anything I'm missing?

Maybe I'm not "starting" oobabot right? I'm navigating to C:\Python312\Lib\site-packages\oobabot\ which is where pip installed it on my machine, and I type "oobabot" (without parameters, I just want to see what happens), and well, I get the above.

jmoney7823956789378 commented 4 months ago

You should be using python -m oobabot on windows.

CHA0SiUM commented 4 months ago

I've actually cleaned up my environment -- I had two versions of Pythons installed, one of them in a weird directory (root), as you can see from my error message. I uninstalled both, reinstalled 3.12, and reinstalled oobabot.

I got an error "ModuleNotFoundError: No module named 'typing_extensions'", but I pip-installed typing-extensions manually, and now oobabot seems to be working. I mean I haven't got it to actually work yet, but it's now being invoked properly and it's expecting parameters (which I haven't fed it yet).

usage: oobabot [-h] [-c CONFIG] [--generate-config] [--invite-url] [--ai-name AI_NAME] [--persona PERSONA] [--wakewords [WAKEWORDS ...]] [--discord-token DISCORD_TOKEN] [--dont-split-responses] [--history-lines HISTORY_LINES] [--ignore-dms] [--reply-in-thread] [--stream-responses] [--base-url BASE_URL] [--log-all-the-things] [--message-regex MESSAGE_REGEX] [--image-words [IMAGE_WORDS ...]] [--stable-diffusion-url STABLE_DIFFUSION_URL] [--extra-prompt-text EXTRA_PROMPT_TEXT] oobabot: error: unrecognized arguments: test

I'll close this... thanks for your help, and apologies for the noise!