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
Pip 21.2 release breaks python2 compatibilty #10214
Comments
Per pip’s Python 2 support policy, pip 20.3.4 was the last version of pip that supported Python 2. Projects still requiring Python 2 should pin pip to |
From the traceback you provided it looks like spark is using easy_install to download and install pip. easy_install is deprecated in favour of pip. I suspect there is an easy_install bug/missing feature where it is trying to install an incompatible version of pip for the current version of Python, but I doubt that it will be fixed in easy_install. I can reproduce the issue by installing pypandoc with easy_install. It looks to me like this is one of the steps in the spark install process. $ python2.7 -m easy_install pypandoc
WARNING: The easy_install command is deprecated and will be removed in a future version.
Searching for pypandoc
Reading https://pypi.org/simple/pypandoc/
Downloading https://files.pythonhosted.org/packages/56/4b/1962e8b460e509b5e23d47491a11a182e9a2eca3206bb3ce8dad0633ecaa/pypandoc-1.6.3.tar.gz#sha256=95a331f5ef74adb9557e9961d784c30ba73bd0d62e7736bb5d9ce74888b9f438
Best match: pypandoc 1.6.3
Processing pypandoc-1.6.3.tar.gz
Writing /tmp/easy_install-GflVXi/pypandoc-1.6.3/setup.cfg
Running pypandoc-1.6.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-GflVXi/pypandoc-1.6.3/egg-dist-tmp-7rzJRt
zip_safe flag not set; analyzing archive contents...
pypandoc.__init__: module references __file__
creating /tmp/spark/venv/lib/python2.7/site-packages/pypandoc-1.6.3-py2.7.egg
Extracting pypandoc-1.6.3-py2.7.egg to /tmp/spark/venv/lib/python2.7/site-packages
Adding pypandoc 1.6.3 to easy-install.pth file
Installed /tmp/spark/venv/lib/python2.7/site-packages/pypandoc-1.6.3-py2.7.egg
Processing dependencies for pypandoc
Searching for pip>=8.1.0
Reading https://pypi.org/simple/pip/
Downloading https://files.pythonhosted.org/packages/f7/ce/e359cf283c0c0f2e0af7df8f16c8d79047aa1887a00a5b39b27d8afc49e2/pip-21.2.1.tar.gz#sha256=303a82aaa24cdc01f7ebbd1afc7d1b871a4aa0a88bb5bedef1fa86a3ee44ca0a
Best match: pip 21.2.1
Processing pip-21.2.1.tar.gz
Writing /tmp/easy_install-95y9Wv/pip-21.2.1/setup.cfg
Running pip-21.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-95y9Wv/pip-21.2.1/egg-dist-tmp-q08hAr
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/tmp/spark/venv/lib/python2.7/site-packages/easy_install.py", line 5, in <module>
main()
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 2321, in main
**kw
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/__init__.py", line 162, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 424, in run
self.easy_install(spec, not self.no_deps)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 685, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 713, in install_item
self.process_distribution(spec, dist, deps)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 758, in process_distribution
[requirement], self.local_index, self.easy_install
File "/tmp/spark/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 782, in resolve
replace_conflicting=replace_conflicting
File "/tmp/spark/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
return self.obtain(req, installer)
File "/tmp/spark/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
return installer(requirement)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 685, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 711, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 896, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1164, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1150, in run_setup
run_setup(setup_script, args)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/sandbox.py", line 253, in run_setup
raise
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/sandbox.py", line 166, in save_modules
saved_exc.resume()
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/tmp/spark/venv/lib/python2.7/site-packages/setuptools/sandbox.py", line 44, in _execfile
code = compile(script, filename, 'exec')
File "/tmp/easy_install-95y9Wv/pip-21.2.1/setup.py", line 7
def read(rel_path: str) -> str:
^
SyntaxError: invalid syntax pypandoc specifies |
Closing since we are not going to do anything about this. |
I believe easy_install never got updated to include
AFAIK easy_install has been deprecated by the setuptools project, so no, it won't. |
My bad. I should have read the README before raising this issue. It clearly states that Pip 21.2 onwards Python2 support is deprecated. Thanks for your help and suggestions @domdfcoding @pfmoore |
Description
This commit ensured that
python setup.py
can be run only with python3. And this was released in pip 21.2 version.There are other projects like Spark which are still using python2 but also depend on latest release of pip.
So, when
python2 setup.py sdist
is run in above spark build, it installs the latest pip and then installation fails since python2 cannot execute pip'ssetup.py
And
python3 setup.py sdist
fails since Spark's setup.py cannot run on python3.Expected behavior
pip should not break python2 compatibility
pip version
21.2
Python version
2.7.4
OS
Linux
How to Reproduce
git clone https://github.com/apache/spark/
cd python
python setup.py sdist
Output
Code of Conduct
The text was updated successfully, but these errors were encountered: