Skip to content

AttributeError: 'Compiler' object has no attribute 'dry_run' when installing with setuptools >= v81.0.0 #485

@qfreewilll

Description

@qfreewilll

Setuptools deprecated the --dry-run flag on 6 February 2026 in the v81.0.0 release:

pkg_resources has been removed from Setuptools. Most common uses of pkg_resources have been superseded by the importlib.resources and importlib.metadata projects. Projects and environments relying on pkg_resources for namespace packages or other behavior should depend on older versions of setuptools. (#3085)

This leads to:

docker run --rm -it python:3.9-slim pip install projectq
Collecting projectq
[... snipped ... ]
  × Building wheel for projectq (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [494 lines of output]
      /tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/config/_apply_pyprojecttoml.py:82: SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated
      !!

              ********************************************************************************
              Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options available on setuptools>=77.0.0).

              By 2027-Feb-18, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.

              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************

      !!
        corresp(dist, value, root_dir)
      /tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/config/_apply_pyprojecttoml.py:61: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!

              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:

              License :: OSI Approved :: Apache Software License

              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************

      !!
        dist._finalize_license_expression()
      /tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/dist.py:765: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!

              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:

              License :: OSI Approved :: Apache Software License

              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************

      !!
        self._finalize_license_expression()
[... snipped ... ]
      /tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/command/build_py.py:215: _Warning: Package 'projectq.backends._sim._cppkernels' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'projectq.backends._sim._cppkernels' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'projectq.backends._sim._cppkernels' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'projectq.backends._sim._cppkernels' to be distributed and are
              already explicitly excluding 'projectq.backends._sim._cppkernels' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      /tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/command/build_py.py:215: _Warning: Package 'projectq.backends._sim._cppkernels.intrin' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'projectq.backends._sim._cppkernels.intrin' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'projectq.backends._sim._cppkernels.intrin' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'projectq.backends._sim._cppkernels.intrin' to be distributed and are
              already explicitly excluding 'projectq.backends._sim._cppkernels.intrin' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      /tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/command/build_py.py:215: _Warning: Package 'projectq.backends._sim._cppkernels.nointrin' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'projectq.backends._sim._cppkernels.nointrin' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'projectq.backends._sim._cppkernels.nointrin' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'projectq.backends._sim._cppkernels.nointrin' to be distributed and are
              already explicitly excluding 'projectq.backends._sim._cppkernels.nointrin' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
[... snipped ... ]
      running build_ext
      Traceback (most recent call last):
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 441, in build_wheel
          return _build(['bdist_wheel', '--dist-info-dir', str(metadata_directory)])
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 429, in _build
          return self._build_with_temp_dir(
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 410, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())
        File "<string>", line 775, in <module>
        File "<string>", line 747, in run_setup
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 117, in setup
          return distutils.core.setup(**attrs)  # type: ignore[return-value]
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 186, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 202, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 1000, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1107, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 1019, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/command/bdist_wheel.py", line 370, in run
          self.run_command("build")
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 341, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1107, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 1019, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 341, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1107, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 1019, in run_command
          cmd_obj.run()
        File "<string>", line 336, in run
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 97, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-b03e9_xu/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 367, in run
          self.build_extensions()
        File "<string>", line 342, in build_extensions
        File "<string>", line 415, in _configure_compiler
      AttributeError: 'Compiler' object has no attribute 'dry_run'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for projectq
Failed to build projectq
ERROR: Could not build wheels for projectq, which is required to install pyproject.toml-based projects

This doesn't happen with python3.8, but fails with python >= 3.9.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions