Missing build and installation steps without using pip
jkr0103 opened this issue · 1 comments
I could not find the steps/documentation to build and install the docker sdk for python
without using pip
. I felt this requirement on Ubuntu 24.04
where a simple script just having two lines doesn't wrok.
client.py:
start of client.py
import docker;
client = docker.from_env()
end of client.py
Issue is described here and fixed in version 6.1.0 with PR 3116.
Ubuntu 24.04
have following versions of python3-requests
, python3-urllib3
and python3-docker
packages:
$ apt list --installed | grep python3-urllib3
python3-urllib3/noble,now 2.0.7-1 all [installed,automatic]
$ apt list --installed | grep python3-requests
python3-requests/noble,now 2.31.0+dfsg-1ubuntu1 all [installed,automatic]
intel@gramine2404:~/docker-7.0.0$ apt list --installed | grep python3-docker
python3-docker/noble,now 5.0.3-1ubuntu1 all [installed]
$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
Installing docker
using pip
is not the option on Ubuntu 24.04
:
$ pip3 install docker
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.12/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Hence I am left with no option except manually building and installing the package. I am looking for the steps to build and install it manually.
Also I would like to know the way to request Ubuntu 24.04 community to upgrade python3-docker=5.0.3
to python3-docker>=6.1.0
where the compatibility issue with requests
and urllib3
is fixed.
The externally-managed-environment
error message outlines your options, and only the virtualenv option applies here (since this is a library, not an application).
If your project needs a version of docker-py
other than that packaged by your distribution, use a virtualenv for your project.