Skip to content

AttributeError: module 'sysconfig' has no attribute 'get_preferred_scheme' on Python 3.10.alpha #10253

Closed
@SylvainDe

Description

@SylvainDe

Description

Trying to use a recent version of pip (pip 21.2.2) with alpha builds for Python 3.10 leads to the following exception:

AttributeError: module 'sysconfig' has no attribute 'get_preferred_scheme'

The version 3.10.beta are not affected by this issue.

I've quickly analysed the issue and suggested the following PR: #10252

Expected behavior

No response

pip version

pip 21.2.2

Python version

3.10.0a1 3.10.0a2 3.10.0a3 3.10.0a4 3.10.0a5 3.10.0a6 3.10.0a7

OS

Any

How to Reproduce

  1. Update pep8 package using 'pip install --upgrade pep8' (I suspect any pip command would do the trick, this one happens to be the first of my Github workflow)
  2. An error occurs.

Output

pip install --upgrade pep8
  pip install pep257
  pip install pydocstyle
  pip install --upgrade pyflakes || true
  pip install coverage
  pip install codecov
  pip install unittest2
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.10.0-alpha.1/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.0-alpha.1/x64/lib
ERROR: Exception:
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.0-alpha.1/x64/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 173, in _main
    status = self.run(options, args)
  File "/opt/hostedtoolcache/Python/3.10.0-alpha.1/x64/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 203, in wrapper
    return func(self, options, args)
  File "/opt/hostedtoolcache/Python/3.10.0-alpha.1/x64/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 239, in run
    options.use_user_site = decide_user_install(
  File "/opt/hostedtoolcache/Python/3.10.0-alpha.1/x64/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 652, in decide_user_install
    if site_packages_writable(root=root_path, isolated=isolated_mode):
  File "/opt/hostedtoolcache/Python/3.10.0-alpha.1/x64/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 598, in site_packages_writable
    get_lib_location_guesses(root=root, isolated=isolated))
  File "/opt/hostedtoolcache/Python/3.10.0-alpha.1/x64/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 584, in get_lib_location_guesses
    scheme = get_scheme(
  File "/opt/hostedtoolcache/Python/3.10.0-alpha.1/x64/lib/python3.10/site-packages/pip/_internal/locations/__init__.py", line 155, in get_scheme
    new = _sysconfig.get_scheme(
  File "/opt/hostedtoolcache/Python/3.10.0-alpha.1/x64/lib/python3.10/site-packages/pip/_internal/locations/_sysconfig.py", line 131, in get_scheme
    scheme_name = _infer_prefix()
  File "/opt/hostedtoolcache/Python/3.10.0-alpha.1/x64/lib/python3.10/site-packages/pip/_internal/locations/_sysconfig.py", line 45, in _infer_prefix
    return sysconfig.get_preferred_scheme("prefix")  # type: ignore
AttributeError: module 'sysconfig' has no attribute 'get_preferred_scheme'
Error: Process completed with exit code 2.


### Code of Conduct

- [X] I agree to follow the [PSF Code of Conduct](https://www.python.org/psf/conduct/).

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions