SillyTavern / SillyTavern-Extras

Extensions API for SillyTavern.
GNU Affero General Public License v3.0
549 stars 124 forks source link

Error: Could not import the 'talkinghead' module. #148

Open RBNXI opened 1 year ago

RBNXI commented 1 year ago

Reinstalled multiple times and installed all requirements, when trying to run it says:

Using torch device: cpu
Initializing talkinghead pipeline in cuda mode....
Error: Could not import the 'talkinghead' module.

Same with CPU mode

Cohee1207 commented 1 year ago

Python version?

RBNXI commented 1 year ago

I followed this installation guide: https://docs.sillytavern.app/extras/installation/

So python 3.11

Cohee1207 commented 1 year ago

And what is your operating system? Could you specify which requirement files you used exactly?

RBNXI commented 1 year ago

I'm using Arch Linux. The requirement files is this one: https://github.com/SillyTavern/SillyTavern-Extras/blob/main/requirements-complete.txt

Cohee1207 commented 1 year ago

Thank you for the clarification. wxpython is not automatically installed in Linux because it fails to install on colab but is needed to run this module. Please run this in your conda env: pip install wxpython==4.2.1

RBNXI commented 1 year ago

after successfully installing it, I run extras with the module activated and now it crashes with this error:


Python 3.11 or newer is recommended to run this program.
Traceback (most recent call last):
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/server.py", line 131, in <module>
    args = parser.parse_args()
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/lib/python3.10/argparse.py", line 1836, in parse_args
    self.error(msg % ' '.join(argv))
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/lib/python3.10/argparse.py", line 2592, in error
    self.print_usage(_sys.stderr)
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/lib/python3.10/argparse.py", line 2562, in print_usage
    self._print_message(self.format_usage(), file)
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/lib/python3.10/argparse.py", line 2528, in format_usage
    return formatter.format_help()
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/lib/python3.10/argparse.py", line 283, in format_help
    help = self._root_section.format_help()
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/lib/python3.10/argparse.py", line 214, in format_help
    item_help = join([func(*args) for func, args in self.items])
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/lib/python3.10/argparse.py", line 214, in <listcomp>
    item_help = join([func(*args) for func, args in self.items])
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/lib/python3.10/argparse.py", line 321, in _format_usage
    action_usage = format(optionals + positionals, groups)
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/lib/python3.10/argparse.py", line 396, in _format_actions_usage
    raise ValueError(f'empty group {group}')
ValueError: empty group <argparse._MutuallyExclusiveGroup object at 0x7f166957c400>

Trying to run it with only the talkinghead module, gives this other error:


Initializing talkinghead pipeline in cpu mode....
Traceback (most recent call last):
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/server.py", line 192, in <module>
    import talkinghead.tha3.app.app as talkinghead
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/talkinghead/tha3/app/app.py", line 11, in <module>
    import wx
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/lib/python3.10/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/lib/python3.10/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
ImportError: /run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by /run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/installer_files/env/lib/python3.10/site-packages/wx/_core.cpython-310-x86_64-linux-gnu.so)
Cohee1207 commented 1 year ago

The log implies that you are not running it with Python 3.11. (First line and this part: installer_files/env/lib/python3.10). I highly encourage you not to mix the Extras files with oobabooga files, Please put the installation folder somewhere, there could be conflicts between them that are hard to catch.

RBNXI commented 1 year ago

That's true, for this try I tried with the old installation and that's why, my bad. I didn't know the old installation had an old python version (this installation was not used in my other tries, just this one because I was lazy to reinstall again). I reinstalled again and now it crashes with this error:

python "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/server.py" --enable-modules=classify,talkinghead
Using torch device: cpu
Initializing talkinghead pipeline in cpu mode....
Traceback (most recent call last):
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/server.py", line 192, in <module>
    import talkinghead.tha3.app.app as talkinghead
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/talkinghead/tha3/app/app.py", line 11, in <module>
    import wx
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
ImportError: /run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by /run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/_core.cpython-311-x86_64-linux-gnu.so)
Cohee1207 commented 1 year ago

Try updating gcc-libs package with pacman. Or do a complete system update if possible.

RBNXI commented 1 year ago

