Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot import TiggerSkyModel because of astropy 2.0.4? #86

Closed
lord-blueberry opened this issue Nov 15, 2018 · 12 comments
Closed

cannot import TiggerSkyModel because of astropy 2.0.4? #86

lord-blueberry opened this issue Nov 15, 2018 · 12 comments
Assignees

Comments

@lord-blueberry
Copy link

I can reproduce this behaviour in a clean 18.04 install. After adding the KERN repo, I use:

sudo apt-get install python
sudo apt-get install meqtrees
sudo apt-get install python-astropy

It installs astropy version 2.0.4-4 and meqtrees

When using the meqtree browser, turbo-sim.py fails to load tigger with the following stack trace:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/Cattery/Siamese/turbo-sim.py", line 80, in <module>
    models.insert(0,TiggerSkyModel());
  File "/usr/lib/python2.7/dist-packages/Cattery/Siamese/OMS/tigger_lsm.py", line 44, in TiggerSkyModel
    classobj = importTigger(verbose=verbose);
  File "/usr/lib/python2.7/dist-packages/Cattery/Siamese/OMS/tigger_lsm.py", line 14, in importTigger
    import Tigger.SiameseInterface
  File "/usr/lib/python2.7/dist-packages/Tigger/SiameseInterface.py", line 49, in <module>
    from Tigger.Models.Formats import ModelHTML
  File "/usr/lib/python2.7/dist-packages/Tigger/Models/Formats/ModelHTML.py", line 39, in <module>
    from Tigger.Models import SkyModel
  File "/usr/lib/python2.7/dist-packages/Tigger/Models/SkyModel.py", line 32, in <module>
    from Tigger.Coordinates import angular_dist_pos_angle,DEG
  File "/usr/lib/python2.7/dist-packages/Tigger/Coordinates.py", line 62, in <module>
    from astLib.astWCS import WCS
  File "/usr/lib/python2.7/dist-packages/astLib/astWCS.py", line 27, in <module>
    from astropy.io import fits as pyfits
  File "/usr/lib/python2.7/dist-packages/astropy/__init__.py", line 116, in <module>
    _check_numpy()
  File "/usr/lib/python2.7/dist-packages/astropy/__init__.py", line 105, in _check_numpy
    requirement_met = minversion(numpy, __minimum_numpy_version__)
  File "/usr/lib/python2.7/dist-packages/astropy/utils/introspection.py", line 156, in minversion
    from pkg_resources import parse_version
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 50, in <module>
    from pkg_resources.extern import six
  File "/usr/lib/python2.7/dist-packages/pkg_resources/extern/__init__.py", line 44, in load_module
    mod = sys.modules[extant]
AttributeError: 'NoneType' object has no attribute 'modules'

This seems related to the issue reported here: ratt-ru/tigger#74 . But now with astropy/numpy as the culprit, as far as I can tell.

I've found an ugly hack for init.py, which is inserting import sys to line 43. It "fixes" the issue in pkg_resources, but fails later on the astropy package with the trace:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/Cattery/Siamese/turbo-sim.py", line 80, in <module>
    models.insert(0,TiggerSkyModel());
  File "/usr/lib/python2.7/dist-packages/Cattery/Siamese/OMS/tigger_lsm.py", line 44, in TiggerSkyModel
    classobj = importTigger(verbose=verbose);
  File "/usr/lib/python2.7/dist-packages/Cattery/Siamese/OMS/tigger_lsm.py", line 14, in importTigger
    import Tigger.SiameseInterface
  File "/usr/lib/python2.7/dist-packages/Tigger/SiameseInterface.py", line 49, in <module>
    from Tigger.Models.Formats import ModelHTML
  File "/usr/lib/python2.7/dist-packages/Tigger/Models/Formats/ModelHTML.py", line 39, in <module>
    from Tigger.Models import SkyModel
  File "/usr/lib/python2.7/dist-packages/Tigger/Models/SkyModel.py", line 32, in <module>
    from Tigger.Coordinates import angular_dist_pos_angle,DEG
  File "/usr/lib/python2.7/dist-packages/Tigger/Coordinates.py", line 62, in <module>
    from astLib.astWCS import WCS
  File "/usr/lib/python2.7/dist-packages/astLib/astWCS.py", line 27, in <module>
    from astropy.io import fits as pyfits
  File "/usr/lib/python2.7/dist-packages/astropy/__init__.py", line 287, in <module>
    log = _init_log()
  File "/usr/lib/python2.7/dist-packages/astropy/logger.py", line 100, in _init_log
    log._set_defaults()
  File "/usr/lib/python2.7/dist-packages/astropy/logger.py", line 484, in _set_defaults
    self.disable_warnings_logging()
  File "/usr/lib/python2.7/dist-packages/astropy/logger.py", line 253, in disable_warnings_logging
    if warnings.showwarning != self._showwarning:
