Search code examples
pythonubuntupipgoogle-cloud-platformta-lib

Installing TA-lib on Google VM (Ubuntu)


I have experiencing issues with the well-known and troubling installation of TA-lib library. However, even if the issue is well known, I saw just 1 post talking about installation on Google Cloud, and my problem is a little bit different from that issue. After following the instructions on TA-lib Github README attached below

Download ta-lib-0.4.0-src.tar.gz and:

$ untar and cd
$ ./configure --prefix=/usr
$ make
$ sudo make install

I am trying to pip install TA-lib. When I input

pip3 install TA-lib`

I see

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 /home/franc_paoli/.local/lib/python3.5/site-packages (from Ta-lib) (1.14.5)
Building wheels for collected packages: Ta-lib
  Running setup.py bdist_wheel for Ta-lib ... -

and then the command window tries to load infinitely.. without any response. Do you think it's just slow and I should wait (1h+) or something is going wrong within the procedure?


Solution

  • It's entirely possible that a Python package could take an hour or more to install, if it has a lot of C code in it that it needs to build. What it might be doing behind that Running setup.py bdist_wheel for Ta-lib ... line is compiling things.

    If you want to check on it, you can open another terminal window/tab while pip3 is running, connect to the server again, and run top to have a look at all the running processes. Once in there, you can press c to see the commands that are running, or q to quit out. If there's a Python or GCC or G++ process taking a lot of CPU, it's probably doing something. If nothing much appears to be going on, something may have gone wrong.

    Note, though, that you aren't installing the same TA-lib you downloaded and manually built. When you do it through Pip, it is downloading and installing https://files.pythonhosted.org/packages/90/05/d4c6a778d7a7de0be366bc4a850b4ffaeac2abad927f95fa8ba6f355a082/TA-Lib-0.4.17.tar.gz, and doing all the ./configure and make over again for you.