Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: 3.2 does not support python 2.7 anymore, indirectly #568

Closed
siovene opened this issue Dec 16, 2020 · 5 comments
Closed

bug: 3.2 does not support python 2.7 anymore, indirectly #568

siovene opened this issue Dec 16, 2020 · 5 comments

Comments

@siovene
Copy link

siovene commented Dec 16, 2020

Describe the bug

bleach is supposed to support python 2.7, as far as I understand, but version 2.7 requires setuptools > 45, and that requires python 3.

** python and bleach versions (please complete the following information):**

  • Python Version: [e.g. 2.7]
  • Bleach Version: [e.g. 3.2.1]

To Reproduce

Steps to reproduce the behavior:

Try to install bleach 3.2.1 with python 2.7 and setuptools 45.

Expected behavior

Everything works fine.

Additional context

import bleach
--
1044 | File "/usr/local/lib/python2.7/dist-packages/bleach/__init__.py", line 5, in <module>
1045 | import packaging.version
1046 | ImportError: No module named packaging.version
@g-k
Copy link
Collaborator

g-k commented Dec 16, 2020

Hi, I'm having trouble reproducing this in the docker python:2-slim image below. Bleach doesn't directly depend on setuptools 45, so I'm not sure how that requirement crept into your environment.

What commands did you run and did you see any errors during install?

Thanks!

» docker run -it python:2-slim /bin/bash
root@89000e286f23:/# pip --version
pip 20.0.2 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
root@89000e286f23:/# python --version
Python 2.7.18
root@89000e286f23:/# pip install bleach==3.2.1
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting bleach==3.2.1
  Downloading bleach-3.2.1-py2.py3-none-any.whl (145 kB)
     |████████████████████████████████| 145 kB 398 kB/s 
Collecting six>=1.9.0
  Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting webencodings
  Downloading webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Collecting packaging
  Downloading packaging-20.8-py2.py3-none-any.whl (39 kB)
Collecting pyparsing>=2.0.2
  Downloading pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
     |████████████████████████████████| 67 kB 583 kB/s 
Installing collected packages: six, webencodings, pyparsing, packaging, bleach
Successfully installed bleach-3.2.1 packaging-20.8 pyparsing-2.4.7 six-1.15.0 webencodings-0.5.1
WARNING: You are using pip version 20.0.2; however, version 20.3.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
root@89000e286f23:/# python
Python 2.7.18 (default, Apr 20 2020, 19:34:11) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bleach
>>> bleach.__version__
u'3.2.1'
>>> 

@g-k
Copy link
Collaborator

g-k commented Dec 16, 2020

refs: #520

@siovene
Copy link
Author

siovene commented Dec 16, 2020

Hi @g-k, this is my requirements.txt, if it helps:
https://github.com/astrobin/astrobin/blob/pyup-update-bleach-3.1.4-to-3.2.1/requirements.txt

And this is my dockerfile, where you can also see the commands that lead to the installation of the pip dependencies:
https://github.com/astrobin/astrobin/blob/pyup-update-bleach-3.1.4-to-3.2.1/docker/astrobin.dockerfile

Please let me know if you need more info, thanks!

@willkg
Copy link
Member

willkg commented Feb 1, 2021

@siovene I can't get astrobin to build. When running compose build, I get this:

...
Step 10/26 : RUN mkdir /code
 ---> Running in af81a445c676
Removing intermediate container af81a445c676
 ---> 52f55a8688c5
Step 11/26 : COPY requirements.txt /code
 ---> 7faaec1ba39b
Step 12/26 : WORKDIR /code
 ---> Running in c20a7bf30437
Removing intermediate container c20a7bf30437
 ---> 17a6c03778b9
Step 13/26 : RUN python -m pip install --upgrade pip &&     apt-get purge -y python-pip &&     python -m pip install "setuptools<45" &&     pip install --no-deps -r requirements.txt --src /src
 ---> Running in 711c79ad0ec2
Collecting pip
  Downloading https://files.pythonhosted.org/packages/b7/2d/ad02de84a4c9fd3b1958dc9fb72764de1aa2605a9d7e943837be6ad82337/pip-21.0.1.tar.gz (1.5MB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: No module named setuptools
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-C1JS96/pip/
You are using pip version 8.1.1, however version 21.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ERROR: Service 'beat' failed to build : The command '/bin/sh -c python -m pip install --upgrade pip &&     apt-get purge -y python-pip &&     python -m pip install "setuptools<45" &&     pip install --no-deps -r requirements.txt --src /src' returned a non-zero code: 1

pip 21.0.1 dropped support for Python 2.7, so I suspect that's what's going on.

Going back a step, I think the problem you're hitting is a problem in the packaging library or some other transitive dependency that's not listed in your requirements file. For example, packaging 20.8 released in 2020-12-11 has this note:

Revert back to setuptools for compatibility purposes for some Linux distros

I think you should try rebasing your pyup-update-bleach-3.1.4-to-3.2.1 branch so it picks up all the changes you've made in your master branch and then try things out from there. You'll be picking up different versions of libraries that aren't listed in your requirements.txt file and an update in one of them might have fixed your issue. Alternatively, you might be in a worse place since pip and libraries are increasingly dropping support for Python 2.7.

@g-k
Copy link
Collaborator

g-k commented Feb 2, 2021

Thanks Will!

Closing this since it looks specific to astrobin.

@g-k g-k closed this as completed Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants