spacetelescope / cubeviz

Data analysis package for cubes. https://cubeviz.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
15 stars 25 forks source link

Six package missing #591

Closed AlvaroLabiano closed 4 years ago

AlvaroLabiano commented 4 years ago

Hi,

I downloaded cubeviz through anaconda. When I try to run it, I get an error. There seems to be a "six' module missing from astropy.extern.

How could I solve it?

Thank you, Alvaro

pllim commented 4 years ago

Hello. Try either downgrading astropy or upgrading cubeviz. If that doesn't work, please provide the exact detail on how you set up "anaconda" and installed cubeviz. Thanks!

nmearl commented 4 years ago

@AlvaroLabiano could you also include the complete traceback for the error?

AlejandroGorgues commented 4 years ago

Hello @pllim and @nmearl,

I'm on a group with @AlvaroLabiano where we tried to run the 0.2.1 version of cubeviz and throws this error as Alvaro mentioned before:

Downloading https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat
|==========================================| 1.3k/1.3k (100.00%)         0s
Traceback (most recent call last):
  File "/.../.conda/envs/cubeviz02/bin/cubeviz", line 6, in <module>
    from cubeviz.cubeviz import main
  File "/.../.conda/envs/cubeviz02/lib/python3.6/site-packages/cubeviz/__init__.py", line 22, in <module>
    from . import keyboard_shortcuts
  File "/.../.conda/envs/cubeviz02/lib/python3.6/site-packages/cubeviz/keyboard_shortcuts.py", line 7, in <module>
    from .tools.wavelengths_ui import WavelengthUI
  File "/.../.conda/envs/cubeviz02/lib/python3.6/site-packages/cubeviz/tools/wavelengths_ui.py", line 17, in <module>
    from ..controls.wavelengths import REST_WAVELENGTH_TEXT, OBS_WAVELENGTH_TEXT
  File "/.../.conda/envs/cubeviz02/lib/python3.6/site-packages/cubeviz/controls/wavelengths.py", line 2, in <module>
    from specviz.third_party.glue.data_viewer import dispatch as specviz_dispatch
  File "/.../.conda/envs/cubeviz02/lib/python3.6/site-packages/specviz/__init__.py", line 21, in <module>
    from .interfaces.loaders import _load_yaml, _load_py
  File "/.../.conda/envs/cubeviz02/lib/python3.6/site-packages/specviz/interfaces/__init__.py", line 1, in <module>
    from .decorators import *
  File "/.../.conda/envs/cubeviz02/lib/python3.6/site-packages/specviz/interfaces/decorators.py", line 9, in <module>
    from ..core.data import Spectrum1DRef
  File "/.../.conda/envs/cubeviz02/lib/python3.6/site-packages/specviz/core/data.py", line 21, in <module>
    from specutils.core.generic import Spectrum1DRef
  File "/.../.conda/envs/cubeviz02/lib/python3.6/site-packages/specutils/__init__.py", line 18, in <module>
    from .spectrum1d import Spectrum1D
  File "/.../.conda/envs/cubeviz02/lib/python3.6/site-packages/specutils/spectrum1d.py", line 10, in <module>
    from astropy.extern import six
ImportError: cannot import name 'six'

We followed the installation section in the cubeviz Docs where we create an enviroment with Astroconda3 and the glueviz and cuebviz packages.

At that time we decided to look for a newer version as you @pllim told us, therefore we found the 0.3.0 version and the installation guide in the cubeviz github usign again Astroconda3. In this case we tried to execute it on Windows which did not show any error but also did not run, for this reason we tried on another OS, which was a MAC and a Linux and in this case it printed an error related with the astropy.six package as you can see on the log below:

Traceback (most recent call last):
  File "/.../.conda/envs/cubeviz030/bin/cubeviz", line 5, in <module>
    from cubeviz.cubeviz import main
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/cubeviz/cubeviz.py", line 20, in <module>
    from .data_factories import DataFactoryConfiguration
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/cubeviz/data_factories/__init__.py", line 17, in <module>
    from ..listener import CUBEVIZ_LAYOUT
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/cubeviz/listener.py", line 7, in <module>
    from .layout import CubeVizLayout
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/cubeviz/layout.py", line 19, in <module>
    from specviz.third_party.glue.viewer import SpecvizDataViewer
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/specviz/third_party/glue/viewer.py", line 32, in <module>
    from .operation_handler import SpectralOperationHandler
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/specviz/third_party/glue/operation_handler.py", line 6, in <module>
    from spectral_cube import BooleanArrayMask, SpectralCube
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/spectral_cube/__init__.py", line 13, in <module>
    from .spectral_cube import SpectralCube, VaryingResolutionSpectralCube
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/spectral_cube/spectral_cube.py", line 17, in <module>
    from astropy.extern import six
