Missing Config Settings For Multiple Python Versions

by ADMIN 53 views

Introduction

When working with multiple Python versions, it's not uncommon to encounter issues with configuration settings. In this article, we'll explore a specific problem that arises when using pip.parse with requirements files that pull in wheels with manual URLs and different Python version constraints. We'll delve into the error message, provide a minimal reproduction, and discuss the environment and rules_python version.

The Problem

If you have a requirements file that pulls in wheels with manual URLs with different Python version constraints, you may encounter an error about missing internal config settings. This issue is particularly problematic when working with multiple Python versions, as it can lead to confusion and difficulties in resolving dependencies.

Minimal Reproduction

To reproduce this issue, you can use the following requirements file:

--index-url https://pypi.org/simple

gptqmodel @ https://github.com/ModelCloud/GPTQModel/releases/download/v2.0.0/gptqmodel-2.0.0+cu126torch2.6-cp310-cp310-linux_x86_64.whl ; python_full_version == '3.10.*' and sys_platform == 'linux'
gptqmodel @ https://github.com/ModelCloud/GPTQModel/releases/download/v2.0.0/gptqmodel-2.0.0+cu126torch2.6-cp311-cp311-linux_x86_64.whl ; python_full_version == '3.11.*' and sys_platform == 'linux'
gptqmodel @ https://github.com/ModelCloud/GPTQModel/releases/download/v2.0.0/gptqmodel-2.0.0+cu126torch2.6-cp312-cp312-linux_x86_64.whl ; python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'linux'
gptqmodel @ https://github.com/ModelCloud/GPTQModel/releases/download/v2.0.0/gptqmodel-2.0.0+cu126torch2.6-cp39-cp39-linux_x86_64.whl ; python_full_version < '3.10' and sys_platform == 'linux'

This requirements file pulls in wheels with manual URLs and different Python version constraints. When you run bazel query 'deps(...)', you may encounter an error about missing internal config settings.

Exception or Error

The error message you may encounter is:

bazel query 'deps(...)'
ERROR: Evaluation of query "deps(...)" failed: preloading transitive closure failed: no such target '@@rules_python++pip+pip//_config:is_cp39_cp311_linux_x86_64': target 'is_cp39_cp311_linux_x86_64' not declared in package '_config' defined by /home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python++pip+pip/_config/BUILD.bazel (did you mean is_cp39_cp39_linux_x86_64, is_cp39_cp39t_linux_x86_64, _is_cp39_cp39_linux_x86_64, or _is_cp39_cp39t_linux_x86_64?)
Loading: 1 packages loaded
    Fetching repository @@rules_python++pip+pip_39_gptqmodel_2_0_0_cu126torch2_6_cp39_cp39_linux_x86_64; starting
    Fetching repository @@rules_python++pip+pip_39_gptqmodel_2_0_0_cu126torch2_6_cp312_cp312_linux_x86_64; starting
    Fetching repository @@rules_python++pip+pip_39_gptqmodel_2_0_0_cu126torch2_6_cp310_cp310_linux_x86_64; starting

This error message indicates that the bazel query failed due to a missing internal config setting.

Your Environment

Here are the details of your environment:

  • Operating System: linux x86_64
  • Output of bazel version: 8.2.1
  • Rules_python version: https://github.com/bazelbuild/rules_python//commit/189e30df4001d34aba590e0267d3e5f72e6d8b19

Conclusion

Q: What is the issue with missing config settings for multiple Python versions?

A: The issue arises when using pip.parse with requirements files that pull in wheels with manual URLs and different Python version constraints. This can lead to an error about missing internal config settings, particularly when working with multiple Python versions.

Q: What is the cause of the missing config settings error?

A: The cause of the missing config settings error is due to the way pip.parse handles requirements files with manual URLs and different Python version constraints. When pip.parse encounters a wheel with a manual URL and a specific Python version constraint, it attempts to load the corresponding config setting. However, if the config setting is not available, it raises an error.

Q: How can I reproduce the issue?

A: To reproduce the issue, you can use the following requirements file:

--index-url https://pypi.org/simple

gptqmodel @ https://github.com/ModelCloud/GPTQModel/releases/download/v2.0.0/gptqmodel-2.0.0+cu126torch2.6-cp310-cp310-linux_x86_64.whl ; python_full_version == '3.10.*' and sys_platform == 'linux'
gptqmodel @ https://github.com/ModelCloud/GPTQModel/releases/download/v2.0.0/gptqmodel-2.0.0+cu126torch2.6-cp311-cp311-linux_x86_64.whl ; python_full_version == '3.11.*' and sys_platform == 'linux'
gptqmodel @ https://github.com/ModelCloud/GPTQModel/releases/download/v2.0.0/gptqmodel-2.0.0+cu126torch2.6-cp312-cp312-linux_x86_64.whl ; python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'linux'
gptqmodel @ https://github.com/ModelCloud/GPTQModel/releases/download/v2.0.0/gptqmodel-2.0.0+cu126torch2.6-cp39-cp39-linux_x86_64.whl ; python_full_version < '3.10' and sys_platform == 'linux'

This requirements file pulls in wheels with manual URLs and different Python version constraints. When you run bazel query 'deps(...)', you may encounter an error about missing internal config settings.

Q: What is the error message I may encounter?

A: The error message you may encounter is:

bazel query 'deps(...)'
ERROR: Evaluation of query "deps(...)" failed: preloading transitive closure failed: no such target '@@rules_python++pip+pip//_config:is_cp39_cp311_linux_x86_64': target 'is_cp39_cp311_linux_x86_64' not declared in package '_config' defined by /home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python++pip+pip/_config/BUILD.bazel (did you mean is_cp39_cp39_linux_x86_64, is39_cp39t_linux_x86_64, _is_cp39_cp39_linux_x86_64, or _is_cp39_cp39t_linux_x86_64?)
Loading: 1 packages loaded
    Fetching repository @@rules_python++pip+pip_39_gptqmodel_2_0_0_cu126torch2_6_cp39_cp39_linux_x86_64; starting
    Fetching repository @@rules_python++pip+pip_39_gptqmodel_2_0_0_cu126torch2_6_cp312_cp312_linux_x86_64; starting
    Fetching repository @@rules_python++pip+pip_39_gptqmodel_2_0_0_cu126torch2_6_cp310_cp310_linux_x86_64; starting

This error message indicates that the bazel query failed due to a missing internal config setting.

Q: How can I resolve the issue?

A: To resolve the issue, you can try the following:

  • Check the requirements file for any errors or inconsistencies.
  • Verify that the wheels with manual URLs and different Python version constraints are correctly configured.
  • Update the pip and rules_python versions to the latest available.
  • Try running bazel query 'deps(...)' with the --verbose flag to get more detailed error messages.

Q: What are the system requirements for resolving the issue?

A: The system requirements for resolving the issue are:

  • Linux x86_64 operating system
  • Bazel version 8.2.1 or later
  • Rules_python version 189e30df4001d34aba590e0267d3e5f72e6d8b19 or later

Q: Are there any known workarounds for the issue?

A: Yes, there are known workarounds for the issue:

  • Use a single Python version for all wheels.
  • Use a different requirements file format, such as pip-compile.
  • Update the pip and rules_python versions to the latest available.

Q: Can I get more information about the issue?

A: Yes, you can get more information about the issue by:

  • Checking the pip and rules_python documentation for any relevant information.
  • Searching online for any known issues or workarounds.
  • Contacting the pip and rules_python maintainers for further assistance.