Docker script installing python 3.9 started failing recently

We have a solution deployed on AWS where an EC2 instance uses docker files to build images for different components. One of those components has a docker script we haven’t changed in over a year that, among other things, installs python 3.9 using pipenv. We ran it as recently as two days ago without any problems. When we tried running today, we got an error we’ve never seen before from the pipenv install.

EXPECTED RESULT:

When script runs RUN pipenv install --python 3.9 that it succeeds. See log from last successful run:

15:02:54 #15 [11/12] RUN pipenv install --python 3.9
15:02:55 #15 0.914 Warning: the environment variable LANG is not set!
15:02:55 #15 0.914 We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
15:02:55 #15 1.290 Creating a virtualenv for this project...
15:02:55 #15 1.290 Pipfile: /code/Pipfile
15:02:55 #15 1.316 Using /usr/bin/python3.9 (3.9.5) to create virtualenv...
15:02:56 #15 2.101 created virtual environment CPython3.9.5.final.0-64 in 476ms
15:02:56 #15 2.101 creator CPython3Posix(dest=/root/.local/share/virtualenvs/code-_Py8Si6I, clear=False, no_vcs_ignore=False, global=False)
15:02:56 #15 2.101 seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
15:02:56 #15 2.101 added seed packages: pip==24.1, setuptools==70.1.0, wheel==0.43.0
15:02:56 #15 2.101 activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
15:02:56 #15 2.101
15:02:56 #15 2.102 ✔ Successfully created virtual environment!
15:02:56 #15 2.157 Virtualenv location: /root/.local/share/virtualenvs/code-_Py8Si6I
15:02:56 #15 2.208 To activate this project's virtualenv, run pipenv shell.
15:02:56 #15 2.208 Alternatively, run a command inside the virtualenv with pipenv run.
15:02:56 #15 2.220 To activate this project's virtualenv, run pipenv shell.
15:02:56 #15 2.220 Alternatively, run a command inside the virtualenv with pipenv run.
15:02:56 #15 2.223 Installing dependencies from Pipfile.lock (d65a77)...

ACTUAL RESULT:

When script runs RUN pipenv install --python 3.9, it fails. See log from last run:

15:49:43 #15 [11/12] RUN pipenv install --python 3.9
15:49:44 #15 0.935 Warning: the environment variable LANG is not set!
15:49:44 #15 0.935 We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
15:49:45 #15 1.345 Creating a virtualenv for this project...
15:49:45 #15 1.346 Pipfile: /code/Pipfile
15:49:45 #15 1.387 Using /usr/bin/python3.9 (3.9.5) to create virtualenv...
15:49:45 #15 1.767
15:49:45 #15 1.767 ✘ Failed creating virtual environment
15:49:45 #15 1.767 [pipenv.exceptions.VirtualenvCreationException]: Traceback (most recent call last):
15:49:45 #15 1.767 File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main
15:49:45 #15 1.767 mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
15:49:45 #15 1.767 File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details
15:49:45 #15 1.767 return _get_module_details(pkg_main_name, error)
15:49:45 #15 1.767 File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details
15:49:45 #15 1.767 import(pkg_name)
15:49:45 #15 1.767 File "/usr/local/lib/python3.9/dist-packages/virtualenv/init.py", line 3, in
15:49:45 #15 1.767 from .run import cli_run, session_via_cli
15:49:45 #15 1.767 File "/usr/local/lib/python3.9/dist-packages/virtualenv/run/init.py", line 15, in
15:49:45 #15 1.767 from .plugin.creators import CreatorSelector
15:49:45 #15 1.767 File "/usr/local/lib/python3.9/dist-packages/virtualenv/run/plugin/creators.py", line 7, in
15:49:45 #15 1.767 from virtualenv.create.via_global_ref.builtin.builtin_way import VirtualenvBuiltin
15:49:45 #15 1.767 File "/usr/local/lib/python3.9/dist-packages/virtualenv/create/via_global_ref/builtin/builtin_way.py", line 5, in
15:49:45 #15 1.767 from virtualenv.create.creator import Creator
15:49:45 #15 1.767 File "/usr/local/lib/python3.9/dist-packages/virtualenv/create/creator.py", line 13, in
15:49:45 #15 1.767 from virtualenv.discovery.cached_py_info import LogCmd
15:49:45 #15 1.767 File "/usr/local/lib/python3.9/dist-packages/virtualenv/discovery/cached_py_info.py", line 25, in
15:49:45 #15 1.767 _CACHE[Path(sys.executable)] = PythonInfo()
15:49:45 #15 1.767 File "/usr/local/lib/python3.9/dist-packages/virtualenv/discovery/py_info.py", line 100, in init
15:49:45 #15 1.767 self.distutils_install = self._distutils_install().copy()
15:49:45 #15 1.767 File "/usr/local/lib/python3.9/dist-packages/virtualenv/discovery/py_info.py", line 191, in _distutils_install
15:49:45 #15 1.767 i.finalize_options()
15:49:45 #15 1.767 File "/usr/local/lib/python3.9/dist-packages/setuptools/command/install.py", line 57, in finalize_options
15:49:45 #15 1.767 super().finalize_options()
15:49:45 #15 1.767 File "/usr/local/lib/python3.9/dist-packages/setuptools/_distutils/command/install.py", line 407, in finalize_options
15:49:45 #15 1.767 'dist_fullname': self.distribution.get_fullname(),
15:49:45 #15 1.767 File "/usr/local/lib/python3.9/dist-packages/setuptools/_core_metadata.py", line 266, in get_fullname
15:49:45 #15 1.767 return _distribution_fullname(self.get_name(), self.get_version())
15:49:45 #15 1.767 File "/usr/local/lib/python3.9/dist-packages/setuptools/_core_metadata.py", line 284, in _distribution_fullname
15:49:45 #15 1.767 canonicalize_version(version, strip_trailing_zero=False),
15:49:45 #15 1.767 TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'
15:49:45 #15 1.767
15:49:45 #15 1.769 Failed to create virtual environment.
15:49:45 #15 ERROR: process "/bin/sh -c pipenv install --python 3.9" did not complete successfully: exit code: 1
15:49:45 ------
15:49:45 > [11/12] RUN pipenv install --python 3.9:
15:49:45 1.767 super().finalize_options()
15:49:45 1.767 File "/usr/local/lib/python3.9/dist-packages/setuptools/_distutils/command/install.py", line 407, in finalize_options
15:49:45 1.767 'dist_fullname': self.distribution.get_fullname(),
15:49:45 1.767 File "/usr/local/lib/python3.9/dist-packages/setuptools/_core_metadata.py", line 266, in get_fullname
15:49:45 1.767 return _distribution_fullname(self.get_name(), self.get_version())
15:49:45 1.767 File "/usr/local/lib/python3.9/dist-packages/setuptools/_core_metadata.py", line 284, in _distribution_fullname
15:49:45 1.767 canonicalize_version(version, strip_trailing_zero=False),
15:49:45 1.767 TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'
15:49:45 1.767
15:49:45 1.769 Failed to create virtual environment.

STEPS TO REPLICATE:

Run the following docker script on a t2.micro AWS EC2 instance built using the following AMI:

amzn2-ami-hvm-2.0.20230926.0-x86_64-gp2

ami-0db2efede9f8bb581

Amazon Linux 2 AMI 2.0.20230926.0 x86_64 HVM gp2

###############DOCKER SCRIPT START###########################
############################################################
FROM ubuntu:focal

ENV TZ=Europe/London
DEBIAN_FRONTEND=noninteractive
IS_DOCKER=true
PYTHONPATH=/code

RUN apt-get -y update
&& apt-get -y install
awscli 
ca-certificates
gnupg
gnupg1
gnupg2
libcairo2 
libcairo2-dev 
libgeos-dev
libpq-dev
libgirepository1.0-dev
libspatialindex-dev
osm2pgsql
python3.9-dev
&& echo -n 'deb [ arch=amd64 ] https://downloads.skewed.de/apt focal main' >> /etc/apt/sources.list
&& apt-key adv --keyserver keys.openpgp.org --recv-key 612DEFB798507F25
&& apt-get -y update 
&& apt-get install python3-graph-tool=2.45 -y

RUN apt-get install -y curl
RUN curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python3.9

RUN pipenv install --python 3.9

###############DOCKER SCRIPT END#############################
############################################################

New contributor

David McClure is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

We hit this one as well. Based on some discussion at https://github.com/pypa/setuptools/issues/4483 it seems similar.

For us it was an incompatibility with the packaging and setuptools modules in python.

We could solve our issue either by increasing the version of packaging or constraining setuptools to an older version.

I would suggest investigating your python requirements.txt

Hope that helps.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật