TA-Lib / ta-lib-python

Python wrapper for TA-Lib (http://ta-lib.org/).
http://ta-lib.github.io/ta-lib-python
Other
9.23k stars 1.72k forks source link

Feature Request: conda release for python 3.11 or later #645

Open auderson opened 2 months ago

auderson commented 2 months ago

As title.

mrjbq7 commented 2 months ago

I don’t know who manages that, I do not. On Apr 19, 2024, at 1:14 AM, auderson @.***> wrote: As title.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

krahnikblis commented 1 month ago

@auderson and/or others watching, i know it's not ideal but just to get working for py3.11, i was able to use the conda install -c conda-forge libta-lib command to get the base C package, then used pip install ta-lib within the activated conda environment to install the python one, and verified via conda list that ta-lib was there, conda just lists pypi as the channel.

i'm just ignorant enough to seriously wonder if something like conda install -c pypi ta-lib would have worked...

functionally the library imports and "works", but the whole reason i went this conda/etc route was to swap out numpy and pandas for cupy and cudf and use RAPIDS to run things on GPU, and ta-lib chokes up on cupy's device versions of numpy arrays, so, can't win them all i guess...

vladiscripts commented 2 weeks ago

Requires Python <3.11.0a0, does not install on 3.11.9.

$ conda install -c conda-forge libta-lib
$ pip install pyproject-toml

$ conda install -c pypi ta-lib gives the same error as conda install -c conda-forge ta-lib:

$ conda install -c conda-forge ta-lib

Channels:
 - conda-forge
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: | warning  libmamba Added empty dependency for problem type SOLVER_RULE_UPDATE
failed

LibMambaUnsatisfiableError: Encountered problems while solving:
  - package ta-lib-0.4.19-py310h96516ba_3 requires python >=3.10,<3.11.0a0, but none of the providers can be installed

Could not solve for environment specs
The following packages are incompatible
├─ pin-1 is installable and it requires
│  └─ python 3.11.* , which can be installed;
└─ ta-lib is not installable because there are no viable options
   ├─ ta-lib [0.4.18|0.4.19] would require
   │  └─ python >=3.6,<3.7.0a0 , which conflicts with any installable versions previously reported;
   ├─ ta-lib [0.4.18|0.4.19] would require
   │  └─ python >=3.7,<3.8.0a0 , which conflicts with any installable versions previously reported;
   ├─ ta-lib [0.4.18|0.4.19|0.4.28] would require
   │  └─ python >=3.8,<3.9.0a0 , which conflicts with any installable versions previously reported;
   ├─ ta-lib [0.4.19|0.4.28] would require
   │  └─ python >=3.10,<3.11.0a0 , which conflicts with any installable versions previously reported;
   └─ ta-lib [0.4.19|0.4.28] would require
      └─ python >=3.9,<3.10.0a0 , which conflicts with any installable versions previously reported.
$ pip install ta-lib

Collecting ta-lib
  Using cached TA-Lib-0.4.30.tar.gz (368 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in ~/miniforge3/envs/trading/lib/python3.11/site-packages (from ta-lib) (2.0.0)
Building wheels for collected packages: ta-lib
  Building wheel for ta-lib (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for ta-lib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [45 lines of output]
      <string>:75: UserWarning: Cannot find ta-lib library, installation may fail.
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/talib
      copying talib/__init__.py -> build/lib.linux-x86_64-cpython-311/talib
      copying talib/abstract.py -> build/lib.linux-x86_64-cpython-311/talib
      copying talib/deprecated.py -> build/lib.linux-x86_64-cpython-311/talib
      copying talib/stream.py -> build/lib.linux-x86_64-cpython-311/talib
      running build_ext
      building 'talib._ta_lib' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/talib

      ....

      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ta-lib
Failed to build ta-lib
ERROR: Could not build wheels for ta-lib, which is required to install pyproject.toml-based projects
vladiscripts commented 2 weeks ago

I made an environment in Python 3.10 and installed it there.

conda create --name trading python=3.10 -c conda-forge
conda activate trading
conda install -c conda-forge ta-lib -n trading
mrjbq7 commented 2 weeks ago

Your error is not having the underlying TA-Lib C library installed.

:75: UserWarning: Cannot find ta-lib library, installation may fail.
vladiscripts commented 2 weeks ago

Thanks, via pip installed. But it don't works, for Python 3.11 and 3.10.

$ conda create --name trading311 python=3.11 -c conda-forge
$ conda activate trading311
$ pip install ta-lib

Collecting ta-lib
  Using cached TA-Lib-0.4.31.tar.gz (368 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting numpy (from ta-lib)
  Using cached numpy-2.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
Using cached numpy-2.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.3 MB)
Building wheels for collected packages: ta-lib
  Building wheel for ta-lib (pyproject.toml) ... done
  Created wheel for ta-lib: filename=TA_Lib-0.4.31-cp311-cp311-linux_x86_64.whl size=469670 sha256=b34b76ee8bdb0965ca1b375b317e576dba475263b6564a73ef95c8a7940fcd86
  Stored in directory: ~/.cache/pip/wheels/ed/8b/88/4b0379d706a3cfb5ad627dcae8648b693f8d9aebaf333017db
Successfully built ta-lib
Installing collected packages: numpy, ta-lib
Successfully installed numpy-2.0.0 ta-lib-0.4.31

$ python

Next, same for Python 3.11 and 3.10:

Python 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import talib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/miniforge3/envs/trading/lib/python3.10/site-packages/talib/__init__.py", line 93, in <module>
    from ._ta_lib import (
  File "talib/_ta_lib.pyx", line 1, in init talib._ta_lib
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
mrjbq7 commented 2 weeks ago

It's not numpy 2.0 compatible yet, i guess:

Using cached numpy-2.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.3 MB)