proycon / analiticcl

an approximate string matching or fuzzy-matching system for spelling correction, normalisation or post-OCR correction
GNU General Public License v3.0
31 stars 4 forks source link

Install fails with python 3.13 on macos: pip fails to compile from source #21

Closed dirkroorda closed 1 week ago

dirkroorda commented 1 week ago

Is it me or is analyticcl not yet ready for python 3.13?

On macos, I installed rust (brew install rust), and analiticcl (cargo install analiticcl).

Then pip install analiticcl failed, deep down there is an error that a maturin commands fails.

Building wheels for collected packages: analiticcl
  Building wheel for analiticcl (pyproject.toml) ... error
  error: subprocess-exited-with-error

  Γ— Building wheel for analiticcl (pyproject.toml) did not run successfully.
  β”‚ exit code: 1
  ╰─> [80 lines of output]
      Running `maturin pep517 build-wheel -i /Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13 --compatibility off`
      🍹 Building a mixed python/rust project
      πŸ”— Found pyo3 bindings
      🐍 Found CPython 3.13 at /Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13
      πŸ’» Using `MACOSX_DEPLOYMENT_TARGET=11.0` for aarch64-apple-darwin by default
      warning: unused manifest key: target.aarch64-apple-darwin.rustflags
      warning: unused manifest key: target.x86_64-apple-darwin.rustflags
         Compiling libc v0.2.153
         Compiling autocfg v1.2.0
         Compiling target-lexicon v0.12.14
         Compiling proc-macro2 v1.0.81
         Compiling unicode-ident v1.0.12
         Compiling cfg-if v1.0.0
         Compiling once_cell v1.19.0
         Compiling crossbeam-utils v0.8.19
         Compiling vec_map v0.8.2
         Compiling ppv-lite86 v0.2.17
         Compiling typenum v1.17.0
         Compiling bit-vec v0.6.3
         Compiling num-traits v0.2.18
         Compiling bit-set v0.5.3
         Compiling lock_api v0.4.11
         Compiling rayon-core v1.12.1
         Compiling either v1.11.0
         Compiling parking_lot_core v0.9.9
         Compiling unicode-width v0.1.11
         Compiling bitflags v1.3.2
         Compiling anyhow v1.0.82
         Compiling serde v1.0.198
         Compiling quote v1.0.36
         Compiling syn v2.0.60
         Compiling crossbeam-epoch v0.9.18
         Compiling pyo3-build-config v0.20.3
         Compiling crossbeam-deque v0.8.5
         Compiling getrandom v0.2.14
         Compiling atty v0.2.14
         Compiling rand_core v0.6.4
         Compiling rand_chacha v0.3.1
         Compiling rand v0.8.5
         Compiling textwrap v0.11.0
         Compiling ordered_iter v0.1.2
         Compiling memoffset v0.9.1
         Compiling minimal-lexical v0.2.1
         Compiling smallvec v1.13.2
         Compiling memchr v2.7.2
         Compiling strsim v0.8.0
         Compiling compare v0.0.6
         Compiling portable-atomic v1.6.0
         Compiling scopeguard v1.2.0
         Compiling heck v0.4.1
         Compiling cfg-if v0.1.10
         Compiling ansi_term v0.12.1
         Compiling nom v7.1.3
         Compiling pyo3-ffi v0.20.3
         Compiling pyo3 v0.20.3
         Compiling pyo3-macros-backend v0.20.3
         Compiling clap v2.34.0
         Compiling bimap v0.3.1
         Compiling stable_bst v0.2.0
      error: failed to run custom build command for `pyo3-ffi v0.20.3`

      Caused by:
        process didn't exit successfully: `/private/var/folders/nb/_qgnfkns75bcn_p_msyjl81m0000gn/T/pip-install-ljmpqeog/analiticcl_a88889686cab4a8dbc69ef2a6707cf5b/target/release/build/pyo3-ffi-e64794397cb3e827/build-script-build` (exit status: 1)
        --- stdout
        cargo:rerun-if-env-changed=PYO3_CROSS
        cargo:rerun-if-env-changed=PYO3_CROSS_LIB_DIR
        cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_VERSION
        cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_IMPLEMENTATION
        cargo:rerun-if-env-changed=PYO3_PRINT_CONFIG
        cargo:rerun-if-env-changed=PYO3_USE_ABI3_FORWARD_COMPATIBILITY

        --- stderr
        error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)
        = help: please check if an updated version of PyO3 is available. Current version: 0.20.3
        = help: set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 to suppress this check and build anyway using the stable ABI
      warning: build failed, waiting for other jobs to finish...
      πŸ’₯ maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `env -u CARGO MACOSX_DEPLOYMENT_TARGET="11.0" PYO3_ENVIRONMENT_SIGNATURE="cpython-3.13-64bit" PYO3_PYTHON="/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13" PYTHON_SYS_EXECUTABLE="/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/private/var/folders/nb/_qgnfkns75bcn_p_msyjl81m0000gn/T/pip-install-ljmpqeog/analiticcl_a88889686cab4a8dbc69ef2a6707cf5b/Cargo.toml" "--release" "--lib" "--" "-C" "link-arg=-undefined" "-C" "link-arg=dynamic_lookup" "-C" "link-args=-Wl,-install_name,@rpath/analiticcl.cpython-313-darwin.so"`
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13', '--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 analiticcl
Failed to build analiticcl
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (analiticcl)
proycon commented 1 week ago

It seems you're right, I'd better upgrade to the latest pyo3!

proycon commented 1 week ago

This should be fixed now in v0.4.7, available on pypi.

dirkroorda commented 1 week ago

Hi @proycon

I tried, but it fails with a different error. I have updated the rust program analiticcl to 0.4.7 (cargo install analiticcl), that went successfully, but then I got:

me:~ > pip install --no-cache-dir --upgrade analiticcl
Collecting analiticcl
  Downloading analiticcl-0.4.7.tar.gz (11 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  Γ— Preparing metadata (pyproject.toml) did not run successfully.
  β”‚ exit code: 1
  ╰─> [10 lines of output]
      error: failed to parse manifest at `/private/var/folders/nb/_qgnfkns75bcn_p_msyjl81m0000gn/T/pip-install-uyi7zfls/analiticcl_a39c2344880a4bc89d520dc370e83b41/Cargo.toml`

      Caused by:
        can't find library `analiticcl`, rename file to `src/lib.rs` or specify lib.path
      πŸ’₯ maturin failed
        Caused by: Cargo metadata failed. Does your crate compile with `cargo build`?
        Caused by: `cargo metadata` exited with an error:
      Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/private/var/folders/nb/_qgnfkns75bcn_p_msyjl81m0000gn/T/pip-modern-metadata-4fp2q38p', '--interpreter', '/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13']' returned non-zero exit status 1.
      Checking for Rust toolchain....
      Running `maturin pep517 write-dist-info --metadata-directory /private/var/folders/nb/_qgnfkns75bcn_p_msyjl81m0000gn/T/pip-modern-metadata-4fp2q38p --interpreter /Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13`
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Γ— Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
proycon commented 1 week ago

Hmm.. It should ideally just grab the python wheel. I thought I prepared one for most systems, but I don't explicitly see macos with python 3.13, will check..

proycon commented 1 week ago

@dirkroorda Could you try again now? The missing wheels should be published

proycon commented 1 week ago

But there indeed seems to be an issue compiling from source via pip, I''m reopening this.

dirkroorda commented 1 week ago

It works. I installed 0.4.8 in python 3.13

proycon commented 1 week ago

Right, thanks, issue is fixed, closing!