Okay so. I have recently put my public bot onto a hosting rather than use my computer. And they installed the correct version of discord.py rewrite with the [voice] bit at the end to install everything for voice. However when trying to connect the bot to a voice channel the console gives us this error.
Ignoring exception in command connect:
Traceback (most recent call last):
File "/home/container/discord/ext/commands/core.py", line 62, in wrapped
ret = await coro(*args, **kwargs)
File "/home/container/cogs/music.py", line 247, in connect_
await channel.connect()
File "/home/container/discord/abc.py", line 975, in connect
voice = VoiceClient(state=state, timeout=timeout, channel=self)
File "/home/container/discord/voice_client.py", line 92, in __init__
raise RuntimeError("PyNaCl library needed in order to use voice")
RuntimeError: PyNaCl library needed in order to use voice
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/container/discord/ext/commands/bot.py", line 898, in invoke
await ctx.command.invoke(ctx)
File "/home/container/discord/ext/commands/core.py", line 611, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/container/discord/ext/commands/core.py", line 71, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice
Even though PyNaCl is installed

If you're using a Linux environment, have you installed the required dependencies for voice?
See https://discordpy.readthedocs.io/en/rewrite/intro.html#installing.
I believe so yes
Correction the host just said it's docker, alpine
Correction the host just said it's docker, alpine
That is Linux.
I believe so yes
Why the ambiguity? Did you install them? Just check if you don't remember.
If you haven't, then you need to do so.
@Harmon758 As I said it's docker, alpine. The host does all the installing
Alpine is a Linux distribution.
I'm not sure what you mean, but just as you installed discord.py, you still need to install the dependencies required for voice, regardless of who installs it.
Docker does not install anything for you. Infact, the alpine image exists almost for the express purpose of not installing anything for you (it doesn't even have mount).
To get voice working on alpine, at the very least you need these packages:
build-base (To give you the required compilers to build CPython extensions)libffi-dev, libsodium-dev (PyNaCl does not issue wheels for alpine so it will need to be built, requiring the development headers)opus-dev (Opus is required by discord.py, and ctypes can't find the library without its development headers on alpine, for some reason)I recommend doing it like this, assuming git is already installed:
# First, update the package database:
apk update
# Install our build dependencies and tag them as `voice-build-deps`:
apk add --virtual .voice-build-deps build-base libffi-dev libsodium-dev
# Install everything that isn't a build dependency, that we will need later:
apk add libffi libsodium opus-dev
# Install the library through git (this should successfully build and install PyNaCl):
pip install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice]
# Tell apk we no longer need the build deps:
apk del .voice-build-deps
Judging from your explanation and screenshot, your host seems to be doing part of the process for you. If you can, try to configure it to be like the above.
Your screenshot also shows PyNaCl with two dist-infos. This should never be the case on a functioning install, so it's likely that your site-packages has been broken somehow. If your host allows it, try using a fresh environment.
Most helpful comment
Docker does not install anything for you. Infact, the
alpineimage exists almost for the express purpose of not installing anything for you (it doesn't even havemount).To get voice working on alpine, at the very least you need these packages:
build-base(To give you the required compilers to build CPython extensions)libffi-dev,libsodium-dev(PyNaCl does not issue wheels for alpine so it will need to be built, requiring the development headers)opus-dev(Opus is required by discord.py, andctypescan't find the library without its development headers on alpine, for some reason)I recommend doing it like this, assuming git is already installed:
Judging from your explanation and screenshot, your host seems to be doing part of the process for you. If you can, try to configure it to be like the above.
Your screenshot also shows PyNaCl with two
dist-infos. This should never be the case on a functioning install, so it's likely that your site-packages has been broken somehow. If your host allows it, try using a fresh environment.