即使安装了 Microsoft 构建工具后,在 Windows 上 pip install web3 也会出现错误

发布于 2025-01-17 05:39:17 字数 7312 浏览 4 评论 0原文

我是 python 新手,即使在安装了 microsoft 构建工具并选中了所有必需品(如 windows 10sdk 和所有 c++ 构建工具)后,我已经尝试安装 web3 几天了。但我仍然收到此错误。我已经用 google 搜索了这个问题但仍然没有解决方案,让我陷入这一步,这真的令人沮丧,我什至在安装微软构建工具后重新启动了我的系统,但我仍然收到下面的错误。

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>py -m pip install web3
Collecting web3
  Using cached web3-5.28.0-py3-none-any.whl (499 kB)
Collecting aiohttp<4,>=3.7.4.post0
  Using cached aiohttp-3.8.1-cp310-cp310-win_amd64.whl (555 kB)
Collecting eth-abi<3.0.0,>=2.0.0b6
  Using cached eth_abi-2.1.1-py3-none-any.whl (27 kB)
Collecting hexbytes<1.0.0,>=0.1.0
  Using cached hexbytes-0.2.2-py3-none-any.whl (6.1 kB)
Collecting ipfshttpclient==0.8.0a2
  Using cached ipfshttpclient-0.8.0a2-py3-none-any.whl (82 kB)
Requirement already satisfied: pywin32>=223 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from web3) (303)
Collecting protobuf<4,>=3.10.0
  Using cached protobuf-3.19.4-cp310-cp310-win_amd64.whl (895 kB)
Collecting eth-account<0.6.0,>=0.5.7
  Using cached eth_account-0.5.7-py3-none-any.whl (101 kB)
Requirement already satisfied: eth-typing<3.0.0,>=2.0.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from web3) (2.3.0)
Requirement already satisfied: eth-hash[pycryptodome]<1.0.0,>=0.2.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from web3) (0.3.2)
Collecting lru-dict<2.0.0,>=1.1.6
  Using cached lru-dict-1.1.7.tar.gz (10 kB)
  Preparing metadata (setup.py) ... done
Collecting eth-utils<2.0.0,>=1.9.5
  Using cached eth_utils-1.10.0-py3-none-any.whl (24 kB)
Collecting websockets<10,>=9.1
  Using cached websockets-9.1.tar.gz (76 kB)
  Preparing metadata (setup.py) ... done
Collecting jsonschema<4.0.0,>=3.2.0
  Using cached jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
Requirement already satisfied: requests<3.0.0,>=2.16.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from web3) (2.27.1)
Collecting multiaddr>=0.0.7
  Using cached multiaddr-0.0.9-py2.py3-none-any.whl (16 kB)
Collecting attrs>=17.3.0
  Using cached attrs-21.4.0-py2.py3-none-any.whl (60 kB)
Requirement already satisfied: charset-normalizer<3.0,>=2.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<4,>=3.7.4.post0->web3) (2.0.12)
Collecting aiosignal>=1.1.2
  Using cached aiosignal-1.2.0-py3-none-any.whl (8.2 kB)
Collecting yarl<2.0,>=1.0
  Using cached yarl-1.7.2-cp310-cp310-win_amd64.whl (122 kB)
Collecting frozenlist>=1.1.1
  Using cached frozenlist-1.3.0-cp310-cp310-win_amd64.whl (33 kB)
Collecting multidict<7.0,>=4.5
  Using cached multidict-6.0.2-cp310-cp310-win_amd64.whl (27 kB)
Collecting async-timeout<5.0,>=4.0.0a3
  Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting parsimonious<0.9.0,>=0.8.0
  Using cached parsimonious-0.8.1.tar.gz (45 kB)
  Preparing metadata (setup.py) ... done
Collecting rlp<3,>=1.0.0
  Using cached rlp-2.0.1-py2.py3-none-any.whl (20 kB)
