简体   繁体   中英

pip install web3 @ ubuntu

I'm having the following issue when trying to install web3 from pip:

$ sudo pip install web3
The directory '/home/chris/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/chris/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting web3
  Downloading https://files.pythonhosted.org/packages/96/76/6313b5d55edb5ac6fdbde9beacafefb04fccd692348ed2085856c95dda25/web3-4.1.0.tar.gz (85kB)
    100% |████████████████████████████████| 92kB 1.4MB/s 
Collecting cytoolz<1.0.0,>=0.9.0 (from web3)
  Downloading https://files.pythonhosted.org/packages/36/f4/9728ba01ccb2f55df9a5af029b48ba0aaca1081bbd7823ea2ee223ba7a42/cytoolz-0.9.0.1.tar.gz (443kB)
    100% |████████████████████████████████| 450kB 3.6MB/s 
Collecting eth-abi<2,>=1.0.0 (from web3)
  Downloading https://files.pythonhosted.org/packages/8d/f1/212b138e8e2e46788054b456a068ae060f07464fd03f5f7ec0eb749c35d0/eth-abi-1.0.0.tar.gz
Collecting eth-account==0.1.0-alpha.2 (from web3)
  Downloading https://files.pythonhosted.org/packages/57/8e/12a906f171f2860c0baf0f07bde4d7b390a3eacb29adc8341c7bbec356f6/eth-account-0.1.0a2.tar.gz
Collecting eth-utils<2.0.0,>=1.0.1 (from web3)
  Downloading https://files.pythonhosted.org/packages/6f/08/0787c6ccb1b8dca4a15c12f67ed3d383f9f361eeb1836d6fe698caf46bca/eth-utils-1.0.3.tar.gz
Collecting hexbytes<1.0.0,>=0.1.0 (from web3)
  Downloading https://files.pythonhosted.org/packages/81/15/fcd3a5ad583673ce52f0aac8e1246b91e7c88acbeae47863c30bfb264436/hexbytes-0.1.0.tar.gz
    Complete output from command python setup.py egg_info:
    zip_safe flag not set; analyzing archive contents...
    pypandoc.__init__: module references __file__

    Installed /tmp/pip-install-KPGcEs/hexbytes/.eggs/pypandoc-1.4-py2.7.egg
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-KPGcEs/hexbytes/setup.py", line 67, in <module>
        'Programming Language :: Python :: Implementation :: PyPy',
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 372, in __init__
        _Distribution.__init__(self, attrs)
      File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 528, in finalize_options
        ep.load()(self, ep.name, value)
      File "/tmp/pip-install-KPGcEs/hexbytes/.eggs/setuptools_markdown-0.2-py2.7.egg/setuptools_markdown.py", line 22, in long_description_markdown_filename
        output = pypandoc.convert(markdown_filename, 'rst')
      File "/tmp/pip-install-KPGcEs/hexbytes/.eggs/pypandoc-1.4-py2.7.egg/pypandoc/__init__.py", line 66, in convert
        raise RuntimeError("Format missing, but need one (identified source as text as no "
    RuntimeError: Format missing, but need one (identified source as text as no file with that name was found).

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-KPGcEs/hexbytes/

So whenever I try the .py script, I'm getting the following error:

from web3 import Web3, KeepAliveRPCProvider, IPCProvider
ImportError: cannot import name Web3

Any idea what could be causing this, or how to solve it?

I was able to solve that issue by moving web3==4.1.0 into a requirements.txt file and running pip install -r requirements.txt .

No idea why it worked. It still fails on attempts to install it from a setup.py file though.

By the way, according to web3 README they support only python 3.5+.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM