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 pip3 install bitwarden-sdk on MacOS #1148

Open
1 task done
otterbotter opened this issue Oct 20, 2024 · 9 comments
Open
1 task done

Unable to pip3 install bitwarden-sdk on MacOS #1148

otterbotter opened this issue Oct 20, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@otterbotter
Copy link

otterbotter commented Oct 20, 2024

Steps To Reproduce

  1. Open a terminal on MacOS
  2. Run pip3 install bitwarden-sdk

Expected Result

I expect ansible-sdk to be installed successfully

Actual Result

Collecting bitwarden-sdk
  Using cached bitwarden_sdk-1.0.0.tar.gz (374 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]
      🔗 Found pyo3 bindings
      🐍 Found CPython 3.8 at /Users/otterbotter/../bin/python3
      📡 Using build options bindings, compatibility from pyproject.toml
      💥 maturin failed
        Caused by: Failed to read /private/var/folders/2c/qzmlgh8j28941tt2hlckkczh0000gn/T/pip-install-_hengb50/bitwarden-sdk_c0ca9cf5d58944eb84e6e0313546647a/crates/bitwarden-py/../../LICENSE
        Caused by: failed to open file `/private/var/folders/2c/qzmlgh8j28941tt2hlckkczh0000gn/T/pip-install-_hengb50/bitwarden-sdk_c0ca9cf5d58944eb84e6e0313546647a/crates/bitwarden-py/../../LICENSE`
        Caused by: No such file or directory (os error 2)
      Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/private/var/folders/2c/qzmlgh8j28941tt2hlckkczh0000gn/T/pip-modern-metadata-u58guaip', '--interpreter', '/Users/otterbotter/../bin/python3']' returned non-zero exit status 1.
      Checking for Rust toolchain....
      Running `maturin pep517 write-dist-info --metadata-directory /private/var/folders/2c/qzmlgh8j28941tt2hlckkczh0000gn/T/pip-modern-metadata-u58guaip --interpreter /Users/otterbotter/../bin/python3`
      [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.

Screenshots or Videos

No response

Additional Context

Python version 3.8.20 installed via pyenv
Pip version 24.2

Operating System

macOS

Operating System Version

Sonoma Version 14.4 (23E214)

Build Version

1.0.0

Issue Tracking Info

  • I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.
@otterbotter otterbotter added the bug Something isn't working label Oct 20, 2024
@darkobas2
Copy link

not just macos... happens in linux/docker too

@darkobas2
Copy link

so i think the issue might be that alpine linux doesnt support manylinux
if i do pip debug i get

  cp311-cp311-musllinux_1_2_x86_64
  cp311-cp311-musllinux_1_1_x86_64
  cp311-cp311-musllinux_1_0_x86_64
  cp311-cp311-linux_x86_64

@alxckn
Copy link

alxckn commented Oct 31, 2024

I had the same issue with a python 3.13.0 venv (linux homebrew), it worked with system python 3.10.12 from ubuntu 22.04

@julgsk
Copy link

julgsk commented Nov 6, 2024

Using Fedora 41 here, same issue.
Since I'm not versed in python wizardry, is there a way to achieve what pip install does when I already have bws binary installed?
🧐

@arpanrec
Copy link

arpanrec commented Nov 10, 2024

Build is failling just for python3.13 with GitHub Actions

     Compiling bitwarden-json v0.3.0 (/tmp/tmpj9g02axz/bitwarden_sdk-1.0.0/crates/bitwarden-json)
      Finished `release` profile [optimized] target(s) in 1m 35s
  💥 maturin failed
    Caused by: Failed to read /tmp/tmpj9g02axz/bitwarden_sdk-1.0.0/crates/bitwarden-py/../../LICENSE
    Caused by: failed to open file `/tmp/tmpj9g02axz/bitwarden_sdk-1.0.0/crates/bitwarden-py/../../LICENSE`
    Caused by: No such file or directory (os error 2)
  Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/tmp/tmp69oheo9s/.venv/bin/python', '--compatibility', 'off'] returned non-zero exit status 1
  

  at /opt/pipx/venvs/poetry/lib/python3.10/site-packages/poetry/installation/chef.py:164 in _prepare
      160│ 
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│ 
      163│             if error is not None:
    → 164│                 raise error from None
      165│ 
      166│             return path
      167│ 
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with bitwarden-sdk (1.0.0) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "bitwarden-sdk (==1.0.0)"'.

Screenshot_20241110_224120-1

@dbasunag
Copy link

Any plans to address this?

@Krikooo
Copy link

Krikooo commented Nov 25, 2024

Any update on this ?
Same issue with docker/alpine ...

@MEhrn00
Copy link

MEhrn00 commented Nov 25, 2024

This issue occurs because the sdist for bitwarden-sdk on pypi is missing a LICENSE file. The cargo manifest in the sdist references the LICENSE file but since it is not present, it fails.

$ wget 'https://files.pythonhosted.org/packages/dd/03/11934ae9d668283895286872a7af3de25d324ec9ac86da5a56ac9dc48544/bitwarden_sdk-1.0.0.tar.gz'
bitwarden_sdk-1.0.0. 100% [===============================================================================================================================================================================================================================>]  365.68K    7.99MB/s
                          [Files: 1  Bytes: 365.68K [1.21MB/s] Redirects: 0  Todo: 0  Errors: 0                                                                                                                                                            ]
$ tar xf bitwarden_sdk-1.0.0.tar.gz
$ cd bitwarden_sdk-1.0.0
$ ls
# No `LICENSE` file
bitwarden_sdk  Cargo.lock  Cargo.toml  crates  PKG-INFO  pyproject.toml  README.md
$ grep 'license-file' Cargo.toml
# Cargo manifest references a `LICENSE` file for the license.
license-file = "LICENSE"
$ pip install .
# Install fails since it cannot find the `LICENSE` file.
Defaulting to user installation because normal site-packages is not writeable
Processing /home/matt/Downloads/bitwarden_sdk-1.0.0
  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]
      🔗 Found pyo3 bindings
      🐍 Found CPython 3.13 at /usr/bin/python3
      📡 Using build options bindings, compatibility from pyproject.toml
      💥 maturin failed
        Caused by: Failed to read /home/matt/Downloads/bitwarden_sdk-1.0.0/crates/bitwarden-py/../../LICENSE
        Caused by: failed to open file `/home/matt/Downloads/bitwarden_sdk-1.0.0/crates/bitwarden-py/../../LICENSE`
        Caused by: No such file or directory (os error 2)
      Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-quidles5', '--interpreter', '/usr/bin/python3']' returned non-zero exit status 1.
      Checking for Rust toolchain....
      Running `maturin pep517 write-dist-info --metadata-directory /tmp/pip-modern-metadata-quidles5 --interpreter /usr/bin/python3`
      [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.

A workaround for this is to download the sdist from pypi, copy the LICENSE into the extracted sdist and then install it from there.

$ wget 'https://files.pythonhosted.org/packages/dd/03/11934ae9d668283895286872a7af3de25d324ec9ac86da5a56ac9dc48544/bitwarden_sdk-1.0.0.tar.gz'
bitwarden_sdk-1.0.0. 100% [===============================================================================================================================================================================================================================>]  365.68K   10.91MB/s
                          [Files: 1  Bytes: 365.68K [1.28MB/s] Redirects: 0  Todo: 0  Errors: 0                                                                                                                                                            ]
$ tar xf bitwarden_sdk-1.0.0.tar.gz
$ cd bitwarden_sdk-1.0.0
$ wget 'https://raw.githubusercontent.com/bitwarden/sdk/refs/heads/main/LICENSE'
LICENSE              100% [===============================================================================================================================================================================================================================>]    5.57K    --.-KB/s
                          [Files: 1  Bytes: 5.57K [27.48KB/s] Redirects: 0  Todo: 0  Errors: 0                                                                                                                                                             ]
$ ls
# `LICENSE` file is present
bitwarden_sdk  Cargo.lock  Cargo.toml  crates  LICENSE  PKG-INFO  pyproject.toml  README.md
$ pip install .
Defaulting to user installation because normal site-packages is not writeable
Processing /home/matt/Downloads/bitwarden_sdk-1.0.0
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: dateutils>=0.6.6 in /home/matt/.local/lib/python3.13/site-packages (from bitwarden_sdk==1.0.0) (0.6.12)
Requirement already satisfied: python-dateutil in /usr/lib/python3.13/site-packages (from dateutils>=0.6.6->bitwarden_sdk==1.0.0) (2.8.2)
Requirement already satisfied: pytz in /home/matt/.local/lib/python3.13/site-packages (from dateutils>=0.6.6->bitwarden_sdk==1.0.0) (2024.2)
Requirement already satisfied: six>=1.5 in /usr/lib/python3.13/site-packages (from python-dateutil->dateutils>=0.6.6->bitwarden_sdk==1.0.0) (1.16.0)
Building wheels for collected packages: bitwarden_sdk
  Building wheel for bitwarden_sdk (pyproject.toml) ... done
  Created wheel for bitwarden_sdk: filename=bitwarden_sdk-1.0.0-cp313-cp313-linux_x86_64.whl size=2631346 sha256=f50584724e0c71e8efaf33f2d4e5aff26a33a38f74e6b62663d9fce17b20aa3b
  Stored in directory: /home/matt/.cache/pip/wheels/7a/2f/a2/0941a0be60f287134c262a8e1a187887d645c312ded4d136b3
Successfully built bitwarden_sdk
Installing collected packages: bitwarden_sdk
  Attempting uninstall: bitwarden_sdk
    Found existing installation: bitwarden_sdk 1.0.0
    Uninstalling bitwarden_sdk-1.0.0:
      Successfully uninstalled bitwarden_sdk-1.0.0
Successfully installed bitwarden_sdk-1.0.0
$ python
Python 3.13.0 (main, Oct  8 2024, 00:00:00) [GCC 14.2.1 20240912 (Red Hat 14.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from bitwarden_sdk import BitwardenClient
>>>

Maturin will need to be installed in order for this to work. Hopefully this issue gets fixed soon.

@goshansp
Copy link

goshansp commented Dec 20, 2024

Are all Python users affected by this? I think this may have been discussed after the release of Python v1.0.0 on 30.09.2024. Referencing issue it seems to be getting fixed with PR.

Is there an ETA for release v1.0.1 with the fix to pypi @coltonhurst ? I cannot wait to deploy this awesome piece of software to our stack! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants