casacore / python-casacore

Python bindings for casacore, a library used in radio astronomy
http://casacore.github.io/python-casacore
GNU Lesser General Public License v3.0
35 stars 22 forks source link

_measures.so: undefined symbol: _ZTIN8casacore5QBaseE #182

Closed p-jacquot closed 5 years ago

p-jacquot commented 5 years ago

I am trying to run a program that require casacore, and python-casacore. I compiled casacore myself to be sure I have the latest version (I even made a sudo apt-get upgrade casacore* to be sure to have all the required stuff), and python-casacore have been installed successfully in a virtualenv with pip.

But when I run my program, I get this error

(venv) ska@chetemi-15:~$ DDF.py -h
 - 09:55:42 - AsyncProcessPool   | Fixing parent process to vthread 0
 - 09:55:42 - AsyncProcessPool   | Worker affinities not specified, leaving unset
Traceback (most recent call last):
  File "/home/ska/venv/bin/DDF.py", line 52, in <module>
    from DDFacet.Imager import ClassDeconvMachine
  File "/home/ska/venv/local/lib/python2.7/site-packages/DDFacet/Imager/ClassDeconvMachine.py", line 21, in <module>
    from ClassFacetMachineTessel import ClassFacetMachineTessel as ClassFacetMachine
  File "/home/ska/venv/local/lib/python2.7/site-packages/DDFacet/Imager/ClassFacetMachineTessel.py", line 22, in <module>
    from DDFacet.Imager import ClassFacetMachine
  File "/home/ska/venv/local/lib/python2.7/site-packages/DDFacet/Imager/ClassFacetMachine.py", line 21, in <module>
    import ClassDDEGridMachine
  File "/home/ska/venv/local/lib/python2.7/site-packages/DDFacet/Imager/ClassDDEGridMachine.py", line 36, in <module>
    from DDFacet.Data import ClassVisServer
  File "/home/ska/venv/local/lib/python2.7/site-packages/DDFacet/Data/ClassVisServer.py", line 25, in <module>
    import ClassMS
  File "/home/ska/venv/local/lib/python2.7/site-packages/DDFacet/Data/ClassMS.py", line 22, in <module>
    import pyrap.measures as pm
  File "/home/ska/venv/local/lib/python2.7/site-packages/pyrap/measures.py", line 1, in <module>
    from casacore.measures import *
  File "/home/ska/venv/local/lib/python2.7/site-packages/casacore/measures/__init__.py", line 29, in <module>
    from ._measures import measures as _measures
ImportError: /home/ska/venv/local/lib/python2.7/site-packages/casacore/measures/_measures.so: undefined symbol: _ZTIN8casacore5QBaseE

But when I look the content of the file _measure.so (in my venv) with the command : nm -C -u _measure.so I can see this line : U typeinfo for casacore::QBase. Does it means the problem comes from my casacore installation ?

gervandiepen commented 5 years ago

I suspect that the casacore libraries used at build time and run time are different. Ensure your LD_LIBRARY_PATH is not such that other libraries are used.

On Tue, Jun 25, 2019 at 10:03 AM Pierre Jacquot notifications@github.com wrote:

I am trying to run a program that require casacore, and python-casacore. I compiled casacore myself to be sure I have the latest version (I even made a sudo apt-get upgrade casacore* to be sure to have all the required stuff), and python-casacore have been installed successfully in a virtualenv with pip.

But when I run my program, I get this error

