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

Unable to build pendulum for 32bit #784

Open
hesstobi opened this issue Dec 19, 2023 · 11 comments
Open

Unable to build pendulum for 32bit #784

hesstobi opened this issue Dec 19, 2023 · 11 comments

Comments

@hesstobi
Copy link

  • [ x] I am on the latest Pendulum version.
  • [x ] I have searched the issues of this repo and believe that this is not a duplicate.
  • OS version and name: Linux 32bit
  • Pendulum version: 3.0.0

Issue

Trying to build pendulum for a 32bit system fails:

-> 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

usize is only a 32 uint on 32 bit systems, thus this is not working.

@Secrus
Copy link
Collaborator

Secrus commented Dec 19, 2023

Unless you are up to making the change required for this to work on 32 bit system, I doubt it will change.

@hesstobi
Copy link
Author

This was my concern.

As far I understand it would work, if the seconds variable in is changed to i64.

I can try to start with rust programming and prepare a PR for that.

@gazpachoking
Copy link
Contributor

gazpachoking commented Dec 26, 2023

Is there a way to force the install to fall back to the pure python implementation?

EDIT: Or could a pure python wheel be published to pypi to fall back on?

@edgarrmondragon
Copy link
Contributor

Is there a way to force the install to fall back to the pure python implementation?

EDIT: Or could a pure python wheel be published to pypi to fall back on?

@gazpachoking maybe the PENDULUM_EXTENSIONS=0 env var?

@gazpachoking
Copy link
Contributor

gazpachoking commented Dec 27, 2023 via email

@gazpachoking
Copy link
Contributor

We added pendulum as a dependency in our project and are now having multiple reports of people who can't install on their platform because either it's 32 bit, or they don't have rust tooling and there isn't a prebuilt wheel for their platform. I really hope official way is added such that pendulum can fall back to the pure python implementation in those cases.

@Secrus
Copy link
Collaborator

Secrus commented Dec 29, 2023

We added pendulum as a dependency in our project and are now having multiple reports of people who can't install on their platform because either it's 32 bit, or they don't have rust tooling and there isn't a prebuilt wheel for their platform. I really hope official way is added such that pendulum can fall back to the pure python implementation in those cases.

Other than 32-bit, could you maybe come up with a list of platforms we don't cover?

@gazpachoking
Copy link
Contributor

I'll try to collect some data from our users with troubles. It's possible it's just 32bit users on raspberry pi like systems.

@gazpachoking
Copy link
Contributor

gazpachoking commented Dec 29, 2023

Other than 32-bit, could you maybe come up with a list of platforms we don't cover?

Looks like linux aarch64 at least. (If that's not the detail needed there is more here)
EDIT: Hmm, I may not have read that log closely enough. That might be a different issue.

@JakFrost
Copy link

JakFrost commented Jan 3, 2024

Same problem as original poster when running on Ubuntu 18.04.6 LTS and 32-bit.

Cannot update Pendulum package since it required Rust and Cargo so installed those packages rustc and cargo just fine. Then it gets the same error as above.

I also noticed that the line PYO3_ENVIRONMENT_SIGNATURE="cpython-3.8-64bit" is set to 64-bit instead of 32-bit.

I'm not sure why all of a sudden a new language is required to be installed for this package dependency and it is now failing for 32-bit systems since it appears that the build for Rust -> Cargo -> Maturin makes the hardcoded assumption that the system is always 64-bit.

Linux Info

root@host:~# uname -a
Linux host 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:29:48 UTC 2023 i686 i686 i686 GNU/Linux

Distro

root@host:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.6 LTS"

Version

root@host:/tmp# which python3
/usr/bin/python3

root@host:/tmp# ll /usr/bin/python3
lrwxrwxrwx 1 root root 25 May 26  2023 /usr/bin/python3 -> /etc/alternatives/python3*

root@host:/tmp# ll /etc/alternatives/python3
lrwxrwxrwx 1 root root 18 May 26  2023 /etc/alternatives/python3 -> /usr/bin/python3.8*

root@host:/tmp# python3 --version
Python 3.8.18

root@host:/tmp# rustc --version
rustc 1.67.1 (d5a82bbd2 2023-02-07) (built from a source tarball)

root@host:/tmp# cargo --version
cargo 1.67.0

root@host:/tmp# pip --version
pip 23.3.2 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)

