** Summary changed:

- Python docker package does not import, crashes due to urllib3 upgrade
+ [SRU] Python docker package does not import, crashes due to urllib3 upgrade

** Description changed:

- This is on a fresh install of the 24.04 beta that was released on April
- 12.  I used the Desktop installer, into a VMware Fusion VM, on amd64.
+ [ Impact ]
+ 
+ python3-docker is completely unusable. It will fail immediately when the
+ user tries to import the module to use it.
+ 
+ 
+ $ python3
+ Python 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] on linux
+ Type "help", "copyright", "credits" or "license" for more information.
+ >>> import docker
+ Traceback (most recent call last):
+   File "<stdin>", line 1, in <module>
+   File "/usr/lib/python3/dist-packages/docker/__init__.py", line 2, in 
<module>
+     from .api import APIClient
+   File "/usr/lib/python3/dist-packages/docker/api/__init__.py", line 2, in 
<module>
+     from .client import APIClient
+   File "/usr/lib/python3/dist-packages/docker/api/client.py", line 10, in 
<module>
+     from .. import auth
+   File "/usr/lib/python3/dist-packages/docker/auth.py", line 5, in <module>
+     from . import credentials
+   File "/usr/lib/python3/dist-packages/docker/credentials/__init__.py", line 
2, in <module>
+     from .store import Store
+   File "/usr/lib/python3/dist-packages/docker/credentials/store.py", line 7, 
in <module>
+     from .utils import create_environment_dict
+   File "/usr/lib/python3/dist-packages/docker/credentials/utils.py", line 1, 
in <module>
+     import distutils.spawn
+ ModuleNotFoundError: No module named 'distutils'
+ 
+ 
+ [ Test Plan ]
+ 
+ Install python3-docker and docker.io
+ In the python3 prompt, use the following commands to test:
+ 
+ >>> import docker
+ >>> client = docker.from_env()
+ >>> client.containers.run("ubuntu:latest", "echo hello world")
+ 
+ With the fixed package it will print:
+ b'hello world\n'
+ 
+ 
+ [ Where problems could occur ]
+ 
+ This change is a combination of two upstream patches which removes the use of 
disutils. The change for 'find_executable' which is replaced with 
'shutil.which' should not have any regression as long as the PATH is defined 
properly.
+ The other fix for distutil changes the way 'version' is calculated for 
comparison and is using 'packaging.version' for it. A new runtime dependency 
had to be added for it. This change can cause problem if the version comparison 
is not as expected. But considering the fact the python3-docker is unusable 
now, the user should not see any new regression than what already exists.
+ 
+ 
+ [ Other Info ]
+ 
+ 1. This has been fixed in Debian and so Oracular is also fixed.
+ 2. As mentioned in the previous section, this change is a combination of two 
different upstream patches. The upstream patch also has changes in 
requirements.txt and setup.py which has been omitted in this change.
+ 
+ 
+ [ Original Bug Description ]
+ 
+ 
+ This is on a fresh install of the 24.04 beta that was released on April 12.  
I used the Desktop installer, into a VMware Fusion VM, on amd64.
  
  Other than the defaults for a fresh Ubuntu Desktop install, all I ran
  was `apt install -y docker.io python3-docker`.
  
  I ran `python3`, tried to execute `import docker`, and got this:
  
  Python 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import docker
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib/python3/dist-packages/docker/__init__.py", line 2, in 
<module>
      from .api import APIClient
    File "/usr/lib/python3/dist-packages/docker/api/__init__.py", line 2, in 
<module>
      from .client import APIClient
    File "/usr/lib/python3/dist-packages/docker/api/client.py", line 10, in 
<module>
      from .. import auth
    File "/usr/lib/python3/dist-packages/docker/auth.py", line 5, in <module>
      from . import credentials
    File "/usr/lib/python3/dist-packages/docker/credentials/__init__.py", line 
2, in <module>
      from .store import Store
    File "/usr/lib/python3/dist-packages/docker/credentials/store.py", line 7, 
in <module>
      from .utils import create_environment_dict
    File "/usr/lib/python3/dist-packages/docker/credentials/utils.py", line 1, 
in <module>
      import distutils.spawn
  ModuleNotFoundError: No module named 'distutils'
  
  ProblemType: Bug
  DistroRelease: Ubuntu 24.04
  Package: python3-docker 5.0.3-1ubuntu1
  ProcVersionSignature: Ubuntu 6.8.0-22.22-generic 6.8.1
  Uname: Linux 6.8.0-22-generic x86_64
  ApportVersion: 2.28.0-0ubuntu1
  Architecture: amd64
  CasperMD5CheckResult: pass
  CurrentDesktop: ubuntu:GNOME
  Date: Tue Apr 16 16:35:20 2024
  InstallationDate: Installed on 2024-04-16 (0 days ago)
  InstallationMedia: Ubuntu 24.04 LTS "Noble Numbat" - Beta amd64 (20240410.2)
  PackageArchitecture: all
  ProcEnviron:
   LANG=en_US.UTF-8
   PATH=(custom, no user)
   SHELL=/bin/bash
   TERM=xterm-256color
   XDG_RUNTIME_DIR=<set>
  SourcePackage: python-docker
  UpgradeStatus: No upgrade log present (probably fresh install)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2061929

Title:
  [SRU] Python docker package does not import, crashes due to urllib3
  upgrade

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-docker/+bug/2061929/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to