(venv) ska@chetemi-15:~$ DDF.py -h

  • 09:55:42 - AsyncProcessPool | Fixing parent process to vthread 0
  • 09:55:42 - AsyncProcessPool | Worker affinities not specified, leaving unset Traceback (most recent call last): File "/home/ska/venv/bin/DDF.py", line 52, in from DDFacet.Imager import ClassDeconvMachine File "/home/ska/venv/local/lib/python2.7/site-packages/DDFacet/Imager/ClassDeconvMachine.py", line 21, in from ClassFacetMachineTessel import ClassFacetMachineTessel as ClassFacetMachine File "/home/ska/venv/local/lib/python2.7/site-packages/DDFacet/Imager/ClassFacetMachineTessel.py", line 22, in from DDFacet.Imager import ClassFacetMachine File "/home/ska/venv/local/lib/python2.7/site-packages/DDFacet/Imager/ClassFacetMachine.py", line 21, in import ClassDDEGridMachine File "/home/ska/venv/local/lib/python2.7/site-packages/DDFacet/Imager/ClassDDEGridMachine.py", line 36, in from DDFacet.Data import ClassVisServer File "/home/ska/venv/local/lib/python2.7/site-packages/DDFacet/Data/ClassVisServer.py", line 25, in import ClassMS File "/home/ska/venv/local/lib/python2.7/site-packages/DDFacet/Data/ClassMS.py", line 22, in import pyrap.measures as pm File "/home/ska/venv/local/lib/python2.7/site-packages/pyrap/measures.py", line 1, in from casacore.measures import * File "/home/ska/venv/local/lib/python2.7/site-packages/casacore/measures/init.py", line 29, in from ._measures import measures as _measures ImportError: /home/ska/venv/local/lib/python2.7/site-packages/casacore/measures/_measures.so: undefined symbol: _ZTIN8casacore5QBaseE

But when I look the content of the file _measure.so (in my venv) with the command : nm -C -u _measure.so I can see this line : U typeinfo for casacore::QBase. Does it means the problems comes from my casacore installation ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/casacore/python-casacore/issues/182?email_source=notifications&email_token=AB34QPFRH2CA2A7NFV4KIHTP4HGLJA5CNFSM4H3FRJ42YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G3PGI4Q, or mute the thread https://github.com/notifications/unsubscribe-auth/AB34QPCOB7WBT5OPUKFO73DP4HGLJANCNFSM4H3FRJ4Q .

p-jacquot commented 5 years ago

I have no LD_LIBRARY_PATH environment variable set. :/ Setting it to /usr/local/include/ where is the casacore folder for the headers files doesn't seems to change anything.

ludwigschwardt commented 5 years ago

When you pip install the latest python-casacore as a wheel, it comes with its own set of casacore libraries independent of any compiled or apt-get installed versions. But DDFacet will also build an extension that won't know about these libraries, and will use the compiled / apt-get installed ones. Putting them together in one Python session is probably a recipe for disaster...

Get around this by running pip install python-casacore --no-binary so that casacore and DDFacet see the same libraries.

On to your missing symbol... The casacore::QBase symbols are defined in libcasa_casa.so, which should come prepackaged with the wheel. I'm still trying to figure out why it is not pulled in when the extension gets imported.

p-jacquot commented 5 years ago

OK, so I installed the program (DDFacet) with this command : pip install --no-binary python-casacore DDFacet/ Still no problems during the installation, but only when I run the program.

I understand what you want to do by using the --no-binary parameter @ludwigschwardt, but can we be sure that casacore can be found by python-casacore ? Maybe it (casacore) has been installed to the wrong place, so that python-casacore still has the impression that casacore is not present.

ludwigschwardt commented 5 years ago

If python-casacore cannot find casacore, the extension won't compile and the installation will fail.

I would start with pip uninstall python-casacore to make sure nothing is lurking, and then

pip install --no-binary python-casacore
pip install DDFacet/

just to be sure.

ludwigschwardt commented 5 years ago

Also try

ldd /home/ska/venv/local/lib/python2.7/site-packages/casacore/measures/_measures.so

to see which casacore library is in use. Compare that with ldd run on the .so files of DDFacet.

p-jacquot commented 5 years ago

I tried these commands with one of my colleagues few minutes ago.

We discovered that I made a mistake while installing my program (the one who need python-casacore). I cloned a github repository, and installed it with pip like this : pip install path/to/the/cloned/repo/ Apparently, installing the program this way cause problem, because when I install it without cloning the repo : pip install DDFacet it work without any problem.

I'm sorry for bothering you with problems that are finally none of your concern... Thank you very much.

If you still need more precision about the issue, I can continue to give you details, but I don't think that will be interesting.

ludwigschwardt commented 5 years ago

Glad you got sorted out!