astropy / astroplan

Observation planning package for astronomers – maintainer @bmorris3
https://astroplan.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
199 stars 109 forks source link

cannot import name 'Observer' from 'astroplan' #492

Closed alexfilothodoros closed 3 years ago

alexfilothodoros commented 3 years ago

Hello,

I have just installed astroplan via conda, on Big Sur.

I am trying to run this script https://astroplan.readthedocs.io/en/latest/tutorials/plots-3.py

but I get the error ImportError: cannot import name 'Observer' from 'astroplan' astroplan.test() shows

==================================================================== 84 passed, 7 warnings in 40.37s ==================================================================== Out[2]: <ExitCode.OK: 0>

And ideas how this problem can be fixed? Thanks

Yash-10 commented 3 years ago

Hi, I am still new here but running the script doesn't give me the error you have mentioned, although it does give me those warnings after running astropy.test(). Also, I am on Ubuntu and used pip for the installation.

But one thing I have noticed, which may not be related to this issue, is that astroplan.observer is a sub-module and is not a package itself. Observer is a class inside the astroplan.observer module. So maybe you can try to check the installed packages and submodules and use observer.Observer instead after importing observer?

The issue of circular import dependency is seen quite common in such scenarios, which doesn't seem the case here since packages installed before Observer doesn't have Observer imported within them.

I thought these points might give some insight to the problem, maybe it helps.

Thanks.

alexfilothodoros commented 3 years ago

But one thing I have noticed, which may not be related to this issue, is that astroplan.observer is a sub-module and is not a package itself. Observer is a class inside the astroplan.observer module. So maybe you can try to check the installed packages and submodules and use observer.Observer instead after importing observer? Nice idea. This should get the job done.

Thanks mate :)