Web3 python ошибка

Set up a clean environment

Many things can cause a broken environment. You might be on an unsupported version of Python.
Another package might be installed that has a name or version conflict.
Often, the best way to guarantee a correct environment is with virtualenv, like:

# Install pip if it is not available:
$ which pip || curl https://bootstrap.pypa.io/get-pip.py | python

# Install virtualenv if it is not available:
$ which virtualenv || pip install --upgrade virtualenv

# *If* the above command displays an error, you can try installing as root:
$ sudo pip install virtualenv

# Create a virtual environment:
$ virtualenv -p python3 ~/.venv-py3

# Activate your new virtual environment:
$ source ~/.venv-py3/bin/activate

# With virtualenv active, make sure you have the latest packaging tools
$ pip install --upgrade pip setuptools

# Now we can install web3.py...
$ pip install --upgrade web3

Note

Remember that each new terminal session requires you to reactivate your virtualenv, like:
$ source ~/.venv-py3/bin/activate

Why can’t I use a particular function?

Note that a web3.py instance must be configured before you can use most of its capabilities.
One symptom of not configuring the instance first is an error that looks something like this:
AttributeError: type object 'Web3' has no attribute 'eth'.

To properly configure your web3.py instance, specify which provider you’re using to connect to the
Ethereum network. An example configuration, if you’re connecting to a locally run node, might be:

>>> from web3 import Web3
>>> w3 = Web3(Web3.HTTPProvider('http://localhost:8545'))

# now `w3` is available to use:
>>> w3.is_connected()
True
>>> w3.eth.send_transaction(...)

Refer to the Providers documentation for further help with configuration.

Why isn’t my web3 instance connecting to the network?

You can check that your instance is connected via the is_connected method:

>>> w3.is_connected()
False

There are a variety of explanations for why you may see False here. To help you
diagnose the problem, is_connected has an optional show_traceback argument:

>>> w3.is_connected(show_traceback=True)
# this is an example, your error may differ

# <long stack trace ouput>
ProviderConnectionError: Problem connecting to provider with error: <class 'FileNotFoundError'>: cannot connect to IPC socket at path: None

If you’re running a local node, such as Geth, double-check that you’ve indeed started
the binary and that you’ve started it from the intended directory — particularly if
you’ve specified a relative path to its ipc file.

If that does not address your issue, it’s probable that you still have a
Provider configuration issue. There are several options for configuring
a Provider, detailed here.

How do I use my MetaMask accounts from web3.py?

Often you don’t need to do this, just make a new account in web3.py,
and transfer funds from your MetaMask account into it. But if you must…

Export your private key from MetaMask, and use
the local private key tools in web3.py to sign and send transactions.

See how to export your private key
and Working with Local Private Keys.

How do I get ether for my test network?

Test networks usually have something called a “faucet” to
help get test ether to people who want to use it. The faucet
simply sends you test ether when you visit a web page, or ping a chat bot, etc.

Each test network has its own version of test ether, so each one
must maintain its own faucet. If you’re not sure which test network
to use, see Which network should I connect to?

Faucet mechanisms tend to come and go, so if any information here is
out of date, try the Ethereum Stackexchange.
Here are some links to testnet ether instructions (in no particular order):

  • Goerli (different faucet links on top menu bar)

  • Sepolia

Why can’t I create an account?

If you’re seeing the error The method personal_newAccount does not exist/is not available,
you may be trying to create an account while connected to a remote node provider, like Infura.
As a matter of security, remote nodes cannot create accounts.

If you are in fact running a local node, make sure that it’s properly configured to accept personal
methods. For Geth, that looks something like: --http.api personal,eth,<etc> or --ws.api personal,eth,<etc>
depending on your configuration. Note that the IPC configuration is most secure and includes the personal
API by default.

In general, your options for accounts are:

  • Run a node (e.g., Geth) locally, connect to it via the local port, then use the personal API.

  • Import a keystore file for an account and extract the private key.

  • Create an account via the eth-account API, e.g., new_acct = w3.eth.account.create().

  • Use an external service (e.g., MyCrypto) to generate a new account, then securely import its private key.