AttributeError: 'NoneType' object has no attribute 'showwarning'

Something seems royally screwed. Did I install everything correctly?

@o-smirnov
Copy link
Contributor

Yeah it does smell like ratt-ru/tigger#74. @gijzelaerr @sjperkins any comments? This is some kind of python2/3 shizzle going badly wrong.

Feeling very astropy-irritated just now 😠 See this too: ratt-ru/montblanc#261

@sjperkins
Copy link
Member

sjperkins commented Nov 17, 2018 via email

@o-smirnov
Copy link
Contributor

Actually it's this issue here again: ratt-ru/meqtrees-timba#34

The 18.04 version of astropy obviously pulls in pkg_resources, which somehow triggers the bug. Gawd I hate this setuptools shizzle. In fact, looking at the current astropy code, looks like they share my high esteem of it, because they've taken that crap out: https://github.com/astropy/astropy/blob/master/astropy/utils/introspection.py

Question is @gijzelaerr, can we still ship a compatible astropy in KERN-4? The latest version is Python3-only...

@o-smirnov
Copy link
Contributor

@lord-blueberry, could you give it a go with the issue-7 branch of https://github.com/ska-sa/tigger-lsm?

  • git clone https://github.com/ska-sa/tigger-lsm -b issue-7

  • Add the cloned tigger-lsm directory to the front of your PYTHONPATH

If this works for you, we can push out a new release.

@lord-blueberry
Copy link
Author

Finally got around to it: Almost there. But the tigger-lsm issue-7 fails to import the Tigger package with this error

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/Cattery/Siamese/turbo-sim.py", line 89, in <module>
    models.insert(0,TiggerSkyModel());
  File "/usr/lib/python2.7/dist-packages/Cattery/Siamese/OMS/tigger_lsm.py", line 42, in TiggerSkyModel
    classobj = importTigger(verbose=verbose);
  File "/usr/lib/python2.7/dist-packages/Cattery/Siamese/OMS/tigger_lsm.py", line 13, in importTigger
    import Tigger.SiameseInterface
  File "Tigger/SiameseInterface.py", line 46, in <module>
    from Tigger.Models.Formats import ModelHTML
  File "Tigger/Models/Formats/ModelHTML.py", line 29, in <module>
    from html.parser import HTMLParser
ImportError: No module named html.parser

AFAIK html.parser is a python3 package, but I run it from python2. Or is this a package from Cattery missing?

@gijzelaerr gijzelaerr self-assigned this Dec 2, 2018
@gijzelaerr
Copy link
Member

i'll fix this next week.

@twillis449
Copy link
Contributor

I seem to be hitting the tigger-lsm issue myself. I'm not sure if astropy is the culprit. I deleted astropy from my ubuntu 16.04 system and I still get the error message:

Failure to import TiggerSkyModel module
Is the location of Tigger defined in your PYTHONPATH environment variable?

(I still had a version of pyfits in my system so fits calls were still handled OK.)

@gijzelaerr
Copy link
Member

working on these issues as we speak, I hope the situation is solved soon.

@gijzelaerr
Copy link
Member

gijzelaerr commented Dec 20, 2018

This is probably because for some package the name used to request the version number from pkg_resources doesn't match the package name. Some package had to be renamed (like tigger to astro-tigger) since they already existed on pypi.

@gijzelaerr
Copy link
Member

This should be solved with the release of tigger-lsm 1.5.0 https://github.com/ska-sa/tigger-lsm/releases/tag/1.5.0 and kittens 1.4.0 https://github.com/ska-sa/kittens/releases/tag/v1.4.0.

please let me know if you still experience issues.

@bmerry
Copy link

bmerry commented Mar 5, 2019

@gijzelaerr I'm using KERN-4 and running into this issue. Is it expected to work there or do I need to upgrade to KERN-5?

@gijzelaerr
Copy link
Member

It is not expected to work with KERN-4, if you can switch to KERN-5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants