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

imp module is removed in python3.12 #2806

Closed
drew-parsons opened this issue Feb 9, 2024 · 0 comments · Fixed by #2807
Closed

imp module is removed in python3.12 #2806

drew-parsons opened this issue Feb 9, 2024 · 0 comments · Fixed by #2807

Comments

@drew-parsons
Copy link

Describe the bug
The sasview doc build uses the imp module to import sources,


used at
run = imp.load_source('run', joinpath(SASVIEW_ROOT, 'run.py'))

The imp module is deprecated and removed from python3.12, so sasview fails to build on python 3.12 (or at least docs fail to build)

build_sphinx.py needs to be updated to use importlib instead.
It probably needs little more than finding the replacement for imp.load_source

To Reproduce
Steps to reproduce the behavior:

  1. cd docs/sphinx-docs
  2. make -Cdocs/sphinx-docs html

Expected behavior
Doc (and sasview itself) should build on python 3.12.

Screenshots
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1061760

 python3 setup.py docs update
running docs
========= check for sasmodels at /<<BUILDDIR>>/sasmodels/doc ============
== !!WARNING!! sasmodels directory not found. Cannot build model docs. ==
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/setup.py", line 292, in <module>
    setup(
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 
107, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", 
line 185, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", 
line 201, in run_commands
    dist.run_commands()
  File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", 
line 969, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 1233, 
in run_command
    super().run_command(command)
  File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", 
line 988, in run_command
    cmd_obj.run()
  File "/<<PKGBUILDDIR>>/setup.py", line 106, in run
    import build_sphinx
  File "/<<PKGBUILDDIR>>/docs/sphinx-docs/build_sphinx.py", line 16, in 
<module>
    import imp
ModuleNotFoundError: No module named 'imp'
make[1]: *** [debian/rules:30: execute_after_dh_auto_build] Error 1
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:20: binary] Error 2

SasView version:

  • Version:5.0.6, HEAD

Operating system (please complete the following information):

  • OS: Linux (debian unstable)
  • Python 3.12 (any OS)

Additional context
Affects update plans in #2546

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.

1 participant