cool-easter-32542
01/09/2024, 4:41 AMstderr:
Could not find a compatible interpreter.
Examined the following working interpreters:
1.) /usr/bin/python3.10 CPython==3.10.12
Skipped the following broken interpreters:
1.) /actions-runner/install/_work/_tool/Python/3.11.7/x64/bin/python3.11:
Traceback (most recent call last):
File "<string>", line 4, in <module>
File "/root/.cache/pants/named_caches/pex_root/isolated/ac60ac27c85fa1751e8e471a569159e88a033b8f/pex/atomic_directory.py", line 24, in <module>
from pex.third_party import attr
File "/root/.cache/pants/named_caches/pex_root/isolated/ac60ac27c85fa1751e8e471a569159e88a033b8f/pex/third_party/__init__.py", line 614, in <module>
install(expose=["attrs"])
File "/root/.cache/pants/named_caches/pex_root/isolated/ac60ac27c85fa1751e8e471a569159e88a033b8f/pex/third_party/__init__.py", line 581, in install
VendorImporter.install_vendored(prefix=import_prefix(), root=root, expose=expose)
File "/root/.cache/pants/named_caches/pex_root/isolated/ac60ac27c85fa1751e8e471a569159e88a033b8f/pex/third_party/__init__.py", line 242, in install_vendored
root = cls._abs_root(root)
^^^^^^^^^^^^^^^^^^^
File "/root/.cache/pants/named_caches/pex_root/isolated/ac60ac27c85fa1751e8e471a569159e88a033b8f/pex/third_party/__init__.py", line 185, in _abs_root
from pex import vendor
File "/root/.cache/pants/named_caches/pex_root/isolated/ac60ac27c85fa1751e8e471a569159e88a033b8f/pex/vendor/__init__.py", line 13, in <module>
from pex.tracer import TRACER
File "/root/.cache/pants/named_caches/pex_root/isolated/ac60ac27c85fa1751e8e471a569159e88a033b8f/pex/tracer.py", line 12, in <module>
from pex.variables import ENV
File "/root/.cache/pants/named_caches/pex_root/isolated/ac60ac27c85fa1751e8e471a569159e88a033b8f/pex/variables.py", line 20, in <module>
from pex.orderedset import OrderedSet
File "/root/.cache/pants/named_caches/pex_root/isolated/ac60ac27c85fa1751e8e471a569159e88a033b8f/pex/orderedset.py", line 15, in <module>
from pex.compatibility import MutableSet
File "/root/.cache/pants/named_caches/pex_root/isolated/ac60ac27c85fa1751e8e471a569159e88a033b8f/pex/compatibility.py", line 130, in <module>
from urllib.request import HTTPSHandler as HTTPSHandler
ImportError: cannot import name 'HTTPSHandler' from 'urllib.request' (/actions-runner/install/_work/_tool/Python/3.11.7/x64/lib/python3.11/urllib/request.py)
(See <https://github.com/pantsbuild/pex/issues/1027> for a list of known breaks and workarounds.)
No working interpreter compatible with the requested constraints was found:
Version matches CPython==3.11.*
I do not expect this error to occur. I have installed python3-distlib per the mentioned issue here: pantsbuild/pex#1027
I have printed the content of the file (request.py), and I see this relevant section:
class HTTPHandler(AbstractHTTPHandler):
def http_open(self, req):
return self.do_open(http.client.HTTPConnection, req)
http_request = AbstractHTTPHandler.do_request_
if hasattr(http.client, 'HTTPSConnection'):
class HTTPSHandler(AbstractHTTPHandler):
def __init__(self, debuglevel=0, context=None, check_hostname=None):
AbstractHTTPHandler.__init__(self, debuglevel)
self._context = context
self._check_hostname = check_hostname
def https_open(self, req):
return self.do_open(http.client.HTTPSConnection, req,
context=self._context, check_hostname=self._check_hostname)
https_request = AbstractHTTPHandler.do_request_
__all__.append('HTTPSHandler')
I'm wondering if this if hasattr(http.client, 'HTTPSConnection'): may return false, and thus I'm not able to import the HTTPSHandler.
Pants version
Which version of Pants are you using?
2.19.0rc3
OS
Are you encountering the bug on MacOS, Linux, or both?
Linux, gha
Additional info
Add any other information about the problem here, such as attachments or links to gists, if relevant.
Pants.toml
[GLOBAL]
pants_version = "2.19.0rc3"
print_stacktrace = true
backend_packages.add = [
"pants.backend.docker",
"pants.backend.python",
"pants.backend.build_files.fix.deprecations",
"pants.backend.build_files.fmt.black",
"pants.backend.python.lint.autoflake",
"pants.backend.python.lint.black",
"pants.backend.python.lint.docformatter",
"pants.backend.python.lint.isort",
"pants.backend.experimental.python.lint.ruff"
]
pants_ignore=[
"**/proto/**",
]
[anonymous-telemetry]
enabled = false
[source]
root_patterns = ["/"]
[python]
interpreter_constraints = ["==3.11.*"]
enable_resolves = true
default_resolve = "python-default"
[python-repos]
indexes = [
# intentionally hidden
]
[python-bootstrap]
search_path = [
"<PYENV>",
"<PATH>",
"/usr/local/bin",
"/opt/homebrew/bin/python3"
]
[pex-cli]
version="v2.1.148"
url_template="file:%(buildroot)s/.github/pex"
[python.resolves]
python-default = "3rdparty/python/user_reqs.lock"
ingestion = "3rdparty/python/ingestion.lock"
dragonfish_dbt = "3rdparty/python/dragonfish_dbt.lock"
backfill = "3rdparty/python/backfill.lock"
services-raf = "3rdparty/python/services-raf.lock"
black = "3rdparty/python/black.lock"
autoflake = "3rdparty/python/autoflake.lock"
docformatter = "3rdparty/python/docformatter.lock"
isort = "3rdparty/python/isort.lock"
ruff = "3rdparty/python/ruff.lock"
[test]
use_coverage = true
report = true
[coverage-py]
report = ["xml", "html"]
[generate-lockfiles]
diff = true
# in order to use these tools, we need to create lockfiles
# so that the ci knows to download the requirements
# from artifactory, instead of pypi
# create lockfiles with `pants generate-lockfiles`
[black]
install_from_resolve = "black"
[autoflake]
install_from_resolve = "autoflake"
[docformatter]
install_from_resolve = "docformatter"
[isort]
install_from_resolve = "isort"
[ruff]
install_from_resolve = "ruff"
Github Action
lint:
name: ✅ Lint
runs-on: [self-hosted, cosmos-prod]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
# I don't think this step is actually required
- name: Install python3-distlib
run: |
sudo apt-get update && sudo apt-get install -y build-essential
sudo apt-get update && sudo apt-get install -y libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
- name: setup-python
uses: anzx/cosmos-github-actions/setup-python@main
with:
python-version: '3.11'
- name: Install python3-distlib
run: sudo apt-get update && sudo apt-get install -y libpython3.11-dev python3-distlib
- name: Initialize Pants
uses: pantsbuild/actions/init-pants@main
- name: ci
shell: bash
run: |
pants lint ::
pantsbuild/pantscool-easter-32542
01/09/2024, 10:39 PM