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

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

Open
RBNXI opened this issue Sep 5, 2023 · 33 comments
Open

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

RBNXI opened this issue Sep 5, 2023 · 33 comments

Comments

@RBNXI
Copy link

RBNXI commented Sep 5, 2023

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
Copy link
Member

Python version?

@RBNXI
Copy link
Author

RBNXI commented Sep 5, 2023

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

So python 3.11

@Cohee1207
Copy link
Member

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

@RBNXI
Copy link
Author

RBNXI commented Sep 5, 2023

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

@Cohee1207
Copy link
Member

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
Copy link
Author

RBNXI commented Sep 5, 2023

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
Copy link
Member

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
Copy link
Author

RBNXI commented Sep 5, 2023

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
Copy link
Member

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

@RBNXI
Copy link
Author

RBNXI commented Sep 5, 2023

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
Copy link
Member

I found this: rstudio/reticulate#1282 (comment)
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
Copy link
Author

RBNXI commented Sep 5, 2023

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
Copy link
Member

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

@RBNXI
Copy link
Author

RBNXI commented Sep 7, 2023

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
Copy link
Author

RBNXI commented Sep 7, 2023

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

@RBNXI
Copy link
Author

RBNXI commented Sep 7, 2023

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'

@RBNXI
Copy link
Author

RBNXI commented Sep 7, 2023

I did pip install wxPython, is not enough?

@RBNXI
Copy link
Author

RBNXI commented Sep 7, 2023

It installed fine

@RBNXI
Copy link
Author

RBNXI commented Sep 7, 2023

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

@RBNXI
Copy link
Author

RBNXI commented Sep 7, 2023

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
Copy link
Author

RBNXI commented Sep 7, 2023

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?

@RBNXI
Copy link
Author

RBNXI commented Sep 15, 2023

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...

@Meamzy
Copy link

Meamzy commented Oct 3, 2023

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

if "talkinghead" in modules:

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
Copy link

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

if "talkinghead" in modules:

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
Copy link
Author

RBNXI commented Oct 20, 2023

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

if "talkinghead" in modules:

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.

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

5 participants
@Cohee1207 @RBNXI @Meamzy @Aliceinchainsaw and others