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

use importlib instead of imp module on Python3.12 #208

Open
yuzibo opened this issue Jul 2, 2024 · 1 comment
Open

use importlib instead of imp module on Python3.12 #208

yuzibo opened this issue Jul 2, 2024 · 1 comment

Comments

@yuzibo
Copy link

yuzibo commented Jul 2, 2024

Hi,

I just google some links about imp was deprecated on python3.12. On Debian, we have one ftbfs below:

    cmd_obj.ensure_finalized()
  File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
    self.finalize_options()
  File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 225, in finalize_options
    parsed_version = packaging.version.Version(self.egg_version)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/setuptools/_vendor/packaging/version.py", line 198, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: 'unknown'
E: pybuild pybuild:389: build: plugin distutils failed with: exit code=1: /usr/bin/python3 setup.py build 

But the back track was unclear, the question is raised from imp imported, so I purpose one patch:

--- a/pycorrfit/_version.py
+++ b/pycorrfit/_version.py
@@ -12,7 +12,7 @@
 # Put the entire script into a `True` statement and add the hint
 # `pragma: no cover` to ignore code coverage here.
 if True:  # pragma: no cover
-    import imp
+    import importlib
     import os
     from os.path import abspath, basename, dirname, join
     import subprocess

It seems it works on my local build. Could you have a look at this?
Thanks.

@paulmueller
Copy link
Member

Hi @yuzibo
I currently do not have time to work on PyCorrFit, but I would be happy to merge a PR. Generally, it would probably be best to migrate to pyproject.toml + setuptools_scm for managing versioning.

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

No branches or pull requests

2 participants