Collecting bitarray<1.3.0,>=1.2.1
  Using cached bitarray-1.2.2.tar.gz (48 kB)
  Preparing metadata (setup.py) ... done
Collecting eth-keys<0.4.0,>=0.3.4
  Using cached eth_keys-0.3.4-py3-none-any.whl (21 kB)
Collecting eth-rlp<2,>=0.1.2
  Using cached eth_rlp-0.3.0-py3-none-any.whl (5.0 kB)
Collecting eth-keyfile<0.6.0,>=0.5.0
  Using cached eth_keyfile-0.5.1-py3-none-any.whl (8.3 kB)
Collecting pycryptodome<4,>=3.6.6
  Using cached pycryptodome-3.14.1-cp35-abi3-win_amd64.whl (1.8 MB)
Collecting cytoolz<1.0.0,>=0.10.1
  Using cached cytoolz-0.11.2.tar.gz (481 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: setuptools in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from jsonschema<4.0.0,>=3.2.0->web3) (61.2.0)
Collecting six>=1.11.0
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting pyrsistent>=0.14.0
  Using cached pyrsistent-0.18.1-cp310-cp310-win_amd64.whl (61 kB)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from requests<3.0.0,>=2.16.0->web3) (1.26.9)
Requirement already satisfied: idna<4,>=2.5 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from requests<3.0.0,>=2.16.0->web3) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from requests<3.0.0,>=2.16.0->web3) (2021.10.8)
Requirement already satisfied: toolz>=0.8.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from cytoolz<1.0.0,>=0.10.1->eth-utils<2.0.0,>=1.9.5->web3) (0.11.2)
Collecting eth-rlp<2,>=0.1.2
  Using cached eth_rlp-0.2.1-py3-none-any.whl (5.0 kB)
Collecting base58
  Using cached base58-2.1.1-py3-none-any.whl (5.6 kB)
Requirement already satisfied: varint in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from multiaddr>=0.0.7->ipfshttpclient==0.8.0a2->web3) (1.0.2)
Requirement already satisfied: netaddr in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from multiaddr>=0.0.7->ipfshttpclient==0.8.0a2->web3) (0.8.0)
Using legacy 'setup.py install' for lru-dict, since package 'wheel' is not installed.
Using legacy 'setup.py install' for websockets, since package 'wheel' is not installed.
Using legacy 'setup.py install' for bitarray, since package 'wheel' is not installed.
Using legacy 'setup.py install' for cytoolz, since package 'wheel' is not installed.
Using legacy 'setup.py install' for parsimonious, since package 'wheel' is not installed.
Installing collected packages: lru-dict, bitarray, websockets, six, pyrsistent, pycryptodome, protobuf, multidict, hexbytes, frozenlist, cytoolz, base58, attrs, async-timeout, yarl, parsimonious, multiaddr, jsonschema, eth-utils, aiosignal, rlp, ipfshttpclient, eth-keys, eth-abi, aiohttp, eth-rlp, eth-keyfile, eth-account, web3
  Running setup.py install for lru-dict ... error
  error: subprocess-exited-with-error

  × Running setup.py install for lru-dict did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      running install
      C:\Users\KADIT CUY\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'lru' extension
      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/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> lru-dict

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Please someone should help!!

I am new to python and i have have been trying to install web3 for some days even after installing microsoft build tools and checkmarking all the neccessities like windows 10sdk and all c++ build tools.But i'm still getting this error.I have googled this problem but still no solution,leaving me stuck at this step and its really frustrating , i even restarted my system after installing the microsoft build tools and yet i am still getting the error below.

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>py -m pip install web3
Collecting web3
  Using cached web3-5.28.0-py3-none-any.whl (499 kB)
Collecting aiohttp<4,>=3.7.4.post0
  Using cached aiohttp-3.8.1-cp310-cp310-win_amd64.whl (555 kB)
Collecting eth-abi<3.0.0,>=2.0.0b6
  Using cached eth_abi-2.1.1-py3-none-any.whl (27 kB)