Warning

Don’t store real value in an account until you are familiar with security best practices.
If you lose your private key, you lose your account!

Making Ethereum JSON-RPC API access faster

Your Ethereum node JSON-RPC API might be slow when fetching multiple and large requests, especially when running batch jobs. Here are some tips for how to speed up your web3.py application.

  • Run your client locally, e.g., Go Ethereum or TurboGeth. The network latency and speed are the major limiting factors for fast API access.

  • Use IPC communication instead of HTTP/WebSockets. See Choosing How to Connect to Your Node.

  • Use an optimised JSON decoder. A future iteration of web3.py may change the default decoder or provide an API to configure one, but for now, you may patch the provider class to use ujson.

"""JSON-RPC decoding optimised for web3.py"""

from typing import cast

import ujson

from web3.providers import JSONBaseProvider
from web3.types import RPCResponse


def _fast_decode_rpc_response(raw_response: bytes) -> RPCResponse:
    decoded = ujson.loads(raw_response)
    return cast(RPCResponse, decoded)


def patch_provider(provider: JSONBaseProvider):
    """Monkey-patch web3.py provider for faster JSON decoding.

    Call this on your provider after construction.

    This greatly improves JSON-RPC API access speeds, when fetching
    multiple and large responses.
    """
    provider.decode_rpc_response = _fast_decode_rpc_response

Why am I getting Visual C++ or Cython not installed error?

Some Windows users that do not have Microsoft Visual C++ version 14.0 or greater installed may see an error message
when installing web3.py as shown below:

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

To fix this error, download and install Microsoft Visual C++ from here :

Microsoft Visual C++ Redistributable for Visual Studio

  • x64 Visual C++

  • x86 Visual C++

  • ARM64 Visual C++

I assume you were trying to install web3 using the pip command python -m pip install web3 (or pip install web3 for short, although the first form is better). I got roughly the same error when performing this command.

The problem isn’t in web3, however, but in one of its dependencies. You can check this by installing it with --no-deps, which works fine:

C:tempstack_overflow>pip install --no-deps web3
Collecting web3
  Using cached web3-5.24.0-py3-none-any.whl (487 kB)
Installing collected packages: web3
Successfully installed web3-5.24.0

But this probably doesn’t solve your problem, because the module likely doesn’t work without all its dependencies. The dependency that is failing in this case is bitarray. This is because bitarray is a source package. The documentation of this library contains installation instructions:

If you have a working C compiler, you can simply:

$ pip install bitarray

If you rather want to use precompiled binaries, you can:

  • conda install bitarray (both the default Anaconda repository as well as conda-forge support bitarray)
  • download Windows wheels from Chris Gohlke

I did the last step: downloading the wheel from the mentioned website, and installing it with pip install bitarray-2.3.4-cp38-cp38-win_amd64.whl (your version may be different of course). This worked like a charm.

However, web3 also has a dependency on lru-dict, which resulted in the same issue. Unfortunately, I could not find pre-compiled binaries for this package, so if you encounter the same problem, you now have two options:

  1. Use conda-forge to install your packages. I personally don’t have experience with conda, but conda-forge seems to support the lru-dict package (as well as the above-mentioned bitarray package).

  2. Make sure to install Microsoft Visual C++ 14.0 or greater. As mentioned in the error message: Get it with «Microsoft C++ Build Tools»: https://visualstudio.microsoft.com/visual-cpp-build-tools/

    This page contains some more detailed instructions on how to download and install it.

I got it working by updating the Visual C++ compiler to the latest version and make sure to include the Windows 10 SDK, as explained in this SO answer.

(venv) C:tempstack_overflow>python.exe -m pip install web3
Collecting web3
  Using cached web3-5.24.0-py3-none-any.whl (487 kB)