I did a full update and remains the same (there was no gcc-libs updates available, I updated the last time yesterday so it's expected)

Cohee1207 commented 1 year ago

I found this: https://github.com/rstudio/reticulate/issues/1282#issuecomment-1272473007 This is for a different program, but outlines the potential solutions pretty nicely. I would try option 3 with replacing this library /run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/bin/../lib/libstdc++.so.6 with a symbolic link to your system libstdc++.so.6, which usually resides in usr/lib/x86_64-linux-gnu/libstdc++.so.6

RBNXI commented 1 year ago

Now crashes with this:


Initializing talkinghead pipeline in cpu mode....
Traceback (most recent call last):
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/server.py", line 192, in <module>
    import talkinghead.tha3.app.app as talkinghead
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/talkinghead/tha3/app/app.py", line 11, in <module>
    import wx
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
ImportError: /usr/lib/libcurl.so.4: undefined symbol: libssh2_session_set_read_timeout

I tried replacing with the symbolic link and also tried with the file the system link points to, same result.

Cohee1207 commented 1 year ago

Sorry, out of ideas for now, I don't have a broad Linux (or Arch specifically) knowledge to propose anything else.

Ph0rk0z commented 1 year ago

I have no problem with venv shared with textgen or python 3.10. Hardest part was installing wxpython because it needed gnome development libraries. I think I had to compile it from scratch.

op has broken libs: https://stackoverflow.com/questions/76902771/pacman-symbol-lookup-error-usr-lib-libcurl-so-4-undefined-symbol-libssh2-se

RBNXI commented 1 year ago

The problem was that I didn't set the correct path of the folder. Now I got it running but still throws an error when trying to load the default page:

Traceback (most recent call last):
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/flask_cors/extension.py", line 176, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/server.py", line 701, in result_feed
    return talkinghead.result_feed()
           ^^^^^^^^^^^
NameError: name 'talkinghead' is not defined
RBNXI commented 1 year ago

I have no problem with venv shared with textgen or python 3.10. Hardest part was installing wxpython because it needed gnome development libraries. I think I had to compile it from scratch.

op has broken libs: https://stackoverflow.com/questions/76902771/pacman-symbol-lookup-error-usr-lib-libcurl-so-4-undefined-symbol-libssh2-se

I checked the md5sum of my file and it's the same as the one in the official Arch repos, so I don't think I have broken libs

Also I get this if I run in the correct path:

(extras) [ruben@ruben SillyTavern-extras]$ python server.py --enable-modules=talkinghead
Using torch device: cpu
Initializing talkinghead pipeline in cpu mode....
Error: Could not import the 'talkinghead' module.
No API key given because you are running locally.
 * Serving Flask app 'server'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://localhost:5100
Press CTRL+C to quit

I'm in the path of the server.py file, all requirements installed and still could not import module

Ph0rk0z commented 1 year ago

You have to run the "app.py" python separately. It didn't auto start it for me. I usually run it first. For some reason on one of them, the eyes blink but the mouth doesn't move. There aren't a lot of chars with expressions that worked for me yet. I think I'll have to generate some and matte them.

RBNXI commented 1 year ago

You have to run the "app.py" python separately. It didn't auto start it for me. I usually run it first. For some reason on one of them, the eyes blink but the mouth doesn't move. There aren't a lot of chars with expressions that worked for me yet. I think I'll have to generate some and matte them.

what app.py do you mean? the one in talkinghead/tha3/app/? If I run it (from extras folder, conda environment active) it crashes with:

Traceback (most recent call last):
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/talkinghead/tha3/app/app.py", line 11, in <module>
    import wx
ModuleNotFoundError: No module named 'wx'
Ph0rk0z commented 1 year ago

Then you still didn't properly install wxpython. It was kind hard like I said, had to do it from source.

RBNXI commented 1 year ago

I did pip install wxPython, is not enough?

Ph0rk0z commented 1 year ago

Did it install or fail? It failed on me with that command until I installed a bunch of libs. Ended up compiling it.

https://stackoverflow.com/questions/8609666/python-importerror-no-module-named-wx

RBNXI commented 1 year ago

It installed fine

Ph0rk0z commented 1 year ago

Its not importing so it couldn't have or it went in wrong venv.

RBNXI commented 1 year ago

Well I know it couldn't import... but now I don't know why it could be, there's no other output apart from that one, and I didn't make the mistakes I made with the other errors, I don't know what I'm doing wrong now, everything else works perfectly

Ph0rk0z commented 1 year ago

does it show up when you pip list?

You can always do: https://aur.archlinux.org/packages/python-wxpython-git

RBNXI commented 1 year ago

does it show up when you pip list?

You can always do: https://aur.archlinux.org/packages/python-wxpython-git

it shows: wxPython 4.2.1

Maybe the version is not correct? Also depending on the directory I run from, I sometimes get this:

Traceback (most recent call last):
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/talkinghead/tha3/app/app.py", line 11, in <module>
    import wx
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
ImportError: /usr/lib/libcurl.so.4: undefined symbol: libssh2_session_set_read_timeout

I think it's the same error I got in RVC, but that one got solved with the correct cd, but this one won't...

RBNXI commented 1 year ago

So if I run it normally I get this:


(extras) [ruben@ruben SillyTavern-extras]$ python server.py --enable-modules=talkinghead
Using torch device: cpu
Initializing talkinghead pipeline in cpu mode....
Traceback (most recent call last):
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/server.py", line 192, in <module>
    import talkinghead.tha3.app.app as talkinghead
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/talkinghead/tha3/app/app.py", line 11, in <module>
    import wx
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
ImportError: /run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by /run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/_core.cpython-311-x86_64-linux-gnu.so)

