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

[PyPy] "pip install --help" fails with TypeError: 'list' objects are unhashable #9245

Closed
ShaneHarvey opened this issue Dec 7, 2020 · 5 comments

Comments

@ShaneHarvey
Copy link

ShaneHarvey commented Dec 7, 2020

Environment

  • pip version: 20.3.1
  • Python version: PyPy 7.3.2 (Python 2.7.13)
  • OS: Ubuntu 16.04

Description
On pypy with pip 20.3.1 "pip install --help" fails with TypeError: 'list' objects are unhashable

Expected behavior
"pip install --help" should print the help message.

How to Reproduce

  1. Create a virtualenv with PyPy 2
  2. Update pip: python -m pip install --upgrade setuptools wheel
  3. Run python -m pip install --help
  4. A TypeError: 'list' objects are unhashable error occurs (see below).

Output

ubuntu@ip-10-122-25-114:~$ createvirtualenv /opt/python/pypy/bin/pypy venvpypy
+ createvirtualenv /opt/python/pypy/bin/pypy venvpypy
+ PYTHON=/opt/python/pypy/bin/pypy
+ VENVPATH=venvpypy
+ /opt/python/pypy/bin/pypy -m virtualenv --version
virtualenv 20.0.33 from /opt/python/pypy/site-packages/virtualenv/__init__.pyc
+ VIRTUALENV='/opt/python/pypy/bin/pypy -m virtualenv --never-download'
+ /opt/python/pypy/bin/pypy -m virtualenv --never-download venvpypy
created virtual environment PyPy2.7.13.final.42-64 in 220ms
  creator PyPy2Posix(dest=/home/ubuntu/venvpypy, clear=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/ubuntu/.local/share/virtualenv)
    added seed packages: pip==20.2.3, setuptools==44.1.1, wheel==0.35.1
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator
+ '[' Windows_NT = '' ']'
+ . venvpypy/bin/activate
++ '[' venvpypy/bin/activate = -bash ']'
++ deactivate nondestructive
++ unset -f pydoc
++ '[' -z '' ']'
++ '[' -z '' ']'
++ '[' -n /bin/bash ']'
++ hash -r
++ '[' -z '' ']'
++ unset VIRTUAL_ENV
++ '[' '!' nondestructive = nondestructive ']'
++ VIRTUAL_ENV=/home/ubuntu/venvpypy
++ export VIRTUAL_ENV
++ _OLD_VIRTUAL_PATH=/opt/go/bin:/opt/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/node/bin:/opt/node/bin:/home/ubuntu/cli_bin
++ PATH=/home/ubuntu/venvpypy/bin:/opt/go/bin:/opt/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/node/bin:/opt/node/bin:/home/ubuntu/cli_bin
++ export PATH
++ '[' -z '' ']'
++ '[' -z '' ']'
++ _OLD_VIRTUAL_PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
++ '[' x '!=' x ']'
+++ basename /home/ubuntu/venvpypy
++ PS1='(venvpypy) ${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
++ export PS1
++ alias pydoc
++ true
++ '[' -n /bin/bash ']'
++ hash -r
+ python -m pip install --upgrade pip setuptools wheel
DEPRECATION: pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Looking in indexes: https://artifactory.corp.mongodb.com/artifactory/api/pypi/pypi/simple, https://pypi.org/simple
Collecting pip
  Using cached https://artifactory.corp.mongodb.com/artifactory/api/pypi/pypi/packages/ab/11/2dc62c5263d9eb322f2f028f7b56cd9d096bb8988fcf82d65fa2e4057afe/pip-20.3.1-py2.py3-none-any.whl (1.5 MB)
Requirement already up-to-date: setuptools in ./venvpypy/site-packages (44.1.1)
Collecting wheel
  Using cached https://artifactory.corp.mongodb.com/artifactory/api/pypi/pypi/packages/c9/0b/e0fd299d93cd9331657f415085a4956422959897b333e3791dde40bd711d/wheel-0.36.1-py2.py3-none-any.whl (34 kB)
Installing collected packages: pip, wheel
  Attempting uninstall: pip
    Found existing installation: pip 20.2.3
    Uninstalling pip-20.2.3:
      Successfully uninstalled pip-20.2.3
  Attempting uninstall: wheel
    Found existing installation: wheel 0.35.1
    Uninstalling wheel-0.35.1:
      Successfully uninstalled wheel-0.35.1
