Skip to content

Libjuju 3.3.1.0 is unusable #1025

@gboutry

Description

@gboutry

Description

From inside a snap

When trying to import with from juju.controller import Controller from inside a snap, we get the following failure:

Traceback (most recent call last):
  File "/snap/openstack/x2/bin/sunbeam", line 6, in <module>
    from sunbeam.main import main
  File "/snap/openstack/x2/lib/python3.10/site-packages/sunbeam/main.py", line 23, in <module>
    from sunbeam.commands import configure as configure_cmds
  File "/snap/openstack/x2/lib/python3.10/site-packages/sunbeam/commands/configure.py", line 26, in <module>
    from sunbeam import utils
  File "/snap/openstack/x2/lib/python3.10/site-packages/sunbeam/utils.py", line 33, in <module>
    from sunbeam.plugins.interface.v1.base import PluginError
  File "/snap/openstack/x2/lib/python3.10/site-packages/sunbeam/plugins/interface/v1/base.py", line 30, in <module>
    from sunbeam.jobs.deployment import Deployment
  File "/snap/openstack/x2/lib/python3.10/site-packages/sunbeam/jobs/deployment.py", line 20, in <module>
    from juju.controller import Controller
  File "/snap/openstack/x2/lib/python3.10/site-packages/juju/controller.py", line 12, in <module>
    from .client import client, connector
  File "/snap/openstack/x2/lib/python3.10/site-packages/juju/client/connector.py", line 12, in <module>
    from juju.client.connection import Connection
  File "/snap/openstack/x2/lib/python3.10/site-packages/juju/client/connection.py", line 19, in <module>
    from juju.version import CLIENT_VERSION
  File "/snap/openstack/x2/lib/python3.10/site-packages/juju/version.py", line 19, in <module>
    CLIENT_VERSION = re.search(r'\d+\.\d+\.\d+', open(VERSION_FILE_PATH).read().strip()).group()
FileNotFoundError: [Errno 2] No such file or directory: '/snap/openstack/x2/lib/python3.10/site-packages/VERSION'

From inside a venv

When trying to import from juju.controller import Controller from inside a virtualenv, we get the following failure:

python3 -c "from juju.controller import Controller"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/ubuntu/testos/lib/python3.10/site-packages/juju/controller.py", line 12, in <module>
    from .client import client, connector
  File "/home/ubuntu/testos/lib/python3.10/site-packages/juju/client/connector.py", line 7, in <module>
    from packaging import version
ModuleNotFoundError: No module named 'packaging'

Side notes:
The snap has other dependencies that do include packaging, so no failure on packaging import
Everything works fine with Juju 3.3.0.0

Urgency

Annoying bug in our test suite

Python-libjuju version

3.3.1.0

Juju version

Unrelated

Reproduce / Test

How to reproduce both failure in a venv:


sudo apt update
sudo apt install python3.10-venv
python3 -m venv venv
source venv/bin/activate
pip install 'juju==3.3.1.0'
python3 -c "from juju.controller import Controller" <-- packaging import missing
pip install packaging
python3 -c "from juju.controller import Controller" <-- VERSION file not found error

Metadata

Metadata

Assignees

No one assigned

    Labels

    hint/3.xgoing on main branchkind/bugindicates a bug in the project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions