kdeldycke/meta-package-manager

[v5.6.2] `AttributeError: module 'subprocess' has no attribute '_ENV'`

pdelre opened this issue · 4 comments

Recently released 5.6.2 (pipx installation, MacOS 12.5.1) is throwing an error for commands. From my memory, this was not occuring with 5.6.1.

$ mpm --version
mpm, version 5.6.2
$ mpm --verbosity DEBUG --all-managers managers
debug: Verbosity set to DEBUG.
debug: Load configuration matching /Users/pdelre/Library/Application Support/mpm/*.{toml,yaml,yml,json,ini,xml}
debug: Pattern is not an URL.
debug: Search local file system.
debug: No configuration file found. Ignore it.
debug: mpm, version 5.6.2
debug: apm CLI not found.
debug: apt CLI found at /usr/bin/apt
debug: ► /usr/bin/apt --version
Traceback (most recent call last):
  File "/Users/pdelre/.local/bin/mpm", line 8, in <module>
    sys.exit(mpm())
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/click_extra/commands.py", line 159, in main
    return super().main(*args, **kwargs)
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/click_extra/commands.py", line 210, in invoke
    return super().invoke(ctx)
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/meta_package_manager/cli.py", line 349, in managers
    version_infos = OK if manager.fresh else KO
  File "/usr/local/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/functools.py", line 981, in __get__
    val = self.func(instance)
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/meta_package_manager/base.py", line 448, in fresh
    if not self.version:
  File "/usr/local/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/functools.py", line 981, in __get__
    val = self.func(instance)
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/meta_package_manager/base.py", line 393, in version
    output = self.run_cli(
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/meta_package_manager/base.py", line 677, in run_cli
    output = self.run(*cli, extra_env=extra_env)
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/meta_package_manager/base.py", line 507, in run
    code, output, error = run_cmd(
  File "/Users/pdelre/.local/pipx/venvs/meta-package-manager/lib/python3.10/site-packages/click_extra/run.py", line 117, in run_cmd
    env=cast(subprocess._ENV, env_copy(extra_env)),
AttributeError: module 'subprocess' has no attribute '_ENV'

Yes, that's my mistake. I just fix this in click-extra v3.2.4, which is being built and released by GitHub CI jobs right now. The fix should hit PyPi in a couple of minutes. In which cas an upgrade of this dependency will fix the issue. I even thinking of releasing a new mpm in a couple of hours.

Thanks for the quick response.

For anyone else, I was able to resolve for now with pipx (I thought other 5.6.x was working yesterday, but they all were failing today so dropping back to 5.5.1)

pipx install --force meta-package-manager==5.5.1

Thanks @pdelre for the pipx command. It should help others use mpm in the mean time. I'll release mpm v5.7.0 in a couple of hours or tomorrow, the 5.6.x has been plagued with other broken dependencies.

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.