Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems with modules
#1

Hello :),

I'm a newbie, started messing around with python a few days ago.
I find myself sitting hours about this shit actually.
No matter what I do, almost always when I run the python script I get an ModuleNotFoundError, and it doesn't even matter what package it is.

For example I'm trying to import the PyGithub module for a small project:

when using the command python [name_of_the_script], it returns: ImportError: No module named github

when using the command python3 [name_of_the_script], it returns:

Error:
Traceback (most recent call last): File "app.py", line 3, in <module> import github File "/home/mectos/.local/lib/python3.8/site-packages/github/__init__.py", line 58, in <module> from github.MainClass import Github, GithubIntegration File "/home/mectos/.local/lib/python3.8/site-packages/github/MainClass.py", line 56, in <module> import requests File "/home/mectos/.local/lib/python3.8/site-packages/requests/__init__.py", line 112, in <module> from . import utils File "/home/mectos/.local/lib/python3.8/site-packages/requests/utils.py", line 25, in <module> from . import certs File "/home/mectos/.local/lib/python3.8/site-packages/requests/certs.py", line 15, in <module> from certifi import where ModuleNotFoundError: No module named 'certifi'
when using the command python3.8 [name_of_the_script], it returns:
Error:
Traceback (most recent call last): File "app.py", line 3, in <module> import github File "/home/mectos/.local/lib/python3.8/site-packages/github/__init__.py", line 58, in <module> from github.MainClass import Github, GithubIntegration File "/home/mectos/.local/lib/python3.8/site-packages/github/MainClass.py", line 56, in <module> import requests File "/home/mectos/.local/lib/python3.8/site-packages/requests/__init__.py", line 112, in <module> from . import utils File "/home/mectos/.local/lib/python3.8/site-packages/requests/utils.py", line 25, in <module> from . import certs File "/home/mectos/.local/lib/python3.8/site-packages/requests/certs.py", line 15, in <module> from certifi import where ModuleNotFoundError: No module named 'certifi'
important note:
The thing is, it changes the "required" package every time. The scenario is as follows:
  • I get this error about the certain module
  • I run pip3 install [package]
  • it tells me that it already exists in /usr/bin/python3.8/dist_packages -> I navigate to this directory
  • manually run sudo rm -rf [package]
  • then run again pip3 install [package]
  • it downloads it successfully
  • I try again [python/python3/python3.8] [name_of_the_script]
  • And then it returns that some another random package is missing.

I presume I have some kind of problem with my packages or PYTHONPATH or whatever?

I'm actually baffled, started with python after a few months with HTML, CSS, JS and JS's package manager npm. So things are slightly different here in Python compared to JS.

Much appreciations in advance for all the help!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems reading modules and the auto filler Tomli 8 3,742 Apr-10-2020, 12:53 AM
Last Post: Tomli
  Modules issue, pip3 download modules only to pyhton3.5.2 not the latest 3.6.1 bmohanraj91 6 8,432 May-25-2017, 08:15 AM
Last Post: wavic

Forum Jump:

User Panel Messages

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