I am trying to do some astronomical analysis using the Fermi Science Tools (FST), and 3ML, a data analysis environment. I know that I am to activate the FST, and then activate the 3ML virtual environment; when I do this however some problems start coming up; namely, there are some .so files that python cannot recognize. I know it has something to do with my LD_LIBRARY_PATH environment variable, but I can't see what. There are a good amount of people with similar problems, (Why can't Python find shared objects that are in directories in sys.path?) but their solutions have not solved mine. Working in a bash terminal on ubuntu 16.
When I activate both packages, my LD_LIBRARY_PATH variable changes from empty to
'/home/max/anaconda2/3ML_env/FST/Fermi1/lib'
However, when I enter python and begin working with 3ML, I get the following error
>>> from threeML import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/max/anaconda2/3ML_env/lib/python2.7/site-packages/threeML /__init__.py", line 6, in <module>
from .io.serialization import *
File "/home/max/anaconda2/3ML_env/lib/python2.7/site-packages/threeML/io/serialization.py", line 1, in <module>
from threeML.classicMLE.joint_likelihood import JointLikelihood
File "/home/max/anaconda2/3ML_env/lib/python2.7/site-packages/threeML/classicMLE/joint_likelihood.py", line 1, in <module>
import collections
File "/home/max/anaconda2/lib/python2.7/collections.py", line 21, in <module>
from operator import itemgetter as _itemgetter, eq as _eq
ImportError: /home/max/anaconda2/3ML_env/lib/python2.7/lib-dynload/operator.so: undefined symbol: _PyUnicodeUCS4_AsDefaultEncodedString
However, if I change my LD_LIBRARY_PATH to be empty again, I can run the 3ML code no problem, until I get a little further into my work, where I reach the error:
LAT = FermipyLike("LAT", config)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/max/anaconda2/3ML_env/lib/python2.7/site-packages/threeML/plugins/FermipyLike.py", line 209, in __new__
_expensive_imports_hook()
File "/home/max/anaconda2/3ML_env/lib/python2.7/site-packages/threeML/plugins/FermipyLike.py", line 190, in _expensive_imports_hook
from fermipy.gtanalysis import GTAnalysis
File "/home/max/anaconda2/3ML_env/lib/python2.7/site-packages/fermipy/gtanalysis.py", line 20, in <module>
import fermipy.gtutils as gtutils
File "/home/max/anaconda2/3ML_env/lib/python2.7/site-packages/fermipy/gtutils.py", line 6, in <module>
import pyLikelihood as pyLike
File "/home/max/anaconda2/3ML_env/FST/Fermi1/lib/python/pyLikelihood.py", line 7, in <module>
import lib_pyLikelihood
ImportError: libLikelihood.so: cannot open shared object file: No such file or directory
If I change the LD_LIBRARY_PATH to [/home/max/anaconda2/3ML_env/FST/Fermi1/lib/python], I get the same error. Curiously, leaving the LD_LIBRARY_PATH variable open to what the programs wanted it to be in the first place, with both packages active, seems to be causing other problems. 'pip' for example, is no longer functional
pip --version
Traceback (most recent call last):
File "/home/max/anaconda2/3ML_env/bin/pip", line 7, in <module>
from pip import main
File "/home/max/anaconda2/3ML_env/lib/python2.7/site-packages/pip/__init__.py", line 4, in <module>
import locale
File "/home/max/anaconda2/3ML_env/lib/python2.7/locale.py", line 16, in <module>
import operator
ImportError: /home/max/anaconda2/3ML_env/lib/python2.7/lib-dynload/operator.so: undefined symbol: _PyUnicodeUCS4_AsDefaultEncodedString
People all over stack have this issue where python cannot recognize a .so file, and the answers received are mostly related to this LD_LIBRARY_PATH variable. A friend suggested to me that I might be asking the wrong installation of python, to do a particular task.
Also, here is what I get for the python sys.path
['', '/home/max/anaconda2/3ML_env/FST/Fermi1/lib/python',
'/home/max/anaconda2/3ML_env/FST/Fermi1/lib',
'/home/max',
'/home/max/anaconda2/3ML_env/lib/python2.7',
'/home/max/anaconda2/3ML_env/lib/python2.7/plat-x86_64-linux-gnu',
'/home/max/anaconda2/3ML_env/lib/python2.7/lib-tk',
'/home/max/anaconda2/3ML_env/lib/python2.7/lib-old',
'/home/max/anaconda2/3ML_env/lib/python2.7/lib-dynload',
'/home/max/anaconda2/lib/python2.7',
'/home/max/anaconda2/lib/python2.7/lib-tk',
'/home/max/anaconda2/3ML_env/lib/python2.7/site-packages']
All of my errors come from a .so file. I really do not know what is going on. I'll be happy to provide any other variable that you guys ask for. Open to any ideas. Thanks in advance, everybody. I'm very appreciative