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

bump deps and fix build #1

Closed
wants to merge 2 commits into from
Closed

Conversation

rotu
Copy link

@rotu rotu commented Mar 19, 2022

No description provided.

@rotu rotu marked this pull request as draft March 19, 2022 11:53
@rotu
Copy link
Author

rotu commented Mar 19, 2022

Hmmm... I don't understand enough to replace that call to register_any. @programmerjake could you help out?

@programmerjake
Copy link
Owner

Updating pyo3 to a newer version would require rewriting a major portion of the python bindings (pyo3 changed their APIs quite a bit), I don't have the spare time to do that at the moment. If you don't need python support, I can push a new branch with the updated dependency versions, but with python support removed. I don't want to publish that to crates.io though, since missing python support is a major deficiency imho.

If you, or someone else, want to work on this, go ahead!

@programmerjake programmerjake added the help wanted Extra attention is needed label Mar 21, 2022
@rotu
Copy link
Author

rotu commented Mar 21, 2022

I do need Python support, unfortunately. But it might work without bumping pyo3. Here's the error that caused pip install to fail:

pip install algebraics

Collecting algebraics
  Using cached algebraics-0.2.0.tar.gz (131 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: algebraics
  Building wheel for algebraics (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for algebraics (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [54 lines of output]
      Running `maturin pep517 build-wheel -i /Users/dan/.pyenv/versions/pypy3.9-7.3.8/bin/python --compatibility off`
      ⚠️  Warning: Please use maturin in pyproject.toml with a version constraint, e.g. `requires = ["maturin>=0.12,<0.13"]`. This will become an error.
      📡 Using build options cargo-extra-args, bindings from pyproject.toml
         Compiling proc-macro2 v1.0.36
         Compiling unicode-xid v0.2.2
         Compiling autocfg v1.1.0
         Compiling syn v1.0.89
         Compiling proc-macro-hack v0.5.19
         Compiling serde_derive v1.0.136
         Compiling libc v0.2.121
         Compiling serde v1.0.136
         Compiling serde_json v1.0.79
         Compiling ryu v1.0.9
         Compiling itoa v1.0.1
         Compiling regex-syntax v0.6.25
         Compiling unindent v0.1.8
         Compiling cfg-if v0.1.10
         Compiling smallvec v1.8.0
         Compiling rand_core v0.4.2
         Compiling version_check v0.9.4
         Compiling scopeguard v1.1.0
         Compiling inventory v0.1.11
         Compiling lazy_static v1.4.0
         Compiling autocfg v0.1.8
         Compiling num-traits v0.2.14
         Compiling num-integer v0.1.44
         Compiling num-bigint v0.2.6
         Compiling num-rational v0.2.4
         Compiling lock_api v0.3.4
         Compiling rand_core v0.3.1
         Compiling rand_pcg v0.1.2
      error: could not compile `lock_api` due to 2 previous errors
      warning: build failed, waiting for other jobs to finish...
      error: build failed
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `cargo rustc --manifest-path Cargo.toml --message-format json --features python-extension --release --lib -- -C link-arg=-undefined -C link-arg=dynamic_lookup -C link-args=-Wl,-install_name,@rpath/algebraics.pypy39-pp73-darwin.so`
      🔗 Found pyo3 bindings
      🐍 Found PyPy 3.9 at /Users/dan/.pyenv/versions/pypy3.9-7.3.8/bin/python
      error[E0557]: feature has been removed
        --> /Users/dan/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/lock_api-0.3.4/src/lib.rs:91:42
         |
      91 | #![cfg_attr(feature = "nightly", feature(const_fn))]
         |                                          ^^^^^^^^ feature has been removed
         |
         = note: split into finer-grained feature gates
      
      
      error: aborting due to previous error
      
      
      For more information about this error, try `rustc --explain E0557`.
      
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/Users/dan/.pyenv/versions/pypy3.9-7.3.8/bin/python', '--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 algebraics
Failed to build algebraics
ERROR: Could not build wheels for algebraics, which is required to install pyproject.toml-based projects

@programmerjake
Copy link
Owner

try changing your default version of Rust to nightly-2020-05-09 (or an earlier version), then you should probably be able to compile it since that version is right before the const_fn feature gate was removed, then you can change your default version of Rust back to whatever you prefer afterwards.

something like:

rustup default nightly-2020-05-09
pip install algebraics
rustup default stable

@rotu
Copy link
Author

rotu commented Mar 21, 2022

Unfortunately, the nightly doesn't seem to exist, and lock_api won't build on the stable channel

➜  ~ rustup default nightly-2020-05-09
info: syncing channel updates for 'nightly-2020-05-09-aarch64-apple-darwin'
info: latest update on 2020-05-09, rust version 1.45.0-nightly (7ebd87a7a 2020-05-08)
error: target 'aarch64-apple-darwin' not found in channel.  Perhaps check https://doc.rust-lang.org/nightly/rustc/platform-support.html for available targets

And with rustup default 1.49.0:

pip install algebraics
Collecting algebraics
  Using cached algebraics-0.2.0.tar.gz (131 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: algebraics
  Building wheel for algebraics (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for algebraics (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [54 lines of output]
      Running `maturin pep517 build-wheel -i /Users/dan/.pyenv/versions/pypy3.9-7.3.8/bin/python --compatibility off`
      ⚠️  Warning: Please use maturin in pyproject.toml with a version constraint, e.g. `requires = ["maturin>=0.12,<0.13"]`. This will become an error.
      📡 Using build options cargo-extra-args, bindings from pyproject.toml
         Compiling proc-macro2 v1.0.36
         Compiling autocfg v1.1.0
         Compiling unicode-xid v0.2.2
         Compiling syn v1.0.89
         Compiling proc-macro-hack v0.5.19
         Compiling serde_derive v1.0.136
         Compiling libc v0.2.121
         Compiling serde v1.0.136
         Compiling serde_json v1.0.79
         Compiling ryu v1.0.9
         Compiling itoa v1.0.1
         Compiling regex-syntax v0.6.25
         Compiling scopeguard v1.1.0
         Compiling inventory v0.1.11
         Compiling cfg-if v0.1.10
         Compiling rand_core v0.4.2
         Compiling unindent v0.1.8
         Compiling version_check v0.9.4
         Compiling smallvec v1.8.0
         Compiling lazy_static v1.4.0
         Compiling autocfg v0.1.8
         Compiling num-traits v0.2.14
         Compiling num-integer v0.1.44
         Compiling num-bigint v0.2.6
         Compiling num-rational v0.2.4
         Compiling lock_api v0.3.4
         Compiling rand_core v0.3.1
         Compiling rand_pcg v0.1.2
      error: could not compile `lock_api`
      
      To learn more, run the command again with --verbose.
      warning: build failed, waiting for other jobs to finish...
      error: build failed
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `cargo rustc --manifest-path Cargo.toml --message-format json --features python-extension --release --lib -- -C link-arg=-undefined -C link-arg=dynamic_lookup -C link-args=-Wl,-install_name,@rpath/algebraics.pypy39-pp73-darwin.so`
      🔗 Found pyo3 bindings
      🐍 Found PyPy 3.9 at /Users/dan/.pyenv/versions/pypy3.9-7.3.8/bin/python
      error[E0554]: `#![feature]` may not be used on the stable release channel
        --> /Users/dan/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/lock_api-0.3.4/src/lib.rs:91:34
         |
      91 | #![cfg_attr(feature = "nightly", feature(const_fn))]
         |                                  ^^^^^^^^^^^^^^^^^
      
      
      error: aborting due to previous error
      
      
      For more information about this error, try `rustc --explain E0554`.
      
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/Users/dan/.pyenv/versions/pypy3.9-7.3.8/bin/python', '--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 algebraics
Failed to build algebraics
ERROR: Could not build wheels for algebraics, which is required to install pyproject.toml-based projects

@programmerjake
Copy link
Owner

ah, ok. aarch64-apple-darwin support was added after const_fn was removed.

I pushed a modified version that embeds pyo3 and disables the "nightly" feature of parking_lot, which makes lock_api not try to use const_fn. I tested with a recent nightly (nightly-2022-03-20) and it works just fine for me...though I'm on x86_64-unknown-linux-gnu. It will probably work on Arm MacOS too, though you may need to adjust which version of rust nightly you use.

rustup default nightly # it should pick a good enough version, those reading this in the future may want to use a specific nightly rather than the latest
git clone https://github.com/programmerjake/algebraics.git
cd algebraics
git checkout work-around-const-fn-removal
pip install .
rustup default stable

@rotu
Copy link
Author

rotu commented Mar 21, 2022

woohoo! It works! Thank you so much :-)

@programmerjake
Copy link
Owner

I created #2 to track moving to a more recent version of pyo3, so if you don't want to or can't do the work yourself, feel free to close this PR.

@rotu rotu closed this Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants