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

package_version function errors for Jishaku #172

Open
4 tasks done
fuh-Q opened this issue May 6, 2022 · 2 comments
Open
4 tasks done

package_version function errors for Jishaku #172

fuh-Q opened this issue May 6, 2022 · 2 comments

Comments

@fuh-Q
Copy link

fuh-Q commented May 6, 2022

Summary

My jsk command keeps erroring when I run the root command, and it seems to be a problem with the package_version function used to determine Jishaku's version as well as discord.py's version

Reproduction steps

  • Run the jsk root command
    OR
  • Import package_version from jishaku.modules and call it, passing "jishaku" as the first argument

Expected results

Return Jishaku's version (in my case 2.5.0)

Actual results

Kept giving me this error in the console

Traceback (most recent call last):
  File "/home/user/bot/cogs/Eval.py", line 445, in _eval
    ret = await func()
  File "<string>", line 6, in func
  File "/home/user/.local/lib/python3.10/site-packages/jishaku/modules.py", line 96, in package_version
    return pkg_resources.get_distribution(package_name).version
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 482, in get_distribution
    dist = get_provider(dist)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 358, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 792, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (importlib-metadata 1.5.0 (/usr/lib/python3/dist-packages), Requirement.parse('importlib-metadata>=3.7.0; python_version < "3.10"'), {'jishaku'})

Checklist

  • I have updated discord.py and jishaku to the latest available versions and have confirmed that this issue is still present
  • I have searched the open issues for duplicates
  • I have shown the entire traceback, if possible
  • I have removed my token from display, if visible

System information

  • Jishaku v2.5.0
  • discord.py v2.0a

Screenshot

image

@PythonCoderAS
Copy link

This is not a jishaku bug. I just tested this by spinning up a fresh venv and testing it. What it seems to be is that your package manager (apt maybe) installed an incompatible version of a dependency, and python/pip cannot solve this because the package manager forbids pip from uninstalling packages installed by it. This is why you always use venvs for anything other than non-global cli tools.

@Gorialis
Copy link
Owner

pkg_resources related problems are also the cause of #205. Will need to purposefully break one of my environments to reproduce it enough to fix it, but the goal is probably to either move from pkg_resources to importlib_metadata (if possible), or to engineer a solution that does not depend on pip's whims at all.

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