achillesrasquinha / pipupgrade

🗽 Like yarn outdated/upgrade, but for pip. Upgrade all your pip packages and automate your Python Dependency Management.
https://git.io/pipupgrade
MIT License
587 stars 28 forks source link

cannot import name 'Version' from 'semver' #140

Open AA1999 opened 2 years ago

AA1999 commented 2 years ago

Description

The issue happens when doing a fresh install of pipupgrade and then running pipupgrade -V --resolve it first asked for mixology to be installed:

➜  ~ pipupgrade -V --resolve
bpyutils | 2022-08-12 18:04:44,335 | INFO | Environment: {'version': '0.5.2\n', 'python_version': '3.10.5', 'os': 'Linux-5.18.16-arch1-1-x86_64-with-glibc2.36', 'config': {'path': {'BASE': '/home/arshia/.local/lib/python3.10/site-packages/bpyutils', 'DATA': '/home/arshia/.local/lib/python3.10/site-packages/bpyutils/data', 'CACHE': '/home/arshia/.config/bpyutils', 'JOBS': '/home/arshia/.local/lib/python3.10/site-packages/bpyutils/jobs'}}, 'settings': {'settings': {'version': '0.5.2', 'cache_timeout': '86400', 'jobs': '8', 'max_chunk_download_bytes': '1024'}}}
bpyutils | 2022-08-12 18:04:44,335 | INFO | Arguments Passed: {'args': (), 'kwargs': {'ARGUMENTS': <class 'inspect._empty'>, 'packages': [], 'resolve': True, 'ignore': None, 'pip_path': None, 'yes': 0, 'clean': 0, 'check': 0, 'upgrade_type': ['minor', 'patch'], 'latest': 0, 'format': 'table', 'all': 0, 'pip': 0, 'self': False, 'requirements': None, 'pipfile': None, 'interactive': 0, 'project': None, 'git_username': None, 'git_email': None, 'pull_request': False, 'github_access_token': None, 'github_reponame': None, 'github_username': None, 'target_branch': 'master', 'jobs': 8, 'user': 0, 'no_included_requirements': 0, 'no_cache': 0, 'output': None, 'ignore_error': 0, 'force': 0, 'doctor': False, 'no_color': 0, 'verbose': True}, 'a': <pipupgrade.commands.to_params.<locals>.O object at 0x7fd9723bc7f0>}
Traceback (most recent call last):
  File "/home/arshia/.local/lib/python3.10/site-packages/pipupgrade/commands/__init__.py", line 110, in import_or_raise
    import_handler(package)
  File "/home/arshia/.local/lib/python3.10/site-packages/bpyutils/util/imports.py", line 27, in import_handler
    handler = _HANDLER_REGISTRY[name]
  File "/home/arshia/.local/lib/python3.10/site-packages/bpyutils/util/imports.py", line 6, in __missing__
    handler = __import__(name)
ModuleNotFoundError: No module named 'mixology'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/arshia/.local/bin/pipupgrade", line 8, in <module>
    sys.exit(main())
  File "/home/arshia/.local/lib/python3.10/site-packages/pipupgrade/cli/__init__.py", line 15, in wrapper
    return fn(**params)
  File "/home/arshia/.local/lib/python3.10/site-packages/pipupgrade/commands/__init__.py", line 91, in command
    raise e
  File "/home/arshia/.local/lib/python3.10/site-packages/pipupgrade/commands/__init__.py", line 79, in command
    return _command(**ARGUMENTS)
  File "/home/arshia/.local/lib/python3.10/site-packages/pipupgrade/commands/__init__.py", line 142, in _command
    import_or_raise("mixology")
  File "/home/arshia/.local/lib/python3.10/site-packages/pipupgrade/commands/__init__.py", line 112, in import_or_raise
    raise DependencyNotFoundError((
pipupgrade.exception.DependencyNotFoundError: Unable to import mixology for resolving dependencies. pipupgrade requires mixology to be installed. Please install mixology by executing 'pip install mixology'.

After doing so I get that error which is shown in console errors.

Screenshot

image image

Console errors

➜  ~ pipupgrade -V --resolve
bpyutils | 2022-08-12 18:05:02,917 | INFO | Environment: {'version': '0.5.2\n', 'python_version': '3.10.5', 'os': 'Linux-5.18.16-arch1-1-x86_64-with-glibc2.36', 'config': {'path': {'BASE': '/home/arshia/.local/lib/python3.10/site-packages/bpyutils', 'DATA': '/home/arshia/.local/lib/python3.10/site-packages/bpyutils/data', 'CACHE': '/home/arshia/.config/bpyutils', 'JOBS': '/home/arshia/.local/lib/python3.10/site-packages/bpyutils/jobs'}}, 'settings': {'settings': {'version': '0.5.2', 'cache_timeout': '86400', 'jobs': '8', 'max_chunk_download_bytes': '1024'}}}
bpyutils | 2022-08-12 18:05:02,918 | INFO | Arguments Passed: {'args': (), 'kwargs': {'ARGUMENTS': <class 'inspect._empty'>, 'packages': [], 'resolve': True, 'ignore': None, 'pip_path': None, 'yes': 0, 'clean': 0, 'check': 0, 'upgrade_type': ['minor', 'patch'], 'latest': 0, 'format': 'table', 'all': 0, 'pip': 0, 'self': False, 'requirements': None, 'pipfile': None, 'interactive': 0, 'project': None, 'git_username': None, 'git_email': None, 'pull_request': False, 'github_access_token': None, 'github_reponame': None, 'github_username': None, 'target_branch': 'master', 'jobs': 8, 'user': 0, 'no_included_requirements': 0, 'no_cache': 0, 'output': None, 'ignore_error': 0, 'force': 0, 'doctor': False, 'no_color': 0, 'verbose': True}, 'a': <pipupgrade.commands.to_params.<locals>.O object at 0x7feb09f6c7f0>}

Traceback (most recent call last):
  File "/home/arshia/.local/lib/python3.10/site-packages/pipupgrade/commands/__init__.py", line 79, in command
    return _command(**ARGUMENTS)
  File "/home/arshia/.local/lib/python3.10/site-packages/pipupgrade/commands/__init__.py", line 145, in _command
    populate_db = import_handler("pipupgrade.pubgrub.populate_db")
  File "/home/arshia/.local/lib/python3.10/site-packages/bpyutils/util/imports.py", line 27, in import_handler
    handler = _HANDLER_REGISTRY[name]
  File "/home/arshia/.local/lib/python3.10/site-packages/bpyutils/util/imports.py", line 10, in __missing__
    module  = __import__(module_name, {}, {}, [handler_name])
  File "/home/arshia/.local/lib/python3.10/site-packages/pipupgrade/pubgrub.py", line 15, in <module>
    from semver import Version, VersionRange, parse_constraint
ImportError: cannot import name 'Version' from 'semver' (/home/arshia/.local/lib/python3.10/site-packages/semver/__init__.py)

An error occured while performing the above command. This could be an issue with
"pipupgrade". Kindly post an issue at https://github.com/achillesrasquinha/pipupgrade/issues
walksonair commented 1 year ago

Experienced this today...