Skip to content
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

ModuleNotFoundError: No module named 'invcryrep' #106

Open
adosar opened this issue Sep 19, 2024 · 3 comments
Open

ModuleNotFoundError: No module named 'invcryrep' #106

adosar opened this issue Sep 19, 2024 · 3 comments

Comments

@adosar
Copy link

adosar commented Sep 19, 2024

Hello,

After installing mattext I am facing the following issue:

>>> from mattext.representations import TextRep
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/asarikas/venvir/numpy/lib/python3.11/site-packages/mattext/representations/__init__.py", line 1, in <module>
    from xtal2txt.core import TextRep
  File "/home/asarikas/venvir/numpy/lib/python3.11/site-packages/xtal2txt/core.py", line 7, in <module>
    from invcryrep.invcryrep import InvCryRep
ModuleNotFoundError: No module named 'invcryrep'

I suspect that this may be related to how the xtal2txt package loads slices as mentioned here.

@n0w0f
Copy link
Collaborator

n0w0f commented Sep 22, 2024

Hi @adosar ,
Thank you for your interest in using MatText. I was able to reproduce the error you reported and it trace back to the recent api changes in SLICES package.

The easiest option for usage now would be to pin slices to a previous version, while I update our package.
pip install slices==1.4.12
I was able to import TextRep after reinstalling slices after installing mattext.

@adosar
Copy link
Author

adosar commented Dec 9, 2024

Hi @n0w0f,

After pinning the slices version to 1.4.12, running the introductory example returns None:

from mattext.representations import TextRep
from pymatgen.core import Structure

# Load structure from a CIF file
from_file = "NaCl.cif"
structure = Structure.from_file(from_file, "cif")

# Initialize TextRep Class
text_rep = TextRep.from_input(structure)

requested_reps = [
    "cif_p1",
    "slices",
    "atom_sequences",
    "atom_sequences_plusplus",
    "crystal_text_llm",
    "zmatrix"
]

# Get the requested text representations
requested_text_reps = text_rep.get_requested_text_reps(requested_reps)   # This returns None.
This is the structure file
# generated using pymatgen
data_NaCl
_symmetry_space_group_name_H-M   'P 1'
_cell_length_a   5.69169400
_cell_length_b   5.69169400
_cell_length_c   5.69169400
_cell_angle_alpha   90.00000000
_cell_angle_beta   90.00000000
_cell_angle_gamma   90.00000000
_symmetry_Int_Tables_number   1
_chemical_formula_structural   NaCl
_chemical_formula_sum   'Na4 Cl4'
_cell_volume   184.38459333
_cell_formula_units_Z   4
loop_
_symmetry_equiv_pos_site_id
_symmetry_equiv_pos_as_xyz
1  'x, y, z'
loop_
_atom_site_type_symbol
_atom_site_label
_atom_site_symmetry_multiplicity
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
Na  Na0  1  0.00000000  0.00000000  0.00000000  1.0
Na  Na1  1  0.00000000  0.50000000  0.50000000  1.0
Na  Na2  1  0.50000000  0.00000000  0.50000000  1.0
Na  Na3  1  0.50000000  0.50000000  0.00000000  1.0
Cl  Cl4  1  0.50000000  0.00000000  0.00000000  1.0
Cl  Cl5  1  0.50000000  0.50000000  0.50000000  1.0
Cl  Cl6  1  0.00000000  0.00000000  0.50000000  1.0
Cl  Cl7  1  0.00000000  0.50000000  0.00000000  1.0
This is the log
2024-12-09 19:17:29.833829: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-12-09 19:17:29.833882: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-12-09 19:17:29.834747: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
WARNING:tensorflow:From /home/asarikas/venvir/mattext/lib/python3.11/site-packages/tensorflow/python/util/deprecation.py:588: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
Reading file /home/asarikas/venvir/mattext/lib/python3.11/site-packages/robocrys/condense/mineDecoding objects from /home/asarikas/venvir/mattext/lib/python3.11/site-packages/robocrys/condReading file /home/asarikas/venvir/mattext/lib/python3.11/site-packages/robocrys/condense/mineral_db.json.gz: 0it [00:00, ?it/s]
Decoding objects from /home/asarikas/venvir/mattext/lib/python3.11/site-packages/robocrys/cond                                           

@n0w0f
Copy link
Collaborator

n0w0f commented Dec 10, 2024

@adosar Thanks for reporting this !

I indeed see that get_requested_text_reps() is returning none. I would try to debug and fix this soon.

meanwhile maybe you can use text_rep.get_all_text_reps(). Which for me returned the following dict.

{'cif_p1': "data_NaCl\n_symmetry_space_group_name_H-M   'P 1'\n_cell_length_a   4.02\n_cell_length_b   4.02\n_cell_length_c   4.02\n_cell_angle_alpha   60.0\n_cell_angle_beta   60.0\n_cell_angle_gamma   60.0\n_symmetry_Int_Tables_number   1\n_chemical_formula_structural   NaCl\n_chemical_formula_sum   'Na1 Cl1'\n_cell_volume   46.1\n_cell_formula_units_Z   1\nloop_\n _symmetry_equiv_pos_site_id\n _symmetry_equiv_pos_as_xyz\n  1  'x, y, z'\nloop_\n _atom_site_type_symbol\n _atom_site_label\n _atom_site_symmetry_multiplicity\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n _atom_site_occupancy\n  Cl  Cl4  1  0.5  0.5  0.5  1.0\n  Na  Na0  1  0.0  0.0  0.0  1.0\n",
 'cif_symmetrized': None,
 'cif_bonding': None,
 'slices': 'Cl Na 0 1 + + o 0 1 + o + 0 1 o + + 0 1 + o o 0 1 o + o 0 1 o o + ',
 'composition': 'ClNa',
 'crystal_text_llm': '4.0 4.0 4.0\n59 59 59\nCl\n0.50 0.50 0.50\nNa\n0.00 0.00 0.00',
 'robocrys_rep': 'NaCl is Halite, Rock Salt structured and crystallizes in the cubic Fm-3m space group. Na(1) is bonded to six equivalent Cl(1) atoms to form a mixture of corner and edge-sharing NaCl6 octahedra. The corner-sharing octahedra are not tilted. All Na(1)-Cl(1) bond lengths are 2.85 Å. Cl(1) is bonded to six equivalent Na(1) atoms to form a mixture of corner and edge-sharing ClNa6 octahedra. The corner-sharing octahedra are not tilted.',
 'wycoff_rep': None,
 'atom_sequences': 'Cl Na',
 'atom_sequences_plusplus': 'Cl Na 4.02 4.02 4.02 60 60 60',
 'zmatrix': 'Cl\nNa 1 4.9',
 'local_env': None}

Some of the representation is failing which could be the cause for get_requested_text_reps failing. But i guess you can get the representations that you wanted with this method, until i fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants