How can I fix this error installing web3 on Python - python

ERROR: Command errored out with exit status 1:
command: 'C:\Program Files\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\KimXD\\AppData\\Local\\Temp\\pip-install-7pjpmdge\\bitarray_3a1e8028774c4a059cdba67b160795fd\\setup.py'"'"'; __file__='"'"'C:\\Users\\KimXD\\AppData\\Local\\Temp\\pip-install-7pjpmdge\\bitarray_3a1e8028774c4a059cdba67b160795fd\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\KimXD\AppData\Local\Temp\pip-record-f8bq9svc\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\KimXD\AppData\Roaming\Python\Python39\Include\bitarray'
cwd: C:\Users\KimXD\AppData\Local\Temp\pip-install-7pjpmdge\bitarray_3a1e8028774c4a059cdba67b160795fd\
Complete output (17 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\bitarray
copying bitarray\test_bitarray.py -> build\lib.win-amd64-3.9\bitarray
copying bitarray\test_util.py -> build\lib.win-amd64-3.9\bitarray
copying bitarray\util.py -> build\lib.win-amd64-3.9\bitarray
copying bitarray\__init__.py -> build\lib.win-amd64-3.9\bitarray
running build_ext
building 'bitarray._bitarray' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\bitarray
cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Program Files\Python39\include -IC:\Program Files\Python39\include /Tcbitarray/_bitarray.c /Fobuild\temp.win-amd64-3.9\Release\bitarray/_bitarray.obj
error: command 'cl.exe' failed: None
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Program Files\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\KimXD\\AppData\\Local\\Temp\\pip-install-7pjpmdge\\bitarray_3a1e8028774c4a059cdba67b160795fd\\setup.py'"'"'; __file__='"'"'C:\\Users\\KimXD\\AppData\\Local\\Temp\\pip-install-7pjpmdge\\bitarray_3a1e8028774c4a059cdba67b160795fd\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\KimXD\AppData\Local\Temp\pip-record-f8bq9svc\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\KimXD\AppData\Roaming\Python\Python39\Include\bitarray' Check the logs for full command output.

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:\temp\stack_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:
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).
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:\temp\stack_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:\users\wovano\appdata\local\pip\cache\wheels\86\3f\f6\6efebdbc72403e91c39f8cc817f61627d065eed97921b8e5b8
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:\users\wovano\appdata\local\pip\cache\wheels\f6\b3\8d\0bb7212600c4671dcb713dec6574c37b118c2c321e6ed52fe3
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.

Let me tell you one perfect solution for such problems. It is always better to have a virtual environment which solves the version problems of the different problems ... you may follow the below process and it will help
# 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

I have an equal problem and I resolved with anaconda.
First check your Microsoft Visual C++, install and restart your computer.
Second, you should watch a some Anaconda's tutorial, after that, you need to create a virtual environment, pick the folder and done.
Example in code : In to cmd
1) conda create --name 'pick a name'
2) conda activate 'yourname'
3) conda install -c conda-forge web3
After that, go to your text editor and pick how python interpreter (alt+shift+p in VSC), the one you already created like ENVS, look in C:\Users'youruser'.conda\envs'yournameENVS.

Related

pip metadata-generation-failed when i wanna to download demjson [duplicate]

version pip 21.2.4
python 3.6
The command:
pip install -r requirements.txt
The content of my requirements.txt:
mongoengine==0.19.1
numpy==1.16.2
pylint
pandas==1.1.5
fawkes
The command is failing with this error
ERROR: Command errored out with exit status 1:
command: /Users/*/Desktop/ml/*/venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/setup.py'"'"'; __file__='"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-pip-egg-info-97994d6e
cwd: /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/
Complete output (1 lines):
error in mongoengine setup command: use_2to3 is invalid.
----------------------------------------
WARNING: Discarding https://*/pypi/packages/mongoengine-0.19.1.tar.gz#md5=68e613009f6466239158821a102ac084 (from https://*/pypi/simple/mongoengine/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mongoengine==0.19.1 (from versions: 0.15.0, 0.19.1)
ERROR: No matching distribution found for mongoengine==0.19.1
It looks like setuptools>=58 breaks support for use_2to3:
setuptools changelog for v58
So you should update setuptools to setuptools<58 or avoid using packages with use_2to3 in the setup parameters.
I was having the same problem, pip==19.3.1
I install setuptools==58It worked for me. pip install setuptools==58. The error coming from setuptools==69 that previously run on my device. and Finally saved me setuptools version 58 for this error.
This worked for me.
pip install --upgrade pip setuptools==57.5.0
"pip install setuptools==58" worked for me. The setuptools version was 59 when I upgraded ubuntu to 22.04 and its python 3.10. I started a clean virtual environment for an existings django project. It had just two packages:
`pip list
Package Version
pip 22.0.2
setuptools 59.6.0`
Then I downgrade the setuptools to 58 as pip install setuptools==58.0.0. After that the pip install -r requirements.txt has not such error above.
Upgrading MongoEngine to >= 0.20 would also fix the problem as Python2 support (hence use_2to3) was dropped in 0.20
I'm working on Windows 11 and these solutions didn't work. I installed pybluez2 instead. Your python version >= 3.9 on Windows.
pip install pybluez2

