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 name 'wraps' from 'astropy.utils.decorators' #474

Open
bencooper1 opened this issue May 19, 2022 · 3 comments
Open

Cannot import name 'wraps' from 'astropy.utils.decorators' #474

bencooper1 opened this issue May 19, 2022 · 3 comments

Comments

@bencooper1
Copy link

bencooper1 commented May 19, 2022

Description

I can not import aplpy with astropy 5.0.4.

I installed astropy version 5.0.4 over conda: conda install -c anaconda astropy
Then, I installed aplpy version 2.0.3: conda install -c conda-forge aplpy
When I use ipython: import aplpy then here is the error:

Steps to Reproduce

In [5]: import aplpy
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 import aplpy

File /opt/anaconda3/lib/python3.9/site-packages/aplpy/__init__.py:14, in <module>
     10 # ----------------------------------------------------------------------------
     12 if not _ASTROPY_SETUP_:  # noqa
---> 14     from .core import FITSFigure  # noqa
     15     from .rgb import make_rgb_image, make_rgb_cube  # noqa
     17     from .frame import Frame  # noqa

File /opt/anaconda3/lib/python3.9/site-packages/aplpy/core.py:30, in <module>
     27 from . import slicer
     29 from .compat import simple_norm
---> 30 from .layers import Layers
     31 from .grid import Grid
     32 from .ticks import Ticks

File /opt/anaconda3/lib/python3.9/site-packages/aplpy/layers.py:9, in <module>
      5 from matplotlib.contour import ContourSet
      6 from matplotlib.collections import RegularPolyCollection, \
      7     PatchCollection, CircleCollection, LineCollection
----> 9 from .regions import ArtistCollection
     10 from .decorators import auto_refresh
     13 class Layers(object):

File /opt/anaconda3/lib/python3.9/site-packages/aplpy/regions.py:6, in <module>
      3 from astropy import log
      4 from astropy import wcs
----> 6 from .decorators import auto_refresh
      9 class Regions(object):
     10     """
     11     Regions sub-class of APLpy.
     12 
   (...)
     41 
     42     """

File /opt/anaconda3/lib/python3.9/site-packages/aplpy/decorators.py:5, in <module>
      1 from __future__ import absolute_import, print_function, division
      3 import threading
----> 5 from astropy.utils.decorators import wraps
      7 mydata = threading.local()
      9 __all__ = ['auto_refresh', 'fixdocstring']

ImportError: cannot import name 'wraps' from 'astropy.utils.decorators' (/opt/anaconda3/lib/python3.9/site-packages/astropy/utils/decorators.py)

System Details

In [1]: import platform; print(platform.platform())
macOS-10.15.7-x86_64-i386-64bit

In [2]: import sys; print("Python", sys.version)
Python 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:27:05) 
[Clang 12.0.1 ]

In [3]: import astropy; print("astropy", astropy.__version__)
astropy 5.0.4
@bencooper1
Copy link
Author

I fixed this problem by modify in decorators.py file: /opt/anaconda3/lib/python3.9/site-packages/aplpy/decorators.py

#from astropy.utils.decorators import wraps
from functools import wraps #modify

@thatastroguy
Copy link

Ran into this same issue (but with astropy 5.2.2), except I first ran into the issue outlined in open issue #472 and had to first modify my aplpy core.py file. This issue then appeared. I can confirm your modification works and apply can be imported on my own system.

@dhomeier
Copy link

dhomeier commented May 5, 2023

This has been fixed in #469 (in 2.1.0), but the current release is only installable via pip at this time.

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

3 participants