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

Incompatible dependencies in python 3.10 will make the sdk unusable. #91

Open
3 tasks done
luisgj opened this issue Mar 13, 2024 · 0 comments
Open
3 tasks done

Comments

@luisgj
Copy link

luisgj commented Mar 13, 2024

✅ Prerequisites

  • Did you perform a cursory search of open issues? Yes Is this bug already reported elsewhere? NO
  • Are you running the latest SDK version? Yes
  • Are you reporting to the correct repository (magic-admin-python)? Yes

🐛 Description

When installing some dependencies like the google sdk in python 3.10.8. Dependencies won't resolve. If you use a package manager like poetry and force the dependencies, poetry will detect incompatible dependencies and will downgrade version of web3.py from 5.31 to v4, which in turns downgrades eth-account, websockets and dependent packages.

This leads to an error in the sdk initialization:

migrate-1  |     from magic_admin import Magic
migrate-1  |   File "/usr/local/lib/python3.10/site-packages/magic_admin/__init__.py", line 1, in <module>
migrate-1  |     from magic_admin.magic import Magic
migrate-1  |   File "/usr/local/lib/python3.10/site-packages/magic_admin/magic.py", line 8, in <module>
migrate-1  |     from magic_admin.resources.base import ResourceComponent
migrate-1  |   File "/usr/local/lib/python3.10/site-packages/magic_admin/resources/__init__.py", line 1, in <module>
migrate-1  |     from magic_admin.resources.token import Token
migrate-1  |   File "/usr/local/lib/python3.10/site-packages/magic_admin/resources/token.py", line 4, in <module>
migrate-1  |     from eth_account.messages import defunct_hash_message
migrate-1  |   File "/usr/local/lib/python3.10/site-packages/eth_account/__init__.py", line 1, in <module>
migrate-1  |     from eth_account.account import Account  # noqa: F401
migrate-1  |   File "/usr/local/lib/python3.10/site-packages/eth_account/account.py", line 1, in <module>
migrate-1  |     from collections import (
migrate-1  | ImportError: cannot import name 'Mapping' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)

🧩 Steps to Reproduce

  1. Install and use poetry. And then isntall the sdk to exemplify: poetry add magic-admin
  2. run poetry install it should install websockets v6, web3 v5.31 and so on.
  3. run poetry add google-cloud-bigquery
  4. You will notice that the command hangs indefinitely when resolving deps.
  5. Kill the above command and force the installation to replicate the error. Manually add google-cloud-bigquery to the pyproject.toml file and run poetry lock to sync the lock file
  6. Run poetry install again
  7. You should see how google deps are added while web3.py and related deps get downgraded for some reason:
Installing dependencies from lock file

Package operations: 14 installs, 8 updates, 0 removals

  • Updating eth-hash (0.3.3 -> 0.7.0)
  • Updating eth-utils (1.10.0 -> 1.9.5)
  • Installing pyasn1 (0.5.1)
  • Installing cachetools (5.3.3)
  • Updating eth-keys (0.3.4 -> 0.2.4)
  • Updating protobuf (3.19.5 -> 4.25.3)
  • Installing pyasn1-modules (0.3.0)
  • Installing rsa (4.9)
  • Installing attrdict (2.0.1)
  • Installing google-auth (2.28.2)
  • Installing googleapis-common-protos (1.63.0)
  • Installing grpcio (1.62.1)
  • Updating eth-abi (2.2.0 -> 1.3.0)
  • Updating eth-account (0.5.9 -> 0.3.0)
  • Installing google-api-core (2.17.1)
  • Installing google-crc32c (1.5.0)
  • Installing grpcio-status (1.62.1)
  • Updating websockets (9.1 -> 6.0)
  • Installing google-cloud-core (2.4.1)
  • Installing google-resumable-media (2.7.0)
  • Updating web3 (5.31.4 -> 4.10.0)
  • Installing google-cloud-bigquery (3.19.0)

After that, the magic admin sdk will stop working throwing the mentioned error.

🤔 Expected behavior

Expected to install an unrelated dependency with no issues

😮 Actual behavior

Dependencies would not resolve for the google-sdk and if forced via a package manage, it will downgrade web3 to make it compatible, but this will break the magic sdk

💻 Code Sample

NA

🌎 Environment

Software Version(s)
magic-admin-python 1.0.0
python 3.10.8
Operating System macOS catalina
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant