Python Forum
ModuleNotFound but pip shows module installed
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ModuleNotFound but pip shows module installed
#1
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: 
Reply
#2
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: 
Reply
#3
What is the output of

python --version

python3 --version
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Os command output in variable shows wrong value paulo79 2 1,523 Apr-09-2022, 03:48 PM
Last Post: ndc85430
  ModuleNotFound error. hammer 5 2,280 Mar-08-2022, 01:42 AM
Last Post: hammer
  No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong? Jghurt 5 4,255 May-08-2021, 07:03 PM
Last Post: Jghurt
  Help in designing a timestamp finder for chapter-less TV shows Daring_T 1 1,867 Oct-26-2020, 09:30 PM
Last Post: Daring_T
  how to find module in installed packages keuninkske 3 3,228 May-09-2020, 10:21 PM
Last Post: keuninkske
  colorbar for scatter shows no negatives values... gil 0 1,545 Apr-15-2020, 12:45 AM
Last Post: gil
  how to import a module which is installed to personal folder using pip install --pre? geekgeek 2 2,431 Mar-09-2020, 02:38 PM
Last Post: geekgeek
  bs4 beautifulsoup4 "module not found" but I confirmed it is installed mjglsn 1 16,411 Feb-01-2020, 12:12 AM
Last Post: metulburr
  2 versions of module installed, how to import the earlier one sveto4ka 8 4,816 Oct-22-2019, 02:51 PM
Last Post: snippsat
  after using openpyxl to add colors to script, black shows up white online in excel Soundtechscott 1 3,698 Jun-08-2019, 10:33 PM
Last Post: Soundtechscott

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020