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

Error importing with PyPy 3.8.15/3.9.15 #688

Closed
davidbrochart opened this issue Dec 20, 2022 · 2 comments · Fixed by jupyterlab/jupyter-collaboration#71 · May be fixed by #691
Closed

Error importing with PyPy 3.8.15/3.9.15 #688

davidbrochart opened this issue Dec 20, 2022 · 2 comments · Fixed by jupyterlab/jupyter-collaboration#71 · May be fixed by #691
Assignees

Comments

@davidbrochart
Copy link

There seems to be an issue with PyPy v3.8.15 and PyPy v3.9.15:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/PyPy/3.8.[15](https://github.com/jupyter-server/jupyter_server_ydoc/actions/runs/3735497732/jobs/6344763684#step:7:16)/x64/lib/pypy3.8/runpy.py", line 198, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 190, in console_main
    code = main()
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 148, in main
    config = _prepareconfig(args, plugins)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 330, in _prepareconfig
    pluginmanager=pluginmanager, args=args
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/helpconfig.py", line 103, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 1058, in pytest_cmdline_parse
    self.parse(args)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 1346, in parse
    self._preparse(args, addopts=addopts)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 1249, in _preparse
    early_config=self, args=args, parser=self._parser
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 1126, in pytest_load_initial_conftests
    early_config.known_args_namespace, rootpath=early_config.rootpath
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 560, in _set_initial_conftests
    self._try_load_conftest(current, namespace.importmode, rootpath)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 579, in _try_load_conftest
    self._getconftestmodules(x, importmode, rootpath)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 603, in _getconftestmodules
    mod = self._importconftest(conftestpath, importmode, rootpath)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 651, in _importconftest
    self.consider_conftest(mod)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 732, in consider_conftest
    self.register(conftestmodule, name=conftestmodule.__file__)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 496, in register
    self.consider_module(plugin)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 740, in consider_module
    self._import_plugin_specs(getattr(mod, "pytest_plugins", []))
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 747, in _import_plugin_specs
    self.import_plugin(import_spec)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/config/__init__.py", line 774, in import_plugin
    __import__(importspec)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/_pytest/assertion/rewrite.py", line [16](https://github.com/jupyter-server/jupyter_server_ydoc/actions/runs/3735497732/jobs/6344763684#step:7:17)8, in exec_module
    exec(co, module.__dict__)
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/jupyter_server/pytest_plugin.py", line 7, in <module>
    from jupyter_server.services.contents.filemanager import AsyncFileContentsManager
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/jupyter_server/services/contents/filemanager.py", line 20, in <module>
    from jupyter_server.base.handlers import AuthenticatedFileHandler
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/jupyter_server/base/handlers.py", line 23, in <module>
    from jupyter_events import EventLogger
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/jupyter_events/__init__.py", line 3, in <module>
    from .logger import EVENTS_METADATA_VERSION, EventLogger
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/jupyter_events/logger.py", line [19](https://github.com/jupyter-server/jupyter_server_ydoc/actions/runs/3735497732/jobs/6344763684#step:7:20), in <module>
    from .schema_registry import SchemaRegistry
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/jupyter_events/schema_registry.py", line 3, in <module>
    from .schema import EventSchema
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/jupyter_events/schema.py", line 8, in <module>
    from . import yaml
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/jupyter_events/yaml.py", line 4, in <module>
    from yaml import dump as ydump
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/yaml/__init__.py", line 13, in <module>
    from .cyaml import *
  File "/opt/hostedtoolcache/PyPy/3.8.15/x64/lib/pypy3.8/site-packages/yaml/cyaml.py", line 7, in <module>
    from yaml._yaml import CParser, CEmitter
  File "yaml/_yaml.pyx", line 2, in init yaml._yaml
ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
@nitzmahone
Copy link
Member

Verified on pypy3.8.16/3.9.16. Interesting that it seems only limited to PyPy, since according to cython/cython#1720, the underlying issue is Cython's legacy default to py2 relative import semantics (even on py3), which isn't a pypy-specific issue, but I don't see this warning on any CPython version I tried.

The recommended fix on the Cython issue does fix the problem, and at a glance, I don't think there's any relative/absolute import stuff happening in there. I've opened a PR with the fix, but no idea when we'll actually release it (or when GHA will pick up the fix in their runner toolcache).

Short-term, you probably need to just disable Python's warnings-as-errors for ImportWarning- unfortunately it doesn't look like you can easily module-limit it, but you could probably use a message regex if you really needed...

@davidbrochart
Copy link
Author

Thanks a lot @nitzmahone, I will just ignore the warning for now.

masklinn added a commit to masklinn/uap-python that referenced this issue Apr 5, 2023
See yaml/pyyaml#688 (and possibly cython/cython#1720), doesn't look
like there's really a better way to fix it than ignore the issue, but
that's simple enough, as it's just an additional `-W` flag on the
pytest invocation.

While at it, add pypy-3.9 and convert versions array to a yaml list for
better readability and diff-ability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
2 participants