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 'pkg_resources' #275

Closed
aboettger opened this issue May 29, 2024 · 2 comments · Fixed by #276
Closed

ModuleNotFoundError: No module named 'pkg_resources' #275

aboettger opened this issue May 29, 2024 · 2 comments · Fixed by #276

Comments

@aboettger
Copy link

❯ pipx install gita --force
--python is ignored when --force is passed. If you want to reinstall gita with /usr/bin/python, run `pipx reinstall gita --python /usr/bin/python` instead.
Installing to existing venv 'gita'
  installed package gita 0.16.6.6, installed using Python 3.12.3
  These apps are now globally available
    - gita
done! ✨ 🌟 ✨
❯ gita
Traceback (most recent call last):
  File "/home/rztab/.local/bin/gita", line 5, in <module>
    from gita.__main__ import main
  File "/home/rztab/.local/pipx/venvs/gita/lib/python3.12/site-packages/gita/__init__.py", line 1, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
@nosarthur
Copy link
Owner

https://importlib-resources.readthedocs.io/en/latest/migration.html

gemini also gave me this

from importlib.metadata import PackageMetadata

def get_version() -> str:
  # Read the package metadata
  metadata = PackageMetadata("your_package_name")  # Replace with your package name
  return metadata.version

# ... rest of your setup script code ...

# Example usage
version = get_version()
print(f"Package version: {version}")

@nosarthur
Copy link
Owner

please try v0.16.7.1

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.

2 participants