RuntimeError: Multiple platforms match current OS (WSL2)
paxsali opened this issue · 7 comments
What happened?
mpm crashes with error message:
RuntimeError: Multiple platforms match current OS: [Platform(id='linux', name='Linux', current=True), Platform(id='wsl2', name='Windows Subsystem for Linux v2', current=True)]
I must notice that it used to work on WSL2 normally and only some recent updates it crashes (havent used it in a while).
The behavior should be, if in doubt, use the more specific, non-contradictory platform name (in this case "wsl2"), instead of crashing because of multiple-matches.
Meta Package Manager configuration
No response
List package managers
No response
Meta Package Manager version
5.11.6
Ah yes. That's my fault. I changed some of the heuristics in the way platforms are detected, to make mpm
aware of other systems apart from Linux, macOS and Windows.
Thank you for reporting this issue, you are the first user of WSL2 that reached out to me. Happy to see mpm
used in that environment!
I'll fix the root cause for the next version. Shouldn't be a big deal.
Issue has been fixed upstream in click_extra v3.8.2
, which is being released and should be available on PyPi in a couple of minutes. A re-install/update of mpm v5.11.6
should pick this latest click_extra
dependency automatically.
I'll release a new mpm v5.11.7
anyway to force this requirement.
FYI, mpm v5.11.7
has been released.
That was a quick fix. Thanks! 👍
TBF, WSL2 behaves much like native Linux, so don't be suprised there's not much activity around it (explicitly).
TBF, WSL2 behaves much like native Linux, so don't be suprised there's not much activity around it (explicitly).
Can confirm, as nobody complained or mentioned it, until I started messing with platform detection last month! 😅
Hi again,
there's one little issue I found and I don't want to open a new issue, because I believe this is directly related to this issue:
paxsali{WSL:Ubuntu-22.04}@devbox:[~]$ mpm -o plain --apt upgrade
warning: No package provided, assume -A/--all option.
Upgrade all outdated packages from apt...
Fallback to calling upgrade operation on each outdated package.
warning: WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Traceback (most recent call last):
File "/home/paxsali/.local/lib/python3.10/site-packages/meta_package_manager/base.py", line 963, in upgrade
cli = self.upgrade_all_cli()
File "/home/paxsali/.local/lib/python3.10/site-packages/meta_package_manager/managers/apt.py", line 225, in upgrade_all_cli
return self.build_cli("--yes", "upgrade", sudo=True)
File "/home/paxsali/.local/lib/python3.10/site-packages/meta_package_manager/base.py", line 735, in build_cli
raise NotImplementedError("sudo only supported on Linux.")
NotImplementedError: sudo only supported on Linux.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/paxsali/.local/bin/mpm", line 8, in <module>
sys.exit(main())
File "/home/paxsali/.local/lib/python3.10/site-packages/meta_package_manager/__main__.py", line 56, in main
mpm(prog_name=mpm.name)
File "/home/paxsali/.local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/paxsali/.local/lib/python3.10/site-packages/click_extra/commands.py", line 159, in main
return super().main(*args, **kwargs)
File "/home/paxsali/.local/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/paxsali/.local/lib/python3.10/site-packages/click_extra/commands.py", line 213, in invoke
return super().invoke(ctx)
File "/home/paxsali/.local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/paxsali/.local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/paxsali/.local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/paxsali/.local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/paxsali/.local/lib/python3.10/site-packages/meta_package_manager/cli.py", line 892, in upgrade
output = manager.upgrade()
File "/home/paxsali/.local/lib/python3.10/site-packages/meta_package_manager/base.py", line 970, in upgrade
output = self.upgrade(package.id)
File "/home/paxsali/.local/lib/python3.10/site-packages/meta_package_manager/base.py", line 959, in upgrade
cli = self.upgrade_one_cli(package_id, version=version)
File "/home/paxsali/.local/lib/python3.10/site-packages/meta_package_manager/capabilities.py", line 81, in print_warning
return func(*args, **kwargs)
File "/home/paxsali/.local/lib/python3.10/site-packages/meta_package_manager/managers/apt.py", line 238, in upgrade_one_cli
return self.build_cli(
File "/home/paxsali/.local/lib/python3.10/site-packages/meta_package_manager/base.py", line 735, in build_cli
raise NotImplementedError("sudo only supported on Linux.")
NotImplementedError: sudo only supported on Linux.
When invoking mpm
as a regular (non-root) user, obviously for some manager types, like apt
, you need elevated priviledges for root, like it is usually done via sudo
.
For some reason the sudo
functionality in mpm is "guarded" behind one more OS detection check procedure, which makes sense.
Here, again ..., it incorrectly detects the OS and says that sudo
is only supported on Linux.
Set aside the obvious incorrectness of the wording (what about MacOS or BSD, AIX, etc.? don't they have sudo
, too?) ..., it should have run on my WSL(2) environment, because it is (essentially) a Linux.
Unfortunatelly above error message doesn't state what it was detected as, unlike my initial post from above.
Maybe the test for this is literally a negation? If not OS equals Linux then throw this error? Seems incorrect to me.
Or maybe the idea behind this is more practically oriented than formally correct as in: there are no (not yet) BSD, MacOS, ... "non-Linux" OSes with apt
as their main pkg-manager (that, I would at least understand).
Does this info help?
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.