Google Colaboratory Python Installation Error: TA-Lib - python

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

Related

How can I fix this error installing web3 on 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.

Installing dryscrape (python library for web scraping) in Google Colab

I was trying to install dryscrape and when i write !pip install dryscrape
in google colab i get the following output:
Collecting dryscrape
Downloading https://files.pythonhosted.org/packages/b5/75/c45f796ec5bc7f98c38b9ae425390ef5f4a76153c8b5af946adb97e7e622/dryscrape-1.0.tar.gz
Collecting webkit_server>=1.0
Downloading https://files.pythonhosted.org/packages/29/f2/f4f454cccde75e95359e91fa58f14497350dc97e58534f9003c77eca3dff/webkit-server-1.0.tar.gz (41kB)
|████████████████████████████████| 51kB 2.5MB/s
Requirement already satisfied: lxml in /usr/local/lib/python3.7/dist-packages (from dryscrape) (4.2.6)
Collecting xvfbwrapper
Downloading https://files.pythonhosted.org/packages/57/b6/4920eabda9b49630dea58745e79f9919aba6408d460afe758bf6e9b21a04/xvfbwrapper-0.2.9.tar.gz
Building wheels for collected packages: dryscrape, webkit-server, xvfbwrapper
Building wheel for dryscrape (setup.py) ... done
Created wheel for dryscrape: filename=dryscrape-1.0-cp37-none-any.whl size=5440 sha256=8e8469df960b731a8cb688d85b0cd4abcdd0aa4bcf5805d817af8e91b57091c1
Stored in directory: /root/.cache/pip/wheels/d5/7e/24/0b5b37166c524082a6fb722bc14c6f885ebb7fcfc7e1563f3e
Building wheel for webkit-server (setup.py) ... error
ERROR: Failed building wheel for webkit-server
Running setup.py clean for webkit-server
Building wheel for xvfbwrapper (setup.py) ... done
Created wheel for xvfbwrapper: filename=xvfbwrapper-0.2.9-cp37-none-any.whl size=5009 sha256=0df17305d7fbff2973dddb1560c1e232f19fcc2a73be1dca2ed2a00d1a2c50f5
Stored in directory: /root/.cache/pip/wheels/10/f2/61/cacfaf84b352c223761ea8d19616e3b5ac5c27364da72863f0
Successfully built dryscrape xvfbwrapper
Failed to build webkit-server
Installing collected packages: webkit-server, xvfbwrapper, dryscrape
Running setup.py install for webkit-server ... error
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-irrofp8e/webkit-server/setup.py'"'"'; file='"'"'/tmp/pip-install-irrofp8e/webkit-server/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-ufv_nemh/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
I tried installing from the github repository and i get the same output when i write !pip install -r requirements.txt, i was using the offical documentation.
Seeing to the logs error is regarding the webkit-server library and seeing in the GitHub issues of webkit-server the library came to the pull request, which helped me install webkit-server and then install dryscrape follow the below commands to install it in your Colab.
Command 1:
!pip install git+https://github.com/niklasb/webkit-server.git#refs/pull/35/head
Command 2:
!pip install dryscrape
This will successfully install dryscrape.
Output:
Let me know if you have any questions :)

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.

Pip install qiskit: Command errored out with exit status 255:

I am trying to install Qiskit on elementaryOS juno running Python 3.7, using pip. I even upgraded to the latest pip.
I get the following log:
Building wheels for collected packages: qiskit
Building wheel for qiskit (setup.py) ... error
ERROR: Command errored out with exit status 255:
command: /home/laura/.pyenv/versions/anaconda3-2019.03/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-p35oetbg/qiskit/setup.py'"'"'; __file__='"'"'/tmp/pip-install-p35oetbg/qiskit/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 /tmp/pip-wheel-2ms47shp --python-tag cp37
cwd: /tmp/pip-install-p35oetbg/qiskit/
Complete output (1 lines):
running bdist_wheel
----------------------------------------
ERROR: Failed building wheel for qiskit
Running setup.py clean for qiskit
Failed to build qiskit
Installing collected packages: qiskit
Running setup.py install for qiskit ... done
Successfully installed qiskit-0.11.0
This error seems to be reported by various users as per issue log in the Qiskit GitHub repository. Could you please try the following steps.
Install Anaconda
Create a python 3.7 environment: conda create --name your_env python=3.7
conda activate your_env
pip install qiskit
You can report the specific details of the issues in the following GitHub repository issue log if it is persisting after following these steps.
Qiskit GitHub Repository Issue Log

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