Have you already seen this error?
I have a recent ruamel.yaml v.0.18.6 and got this error when trying to load the launchpad:
lpad = LaunchPad.auto_load() or lpad = LaunchPad.from_file()
The full error stack is the following:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[50], line 1
----> 1 LaunchPad.auto_load()
File ~/python-venvs/devel/lib64/python3.11/site-packages/fireworks/core/launchpad.py:313, in LaunchPad.auto_load(cls)
310 @classmethod
311 def auto_load(cls):
312 if LAUNCHPAD_LOC:
--> 313 return LaunchPad.from_file(LAUNCHPAD_LOC)
314 return LaunchPad()
File ~/python-venvs/devel/lib64/python3.11/site-packages/fireworks/utilities/fw_serializers.py:291, in FWSerializable.from_file(cls, filename, f_format)
289 f_format = filename.split(".")[-1]
290 with open(filename, "r", **ENCODING_PARAMS) as f:
--> 291 return cls.from_format(f.read(), f_format=f_format)
File ~/python-venvs/devel/lib64/python3.11/site-packages/fireworks/utilities/fw_serializers.py:256, in FWSerializable.from_format(cls, f_str, f_format)
254 dct = json.loads(f_str)
255 elif f_format == "yaml":
--> 256 dct = yaml.safe_load(f_str)
257 else:
258 raise ValueError(f"Unsupported format {f_format}")
File ~/python-venvs/devel/lib64/python3.11/site-packages/ruamel/yaml/main.py:1105, in safe_load(stream, version)
1099 def safe_load(stream: StreamTextType, version: Optional[VersionType] = None) -> Any:
1100 """
1101 Parse the first YAML document in a stream
1102 and produce the corresponding Python object.
1103 Resolve only basic YAML tags.
1104 """
-> 1105 error_deprecation('safe_load', 'load', arg="typ='safe', pure=True")
File ~/python-venvs/devel/lib64/python3.11/site-packages/ruamel/yaml/main.py:1039, in error_deprecation(fun, method, arg, comment)
1037 raise AttributeError(s)
1038 else:
-> 1039 raise AttributeError(s, name=None)
AttributeError:
"safe_load()" has been removed, use
yaml = YAML(typ='safe', pure=True)
yaml.load(...)
instead of file "/home/fraricci/python-venvs/devel/lib64/python3.11/site-packages/fireworks/utilities/fw_serializers.py", line 256
dct = yaml.safe_load(f_str)
Applying the suggested way of loading a file it works:
from ruamel.yaml import YAML
from pathlib import Path
yaml = YAML(typ='safe', pure=True)
yaml = yaml.load(Path("my_launchpad.yaml").read_text())
lpad = LaunchPad.from_dict(yaml)
If someone can confirm this, I can send a pull request with this fix.
Thanks
Have you already seen this error?
I have a recent ruamel.yaml v.0.18.6 and got this error when trying to load the launchpad:
lpad = LaunchPad.auto_load()orlpad = LaunchPad.from_file()The full error stack is the following:
Applying the suggested way of loading a file it works:
If someone can confirm this, I can send a pull request with this fix.
Thanks