0

Both users foobar and foobiz are in same group on RHEL.

foobar$ python3 -m pip list

Package           Version
----------------- -------
oracledb          1.4.2
pip               21.3.1

foobiz$ python3 -m pip list
 
Package           Version
----------------- -------
pip               21.3.1

foobar$ head -3 my_python.py
from datetime import datetime
import time
import oracledb

The code executes for foobar, but foobiz gets the following message:

import oracledb
ModuleNotFoundError: No module named 'oracledb'

Questions:

  • Does foobiz need its own oracledb module?
  • How can I get foobiz to run run my_python.py with out installing oracledb for foobiz?
1
  • I'll recommend you to create a venv, install all necessary modules in that venv, change the ownership of that venv (change it to your common group), and before running your script, switch to that venv, your script will find all necessary modules. By default, pip installs packages for current user only. It's better to use venv. Commented Apr 16, 2024 at 10:20

1 Answer 1

1

User foobar may have a custom Python search Path. One thing you could do is:

import sys

sys.path 

and compare the respective outputs carefully.

Also, introspection can tell you the location of the lib eg:

import inspect
import oracledb

inspect.getfile(oracledb)

The doc also mention:

On Linux, do not pass the lib_dir parameter in the call: the Oracle Client libraries on Linux must be in the system library search path before the Python process starts.

Haven't looked in detail but it looks like the Python lib alone is not sufficient, Oracle Client libraries must be present as well. Possibly they have been installed in a user-specific directory, and are therefore not available system-wide to other users - just a thought. This could be an issue stemming from the way the libs were installed.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.