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

pkg_ressources removed in py 3.12 #20

Open
janesser opened this issue Sep 7, 2024 · 2 comments
Open

pkg_ressources removed in py 3.12 #20

janesser opened this issue Sep 7, 2024 · 2 comments

Comments

@janesser
Copy link

janesser commented Sep 7, 2024

https://docs.python.org/3/whatsnew/3.12.html

There is no more pkg_resources in python 3.12 (which is standard in e.g. ubuntu noble)

Longer situational description here: mu-editor/mu#2485

Let's see if we can fix it.

> pipx run  yglu
Traceback (most recent call last):
  File "/home/jan/.local/pipx/.cache/3af48864adc97f2/bin/yglu", line 5, in <module>
    from yglu.cli import main
  File "/home/jan/.local/pipx/.cache/3af48864adc97f2/lib/python3.12/site-packages/yglu/cli.py", line 6, in <module>
    from .main import process
  File "/home/jan/.local/pipx/.cache/3af48864adc97f2/lib/python3.12/site-packages/yglu/main.py", line 5, in <module>
    from .builder import build_all
  File "/home/jan/.local/pipx/.cache/3af48864adc97f2/lib/python3.12/site-packages/yglu/builder.py", line 7, in <module>
    from .expression import Expression, Function, FunctionBlock
  File "/home/jan/.local/pipx/.cache/3af48864adc97f2/lib/python3.12/site-packages/yglu/expression.py", line 5, in <module>
    import yaql
  File "/home/jan/.local/pipx/.cache/3af48864adc97f2/lib/python3.12/site-packages/yaql/__init__.py", line 16, in <module>
    import pkg_resources

EDIT: affected version is yglu@1.1.2 (which is actually latest on pypy)

@janesser
Copy link
Author

janesser commented Sep 7, 2024

in fact its yagl.

EDIT: quick & dirty workaround of yagl/init,py

> import pkg_resources
40c41,53
< __version__ = "2.0.1"
---
> def detect_version():
>     try:
>         dist = pkg_resources.get_distribution('yaql')
>         location = os.path.normcase(dist.location)
>         this_location = os.path.normcase(__file__)
>         if not this_location.startswith(os.path.join(location, 'yaql')):
>             raise pkg_resources.DistributionNotFound()
>         return dist.version
>     except pkg_resources.DistributionNotFound:
>         return 'Undefined (package was not installed with setuptools)'
> 
> 
> __version__ = detect_version()

@lbovet
Copy link
Owner

lbovet commented Sep 8, 2024

You can also install setuptools with pip3 install setuptools

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