Skip to content

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

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

Closed
SylvainDe opened this issue Jul 31, 2021 · 3 comments
Labels
type: bug A confirmed bug or unintended behavior

Comments

@SylvainDe
Copy link
Contributor

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/).
@edmorley
Copy link
Contributor

edmorley commented Aug 1, 2021

This can be closed - fixed by #10252.

@uranusjr uranusjr closed this as completed Aug 1, 2021
@uranusjr uranusjr removed this from the 21.2.3 milestone Aug 1, 2021
@uranusjr
Copy link
Member

uranusjr commented Aug 1, 2021

Also removing the milestone since #10252 is already in it and we don’t need two entries for the same thing.

@SylvainDe
Copy link
Contributor Author

Successfully fixed when CI went from using pip 21.2.2 to pip 21.2.3.
Thanks @uranusjr for your help in making this possible so quickly!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2021
@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants