Skip to content

Running pep517.build (only with setuptools?) on PyPy does not fetch the backend / fails with BackendUnavailable #74

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

Closed
Julian opened this issue Dec 11, 2019 · 3 comments

Comments

@Julian
Copy link

Julian commented Dec 11, 2019

Full reproducer:

somepython=pypy
rm -rf venv pep517-venv foo && \
"$somepython" ~/Development/virtualenv/virtualenv.py --quiet venv && \
venv/bin/python -m pip install --quiet mkpkg && \
venv/bin/mkpkg foo && \
venv/bin/python ~/Development/virtualenv/virtualenv.py --no-setuptools pep517-venv && \
pep517-venv/bin/python -m pip install --quiet pep517 && \
pep517-venv/bin/python -m pep517.build foo

fails with:

  No LICENSE.txt / LICENSE found in source
/Users/julian/Desktop/venv/site-packages/pip/_vendor/msgpack/fallback.py:133: DeprecationWarning: encoding is deprecated, Use raw=False instead.
  unpacker = Unpacker(None, max_buffer_size=len(packed), **kwargs)
Set up CI at: https://travis-ci.com/Julian/foo
Using real prefix '/usr/local/Cellar/pypy/7.2.0/libexec'
  No LICENSE.txt / LICENSE found in source
Path not in prefix '/Users/julian/Desktop/venv/include' '/usr/local/Cellar/pypy/7.2.0/libexec'
New pypy executable in /Users/julian/Desktop/pep517-venv/bin/python
Also creating executable in /Users/julian/Desktop/pep517-venv/bin/pypy
Installing pip, wheel...
done.
/Users/julian/Desktop/pep517-venv/site-packages/pip/_vendor/msgpack/fallback.py:133: DeprecationWarning: encoding is deprecated, Use raw=False instead.
  unpacker = Unpacker(None, max_buffer_size=len(packed), **kwargs)
No handlers could be found for logger "pep517.envbuild"
Traceback (most recent call last):
  File "/usr/local/Cellar/pypy/7.2.0/libexec/lib-python/2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/Cellar/pypy/7.2.0/libexec/lib-python/2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/julian/Desktop/pep517-venv/site-packages/pep517/build.py", line 124, in <module>
    main(parser.parse_args())
  File "/Users/julian/Desktop/pep517-venv/site-packages/pep517/build.py", line 120, in main
    build(args.source_dir, dist, args.out_dir)
  File "/Users/julian/Desktop/pep517-venv/site-packages/pep517/build.py", line 88, in build
    _do_build(hooks, env, dist, dest)
  File "/Users/julian/Desktop/pep517-venv/site-packages/pep517/build.py", line 61, in _do_build
    reqs = get_requires({})
  File "/Users/julian/Desktop/pep517-venv/site-packages/pep517/wrappers.py", line 213, in get_requires_for_build_sdist
    'config_settings': config_settings
  File "/Users/julian/Desktop/pep517-venv/site-packages/pep517/wrappers.py", line 265, in _call_hook
    raise BackendUnavailable(data.get('traceback', ''))
BackendUnavailable

which seems to only fail on PyPy, because on CPython changing somepython=python3.6 and rerunning seems to succeed.

For ease, the (generated) pyproject.toml in that stub package is:

[build-system]
requires = [
    # The minimum setuptools version is specific to the PEP 517 backend,
    # and may be stricter than the version required in `setup.py`
    "setuptools>=40.6.0",
    "setuptools_scm",
    "wheel",
]
build-backend = "setuptools.build_meta"
Julian added a commit to Julian/mkpkg that referenced this issue Dec 11, 2019
@Julian
Copy link
Author

Julian commented Dec 11, 2019

(In case anyone else encounters this in the meanwhile, manually installing the build deps fixes it, see this commit and its GitHub Action run for example).

Julian added a commit to Julian/svmlight-loader that referenced this issue Dec 11, 2019
@oberstet
Copy link

oberstet commented Jan 15, 2020

also running into this. howeever, even after doing pip install -U setuptools setuptools-scm pip wheel, I am still running into:

Collecting crossbar
  Cloning https://github.com/crossbario/crossbar.git (to revision master) to /tmp/pip-install-0bk26s3h/crossbar
  Running command git clone -q https://github.com/crossbario/crossbar.git /tmp/pip-install-0bk26s3h/crossbar
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
ERROR: Exception:
Traceback (most recent call last):
  File "/home/oberstet/pypy36_1/site-packages/pip/_internal/cli/base_command.py", line 153, in _main
    status = self.run(options, args)
  File "/home/oberstet/pypy36_1/site-packages/pip/_internal/commands/install.py", line 382, in run
    resolver.resolve(requirement_set)
  File "/home/oberstet/pypy36_1/site-packages/pip/_internal/legacy_resolve.py", line 201, in resolve
    self._resolve_one(requirement_set, req)
  File "/home/oberstet/pypy36_1/site-packages/pip/_internal/legacy_resolve.py", line 365, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/oberstet/pypy36_1/site-packages/pip/_internal/legacy_resolve.py", line 313, in _get_abstract_dist_for
    req, self.session, self.finder, self.require_hashes
  File "/home/oberstet/pypy36_1/site-packages/pip/_internal/operations/prepare.py", line 224, in prepare_linked_requirement
    req, self.req_tracker, finder, self.build_isolation,
  File "/home/oberstet/pypy36_1/site-packages/pip/_internal/operations/prepare.py", line 49, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/home/oberstet/pypy36_1/site-packages/pip/_internal/distributions/source/legacy.py", line 37, in prepare_distribution_metadata
    self._setup_isolation(finder)
  File "/home/oberstet/pypy36_1/site-packages/pip/_internal/distributions/source/legacy.py", line 90, in _setup_isolation
    reqs = backend.get_requires_for_build_wheel()
  File "/home/oberstet/pypy36_1/site-packages/pip/_vendor/pep517/wrappers.py", line 152, in get_requires_for_build_wheel
    'config_settings': config_settings
  File "/home/oberstet/pypy36_1/site-packages/pip/_vendor/pep517/wrappers.py", line 255, in _call_hook
    raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pep517.wrappers.BackendUnavailable: Traceback (most recent call last):
  File "/home/oberstet/pypy36_1/site-packages/pip/_vendor/pep517/_in_process.py", line 63, in _build_backend
    obj = import_module(mod_path)
  File "/home/oberstet/pypy3.6-v7.3.0-linux64/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 964, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 674, in _load_unlocked
  File "<builtin>/frozen importlib._bootstrap_external", line 691, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/tmp/pip-build-env-y2_d_h9p/overlay/site-packages/setuptools/__init__.py", line 18, in <module>
    import setuptools.version
  File "/tmp/pip-build-env-y2_d_h9p/overlay/site-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
  File "/tmp/pip-build-env-y2_d_h9p/overlay/site-packages/pkg_resources/__init__.py", line 36, in <module>
    import email.parser
  File "/home/oberstet/pypy3.6-v7.3.0-linux64/lib-python/3/email/parser.py", line 12, in <module>
    from email.feedparser import FeedParser, BytesFeedParser
  File "/home/oberstet/pypy3.6-v7.3.0-linux64/lib-python/3/email/feedparser.py", line 27, in <module>
    from email._policybase import compat32
  File "/home/oberstet/pypy3.6-v7.3.0-linux64/lib-python/3/email/_policybase.py", line 9, in <module>
    from email.utils import _has_surrogates
  File "/home/oberstet/pypy3.6-v7.3.0-linux64/lib-python/3/email/utils.py", line 28, in <module>
    import random
  File "/home/oberstet/pypy3.6-v7.3.0-linux64/lib-python/3/random.py", line 46, in <module>
    from hashlib import sha512 as _sha512
ImportError: cannot import name 'sha512'

Makefile:188: recipe for target 'install' failed
make: *** [install] Error 2

but this works

(pypy36_1) oberstet@intel-nuci7:~/scm/crossbario/crossbarfx$ which python
/home/oberstet/pypy36_1/bin/python
(pypy36_1) oberstet@intel-nuci7:~/scm/crossbario/crossbarfx$ python -c "from hashlib import sha512 as _sha512"

is there a way to disable this pep517 stuff altogether?

Julian added a commit to Julian/dotfiles that referenced this issue Jan 24, 2020
@pradyunsg
Copy link
Member

pradyunsg commented Aug 27, 2020

This seems to be #49+#45, and in the spirit of limited-time-triage, I'll go ahead and close this based on that judgement. Please holler if that looks wrong! :)

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

3 participants