mctools / ncrystal

NCrystal : a library for thermal neutron transport in crystals and other materials
https://mctools.github.io/ncrystal/
Other
41 stars 18 forks source link

Make conda pkgs work even if CONDA_PREFIX is not set. #195

Open tkittel opened 2 months ago

tkittel commented 2 months ago

In some google colab + condacolab notebooks we actually ended up with CONDA_PREFIX not being set. So it would be great if the ncrystal conda packages could be made to work without the CONDA_prefix being set (the code DOES now after all that it is from the conda package).

tkittel commented 2 months ago

In a quick test on ubuntu + python 3.12, the python site packages dir is actually below CONDA_PREFIX/lib, so simply walking up from the directory of the ncrystal python modules, would eventually yield the libNCrystal.so file.

And in the CONDA_PREFIX dir itself, we have a conda-meta directory, so presumably we could also find CONDA_PREFIX by simply walking up until we see conda-meta, and then back down to the subdir named lib.

tkittel commented 2 months ago

We should of course also verify that it will work on windows, once we get that far.