alxbavy
alxbavy

Reputation: 160

I cant import pynacl module. (discrod.py - ModuleNotFoundError: No module named 'pynacl')

import discord
import pynacl

client = discord.Client()

@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
    if message.author == client.user:
        return
    if message.content.startswith('$'):
        if message.author.voice:
            await message.author.voice.channel.connect()
        return await message.channel.send(message.author.voice.channel)

After starting the program, an error appears ModuleNotFoundError: No module named 'pynacl'. It is important to note that pynacl is already in the module list. When I reinstall the module pip install PyNaCl/pip3 install PyNaCl, the console says the module is already loaded.

Tried: Reload IDLE and computer, tried import nacl (ModuleNotFoundError: No module named 'nacl'), and not import pynacl, reinstall module, and also used import discrod.py[voice]. If the module is not imported, it displays the following error: RuntimeError: PyNaCl library needed in order to use voice.

I am using IDLE Python 3.7.1

Upvotes: 3

Views: 9389

Answers (1)

alxbavy
alxbavy

Reputation: 160

In short, I figured it out. Thanks to everyone who took part in the discussion of the issue. The problem was that the Windows console was "tied" to the Python 3.6.7 version, and all modules were installed on it, and I was working in 3.7.1, hence the error.

As fixed:

  1. Checked python3 --version and found that the console is tied to it.
  2. Removed Python 3.6.7 version.
  3. Faced the problem "Fatal error in launcher".
  4. Removed the Python 3.6 folder from AppData\Local\Programs\Python.
  5. Updated pip and downloaded pynacl. Done! :D

Upvotes: 1

Related Questions