Can't install Ta-Lib with pip in Ubuntu 18.04 - python-3.x

I need to install the TA-Lib library on python. Where I run the following:
pip install TA-Lib --user
I get this error code:
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-52h2r7l4/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-meoq431k/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-52h2r7l4/TA-Lib/
I have also tried:
pip3 install TA-Lib
when I run:
python --version
I get:
Python 2.7.15rc1
Then I run:
python3 --version
I get:
Python 3.6.7
I can't understand. I have Ubuntu 18.04. Before I have Anaconda, then delete it (hope I delete it correctly) And then install Python 2.7 because I wanted to use Zipline to backtest some strategies, but I cannot use TA-Lib.
Hope someone know the problem, thank you!

I've downloaded TA-Lib-0.4.17.tar.gz that pip3 gets automatically. Opened it - there is no TA-Lib, only wrapper for it. According to its README.md
Dependencies
To use TA-Lib for python, you need to have the TA-Lib already installed. You should probably follow their installation directions for your
platform, but some suggestions are included below for reference.
Mac OS X
$ brew install ta-lib
Windows
Download ta-lib-0.4.0-msvc.zip and unzip to C:\ta-lib
This is a 32-bit release. If you want to use 64-bit Python, you will need to build a 64-bit version of the library.
Some unofficial (and unsupported) instructions for building on 64-bit Windows 10, here for reference:
Download and Unzip ta-lib-0.4.0-msvc.zip
Move the Unzipped Folder ta-lib to C:\
Download and Install Visual Studio Community 2015
Remember to Select [Visual C++] Feature
Build TA-Lib Library
From Windows Start Menu, Start [VS2015 x64 Native Tools Command Prompt]
Move to C:\ta-lib\c\make\cdr\win32\msvc
Build the Library nmake
Linux
Download ta-lib-0.4.0-src.tar.gz and:
$ untar and cd $ ./configure --prefix=/usr $ make $ sudo make install
If you build TA-Lib using make -jX it will fail but that’s OK! Simply rerun make -jX followed by [sudo] make install.

ta-lib depends on their C implementation you have to install it before installing the python version.

Related

Installed C++ build tools via Visual Studio Installed, but pip install pycocotools still give me error

Installing pycotools via pip install gives the error
error log of failing to install pycotools
I have installed C++ build tools via Visual Studio Installed
image of installed C++ build tools
But, when I pip install pycocotools,
It still gives the error
error log of failing to install pycotools
Do not try for installing pycocotools(original) on Visual Studio.
if you want to do that, you must install clone of pycocotools from this: https://github.com/philferriere/cocoapi
Thx to MAHDI SOLTANI PAKDEL's solution,
I have found an alternative solution: installing pycocotools won't require C++ build tools.
conda install -c conda-forge pycocotools
conda install -c conda-forge/label/gcc7 pycocotools
conda install -c conda-forge/label/cf201901 pycocotools
conda install -c conda-forge/label/cf202003 pycocotools

Travis-ci windows meson+ninja build install (python is broken)

I would like to ask for some help about travis.yml:
I would like to set a build machine with Windows, and install Ninja + Meson as a build system. For this I need python 3 and pip3. I try to install it, but python3 and pip3 commands are not in my path - as it's seems to not to be.
My travis.yml file is here, the windows part is commented:
https://github.com/mezeipetister/game_battle/blob/master/.travis.yml
The windows part is:
- name: "Windows - CLANG"
os: windows
compiler: clang
before_install:
choco install python
python -m pip install -U pip
choco install ninja
python -m pip install meson
Could you help me with this?
My main goal is to have meson and ninja installed, and meson and ninja command to work to run my meson builddir and ninja -C builddir commands.
My strategy was to somehow setup python3 and pip3, install meson with it, and then use it.
I've been working on this problem myself, and found that the answer is to use choco's --version to grab a specific version of Python 3, and use get-pip.py instead for pip:
wget --progress=dot:mega https://bootstrap.pypa.io/get-pip.py
wget --progress=dot:mega https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip
choco install python --version 3.6.8
python get-pip.py
pip3 install meson
mkdir /c/tools/ninja-build
7z x -oC:\\tools\\ninja-build ninja-win.zip
rm get-pip.py ninja-win.zip
This also deals with the choco ninja being super out of date. I leave it as an exercise to the reader to construct a working $PATH.
I have had this working reliably on Travis for some time now.

pyrebase install on windows Python 3.7 fails

