[BUG] Should fail hard when installing packages that want 2to3
See original GitHub issuesetuptools version
setuptools==58.0.0
Python version
Python 3.9
OS
Linux
Additional environment information
No response
Description
Tried to install a package that uses 2to3 (specifically https://pypi.org/project/demjson/), got a message from pip like:
Successfully installed demjson-2.2.3
But really it wasn’t successful, and then get confusing SyntaxError
exceptions.
Expected behavior
I have now worked out that this is because of the change to remove 2to3
from setuptools, which I think is a perfectly reasonable change, and because my setuptools version wasn’t pinned. But setuptools is not doing something the package is asking for, and the result is going to be something that does not run (though I guess there are caveats here).
I would have expected to get an error like “This module wants to use 2to3, but this is not supported [link to github issue about removing 2to3 support]”. At least, that would certainly have saved me time.
How to Reproduce
Install demjson==2.2.3
with setuptools==58.0.0
. Attempt to import and get a syntax error.
Output
$ pip install -U setuptools==58.0.0 && pip install demjson==2.2.3 && python -c 'import demjson'
Collecting setuptools==58.0.0
Using cached setuptools-58.0.0-py3-none-any.whl (816 kB)
Installing collected packages: setuptools
Attempting uninstall: setuptools
Found existing installation: setuptools 56.0.0
Uninstalling setuptools-56.0.0:
Successfully uninstalled setuptools-56.0.0
Successfully installed setuptools-58.0.0
Collecting demjson==2.2.3
Using cached demjson-2.2.3.tar.gz (131 kB)
Using legacy 'setup.py install' for demjson, since package 'wheel' is not installed.
Installing collected packages: demjson
Running setup.py install for demjson ... done
Successfully installed demjson-2.2.3
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/example/venv/lib/python3.9/site-packages/demjson.py", line 645
class json_int( (1L).__class__ ): # Have to specify base this way to satisfy 2to3
^
SyntaxError: invalid syntax
Code of Conduct
- I agree to follow the PSF Code of Conduct
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (6 by maintainers)
Top GitHub Comments
I think this broke a lot of builds unintentionally.
It sure did. 😬