-
Notifications
You must be signed in to change notification settings - Fork 20
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
Unpin pint
to be able to use units supported in more recent version of pint
#100
Comments
pint
pint
to be able to use units supported in more recent version of pint
Here is the log showing the error when parsing data with a schema containing the unit Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/nomad/processing/data.py", line 1203, in parsing
parser.parse(self.mainfile_file.os_path, self._parser_results, logger=logger, **kwargs)
File "/usr/local/lib/python3.9/site-packages/nomad/parsing/parser.py", line 505, in parse
self.parse_file(mainfile, f, archive, logger)
File "/usr/local/lib/python3.9/site-packages/nomad/parsing/parser.py", line 494, in parse_file
archive.definitions = Package.m_from_dict(
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 4120, in m_from_dict
return super(Package, cls).m_from_dict(data, **kwargs)
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2371, in m_from_dict
return MSection.from_dict(data, cls=cls, **kwargs)
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2436, in from_dict
section.m_update_from_dict(dct)
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2322, in m_update_from_dict
sub_section = sub_section_cls.m_from_dict(
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 4007, in m_from_dict
return super(Section, cls).m_from_dict(data, **kwargs)
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2371, in m_from_dict
return MSection.from_dict(data, cls=cls, **kwargs)
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2436, in from_dict
section.m_update_from_dict(dct)
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2322, in m_update_from_dict
sub_section = sub_section_cls.m_from_dict(
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2371, in m_from_dict
return MSection.from_dict(data, cls=cls, **kwargs)
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2436, in from_dict
section.m_update_from_dict(dct)
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2357, in m_update_from_dict
section.__dict__[property_def.name] = self.__deserialize(section, quantity_def, quantity_value)
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2285, in __deserialize
return __type_specific_deserialize(quantity_value)
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2280, in __type_specific_deserialize
return tgt_type.deserialize(section, quantity_def, v)
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 347, in deserialize
value = units.parse_units(value)
File "/usr/local/lib/python3.9/site-packages/pint/registry.py", line 1093, in parse_units
units = self._parse_units(input_string, as_delta, case_sensitive)
File "/usr/local/lib/python3.9/site-packages/pint/registry.py", line 1306, in _parse_units
return super()._parse_units(input_string, as_delta, case_sensitive)
File "/usr/local/lib/python3.9/site-packages/pint/registry.py", line 1121, in _parse_units
cname = self.get_name(name, case_sensitive=case_sensitive)
File "/usr/local/lib/python3.9/site-packages/pint/registry.py", line 643, in get_name
raise UndefinedUnitError(name_or_alias)
pint.errors.UndefinedUnitError: 'year' is not defined in the unit registry |
Thanks for bringing this up. We can definitely try updating to In general, we like to pin many of our dependencies, because we have had so many problems with unpinned libraries breaking our code. But a controlled update of the pinned version is totally fine. |
An update: unfortunately |
It seems that
pint
is pinned to 0.17 and it would be convenient to unpin it be able to useppm
unit, which was introduced in pint 0.21 https://pint.readthedocs.io/en/stable/changes.html#id3.The text was updated successfully, but these errors were encountered: