• Bug#1107280: pymatgen: FTBFS: Tries to access Internet during build

    From Santiago Vila@21:1/5 to All on Wed Jun 4 15:40:01 2025
    Package: src:pymatgen
    Version: 2025.2.18+dfsg1-4
    Severity: serious
    Tags: ftbfs trixie sid

    Dear maintainer:

    During a rebuild of all packages in unstable, your package failed to build:

    --------------------------------------------------------------------------------
    [...]
    self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7fce1d0e9ba0> err = TimeoutError('The read operation timed out')
    url = '/wiki/api.php?action=query&list=categorymembers&cmtitle=Category:INCAR_tag&cmlimit=500&format=json'
    timeout_value = 60

    def _raise_timeout(
    self,
    err: BaseSSLError | OSError | SocketTimeout,
    url: str,
    timeout_value: _TYPE_TIMEOUT | None,
    ) -> None:
    """Is the error actually a timeout? Will raise a ReadTimeout or pass"""

    if isinstance(err, SocketTimeout):
    raise ReadTimeoutError(
    self, url, f"Read timed out. (read timeout={timeout_value})"
    ) from err
    E urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='www.vasp.at', port=443): Read timed out. (read timeout=60)
    --------------------------------------------------------------------------------

    The reason is in tests/io/vasp/test_help.py which reads like this:


    try:
    website_down = requests.get("https://www.vasp.at", timeout=5).status_code != 200
    except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout):
    website_down = True


    I guess that for the package build as such, we could do this instead of the above four lines:

    website_down = True

    and the remaining code would not need to be touched.


    But I see in #1103427 that some network tests are deliberately run in CI
    so I'm not sure if the above simple fix would be compatible with running
    the network tests in CI, so I leave it to you.

    Thanks.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Santiago Vila@21:1/5 to All on Thu Jun 5 11:50:01 2025
    This is a multi-part message in MIME format.
    Hi. I found a different mode of failure today:

    =================================== FAILURES ===================================
    ______________________ TestVaspDoc.test_print_help[ISYM] _______________________

    self = <vasp.test_help.TestVaspDoc object at 0x7f34bfc4cb90>, tag = 'ISYM'

    @pytest.mark.parametrize("tag", ["ISYM"])
    def test_print_help(self, tag):
    vasp_doc = VaspDoc()
    with patch("sys.stdout", new=io.StringIO()) as fake_stdout:
    vasp_doc.print_help(tag)

    .pybuild/test_python3.13/tests/io/vasp/test_help.py:26:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .pybuild/test_python3.13/pymatgen/io/vasp/help.py:32: in print_help
    print(self.get_help(tag))
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    cls = <class 'pymatgen.io.vasp.help.VaspDoc'>, tag = 'ISYM', fmt = 'text'

    @classmethod
    def get_help(cls, tag: str, fmt: str = "text") -> str:
    """Get help on a VASP tag.

    Args:
    tag (str): VASP tag, e.g. ISYM.

    Returns:
    Help text.
    """
    tag = tag.upper()
    response = requests.get(
    f"https://www.vasp.at/wiki/index.php/{tag}",
    timeout=60,
    )
    soup = BeautifulSoup(response.text, features="html.parser")
    main_doc = soup.find(id="mw-content-text")
    if fmt == "text":
    output = main_doc.text
    E AttributeError: 'NoneType' object has no attribute 'text' ---------------------------------------------------------------------

    However, this also comes from tests/io/vasp/test_help.py, so
    hardcoding website_down to True would also fix this one.

    I'm attaching the trivial patch here, but someone should still
    determine if it's good enough for the package as a whole
    (i.e. considering also the CI tests).

    Thanks. LS0tIGEvdGVzdHMvaW8vdmFzcC90ZXN0X2hlbHAucHkKKysrIGIvdGVzdHMvaW8vdmFzcC90 ZXN0X2hlbHAucHkKQEAgLTExLDEwICsxMSw3IEBAIGZyb20gcHltYXRnZW4uaW8udmFzcC5o ZWxwIGltcG9ydCBWYXNwRG9jCiBCZWF1dGlmdWxTb3VwID0gcHl0ZXN0LmltcG9ydG9yc2tp cCgiYnM0IikuQmVhdXRpZnVsU291cAogCiAKLXRyeToKLSAgICB3ZWJzaXRlX2Rvd24gPSBy ZXF1ZXN0cy5nZXQoImh0dHBzOi8vd3d3LnZhc3AuYXQiLCB0aW1lb3V0PTUpLnN0YXR1c19j b2RlICE9IDIwMAotZXhjZXB0IChyZXF1ZXN0cy5leGNlcHRpb25zLkNvbm5lY3Rpb25FcnJv ciwgcmVxdWVzdHMuZXhjZXB0aW9ucy5SZWFkVGltZW91dCk6Ci0gICAgd2Vic2l0ZV9kb3du ID0gVHJ1ZQord2Vic2l0ZV9kb3duID0gVHJ1ZQogCiAKIEBweXRlc3QubWFyay5za2lwaWYo d2Vic2l0ZV9kb3duLCByZWFzb249Ind3dy52YXNwLmF0IGlzIGRvd24iKQo=

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)