SMTG-Bham / ShakeNBreak

Defect structure-searching employing chemically-guided bond distortions
https://shakenbreak.readthedocs.io
MIT License
79 stars 17 forks source link

Importing library error #46

Closed AndresOrtegaGuerrero closed 1 year ago

AndresOrtegaGuerrero commented 1 year ago

Hello ,

I have been trying to use the code yet when i am trying to import the library i get the same error

`~/opt/anaconda3/lib/python3.9/site-packages/shakenbreak/distortions.py in 7 import numpy as np 8 from ase.neighborlist import NeighborList ----> 9 from hiphive.structure_generation.rattle import ( 10 _probability_mc_rattle, 11 generate_mc_rattled_structures,

~/opt/anaconda3/lib/python3.9/site-packages/hiphive/init.py in 4 5 from .cluster_space import ClusterSpace ... ----> 3 from numba.np.ufunc import _internal 4 from numba.np.ufunc.parallel import ParallelUFuncBuilder, ParallelGUFuncBuilder 5

SystemError: initialization of _internal failed without raising an exception`

I tried changing the numpy and numba version but it doesnt seem to solve the issue, I was wondering if you could give me some suggestions

ireaml commented 1 year ago

Hi Andres,

What are your versions of numpy and numba?

Also, might be worth trying to use a python virtual environment for ShakeNBreak to avoid version issues. In conda you can create one using:

conda create -n snb
conda activate snb

And then install ShakeNBreak inside it:

conda install -c conda-forge shakenbreak
AndresOrtegaGuerrero commented 1 year ago

Hello @ireaml

I tried with numpy 1.23.5 and 1.24.1 and 1.24.2 and numba 0.54.1 0.55 0.56.2 Since I already have an environment with other packages I wanted to include ShakeNBreak python package while keeping at least numpy 1.24.1 otherwise there seems to be an incompatibility issue only in ShakeNBreak

ireaml commented 1 year ago

So numba requires numpy<1.24,>=1.18, which it's the incompatibility causing the error. Can you try with numpy<=1.23.5 and numba==0.56.4? For me, with these versions (1.23.5 and 0.56.4 it works ok)

AndresOrtegaGuerrero commented 1 year ago

Hello, I tried the same combination, no success either

ireaml commented 1 year ago

Did you use pip or conda for installation?

Can you execute the following lines in a jupyter cell? (with your environment activated)

from importlib_metadata import version

print(f"Version of numpy:", version("numpy"))
print(f"Version of numba:", version("numba"))
print(f"Version of hiphive:", version("hiphive"))
print(f"Version of shakenbreak:", version("shakenbreak"))
AndresOrtegaGuerrero commented 1 year ago

I manage to make it wok but i use numpy 1.23.1

Version of numpy: 1.23.1 Version of numba: 0.56.4 Version of hiphive: 1.1 Version of shakenbreak: 23.2.8

ireaml commented 1 year ago

Cool! Closing this now then