Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build-requires pinning numpy to <2 #656

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

xmatthias
Copy link
Contributor

@xmatthias xmatthias commented Jun 17, 2024

With the release of numpy2.0, ta-lib is no longer installable (the build fails), as it's currently incompatible with numpy 2.x.

While that should be addressed too - I'm not sure it's a "quick fix" that can be done with just a few lines of code (or while keeping compatibility with older numpy versions).

i therefore think it's better to have a "quick fix" available so it's at least not breaking existing setups / installations.
Regular version-pinning is not relevant here - as it's the numpy version during build-time (a separate, isolated environment created while building a package) that's the problem currently.

Temporarily solves #655

Alternative workarounds: Disable build isolation.

pip install "numpy<2"
pip install TA-Lib -v --no-build-isolation

To test this:
install ta-lib (regularly, without workaround) without this fix anytime after the numpy 2.x release (don't test while time-traveling, please) - notice it failing
Install with this fix - notice the build working again.

@mmarr96
Copy link

mmarr96 commented Jun 17, 2024

legend, thank you!

@mrjbq7 mrjbq7 merged commit f5833c8 into TA-Lib:master Jun 17, 2024
6 checks passed
@mrjbq7
Copy link
Collaborator

mrjbq7 commented Jun 17, 2024

Thanks! I suppose this needs a new release to be useful?

@mrjbq7
Copy link
Collaborator

mrjbq7 commented Jun 17, 2024

Okay, released 0.4.31 with this fix, see if that helps everyone?

@morenod
Copy link

morenod commented Jun 17, 2024

Probably related, after upgrading talib to 0.4.31, I get:

Traceback (most recent call last):
  File "xxxx.py", line 11, in <module>
    from libs.ta import TA
  File "xxx/ta.py", line 3, in <module>
    import talib
  File "/home/runner/.local/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
Collecting TA-Lib (from -r ./requirements.txt (line 2))
  Downloading TA-Lib-0.4.31.tar.gz (368 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 368.5/368.5 kB 2.8 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: numpy in /home/runner/.local/lib/python3.10/site-packages (from TA-Lib->-r ./requirements.txt (line 2)) (2.0.0)
Building wheels for collected packages: TA-Lib
  Building wheel for TA-Lib (pyproject.toml): started
  Building wheel for TA-Lib (pyproject.toml): finished with status 'done'
  Created wheel for TA-Lib: filename=TA_Lib-0.4.31-cp310-cp310-linux_x86_64.whl size=2063332 sha256=6906642f6ba091db8850fa0ed115f4012ed900b80fb76c1f4cc05925027036c0
  Stored in directory: /home/runner/.cache/pip/wheels/a4/dc/b0/8860882f03d5b3498c7f640840c037569ed2285a30ff3a48e9
Successfully built TA-Lib
Installing collected packages: TA-Lib, elastic-transport, elasticsearch
Successfully installed TA-Lib-0.4.31

@xmatthias xmatthias deleted the fix/numpy_2.0_short_term branch June 17, 2024 16:10
@xmatthias
Copy link
Contributor Author

@morenod you'll still need to have numpy <2.0.0 installed - the error looks like it's using latest ...

@morenod
Copy link

morenod commented Jun 17, 2024

numpy

yep, fixed setting numpy<2 on requirements.txt

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants