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
{{ message }}
Repository navigation
cannot import name 'imperials' from 'astropy.units' #11975
import astropy.units as u
u.K in (u.K, u.imperial.deg_F)
>>> cannot import name 'imperials' from 'astropy.units'
Now I have to update the code to
import astropy.units as u
from astropy.units.imperial import deg_F
u.K in (u.K, deg_F)
>>> True
If this is the expected behavior (and cleaner way to import), this Issue can be closed right away. Hopefully the title will help people that would encounter the same proper to find an easy fix.
Welcome to Astropy 👋 and thank you for your first issue!
A project member will respond to you as soon as possible; in the meantime, please double-check the guidelines for submitting issues and make sure you've provided the requested details.
If you feel that this issue has not been responded to in a timely manner, please leave a comment mentioning our software support engineer @embray, or send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail [email protected].
I'm running into the same issue with PyWWT using u.imperial:
In [1]: from astropy import units as u
In [2]: u.imperial
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-f25c0008b10d> in <module>
----> 1 u.imperial
AttributeError: module 'astropy.units' has no attribute 'imperial'
FYI to packages affected by this: Going forward, we highly recommend adding a CI job to test against astropy dev, or at the very least test the release candidate when it is announced.
Activity
github-actions commentedon Jul 27, 2021
Welcome to Astropy 👋 and thank you for your first issue!
A project member will respond to you as soon as possible; in the meantime, please double-check the guidelines for submitting issues and make sure you've provided the requested details.
If you feel that this issue has not been responded to in a timely manner, please leave a comment mentioning our software support engineer @embray, or send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail [email protected].
fix import with astropy>4.3
astrofrog commentedon Jul 27, 2021
I'm running into the same issue with PyWWT using
u.imperial:astrofrog commentedon Jul 27, 2021
I think this is going to require a quick v4.3.1 follow-up (at the very least there should be a deprecation warning if this was intentional)
dhomeier commentedon Jul 27, 2021
Until then a less intrusive workaround will probably be
pllim commentedon Jul 27, 2021
Oh, dear! See #11977
pllim commentedon Jul 27, 2021
FYI to packages affected by this: Going forward, we highly recommend adding a CI job to test against astropy dev, or at the very least test the release candidate when it is announced.
bugfix/workaround geospatial docs (see astropy/astropy#11975)
bugfix/workaround geospatial docs (see astropy/astropy#11975)