ellawang44 / Breidablik

Interpolate lithium spectra and predict lithium abundance for late-type stars
MIT License
4 stars 0 forks source link

Error when calling `breidablik.interpolate.nlte` #3

Closed mlldantas closed 1 year ago

mlldantas commented 1 year ago

Hi Ella,

I am trying to use your package to estimate 3D-NLTE corrections for Li abundances that I already have. Your package seems to be correctly installed on my computer (meaning that import breidablik works fine, with no errors or warnings). However, if I do:

from breidablik.interpolate.nlte import Nlte

The following error appears:

OSError                                   Traceback (most recent call last)
/tmp/ipykernel_9895/1803203003.py in <module>
----> 1 from breidablik.interpolate.nlte import Nlte

~/.local/lib/python3.8/site-packages/breidablik-1.0.0-py3.8.egg/breidablik/interpolate/nlte.py in <module>
----> 1 from breidablik.interpolate.load import FFNN
      2 from breidablik.interpolate.grid_check import _grid_check
      3 from breidablik.interpolate.scalar import Scalar
      4 import numpy as np
      5 from pathlib import Path

~/.local/lib/python3.8/site-packages/breidablik-1.0.0-py3.8.egg/breidablik/interpolate/load.py in <module>
----> 1 import torch
      2 import torch.nn as nn
      3 import numpy as np
      4 import os
      5 import warnings

~/.local/lib/python3.8/site-packages/torch-1.13.0-py3.8-linux-x86_64.egg/torch/__init__.py in <module>
    189     # See Note [Global dependencies]
    190     if USE_GLOBAL_DEPS:
--> 191         _load_global_deps()
    192     from torch._C import *  # noqa: F403
    193 

~/.local/lib/python3.8/site-packages/torch-1.13.0-py3.8-linux-x86_64.egg/torch/__init__.py in _load_global_deps()
    151     lib_path = os.path.join(os.path.dirname(here), 'lib', lib_name)
    152 
--> 153     ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
    154 
    155 

/work/mlldantas/anaconda3/lib/python3.8/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    371 
    372         if handle is None:
--> 373             self._handle = _dlopen(self._name, mode)
    374         else:
    375             self._handle = handle

OSError: libcublas.so.11: cannot open shared object file: No such file or directory

I wonder if you have any idea on how to circumvent this issue.

Thanks!

ellawang44 commented 1 year ago

Hi Maria,

This looks like a torch installation issue. There's a couple of things to try:

  1. Roll back to a previous version of Breidablik (I recommend version 0.6.5). Breidablik used to use sci-kit learn instead of torch, this was a recent backend update. There were only major updates to the Spectra class, it sounds like you're not using it anyway so it shouldn't make a difference to your results. If you are rolling back, the Balder data might not be able to be read in, but it isn't used in Nlte, so it shouldn't make a difference.
  2. Try fixing the torch issue. I'm not quite sure why this is happening, but this does appear to be a known issue. You might be able to find some fixes here. For reference I'm currently running torch version 1.12.1 and I'm not getting this import issue.

Let me know if you have further issues.