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

ModuleNotFoundError: No module named 'imp' #89

Closed
pentyum opened this issue Jun 22, 2024 · 3 comments · Fixed by #92
Closed

ModuleNotFoundError: No module named 'imp' #89

pentyum opened this issue Jun 22, 2024 · 3 comments · Fixed by #92
Assignees

Comments

@pentyum
Copy link

pentyum commented Jun 22, 2024

Cannot install speclite on Python 3.12, because Python 3.12 has removed the imp package.

Traceback (most recent call last):
        File "/home/user/desihub/speclite/astropy_helpers/setup.py", line 22, in <module>
          from astropy_helpers.version_helpers import generate_version_py  # noqa
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/user/desihub/speclite/astropy_helpers/astropy_helpers/version_helpers.py", line 34, in <module>
          from .distutils_helpers import is_distutils_display_option
        File "/home/user/desihub/speclite/astropy_helpers/astropy_helpers/distutils_helpers.py", line 18, in <module>
          from .utils import silence
        File "/home/user/desihub/speclite/astropy_helpers/astropy_helpers/utils.py", line 4, in <module>
          import imp
      ModuleNotFoundError: No module named 'imp'
@sbailey
Copy link
Collaborator

sbailey commented Jun 24, 2024

Thanks for noting this. In python 3.10, import imp reports

DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses

@pentyum would you be willing to make a speclite PR that replaces imp with importlib? I'm not sure if that is a drop-in replacement or requires some syntax changes to how it is used. If you can't do this, ok, we'll put it on our to-do list but there will be some delay before we find time to update this.

Also, side note: I don't recognize your github user name but see you have popped up on several DESI-related repos recently; thanks for those reports and fixes. If you are a DESI collaborator, please message me on the DESI slack so that we have some context about who this is, and establish an alternate non-github communication channel as well. Thanks.

@sbailey
Copy link
Collaborator

sbailey commented Jun 24, 2024

@pentyum update: now I see on desigal that you already identified that you are not a desi collaborator. Thanks for your interest in DESI data and patience and contributions to our code.

@weaverba137
Copy link
Member

Technical note: the import error is not in speclite itself, but in the deprecated astropy_helpers submodule. The solution is simply to eliminate the submodule entirely and bring speclite up to modern packaging standards, but as previously noted, that could take a while.

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

Successfully merging a pull request may close this issue.

3 participants