Collecting hexbytes<1.0.0,>=0.1.0
  Using cached hexbytes-0.2.2-py3-none-any.whl (6.1 kB)
Collecting ipfshttpclient==0.8.0a2
  Using cached ipfshttpclient-0.8.0a2-py3-none-any.whl (82 kB)
Requirement already satisfied: pywin32>=223 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from web3) (303)
Collecting protobuf<4,>=3.10.0
  Using cached protobuf-3.19.4-cp310-cp310-win_amd64.whl (895 kB)
Collecting eth-account<0.6.0,>=0.5.7
  Using cached eth_account-0.5.7-py3-none-any.whl (101 kB)
Requirement already satisfied: eth-typing<3.0.0,>=2.0.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from web3) (2.3.0)
Requirement already satisfied: eth-hash[pycryptodome]<1.0.0,>=0.2.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from web3) (0.3.2)
Collecting lru-dict<2.0.0,>=1.1.6
  Using cached lru-dict-1.1.7.tar.gz (10 kB)
  Preparing metadata (setup.py) ... done
Collecting eth-utils<2.0.0,>=1.9.5
  Using cached eth_utils-1.10.0-py3-none-any.whl (24 kB)
Collecting websockets<10,>=9.1
  Using cached websockets-9.1.tar.gz (76 kB)
  Preparing metadata (setup.py) ... done
Collecting jsonschema<4.0.0,>=3.2.0
  Using cached jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
Requirement already satisfied: requests<3.0.0,>=2.16.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from web3) (2.27.1)
Collecting multiaddr>=0.0.7
  Using cached multiaddr-0.0.9-py2.py3-none-any.whl (16 kB)
Collecting attrs>=17.3.0
  Using cached attrs-21.4.0-py2.py3-none-any.whl (60 kB)
Requirement already satisfied: charset-normalizer<3.0,>=2.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<4,>=3.7.4.post0->web3) (2.0.12)
Collecting aiosignal>=1.1.2
  Using cached aiosignal-1.2.0-py3-none-any.whl (8.2 kB)
Collecting yarl<2.0,>=1.0
  Using cached yarl-1.7.2-cp310-cp310-win_amd64.whl (122 kB)
Collecting frozenlist>=1.1.1
  Using cached frozenlist-1.3.0-cp310-cp310-win_amd64.whl (33 kB)
Collecting multidict<7.0,>=4.5
  Using cached multidict-6.0.2-cp310-cp310-win_amd64.whl (27 kB)
Collecting async-timeout<5.0,>=4.0.0a3
  Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting parsimonious<0.9.0,>=0.8.0
  Using cached parsimonious-0.8.1.tar.gz (45 kB)
  Preparing metadata (setup.py) ... done
Collecting rlp<3,>=1.0.0
  Using cached rlp-2.0.1-py2.py3-none-any.whl (20 kB)
Collecting bitarray<1.3.0,>=1.2.1
  Using cached bitarray-1.2.2.tar.gz (48 kB)
  Preparing metadata (setup.py) ... done
Collecting eth-keys<0.4.0,>=0.3.4
  Using cached eth_keys-0.3.4-py3-none-any.whl (21 kB)
Collecting eth-rlp<2,>=0.1.2
  Using cached eth_rlp-0.3.0-py3-none-any.whl (5.0 kB)
Collecting eth-keyfile<0.6.0,>=0.5.0
  Using cached eth_keyfile-0.5.1-py3-none-any.whl (8.3 kB)
Collecting pycryptodome<4,>=3.6.6
  Using cached pycryptodome-3.14.1-cp35-abi3-win_amd64.whl (1.8 MB)
Collecting cytoolz<1.0.0,>=0.10.1
  Using cached cytoolz-0.11.2.tar.gz (481 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: setuptools in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from jsonschema<4.0.0,>=3.2.0->web3) (61.2.0)