Successfully installed pip-20.3.1 wheel-0.36.1
(venvpypy) ubuntu@ip-10-122-25-114:~$ pip list
+ pip list
DEPRECATION: pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Package    Version
---------- -------
cffi       1.14.2
greenlet   0.4.13
pip        20.3.1
readline   6.2.4.1
setuptools 44.1.1
wheel      0.36.1
(venvpypy) ubuntu@ip-10-122-25-114:~$ pip --version
+ pip --version
pip 20.3.1 from /home/ubuntu/venvpypy/site-packages/pip (python 2.7)
(venvpypy) ubuntu@ip-10-122-25-114:~$ python --version
+ python --version
Python 2.7.13 (6abe2e00c51d, Sep 23 2020, 05:06:33)
[PyPy 7.3.2 with GCC 7.3.1 20180303 (Red Hat 7.3.1-5)]
(venvpypy) ubuntu@ip-10-122-25-114:~$ pip install --help
+ pip install --help
Traceback (most recent call last):
  File "/home/ubuntu/venvpypy/bin/pip", line 8, in <module>
    sys.exit(main())
  File "/home/ubuntu/venvpypy/site-packages/pip/_internal/cli/main.py", line 75, in main
    return command.main(cmd_args)
  File "/home/ubuntu/venvpypy/site-packages/pip/_internal/cli/base_command.py", line 117, in main
    return self._main(args)
  File "/home/ubuntu/venvpypy/site-packages/pip/_internal/cli/base_command.py", line 131, in _main
    options, args = self.parse_args(args)
  File "/home/ubuntu/venvpypy/site-packages/pip/_internal/cli/base_command.py", line 111, in parse_args
    return self.parser.parse_args(args)
  File "/opt/python/pypy/lib-python/2.7/optparse.py", line 1400, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/opt/python/pypy/lib-python/2.7/optparse.py", line 1440, in _process_args
    self._process_long_opt(rargs, values)
  File "/opt/python/pypy/lib-python/2.7/optparse.py", line 1515, in _process_long_opt
    option.process(opt, value, values, self)
  File "/opt/python/pypy/lib-python/2.7/optparse.py", line 789, in process
    self.action, self.dest, opt, value, values, parser)
  File "/opt/python/pypy/lib-python/2.7/optparse.py", line 811, in take_action
    parser.print_help()
  File "/opt/python/pypy/lib-python/2.7/optparse.py", line 1670, in print_help
    file.write(self.format_help().encode(encoding, "replace"))
  File "/opt/python/pypy/lib-python/2.7/optparse.py", line 1650, in format_help
    result.append(self.format_option_help(formatter))
  File "/opt/python/pypy/lib-python/2.7/optparse.py", line 1633, in format_option_help
    result.append(group.format_help(formatter))
  File "/opt/python/pypy/lib-python/2.7/optparse.py", line 1114, in format_help
    result += OptionContainer.format_help(self, formatter)
  File "/opt/python/pypy/lib-python/2.7/optparse.py", line 1085, in format_help
    result.append(self.format_option_help(formatter))
  File "/opt/python/pypy/lib-python/2.7/optparse.py", line 1074, in format_option_help
    result.append(formatter.format_option(option))
  File "/opt/python/pypy/lib-python/2.7/optparse.py", line 316, in format_option
    help_text = self.expand_default(option)
  File "/home/ubuntu/venvpypy/site-packages/pip/_internal/cli/parser.py", line 123, in expand_default
    default_value, redact_auth_from_url(default_value))
  File "/home/ubuntu/venvpypy/site-packages/pip/_internal/utils/misc.py", line 826, in redact_auth_from_url
    return _transform_url(url, _redact_netloc)[0]
  File "/home/ubuntu/venvpypy/site-packages/pip/_internal/utils/misc.py", line 786, in _transform_url
    purl = urllib_parse.urlsplit(url)
  File "/opt/python/pypy/lib-python/2.7/urlparse.py", line 176, in urlsplit
    cached = _parse_cache.get(key, None)
TypeError: 'list' objects are unhashable
@uranusjr
Copy link
Member

uranusjr commented Dec 8, 2020

Hi, can you try if #9207 fixes the issue?

@ShaneHarvey
Copy link
Author

Yes this seems to be fixed in master:

(venvpypy) ubuntu@ip-10-122-25-114:~$ pip install --upgrade https://github.com/pypa/pip/archive/master.tar.gz
DEPRECATION: pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Looking in indexes: https://artifactory.corp.mongodb.com/artifactory/api/pypi/pypi/simple, https://pypi.org/simple
Collecting https://github.com/pypa/pip/archive/master.tar.gz
  Downloading https://github.com/pypa/pip/archive/master.tar.gz
     / 8.8 MB 10.2 MB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: pip
  Building wheel for pip (PEP 517) ... done
  Created wheel for pip: filename=pip-21.0.dev0-py2.py3-none-any.whl size=1519799 sha256=c546a19befe9b9ecca89fe72e55478349a139beb9c8f046d780655c6f890d9a4
  Stored in directory: /data/tmp/pip-ephem-wheel-cache-1usjXk/wheels/fd/ba/0a/a283cf6fd417b712631848e460eb636624b69f04c8752894dd
Successfully built pip
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.3.1
    Uninstalling pip-20.3.1:
      Successfully uninstalled pip-20.3.1
Successfully installed pip-21.0.dev0
(venvpypy) ubuntu@ip-10-122-25-114:~$ pip install --help

Usage:
  pip install [options] <requirement specifier> [package-index-options] ...
  pip install [options] -r <requirements file> [package-index-options] ...
  pip install [options] [-e] <vcs project url> ...

Thanks.

@pradyunsg
Copy link
Member

Thanks for confirming @ShaneHarvey! I'll close this, since the fix has been merged and will be in the upcoming pip 20.3.2 release.

@ichard26
Copy link
Member

I'm pretty sure that this should be closed as the fix has been available in a release for a little bit now. Looks like pradyunsg forgot about this issue so just a gentle ping :)

@uranusjr
Copy link
Member

Thanks for the heads-up!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants