Repository navigation
Closed
Labels
area:configurationbug:minordoes not affect many people or has no big impactdoes not affect many people or has no big impactbug:normalaffects many people or has quite an impactaffects many people or has quite an impacthelp:wantedIssues that have been acknowledged, a solution determined and a PR might likely be accepted.Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Description
Issue
Describe what's the expected behaviour and what you're observing.
Getting a RuntimeError: config set has been marked final and cannot be extended at tox startup
Environment
Provide at least:
Better example at: #3006 (comment)
- OS: A Gitlab runner using an image based of:
FROM registry.<local>/docker/library/python:3.11-bullseye
WORKDIR /
# Include external env vars into build context
ARG PYPI_ADDRESS
ARG PYPI_USERNAME
ARG PYPI_PASSWORD
# Python runtime config
ENV PYTHONIOENCODING utf-8
ENV PYTHONUNBUFFERED 1
ENV PYTHONOPTIMIZE 1
ENV PIP_TRUSTED_HOST ${PYPI_ADDRESS}
ENV PIP_INDEX https://${PYPI_USERNAME}:${PYPI_PASSWORD}@${PYPI_ADDRESS}/runner/org/
ENV PIP_INDEX_URL https://${PYPI_USERNAME}:${PYPI_PASSWORD}@${PYPI_ADDRESS}/runner/org/+simple/
ENV PIP_EXTRA_INDEX_URL https://pypi.org/simple
# Virtualenv stuff
ENV VIRTUAL_ENV=/venv
RUN curl -o virtualenv.pyz https://bootstrap.pypa.io/virtualenv.pyz
RUN python3.11 /virtualenv.pyz $VIRTUAL_ENV --pip=embed --setuptools=embed --wheel=embed --no-periodic-update
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY requirements.txt .
RUN pip --version
RUN python --version
RUN pip install --upgrade --cache-dir=.pip -r requirements.txt && rm -rf .pip
- requirements.txt contains:
setuptools==67.7.2
wheel==0.40.0
pytest==7.3.0
pytest-cov==4.0.0
pytest-sugar==0.9.6
coverage==7.2.5
pip==23.1.2
tox==4.5.1
devpi-client==6.0.4(We have seen this in older versions of Tox and Python)
Output of running tox
Provide the output of tox -rvv:
tox -vvvvv
ROOT: 170 D setup logging to NOTSET on pid 30 [tox/report.py:221]
py311: 255 I find interpreter for spec PythonSpec(major=3, minor=11) [virtualenv/discovery/builtin.py:56]
py311: 255 I proposed PythonInfo(spec=CPython3.11.2.final.0-64, exe=/usr/local/bin/python, platform=linux, version='3.11.2 (main, Mar 23 2023, 17:12:29) [GCC 10.2.1 20210110]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:63]
py311: 255 D accepted PythonInfo(spec=CPython3.11.2.final.0-64, exe=/usr/local/bin/python, platform=linux, version='3.11.2 (main, Mar 23 2023, 17:12:29) [GCC 10.2.1 20210110]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
py311: 257 D filesystem is case-sensitive [virtualenv/info.py:24]
py311: 291 I create virtual environment via CPython3Posix(dest=/builds/<org>/<project>/.tox/py311, clear=False, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:48]
py311: 291 D create folder /builds/<org>/<project>/.tox/py311/bin [virtualenv/util/path/_sync.py:9]
py311: 291 D create folder /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages [virtualenv/util/path/_sync.py:9]
py311: 292 D write /builds/<org>/<project>/.tox/py311/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:30]
py311: 292 D home = /usr/local/bin [virtualenv/create/pyenv_cfg.py:34]
py311: 292 D implementation = CPython [virtualenv/create/pyenv_cfg.py:34]
py311: 292 D version_info = 3.11.2.final.0 [virtualenv/create/pyenv_cfg.py:34]
py311: 292 D virtualenv = 20.21.0 [virtualenv/create/pyenv_cfg.py:34]
py311: 292 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:34]
py311: 292 D base-prefix = /usr/local [virtualenv/create/pyenv_cfg.py:34]
py311: 292 D base-exec-prefix = /usr/local [virtualenv/create/pyenv_cfg.py:34]
py311: 292 D base-executable = /usr/local/bin/python [virtualenv/create/pyenv_cfg.py:34]
py311: 292 D symlink /usr/local/bin/python to /builds/<org>/<project>/.tox/py311/bin/python [virtualenv/util/path/_sync.py:28]
py311: 293 D create virtualenv import hook file /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:89]
py311: 293 D create /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:92]
py311: 293 D ============================== target debug ============================== [virtualenv/run/session.py:50]
py311: 293 D debug via /builds/<org>/<project>/.tox/py311/bin/python /usr/local/lib/python3.11/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:193]
py311: 293 D {
"sys": {
"executable": "/builds/<org>/<project>/.tox/py311/bin/python",
"_base_executable": "/usr/local/bin/python3.11",
"prefix": "/builds/<org>/<project>/.tox/py311",
"base_prefix": "/usr/local",
"real_prefix": null,
"exec_prefix": "/builds/<org>/<project>/.tox/py311",
"base_exec_prefix": "/usr/local",
"path": [
"/usr/local/lib/python311.zip",
"/usr/local/lib/python3.11",
"/usr/local/lib/python3.11/lib-dynload",
"/builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.11.2 (main, Mar 23 2023, 17:12:29) [GCC 10.2.1 20210110]",
"makefile_filename": "/usr/local/lib/python3.11/config-3.11-x86_64-linux-gnu/Makefile",
"os": "<module 'os' (frozen)>",
"site": "<module 'site' (frozen)>",
"datetime": "<module 'datetime' from '/usr/local/lib/python3.11/datetime.py'>",
"math": "<module 'math' from '/usr/local/lib/python3.11/lib-dynload/math.cpython-311-x86_64-linux-gnu.so'>",
"json": "<module 'json' from '/usr/local/lib/python3.11/json/__init__.py'>"
} [virtualenv/run/session.py:51]
py311: 334 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv) [virtualenv/run/session.py:55]
py311: 338 D got embed update of distribution setuptools from /root/.local/share/virtualenv/wheel/3.11/embed/3/setuptools.json [virtualenv/app_data/via_disk_folder.py:129]
py311: 342 D got embed update of distribution wheel from /root/.local/share/virtualenv/wheel/3.11/embed/3/wheel.json [virtualenv/app_data/via_disk_folder.py:129]
py311: 342 D got embed update of distribution pip from /root/.local/share/virtualenv/wheel/3.11/embed/3/pip.json [virtualenv/app_data/via_disk_folder.py:129]
py311: 343 D install setuptools from wheel /usr/local/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/setuptools-67.4.0-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47]
py311: 343 D install wheel from wheel /usr/local/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/wheel-0.38.4-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47]
py311: 343 D install pip from wheel /usr/local/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/pip-23.0.1-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47]
py311: 347 D copy directory /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-67.4.0-py3-none-any/setuptools to /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/setuptools [virtualenv/util/path/_sync.py:36]
py311: 348 D copy /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-23.0.1-py3-none-any/pip-23.0.1.virtualenv to /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/pip-23.0.1.virtualenv [virtualenv/util/path/_sync.py:36]
py311: 348 D copy directory /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel to /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/wheel [virtualenv/util/path/_sync.py:36]
py311: 349 D copy directory /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-23.0.1-py3-none-any/pip-23.0.1.dist-info to /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/pip-23.0.1.dist-info [virtualenv/util/path/_sync.py:36]
py311: 357 D copy directory /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-23.0.1-py3-none-any/pip to /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/pip [virtualenv/util/path/_sync.py:36]
py311: 369 D copy /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel-0.38.4.virtualenv to /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/wheel-0.38.4.virtualenv [virtualenv/util/path/_sync.py:36]
py311: 371 D copy directory /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel-0.38.4.dist-info to /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/wheel-0.38.4.dist-info [virtualenv/util/path/_sync.py:36]
py311: 381 D generated console scripts wheel3 wheel3.11 wheel wheel-3.11 [virtualenv/seed/embed/via_app_data/pip_install/base.py:41]
py311: 464 D copy directory /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-67.4.0-py3-none-any/_distutils_hack to /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:36]
py311: 465 D copy directory /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-67.4.0-py3-none-any/pkg_resources to /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/pkg_resources [virtualenv/util/path/_sync.py:36]
py311: 513 D copy directory /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-67.4.0-py3-none-any/setuptools-67.4.0.dist-info to /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/setuptools-67.4.0.dist-info [virtualenv/util/path/_sync.py:36]
py311: 517 D copy /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-67.4.0-py3-none-any/setuptools-67.4.0.virtualenv to /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/setuptools-67.4.0.virtualenv [virtualenv/util/path/_sync.py:36]
py311: 518 D copy /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-67.4.0-py3-none-any/distutils-precedence.pth to /builds/<org>/<project>/.tox/py311/lib/python3.11/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:36]
py311: 519 D generated console scripts [virtualenv/seed/embed/via_app_data/pip_install/base.py:41]
py311: 559 D generated console scripts pip pip-3.11 pip3 pip3.11 [virtualenv/seed/embed/via_app_data/pip_install/base.py:41]
py311: 559 I add activators for Bash, CShell, Fish, Nushell, PowerShell, Python [virtualenv/run/session.py:61]
py311: 562 D write /builds/<org>/<project>/.tox/py311/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:30]
py311: 562 D home = /usr/local/bin [virtualenv/create/pyenv_cfg.py:34]
py311: 562 D implementation = CPython [virtualenv/create/pyenv_cfg.py:34]
py311: 562 D version_info = 3.11.2.final.0 [virtualenv/create/pyenv_cfg.py:34]
py311: 562 D virtualenv = 20.21.0 [virtualenv/create/pyenv_cfg.py:34]
py311: 562 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:34]
py311: 562 D base-prefix = /usr/local [virtualenv/create/pyenv_cfg.py:34]
py311: 562 D base-exec-prefix = /usr/local [virtualenv/create/pyenv_cfg.py:34]
py311: 562 D base-executable = /usr/local/bin/python [virtualenv/create/pyenv_cfg.py:34]
py311: 563 E internal error [tox/session/cmd/run/single.py:58]
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/tox/session/cmd/run/single.py", line 45, in _evaluate
tox_env.setup()
File "/usr/local/lib/python3.11/site-packages/tox/tox_env/api.py", line 249, in setup
self._setup_env()
File "/usr/local/lib/python3.11/site-packages/tox/tox_env/python/runner.py", line 107, in _setup_env
self._install_deps()
File "/usr/local/lib/python3.11/site-packages/tox/tox_env/python/runner.py", line 111, in _install_deps
self._install(requirements_file, PythonRun.__name__, "deps")
File "/usr/local/lib/python3.11/site-packages/tox/tox_env/api.py", line 96, in _install
self.installer.install(arguments, section, of_type)
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/tox/tox_env/python/virtual_env/api.py", line 73, in installer
self._installer = Pip(self)
^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/tox/tox_env/python/pip/pip_install.py", line 26, in __init__
super().__init__(tox_env)
File "/usr/local/lib/python3.11/site-packages/tox/tox_env/installer.py", line 15, in __init__
self._register_config()
File "/usr/local/lib/python3.11/site-packages/tox/tox_env/python/pip/pip_install.py", line 29, in _register_config
self._env.conf.add_config(
File "/usr/local/lib/python3.11/site-packages/tox/config/sets.py", line 64, in add_config
raise RuntimeError("config set has been marked final and cannot be extended")
RuntimeError: config set has been marked final and cannot be extended
py311: FAIL code 2 (0.32 seconds)
evaluation failed :( (0.40 seconds)Minimal example
If possible, provide a minimal reproducer for the issue:
[tox]
envlist = py311
skipsdist = True
[testenv]
# Expose ENV variables in calling shell to tox
passenv = PIP_TRUSTED_HOST,PIP_INDEX,PIP_INDEX_URL,PIP_EXTRA_INDEX_URL
install_command =
pip install {opts} {packages}
deps =
setuptools==67.3.2
wheel==0.38.4
pytest==7.2.1
pytest-cov==4.0.0
pytest-sugar==0.9.6
coverage==7.1.0
commands =
# Install ourselves
pip install -e .
# pytest-cov doesn't seem to play nice with -p
coverage run -p -m pytest -s -p no:warnings --junitxml=report.xml testsReacted by Sorin Sbarnea
Metadata
Metadata
Assignees
Labels
area:configurationbug:minordoes not affect many people or has no big impactdoes not affect many people or has no big impactbug:normalaffects many people or has quite an impactaffects many people or has quite an impacthelp:wantedIssues that have been acknowledged, a solution determined and a PR might likely be accepted.Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Activity
gaborbernat commentedon May 3, 2023
PR welcome to fix it.
m3talstorm commentedon Jun 12, 2023
@gaborbernat Can you think of any work arounds for this? Or at least some pointers where to look?
gaborbernat commentedon Jun 20, 2023
Sadly not 😊 you'll need to debug around the code and understand what's happening.
m3talstorm commentedon Jul 1, 2023
Here's an updated reproducible flow (no need to run it as a Gitlab runner, tox.ini and requirements.txt are still the same)
Base image:
docker build -t registry.local/base-image:latest -f Dockerfile1 .
docker build -t registry.local/tox-image:latest -f Dockerfile2 .
You'll get:
(Note I know this is a weird way of running tox (with a Docker RUN command at build time) but it's just an example of how to hit the error.)
m3talstorm commentedon Jul 1, 2023
Thanks to debugging with @anthonywritescode
The problem is with
ENV PYTHONOPTIMIZE 1If you simply run tox like so, you will get the same error:
gaborbernat commentedon Jul 1, 2023
Never heard about that flag. What does it do?
m3talstorm commentedon Jul 1, 2023
@gaborbernat PYTHONOPTIMIZE , it's the same as -O but just as a env var :)
gaborbernat commentedon Jul 1, 2023
I have no idea why that might break the world, I would say as of today it's unsupported, however, feel free to put in a PR to make it supported. I will not spend time on making this work. 👍😁
gaborbernat commentedon Feb 18, 2026
Cannot reproduce on latest tox. The
RuntimeError: config set has been marked final and cannot be extendederror no longer occurs withinstall_commandset in the config. This was reported against tox 4.5.1 and has been fixed in subsequent releases.