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] Should fail hard when installing packages that want 2to3

See original GitHub issue

setuptools 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:closed
  • Created 2 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

28reactions
arphenocommented, Sep 7, 2021

I think this broke a lot of builds unintentionally.

11reactions
ikapelyukhincommented, Sep 7, 2021

I think this broke a lot of builds unintentionally.

It sure did. 😬

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use/install python 2to3? - Stack Overflow
You need to first install the following packages: apt install 2to3 apt install python3-lib2to3 apt install python3-toolz. For windows just install 2to3
Read more >
Pip Install: Install and Remove Python Packages
First things first: we need to install pip itself. The good news is that Pip is probably already present on your system. Most...
Read more >
Unable to upgrade Python 3.8.10 to 3.10 - SOLVED
Hi, I tried to upgrade Python 3.8.10 to 3.10 on Ubuntu : Ubuntu 20.04.4 LTS but we hit a blocker and wondering whether...
Read more >
User:Tomspur/Packaging:Python - Fedora Project Wiki
In RHEL 6 and older, python2 packages that install python modules need to ... be more difficult to figure out e.g. that a...
Read more >
Full Text Bug Listing - Red Hat Bugzilla
Installing one which runs under whichever version of python is default should be enough ... It also should not print an error message...
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