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

test_input_formats failing on pypy3 #1375

Closed
atugushev opened this issue Apr 4, 2021 · 8 comments
Closed

test_input_formats failing on pypy3 #1375

atugushev opened this issue Apr 4, 2021 · 8 comments
Labels
bug Something is not working help wanted Request help from the community tests Testing and related things

Comments

@atugushev
Copy link
Member

atugushev commented Apr 4, 2021

Introduced in #1356.

2021-04-04T00:25:09.6159906Z         out = runner.invoke(cli, ["-n", "--find-links", dists_path, path])
2021-04-04T00:25:09.6160556Z >       assert out.exit_code == 0, out.stderr
2021-04-04T00:25:09.6161090Z E       AssertionError: 
2021-04-04T00:25:09.6161502Z E       assert 1 == 0
2021-04-04T00:25:09.6163174Z E        +  where 1 = <Result BackendUnavailable('Traceback (most recent call last):\n  File "/home/runner/work/pip-tools/pip-tools/.tox/pip... importlib._bootstrap>", line 962, in _find_and_load_unlocked\nModuleNotFoundError: No module named \'flit_core\'\n',)>.exit_code

...

2021-04-04T00:25:10.3688000Z >       assert out.exit_code == 0, out.stderr
2021-04-04T00:25:10.3688554Z E       AssertionError: 
2021-04-04T00:25:10.3689037Z E       assert 1 == 0
2021-04-04T00:25:10.3690850Z E        +  where 1 = <Result BackendUnavailable('Traceback (most recent call last):\n  File "/home/runner/work/pip-tools/pip-tools/.tox/pip...zen importlib._bootstrap>", line 962, in _find_and_load_unlocked\nModuleNotFoundError: No module named \'poetry\'\n',)>.exit_code

See logs for details.

/cc: @orsinium

@atugushev atugushev added bug Something is not working tests Testing and related things labels Apr 4, 2021
@webknjaz
Copy link
Member

webknjaz commented Apr 4, 2021

No module named 'poetry'\n',)

Looks like the trailing quote and line feed get into the name during parsing?

@atugushev why don't we run pypy jobs on PRs? They are not that heavy and being executed in parallel with the other jobs, the overall workflow completion would be barely noticeable.
Besides, I noticed that there's no caching set up in GHA, fixing this should make things even faster.

@webknjaz
Copy link
Member

webknjaz commented Apr 4, 2021

Oh, and if we ever get that "auto-merge" feature on, there will be even fewer reasons to care about the CI completion time. cc @jezdez

@atugushev
Copy link
Member Author

@webknjaz

We moved pypy to the cron workflow because they were too slow. However, there were pypy2 jobs also at that time, but now there are only two jobs. It would be great to improve speed and move these jobs to PRs test workflow.

image

@atugushev
Copy link
Member Author

atugushev commented Apr 5, 2021

Looks like the trailing quote and line feed get into the name during parsing?

It was just a bad repr (perhaps, a bug in pytest). Full traceback here:

Traceback (most recent call last):
  File "/Users/albert/Projects/pip-tools/tests/test_cli_compile.py", line 1773, in test_input_formats
    out = runner.invoke(cli, ["-n", "--find-links", dists_path, path], catch_exceptions=False)
  File "/Users/albert/Projects/pip-tools/.venv/site-packages/click/testing.py", line 329, in invoke
    cli.main(args=args or (), prog_name=prog_name, **extra)
  File "/Users/albert/Projects/pip-tools/.venv/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/albert/Projects/pip-tools/.venv/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/albert/Projects/pip-tools/.venv/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/albert/Projects/pip-tools/.venv/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/albert/Projects/pip-tools/piptools/scripts/compile.py", line 363, in cli
    dist = meta.load(os.path.dirname(os.path.abspath(src_file)))
  File "/Users/albert/Projects/pip-tools/.venv/site-packages/pep517/meta.py", line 71, in load
    path = Path(build_as_zip(builder))
  File "/Users/albert/Projects/pip-tools/.venv/site-packages/pep517/meta.py", line 58, in build_as_zip
    builder(dest=out_dir)
  File "/Users/albert/.pyenv/versions/pypy3.6-7.3.3/lib_pypy/_functools.py", line 80, in __call__
    return self._func(*(self._args + fargs), **fkeywords)
  File "/Users/albert/Projects/pip-tools/.venv/site-packages/pep517/meta.py", line 53, in build
    _prep_meta(hooks, env, dest)
  File "/Users/albert/Projects/pip-tools/.venv/site-packages/pep517/meta.py", line 28, in _prep_meta
    reqs = hooks.get_requires_for_build_wheel({})
  File "/Users/albert/Projects/pip-tools/.venv/site-packages/pep517/wrappers.py", line 169, in get_requires_for_build_wheel
    'config_settings': config_settings
  File "/Users/albert/Projects/pip-tools/.venv/site-packages/pep517/wrappers.py", line 275, in _call_hook
    raise BackendUnavailable(data.get('traceback', ''))
