Cannot install glean_sdk Python package on platforms for which a binary wheel is not supplied
Categories
(Data Platform and Tools :: Glean: SDK, defect, P1)
Tracking
(Not tracked)
People
(Reporter: rstewart, Assigned: mdroettboom)
References
Details
The glean_sdk
package (which we imminently plan on using for mach
, the entry point to Firefox development tools), can't be installed on platforms for which a binary wheel is not provided. This includes Apple Silicon as well as OpenBSD.
Ideally it seems to me that glean_sdk
should build from source if a binary wheel can't be installed.
Updated•4 years ago
|
Comment 1•4 years ago
|
||
Mike, is there anything we could do here?
Jan-Erik suggests to at least "do nothing" if the wheel is not available, meaning it should not crash "mach" and just not report any telemetry.
Assignee | ||
Comment 2•4 years ago
|
||
Thanks for the report.
Building from source would require a Rust compiler installed. Additionally, the package isn't really set up to build from source right now, given the layout of the repo. I guess we should work to do a best effort to try to compile (which will fail in the absence of a Rust compiler), and barring that have a "do nothing" pure Python thing.
Assignee | ||
Updated•4 years ago
|
Reporter | ||
Comment 3•4 years ago
|
||
At least on the mach
side -- we require rustc
in order to build Firefox, so anyone who's doing any serious work on Firefox WILL have rustc
somewhere. Whatever you land on, we can do some extra legwork on our part to make sure rustc
gets found by pip
(e.g. if we have to set an environment variable or something).
Assignee | ||
Comment 4•4 years ago
|
||
Great! This PR should make this possible. Once we tag a new release and ship it to PyPI, I'll perhaps ask you, :rstewart, to test it in context and then we can close this...
Assignee | ||
Comment 5•4 years ago
|
||
:rstewart -- would you mind giving this a test?
Reporter | ||
Comment 6•4 years ago
|
||
Hey, yeah, can you give me a little more guidance on how to ensure this works? I tried python3 setup.py install
, but that doesn't build the Rust code (and installs a broken version of the package)...
Assignee | ||
Comment 7•4 years ago
|
||
python3 setup.py build install
should work (and build the Rust code) in a git checkout.
But more importantly, the source distribution is now on PyPI now, so pip install glean_sdk
(in a fresh virtual environment) should (hopefully) work, but that's what I was hoping you could test on one of these alternative platforms.
Reporter | ||
Comment 8•4 years ago
|
||
glandium, can you check that installing the latest version of glean_sdk
no longer fails on Apple Silicon?
Comment 9•4 years ago
|
||
It fails, and it's not very verbose about why:
Using version 32.4.0 (newest of versions: 0.0.0, 32.4.0)
Collecting glean_sdk
Created temporary directory: /private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-unpack-iqz0w0nv
Looking up "https://files.pythonhosted.org/packages/cf/3a/9529b30741487666c14ce41731c4eb25d9b5d83bad38d162e6af82ad04e2/glean-sdk-32.4.0.tar.gz" in the cache
Current age based on date: 139
Ignoring unknown cache-control directive: immutable
Freshness lifetime from max-age: 365000000
The response is "fresh", returning cached response
365000000 > 139
Using cached https://files.pythonhosted.org/packages/cf/3a/9529b30741487666c14ce41731c4eb25d9b5d83bad38d162e6af82ad04e2/glean-sdk-32.4.0.tar.gz
Added glean_sdk from https://files.pythonhosted.org/packages/cf/3a/9529b30741487666c14ce41731c4eb25d9b5d83bad38d162e6af82ad04e2/glean-sdk-32.4.0.tar.gz#sha256=3b50be6fc271225bdd95262d1fbdeaca3a97e986082afae2106e71e2034fce28 to build tracker '/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-req-tracker-ideopohm'
Running setup.py (path:/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-rlf2q0z1/glean-sdk/setup.py) egg_info for package glean-sdk
Running command python setup.py egg_info
Cleaning up...
Removing source in /private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-rlf2q0z1/glean-sdk
Removed glean_sdk from https://files.pythonhosted.org/packages/cf/3a/9529b30741487666c14ce41731c4eb25d9b5d83bad38d162e6af82ad04e2/glean-sdk-32.4.0.tar.gz#sha256=3b50be6fc271225bdd95262d1fbdeaca3a97e986082afae2106e71e2034fce28 from build tracker '/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-req-tracker-ideopohm'
Removed build tracker '/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-req-tracker-ideopohm'
ERROR: Files/directories not found in /private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-rlf2q0z1/glean-sdk/pip-egg-info
Exception information:
Traceback (most recent call last):
File "/Users/glandium/gecko-dev/obj-aarch64-apple-darwin20.1.0/_virtualenvs/init_py3/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 153, in _main
status = self.run(options, args)
File "/Users/glandium/gecko-dev/obj-aarch64-apple-darwin20.1.0/_virtualenvs/init_py3/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 382, in run
resolver.resolve(requirement_set)
File "/Users/glandium/gecko-dev/obj-aarch64-apple-darwin20.1.0/_virtualenvs/init_py3/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py", line 201, in resolve
self._resolve_one(requirement_set, req)
File "/Users/glandium/gecko-dev/obj-aarch64-apple-darwin20.1.0/_virtualenvs/init_py3/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py", line 365, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/Users/glandium/gecko-dev/obj-aarch64-apple-darwin20.1.0/_virtualenvs/init_py3/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py", line 312, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(
File "/Users/glandium/gecko-dev/obj-aarch64-apple-darwin20.1.0/_virtualenvs/init_py3/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 223, in prepare_linked_requirement
abstract_dist = _get_prepared_distribution(
File "/Users/glandium/gecko-dev/obj-aarch64-apple-darwin20.1.0/_virtualenvs/init_py3/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 49, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(finder, build_isolation)
File "/Users/glandium/gecko-dev/obj-aarch64-apple-darwin20.1.0/_virtualenvs/init_py3/lib/python3.8/site-packages/pip/_internal/distributions/source/legacy.py", line 39, in prepare_distribution_metadata
self.req.prepare_metadata()
File "/Users/glandium/gecko-dev/obj-aarch64-apple-darwin20.1.0/_virtualenvs/init_py3/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 563, in prepare_metadata
self.metadata_directory = metadata_generator(self)
File "/Users/glandium/gecko-dev/obj-aarch64-apple-darwin20.1.0/_virtualenvs/init_py3/lib/python3.8/site-packages/pip/_internal/operations/generate_metadata.py", line 128, in _generate_metadata_legacy
return _find_egg_info(
File "/Users/glandium/gecko-dev/obj-aarch64-apple-darwin20.1.0/_virtualenvs/init_py3/lib/python3.8/site-packages/pip/_internal/operations/generate_metadata.py", line 81, in _find_egg_info
raise InstallationError(
pip._internal.exceptions.InstallationError: Files/directories not found in /private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-rlf2q0z1/glean-sdk/pip-egg-info
Comment 10•4 years ago
|
||
Top-level setup.py
says this:
A basic top-level setup.py script that delegates to the real one in
glean-core/python/setup.py
The code does this:
sys.path.insert(0, str((Path(__file__).parent / "glean-core" / "python").resolve()))
from setup import *
But there is actually no glean-core/python/setup.py
, so I guess this from setup import *
just imports everything from itself and does nothing.
Comment 11•4 years ago
|
||
I peaked at the released source package and it is indeed missing the files. We might have missed something in our packaging step.
Note: there's no official support for the Rust compiler on Apple Silicon yet, so unless you have a custom build of the Rust toolchain it will still fail to install the package.
Assignee | ||
Comment 12•4 years ago
|
||
Yeah -- indeed that source package (from CI) is quite different from the one built on my machine locally. I guess I need to get to the bottom of what is different in CI...
Assignee | ||
Comment 13•4 years ago
|
||
The latest 33.0.1 package now contains the correct files. :glandium or :rstewart, if you wouldn't mind trying again? (Understanding the issues with a lack of rust compiler on Apple Silicon)...
Reporter | ||
Comment 14•4 years ago
|
||
We'll have to wait for glandium, I only have a regular old macbook :)
Comment 15•4 years ago
|
||
It now fails with:
Running setup.py (path:/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-xasvas5f/glean-sdk/setup.py) egg_info for package glean-sdk
Created temporary directory: /private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-pip-egg-info-5dp4yygk
Running command python setup.py egg_info
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-xasvas5f/glean-sdk/setup.py", line 16, in <module>
from setup import *
File "/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-xasvas5f/glean-sdk/glean-core/python/setup.py", line 152, in <module>
setup(
File "/Users/glandium/v/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/Applications/Xcode-beta.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/Users/glandium/v/lib/python3.8/site-packages/setuptools/dist.py", line 423, in __init__
_Distribution.__init__(self, {
File "/Applications/Xcode-beta.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 292, in __init__
self.finalize_options()
File "/Users/glandium/v/lib/python3.8/site-packages/setuptools/dist.py", line 695, in finalize_options
ep(self)
File "/Users/glandium/v/lib/python3.8/site-packages/setuptools/dist.py", line 702, in _finalize_setup_keywords
ep.load()(self, ep.name, value)
File "/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-xasvas5f/glean-sdk/.eggs/cffi-1.14.3-py3.8-macosx-10.14.6-arm64.egg/cffi/setuptools_ext.py", line 219, in cffi_modules
add_cffi_module(dist, cffi_module)
File "/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-xasvas5f/glean-sdk/.eggs/cffi-1.14.3-py3.8-macosx-10.14.6-arm64.egg/cffi/setuptools_ext.py", line 49, in add_cffi_module
execfile(build_file_name, mod_vars)
File "/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-xasvas5f/glean-sdk/.eggs/cffi-1.14.3-py3.8-macosx-10.14.6-arm64.egg/cffi/setuptools_ext.py", line 25, in execfile
exec(code, glob, glob)
File "/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-xasvas5f/glean-sdk/glean-core/python/ffi_build.py", line 35, in <module>
ffibuilder = cffi.FFI()
File "/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-xasvas5f/glean-sdk/.eggs/cffi-1.14.3-py3.8-macosx-10.14.6-arm64.egg/cffi/api.py", line 48, in __init__
import _cffi_backend as backend
ImportError: dlopen(/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-xasvas5f/glean-sdk/.eggs/cffi-1.14.3-py3.8-macosx-10.14.6-arm64.egg/_cffi_backend.cpython-38-darwin.so, 2): no suitable image found. Did find:
/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-xasvas5f/glean-sdk/.eggs/cffi-1.14.3-py3.8-macosx-10.14.6-arm64.egg/_cffi_backend.cpython-38-darwin.so: code signature in (/private/var/folders/mk/ql7ml6k575z7822gg2q4wzg40000gn/T/pip-install-xasvas5f/glean-sdk/.eggs/cffi-1.14.3-py3.8-macosx-10.14.6-arm64.egg/_cffi_backend.cpython-38-darwin.so) not valid for use in process using Library Validation: Trying to load an unsigned library
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
which seems like something that should be reproducible on Big Sur beta on a x86 mac if you disable installing wheels.
Comment 16•4 years ago
|
||
That looks like it's failing to load the cffi library because of a missing code signature and I guess Big Sur enforces a signature on all compiled code?
That is probably something that will be fixed upstream eventually.
I don't have a machine to run Big Sur beta on so I won't be able to test this out.
Maybe we can find a way to essentially install a "no-op (no-compile)" version of Glean if the platform is unsupported, so that the tools at least keep working, even if we don't get telemetry data out of it?
wdyt, :mdroettboom? Is the Python pip installation process flexible enough so we can do this, until we get it to work on newer macOS and eventually Apple Silicon?
Assignee | ||
Comment 17•4 years ago
|
||
I don't know if we could install a different package depending on this context (certainly not a different source package). But we could swap everything out for a stub implementation at import time...
If we have this problem, I'm certain other Python packages that install from source are also running into it, so maybe there's some prior art. Distutils may be signing for the user when it compiles C/C++ ... We are of course bypassing any compilation that distutils does here because it doesn't support rust/cargo...
Assignee | ||
Comment 18•4 years ago
|
||
Also, I wonder if the code signing problem is actually in cffi, not in the Glean shared library (the error message is a little ambiguous).
Does installing cffi from a prebuilt source that presumably has worked this out (like homebrew) resolve the issue?
Comment 20•3 years ago
|
||
Fwiw, stumbled upon this issue after being told to use the moz-phab contraption in https://bugzilla.mozilla.org/show_bug.cgi?id=1680269#c17, i know its "the way to manipulate and access patches etc etc".
sadly, glean-core doesnt install on OpenBSD, so i cant install moz-phab.
$pip3.8 install --user MozPhab
Collecting MozPhab
Downloading MozPhab-0.1.93.tar.gz (75 kB)
|________________________________| 75 kB 242 kB/s
Collecting distro
Downloading distro-1.5.0-py2.py3-none-any.whl (18 kB)
Collecting glean-sdk==33.0.4
Downloading glean-sdk-33.0.4.tar.gz (1.3 MB)
|________________________________| 1.3 MB 1.3 MB/s
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uwjitp1t/glean-sdk/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uwjitp1t/glean-sdk/setup.py'"'"';f=getattr(tokenize, '"'"'ope
n'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-fxq2nzf6
cwd: /tmp/pip-install-uwjitp1t/glean-sdk/
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-uwjitp1t/glean-sdk/setup.py", line 16, in <module>
from setup import *
File "/tmp/pip-install-uwjitp1t/glean-sdk/glean-core/python/setup.py", line 82, in <module>
raise ValueError(f"The platform {sys.platform} is not supported.")
ValueError: The platform openbsd6 is not supported.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
We're used to being tier3/unsupported, but this is too hostile for external contributors.
Comment 21•3 years ago
|
||
seems https://github.com/mozilla/glean/commit/0b8bb11b19d98cd45af7677486eafbc9e0065ce6 / https://github.com/mozilla/glean/pull/1363 will help. will retest once its released..but moz-phab so far requires 33.0.4, so wont really help moz-phab for now.
Comment 22•3 years ago
|
||
Sorry about that, I justed merged a patch that should enable BSD support, so if everything else is set up it should be possible to use it there (it will still require a release today and moz-phab then needs to pull in that version)
Assignee | ||
Comment 23•3 years ago
|
||
Sorry about the glitch here -- In general in this design, I was trying to not overpromise what we support, but obviously the Tier 3 platforms fell through the cracks.
We have considered making telemetry a no-op for platforms we aren't able to internally support, but that would result in never hearing from those platforms, which I think would have been far worse.
Comment 24•3 years ago
|
||
(In reply to Michael Droettboom [:mdroettboom] from comment #23)
We have considered making telemetry a no-op for platforms we aren't able to internally support, but that would result in never hearing from those platforms, which I think would have been far worse.
that's also why on OpenBSD in the packaging goo i dont disable telemetry by default (some users hate me for that) so that at least we appear somewhere on the dashboards, even if upstream doesnt care much..
Assignee | ||
Comment 25•3 years ago
|
||
Closing -- the source package is now installable most places (for platforms where it's not feasible to produce binary wheels).
Description
•