(...lots of lines listing requirements already satisfied...)
Building wheels for collected packages: lru-dict, bitarray
  Building wheel for lru-dict (setup.py) ... done
  Created wheel for lru-dict: filename=lru_dict-1.1.7-cp39-cp39-win_amd64.whl size=12711 sha256=a6ccbda691f0a941591c1b9c1ae24a5a4ee26d726685f2e71aa382e5b77a3d65
  Stored in directory: c:userswovanoappdatalocalpipcachewheels863ff66efebdbc72403e91c39f8cc817f61627d065eed97921b8e5b8
  Building wheel for bitarray (setup.py) ... done
  Created wheel for bitarray: filename=bitarray-1.2.2-cp39-cp39-win_amd64.whl size=55817 sha256=a03c3e6ac482b1cbe4adce197f0bd4333c7094af2d785f5575bdff16a024710d
  Stored in directory: c:userswovanoappdatalocalpipcachewheelsf6b38dbb7212600c4671dcb713dec6574c37b118c2c321e6ed52fe3
Successfully built lru-dict bitarray
Installing collected packages: bitarray, attrs, async-timeout, websockets, pywin32, protobuf, lru-dict, jsonschema, ipfshttpclient, eth-account, aiohttp, web3
Successfully installed aiohttp-3.7.4.post0 async-timeout-3.0.1 attrs-21.2.0 bitarray-1.2.2 eth-account-0.5.6 ipfshttpclient-0.8.0a2 jsonschema-3.2.0 lru-dict-1.1.7 protobuf-3.18.1 pywin32-302 web3-5.24.0 websockets-9.1

NB: It is recommended to install web3 in a clean virtual environment, to avoid version conflicts with other installed modules.

Thanks, The first 2 commands worked fine, but the third one (pip install web3) failed.

(venv) ubuntu@ip-172-39-31-91:~$ pip install web3
Collecting web3
  Using cached https://files.pythonhosted.org/packages/45/9a/3f08f27566d8b00fc1b472ce97c858ce6d8cc3794304d8b2ccbc81295747/web3-4.3.0-py3-none-any.whl
Collecting eth-account<0.3.0,>=0.2.1 (from web3)
  Using cached https://files.pythonhosted.org/packages/1c/f4/752b666464002dbd30d30443426cd25c045f941ae5f5e7b08eda1aee3c68/eth_account-0.2.3-py3-none-any.whl
Collecting lru-dict<2.0.0,>=1.1.6 (from web3)
  Using cached https://files.pythonhosted.org/packages/00/a5/32ed6e10246cd341ca8cc205acea5d208e4053f48a4dced2b1b31d45ba3f/lru-dict-1.1.6.tar.gz
Collecting cytoolz<1.0.0,>=0.9.0; implementation_name == "cpython" (from web3)
  Using cached https://files.pythonhosted.org/packages/36/f4/9728ba01ccb2f55df9a5af029b48ba0aaca1081bbd7823ea2ee223ba7a42/cytoolz-0.9.0.1.tar.gz
Collecting eth-utils<2.0.0,>=1.0.1 (from web3)
  Using cached https://files.pythonhosted.org/packages/67/fd/e37d9b07c3e5acbabb79dc92f46bc0723246a30fbf3fa1242cd208b0bfec/eth_utils-1.0.3-py3-none-any.whl
Collecting requests<3.0.0,>=2.16.0 (from web3)
  Using cached https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl
Collecting websockets<5.0.0,>=4.0.1 (from web3)
  Using cached https://files.pythonhosted.org/packages/4a/30/f68f8e72901609397ced5cd5b59002716b3e64b1a364631124820a06fe0a/websockets-4.0.1-cp35-cp35m-manylinux1_x86_64.whl
Collecting hexbytes<1.0.0,>=0.1.0 (from web3)
  Using cached https://files.pythonhosted.org/packages/18/bd/21697d93ee2153c8c12253262b740f571e94341d4cee411504032fff3f56/hexbytes-0.1.0-py3-none-any.whl
Collecting eth-abi<2,>=1.1.1 (from web3)
  Using cached https://files.pythonhosted.org/packages/a2/2b/8529812e103639a6084c9d5d62862052989cf3877a76253509fc6f19eab6/eth_abi-1.1.1-py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): eth-hash[pycryptodome] in ./venv/lib/python3.5/site-packages (from web3)
Collecting eth-keys<0.3.0,>=0.2.0b3 (from eth-account<0.3.0,>=0.2.1->web3)
  Using cached https://files.pythonhosted.org/packages/9b/96/bec507291a2ecac65358b4485282ce02e8c0cdd30980a232791b355a1f5b/eth_keys-0.2.0b3-py3-none-any.whl
Collecting eth-keyfile<0.6.0,>=0.5.0 (from eth-account<0.3.0,>=0.2.1->web3)
  Using cached https://files.pythonhosted.org/packages/eb/a5/3615d100b62fbf20fe5d5c0d1d4d7326eac861d260b0cd2a36af2bf8ccb1/eth_keyfile-0.5.1-py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): attrdict<3,>=2.0.0 in ./venv/lib/python3.5/site-packages (from eth-account<0.3.0,>=0.2.1->web3)
Collecting eth-rlp<1,>=0.1.2 (from eth-account<0.3.0,>=0.2.1->web3)
  Using cached https://files.pythonhosted.org/packages/56/4b/b309fb44dd9bb975e84f3d626392eec1eeed0108e55a51cd7dd8956a73ad/eth_rlp-0.1.2-py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): toolz>=0.8.0 in ./venv/lib/python3.5/site-packages (from cytoolz<1.0.0,>=0.9.0; implementation_name == "cpython"->web3)
Collecting urllib3<1.23,>=1.21.1 (from requests<3.0.0,>=2.16.0->web3)
  Using cached https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests<3.0.0,>=2.16.0->web3)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests<3.0.0,>=2.16.0->web3)
  Using cached https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests<3.0.0,>=2.16.0->web3)
  Using cached https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl
Collecting parsimonious==0.8.0 (from eth-abi<2,>=1.1.1->web3)
  Using cached https://files.pythonhosted.org/packages/4a/89/32c55944cd30dff856f16859ee325b13c83c260d0c56c0eed511e8063c87/parsimonious-0.8.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pycryptodome<4,>=3.5.1; extra == "pycryptodome" in ./venv/lib/python3.5/site-packages (from eth-hash[pycryptodome]->web3)
Requirement already satisfied (use --upgrade to upgrade): six in ./venv/lib/python3.5/site-packages (from attrdict<3,>=2.0.0->eth-account<0.3.0,>=0.2.1->web3)
Collecting rlp<2,>=0.6.0 (from eth-rlp<1,>=0.1.2->eth-account<0.3.0,>=0.2.1->web3)
  Using cached https://files.pythonhosted.org/packages/b4/dc/a54b93cac06f46ef49b8da6cb06a6bf77ba65bf45dec5c498f51ceefc5c6/rlp-1.0.1-py2.py3-none-any.whl
Building wheels for collected packages: lru-dict, cytoolz, parsimonious
  Running setup.py bdist_wheel for lru-dict ... error
  Complete output from command /home/ubuntu/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-__5xdn1r/lru-dict/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp_fgde02zpip-wheel- --python-tag cp35:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help
  
  error: invalid command 'bdist_wheel'
  
  ----------------------------------------
  Failed building wheel for lru-dict
  Running setup.py clean for lru-dict
  Running setup.py bdist_wheel for cytoolz ... error
  Complete output from command /home/ubuntu/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-__5xdn1r/cytoolz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpsv6_x1w6pip-wheel- --python-tag cp35:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help
  
  error: invalid command 'bdist_wheel'
  
  ----------------------------------------
  Failed building wheel for cytoolz
  Running setup.py clean for cytoolz
  Running setup.py bdist_wheel for parsimonious ... error
  Complete output from command /home/ubuntu/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-__5xdn1r/parsimonious/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpd50wiygcpip-wheel- --python-tag cp35:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help
  
  error: invalid command 'bdist_wheel'
  
  ----------------------------------------
  Failed building wheel for parsimonious
  Running setup.py clean for parsimonious