And the problem could be the version of that library, so I try replacing with my library which is the correct version and then get this other error:


(extras) [ruben@ruben SillyTavern-extras]$ python server.py --enable-modules=talkinghead
Using torch device: cpu
Initializing talkinghead pipeline in cpu mode....
Traceback (most recent call last):
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/server.py", line 192, in <module>
    import talkinghead.tha3.app.app as talkinghead
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/SillyTavern-extras/talkinghead/tha3/app/app.py", line 11, in <module>
    import wx
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/run/media/ruben/Prime/CharacterAI/oobabooga_linux/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
ImportError: /usr/lib/libcurl.so.4: undefined symbol: libssh2_session_set_read_timeout

And trying to replace more libraries doesn't change anything anymore. And trying to run app.py has other errors... Is this absolutely only my fault? no one else has this errors?

Ph0rk0z commented 1 year ago

I had problems with wxpython like you but I googled them all and fixed it. What I do different is I have an nvidia conda environment with latest torch and not 50 venv for each project. Super rare that requirements are actually those versions for a reason. Some of these repos want you to install torch 1.0.x like a crazy person.

You have to investigate why curl is broken.. my guess is when you fix the glib for WX it's different from the one curl was compiled for. These are total arch problems which is why when I installed my ML server I was like arch, fuck no. Went with mint to have some stability in libraries.

I think your fastest fix is to put glib back how it was and compile wx from source instead of using the pip package.

RBNXI commented 1 year ago

Update: After a lot of updates on Arch this days and reinstalling extras, the error is exactly the same. I think that this is not an Arch problem but a problem with this program itself...

Ph0rk0z commented 1 year ago

Well.. if you think so. It runs on my machine.

Meamzy commented 12 months ago

@RBNXI, you might not have the requirements installed, I had same issue and figured it out here: https://github.com/SillyTavern/SillyTavern-Extras/blob/0d73db91e745ed22cc2829326acee45139b1a513/server.py#L183

Basically if there are modules not found (no matter which module) this will return you

except ModuleNotFoundError:
        print("Error: Could not import the 'talkinghead' module.")

So I did:

    except Exception as err:
        print(err)
        print("Error: Could not import the 'talkinghead' module.")

And found out I didn't have some modules installed, such as 'scipy", so I went to the requirements-complete and installed it from there. (had to skip a couple of failing ones)

Aliceinchainsaw commented 11 months ago

@RBNXI, you might not have the requirements installed, I had same issue and figured it out here:

https://github.com/SillyTavern/SillyTavern-Extras/blob/0d73db91e745ed22cc2829326acee45139b1a513/server.py#L183

Basically if there are modules not found (no matter which module) this will return you

except ModuleNotFoundError:
        print("Error: Could not import the 'talkinghead' module.")

So I did:

    except Exception as err:
        print(err)
        print("Error: Could not import the 'talkinghead' module.")

And found out I didn't have some modules installed, such as 'scipy", so I went to the requirements-complete and installed it from there. (had to skip a couple of failing ones)

Excellent tip, mine was missing 'matplotlib'

RBNXI commented 11 months ago

@RBNXI, you might not have the requirements installed, I had same issue and figured it out here:

https://github.com/SillyTavern/SillyTavern-Extras/blob/0d73db91e745ed22cc2829326acee45139b1a513/server.py#L183

Basically if there are modules not found (no matter which module) this will return you

except ModuleNotFoundError:
        print("Error: Could not import the 'talkinghead' module.")

So I did:

    except Exception as err:
        print(err)
        print("Error: Could not import the 'talkinghead' module.")

And found out I didn't have some modules installed, such as 'scipy", so I went to the requirements-complete and installed it from there. (had to skip a couple of failing ones)

As I sad in my last comment, I don't have the "Could not import the 'talkinghead' module." error anymore. Running server.py crashes with ImportError: /run/media/ruben/Prime/CharacterAI/SillyTavern-extras/miniconda/envs/extras/bin/../lib/libstdc++.so.6: version GLIBCXX_3.4.32 not found (required by /run/media/ruben/Prime/CharacterAI/SillyTavern-extras/miniconda/envs/extras/lib/python3.11/site-packages/wx/_core.cpython-311-x86_64-linux-gnu.so)

And I installed all the requirements from requirements-complete, so I don't think it's a problem with python requirements.