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" when using Python 3.12 #181

Closed
Delgan opened this issue Sep 10, 2023 · 3 comments · Fixed by #182
Closed

"ModuleNotFoundError" when using Python 3.12 #181

Delgan opened this issue Sep 10, 2023 · 3 comments · Fixed by #182

Comments

@Delgan
Copy link
Contributor

Delgan commented Sep 10, 2023

Hi!

Python 3.12 final release is scheduled for the next month and they removed some bundled libraries like notably pkg_resources:

easy_install, pkg_resources, setuptools and distutils are no longer provided by default in environments created with venv or bootstrapped with ensurepip, since they are part of the setuptools package. For projects relying on these at runtime, the setuptools project should be declared as a dependency and installed separately (typically, using pip).

The problem is that language-formatters-pre-commit-hooks depends on pkg_resources here:

When using Python 3.12, this causes my pre-commit to fail with the following error:

Traceback (most recent call last):
  File "/home/delgan/.cache/pre-commit/repogd__gv51/py_env-python3.12/bin/pretty-format-yaml", line 5, in <module>
    from language_formatters_pre_commit_hooks.pretty_format_yaml import pretty_format_yaml
  File "/home/delgan/.cache/pre-commit/repogd__gv51/py_env-python3.12/lib/python3.12/site-packages/language_formatters_pre_commit_hooks/__init__.py", line 2, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

I guess setuptools should be added as an explicit dependency to this project in setup.cfg?

@macisamuele
Copy link
Owner

@Delgan thanks a lot for the report.
We do welcome PRs, hence feel free to open one and I'll be happy to review/merge/release it.

Otherwise I'll try to get to it within a week (or so).

@Delgan
Copy link
Contributor Author

Delgan commented Sep 10, 2023

Thanks for the quick reply. I opened #182. ;)

@RossKempesinos
Copy link

Would you be able to create a new tag with this included?

milesziemer added a commit to milesziemer/smithy-rs that referenced this issue Nov 21, 2023
Was running into
macisamuele/language-formatters-pre-commit-hooks#181
trying to run pre-commit. It was fixed in 2.11.
github-merge-queue bot pushed a commit to smithy-lang/smithy-rs that referenced this issue Nov 21, 2023
Was running into

macisamuele/language-formatters-pre-commit-hooks#181
trying to run pre-commit. It was fixed in 2.11.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
github-merge-queue bot pushed a commit to smithy-lang/smithy-rs that referenced this issue Nov 21, 2023
Was running into

macisamuele/language-formatters-pre-commit-hooks#181
trying to run pre-commit. It was fixed in 2.11.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
rcoh pushed a commit to milesziemer/smithy-rs that referenced this issue Nov 21, 2023
Was running into
macisamuele/language-formatters-pre-commit-hooks#181
trying to run pre-commit. It was fixed in 2.11.
github-merge-queue bot pushed a commit to smithy-lang/smithy-rs that referenced this issue Nov 24, 2023
Was running into

macisamuele/language-formatters-pre-commit-hooks#181
trying to run pre-commit. It was fixed in 2.11.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

Co-authored-by: Russell Cohen <[email protected]>
jdisanti pushed a commit to smithy-lang/smithy-rs that referenced this issue Nov 27, 2023
Was running into

macisamuele/language-formatters-pre-commit-hooks#181
trying to run pre-commit. It was fixed in 2.11.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

Co-authored-by: Russell Cohen <[email protected]>
ysaito1001 pushed a commit to smithy-lang/smithy-rs that referenced this issue Nov 28, 2023
Was running into

macisamuele/language-formatters-pre-commit-hooks#181
trying to run pre-commit. It was fixed in 2.11.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

Co-authored-by: Russell Cohen <[email protected]>
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