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

Fix requests version of install_requires to solve idna dependency #562

Merged
merged 1 commit into from Jan 22, 2018

Conversation

@dongsam
Copy link
Contributor

commented Jan 17, 2018

What was wrong?

occur ImportError: No module named 'idna' after pip install on macOS high sierra, Python 3.5.2


ImportError Traceback (most recent call last)
in ()
----> 1 from web3 import Web3, HTTPProvider, IPCProvider
~/.pyenv/versions/3.5.2/envs/morecoin-3.5.2/lib/python3.5/site-packages/web3/init.py in ()
5 raise EnvironmentError("Python 3.5 or above is required")
6
----> 7 from web3.account import Account # noqa: E402
8 from web3.main import Web3 # noqa: E402
9 from web3.providers.rpc import ( # noqa: E402

~/.pyenv/versions/3.5.2/envs/morecoin-3.5.2/lib/python3.5/site-packages/web3/account.py in ()
27 )
28
---> 29 from web3.utils.datastructures import (
30 AttributeDict,
31 HexBytes,

~/.pyenv/versions/3.5.2/envs/morecoin-3.5.2/lib/python3.5/site-packages/web3/utils/datastructures.py in ()
8 )
9
---> 10 from web3.utils.encoding import (
11 hexstr_if_str,
12 to_bytes,

~/.pyenv/versions/3.5.2/envs/morecoin-3.5.2/lib/python3.5/site-packages/web3/utils/encoding.py in ()
29 )
30
---> 31 from web3.utils.abi import (
32 is_address_type,
33 is_array_type,

~/.pyenv/versions/3.5.2/envs/morecoin-3.5.2/lib/python3.5/site-packages/web3/utils/abi.py in ()
28 )
29
---> 30 from web3.utils.ens import is_ens_name
31
32 from web3.utils.formatters import (

~/.pyenv/versions/3.5.2/envs/morecoin-3.5.2/lib/python3.5/site-packages/web3/utils/ens.py in ()
7 )
8
----> 9 from ens import ENS
10
11 from web3.exceptions import (

~/.pyenv/versions/3.5.2/envs/morecoin-3.5.2/lib/python3.5/site-packages/ens/init.py in ()
1 # flake8: noqa
2
----> 3 from .main import (
4 ENS,
5 )

~/.pyenv/versions/3.5.2/envs/morecoin-3.5.2/lib/python3.5/site-packages/ens/main.py in ()
12 )
13
---> 14 from ens.exceptions import (
15 AddressMismatch,
16 UnauthorizedError,

~/.pyenv/versions/3.5.2/envs/morecoin-3.5.2/lib/python3.5/site-packages/ens/exceptions.py in ()
----> 1 import idna
2
3
4 class AddressMismatch(ValueError):
5 '''

ImportError: No module named 'idna'

additional finding

when pip install web3, if already installed requests lower then 2.16.0 idna could be not installed

when i tested pip install requests version in 2.12.4, 2.12.5, 2.13.0, 2.14.0, 2.14.1, 2.14.2, 2.15.1,
not installed idna, 2.16.0 is start version what install with idna

How was it fixed?

add idna package on install_requires
pip install test succeed after adding idna on install_requires
or "requests>=2.12.4,<3.0.0" to "requests>=2.16.0,<3.0.0",

you can test by pip install git+https://github.com/dongsam/web3.py@patch-1

Cute Animal Picture

Cute animal picture

@carver

This comment has been minimized.

Copy link
Collaborator

commented Jan 17, 2018

Hmm, requests already requires idna, so this shouldn't have happened. How exactly did you install? Can you show the log output of a fresh install?

@dongsam

This comment has been minimized.

Copy link
Contributor Author

commented Jan 18, 2018

@carver Yes, I just find environment for error occur
when pip install web3, if already installed requests lower then 2.16.0 idna could be not installed

when i tested pip install requests version in 2.12.4, 2.12.5, 2.13.0, 2.14.0, 2.14.1, 2.14.2, 2.15.1,
not installed idna, 2.16.0 is start version what install with idna

(3.5.2/envs/web3) dongsamb:~ dongsamb$ pip3 freeze  ## clean environment 
(3.5.2/envs/web3) dongsamb:~ dongsamb$ pip3 install requests==2.12.4
Collecting requests==2.12.4
  Using cached requests-2.12.4-py2.py3-none-any.whl
Installing collected packages: requests
Successfully installed requests-2.12.4
(3.5.2/envs/web3) dongsamb:~ dongsamb$ pip3 install git+https://github.com/ethereum/web3.py
Collecting git+https://github.com/ethereum/web3.py
  Cloning https://github.com/ethereum/web3.py to /private/var/folders/n4/wmnzt26s0fs7cfqn5nqdqz240000gn/T/pip-gw84l2i4-build
Collecting cytoolz<1.0.0,>=0.9.0 (from web3==4.0.0b5)
  Using cached cytoolz-0.9.0.tar.gz
Collecting eth-abi<1.0.0,>=0.5.0 (from web3==4.0.0b5)
  Using cached eth_abi-0.5.0-py3-none-any.whl
Collecting eth-keyfile<1.0.0,>=0.4.0 (from web3==4.0.0b5)
  Using cached eth_keyfile-0.4.1-py3-none-any.whl
Collecting eth-keys<0.2.0,>=0.1.0b4 (from web3==4.0.0b5)
  Using cached eth_keys-0.1.0b4-py3-none-any.whl
Collecting eth-utils<1.0.0,>=0.7.1 (from web3==4.0.0b5)
  Using cached eth_utils-0.7.4-py3-none-any.whl
Collecting lru-dict<2.0.0,>=1.1.6 (from web3==4.0.0b5)
  Using cached lru-dict-1.1.6.tar.gz
Collecting pysha3<2.0.0,>=1.0.0 (from web3==4.0.0b5)
  Using cached pysha3-1.0.2.tar.gz
Requirement already satisfied: requests<3.0.0,>=2.12.4 in ./.pyenv/versions/3.5.2/envs/web3/lib/python3.5/site-packages (from web3==4.0.0b5)
Collecting rlp<1.0.0,>=0.4.7 (from web3==4.0.0b5)
  Using cached rlp-0.6.0.tar.gz
Collecting eth-tester<0.2.0,>=0.1.0b11 (from web3==4.0.0b5)
  Using cached eth_tester-0.1.0b11-py3-none-any.whl
Collecting toolz>=0.8.0 (from cytoolz<1.0.0,>=0.9.0->web3==4.0.0b5)
  Using cached toolz-0.9.0.tar.gz
Collecting pycryptodome<4.0.0,>=3.4.7 (from eth-keyfile<1.0.0,>=0.4.0->web3==4.0.0b5)
  Using cached pycryptodome-3.4.7.tar.gz
Collecting semantic-version<3.0.0,>=2.6.0 (from eth-tester<0.2.0,>=0.1.0b11->web3==4.0.0b5)
  Using cached semantic_version-2.6.0-py3-none-any.whl
Installing collected packages: toolz, cytoolz, pysha3, eth-utils, eth-abi, pycryptodome, eth-keys, eth-keyfile, lru-dict, rlp, semantic-version, eth-tester, web3
  Running setup.py install for toolz ... done
  Running setup.py install for cytoolz ... done
  Running setup.py install for pysha3 ... done
  Running setup.py install for pycryptodome ... done
  Running setup.py install for lru-dict ... done
  Running setup.py install for rlp ... done
  Running setup.py install for web3 ... done
Successfully installed cytoolz-0.9.0 eth-abi-0.5.0 eth-keyfile-0.4.1 eth-keys-0.1.0b4 eth-tester-0.1.0b11 eth-utils-0.7.4 lru-dict-1.1.6 pycryptodome-3.4.7 pysha3-1.0.2 rlp-0.6.0 semantic-version-2.6.0 toolz-0.9.0 web3-4.0.0b5
(3.5.2/envs/web3) dongsamb:~ dongsamb$ python3
Python 3.5.2 (default, Apr 30 2017, 08:04:02)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import web3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/dongsamb/.pyenv/versions/3.5.2/envs/web3/lib/python3.5/site-packages/web3/__init__.py", line 7, in <module>
    from web3.account import Account  # noqa: E402
  File "/Users/dongsamb/.pyenv/versions/3.5.2/envs/web3/lib/python3.5/site-packages/web3/account.py", line 29, in <module>
    from web3.utils.datastructures import (
  File "/Users/dongsamb/.pyenv/versions/3.5.2/envs/web3/lib/python3.5/site-packages/web3/utils/datastructures.py", line 10, in <module>
    from web3.utils.encoding import (
  File "/Users/dongsamb/.pyenv/versions/3.5.2/envs/web3/lib/python3.5/site-packages/web3/utils/encoding.py", line 31, in <module>
    from web3.utils.abi import (
  File "/Users/dongsamb/.pyenv/versions/3.5.2/envs/web3/lib/python3.5/site-packages/web3/utils/abi.py", line 30, in <module>
    from web3.utils.ens import is_ens_name
  File "/Users/dongsamb/.pyenv/versions/3.5.2/envs/web3/lib/python3.5/site-packages/web3/utils/ens.py", line 9, in <module>
    from ens import ENS
  File "/Users/dongsamb/.pyenv/versions/3.5.2/envs/web3/lib/python3.5/site-packages/ens/__init__.py", line 3, in <module>
    from .main import (
  File "/Users/dongsamb/.pyenv/versions/3.5.2/envs/web3/lib/python3.5/site-packages/ens/main.py", line 14, in <module>
    from ens.exceptions import (
  File "/Users/dongsamb/.pyenv/versions/3.5.2/envs/web3/lib/python3.5/site-packages/ens/exceptions.py", line 1, in <module>
    import idna
ImportError: No module named 'idna'
>>>

so if other also occur like that, i think we need to add idna to install_requires or "requests>=2.12.4,<3.0.0" to "requests>=2.16.0,<3.0.0",

@carver

This comment has been minimized.

Copy link
Collaborator

commented Jan 18, 2018

Great, thanks for tracking that down! Let's change the requests dependency to "requests>=2.16.0,<3.0.0". Would you update the PR?

@carver

This comment has been minimized.

Copy link
Collaborator

commented Jan 18, 2018

👍 When the tests pass, I'll merge.

Fix requests version of install_requires
fix to requests>=2.16.0,<3.0.0 for solve dependency of idna
-----------------------------------
add idna package on install_requires,
to solve occur No module error on macOS high sierra, Python 3.5.2

@dongsam dongsam force-pushed the dongsam:patch-1 branch from c4287d2 to 67d85ec Jan 18, 2018

@dongsam dongsam changed the title Add idna on install_requires Fix requests version of install_requires to solve idna dependency Jan 18, 2018

@dongsam

This comment has been minimized.

Copy link
Contributor Author

commented Jan 20, 2018

I think it is ready to merge, but tell me if need to rebase and retest

@carver carver merged commit ba56cbd into ethereum:master Jan 22, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@carver

This comment has been minimized.

Copy link
Collaborator

commented Jan 22, 2018

Thanks @dongsam !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.