You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✔ ~/munka/devel/astropy [hacking|✚ 1⚑ 14] $ python -c "from astropy import convolution"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/bsipocz/munka/devel/astropy/astropy/convolution/__init__.py", line 10, in <module>
from .convolve import convolve, convolve_fft, interpolate_replace_nans, convolve_models
File "/Users/bsipocz/munka/devel/astropy/astropy/convolution/convolve.py", line 28, in <module>
lib_path = glob.glob(os.path.join(os.path.dirname(__file__), 'lib_convolve*'))[0]
IndexError: list index out of range
Well, @pllim pointed out I can't be in the source library to import convolution, at least a bit less cryptic error message would be nice to avoid causing a heart attack.
Building in the source dir also doesn't solve all the issues, now I see another one:
In [2]: >>> from astropy.convolution import convolve
...: >>> convolve([1, 4, 5, 6, 5, 7, 8], [0.2, 0.6, 0.2])
...:
...:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-843c8031be97> in <module>()
----> 1 from astropy.convolution import convolve
2 convolve([1, 4, 5, 6, 5, 7, 8], [0.2, 0.6, 0.2])
~/munka/devel/astropy/astropy/convolution/__init__.py in <module>()
8 try:
9 # Not guaranteed available at setup time
---> 10 from .convolve import convolve, convolve_fft, interpolate_replace_nans, convolve_models
11 except ImportError:
12 if not _ASTROPY_SETUP_:
~/munka/devel/astropy/astropy/convolution/convolve.py in <module>()
23 # Turn the faulthandler ON to help catch any signals, e.g. segfaults
24 # or asserts. This doesn't, currently, work with Jupyter Notebook.
---> 25 faulthandler.enable()
26
27 # Find and load C convolution library
AttributeError: '_StdoutProxy' object has no attribute 'fileno'
This is due to the refactoring of the convolution code. I think we should just remove the call to faulthandler, it's not actually needed for the convolution code. And I agree that we should basically make sure the error message when importing for the source tree is the same as for other extensions. I'll open a PR.
Regarding the "more", are there other issues that I should be aware of? I just looked but couldn't find any open (or very recently closed).
more, in addition to the last commit done in that PR. My first (wrong) thought was that this is due to some remnants of openMP, but apparently ctypes messes with my pure python life just as much.
@nden just walked me through their findings and I'm just in the process of trying to reproduce on my box... done.
In gist, I never tested the build via ./setup install, I only ever used ./setup build and then imported explicitly from the build dir. I only tested the install with conda-build.
So the issue is that the install generates the extralib_convolve.py. The grep for lib_convolve* picks that up instead of the .so or .dll. The grep could be made more explicit, it could loop through the returned list and exclude the *py or be explicit conditional on OS, e.g. lib_convolve*.so.
conda-build doesn't generate the superfluous file, lib_conovlve.py. Which is interesting since the build script only executes $PYTHON setup.py install --offline --old-and-unmanageable.
Activity
bsipocz commentedon Oct 30, 2018
Some more cleanup of #7293 is needed.
bsipocz commentedon Oct 30, 2018
Well, @pllim pointed out I can't be in the source library to import convolution, at least a bit less cryptic error message would be nice to avoid causing a heart attack.
Building in the source dir also doesn't solve all the issues, now I see another one:
I had none of these on the LTS branch....
astrofrog commentedon Oct 30, 2018
This is due to the refactoring of the convolution code. I think we should just remove the call to faulthandler, it's not actually needed for the convolution code. And I agree that we should basically make sure the error message when importing for the source tree is the same as for other extensions. I'll open a PR.
jamienoss commentedon Oct 30, 2018
@bsipocz
Regarding the "more", are there other issues that I should be aware of? I just looked but couldn't find any open (or very recently closed).
jdavies-st commentedon Oct 30, 2018
I also cannot import convolve running MacOS 10.13.6. This is from last night on master, git hash 064dac1
nden commentedon Oct 30, 2018
Just to be clear #8035 does not fix the error @jdavies-st reported.
astrofrog commentedon Oct 30, 2018
@jamienoss - any ideas about @jdavies-st's issue?
jamienoss commentedon Oct 30, 2018
I'll walk over and find out...
bsipocz commentedon Oct 30, 2018
more, in addition to the last commit done in that PR. My first (wrong) thought was that this is due to some remnants of openMP, but apparently ctypes messes with my pure python life just as much.
jamienoss commentedon Oct 30, 2018
@bsipocz ok cool, just wanted to double check I wasn't missing something.
jamienoss commentedon Oct 30, 2018
@nden just walked me through their findings and I'm just in the process of trying to reproduce on my box... done.
In gist, I never tested the build via
./setup install, I only ever used./setup buildand then imported explicitly from the build dir. I only tested the install with conda-build.So the issue is that the install generates the extra
lib_convolve.py. The grep forlib_convolve*picks that up instead of the.soor.dll. The grep could be made more explicit, it could loop through the returned list and exclude the*pyor be explicit conditional on OS, e.g.lib_convolve*.so.The content of
lib_convolve.pyis:The other approach is to determine why it is even there. I will also sanity check the conda-build method again.
jamienoss commentedon Oct 30, 2018
To be clear
./setup builddoesn't producelib_convolve.pythis is generated as part of the install stage. Perhaps it's an egg thing?jamienoss commentedon Oct 30, 2018
conda build and install works great for me, if you ignore the numpy 1.11 -> 1.15 issue and the failing erfa test:
conda-build doesn't generate the superfluous file,
lib_conovlve.py. Which is interesting since the build script only executes$PYTHON setup.py install --offline --old-and-unmanageable.jamienoss commentedon Oct 30, 2018
Looks like the trick is
--old-and-unmanageablethus preventing the egg build. Guess it is an egg thing?jamienoss commentedon Oct 30, 2018
Should we split this issue out into two?
jamienoss commentedon Oct 30, 2018
lib_convolve.pyis also produced on windows via./setup install.