TypeError: copy_file() takes from 2 to 7 positional arguments but 8 were given

Hi there,
I face error at the end of the “.whl” generation file with both wxpython 4.2.2 and 4.2.4.
I use Fedora 43 / python 3.14.

I launch the command :
pip wheel -v wxPython-4.2.2.tar.gz 2>&1 | tee build.log

And it fails with this message :
TypeError: copy_file() takes from 2 to 7 positional arguments but 8 were given

  ------------ BUILD FINISHED ------------
  To use wxPython from the build folder (without installing):
   - Set your PYTHONPATH variable to /tmp/pip-req-build-nzpvslec.
   - You may also need to set your (DY)LD_LIBRARY_PATH to /tmp/pip-req-build-nzpvslec/build/wxbld/gtk3/lib,
     or wherever the wxWidgets libs have been installed.

  Finished command: build_py (17m33.230s)
  Finished command: build (25m34.929s)
  Done!
  WARNING: Building this way assumes that all generated files have been
  generated already.  If that is not the case then use build.py directly
  to generate the source and perform the build stage.  You can use
  --skip-build with the bdist_* or install commands to avoid this
  message and the wxWidgets and Phoenix build steps in the future.

  "/home/kredge/Development/GestConsoPhoenix4.2.2--1.4.4/env4.2.4-py3.14/bin/python" -u build.py build
  running build_py
  creating build/lib.linux-x86_64-cpython-314/wx
  Traceback (most recent call last):
    File "/home/kredge/Development/GestConsoPhoenix4.2.2--1.4.4/env4.2.4-py3.14/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
      main()
      ~~~~^^
    File "/home/kredge/Development/GestConsoPhoenix4.2.2--1.4.4/env4.2.4-py3.14/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
      json_out["return_val"] = hook(**hook_input["kwargs"])
                               ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/kredge/Development/GestConsoPhoenix4.2.2--1.4.4/env4.2.4-py3.14/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 280, in build_wheel
      return _build_backend().build_wheel(
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
          wheel_directory, config_settings, metadata_directory
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      )
      ^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/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-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/build_meta.py", line 429, in _build
      return self._build_with_temp_dir(
             ~~~~~~~~~~~~~~~~~~~~~~~~~^
          cmd,
          ^^^^
      ...<3 lines>...
          self._arbitrary_args(config_settings),
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      )
      ^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/build_meta.py", line 410, in _build_with_temp_dir
      self.run_setup()
      ~~~~~~~~~~~~~~^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/build_meta.py", line 520, in run_setup
      super().run_setup(setup_script=setup_script)
      ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/build_meta.py", line 317, in run_setup
      exec(code, locals())
      ~~~~^^^^^^^^^^^^^^^^
    File "<string>", line 364, in <module>
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/__init__.py", line 117, in setup
      return distutils.core.setup(**attrs)  # type: ignore[return-value]
             ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/_distutils/core.py", line 186, in setup
      return run_commands(dist)
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/_distutils/core.py", line 202, in run_commands
      dist.run_commands()
      ~~~~~~~~~~~~~~~~~^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/_distutils/dist.py", line 1000, in run_commands
      self.run_command(cmd)
      ~~~~~~~~~~~~~~~~^^^^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/dist.py", line 1107, in run_command
      super().run_command(command)
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/_distutils/dist.py", line 1019, in run_command
      cmd_obj.run()
      ~~~~~~~~~~~^^
    File "<string>", line 230, in run
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/_distutils/cmd.py", line 341, in run_command
      self.distribution.run_command(command)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/dist.py", line 1107, in run_command
      super().run_command(command)
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/_distutils/dist.py", line 1019, in run_command
      cmd_obj.run()
      ~~~~~~~~~~~^^
    File "<string>", line 144, in run
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/_distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
      ~~~~~~~~~~~~~~~~^^^^^^^^^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/_distutils/cmd.py", line 341, in run_command
      self.distribution.run_command(command)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/dist.py", line 1107, in run_command
      super().run_command(command)
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/_distutils/dist.py", line 1019, in run_command
      cmd_obj.run()
      ~~~~~~~~~~~^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/command/build_py.py", line 79, in run
      self.build_packages()
      ~~~~~~~~~~~~~~~~~~~^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/_distutils/command/build_py.py", line 380, in build_packages
      self.build_module(module, module_file, package)
      ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/_distutils/command/build_py.py", line 351, in build_module
      return self.copy_file(module_file, outfile, preserve_mode=False)
             ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/command/build_py.py", line 66, in copy_file
      return super().copy_file(  # pyright: ignore[reportReturnType] # pypa/distutils#309
             ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          infile, outfile, preserve_mode, preserve_times, link, level
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      )
      ^
    File "/tmp/pip-build-env-9qiygpxx/overlay/lib/python3.14/site-packages/setuptools/_distutils/cmd.py", line 405, in copy_file
      return file_util.copy_file(
             ~~~~~~~~~~~~~~~~~~~^
          infile,
          ^^^^^^^
      ...<4 lines>...
          link,
          ^^^^^
      )
      ^
    File "<string>", line 287, in wx_copy_file
  TypeError: copy_file() takes from 2 to 7 positional arguments but 8 were given
  error: subprocess-exited-with-error
  
  × Building wheel for wxPython (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> No available output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /home/kredge/Development/GestConsoPhoenix4.2.2--1.4.4/env4.2.4-py3.14/bin/python /home/kredge/Development/GestConsoPhoenix4.2.2--1.4.4/env4.2.4-py3.14/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmp22rqx7zk
  cwd: /tmp/pip-req-build-nzpvslec
  Building wheel for wxPython (pyproject.toml): finished with status 'error'
  ERROR: Failed building wheel for wxPython
Failed to build wxPython
ERROR: Failed to build one or more wheels 

Any idea to this issue ?

Thanks a lot.

Sigh, yeah this is something I noticed yesterday. wxPython monkey-patches parts of distutils (part of setuptools now) and there was a setuptools update yesterday that broke our monkey-patching.

As a workaround, you should be able to downgrade to setuptools < 81.

I’ve already fixed this in the master branch, but I guess we might need a new 4.2.x release. :frowning:

Thank you swt2c for your reply.
I changed six/wheel/setuptools with their versions who worked out fine on another Linux distrib (Winux) :
six : 1.17.0
wheel : 0.45.1
setuptools : 80.9.0
But on Fedora 43 the issue remains the same…
What do you think about these same versions ? ok on Winux, but ko on Fedora. Isn’t there another problem than setuptools version on your opinion ?
Thx again :slight_smile:

I am not sure. Are you 100% sure you’re using setuptools < 81 on Fedora 43? Also, the error is the exact same?