Error - PYO3_ENVIRONMENT_SIGNATURE="cpython-3.8-64bit"

Caused by: Cargo build finished with "exit status: 101": `PYO3_ENVIRONMENT_SIGNATURE="cpython-3.8-64bit" PYO3_PYTHON="/usr/bin/python3" PYTHON_SYS_EXECUTABLE="/usr/bin/python3" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/tmp/pip-install-k8toz2qx/pendulum_1a784c65d6ec494c90a21ee7d6fe09b8/rust/Cargo.toml" "--release" "--lib" "--crate-type" "cdylib"`

Errors

2024-01-03T04:58:05,343 Building wheels for collected packages: pendulum
2024-01-03T04:58:05,346   Created temporary directory: /tmp/pip-wheel-fc4artfx
2024-01-03T04:58:05,346   Destination directory: /tmp/pip-wheel-fc4artfx
2024-01-03T04:58:05,349   Running command Building wheel for pendulum (pyproject.toml)
2024-01-03T04:58:05,702   Running `maturin pep517 build-wheel -i /usr/bin/python3 --compatibility off`
2024-01-03T04:58:06,314   🍹 Building a mixed python/rust project
2024-01-03T04:58:06,315   🔗 Found pyo3 bindings
2024-01-03T04:58:06,619   🐍 Found CPython 3.8 at /usr/bin/python3
2024-01-03T04:58:07,363      Compiling target-lexicon v0.12.6
2024-01-03T04:58:07,363      Compiling python3-dll-a v0.2.9
2024-01-03T04:58:07,364      Compiling libc v0.2.139
2024-01-03T04:58:07,365      Compiling autocfg v1.1.0
2024-01-03T04:58:12,558      Compiling once_cell v1.17.1
2024-01-03T04:58:14,852      Compiling proc-macro2 v1.0.51
2024-01-03T04:58:16,655      Compiling unicode-ident v1.0.6
2024-01-03T04:58:17,528      Compiling quote v1.0.23
2024-01-03T04:58:20,869      Compiling syn v1.0.109
2024-01-03T04:58:24,872      Compiling pyo3-build-config v0.19.1
2024-01-03T04:58:24,968      Compiling lock_api v0.4.9
2024-01-03T04:58:27,400      Compiling parking_lot_core v0.9.7
2024-01-03T04:58:32,301      Compiling cc v1.0.79
2024-01-03T04:58:38,172      Compiling memoffset v0.9.0
2024-01-03T04:58:40,518      Compiling smallvec v1.10.0
2024-01-03T04:58:43,899      Compiling cfg-if v1.0.0
2024-01-03T04:58:44,059      Compiling scopeguard v1.1.0
2024-01-03T04:58:54,954      Compiling parking_lot v0.12.1
2024-01-03T04:59:00,301      Compiling libmimalloc-sys v0.1.35
2024-01-03T04:59:09,199      Compiling pyo3-ffi v0.19.1
2024-01-03T04:59:12,630      Compiling pyo3 v0.19.1
2024-01-03T04:59:16,143      Compiling unindent v0.1.11
2024-01-03T04:59:21,784      Compiling indoc v1.0.9
2024-01-03T04:59:29,569      Compiling mimalloc v0.1.39
2024-01-03T04:59:39,815      Compiling pyo3-macros-backend v0.19.1
2024-01-03T05:00:50,569      Compiling pyo3-macros v0.19.1
2024-01-03T05:02:20,322      Compiling _pendulum v3.0.0 (/tmp/pip-install-k8toz2qx/pendulum_1a784c65d6ec494c90a21ee7d6fe09b8/rust)
2024-01-03T05:02:25,221   error: this arithmetic operation will overflow
2024-01-03T05:02:25,222     --> src/helpers.rs:59:20
2024-01-03T05:02:25,222      |
2024-01-03T05:02:25,223   59 |         seconds += ((146_097 - 10957) * SECS_PER_DAY as usize) as isize;
2024-01-03T05:02:25,223      |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `135140_usize * 86400_usize`, which would overflow
2024-01-03T05:02:25,224      |
2024-01-03T05:02:25,225      = note: `#[deny(arithmetic_overflow)]` on by default

