Error installing from source
Describe the Bug
I cloned the pyrefly repository locally and wanted to install it. I ran cd pyrefly && pip install .. I got the following Rust compiler error. Is a particular rust version required?
Processing /home/bdice/code/pyrefly/pyrefly
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: pyrefly
Building wheel for pyrefly (pyproject.toml): started
Building wheel for pyrefly (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Building wheel for pyrefly (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [40 lines of output]
Running `maturin pep517 build-wheel -i /home/bdice/miniforge3/envs/dice/bin/python3.12 --compatibility off`
⚠️ Warning: `project.version` field is required in pyproject.toml unless it is present in the `project.dynamic` list
🔗 Found bin bindings
📡 Using build options bindings from pyproject.toml
Compiling zstd-safe v7.2.4
Compiling jemallocator v0.5.4
Compiling static_interner v0.1.1
Compiling pyrefly_derive v0.0.0 (/home/bdice/code/pyrefly/pyrefly_derive)
Compiling yansi v1.0.1
Compiling const-str v0.4.3
Compiling human_bytes v0.4.3
Compiling base64 v0.21.7
Compiling glob v0.3.2
error: the option `Z` is only accepted on the nightly compiler
help: consider switching to a nightly toolchain: `rustup default nightly`
note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see <https://rust-lang.github.io/rustup/concepts/index.html>
note: for more information about Rust's stability policy, see <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html#unstable-features>
error: 1 nightly option were parsed
error: could not compile `pyrefly_derive` (lib)
Caused by:
process didn't exit successfully: `rustc --crate-name pyrefly_derive --edition=2024 -Z unstable-options /home/bdice/code/pyrefly/pyrefly_derive/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C debug-assertions=off --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=b48936dfdc7c3287 -C extra-filename=-b48936dfdc7c3287 --out-dir /home/bdice/code/pyrefly/pyrefly/target/release/deps -C linker=/home/bdice/miniforge3/envs/dice/bin/x86_64-conda-linux-gnu-cc -C strip=debuginfo -L dependency=/home/bdice/code/pyrefly/pyrefly/target/release/deps --extern proc_macro2=/home/bdice/code/pyrefly/pyrefly/target/release/deps/libproc_macro2-037df9dcfec7379c.rlib --extern quote=/home/bdice/code/pyrefly/pyrefly/target/release/deps/libquote-4e10365faf8e54a5.rlib --extern syn=/home/bdice/code/pyrefly/pyrefly/target/release/deps/libsyn-61b4508c0c74e86a.rlib --extern proc_macro` (exit status: 1)
warning: build failed, waiting for other jobs to finish...
error[E0554]: `#![feature]` may not be used on the stable release channel
--> /home/bdice/.cargo/registry/src/index.crates.io-6f17d22bba15001f/static_interner-0.1.1/src/lib.rs:15:1
|
15 | #![feature(offset_of)]
| ^^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0554`.
error: could not compile `static_interner` (lib) due to 1 previous error
💥 maturin failed
Caused by: Failed to build a native library through cargo
Caused by: Cargo build finished with "exit status: 101": `env -u CARGO "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/home/bdice/code/pyrefly/pyrefly/Cargo.toml" "--release" "--bin" "pyrefly" "--" "-C" "strip=symbols"`
Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/home/bdice/miniforge3/envs/dice/bin/python3.12', '--compatibility', 'off'] returned non-zero exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyrefly
Failed to build pyrefly
ERROR: Failed to build installable wheels for some pyproject.toml based projects (pyrefly)
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response
Yes, and we have a file https://github.com/facebook/pyrefly/blob/main/pyrefly/rust-toolchain that ensures we get the right version. Not sure why it wasn't being picked up for you.
@ndmitchell Can you share the commands you use to install? I tried cd pyrefly && cargo build but it failed:
Build log
Compiling proc-macro2 v1.0.95
Compiling unicode-ident v1.0.18
Compiling libc v0.2.172
Compiling cfg-if v1.0.0
Compiling serde v1.0.219
Compiling autocfg v1.4.0
Compiling memchr v2.7.4
Compiling once_cell v1.21.3
Compiling zerocopy v0.8.25
Compiling stable_deref_trait v1.2.0
Compiling smallvec v1.15.0
Compiling shlex v1.3.0
Compiling regex-syntax v0.8.5
Compiling version_check v0.9.5
Compiling syn v1.0.109
Compiling bitflags v2.9.1
Compiling itoa v1.0.15
Compiling log v0.4.27
Compiling scopeguard v1.2.0
Compiling parking_lot_core v0.9.10
Compiling pin-project-lite v0.2.16
Compiling ryu v1.0.20
Compiling either v1.15.0
Compiling rustversion v1.0.20
Compiling lock_api v0.4.12
Compiling slab v0.4.9
Compiling linux-raw-sys v0.9.4
Compiling crossbeam-utils v0.8.21
Compiling aho-corasick v1.1.3
Compiling futures-core v0.3.31
Compiling anyhow v1.0.98
Compiling num-traits v0.2.19
Compiling siphasher v1.0.1
Compiling futures-sink v0.3.31
Compiling serde_json v1.0.140
Compiling quote v1.0.40
Compiling syn v2.0.101
Compiling jobserver v0.1.33
Compiling getrandom v0.2.16
Compiling parking_lot v0.12.3
Compiling cc v1.2.22
Compiling rand_core v0.6.4
Compiling futures-io v0.3.31
Compiling mio v1.0.3
Compiling socket2 v0.5.9
Compiling signal-hook-registry v1.4.5
Compiling castaway v0.2.3
Compiling futures-channel v0.3.31
Compiling ahash v0.8.12
Compiling regex-automata v0.4.9
Compiling pin-utils v0.1.0
Compiling ppv-lite86 v0.2.21
Compiling litemap v0.8.0
Compiling hashbrown v0.15.3
Compiling static_assertions v1.1.0
Compiling equivalent v1.0.2
Compiling pkg-config v0.3.32
Compiling futures v0.1.31
Compiling futures-task v0.3.31
Compiling writeable v0.6.1
Compiling itertools v0.10.5
Compiling rand_chacha v0.3.1
Compiling rand v0.8.5
Compiling indexmap v2.9.0
Compiling phf_shared v0.11.3
Compiling icu_properties_data v2.0.0
Compiling zstd-sys v2.0.15+zstd.1.5.7
Compiling typenum v1.18.0
Compiling parking_lot_core v0.8.6
Compiling rustix v1.0.7
Compiling icu_normalizer_data v2.0.0
Compiling phf_generator v0.11.3
Compiling generic-array v0.14.7
Compiling instant v0.1.13
Compiling unicode-width v0.1.14
Compiling allocator-api2 v0.2.21
Compiling rayon-core v1.12.1
Compiling getopts v0.2.21
Compiling phf_codegen v0.11.3
Compiling hashbrown v0.14.5
Compiling num-integer v0.1.46
Compiling crossbeam-epoch v0.9.18
Compiling filetime v0.2.25
Compiling itertools v0.11.0
Compiling ident_case v1.0.1
Compiling allocative v0.3.4
Compiling heck v0.5.0
Compiling fnv v1.0.7
Compiling zstd-safe v7.2.4
Compiling strsim v0.10.0
Compiling regex v1.11.1
Compiling dashmap v5.5.3
Compiling darling_core v0.13.4
Compiling unicode_names2_generator v1.3.0
Compiling synstructure v0.13.2
Compiling env_logger v0.8.4
Compiling quickcheck v1.0.3
Compiling num-bigint v0.4.6
Compiling crossbeam-deque v0.8.6
Compiling parking_lot v0.11.2
Compiling compact_str v0.8.1
Compiling sorted_vector_map v0.2.0
Compiling prost-derive v0.11.9
Compiling ctor v0.1.26
Compiling tracing-core v0.1.33
Compiling relative-path v1.9.3
Compiling utf8parse v0.2.2
Compiling ruff_text_size v0.0.0 (https://github.com/astral-sh/ruff/?rev=3acf4e716d5d1fb9bd1316dc268deb6824a300c8#3acf4e71)
Compiling thiserror v1.0.69
Compiling byteorder v1.5.0
Compiling bumpalo v3.17.0
Compiling unicode-width v0.2.0
Compiling darling_macro v0.13.4
Compiling xattr v1.5.0
Compiling ruff_source_file v0.0.0 (https://github.com/astral-sh/ruff/?rev=3acf4e716d5d1fb9bd1316dc268deb6824a300c8#3acf4e71)
Compiling serde_derive v1.0.219
Compiling zerofrom-derive v0.1.6
Compiling yoke-derive v0.8.0
Compiling zerovec-derive v0.11.1
Compiling displaydoc v0.2.5
Compiling futures-macro v0.3.31
Compiling tokio-macros v2.5.0
Compiling allocative_derive v0.3.3
Compiling dupe_derive v0.9.1
Compiling thiserror-impl v1.0.69
Compiling structmeta-derive v0.2.0
Compiling anstyle-parse v0.2.6
Compiling unicode_names2 v1.3.0
Compiling futures-util v0.3.31
Compiling jemalloc-sys v0.5.4+5.3.0-patched
Compiling itertools v0.14.0
Compiling fs-err v2.11.0
Compiling bitflags v1.3.2
Compiling percent-encoding v2.3.1
Compiling zerofrom v0.1.6
Compiling yoke v0.8.0
Compiling anstyle v1.0.10
Compiling tinyvec_macros v0.1.1
Compiling regex-syntax v0.6.29
Compiling zerovec v0.11.2
Compiling zerotrie v0.2.2
Compiling is_terminal_polyfill v1.70.1
Compiling powerfmt v0.2.0
Compiling portable-atomic v1.11.0
Compiling utf8_iter v1.0.4
Compiling rustix v0.38.44
Compiling anstyle-query v1.1.2
Compiling colorchoice v1.0.3
Compiling ryu v0.2.8
Compiling anstream v0.6.18
Compiling structmeta v0.2.0
Compiling deranged v0.4.0
Compiling tinyvec v1.9.0
Compiling form_urlencoded v1.2.1
Compiling tinystr v0.8.1
Compiling potential_utf v0.1.2
Compiling icu_collections v2.0.0
Compiling ruff_python_trivia v0.0.0 (https://github.com/astral-sh/ruff/?rev=3acf4e716d5d1fb9bd1316dc268deb6824a300c8#3acf4e71)
Compiling icu_locale_core v2.0.0
Compiling phf v0.11.3
Compiling dupe v0.9.1
Compiling darling v0.13.4
Compiling tar v0.4.44
Compiling is-macro v0.3.7
Compiling tracing-attributes v0.1.28
Compiling regex-automata v0.1.10
Compiling icu_provider v2.0.0
Compiling futures-executor v0.3.31
Compiling futures v0.3.31
Compiling icu_properties v2.0.0
Compiling icu_normalizer v2.0.0
Compiling terminal_size v0.4.2
Compiling block-buffer v0.10.4
Compiling crypto-common v0.1.6
Compiling blake3 v1.5.5
Compiling compact_str v0.9.0
Compiling crossbeam-channel v0.5.15
Compiling inotify-sys v0.1.5
Compiling strsim v0.11.1
Compiling unicode-segmentation v1.12.0
Compiling num-conv v0.1.0
Compiling overload v0.1.1
Compiling same-file v1.0.6
Compiling num_threads v0.1.7
Compiling atomic v0.5.3
Compiling rustc-hash v2.1.1
Compiling linux-raw-sys v0.4.15
Compiling time-core v0.1.4
Compiling subtle v2.6.1
Compiling iana-time-zone v0.1.63
Compiling toml_write v0.1.1
Compiling thiserror v2.0.12
Compiling paste v1.0.15
Compiling winnow v0.7.10
Compiling regex-syntax v0.7.5
Compiling idna_adapter v1.2.1
Compiling unicase v2.8.1
Compiling idna v1.0.3
Compiling lazy_static v1.5.0
Compiling starlark_map v0.13.0
Compiling clap_lex v0.7.4
Compiling sharded-slab v0.1.7
Compiling clap_builder v4.5.38
Compiling chrono v0.4.41
Compiling digest v0.10.7
Compiling tracing v0.1.41
Compiling time v0.3.41
Compiling ruff_python_ast v0.0.0 (https://github.com/astral-sh/ruff/?rev=3acf4e716d5d1fb9bd1316dc268deb6824a300c8#3acf4e71)
Compiling bytes v1.10.1
Compiling triomphe v0.1.14
Compiling serde_spanned v0.6.8
Compiling serde_bytes v0.11.17
Compiling tokio v1.45.0
Compiling prost v0.11.9
Compiling toml_datetime v0.6.9
Compiling prost-types v0.11.9
Compiling toml_edit v0.22.26
Compiling serde_bser v0.4.0
Compiling url v2.5.4
Compiling tracing-serde v0.2.0
Compiling bstr v1.12.0
Compiling walkdir v2.5.0
Compiling nu-ansi-term v0.46.0
Compiling inotify v0.9.6
Compiling parse-display-derive v0.8.2
Compiling matchers v0.1.0
Compiling serde_with_macros v1.5.2
Compiling unicode-normalization v0.1.24
Compiling rayon v1.10.0
Compiling console v0.15.11
Compiling serde_repr v0.1.20
Compiling enum-iterator-derive v1.4.0
Compiling thiserror-impl v2.0.12
Compiling clap_derive v4.5.32
Compiling fxhash v0.2.1
Compiling tracing-log v0.2.0
Compiling mio v0.8.11
Compiling memmap2 v0.9.5
Compiling os_str_bytes v6.6.1
Compiling path-dedot v3.1.1
Compiling thread_local v1.1.8
Compiling home v0.5.11
Compiling arrayref v0.3.9
Compiling maplit v1.0.2
Compiling tokio-util v0.6.10
Compiling constant_time_eq v0.3.1
Compiling itoa v0.4.8
Compiling arrayvec v0.7.6
Compiling hex v0.4.3
Compiling number_prefix v0.4.0
Compiling serde_jsonrc v0.1.0
Compiling indicatif v0.17.11
Compiling serde_with v1.14.0
Compiling lock_free_hashtable v0.1.1
Compiling static_interner v0.1.1
error[E0554]: `#![feature]` may not be used on the stable release channel
--> /home/bdice/.cargo/registry/src/index.crates.io-6f17d22bba15001f/static_interner-0.1.1/src/lib.rs:15:1
|
15 | #![feature(offset_of)]
| ^^^^^^^^^^^^^^^^^^^^^^
Compiling watchman_client v0.9.0
For more information about this error, try `rustc --explain E0554`.
error: could not compile `static_interner` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
I also tried cd pyrefly && maturin develop but that failed too:
⚠️ Warning: `project.version` field is required in pyproject.toml unless it is present in the `project.dynamic` list
🔗 Found bin bindings
📡 Using build options bindings from pyproject.toml
⚠️ Warning: `project.version` field is required in pyproject.toml unless it is present in the `project.dynamic` list
💥 maturin failed
Caused by: Cannot build without valid version information. You need to specify either `project.version` or `project.dynamic = ["version"]` in pyproject.toml.
I have rustc 1.84.0 and cargo 1.84.0. I don't know how to make it use the rust-toolchain file.
What do you get for:
$ rustup --version
rustup 1.28.1 (f9edccde0 2025-03-05)
If you are at PyCon, please drop into the Pyrefly room and I'd happily debug.
This only works if rust is installed using rustup - which isn't always the case.
https://github.com/conda-forge/staged-recipes/pull/30079 <- build is failing due to nightly rust not being available.
Is it possible to build this project with stable rust?
Sorry I didn’t get a chance to stop by at PyCon. I am not using rustup, which might explain the problem.
Similar issue here, can't compile because of no #![feature(offset_of)]. No rustup either, I guess it's a requirement?
macOS 15.5 Xcode 16.3 Build version 16E140 rustc 1.87.0 (17067e9ac 2025-05-09) (Homebrew)
I'm going to close this issue since it's fairly old, and we have already another issue for using stable rust (https://github.com/facebook/pyrefly/issues/374). Please comment or open a new issue if you have a problem with installing pyrefly from source that wouldn't be fixed by https://github.com/facebook/pyrefly/issues/374.