Python in Linux: "ImportError: No module named X", but library exists

Question:

I’ve recently updated a python script of mine in my server after installing Selenium. Whenever I try to execute the script: I get "ImportError Module: No module named schedule", even tho it is installed:

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: schedule in ./JET/.local/lib/python3.8/site-packages (1.1.0)

It happens with every library, and every librari is installed.

I don’t want to place the package in the same folder as the script, it raises even more errors.

I execute the script via a another shell script, but it never gave me this error before.

My guessings are it has to do with PATH, but I don’t know what to do.

Thanks in advance!

Asked By: spund3

||

Answers:

(Sorry for not writing this as a comment, but I cannot comment yet.)

Hi, I wonder if that could be related to this question or this another one.

I wonder if adding path before the import might help

import sys 
sys.path.append("./JET/.local/lib/python3.8/site-packages")
import schedule
Answered By: Matej
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.