2024-01-03T05:04:17,959   error: could not compile `_pendulum` due to previous error
2024-01-03T05:04:17,974   💥 maturin failed
2024-01-03T05:04:17,975     Caused by: Failed to build a native library through cargo
2024-01-03T05:04:17,975     Caused by: Cargo build finished with "exit status: 101": `PYO3_ENVIRONMENT_SIGNATURE="cpython-3.8-64bit" PYO3_PYTHON="/usr/bin/python3" PYTHON_SYS_EXECUTABLE="/usr/bin/python3" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/tmp/pip-install-k8toz2qx/pendulum_1a784c65d6ec494c90a21ee7d6fe09b8/rust/Cargo.toml" "--release" "--lib" "--crate-type" "cdylib"`
2024-01-03T05:04:17,976   Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/usr/bin/python3', '--compatibility', 'off'] returned non-zero exit status 1
2024-01-03T05:04:18,009   ERROR: Building wheel for pendulum (pyproject.toml) exited with 1
2024-01-03T05:04:18,049   [bold magenta]full command[/]: [blue]/usr/bin/python3 /usr/local/lib/python3.8/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmp3ztdwcg3[/]
2024-01-03T05:04:18,050   [bold magenta]cwd[/]: /tmp/pip-install-k8toz2qx/pendulum_1a784c65d6ec494c90a21ee7d6fe09b8
2024-01-03T05:04:18,052   ERROR: Failed building wheel for pendulum
2024-01-03T05:04:18,056 Failed to build pendulum
2024-01-03T05:04:18,058 ERROR: Could not build wheels for pendulum, which is required to install pyproject.toml-based projects
2024-01-03T05:04:18,060 Exception information:
2024-01-03T05:04:18,060 Traceback (most recent call last):
2024-01-03T05:04:18,060   File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
2024-01-03T05:04:18,060     status = run_func(*args)
2024-01-03T05:04:18,060   File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/req_command.py", line 245, in wrapper
2024-01-03T05:04:18,060     return func(self, options, args)
2024-01-03T05:04:18,060   File "/usr/local/lib/python3.8/dist-packages/pip/_internal/commands/install.py", line 429, in run
2024-01-03T05:04:18,060     raise InstallationError(
2024-01-03T05:04:18,060 pip._internal.exceptions.InstallationError: Could not build wheels for pendulum, which is required to install pyproject.toml-based projects
2024-01-03T05:04:18,154 Remote version of pip: 23.3.2
2024-01-03T05:04:18,155 Local version of pip:  23.3.2

dbaty added a commit to dbcli/pgcli that referenced this issue Feb 19, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
dbaty added a commit to dbcli/pgcli that referenced this issue Feb 19, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
dbaty added a commit to dbcli/pgcli that referenced this issue Feb 19, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
dbaty added a commit to dbcli/pgcli that referenced this issue Feb 19, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
dbaty added a commit to dbcli/pgcli that referenced this issue Feb 19, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
dbaty added a commit to dbcli/pgcli that referenced this issue Feb 20, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
dbaty added a commit to dbcli/pgcli that referenced this issue Feb 20, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
dbaty added a commit to dbcli/pgcli that referenced this issue Feb 20, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
@jschlyter
Copy link

Any updates on this issue @sdispater?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants