# Error importing \`\`abilab\`\` - \`\`pymatgen ModuleNotFound Error\`\`

**URL:** <https://discourse.abinit.org/t/error-importing-abilab-pymatgen-modulenotfound-error/3267>\
**Category:** Python interfacing : Abipy ecosystem\
**Tags:** testing\
**Created:** [February 6, 2023, 5:17pm UTC](https://discourse.abinit.org/t/error-importing-abilab-pymatgen-modulenotfound-error/3267 "2023-02-06T17:17:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![agran](https://discourse.abinit.org/letter_avatar_proxy/v4/letter/a/e9bcb4/32.png) [@agran](https://discourse.abinit.org/u/agran)\
**Post date:** [February 6, 2023, 5:17pm UTC](https://discourse.abinit.org/t/error-importing-abilab-pymatgen-modulenotfound-error/3267/1 "2023-02-06T17:17:10Z")

</div>

Dear developers,

I am trying to use `Abipy` library to plot a band structure computed with Abinit. I completed its installation (including `pymatgen`’s) following the instructions [HERE](https://github.com/abinit/abipy). However, when I try to import `abilab` (`from abipy import abilab`) I am getting a `ModuleNotFoundError` error, apparently because the pymatgen `serialization` module is not found.

```auto
----> 1 from abipy import abilab

File ~/.local/lib/python3.8/site-packages/abipy/ __init__.py:18
     12 del sys
     14 #-----------------------------------------------------------------------------
     15 # Setup the top level names
     16 #-----------------------------------------------------------------------------
---> 18 from abipy.core import release
     20 # Release data
     21 __author__ = ''

File ~/.local/lib/python3.8/site-packages/abipy/core/ __init__.py:3
      1 """Core objects."""
      2 # flake8: noqa
----> 3 from .kpoints import *
      4 from .structure import *
      5 from .symmetries import *

File ~/.local/lib/python3.8/site-packages/abipy/core/kpoints.py:16
     14 from monty.string import marquee
     15 from pymatgen.core.lattice import Lattice
---> 16 from pymatgen.util.serialization import pmg_serialize, SlotPickleMixin
     17 from abipy.iotools import ETSF_Reader
     18 from abipy.tools.derivatives import finite_diff

ModuleNotFoundError: No module named 'pymatgen.util.serialization'

```

I have inspected the `pymatgen` [repo](https://github.com/materialsproject/pymatgen) and haven’t found the `~/pymatgen/util/serialization.py` module either.

Any help on how to sort this out so I can try the nice `plot_ebands_spin.ipynb` notebook shown [HERE](https://abinit.github.io/abipy/gallery/plot_ebands_spin.html#sphx-glr-gallery-plot-ebands-spin-py) ?

Thank you very much!

Alain.

---

<div class="post-metadata">

**Author:** ![gingras.ol](https://discourse.abinit.org/user_avatar/discourse.abinit.org/gingras.ol/32/275_2.png) [@gingras.ol](https://discourse.abinit.org/u/gingras.ol)\
**Post date:** [February 6, 2023, 8:29pm UTC](https://discourse.abinit.org/t/error-importing-abilab-pymatgen-modulenotfound-error/3267/2 "2023-02-06T20:29:50Z")

</div>

Dear Alain,

It appears `pymatgen` have removed this module in [a recent commit.](https://github.com/materialsproject/pymatgen/commit/dcf9e83dbd6ee80a99bd54b1a86da88898ba5cd3) For now, what would be best would be to install a version which still has the `serialization` module.

We will have to accommodate abipy for newer versions of `pymatgen` though @gmatteo.

Best,  
Olivier

---

<div class="post-metadata">

**Author:** ![agran](https://discourse.abinit.org/letter_avatar_proxy/v4/letter/a/e9bcb4/32.png) [@agran](https://discourse.abinit.org/u/agran)\
**Post date:** [February 7, 2023, 12:05am UTC](https://discourse.abinit.org/t/error-importing-abilab-pymatgen-modulenotfound-error/3267/3 "2023-02-07T00:05:16Z")

</div>

Thank you Olivier! I went a little bit back and installed `pymatgen-2022.7.25` and it worked.

Best regards,

Alain.