pep517.wrappers.BackendUnavailable: Traceback (most recent call last):
  File "/Users/albert/Projects/pip-tools/.venv/site-packages/pep517/in_process/_in_process.py", line 86, in _build_backend
    obj = import_module(mod_path)
  File "/Users/albert/.pyenv/versions/pypy3.6-7.3.3/lib-python/3/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1003, in _gcd_import
  File "<frozen importlib._bootstrap>", line 980, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1003, in _gcd_import
  File "<frozen importlib._bootstrap>", line 980, in _find_and_load
  File "<frozen importlib._bootstrap>", line 962, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'flit_core'

@orsinium
Copy link
Contributor

orsinium commented Apr 6, 2021

Interesting. Looks like build-system.requires wasn't installed by pip.

@AndydeCleyre
Copy link
Contributor

I was able to reproduce locally on Linux with (pypy3.6-7.3.3, pypy3.7-7.3.2, pypy3.7-7.3.3), though the problem did not occur when I additionally created a requirements.in file with the content: ., and pip-compiled against that.

So here's a pytest-less reproduction procedure:

% mkdir -p workdir && cd workdir
% mkdir -p sample_lib && print -l "'example module'" "__version__ = '1.2.3'" >sample_lib/__init__.py
% eval "$(pyenv init - zsh)"
% pyenv install pypy3.6-7.3.3
% pyenv shell pypy3.6-7.3.3
% python -m venv venv
% . ./venv/bin/activate
% pip install -e PATH/TO/PIP-TOOLS
% $EDITOR pyproject.toml  # paste content from the flit test case
% pip-compile -f PATH/TO/PIP-TOOLS/tests/test_data/packages -f PATH/TO/PIP-TOOLS/tests/test_data/minimal_wheels pyproject.toml

It's not strictly necessary to specify the find-links or create the sample lib just to observe this, as the error is raised before any of those others would be anyway, I think.

It does look like flit-core gets installed, somewhere.

Notably, this succeeds:

% pip install -f PATH/TO/PIP-TOOLS/tests/test_data/packages -f PATH/TO/PIP-TOOLS/tests/test_data/minimal_wheels .

Perhaps even more notably, the pip-compile command succeeds if I don't explicitly create a venv, but rather just use pyenv's default activated venv for a pypy version. I also see though that pip --version reveals that the pyenv shim points to /usr/lib/python3.9/site-packages/pip. So I try:

$ python -m pip install -U pip

Now the shim points to pypy's pip, but the command succeeds again, anyway.

@atugushev
Copy link
Member Author

Cross reference pypa/pyproject-hooks#116

ssbarnea added a commit that referenced this issue Jun 19, 2021
ssbarnea added a commit that referenced this issue Jun 20, 2021
* Add PyPy jobs to PR CI runs

* Mark known broken tests with xfail

Related: #1375

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Use PyPy3.7 instead of 3.6 in CI

* Fix PyPy 3.7 declaration syntax

Co-authored-by: Sorin Sbarnea <ssbarnea@redhat.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
AndydeCleyre added a commit to AndydeCleyre/pip-tools that referenced this issue May 31, 2022
@atugushev
Copy link
Member Author

Fixed by #1629

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working help wanted Request help from the community tests Testing and related things
Projects
None yet
Development

No branches or pull requests

4 participants