pythonpint

ModuleNotFoundError: No module named 'importlib_metadata' while installing pint in python


I have tried installing pint using pip. But whenever I am trying, I am getting ModuleNotFoundError: No module named 'importlib_metadata'.

Traceback:

ModuleNotFoundError                       Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\pint\__init__.py in <module>
     32 try:
---> 33     from importlib.metadata import version
     34 except ImportError:

ModuleNotFoundError: No module named 'importlib.metadata'

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_31716/1730524550.py in <module>
      9 
     10 # import units
---> 11 from pint import UnitRegistry
     12 units = UnitRegistry()

C:\ProgramData\Anaconda3\lib\site-packages\pint\__init__.py in <module>
     34 except ImportError:
     35     # Backport for Python < 3.8
---> 36     from importlib_metadata import version
     37 
     38 try:  # pragma: no cover

ModuleNotFoundError: No module named 'importlib_metadata'

What should I do?


Solution

  • You can try running in Google Colab.

    To install in your notebook in Google Colab, please use !pip install pint.

    It will work. Atleast as your backup for your urgency hopefully.