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] error in XXXX setup command: use_2to3 is invalid when false.

See original GitHub issue

setuptools version

setuptools==58.0.2

Python version

Python 3.6.9, Python 3.9.2

OS

Ubuntu 18.04.5 LTS, Debian 11

Additional environment information

This happens installing any Python2 package when trying to use use_2to3 on setuptool execution

Description

Error installing a package that requires to use use_2to3 on its installation

Expected behavior

The package should be installed as previous versions do (like setuptools==58.0.1)

How to Reproduce

  1. Generate a virtualenv and activate it.
  2. Make sure you’re environment tools are updated.
  3. Install a Python2 package that requires to use use_2to3 on its installation.

Output

  1. Generate a virtualenv like:
virtualenv .env -p /usr/bin/python3 && source .env/bin/activate
created virtual environment CPython3.9.2.final.0-64 in 121ms
  creator CPython3Posix(dest=/home/miguelfito/tmp/pruebas/devops_housekeeping_test/.env, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/miguelfito/.local/share/virtualenv)
    added seed packages: pip==20.3.4, pkg_resources==0.0.0, setuptools==44.1.1, wheel==0.34.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
  1. Make sure you’re environment tools are updated:
python3 -m pip install --upgrade pip setuptools wheel
Looking in indexes: ****
Requirement already satisfied: pip in ./.env/lib/python3.9/site-packages (20.3.4)
Collecting pip
  Downloading pip-21.2.4-py3-none-any.whl (1.6 MB)
     |████████████████████████████████| 1.6 MB 5.4 MB/s 
Requirement already satisfied: setuptools in ./.env/lib/python3.9/site-packages (44.1.1)
Collecting setuptools
  Downloading setuptools-58.0.2-py3-none-any.whl (816 kB)
     |████████████████████████████████| 816 kB 20.9 MB/s 
Requirement already satisfied: wheel in ./.env/lib/python3.9/site-packages (0.34.2)
Collecting wheel
  Downloading wheel-0.37.0-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel, setuptools, pip
  Attempting uninstall: wheel
    Found existing installation: wheel 0.34.2
    Uninstalling wheel-0.34.2:
      Successfully uninstalled wheel-0.34.2
  Attempting uninstall: setuptools
    Found existing installation: setuptools 44.1.1
    Uninstalling setuptools-44.1.1:
      Successfully uninstalled setuptools-44.1.1
  Attempting uninstall: pip
    Found existing installation: pip 20.3.4
    Uninstalling pip-20.3.4:
      Successfully uninstalled pip-20.3.4
Successfully installed pip-21.2.4 setuptools-58.0.2 wheel-0.37.0
  1. Install a Python2 package:
pip install mailer==0.8.1                            
Looking in indexes: **********
Collecting mailer==0.8.1
  Downloading mailer-0.8.1.zip (6.5 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/miguelfito/tmp/pruebas/devops_housekeeping_test/.env/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k06h_9aq/mailer_e0ec5902e983461198885f3ed8f7b2db/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k06h_9aq/mailer_e0ec5902e983461198885f3ed8f7b2db/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-y8q_t3za
         cwd: /tmp/pip-install-k06h_9aq/mailer_e0ec5902e983461198885f3ed8f7b2db/
    Complete output (1 lines):
    error in mailer setup command: use_2to3 is invalid.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/30/e7/c3a932fc03ab95c96ff911d8ee3e89b937205596a5c1f00849401a2468e0/mailer-0.8.1.zip#sha256=3411a12197731e0d5379ab194d9acc8d0d71c8b95fdfb11474d67c3e9860070e (from https://pypi.org/simple/mailer/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading https:// **********/30/e7/c3a932fc03ab95c96ff911d8ee3e89b937205596a5c1f00849401a2468e0/mailer-0.8.1.zip (6.5 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/miguelfito/tmp/pruebas/devops_housekeeping_test/.env/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k06h_9aq/mailer_ac6269ca2eb7417faf12a97364828523/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k06h_9aq/mailer_ac6269ca2eb7417faf12a97364828523/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-_1878lem
         cwd: /tmp/pip-install-k06h_9aq/mailer_ac6269ca2eb7417faf12a97364828523/
    Complete output (1 lines):
    error in mailer setup command: use_2to3 is invalid.
    ----------------------------------------
WARNING: Discarding https:// **********/30/e7/c3a932fc03ab95c96ff911d8ee3e89b937205596a5c1f00849401a2468e0/mailer-0.8.1.zip#sha256=3411a12197731e0d5379ab194d9acc8d0d71c8b95fdfb11474d67c3e9860070e (from https://descinet.bbva.es/artifactory/api/pypi/pypi/simple/mailer/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mailer==0.8.1 (from versions: 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8.1)
ERROR: No matching distribution found for mailer==0.8.1

Code of Conduct

  • I agree to follow the PSF Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:19
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

13reactions
0robustus1commented, Sep 7, 2021

May i suggest to revert https://github.com/pypa/setuptools/pull/2770 and push a new patch level release? It seems that this change should also cause a major version release (since it is breaking for some/many packages that still use use2to3).

6reactions
jaracocommented, Sep 7, 2021

There was no deprecation warning for the change in #2770 for packages that disable the use_2to3 feature.

I honestly did not expect that anyone would have specified use2to3=False. The primary concern here is to fail fast for those projects relying on use_2to3=True.

May i suggest to revert #2770 and push a new patch level release? It seems that this change should also cause a major version release (since it is breaking for some/many packages that still use use2to3).

#2770 is a tweak on the original incompatibility introduced on the 58 release. That’s where the main incompatibility was introduced. v58.0.2 simply fails faster and in closer proximity to the cause.

I’ll restore compatibility for use_2to3=False and regret the inconvenience caused.

FWIW I see why this could’ve been expected to be dropped in a major version. So I’ll recommend @jaraco to re-release as v59 and yank v58.0.2 on PyPI.

I doubt making a backward-incompatible release will have any benefit. v58.0.3 will restore support for use_2to3=False. If we were to release support for Setuptools 59 as described, I can’t imagine any users would pin to 58<setuptools<59.

To all the others, if you legitimately think that this should be resurrected, it’d be useful if somebody could come up with a failing regression test that could be merged as XFAIL per https://pganssle-talks.github.io/xfail-lightning/. I don’t have a strong case for having this supported in a post Py2 EOL world, though, and would understand if Jason wouldn’t want to recover this, especially since he is the only active maintainer in the whole world (without exaggeration).

The main case to be made is for old, unmaintained code that’s still in Python 2 syntax but installed on Python 3. I don’t want to support this use case any longer. I did expect there would be some disruption from this change and my hope was that it would be small (a few fringe packages), and thus believe a deprecation period to be possibly unnecessary. I’m even offering to help revive/maintain some of these packages.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Should fail hard when installing packages that want 2to3
Tried to install a package that uses 2to3 (specifically ... [BUG] error in XXXX setup command: use_2to3 is invalid when false. #2775.
Read more >
pip giving error when trying to install packages Python 3.10
This error shows up on windows when one tries to use pip in the command prompt. To solve this error on windows, you...
Read more >
Diff - chromium/src - Google Git
Issue 48: incorrect size for mib array defined in getcmdargs for BSD ... run the standard distutils -commands: - -to build only: -...
Read more >
[Python-checkins] distutils2 (merge default -> python3): Ye olde merge.
+ logger.error( + "Invalid selection, type a number from the list above. ... self.version), + # FIXME doesn't that reproduce the bug from...
Read more >
autoland - Mercurial - Mozilla
We run this check as soon as # possible to avoid a cryptic import/usage error. if sys.version_info < (3, 6): print("Python 3.6+ is...
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