Python Forum

Full Version: ModuleNotFound but pip shows module installed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I just encountered a strange problem. I'm trying to run my program but it fails to import modules at the beginning. Never-the-less pip reports that the modules are available. What can I do about this? Thanks in advance.

(Recruiter-bot) [brian@archlinux Recruiter-bot]$ /home/brian/Python/Recruiter-bot/Recuiter-bot/bin/python /home/brian/Python/Recruiter-bot/main.py
Traceback (most recent call last):
  File "/home/brian/Python/Recruiter-bot/main.py", line 4, in <module>
    import discord
ModuleNotFoundError: No module named 'discord'
(Recruiter-bot) [brian@archlinux Recruiter-bot]$ pip show discord
Name: discord
Version: 1.7.3
Summary: A mirror package for discord.py. Please install that instead.
Home-page: https://github.com/Rapptz/discord.py
Author: Rapptz
Author-email: 
License: UNKNOWN
Location: /home/brian/Python/Recruiter-bot/lib/python3.10/site-packages
Requires: discord.py
Required-by: 
If it makes a difference I am using vscode. Here is another example. I deactivate the venv to remove that as a variable in my problem.

[brian@archlinux Recruiter-bot]$ /usr/bin/python /home/brian/Python/Recruiter-bot/main.py
Traceback (most recent call last):
  File "/home/brian/Python/Recruiter-bot/main.py", line 21, in <module>
    from keep_alive import keep_alive
ModuleNotFoundError: No module named 'keep_alive'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fede9464280>
[brian@archlinux Recruiter-bot]$ pip show keep_alive
Name: keep-alive
Version: 0.0.1
Summary: A package to keep an application online with HTTPS requests.
Home-page: https://github.com/codebankco/keep-alive
Author: Multi
Author-email: [email protected]
License: UNKNOWN
Location: /home/brian/.local/lib/python3.10/site-packages
Requires: 
Required-by: 
What is the output of

python --version

python3 --version