Error while downloading the requirements using pip install (setup command: use_2to3 is invalid.)

version pip 21.2.4
python 3.6
The command:
pip install -r requirements.txt
The content of my requirements.txt:
mongoengine==0.19.1
numpy==1.16.2
pylint
pandas==1.1.5
fawkes
The command is failing with this error
ERROR: Command errored out with exit status 1:
command: /Users/*/Desktop/ml/*/venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/setup.py'"'"'; __file__='"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-pip-egg-info-97994d6e
cwd: /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/
Complete output (1 lines):
error in mongoengine setup command: use_2to3 is invalid.
----------------------------------------
WARNING: Discarding https://*/pypi/packages/mongoengine-0.19.1.tar.gz#md5=68e613009f6466239158821a102ac084 (from https://*/pypi/simple/mongoengine/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mongoengine==0.19.1 (from versions: 0.15.0, 0.19.1)
ERROR: No matching distribution found for mongoengine==0.19.1
It looks like setuptools>=58 breaks support for use_2to3:
setuptools changelog for v58
So you should update setuptools to setuptools<58 or avoid using packages with use_2to3 in the setup parameters.
I was having the same problem, pip==19.3.1
I install setuptools==58It worked for me. pip install setuptools==58. The error coming from setuptools==69 that previously run on my device. and Finally saved me setuptools version 58 for this error.
This worked for me.
pip install --upgrade pip setuptools==57.5.0
"pip install setuptools==58" worked for me. The setuptools version was 59 when I upgraded ubuntu to 22.04 and its python 3.10. I started a clean virtual environment for an existings django project. It had just two packages:
`pip list
Package Version
pip 22.0.2
setuptools 59.6.0`
Then I downgrade the setuptools to 58 as pip install setuptools==58.0.0. After that the pip install -r requirements.txt has not such error above.
Upgrading MongoEngine to >= 0.20 would also fix the problem as Python2 support (hence use_2to3) was dropped in 0.20
I'm working on Windows 11 and these solutions didn't work. I installed pybluez2 instead. Your python version >= 3.9 on Windows.
pip install pybluez2

Google Colaboratory Python Installation Error: TA-Lib

Recently, I have attempted to complete a neural network and technical analysis program for the prediction of fluctuations within the financial equities markets available via utilised databases; I am currently utilising the module Quandl for the purposes of financial information retrieval, while the program itself remains within the Google Colaboratory integrated development environment. For the purposes of this project, I have recently attempted to install a Python wrapper for the module TA-Lib, which contains a portion designed for the analysis of candlestick chart patterns; the documentation for the library and page are shown below:
https://github.com/mrjbq7/ta-lib
https://mrjbq7.github.io/ta-lib/func_groups/pattern_recognition.html
Within the Colaboratory editor, I attempted to install the program via the command:
pip install TA-Lib
as specified; however, the integrated development environment provided the following error message:
Collecting TA-Lib
Using cached https://files.pythonhosted.org/packages/90/05/d4c6a778d7a7de0be366bc4a850b4ffaeac2abad927f95fa8ba6f355a082/TA-Lib-0.4.17.tar.gz
Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from TA-Lib) (1.17.5)
Building wheels for collected packages: TA-Lib
Building wheel for TA-Lib (setup.py) ... error
ERROR: Failed building wheel for TA-Lib
Running setup.py clean for TA-Lib
Failed to build TA-Lib
Installing collected packages: TA-Lib
Running setup.py install for TA-Lib ... error
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-npc2f3yq/TA-Lib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-npc2f3yq/TA-Lib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-oh1la09j/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
Is there an alternative method responsible for the avoidance of this inevitable error? If not, is there a method to download this module within Colaboratory which would bypass such processes? Thank you for your assistance.
Try this
!wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
!tar -xzvf ta-lib-0.4.0-src.tar.gz
%cd ta-lib
!./configure --prefix=/usr
!make
!make install
!pip install Ta-Lib
import talib

Google Assistant installation via python - setup.py install for grpcio ... error

