C
C
CrazyMolecule2021-02-16 12:34:49
Python
CrazyMolecule, 2021-02-16 12:34:49

Why can't I import the pynacl module? (discord.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, the error ModuleNotFoundError: No module named 'pynacl' appears . It's important to note that pynacl is already in the modules list.

When I install the module again pip install PyNaCl / pip3 install PyNaC l, the console shows that the module is already loaded.

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

I'm using IDLE Python 3.7.1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
CrazyMolecule, 2021-02-16
@CrazyMolecule

In short, I got it. The problem was that the Windows console was "tied" to Python version 3.6.7, and all modules were installed on it, and I was working in 3.7.1, respectively, hence the error.
How I fixed it:
1. Checked python3 --version and found that the console is tied to it.
2. Removed Python version 3.6.7.
3. Faced the problem "Fatal error in launcher".
4. Deleted the Python 3.6 folder from AppData\Local\Programs\Python.
5. Updated pip and downloaded pynacl.
Ready! :D

V
VISVO, 2021-02-16
@VISVO

This library is not called by pynacl but by:
import nacl
602b994f3f325903648231.png
602b999b9aabd566907433.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question