aiidateam / aiida-quantumespresso

The official AiiDA plugin for Quantum ESPRESSO
https://aiida-quantumespresso.readthedocs.io
Other
52 stars 77 forks source link

xmlschema==1.11.3 not working with python 3.12 #989

Closed rikigigi closed 7 months ago

rikigigi commented 7 months ago

I think xmlschema 1.11.3 stopped working with python 3.12 Is it a big work to upgrade to xmlschema 2.x and see what happens? See also https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1941174.html

11/29/2023 11:43:14 PM <1> aiida.orm.nodes.process.calculation.calcjob.CalcJobNode: [REPORT] [152|PwCalculation|on_except]: Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/plumpy/process_states.py", line 228, in execute
    result = self.run_fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/calcjob.py", line 678, in parse
    exit_code_retrieved = self.parse_retrieved_output(retrieved_temporary_folder)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiida/engine/processes/calcjobs/calcjob.py", line 789, in parse_retrieved_output
    exit_code = parser.parse(**parse_kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiida_quantumespresso/parsers/pw.py", line 55, in parse
    parsed_xml, logs_xml = self.parse_xml(dir_with_bands, parser_options)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiida_quantumespresso/parsers/pw.py", line 313, in parse_xml
    from .parse_xml.pw.parse import parse_xml
  File "/usr/local/lib/python3.12/site-packages/aiida_quantumespresso/parsers/parse_xml/pw/parse.py", line 2, in <module>
    from xmlschema.etree import ElementTree
  File "/usr/local/lib/python3.12/site-packages/xmlschema/__init__.py", line 20, in <module>
    from .dataobjects import DataElement, DataElementConverter, DataBindingConverter
  File "/usr/local/lib/python3.12/site-packages/xmlschema/dataobjects.py", line 22, in <module>
    from . import validators
  File "/usr/local/lib/python3.12/site-packages/xmlschema/validators/__init__.py", line 38, in <module>
    from .schemas import XMLSchemaMeta, XMLSchemaBase, XMLSchema, XMLSchema10, XMLSchema11
  File "/usr/local/lib/python3.12/site-packages/xmlschema/validators/schemas.py", line 2154, in <module>
    class XMLSchema10(XMLSchemaBase):
  File "/usr/local/lib/python3.12/site-packages/xmlschema/validators/schemas.py", line 150, in __new__
    meta_schema = meta_schema_class.create_meta_schema(meta_schema_file)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/xmlschema/validators/schemas.py", line 772, in create_meta_schema
    meta_schema = meta_schema_class(source, XSD_NAMESPACE, global_maps=global_maps,
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/xmlschema/validators/schemas.py", line 361, in __init__
    self.source = XMLResource(source, base_url, allow, defuse, timeout)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/xmlschema/resources.py", line 513, in __init__
    self.parse(source, lazy)
  File "/usr/local/lib/python3.12/site-packages/xmlschema/resources.py", line 748, in parse
    url = normalize_url(source, self._base_url)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/xmlschema/resources.py", line 188, in normalize_url
    path = _PurePath.from_uri(url)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/xmlschema/resources.py", line 109, in from_uri
    return cls(uri)
           ^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/xmlschema/resources.py", line 98, in __new__
    return cast('_PurePath', cls._from_parts(args))
                             ^^^^^^^^^^^^^^^
AttributeError: type object '_PurePosixPath' has no attribute '_from_parts'. Did you mean: '_load_parts'?
sphuber commented 7 months ago

Is it a big work to upgrade to xmlschema 2.x and see what happens?

Not sure. Depends on how much of the interface they broke 😅 Don't think we use a whole lot other than simple API to verify a schema. Think it makes sense to update anyway.

rikigigi commented 7 months ago

Ok I will investigate

rikigigi commented 7 months ago

solved in https://github.com/aiidateam/aiida-quantumespresso/pull/990