pythonubuntu

Unable to install TA-Lib on Ubuntu


I'm trying to install Python Ta-Lib in Ubuntu,but when I run:

pip install TA-Lib

I get this error:

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-YfCSFn/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-swmI7D-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-YfCSFn/TA-Lib/

I already installed:

sudo apt-get install python3-dev

and installed Ta-lib

How can I fix this?


Solution

  • Seem like other people had this problem.

    To quote the accepted answer:

    Seems that your PiP can't access Setuptools as per the "import setuptools" in the error. Try the below first then try running your pip install again.

    > sudo pip install -U setuptools
    

    Or if it doesn't work to quote his comment:

    Try this 'sudo -H pip install TA-Lib'

    As Filipe Ferminiano said in comment if this still doesn't fix it then you can try what is said on this link .

    To quote the accepted answer once again:

    Your sudo is not getting the right python. This is a known behaviour of sudo in Ubuntu. See this question for more info. You need to make sure that sudo calls the right python, either by using the full path:
    sudo /usr/local/epd/bin/python setup.py install
    

    or by doing the following (in bash):

    alias sudo='sudo env PATH=$PATH'
    sudo python setup.py install
    

    Here is the question he's talking about

    Please give credit to the one of the accepted answer if it fix your problem.