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 'distutils' #5

Closed
egarbi opened this issue Nov 28, 2023 · 4 comments
Closed

ModuleNotFoundError: No module named 'distutils' #5

egarbi opened this issue Nov 28, 2023 · 4 comments

Comments

@egarbi
Copy link

egarbi commented Nov 28, 2023

After upgrading python to v3.12 on my Mac. I'm not able anymore to validate commits.
See the full error below

k8svalidate..............................................................Failed
- hook id: k8svalidate
- exit code: 1

Traceback (most recent call last):
  File "/Users/enrique/.cache/pre-commit/repocsm9mirn/py_env-python3.12/bin/k8svalidate", line 13, in <module>
    import kubernetes_validate.utils as utils
  File "/Users/enrique/.cache/pre-commit/repocsm9mirn/py_env-python3.12/lib/python3.12/site-packages/kubernetes_validate/__init__.py", line 1, in <module>
    from .utils import latest_version, validate, validate_file, validate_resource
  File "/Users/enrique/.cache/pre-commit/repocsm9mirn/py_env-python3.12/lib/python3.12/site-packages/kubernetes_validate/utils.py", line 8, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'

This is my configuration file

- repo: https://github.com/Agilicus/pre-commit-hook-k8svalidate.git
    rev: v0.2.0
    hooks:
      - id: k8svalidate
        files: .yaml$

kubernetes-validate CLI works if I try manually

❯ kubernetes-validate -k 1.28 --strict namespace.yaml
INFO namespace.yaml passed for resource namespace/laravel-queue-workers against version 1.28
@brent-cybrid
Copy link

I'm also running into this issue after updating Python to v3.12. It is related to distutils no longer being supported in Python v3.12 (see here).

@donbowman
Copy link
Contributor

we don't use distutils in this tho?

@brent-cybrid
Copy link

brent-cybrid commented Dec 8, 2023

It's due to an issue with a dependency of this project: kubernetes-validate.

I've opened a ticket with them as well here.

Here's the error message that is received this package is run:

Traceback (most recent call last):
  File "<user_dir>/.cache/pre-commit/repotkgmzlfm/py_env-python3.12/bin/k8svalidate", line 13, in <module>
    import kubernetes_validate.utils as utils
  File "<user_dir>.cache/pre-commit/repotkgmzlfm/py_env-python3.12/lib/python3.12/site-packages/kubernetes_validate/__init__.py", line 1, in <module>
    from .utils import latest_version, validate, validate_file, validate_resource
  File "<user_dir>/.cache/pre-commit/repotkgmzlfm/py_env-python3.12/lib/python3.12/site-packages/kubernetes_validate/utils.py", line 8, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'

@egarbi
Copy link
Author

egarbi commented Dec 28, 2023

This has been solved by willthames/kubernetes-validate#24

@egarbi egarbi closed this as completed Dec 28, 2023
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

3 participants