Failed to build lru-dict cytoolz parsimonious
Installing collected packages: cytoolz, eth-utils, eth-keys, eth-keyfile, rlp, hexbytes, eth-rlp, eth-account, lru-dict, urllib3, chardet, idna, certifi, requests, websockets, parsimonious, eth-abi, web3
  Running setup.py install for cytoolz ... error
    Complete output from command /home/ubuntu/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-__5xdn1r/cytoolz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" install --record /tmp/pip-e5ysv_71-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/venv/include/site/python3.5/cytoolz:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/_signatures.py -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/_version.py -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/compatibility.py -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/__init__.py -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/utils_test.py -> build/lib.linux-x86_64-3.5/cytoolz
    creating build/lib.linux-x86_64-3.5/cytoolz/curried
    copying cytoolz/curried/exceptions.py -> build/lib.linux-x86_64-3.5/cytoolz/curried
    copying cytoolz/curried/__init__.py -> build/lib.linux-x86_64-3.5/cytoolz/curried
    copying cytoolz/curried/operator.py -> build/lib.linux-x86_64-3.5/cytoolz/curried
    copying cytoolz/utils.pyx -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/recipes.pyx -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/dicttoolz.pyx -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/itertoolz.pyx -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/functoolz.pyx -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/itertoolz.pxd -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/dicttoolz.pxd -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/cpython.pxd -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/__init__.pxd -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/utils.pxd -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/functoolz.pxd -> build/lib.linux-x86_64-3.5/cytoolz
    copying cytoolz/recipes.pxd -> build/lib.linux-x86_64-3.5/cytoolz
    creating build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_tlz.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_itertoolz.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_compatibility.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_curried_toolzlike.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_serialization.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_none_safe.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_dev_skip_test.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_signatures.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_docstrings.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/dev_skip_test.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_utils.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_functoolz.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_doctests.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_embedded_sigs.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_dicttoolz.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_curried.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_inspect_args.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    copying cytoolz/tests/test_recipes.py -> build/lib.linux-x86_64-3.5/cytoolz/tests
    running build_ext
    building 'cytoolz.dicttoolz' extension
    creating build/temp.linux-x86_64-3.5
    creating build/temp.linux-x86_64-3.5/cytoolz
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/ubuntu/venv/include -I/usr/include/python3.5m -c cytoolz/dicttoolz.c -o build/temp.linux-x86_64-3.5/cytoolz/dicttoolz.o
    cytoolz/dicttoolz.c:17:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/home/ubuntu/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-__5xdn1r/cytoolz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" install --record /tmp/pip-e5ysv_71-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/venv/include/site/python3.5/cytoolz" failed with error code 1 in /tmp/pip-build-__5xdn1r/cytoolz/
You are using pip version 8.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Without your source code, it’s hard to say exactly what’s going wrong. However, you might have mismatched pip and python if your environment already has Python 2 installed and you’re attempting to use Python 3.

If I pip install web3 and then create a file with the following contents:

import json
import web3

from web3 import Web3, HTTPProvider, TestRPCProvider

I don’t have any problems with it on macOS with Python 3:

$ pip --version

pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)

$ python --version

Python 3.6.4

You might consider looking into virtualenv so that you can have a clean Python environment each time you want to work with it. This can also help ensure you have isolation between Python versions and pip installs.

Python pycharm project: how to solve «no web3 module» using CDN link

Hi,

I am getting ‘1 low severity vulnerability problem» while installing web3.js. I am trying to compile a python code on ubuntu 18.04:

from __future__ import print_function

from web3 import Web3, KeepAliveRPCProvider, IPCProvider

import argparse,subprocess,sys

At the end I am getting the error:

ModuleNotFoundError: No module named ‘web3’

I found one post which says:

You can try to add the web3 script from a CDN like this: cdnjs.com/libraries/web3

Can the above hint help me to solve the web3 module not found error on PyCharm3.0?

I also have python3 installed on my Ubuntu terminal

Please guide me how I can implement the above technique?

Понравилась статья? Поделить с друзьями:
  • Web сервис 1с ошибка 500
  • Web ошибка 302
  • Wil 105 коды ошибок
  • Web api обработка ошибок
  • Wii u ошибка 160 0103