rodluger / starry

Tools for mapping stars and planets.
https://starry.readthedocs.io
MIT License
138 stars 32 forks source link

Import Issue with Starry #276

Closed mkplummer closed 3 years ago

mkplummer commented 3 years ago

When I import starry, I get the following error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-10c95ea0e8bb> in <module>
----> 1 import starry
~\Anaconda3\lib\site-packages\starry\__init__.py in <module>
     15 # Import the main interface
     16 from ._config import config
---> 17 from . import kepler, linalg, maps
     18 from .maps import Map
     19 from .kepler import Primary, Secondary, System
~\Anaconda3\lib\site-packages\starry\kepler.py in <module>
      2 from . import config
      3 from ._constants import *
----> 4 from .maps import MapBase, RVBase, ReflectedBase
      5 from ._core import OpsSystem, math
      6 from .compat import evaluator
~\Anaconda3\lib\site-packages\starry\maps.py in <module>
      2 from . import config, legacy
      3 from ._constants import *
----> 4 from ._core import OpsYlm, OpsLD, OpsReflected, OpsRV, math
      5 from ._core.utils import is_theano
      6 from ._indices import integers, get_ylm_inds, get_ul_inds, get_ylmw_inds
~\Anaconda3\lib\site-packages\starry\_core\__init__.py in <module>
      1 # -*- coding: utf-8 -*-
----> 2 from . import core, ops, utils, math
      3 from .core import *
~\Anaconda3\lib\site-packages\starry\_core\core.py in <module>
      2 from .. import config
      3 from .._constants import *
----> 4 from .ops import (
      5     sTOp,
      6     rTReflectedOp,
~\Anaconda3\lib\site-packages\starry\_core\ops\__init__.py in <module>
      1 # -*- coding: utf-8 -*-
      2 from .exceptions import *
----> 3 from .filter import *
      4 from .integration import *
      5 from .limbdark import *
~\Anaconda3\lib\site-packages\starry\_core\ops\filter.py in <module>
     10     STARRY_OREN_NAYAR_DEG = 5
     11 else:
---> 12     from ..._c_ops import STARRY_OREN_NAYAR_DEG
     13 
     14 
ImportError: DLL load failed: The specified module could not be found.
rodluger commented 3 years ago

Hey @mkplummer can you tell me a bit more about your setup? Looks like you're on windows. How did you install starry and which version is it?

mkplummer commented 3 years ago

Thank you! I am running the module via Jupyter Workbook. Looks like Starry 1.1.0 on Python 3.7.3 and Conda 4.9.3 are my current versions.

I appreciate the help!

rodluger commented 3 years ago

Thanks. And did you install it via pip or by cloning the repo and running setup.py? It would also be helpful if you could list the contents of the directory

~\Anaconda3\lib\site-packages\starry
mkplummer commented 3 years ago

Thank you again! I installed via pip. Would it work better the other way (by cloning the repo and running setup.py)?

Here are the contents of my directory:

image

rodluger commented 3 years ago

@mkplummer The _c_ops DLL it's complaining about not being able to find is the compiled C++ code, which I think is the _c_ops.cp37-win_amd64.pyd file I see listed there. So it's not immediately obvious to me what's causing the issue.

Can you try cloning the repository and running python setup.py install, and letting me know what happens?

If that doesn't work, can you try creating (and activating) a fresh conda virtual environment and trying to pip install inside of that?

rodluger commented 3 years ago

@dfm The Windows wheels seem to be ok: https://github.com/rodluger/starry/actions/runs/679686498. Any ideas what the issue might be?

dfm commented 3 years ago

There can be issues with wheels and linked libraries on Windows that can result in useless errors like this, but I'm not sure if that's what would be happening here (I don't think there should be any linking required for starry!).

So, @mkplummer: one option would be to try installing from source. I think the following would work:

pip uninstall starry
pip install -U starry --no-binary starry

I can try playing around with this on Windows later if you continue to have trouble.

mkplummer commented 3 years ago

Good morning! Thank you for your help. After uninstalling starry, I executed the "pip uninstall -U starrry --no-binary starry" cmd, and here was the results: image Followed by a string of errors and then, image So I believe I need to update my microsoft C++, I will see if this helps. Once again, I really appreciate the help.

rodluger commented 3 years ago

Keep us posted!

mkplummer commented 3 years ago

I wound up updating Visual C++, Python, and reinstalled starry, theano, exoplanet and matplotlib via conda and python. So far everything seems to be working now. Thank you!

rodluger commented 3 years ago

Great, glad to hear. Feel free to re-open the issue if you run into trouble again.