Collecting six>=1.11.0
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting pyrsistent>=0.14.0
  Using cached pyrsistent-0.18.1-cp310-cp310-win_amd64.whl (61 kB)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from requests<3.0.0,>=2.16.0->web3) (1.26.9)
Requirement already satisfied: idna<4,>=2.5 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from requests<3.0.0,>=2.16.0->web3) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from requests<3.0.0,>=2.16.0->web3) (2021.10.8)
Requirement already satisfied: toolz>=0.8.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from cytoolz<1.0.0,>=0.10.1->eth-utils<2.0.0,>=1.9.5->web3) (0.11.2)
Collecting eth-rlp<2,>=0.1.2
  Using cached eth_rlp-0.2.1-py3-none-any.whl (5.0 kB)
Collecting base58
  Using cached base58-2.1.1-py3-none-any.whl (5.6 kB)
Requirement already satisfied: varint in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from multiaddr>=0.0.7->ipfshttpclient==0.8.0a2->web3) (1.0.2)
Requirement already satisfied: netaddr in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from multiaddr>=0.0.7->ipfshttpclient==0.8.0a2->web3) (0.8.0)
Using legacy 'setup.py install' for lru-dict, since package 'wheel' is not installed.
Using legacy 'setup.py install' for websockets, since package 'wheel' is not installed.
Using legacy 'setup.py install' for bitarray, since package 'wheel' is not installed.
Using legacy 'setup.py install' for cytoolz, since package 'wheel' is not installed.
Using legacy 'setup.py install' for parsimonious, since package 'wheel' is not installed.
Installing collected packages: lru-dict, bitarray, websockets, six, pyrsistent, pycryptodome, protobuf, multidict, hexbytes, frozenlist, cytoolz, base58, attrs, async-timeout, yarl, parsimonious, multiaddr, jsonschema, eth-utils, aiosignal, rlp, ipfshttpclient, eth-keys, eth-abi, aiohttp, eth-rlp, eth-keyfile, eth-account, web3
  Running setup.py install for lru-dict ... error
  error: subprocess-exited-with-error

  × Running setup.py install for lru-dict did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      running install
      C:\Users\KADIT CUY\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'lru' extension
      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/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> lru-dict

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Please someone should help!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

猥︴琐丶欲为 2025-01-24 05:39:17

您可以先尝试安装wheel:pip installwheel。然后你就可以避免使用setup.py install。

您可以将 Microsoft Visual C++ 更新到 14 或更高版本,如错误消息建议的那样。

You can try to install the wheel first: pip install wheel. Then you can avoid using setup.py install.

And you can update the Microsoft Visual C++ to 14 or greater like the error message suggestted.

听闻余生 2025-01-24 05:39:17

旁注:该错误源于安装 lru-dict,而不是直接安装 web3

您似乎已安装 Visual Studio 2022。您应该检查是否已安装编译 python 所需的所有可选功能(来自此处):

  • 安装 Python 开发工作负载和可选的 Python 本机开发工具选项。

  • 安装最新的 Windows SDK(在安装程序中的“本机开发”下)。

  • 可选:如果未检测到,请在构建之前将 $env:PlatformToolset 设置为您的工具集版本。 (或者,您可以打开开发人员命令提示符)

  • 更新到最新的 setuptools Python 包版本

特别是最后一个版本需要支持最新的编译器。运行pip install --upgrade setuptools。然后再次尝试安装

Sidenote: The error originates from installing lru-dict, not web3 directly.

You seem to have visual studio 2022 installed. You should check that you have installed all optional features needed for compiling for python (from here):

  • Install the Python development workload and the optional Python native development tools option.

  • Install the latest Windows SDK (under Native development in the installer).

  • Optional: Set $env:PlatformToolset to your toolset version before building, if it doesn't detect it. (Alternatively, you could open the developer command prompt)

  • Update to the latest setuptools Python package version

Especially the last is needed to have support for the latest compilers. Run pip install --upgrade setuptools. Then try to install again

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文