astropy / pyvo

An Astropy affiliated package providing access to remote data and services of the Virtual Observatory (VO) using Python.
https://pyvo.readthedocs.io/en/latest
BSD 3-Clause "New" or "Revised" License
77 stars 52 forks source link

ImportError: cannot import name 'wraps' from 'astropy.utils.decorators' #288

Closed keflavich closed 2 years ago

keflavich commented 2 years ago

I can't import pyvo locally after pip installing. This affected both pyvo 1.1 and 1.2

$ python -c "import astropy; print(astropy.__version__)"
5.1.dev424+ga1475dd9a
$ python -c "import pyvo"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/adam/anaconda3/envs/python3.9/lib/python3.9/site-packages/pyvo/__init__.py", line 37, in <module>
    from . import registry
  File "/home/adam/anaconda3/envs/python3.9/lib/python3.9/site-packages/pyvo/registry/__init__.py", line 7, in <module>
    from . import regtap
  File "/home/adam/anaconda3/envs/python3.9/lib/python3.9/site-packages/pyvo/registry/regtap.py", line 19, in <module>
    from ..dal import scs, sia, ssa, sla, tap, query as dalq
  File "/home/adam/anaconda3/envs/python3.9/lib/python3.9/site-packages/pyvo/dal/__init__.py", line 2, in <module>
    from .sia import search as imagesearch
  File "/home/adam/anaconda3/envs/python3.9/lib/python3.9/site-packages/pyvo/dal/sia.py", line 39, in <module>
    from .query import DALResults, DALQuery, DALService, Record
  File "/home/adam/anaconda3/envs/python3.9/lib/python3.9/site-packages/pyvo/dal/query.py", line 47, in <module>
    from ..utils.decorators import stream_decode_content
  File "/home/adam/anaconda3/envs/python3.9/lib/python3.9/site-packages/pyvo/utils/decorators.py", line 4, in <module>
    from astropy.utils.decorators import wraps
ImportError: cannot import name 'wraps' from 'astropy.utils.decorators' (/home/adam/repos/astropy/astropy/utils/decorators.py)

@pllim this was caused by https://github.com/astropy/astropy/commit/0039c14b9873d5ad4557923d717ce8ff16fc3d88#diff-2f264c7dc050831e9739d4e4e90df88b9063a033fb8d42ef7b95b4245bb070a7, where you remove the from functools import wraps call.

The fix is to replace pyvo/utils/decorators.py line 4 with from functools import wraps.

keflavich commented 2 years ago

This was fixed in https://github.com/astropy/pyvo/pull/283 but is not in a released version.

pllim commented 2 years ago

pyvo plans to do a release soon (@tomdonaldson).

andamian commented 2 years ago

1.2.1 has been published. It should fix this.

entaylor commented 2 years ago

I've just run into this issue as well, so apparently still not fixed or re-broken?

I'm trying to install pyvo via macports; py39-astropy @5.1 (python, science) and py38-pyvo @1.3 (python).

Trying the suggested fix above, replacing the line: from functools import partial, wraps with from functools import wraps does not fix the issue.

pllim commented 2 years ago

@entaylor , is your traceback exactly the same? Please share traceback. Thanks.

andamian commented 2 years ago

Yes, the plan was to release it but we've waited until after JWST for reasons that I can't remember. @tomdonaldson might be away and I don't know how to release it but he should be able to when he's back.

pllim commented 2 years ago

Hmm, maybe time to revisit #266 !

bsipocz commented 2 years ago

I'm happy to help with a release, but as I recall it was stalled prior AAS due to non-backward compatible changes around the registry and those discussions might not have been wrapped up fully.