ImportError: cannot import name 'six' from 'astropy.extern' (/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/astropy/extern/__init__.py)

After searching a solution for the problem, we tried to change the line of code where the import is being made with the substitution that other people that we asked suggested, with the import of the six package instead of the astropy.extern package on both versions.

Making this change on the old version of cubeviz (0.2.1), we could execute it, however with the last version, another problem appeared, related with pyqt:

Traceback (most recent call last):
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/glue/utils/qt/decorators.py", line 63, in decorated
    return f(*args, **kwargs)
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/cubeviz/cubeviz.py", line 157, in main
    app = create_app(datafiles, data_configs, data_configs_show)
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/cubeviz/cubeviz.py", line 116, in create_app
    ga.run_startup_action('cubeviz')
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/glue/app/qt/application.py", line 358, in run_startup_action
    startup_action.members[name](self.session, self.data_collection)
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/cubeviz/startup.py", line 11, in cubeviz_setup
    _manager = CubevizManager(session)
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/cubeviz/listener.py", line 22, in __init__
    self._empty_layout = self._app.add_fixed_layout_tab(CubeVizLayout)
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/glue/app/qt/application.py", line 973, in add_fixed_layout_tab
    tab = tab_cls(session=self.session)
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/cubeviz/layout.py", line 139, in __init__
    directory=os.path.dirname(__file__))
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/glue/utils/qt/helpers.py", line 145, in load_ui
    return loadUi(full_path, parent)
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/PyQt5/uic/__init__.py", line 226, in loadUi
    return DynamicUILoader(package).loadUi(uifile, baseinstance, resource_suffix)
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/PyQt5/uic/Loader/loader.py", line 72, in loadUi
    return self.parse(filename, resource_suffix, basedir)
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/PyQt5/uic/uiparser.py", line 1021, in parse
    actor(elem)
  File "/.../.conda/envs/cubeviz030/lib/python3.7/site-packages/PyQt5/uic/uiparser.py", line 942, in createConnections
    QtCore.QMetaObject.connectSlotsByName(self.toplevelWidget)
SystemError: <built-in function connectSlotsByName> returned a result with an error set

At this moment we decided to stop modifying the code and ask if someone had the same problems on the GitHub repository. Hope this explanation add a solution to this problem @pllim .

Thanks.

Alejandro Gorgues

kilarson commented 4 years ago

Hi! I was having this problem as well and was able to fix it by updating from astropy.extern import six from astropy.extern.six.moves import range as xrange from astropy.extern.six.moves import zip to import the six package instead in 4 programs: spectral_cube.py, masks.py, ytcube.py, and stokes_spectral_cube.py

AlvaroLabiano commented 4 years ago

Hi! I was having this problem as well and was able to fix it by updating from astropy.extern import six from astropy.extern.six.moves import range as xrange from astropy.extern.six.moves import zip to import the six package instead in 4 programs: spectral_cube.py, masks.py, ytcube.py, and stokes_spectral_cube.py

Thanks! We also tried changing the code and fixed a few things. As Alejandro reported, we are having other issues.

Thanks again!

nmearl commented 4 years ago

@AlejandroGorgues, @AlvaroLabiano the error still seems to indicate that you might be using a too new version of astropy. The released CubeViz nominally supports astropy < v4.0, can you let us know which version of astropy you're currently seeing these errors with?

AlvaroLabiano commented 4 years ago

@nmearl : I am using astropy version 4.0 Thanks

nmearl commented 4 years ago

@AlvaroLabiano Thanks! You'll have to downgrade your astropy in order for CubeViz to work properly (i.e. without having to in and manually edit code), since we have not made the Qt version of CubeViz compatible with the latest astropy.

AlvaroLabiano commented 4 years ago

@nmearl Thanks!