question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Deprecation warning when building wheels

See original GitHub issue

setuptools version

setuptools==58.3.0 or setuptools==58.4.0

Python version

Python 3.8

OS

Ubuntu 20.04

Additional environment information

No response

Description

Attempting to install or build a wheel of a project using setuptools results in the following warning:

venv/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
Full traceback:
  Traceback (most recent call last):
    File "venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "venv/lib/python3.8/site-packages/setuptools/build_meta.py", line 221, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "venv/lib/python3.8/site-packages/setuptools/build_meta.py", line 207, in _build_with_temp_dir
      self.run_setup()
    File "venv/lib/python3.8/site-packages/setuptools/build_meta.py", line 150, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 20, in <module>
      setup(
    File "venv/lib/python3.8/site-packages/setuptools/__init__.py", line 159, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "venv/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 301, in run
      install = self.reinitialize_command('install',
    File "/venv/lib/python3.8/site-packages/setuptools/__init__.py", line 214, in reinitialize_command
      cmd = _Command.reinitialize_command(self, command, reinit_subcommands)
    File "/usr/lib/python3.8/distutils/cmd.py", line 305, in reinitialize_command
      return self.distribution.reinitialize_command(command,
    File "/usr/lib/python3.8/distutils/dist.py", line 938, in reinitialize_command
      command = self.get_command_obj(command_name)
    File "/usr/lib/python3.8/distutils/dist.py", line 858, in get_command_obj
      cmd_obj = self.command_obj[command] = klass(self)
    File "venv/lib/python3.8/site-packages/setuptools/__init__.py", line 178, in __init__
      _Command.__init__(self, dist)
    File "/usr/lib/python3.8/distutils/cmd.py", line 62, in __init__
      self.initialize_options()
    File "/venv/lib/python3.8/site-packages/setuptools/command/install.py", line 34, in initialize_options
      warnings.warn(
  setuptools._deprecation_warning.SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

This occurs with both build and pip (pip install and pip wheel).

Expected behavior

No warning is emitted when building a wheel or installing using pip or build.

How to Reproduce

  1. Install setuptools 58.3.0 or 58.4.0
  2. Run PYTHONWARNINGS=error pip wheel domdf_python_tools==3.1.0 --no-binary domdf_python_tools -v --no-deps

This also occurs with whey and natsort.

Output

Looking in indexes: http://localhost:3141/root/staging
Collecting domdf_python_tools==3.1.0
  Downloading http://localhost:3141/root/pypi/%2Bf/c55/b356a87d53841/domdf-python-tools-3.1.0.tar.gz (99 kB)
  Installing build dependencies: started
  Running command /tmp/venv/bin/python3 /tmp/pip-standalone-pip-7m38gblg/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-myy0rzw0/overlay --no-warn-script-location --no-binary domdf-python-tools --only-binary :none: -i http://localhost:3141/root/staging -- 'setuptools>=40.6.0' 'wheel>=0.34.2'
  Looking in indexes: http://localhost:3141/root/staging
  Collecting setuptools>=40.6.0
    Downloading http://localhost:3141/root/pypi/%2Bf/e8b/1d3127a0441fb/setuptools-58.4.0-py3-none-any.whl (946 kB)
  Collecting wheel>=0.34.2
    Downloading http://localhost:3141/root/pypi/%2Bf/210/14b2bd93c6d00/wheel-0.37.0-py2.py3-none-any.whl (35 kB)
  Installing collected packages: wheel, setuptools
  Successfully installed setuptools-58.4.0 wheel-0.37.0
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Running command /tmp/venv/bin/python3 /tmp/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmp32ew7q_j
  running egg_info
  writing domdf_python_tools.egg-info/PKG-INFO
  writing dependency_links to domdf_python_tools.egg-info/dependency_links.txt
  writing requirements to domdf_python_tools.egg-info/requires.txt
  writing top-level names to domdf_python_tools.egg-info/top_level.txt
  reading manifest file 'domdf_python_tools.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  no previously-included directories found matching '**/__pycache__'
  adding license file 'LICENSE'
  writing manifest file 'domdf_python_tools.egg-info/SOURCES.txt'
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Running command /tmp/venv/bin/python3 /tmp/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpenyjg9hk
  running dist_info
  creating /tmp/pip-modern-metadata-2tke0rjw/domdf_python_tools.egg-info
  writing /tmp/pip-modern-metadata-2tke0rjw/domdf_python_tools.egg-info/PKG-INFO
  writing dependency_links to /tmp/pip-modern-metadata-2tke0rjw/domdf_python_tools.egg-info/dependency_links.txt
  writing requirements to /tmp/pip-modern-metadata-2tke0rjw/domdf_python_tools.egg-info/requires.txt
  writing top-level names to /tmp/pip-modern-metadata-2tke0rjw/domdf_python_tools.egg-info/top_level.txt
  writing manifest file '/tmp/pip-modern-metadata-2tke0rjw/domdf_python_tools.egg-info/SOURCES.txt'
  reading manifest file '/tmp/pip-modern-metadata-2tke0rjw/domdf_python_tools.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  no previously-included directories found matching '**/__pycache__'
  adding license file 'LICENSE'
  writing manifest file '/tmp/pip-modern-metadata-2tke0rjw/domdf_python_tools.egg-info/SOURCES.txt'
  creating '/tmp/pip-modern-metadata-2tke0rjw/domdf_python_tools.dist-info'
  adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: domdf-python-tools
  Building wheel for domdf-python-tools (pyproject.toml): started
  Running command /tmp/venv/bin/python3 /tmp/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp_1m0sf3w
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib
  creating build/lib/domdf_python_tools
  copying domdf_python_tools/bases.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/paths.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/secrets.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/dates.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/delegators.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/import_tools.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/versions.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/iterative.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/utils.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/__init__.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/terminal.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/typing.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/words.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/doctools.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/stringlist.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/_is_match.py -> build/lib/domdf_python_tools
  copying domdf_python_tools/pretty_print.py -> build/lib/domdf_python_tools
  creating build/lib/domdf_python_tools/pagesizes
  copying domdf_python_tools/pagesizes/sizes.py -> build/lib/domdf_python_tools/pagesizes
  copying domdf_python_tools/pagesizes/utils.py -> build/lib/domdf_python_tools/pagesizes
  copying domdf_python_tools/pagesizes/classes.py -> build/lib/domdf_python_tools/pagesizes
  copying domdf_python_tools/pagesizes/__init__.py -> build/lib/domdf_python_tools/pagesizes
  copying domdf_python_tools/pagesizes/units.py -> build/lib/domdf_python_tools/pagesizes
  creating build/lib/domdf_python_tools/compat
  copying domdf_python_tools/compat/importlib_metadata.py -> build/lib/domdf_python_tools/compat
  copying domdf_python_tools/compat/__init__.py -> build/lib/domdf_python_tools/compat
  copying domdf_python_tools/compat/importlib_resources.py -> build/lib/domdf_python_tools/compat
  running egg_info
  creating domdf_python_tools.egg-info
  writing domdf_python_tools.egg-info/PKG-INFO
  writing dependency_links to domdf_python_tools.egg-info/dependency_links.txt
  writing requirements to domdf_python_tools.egg-info/requires.txt
  writing top-level names to domdf_python_tools.egg-info/top_level.txt
  writing manifest file 'domdf_python_tools.egg-info/SOURCES.txt'
  reading manifest file 'domdf_python_tools.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  no previously-included directories found matching '**/__pycache__'
  adding license file 'LICENSE'
  writing manifest file 'domdf_python_tools.egg-info/SOURCES.txt'
  copying domdf_python_tools/google-10000-english-no-swears.txt -> build/lib/domdf_python_tools
  copying domdf_python_tools/py.typed -> build/lib/domdf_python_tools
  copying domdf_python_tools/compat/importlib_metadata.pyi -> build/lib/domdf_python_tools/compat
  copying domdf_python_tools/compat/importlib_resources.pyi -> build/lib/domdf_python_tools/compat
  Traceback (most recent call last):
    File "/tmp/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/tmp/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/tmp/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-build-env-myy0rzw0/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 221, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/tmp/pip-build-env-myy0rzw0/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 207, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/pip-build-env-myy0rzw0/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 150, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 20, in <module>
      setup(
    File "/tmp/pip-build-env-myy0rzw0/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 159, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-myy0rzw0/overlay/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 301, in run
      install = self.reinitialize_command('install',
    File "/tmp/pip-build-env-myy0rzw0/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 214, in reinitialize_command
      cmd = _Command.reinitialize_command(self, command, reinit_subcommands)
    File "/usr/lib/python3.8/distutils/cmd.py", line 305, in reinitialize_command
      return self.distribution.reinitialize_command(command,
    File "/usr/lib/python3.8/distutils/dist.py", line 938, in reinitialize_command
      command = self.get_command_obj(command_name)
    File "/usr/lib/python3.8/distutils/dist.py", line 858, in get_command_obj
      cmd_obj = self.command_obj[command] = klass(self)
    File "/tmp/pip-build-env-myy0rzw0/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 178, in __init__
      _Command.__init__(self, dist)
    File "/usr/lib/python3.8/distutils/cmd.py", line 62, in __init__
      self.initialize_options()
    File "/tmp/pip-build-env-myy0rzw0/overlay/lib/python3.8/site-packages/setuptools/command/install.py", line 34, in initialize_options
      warnings.warn(
  setuptools._deprecation_warning.SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  Building wheel for domdf-python-tools (pyproject.toml): finished with status 'error'
  ERROR: Failed building wheel for domdf-python-tools
Failed to build domdf-python-tools
ERROR: Failed to build one or more wheels

Code of Conduct

  • I agree to follow the PSF Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:29 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
mara004commented, Feb 18, 2022

I see… That’s not a bad approach. It might be possible to do something similar for pypdfium2, though it would make the main setup file harder to overview.

1reaction
abravalhericommented, Feb 16, 2022

Build will not do that automatically for you. The guys in pybind11 came up with this strategy of using the main setup.py to select another file to run. It is quite ingenious.

They are exec-ing the secondary files, because they are creating them dynamically from templates, but in your case, since the files are static, you could simply use importlib.import_module and find the right function to run.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deprecation Warning while installing wheel for scikit-learn
It's not an error yet, just a warning that when version 0.23 of the library comes out the module will be deprecated.
Read more >
Frequently asked questions — Cryptography 35.0.0 ...
The deprecation warning emitted on import does not inherit DeprecationWarning but inherits UserWarning instead. If your pytest setup follows the best practices ...
Read more >
Release Notes — pip 10.0.0.dev0 documentation
DEPRECATION pip install --egg have been deprecated and will be removed in the future. This “feature” has a long list of drawbacks which...
Read more >
Changelog — Python 3.11.1 documentation
It no longer emits a deprecation warning if the current event loop was set. gh-51524: Fix bug when calling trace.CoverageResults with valid infile....
Read more >
SciPy 1.9.0 Release Notes
#15962: Race condition in macOS Meson build between `_matfuncs_expm`… #15987: CI: `np.matrix` deprecation warning. #16007: BUG: Confusing documentation in ` ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found