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

Getting No module named 'astropy_iers_data' Exception on performing import astropy.io.ascii as asciitable #16739

Open
JuanCab opened this issue Jul 17, 2024 · 6 comments · May be fixed by emscripten-forge/recipes#1357

Comments

@JuanCab
Copy link

JuanCab commented Jul 17, 2024

Description

I am trying to update some old code I had to run with the current astropy (6.1.1) under Python 3.11 under voici (which runs it in the browser). The code is old and may not use modern best practices, I am still going to review it. That said, I am reporting it because the failure occurred when attempting an import astropy.io.ascii as asciitable.

I am certainly aware that astropy is not responsible for compatibility with voici, but given the import command that failed, it seemed like others might run into this in similar situations. I suspect the problem may be that voici may be limited in what files it can retrieve online so that import astropy_iers_data might fail in this situation.

Expected behavior

Code should run and read a file and display a plot.

How to Reproduce

I attempt to load my Jupyter notebook via Voici and I get the following stack trace when it attempts to import astropy.io.ascii as asciitable.

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[2], line 17
     14 from IPython.display import display
     16 # Import specific functions designed for galaxy model building
---> 17 from galaxyparam import *

File /files/galaxyparam.py:4
      1 # This python script contains functions and classes used in the
      2 # two synthetic galaxy model notebooks in this directory.
----> 4 import astropy.io.ascii as asciitable
      5 from scipy import interpolate
      6 import numpy as np

File /lib/python3.11/site-packages/astropy/io/ascii/__init__.py:5
      2 """An extensible ASCII table reader and writer."""
      3 # flake8: noqa
----> 5 from . import connect
      6 from .basic import (
      7     Basic,
      8     BasicData,
   (...)
     14     Tab,
     15 )
     16 from .cds import Cds

File /lib/python3.11/site-packages/astropy/io/ascii/connect.py:8
      5 import re
      7 from astropy.io import registry as io_registry  # noqa: F401
----> 8 from astropy.table import Table
     10 __all__ = []
     13 def io_read(format, filename, **kwargs):

File /lib/python3.11/site-packages/astropy/table/__init__.py:119
    116 with registry.delay_doc_updates(Table):
    117     # Import routines that connect readers/writers to astropy.table
    118     import astropy.io.ascii.connect
--> 119     import astropy.io.fits.connect
    120     import astropy.io.misc.connect
    121     import astropy.io.misc.pandas.connect

File /lib/python3.11/site-packages/astropy/io/fits/__init__.py:74
     68 conf = Conf()
     71 # Public API compatibility imports
     72 # These need to come after the global config variables, as some of the
     73 # submodules use them
---> 74 from . import card, column, convenience, hdu
     75 from .card import *
     76 from .column import *

File /lib/python3.11/site-packages/astropy/io/fits/card.py:11
      8 from astropy.utils.exceptions import AstropyUserWarning
     10 from . import conf
---> 11 from .util import _is_int, _str_to_num, _words_group, translate
     12 from .verify import VerifyError, VerifyWarning, _ErrList, _Verify
     14 __all__ = ["Card", "Undefined"]

File /lib/python3.11/site-packages/astropy/io/fits/util.py:22
     19 import numpy as np
     20 from packaging.version import Version
---> 22 from astropy.utils import data
     23 from astropy.utils.exceptions import AstropyUserWarning
     25 path_like = (str, bytes, os.PathLike)

File /lib/python3.11/site-packages/astropy/utils/data.py:34
     29 except ImportError:
     30     # certifi support is optional; when available it will be used for TLS/SSL
     31     # downloads
     32     certifi = None
---> 34 import astropy_iers_data
     36 import astropy.config.paths
     37 from astropy import config as _config

ModuleNotFoundError: No module named 'astropy_iers_data'

Versions

import astropy
try:
    astropy.system_info()
except AttributeError:
    import platform; print(platform.platform())
    import sys; print("Python", sys.version)
    import astropy; print("astropy", astropy.__version__)
    import numpy; print("Numpy", numpy.__version__)
    import erfa; print("pyerfa", erfa.__version__)
    try:
        import scipy
        print("Scipy", scipy.__version__)
    except ImportError:
        print("Scipy not installed")
    try:
        import matplotlib
        print("Matplotlib", matplotlib.__version__)
    except ImportError:
        print("Matplotlib not installed")
Emscripten-3.1.45-wasm32-32bit
Python 3.11.3 (main, Oct  5 2023, 09:36:00) [Clang 18.0.0 (https://github.com/llvm/llvm-project d1e685df45dc5944b43d2547d013
astropy 6.1.1
Numpy 1.25.2
pyerfa 2.0.0.3
Scipy 1.11.1
Matplotlib 3.8.4
@pllim
Copy link
Member

pllim commented Jul 17, 2024

No module named 'astropy_iers_data'

Not sure who packages for "voici" but this team needs to add https://pypi.org/project/astropy-iers-data/ to their distro. astropy now requires it, so not sure why they didn't allow astropy to pull it in automatically from PyPI.

"astropy-iers-data>=0.2024.7.1.0.34.3",

@JuanCab
Copy link
Author

JuanCab commented Jul 17, 2024

Installing astropy-iers-data into the voici environment did in fact fix the problem, so for some reason it isn't getting picked up as a required package for astropy.

I have reported this to emscripten-forge in the hope that someone can fix the WASM recipe.

@pllim
Copy link
Member

pllim commented Jul 17, 2024

@JuanCab , is this issue considered resolved over here then? If so, please close the issue. Thanks!

@JuanCab
Copy link
Author

JuanCab commented Jul 17, 2024

@JuanCab , is this issue considered resolved over here then? If so, please close the issue. Thanks!

I'll do that, there's been no reaction yet on the issue.

@ManonMarchand
Copy link
Member

ManonMarchand commented Oct 1, 2024

I'll try to contribute this upstream.
There's an other issue in the current build on imports of the sub-module astropy.tests . Is there an other mandatory dependency that they might have missed ? Is is pytest from here ?

Edit: pytest does not solve the issue

@pllim
Copy link
Member

pllim commented Oct 1, 2024

astropy.tests is for testing, so it would import (optional) test dependencies. So, if this voici wants to run astropy tests too, then it should also opt to install the test dependencies as defined in pyproject.toml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants