oracle / oracle/oci-cli

ModuleNotFoundError: No module named 'src' | Installed via pip install oci_cli in container

Open
#976 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
669
Forks
236
Avg merge
1m
Merged PRs (30d)
4

Description

If oci_cli is installed via pypi, it cannot be executed correctly.

$ podman run --rm -it quay.io/centos/centos:stream9 bash
bash-5.1# yum install python3-pip
bash-5.1# pip install oci_cli
bash-5.1# oci --version
3.64.0
bash-5.1# oci support incident createTraceback (most recent call last):
  File "/usr/local/bin/oci", line 5, in <module>
    from oci_cli.cli import cli
  File "/usr/local/lib/python3.9/site-packages/oci_cli/__init__.py", line 30, in <module>
    dl.load_required_services_for_invocation()
  File "/usr/local/lib/python3.9/site-packages/oci_cli/dynamic_loader.py", line 53, in load_required_services_for_invocation
    load_service_from_command(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/oci_cli/dynamic_loader.py", line 86, in load_service_from_command
    load_service(arg)
  File "/usr/local/lib/python3.9/site-packages/oci_cli/dynamic_loader.py", line 92, in load_service
    load_service_modules(path.join(services_dir, service_mapping[service][0]), service_mapping[service][0])
  File "/usr/local/lib/python3.9/site-packages/oci_cli/dynamic_loader.py", line 109, in load_service_modules
    load_extended(path.join(modules, mod), service, mod)
  File "/usr/local/lib/python3.9/site-packages/oci_cli/dynamic_loader.py", line 125, in load_extended
    load_module(".{service}.src.{mod}.{extended_mod}".format(service=service, mod=mod, extended_mod=file[:-3]))
  File "/usr/local/lib/python3.9/site-packages/oci_cli/dynamic_loader.py", line 129, in load_module
    __import__(ALL_SERVICES_DIR + mod_path)
  File "/usr/local/lib/python3.9/site-packages/services/cims/src/oci_cli_incident/cims_cli_extended.py", line 16, in <module>
    from src.oci_cli import cli_exceptions
ModuleNotFoundError: No module named 'src'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the CentOS Stream 9 container and pip-installed oci_cli, then start with oci_cli/dynamic_loader.py and services/cims/src/oci_cli_incident/cims_cli_extended.py from the traceback. Trace why the installed package cannot resolve src.oci_cli.cli_exceptions; done means the reported oci support incident create command runs successfully from the pip installation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.