I just installed python 3.7 64 bits on windows 10 for all u
sers and modified the PATH
I updated the pip to 18.1
I installed pygame, with
py -3 -m pip install pygame
it works fine
I wanted to install pyrebase with
py -3 -m pip install pyrebase
Download fine then I have this msg and the pip log dir is erased, so I can't figure out what is hapenning
Command ""C:\Program Files\Python37\python.exe" -u -c "import setuptools, tokenize;file='C:\Users\mine\AppData\Local\Temp\pip-install-2rr8v7jh\pycryptodome\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\mine\AppData\Local\Temp\pip-record-om6lqxmm\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\mine\AppData\Local\Temp\pip-install-2rr8v7jh\pycryptodome\
but before it gives this error
Installing collected packages: pycryptodome, pyrebase
Found existing installation: pycryptodome 3.7.0
Uninstalling pycryptodome-3.7.0:
Successfully uninstalled pycryptodome-3.7.0
Running setup.py install for pycryptodome ... error
this is when I tried to install pycryptodome, which installed well alone, but when trying to install pyrebase it uninstall the previous pycryptodome and try it own but fails.
Any advice? thanks
Edit:
I tried
pip install --upgrade setuptools
as suggested in https://github.com/thisbejim/Pyrebase/issues/179
but it didn't solve my issue
I am still having an error, on Windows10, python 3.7:
Installing collected packages: pycryptodome, pyrebase Running
setup.py install for pycryptodome ... error
Complete output from command "C:\Program Files\Python37\python.exe" -u -c "import setuptools,
tokenize;file='C:\Users\...\AppData\Local\Temp\pip-install-a9kop2nb\pycryptodome\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...\AppData\Local\Temp\pip-record-dm88ctzw\install-record.txt
--single-version-externally-managed --compile:
To install https://github.com/thisbejim/Pyrebase
I needed to download the .zip file (or Git) than manually install it after modifying the setup.py by specifying the latest 'pycryptodome==3.7.3'
then copy the pyrebase\ directory to my python install
c:\WPy-3710\python-3.7.1.amd64\Lib\site-packages\
but the previous comment of #silkindustry showed me a new lib/Wrapper: Pyrebase4
https://github.com/nhorvath/Pyrebase4
that install easily with
pip3 install pyrebase4
Just upgrade setuptools (Successfully installed setuptools-40.6.3) with your suggested command and install newer version of Pyrebase. (Pyrebase4).
I had the same issue. I solved it using the following steps.
pip install pycryptodome
and then I ran
pip install pyrebase
I faced the same issue when I was working with Anaconda which runs python 3.7 as its default python interpreter. So I created a virtual environment with Python 3.6 with
conda create --name env_name python=3.6
Then with conda activate env_name activate the environment and run pip install pyrebase
and it should be installed.
As Lotfi said, go to the pyrebase repository, https://github.com/thisbejim/Pyrebase and download the .zip file of git repository and then edit as he said,then save the /pyrebase folder to site packeges folder, if you still found no module error(Crypto) then visit this link, ImportError: No module named Crypto.Cipher
first install pycryptodome version 3.10.1
pip install pycryptodome==3.10.1
then install pyrebase4
pip install pyrebase4
It work for me
I couldn't solve the issue although I tried the above solutions.
Finally I can install pyrebase like following.
Re-install Python at C:\Pyton. : To avoid searching error of C:\Users...
Install JWS manually. Specify file format by UTF8 at setup.py file.
Install pycryptodomex not pycryptodome.
When make Project check following "inherit global site-packages"
i also faced the same issue with Anaconda, then i solved it by opening the command prompt of Anaconda and type the following,
pip install pycryptodome and then i ran
pip install pyrebase4, these two commands help to clear the issue
If your are using Pycharm you can install the pyrebase5 or any other modules directly from it without getting any error.
Go to Files
Open the settings(Ctrl+Alt+s if you're using Win10)
Go to the Project >> project interpreter
Now you can see all the packages installed in the root folder of python.
(Make sure your your project interpreter is selected to the python root folder :
C:\Users\ (Username)\AppData\Local\Programs\Python\Python38-32
In project interpreter you can see the +(Install) sign in the right. Click on it
the available packages window id open
Now you can search any packages you want to install like pyrebase: you can see all the versions of the pyrebase.
select the package and install package.
This worked for me.
Step 1: Follow the answer given by Nayan and answer by Lotfi. But use 'pycryptodome==VERSION_OF_PYCRYPTODOME_YOU_HAVE_ALREADY_INSTALLED'.Ex. 'pycryptodome==3.10.1'
Step 2: After that Go to the site-packages/Pyrebase folder with updated setup.py file.
Step 3: Install the Pyrebase library from that folder. For that use command
python setup.py install
That's it!
I solved my problem with the 2 steps below. I hope this is going to solve yours as well.
uninstall pyrebase:
pip uninstall pyrebase
Install Pyrebase-t:
pip install Pyrebase-t
The only thing that worked for me was deactivating the virtual environment and reactivating it before trying
pip install pyrebase

Can't install cx_Freeze or scipy for Python 3.7 64-bit

I'm trying to install cx_Freeze and scipy but I get a
compile failed with error code 1
error every time. Here's what I see when I try to do it with cx_Freeze:
error: file 'C:\Users\myAccount\AppData\Local\Temp\pip-install-nabp1tpo\cx-fre
eze\cxfreeze-postinstall' does not exist
----------------------------------------
Command "c:\users\myAccount\appdata\local\programs\python\python37\python.exe -u -
c "import setuptools, tokenize;__file__='C:\\Users\\myAccount\\AppData\\Local\\Tem
p\\pip-install-nabp1tpo\\cx-freeze\\setup.py';f=getattr(tokenize, 'open', open)(
__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __fil
e__, 'exec'))" install --record C:\Users\myAccount\AppData\Local\Temp\pip-record-3
6fbtmht\install-record.txt --single-version-externally-managed --compile" failed
with error code 1 in C:\Users\myAccount\AppData\Local\Temp\pip-install-nabp1tpo\c
x-freeze\
How can I fix this?
You could manage to install it from wheel.
First you need to install wheel:
pip install wheel
Then go to the following link to download the cx_Freeze wheel file according to you python version and windows version:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_freeze
For 64bit and Python 3.7: cx_Freeze‑5.1.1‑cp37‑cp37m‑win_amd64.whl
On your command prompt change directory to the downloaded folder and use the command:
pip install cx_Freeze‑5.1.1‑cp37‑cp37m‑win_amd64.whl
For further description on installing from wheel, check the following link: https://pip.pypa.io/en/latest/user_guide/#installing-from-wheels
The same method will solve your problem to install scipy.
It seems that this problem occurs because the version on PyPI isn't up to date.
It works for me when I manually download it from the master branch on GitHub.
pip install --upgrade git+https://github.com/anthony-tuininga/cx_Freeze.git#master
Got this answer from issue #407 published on the GitHub page.
I tried Nischal's solution (which worked) but then ran into more errors down the line.
I then rolled back python to 3.6-32bit and everything worked flawlessly, just a heads up to whoever else gets this, unless you can get cx_freeze 6.0 installed it may be easier to rollback to python3.6 (or make a virtualenv of it).
I downloaded 32 bit installer when 64 bit didn't work.
pip install cx_Freeze-5.1.1-cp37-cp37m-win32.whl
This works fine for me. So I guess no need to downgrade to Python 3.6
I am using Python 3.7 (64-bit)
Download cx_Freeze here (depending on your Python version):
And paste this .whl file in working directory.
Open command prompt, paste following command and press enter:
pip install cx_Freeze-5.1.1-cp37-cp37m-win_amd64.whl
Please note that this command is for Python 3.7(64-bit)
Output should look like:
Processing c:\users\Python37\cx_freeze-5.1.1-cp37-cp37m-win_amd64.whl*
Installing collected packages: cx-Freeze*
Successfully installed cx-Freeze-5.1.1*