I am trying to install GoogleAssistant for my PC using python. I am a beginner at coding in Python. So, I am basically using instructions from various sites. (esp - https://www.lifewire.com/google-assistant-on-windows-4628292 )
I have tried updating python version through
"python -m pip install --upgrade pip."
error: [WinError 2] The system cannot find the file specified
----------------------------------------
*ERROR: Command errored out with exit status 1: 'C:\Users\S K CHOUDHARY\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\S K CHOUDHARY\\AppData\\Local\\Temp\\pip-install-gr2pj17q\\grpcio\\setup.py'"'"'; __file__='"'"'C:\\Users\\S K CHOUDHARY\\AppData\\Local\\Temp\\pip-install-gr2pj17q\\grpcio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\S K CHOUDHARY\AppData\Local\Temp\pip-record-n9m9wxyy\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
What does the above error mean ? How can I fix it ?
WARNING:
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\WINDOWS\system32>
C:\WINDOWS\system32>python -m pip install --upgrade pip
Requirement already up-to-date: pip in c:\program files\python37\lib\site-packages (19.3.1)
Do look at the WARNING. It says that I ought to have version 19.3.1 but upon running upgrade the very same cmd shows that I am already using the latest version 19.3.1. How is this possible?
I am facing a lot of confusions. Can anyone ALSO recommend some websites for beginners for installing GoogleAssistant on PC. I have tried Github but haven't been able to comprehend it.

Error when installing dlib on Python 3.5 using Windows 10

EDIT: Looks like I have to install Visual Studio 2015...Can I install dlib without VS 2015? I already have older versions pre-installed with Windows.
I am using Python 3.5, trying to install dlib on PyCharm in the terminal and this is what I am getting, and every search on these errors I do... I find stuff on Visual Studio which I don't have the GUI + I don't have vcvarsall.bat in the VC folder of any of the Visual Studio versions (8, 11, 12, 14). I have searched a good amount before posting this question on the Web.
Do I need to download Visual Studio latest version to get vcvarsall.bat ?
This is CMakeLists.txt:
cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(IntelFortranImplicit Fortran)
add_custom_command(
OUTPUT output.cmake
COMMAND ${CMAKE_COMMAND} -P ${IntelFortranImplicit_SOURCE_DIR}/detect.cmake
)
add_library(FortranLib hello.f output.cmake)
This is the error when I do: pip install dlib
Collecting dlib
Using cached dlib-19.6.1.tar.gz
Building wheels for collected packages: dlib
Running setup.py bdist_wheel for dlib ... error
Complete output from command C:\Users\tiger\Anaconda3\envs\TensorFlowExample\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\tiger\\AppDat
a\\Local\\Temp\\pip-build-gjtgkl6a\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code
, __file__, 'exec'))" bdist_wheel -d C:\Users\tiger\AppData\Local\Temp\tmprc21rnv_pip-wheel- --python-tag cp35:
running bdist_wheel
running build
error: Cannot find cmake, ensure it is installed and in the path.
You can install cmake using the instructions at https://cmake.org/install/
You can also specify its path with --cmake parameter.
----------------------------------------
Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
Running setup.py install for dlib ... error
Complete output from command C:\Users\tiger\Anaconda3\envs\TensorFlowExample\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\tiger\\AppD
ata\\Local\\Temp\\pip-build-gjtgkl6a\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(co
de, __file__, 'exec'))" install --record C:\Users\tiger\AppData\Local\Temp\pip-dk1naa28-record\install-record.txt --single-version-externally-managed --compile
:
running install
running build
error: Cannot find cmake, ensure it is installed and in the path.
You can install cmake using the instructions at https://cmake.org/install/
You can also specify its path with --cmake parameter.
----------------------------------------
Command "C:\Users\tiger\Anaconda3\envs\TensorFlowExample\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\tiger\\AppData\\Local\\Temp\\pip-bu
ild-gjtgkl6a\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))"
install --record C:\Users\tiger\AppData\Local\Temp\pip-dk1naa28-record\install-record.txt --single-version-externally-managed --compile" failed with error code
1 in C:\Users\tiger\AppData\Local\Temp\pip-build-gjtgkl6a\dlib\
Solution found here: Using Anaconda installing manager..!
Running the following in PyCharm Terminal: conda install -c conda-forge dlib=19.4
I was able to use dlib! :)
Huge thanks to birryree in the comments for letting me know!
Open Anaconda Prompt in Administrative mode.
conda update conda 3. conda update anaconda
conda create -n dlib_env python=3.7
conda activate dlib_env
conda install -c conda-forge dlib
python
7.1 >>> import dlib 7.2 >>> dlib.version
Source

Categories