1Password / onepassword-sdk-python

https://developer.1password.com/docs/sdks/
MIT License
77 stars 7 forks source link

Cannot install the module - metadate generation error #64

Closed D-Edward-Scott closed 2 months ago

D-Edward-Scott commented 3 months ago

Running Mac OSX, M3 Pro, Sonoma 14.5.

Python version: 3.12.3

I have tried both installing the module using pip git+https and by downloading and running "python setup.py install". Both fail to produce functional results.

This used to work on my machine prior, closer to the first release.

Response from "pip install git+https://git@github.com/1Password/onepassword-sdk-python.git@v0.1.0-beta.9":

DEPRECATION: Loading egg at /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/annotated_types-0.6.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation. Discussion can be found at https://github.com/pypa/pip/issues/12330 DEPRECATION: Loading egg at /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/typing_extensions-4.11.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation. Discussion can be found at https://github.com/pypa/pip/issues/12330 DEPRECATION: Loading egg at /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pydantic-2.7.1-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation. Discussion can be found at https://github.com/pypa/pip/issues/12330 DEPRECATION: Loading egg at /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pydantic_core-2.18.2-py3.12-macosx-10.9-universal2.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation. Discussion can be found at https://github.com/pypa/pip/issues/12330 Collecting git+https://****@github.com/1Password/onepassword-sdk-python.git@v0.1.0-beta.9 Cloning https://****@github.com/1Password/onepassword-sdk-python.git (to revision v0.1.0-beta.9) to /private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-req-build-tdp5e8ff Running command git clone --filter=blob:none --quiet 'https://****@github.com/1Password/onepassword-sdk-python.git' /private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-req-build-tdp5e8ff Running command git checkout -q ef3cc81a35d9414c64b74b894d9bad21bfe291a1 Resolved https://****@github.com/1Password/onepassword-sdk-python.git to commit ef3cc81a35d9414c64b74b894d9bad21bfe291a1 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 ╰─> [53 lines of output] /private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/dist.py:318: InformationOnly: Normalizing '0.1.0-beta.1' to '0.1.0b1' self.metadata.version = self._normalize_version(self.metadata.version) running dist_info creating /private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-modern-metadata-sry52vtf/onepassword.egg-info writing /private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-modern-metadata-sry52vtf/onepassword.egg-info/PKG-INFO writing dependency_links to /private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-modern-metadata-sry52vtf/onepassword.egg-info/dependency_links.txt writing requirements to /private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-modern-metadata-sry52vtf/onepassword.egg-info/requires.txt writing top-level names to /private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-modern-metadata-sry52vtf/onepassword.egg-info/top_level.txt writing manifest file '/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-modern-metadata-sry52vtf/onepassword.egg-info/SOURCES.txt' reading manifest file '/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-modern-metadata-sry52vtf/onepassword.egg-info/SOURCES.txt' adding license file 'LICENSE' writing manifest file '/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-modern-metadata-sry52vtf/onepassword.egg-info/SOURCES.txt' creating '/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-modern-metadata-sry52vtf/onepassword-0.1.0b1.dist-info' Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in main() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel return hook(metadata_directory, config_settings) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 368, in prepare_metadata_for_build_wheel self.run_setup() File "/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 497, in run_setup super().run_setup(setup_script=setup_script) File "/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 313, in run_setup exec(code, locals()) File "", line 46, in File "/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/init.py", line 103, in setup return distutils.core.setup(attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 184, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 200, in run_commands dist.run_commands() File "/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 970, in run_commands self.run_command(cmd) File "/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 974, in run_command super().run_command(command) File "/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 989, in run_command cmd_obj.run() File "/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/command/dist_info.py", line 97, in run bdist_wheel = self.get_finalized_command('bdist_wheel') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 302, in get_finalized_command cmd_obj = self.distribution.get_command_obj(command, create) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/private/var/folders/5j/gj_37p8171l19szsv25hhqh00000gp/T/pip-build-env-2z0j2gsf/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 863, in get_command_obj cmd_obj = self.command_obj[command] = klass(self) ^^^^^^^^^^^ TypeError: 'NoneType' object is not callable [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.

When running "python setup.py install" locally:

it installs "successfully" but when running scripts it fails:

Traceback (most recent call last): File "/Users/user/Documents/Code/op-test.py", line 1, in from onepassword.client import Client File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/onepassword-0.1.0b11-py3.12.egg/onepassword/init.py", line 2, in from .client import Client File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/onepassword-0.1.0b11-py3.12.egg/onepassword/client.py", line 4, in from .defaults import new_default_config File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/onepassword-0.1.0b11-py3.12.egg/onepassword/defaults.py", line 2, in from src.release.version import SDK_BUILD_NUMBER ModuleNotFoundError: No module named 'src'

I have also tried running in multiple containers to the same results, will try on an x86 machine tomorrow.

Any and all insights are appreciated.

Thank you.

MOmarMiraj commented 3 months ago

Hello @D-Edward-Scott

Thanks for bringing up this issue, this is due to Python 3.12 removing support for setuptools and wheel inside their virtual environment. (https://docs.python.org/3/library/venv.html)

The fix would be the following: 1) Create a new venv python3 -m venv venv 2) Activate the venv by: source venv/bin/activate 3) Install setuptools and wheel in the venv: pip install setuptools and pip install wheel

If your using a requirements.txt you can also add these two inside their as well. This should fix the issue, let me know if you have any other troubles!

abbeycode commented 2 months ago

In case anyone else lands on this like I did, I'd like to point out a typo: run pip install wheel, not wheels. Thanks though @MOmarMiraj because this was also necessary for me on Python 3.10.0.

MOmarMiraj commented 2 months ago

Edited it in my original response, thanks for the catch and glad I could help!

abbeycode commented 2 months ago

Meanwhile, should the onepassword package declare explicit dependencies on setuptools and wheel? Would that make this special instruction unnecessary?

jcphlux commented 2 months ago

Meanwhile, should the onepassword package declare explicit dependencies on setuptools and wheel? Would that make this special instruction unnecessary?

I agree or atleast add these steps to the Get started section.

MOmarMiraj commented 2 months ago

Thanks for the great suggestion @abbeycode and @jcphlux. I hear you guys as this is quite important and I will bring this information back to the team and we can determine the best possible way to go about this dependencies for the Python SDK.

I will close this issue for now and feel free to re-open if there is any more issues with this.