"pip install scipy" failed in Travis CI python 3.7 env

I have problem to setup my project in Travis CI python 3.7 environment, although simply running with 'pip install scipy' in python 3.6 works fine. There lots of similar/same problems and solutions reported before [1], but answers does not work for me.
Can anyone help to explain why it works with python 3.6 [2], while failed with python 3.7 in Travis CI server ?
I finally tried with the following scripts, but it still does not work in Travis CI (python 3.7) env. Travis CI (python 3.6 and python 3.6 dev) still work fine.
python -m pip install --upgrade pip
pip install --upgrade pip setuptools wheel
sudo apt-get build-dep python-scipy
sudo apt-get install -qq python-scipy
pip install scipy
...
[1] https://github.com/travis-ci/travis-ci/issues/2890
[2] https://travis-ci.org/jerrygaoLondon/jgtextrank/jobs/323822420
Errors:
Building wheels for collected packages: scipy
Running setup.py bdist_wheel for scipy ... error
Complete output from command /home/travis/virtualenv/python3.7-dev/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-j7d10poq/scipy/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/tmp2u1cz0lipip-wheel- --python-tag cp37:
lapack_opt_info:
lapack_mkl_info:
libraries mkl_rt not found in ['/home/travis/virtualenv/python3.7-dev/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
NOT AVAILABLE
...
For more details of the error, please check out https://travis-ci.org/jerrygaoLondon/jgtextrank/jobs/323822422
There are no binary wheels yet for Python 3.7 (the list is on https://pypi.python.org/pypi/scipy) so pip downloads the source package for SciPy and attempts to compile it. This fails most of the time because you need a full development environment for Python and the assorted libraries (BLAS and LAPACK with development headers), see https://scipy.org/install.html and https://github.com/scipy/scipy/blob/master/INSTALL.rst.txt .
Your solutions:
Roll back to Python 3.6, which I would suggest.
Make sure to install the development libraries for Python 3.7 and the libraries (+ headers) for BLAS and LAPACK.

Resources