sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Unable to `pip3 install bitwarden-sdk` on MacOS

Open otterbotter opened this issue 1 year ago • 22 comments

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

  • [X] 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 avatar Oct 20 '24 13:10 otterbotter

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

darkobas2 avatar Oct 25 '24 00:10 darkobas2

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

darkobas2 avatar Oct 29 '24 01:10 darkobas2

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

alxckn avatar Oct 31 '24 22:10 alxckn

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

julgsk avatar Nov 06 '24 19:11 julgsk

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

arpanrec avatar Nov 10 '24 17:11 arpanrec

Any plans to address this?

dbasunag avatar Nov 14 '24 18:11 dbasunag

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

Krikooo avatar Nov 25 '24 13:11 Krikooo

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.

MEhrn00 avatar Nov 25 '24 19:11 MEhrn00

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.

goshansp avatar Dec 20 '24 11:12 goshansp

Good Morning @Hinton @dani-garcia - Thank you very much for this excellent piece of software. Bitwarden-SDK is an absolute game-changer and I crave to use it for a long time. This issue is preventing a huge portion of the community to further adopt it. Could you please prioritize and assign this issue ^^ or give a statement? If there are ways to push the release of Fix I'd be happy to help.

goshansp avatar Jan 11 '25 07:01 goshansp

Any news on this? I can't build our Alpine based docker image, because of this.

Marx1st avatar Jan 20 '25 15:01 Marx1st

A fix for Alpine will be greatly appreciated.

himike12 avatar Feb 05 '25 20:02 himike12

The workaround mentioned in a comment didn't work for me in Alpine (building a Docker container).

I had to use this in the Dockerfile (running the commands in one line):

RUN wget 'https://files.pythonhosted.org/packages/dd/03/11934ae9d668283895286872a7af3de25d324ec9ac86da5a56ac9dc48544/bitwarden_sdk-1.0.0.tar.gz' && 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' && pip3 install .

Marx1st avatar Feb 14 '25 15:02 Marx1st

Fail as well on Ubuntu 22.04 with Python 3.13.2

Sispheor avatar Feb 15 '25 08:02 Sispheor

Is there for real no fix since october? It is only a missing LICENSE file. This make Bitwarden-sdk install in fact a pain. I was confused in the beginning why i need to install rust for accessing credentials from ansible, but after this process i am demotivated.

KornKalle avatar Feb 16 '25 10:02 KornKalle

appreciate it if there is any updates on fixes on this

I couldn't go past bitwarden-labs bws ansible-examples because of this blocker: https://github.com/bitwarden-labs/bws-ansible-examples/blob/main/demonstration-playbook/README-demonstration.md

davzoku avatar Mar 04 '25 17:03 davzoku

Thanks @goshansp for the hint of the related PR: https://github.com/bitwarden/sdk-sm/issues/1148

That contributes to the fix. Additionally, i think the license path has to added for Maturin to allow the build to be successful too: https://github.com/bitwarden/sdk-sm/pull/1221

Hopefully, it get merged soon and unblocks everyone's workflows.

davzoku avatar Mar 07 '25 16:03 davzoku

I contacted support on this and received the following message on Feb 21st


Thank you for your patience. This matter is on the team's radar and hopefully it'd be addressed in the future; I do not have an ETA that I can promise you at this stage.
 
I thank you in advance for your understanding and patience; please feel free to let me know if there is anything else I can assist you with.


All the best,

We went with hashicorp vault instead, our team decided against these workarounds as we did not want to integrate a secrets management with overhead to just get it working.

KornKalle avatar Mar 12 '25 09:03 KornKalle

For others looking for a fix, I was able to successfully install version 0.1.0 of the bitwarden-sdk into my Python project. https://pypi.org/project/bitwarden-sdk/#history

5cotts avatar Mar 22 '25 18:03 5cotts

This issue is still unresolved. Version 1.0.0 fails to install because of the missing LICENSE file for Python interpreters >=3.13

SaitoPhoenix avatar May 15 '25 20:05 SaitoPhoenix

Same issue here in MacOS

iicc1 avatar May 16 '25 17:05 iicc1

Issue still not fixed, debian 12/13 with python 3.13.3.

rsponar avatar Jun 07 '25 05:06 rsponar