lpsinger / ligo.skymap

Localization of gravitational-wave transients. Mirror of https://git.ligo.org/lscsoft/ligo.skymap
23 stars 18 forks source link

problems in importing io.fits #7

Closed ferrigno closed 3 years ago

ferrigno commented 3 years ago

I installed this github version and got the following problem. Note that the version from pip, for the same instruction created a segmentation fault with output

double free or corruption (top)
Aborted (core dumped)
Python 3.7.5 (default, Nov  7 2019, 10:50:52) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from ligo.skymap.io import fits
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-2ea362b450de> in <module>
----> 1 from ligo.skymap.io import fits

~/Soft/ligo.skymap/ligo/skymap/io/__init__.py in <module>
      9         exec('from . import {0};'
     10              '__all__ += getattr({0}, "__all__", ());'
---> 11              'from .{0} import *'.format(module))
     12     del module
     13 

~/Soft/ligo.skymap/ligo/skymap/io/__init__.py in <module>

~/Soft/ligo.skymap/ligo/skymap/io/fits.py in <module>
     68 import astropy_healpix as ah
     69 from astropy.table import Table
---> 70 from .. import moc
     71 
     72 log = logging.getLogger()

~/Soft/ligo.skymap/ligo/skymap/moc.py in <module>
     32 from numpy.lib.recfunctions import repack_fields
     33 
---> 34 from .core import nest2uniq, uniq2nest, uniq2order, uniq2pixarea, uniq2ang
     35 from .core import rasterize as _rasterize
     36 from .util.numpy import add_newdoc_ufunc, require_contiguous_aligned

ModuleNotFoundError: No module named 'ligo.skymap.core'

Can you help me?

lpsinger commented 3 years ago

Hi @ferrigno! For the installation from git, did you simply clone the repository, or did you also install it (pip install . or python setup.py install)? The ligo.skymap.core module is a Python C extension that only gets generated when you install. Did you follow the instructions in the manual for installing from source?

As for the segmentation fault on import, that's new to me, so I need a bit more information about your system to diagnose the issue. Would you please provide the following information:

ferrigno commented 3 years ago

Hi I did not see the page you link before trying the installation and I used a simple python setup.py install Now I see that I would need to install the intel base-kit and I have not 14Gb on my laptop to do it.

For the binary, these are the infos. Note that on Ubuntu 20.04, the package works smoothly. uname -a Linux 4.15.0-128-generic #131-Ubuntu SMP Wed Dec 9 06:57:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux It is Ubuntu 18.04 I am using a virtualenv in which packages are installed with pip. I can send you my list of packages, if needed. pip --version pip 20.3.3 from /home/ferrigno/Soft/myVE-py37/lib/python3.7/site-packages/pip (python 3.7) python -c 'import numpy; print(numpy.version)' 1.19.4

lpsinger commented 3 years ago

Now I see that I would need to install the intel base-kit and I have not 14Gb on my laptop to do it.

No, you don't need the Intel oneAPI base kit. It will build just fine with the gcc compiler that comes with your Ubuntu distribution. The GW localization code runs a bit faster if it is built with Intel's compiler, but unless you are actually generating GW localizations, that won't matter.

ferrigno commented 3 years ago

Same error following your compilation instructions (without INTEL) on ubuntu 18.04

I used ligo.skymap for what I needed, with Ubuntu 20.04, see

https://github.com/ferrigno/Theseus-FoV-Projection

I adapted your make_rect_poly from https://github.com/lpsinger/ligo.skymap/blob/master/ligo/skymap/plot/poly.py because for some large angles, it output NaN.

lpsinger commented 3 years ago

Same error following your compilation instructions (without INTEL) on ubuntu 18.04

Which error is that? The "double free or corruption" error, or the ModuleNotFound exception? Would you please attach the text of your full terminal session, including retrieving the source, installing, and importing?

I adapted your make_rect_poly from https://github.com/lpsinger/ligo.skymap/blob/master/ligo/skymap/plot/poly.py because for some large angles, it output NaN.

If you have an example to reproduce the NaN, please share as an issue report. If you have a patch to fix it, even better!

ferrigno commented 3 years ago

Compiling from source, the error is ModuleNotFoundError: No module named 'ligo.skymap.core'


The error in making the rectangular plot can be reproduced as: ligo.skymap.plot.make_rect_poly(117./2, 68.0/2, 0, 0, subdivisions=1) array([[nan, nan], [nan, nan], [nan, nan], [nan, nan]])

but I have not found a patch, I realize that I have used a smaller angle at the end. There must be something tricky with spherical angles, but I have not managed to find it.

lpsinger commented 3 years ago

Compiling from source, the error is ModuleNotFoundError: No module named 'ligo.skymap.core'

I'm not able to reproduce this over here, so I need a bit more detail. Please try to do a fresh installation, and send:

  1. The output of env.
  2. The full text of your shell session, including the commands that you used to retrieve the source code, the build and install commands, and the command to start your Python interpreter and attempt to import the module.

The error in making the rectangular plot can be reproduced as: ligo.skymap.plot.make_rect_poly(117./2, 68.0/2, 0, 0, subdivisions=1) array([[nan, nan], [nan, nan], [nan, nan], [nan, nan]])

but I have not found a patch, I realize that I have used a smaller angle at the end. There must be something tricky with spherical angles, but I have not managed to find it.

I see the problem now, and it should be easy to fix. I described it in GitLab, here: https://git.ligo.org/lscsoft/ligo.skymap/-/issues/23