icon-project / icon-sdk-python

ICON SDK for Python
45 stars 44 forks source link

import iconsdk doesnt work #85

Closed paulrouge closed 2 months ago

paulrouge commented 2 months ago

When importing iconsdk I get an error:

/usr/local/lib/python3.8/dist-packages/eth_utils/network.py:44: UserWarning: Network 345 
with name 'Yooldo Verse Mainnet' does not have a valid ChainId. eth-typing should be updated 
with the latest networks.
 warnings.warn(
/usr/local/lib/python3.8/dist-packages/eth_utils/network.py:44: UserWarning: 
Network 12611 with name 'Astar zkEVM' does not have a valid ChainId. eth-typing should 
be updated with the latest networks.
  warnings.warn(

Im using Python 3.8.10 on a Linux machine.

eunsoo-icon commented 2 months ago

The error caused by eth libraries not by iconsdk.

What version of eth libraries do you use?

I have no problem with python 3.9.17 and following eth libraries

$ pip list                                                          
Package            Version
------------------ --------
...
eth-hash           0.7.0
eth-keyfile        0.6.1
eth-keys           0.4.0
eth-typing         3.5.2
eth-utils          2.3.1
...
sink772 commented 2 months ago

https://github.com/ethereum/eth-utils/pull/276

paulrouge commented 2 months ago

Thank you,

I'm not to familiar with Python. But shouldnt pip install iconsdk just work?

I get the error when importing iconsdk and I'm not importing anything else.

sink772 commented 2 months ago

Much like JavaScript development environments, Python also tends to have dependency hell.

It seems you've installed iconsdk in global context and using it without any sandboxed dependency env. It looks like eth-utils has been upgraded later while performing your other tasks.

Usually we use virtualenv to separate the dependencies from other Python projects.

You need to upgrade eth-utils by yourself if you'd like to keep using the global context dev env.

paulrouge commented 2 months ago

Thank you!