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

ValueError: No entry_points plugins could be loaded for 'nbcheck.exec' on Linux #1

Closed
lbianchi-lbl opened this issue Jul 14, 2023 · 0 comments
Assignees

Comments

@lbianchi-lbl
Copy link
Contributor

lbianchi-lbl commented Jul 14, 2023

This occurs when calling pytest --nbcheck=exec, resulting in the following error on Linux, but seemingly not on Windows (at least with GitHub Actions runners):

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/_pytest/main.py", line 266, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1054, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/pluggy/_hooks.py", line 452, in call_historic
INTERNALERROR>     res = self._hookexec(self.name, self._hookimpls, kwargs, False)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/pluggy/_manager.py", line 112, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/pluggy/_callers.py", line 116, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/pluggy/_callers.py", line 80, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/nbcheck/plugin.py", line 48, in pytest_configure
INTERNALERROR>     raise ValueError(f"No entry_points plugins could be loaded for {entry_point_group_name!r}")
INTERNALERROR> ValueError: No entry_points plugins could be loaded for 'nbcheck.exec'

After researching possible causes, including:

  • pytest
  • setuptools
  • importlib-resources
  • importlib-metadata
  • pluggy

it seems the cause could be the updates between pluggy 1.0.0 and 1.2.0: pytest-dev/pluggy@1.0.0...1.2.0, in the sense that the same code in the same environment works when pluggy 1.0.0 is installed, and has the error above for 1.2.0.

The actual cause of the error is:

  • The pytest_configure() hook in nbcheck.plugin is for some reason run twice, leading to the error being raised the second time since no setuptools (entry points) plugins are added via load_setuptools_plugins as they were already registered
  • I'm not 100% sure why this only happens for nbcheck.exec and not nbcheck.static, but my guess is that it might have something to do with nbcheck.execution defining its own pytest_configure() hook with tryfirst=True
  • As to why this happens on Linux but not on Windows: 🤷‍♂️

At any rate, just reworking the after-loading verification logic, and using a warning instead of raising an exception just to be on the safe side, seem to work to resolve this (b4e2f91/0.2.2).

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

1 participant