JohannesBuchner / PyMultiNest

Pythonic Bayesian inference and visualization for the MultiNest Nested Sampling Algorithm and PyCuba's cubature algorithms.
http://johannesbuchner.github.io/PyMultiNest/
Other
191 stars 87 forks source link

Specifying "Linux" platform in run.py #206

Closed hzarei4 closed 2 years ago

hzarei4 commented 2 years ago

Hello,

I tried to install the package on linux platform (for days :D) but the error of cannot open shared object file: No such file or directory libmultinest.so did not solve. I tried to change the LD_LIBRARY_PATH environment variable both from python IDLE and terminal but it did not help.

So I changed parts of the source code and solved this issue. In the file /usr/local/lib/python3.7/dist-packages/pymultinest/run.py or in the package: pymultinest/run.py line 14 to

if sys.platform == 'linux':

and the problem solved and imported in python 3.7.

I am using python 3.7 on Google Colaboratory (Linux platform).

Could I add a new commit on this issue?

Thanks!

JohannesBuchner commented 2 years ago

When you ran from terminal, did you export the variable? That is:

LD_LIBRARY_PATH=/path/to/multinest/lib python3 myscript.py

or

export LD_LIBRARY_PATH=/path/to/multinest/lib
python3 myscript.py

and verified that ls $LD_LIBRARY_PATH/libmultinest.so does not complain.

hzarei4 commented 2 years ago

Oh, yes, that's true. My mistake.

When I run export LD_LIBRARY_PATH=/path/to/multinest/lib from Terminal, it works. But the same code, in Colaboratory did not run and the libmultinest.so did not found.

JohannesBuchner commented 2 years ago

did you set the environment variable with os.environ?

hzarei4 commented 2 years ago

Yes, and then it did not import the package.

JohannesBuchner commented 2 years ago

I am not sure what the implications of switching to find_library by default are. Can you research this?

Can you test your proposed change on python 2.7, 3.4 and the latest python on linux?

hzarei4 commented 2 years ago

Alright, I will try that and let you know about the results (in a few days).

JohannesBuchner commented 2 years ago

I am closing this. If the issue still persists, feel free to reopen.