-
Notifications
You must be signed in to change notification settings - Fork 881
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
Support python3.13 #4100
base: master
Are you sure you want to change the base?
Support python3.13 #4100
Conversation
455e0ef
to
a8a765a
Compare
might close this one now as too many packages don't support python 3.13, feel free to take over this |
38a70c4
to
d1694e3
Compare
d1694e3
to
0f02418
Compare
300129b
to
05e98d2
Compare
15e3e8a
to
3e55250
Compare
try: | ||
AFLOW_PROTOTYPE_LIBRARY = loadfn(f"{MODULE_DIR}/aflow_prototypes.json") | ||
except RuntimeError as exc: | ||
raise ImportError("pybtex is needed to load AFLOW library") from exc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this would be breaking, this just re-raise the exception from requires
to provide more context, otherwise the error message when pybtex
is not available would be:
tests/analysis/test_prototypes.py:6: in <module>
from pymatgen.analysis.prototypes import AflowPrototypeMatcher
src/pymatgen/analysis/prototypes.py:28: in <module>
AFLOW_PROTOTYPE_LIBRARY = loadfn(f"{MODULE_DIR}/aflow_prototypes.json")
venv312/lib/python3.12/site-packages/monty/serialization.py:79: in loadfn
return json.load(fp, *args, **kwargs)
../../opt/miniconda3/envs/pmg/lib/python3.12/json/__init__.py:293: in load
return loads(fp.read(),
../../opt/miniconda3/envs/pmg/lib/python3.12/json/__init__.py:359: in loads
return cls(**kw).decode(s)
venv312/lib/python3.12/site-packages/monty/json.py:879: in decode
return self.process_decoded(d)
venv312/lib/python3.12/site-packages/monty/json.py:857: in process_decoded
return [self.process_decoded(x) for x in d]
venv312/lib/python3.12/site-packages/monty/json.py:853: in process_decoded
self.process_decoded(k): self.process_decoded(v) for k, v in d.items()
venv312/lib/python3.12/site-packages/monty/json.py:777: in process_decoded
return cls_.from_dict(data)
src/pymatgen/util/provenance.py:340: in from_dict
return cls(
src/pymatgen/util/provenance.py:229: in __init__
if references and not is_valid_bibtex(references):
venv312/lib/python3.12/site-packages/monty/dev.py:167: in decorated
raise self.err_cls(self.message)
E RuntimeError: pybtex is not available
Before adding the requires
decorator to is_valid_bibtex
:
tests/analysis/test_prototypes.py:6: in <module>
from pymatgen.analysis.prototypes import AflowPrototypeMatcher
src/pymatgen/analysis/prototypes.py:29: in <module>
AFLOW_PROTOTYPE_LIBRARY = loadfn(f"{MODULE_DIR}/aflow_prototypes.json")
venv312/lib/python3.12/site-packages/monty/serialization.py:79: in loadfn
return json.load(fp, *args, **kwargs)
../../opt/miniconda3/envs/pmg/lib/python3.12/json/__init__.py:293: in load
return loads(fp.read(),
../../opt/miniconda3/envs/pmg/lib/python3.12/json/__init__.py:359: in loads
return cls(**kw).decode(s)
venv312/lib/python3.12/site-packages/monty/json.py:879: in decode
return self.process_decoded(d)
venv312/lib/python3.12/site-packages/monty/json.py:857: in process_decoded
return [self.process_decoded(x) for x in d]
venv312/lib/python3.12/site-packages/monty/json.py:853: in process_decoded
self.process_decoded(k): self.process_decoded(v) for k, v in d.items()
venv312/lib/python3.12/site-packages/monty/json.py:777: in process_decoded
return cls_.from_dict(data)
src/pymatgen/util/provenance.py:340: in from_dict
return cls(
src/pymatgen/util/provenance.py:229: in __init__
if references and not is_valid_bibtex(references):
src/pymatgen/util/provenance.py:53: in is_valid_bibtex
parser = bibtex.Parser()
E AttributeError: 'NoneType' object has no attribute 'Parser'
Update: I just realized pybtex
is not an optional dependency, need to put more thoughts into this:
Lines 56 to 64 in 5b997f7
dependencies = [ | |
"joblib>=1", | |
"matplotlib>=3.8", | |
"monty>=2025.1.9", | |
"networkx>=2.7", # PR4116 | |
"palettable>=3.3.3", | |
"pandas>=2", | |
"plotly>=4.5.0,<6.0.0", | |
"pybtex>=0.24.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird, pybtex
is installed successfully in MacOS CI but some or all parts of pybtex
is still not available, need to look into the reason later as I don't have a MacOS machine at hand right now
Update:
On MacOS, from pybtex.database.input import bibtex
gives:
Traceback (most recent call last):
File "/Users/yang/developer/pymatgen/debug/test_pybtex_install.py", line 8, in <module>
from pybtex.database.input import bibtex
File "/Users/yang/developer/pymatgen/venv313/lib/python3.13/site-packages/pybtex/database/__init__.py", line 44, in <module>
from pybtex.plugin import find_plugin
File "/Users/yang/developer/pymatgen/venv313/lib/python3.13/site-packages/pybtex/plugin/__init__.py", line 26, in <module>
import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
Which is an already fixed issue from pybtex's side but they haven't got a release with this patch yet. In fact they haven't released any issue since Jan 2021
…ymatgen into support-python313
a9cf179
to
0b25745
Compare
Also cannot recreate the |
0b25745
to
9f2dda1
Compare
be8a31d
to
2692696
Compare
433e54f
to
af559fa
Compare
This reverts commit af559fa.
I'm pretty much stuck with the Windows runner failure, help needed
|
Summary
pybtex
optional dependency (doesn't work on MacOS Python 3.13)Optional dependencies that miss Python 3.13 support:
openff-toolkit
(conda source)chgnet