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

Unable to import client #10

Closed
etvoight opened this issue Apr 24, 2023 · 14 comments
Closed

Unable to import client #10

etvoight opened this issue Apr 24, 2023 · 14 comments
Labels
bug Something isn't working

Comments

@etvoight
Copy link

Getting the below errors when trying to run python main.py

I'm a relative beginner with this so apologies if I'm doing something obviously wrong.

image

@hc20k
Copy link
Owner

hc20k commented Apr 24, 2023

No worries! Did you install the dependencies from requirements.txt? The script requires a fork of discord.py with voice support. You can install it manually with: pip install git+https://github.com/Sheepposu/discord.py@voice-receive

@etvoight
Copy link
Author

Looks like that solved that problem, thank you! I just tried testing the bot using the "/info" command within the Discord server. I'm getting the below error message and in Discord it's saying the bot is not responding.

Any ideas/help with this?

[04-24 18:47:01] [tree.py:798] ERROR - Ignoring exception in command 'info'
Traceback (most recent call last):
  File "/usr/local/python/3.10.4/lib/python3.10/configparser.py", line 790, in get
    value = d[option]
  File "/usr/local/python/3.10.4/lib/python3.10/collections/__init__.py", line 986, in __getitem__
    return self.__missing__(key)            # support subclasses that define __missing__
  File "/usr/local/python/3.10.4/lib/python3.10/collections/__init__.py", line 978, in __missing__
    raise KeyError(key)
KeyError: 'reminder'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/discord/app_commands/commands.py", line 841, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
  File "/workspaces/Discord-Chatbot/llmchat/client.py", line 286, in print_info
    value=self.config.bot_reminder if self.config.bot_reminder is not None else "*Not set!*",
  File "/workspaces/Discord-Chatbot/llmchat/config.py", line 214, in bot_reminder
    return self._config.get("Bot", "reminder")
  File "/usr/local/python/3.10.4/lib/python3.10/configparser.py", line 793, in get
    raise NoOptionError(option, section)
configparser.NoOptionError: No option 'reminder' in section: 'Bot'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/discord/app_commands/tree.py", line 1248, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/discord/app_commands/commands.py", line 867, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/discord/app_commands/commands.py", line 860, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'info' raised an exception: NoOptionError: No option 'reminder' in section: 'Bot'

@hc20k
Copy link
Owner

hc20k commented Apr 24, 2023

Ah yes, this is a bug with the config parser. I'll push an update soon to fix this, but for now you can add reminder = in the [Bot] category and the error should go away.

@hc20k hc20k added the bug Something isn't working label Apr 24, 2023
@etvoight
Copy link
Author

Awesome! Your fixes have worked, thank you again.

The (hopefully) last issue I'm running into is that the voice Discord is reading responses in is still the default Discord TTS voice and not the Eleven Labs voice I have created. I've added my Eleven Labs API key as well as the voice ID for the voice I want to use but that hasn't seemed to work.

Is there another configuration I have missed?

hc20k added a commit that referenced this issue Apr 25, 2023
Added easy update script to update the repo along with an easy dependency chooser/installer
Add reminder to the example config.
Fixed issue where not having a reminder would throw an Exception #7 #10
Added the {date} and {nl} wildcards
Updated documentation
Fixed issue where /models would fail if the request to get TTS voices took too long
@hc20k
Copy link
Owner

hc20k commented Apr 25, 2023

The ElevenLabs TTS doesn't replace the default discord tts, you have to join a voice channel and the bot will join after you. If you want the bot to just read its replies and ignore your voice, set Bot.audiobook_mode to true. :) Let me know if that works for you!

@etvoight
Copy link
Author

Oh ok got it. Sorry, misunderstood how it worked!

I've got the bot responding to messages, but it's still not using my Eleven Labs voice. I think it may have to do with this error I'm seeing when I install the requirements.txt.

Building wheels for collected packages: PyAudio
  Building wheel for PyAudio (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for PyAudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/pyaudio
      copying src/pyaudio/__init__.py -> build/lib.linux-x86_64-cpython-310/pyaudio
      running build_ext
      building 'pyaudio._portaudio' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/src
      creating build/temp.linux-x86_64-cpython-310/src/pyaudio
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include -I/usr/include -I/usr/local/python/3.10.4/include/python3.10 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-310/src/pyaudio/device_api.o
      src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
          9 | #include "portaudio.h"
            |          ^~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for PyAudio
Failed to build PyAudio
ERROR: Could not build wheels for PyAudio, which is required to install pyproject.toml-based projects

I've been trying a bunch of different fixes I've found online but no luck. Any guidance?

@hc20k
Copy link
Owner

hc20k commented Apr 25, 2023

Since you're on linux, you have to install portaudio19-dev using your package manager and it should work after :) It's a dependency of pyaudio

@etvoight
Copy link
Author

Weird, I'm on Windows 10. Do you know why that error is being thrown since I'm not on Linux?

@hc20k
Copy link
Owner

hc20k commented Apr 25, 2023

Weird, I'm on Windows 10. Do you know why that error is being thrown since I'm not on Linux?

Wait really? Are you using WSL?

@etvoight
Copy link
Author

Negative. Vanilla Windows 10, running the code through Github Codespaces. Could that have something to do with it? Should I try running the code using a different environment?

@hc20k
Copy link
Owner

hc20k commented Apr 25, 2023

Ah yes that would be it, I'm pretty sure they run Linux. If you can install portaudio19-dev on the codespaces machine that should fix the error, or you can clone it locally and try running it on your Windows 10 machine

@etvoight
Copy link
Author

Running it locally has fixed that issue! I've got the bot working correctly in audiobook mode on a private Discord server.

Two things I've faced now that it's responding:

  1. I haven't been able to get it to respond to my voice (assuming it's supposed to based on my understanding of your documentation). I've tried different microphones and have given the bot basically every permission in Discord.
  2. The Discord default TTS voice is playing overtop of the ElevenLabs voice. I've disabled TTS readouts in Discord's accessibility settings, but the robotic TTS voice is still playing.

Any ideas about those two points?

@etvoight
Copy link
Author

@hc20k Disregard the second question, I figured that one out. Turns out there's a separate setting in Discord to enable TTS for notifications, which is what was being triggered.

@hc20k
Copy link
Owner

hc20k commented Apr 30, 2023

Running it locally has fixed that issue! I've got the bot working correctly in audiobook mode on a private Discord server.

Two things I've faced now that it's responding:

  1. I haven't been able to get it to respond to my voice (assuming it's supposed to based on my understanding of your documentation). I've tried different microphones and have given the bot basically every permission in Discord.
  2. The Discord default TTS voice is playing overtop of the ElevenLabs voice. I've disabled TTS readouts in Discord's accessibility settings, but the robotic TTS voice is still playing.

Any ideas about those two points?

Hmm, for your first issue, which TTS service are you using? I find that whisper works really well compared to google.

@hc20k hc20k closed this as completed May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants