sdispater / pendulum

Python datetimes made easy
https://pendulum.eustace.io
MIT License
6.12k stars 372 forks source link

Arithmetic overflow during the compilation of the Rust code for the "_pendulum" library. #787

Closed vkasotis closed 6 months ago

vkasotis commented 6 months ago

Issue

I have tried to upgrade flexget to the latest version on my Pi4, yet, it seems that there is a problem with the installation of the pendulum library. More specifically, it seems that when it tries to build the wheel there is an arithmetic overflow :

Building wheels for collected packages: greenlet, pendulum, psutil
  Building wheel for greenlet (pyproject.toml) ... done
  Created wheel for greenlet: filename=greenlet-3.0.3-cp311-cp311-linux_armv7l.whl size=589601 sha256=8de946828b71a4b1334a55b6c8bba30371da1866632d1a28439f09d365567838
  Stored in directory: /home/osmc/.cache/pip/wheels/56/08/ca/e0bd72a4cd850a40d2a51ee67fbd2f3efe5332fe5fe00e2c53
  Building wheel for pendulum (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pendulum (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [44 lines of output]
      Running `maturin pep517 build-wheel -i /usr/local/bin/python3.11 --compatibility off`
      🍹 Building a mixed python/rust project
      🔗 Found pyo3 bindings
      🐍 Found CPython 3.11 at /usr/local/bin/python3.11
         Compiling target-lexicon v0.12.6
         Compiling python3-dll-a v0.2.9
         Compiling autocfg v1.1.0
         Compiling libc v0.2.139
         Compiling proc-macro2 v1.0.51
         Compiling once_cell v1.17.1
         Compiling quote v1.0.23
         Compiling unicode-ident v1.0.6
         Compiling syn v1.0.109
         Compiling lock_api v0.4.9
         Compiling parking_lot_core v0.9.7
         Compiling pyo3-build-config v0.19.1
         Compiling cc v1.0.79
         Compiling memoffset v0.9.0
         Compiling smallvec v1.10.0
         Compiling cfg-if v1.0.0
         Compiling scopeguard v1.1.0
         Compiling parking_lot v0.12.1
         Compiling libmimalloc-sys v0.1.35
         Compiling pyo3-ffi v0.19.1
         Compiling pyo3 v0.19.1
         Compiling indoc v1.0.9
         Compiling unindent v0.1.11
         Compiling mimalloc v0.1.39
         Compiling pyo3-macros-backend v0.19.1
         Compiling pyo3-macros v0.19.1
         Compiling _pendulum v3.0.0 (/tmp/pip-install-nxx3fkk_/pendulum_98ef337297f5446f9635029aca591bf0/rust)
      error: this arithmetic operation will overflow
        --> src/helpers.rs:59:20
         |
      59 |         seconds += ((146_097 - 10957) * SECS_PER_DAY as usize) as isize;
         |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `135140_usize * 86400_usize`, which would overflow
         |
         = note: `#[deny(arithmetic_overflow)]` on by default

      error: could not compile `_pendulum` (lib) due to previous error
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `PYO3_ENVIRONMENT_SIGNATURE="cpython-3.11-64bit" PYO3_PYTHON="/usr/local/bin/python3.11" PYTHON_SYS_EXECUTABLE="/usr/local/bin/python3.11" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/tmp/pip-install-nxx3fkk_/pendulum_98ef337297f5446f9635029aca591bf0/rust/Cargo.toml" "--release" "--lib" "--crate-type" "cdylib"`
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/usr/local/bin/python3.11', '--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 pendulum
  Building wheel for psutil (pyproject.toml) ... done
  Created wheel for psutil: filename=psutil-5.9.7-cp311-abi3-linux_armv7l.whl size=282795 sha256=1c70b0584eafcc1e5b9dba7c462f7f43364beba6dc201058b58abf81a0dc1a9f
  Stored in directory: /home/osmc/.cache/pip/wheels/8a/e0/cf/0387173bc7d441888e75433d029f2d582ecc243b2f03835bc4
Successfully built greenlet psutil
Failed to build pendulum
ERROR: Could not build wheels for pendulum, which is required to install pyproject.toml-based projects
vkasotis commented 6 months ago

Found the solution with the pendulum-3.0.0-py3-none-any.whl.zip mention in other issue.