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

support for 3.12 #241

Open
gnzsnz opened this issue Apr 13, 2024 · 3 comments
Open

support for 3.12 #241

gnzsnz opened this issue Apr 13, 2024 · 3 comments

Comments

@gnzsnz
Copy link

gnzsnz commented Apr 13, 2024

Dear Zipline Maintainers,

Before I tell you about my issue, let me describe my environment:

Environment

  • Operating System: x86_64 GNU/Linux & aarch64 GNU/Linux
  • Python Version: $ python --version --> 3.12
  • Python Bitness: $ python -c 'import math, sys;print(int(math.log(sys.maxsize + 1, 2) + 1))'
  • How did you install Zipline: (pip, conda, or other (please explain)) pip
  • Python packages: $ pip freeze or $ conda list

Now that you know a little about me, let me tell you about the issue I am
having:

Description of Issue

  • What did you expect to happen?

run pip install zipline-reloaded on python 3.12

  • What happened instead?

instalation fails

Here is how you can reproduce this issue on your machine:

Reproduction Steps

docker run --rm -it python:3.12 bash
apt-get update && apt-get update && apt-get install --no-install-recommends -y libhdf5-dev
pip install git+https://github.com/stefan-jansen/bcolz-zipline.git@main
curl -LO https://github.com/gnzsnz/jupyter-quant/releases/download/ta-lib-0.4.0-linux/ta-lib-0.4.0-linux_"$(uname -m)".tgz
tar xzf ta-lib-0.4.0-linux_x86_64.tgz
export PREFIX=/usr/local/ta-lib &&   export TA_LIBRARY_PATH="$PREFIX/lib" &&   export TA_INCLUDE_PATH="$PREFIX/include"
pip install zipline-reloaded

What steps have you taken to resolve this already?

install bcolz from git helps to solve the problems with bcolz and 3.12. but zipline still fails

Anything else?

log

     creating build/temp.linux-x86_64-cpython-312
      creating build/temp.linux-x86_64-cpython-312/src
      creating build/temp.linux-x86_64-cpython-312/src/zipline
      creating build/temp.linux-x86_64-cpython-312/src/zipline/assets
      gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -I/tmp/pip-build-env-z5lzvvey/overlay/lib/python3.12/site-packages/numpy/core/include
-I/usr/local/include/python3.12 -c src/zipline/assets/_assets.c -o build/temp.linux-x86_64-cpython-312/src/zipline/assets/_assets.o
      src/zipline/assets/_assets.c: In function ‘__pyx_pf_7zipline_6assets_7_assets_5Asset___init__’:
      src/zipline/assets/_assets.c:1519:32: error: ‘_PyCFrame’ has no member named ‘use_tracing’
       1519 |      (unlikely((tstate)->cframe->use_tracing) &&\
            |                                ^~
      src/zipline/assets/_assets.c:968:43: note: in definition of macro ‘unlikely’
        968 |   #define unlikely(x) __builtin_expect(!!(x), 0)
            |                                           ^
      src/zipline/assets/_assets.c:1558:15: note: in expansion of macro ‘__Pyx_IsTracing’
       1558 |           if (__Pyx_IsTracing(tstate, 1, 1)) {\
            |               ^~~~~~~~~~~~~~~
      src/zipline/assets/_assets.c:2685:3: note: in expansion of macro ‘__Pyx_TraceCall’
       2685 |   __Pyx_TraceCall("__init__", __pyx_f[0], 93, 0, __PYX_ERR(0, 93, __pyx_L1_error));
            |   ^~~~~~~~~~~~~~~
      src/zipline/assets/_assets.c:1519:32: error: ‘_PyCFrame’ has no member named ‘use_tracing’
       1519 |      (unlikely((tstate)->cframe->use_tracing) &&\
            |                                ^~
      src/zipline/assets/_assets.c:968:43: note: in definition of macro ‘unlikely’
        968 |   #define unlikely(x) __builtin_expect(!!(x), 0)
            |                                           ^
      src/zipline/assets/_assets.c:1566:11: note: in expansion of macro ‘__Pyx_IsTracing’
       1566 |       if (__Pyx_IsTracing(tstate, 1, 1)) {\
            |           ^~~~~~~~~~~~~~~
      src/zipline/assets/_assets.c:2685:3: note: in expansion of macro ‘__Pyx_TraceCall’
       2685 |   __Pyx_TraceCall("__init__", __pyx_f[0], 93, 0, __PYX_ERR(0, 93, __pyx_L1_error));
            |   ^~~~~~~~~~~~~~~
      src/zipline/assets/_assets.c:1519:32: error: ‘_PyCFrame’ has no member named ‘use_tracing’
       1519 |      (unlikely((tstate)->cframe->use_tracing) &&\
            |                                ^~
      src/zipline/assets/_assets.c:968:43: note: in definition of macro ‘unlikely’
        968 |   #define unlikely(x) __builtin_expect(!!(x), 0)
            |                                           ^
      src/zipline/assets/_assets.c:1617:19: note: in expansion of macro ‘__Pyx_IsTracing’
       1617 |               if (__Pyx_IsTracing(tstate, 0, 0)) {\
            |                   ^~~~~~~~~~~~~~~
      src/zipline/assets/_assets.c:2824:3: note: in expansion of macro ‘__Pyx_TraceReturn’
       2824 |   __Pyx_TraceReturn(Py_None, 0);
            |   ^~~~~~~~~~~~~~~~~
      src/zipline/assets/_assets.c:1519:32: error: ‘_PyCFrame’ has no member named ‘use_tracing’
       1519 |      (unlikely((tstate)->cframe->use_tracing) &&\
            |                                ^~

logs is very long, but the same error repeats over and over. __Pyx_TraceCall, __Pyx_IsTracing and __Pyx_TraceReturn give errors.

Sincerely,
$ whoami

@RichardDale
Copy link

I think Zipline-Released v3.0.4 resolves this issue. Please confirm!

@gnzsnz
Copy link
Author

gnzsnz commented May 15, 2024

i'm testing this on 3.12.3 on ubuntu 22.04 and osx Sonoma

================================================================================================== ERRORS ==================================================================================================
_____________________________________________________________________________ ERROR collecting tests/data/bundles/test_core.py _____________________________________________________________________________
ImportError while importing test module '/home/gonzo/Documents/zipline-reloaded/tests/data/bundles/test_core.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../.pyenv/versions/3.12.3/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/data/bundles/test_core.py:5: in <module>
    from parameterized import parameterized
E   ModuleNotFoundError: No module named 'parameterized'
____________________________________________________________________________ ERROR collecting tests/data/bundles/test_csvdir.py ____________________________________________________________________________
ImportError while importing test module '/home/gonzo/Documents/zipline-reloaded/tests/data/bundles/test_csvdir.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../.pyenv/versions/3.12.3/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/data/bundles/test_csvdir.py:14: in <module>
    from zipline.testing.github_actions import skip_on
../../.pyenv/versions/3.12.3/envs/zipline/lib/python3.12/site-packages/zipline/testing/__init__.py:1: in <module>
    from .core import (  # noqa
../../.pyenv/versions/3.12.3/envs/zipline/lib/python3.12/site-packages/zipline/testing/core.py:19: in <module>
    from testfixtures import TempDirectory
E   ModuleNotFoundError: No module named 'testfixtures'
____________________________________________________________________________ ERROR collecting tests/data/bundles/test_quandl.py ____________________________________________________________________________
ImportError while importing test module '/home/gonzo/Documents/zipline-reloaded/tests/data/bundles/test_quandl.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../.pyenv/versions/3.12.3/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/data/bundles/test_quandl.py:14: in <module>
    from zipline.testing import (
../../.pyenv/versions/3.12.3/envs/zipline/lib/python3.12/site-packages/zipline/testing/__init__.py:1: in <module>
    from .core import (  # noqa
../../.pyenv/versions/3.12.3/envs/zipline/lib/python3.12/site-packages/zipline/testing/core.py:19: in <module>
    from testfixtures import TempDirectory
E   ModuleNotFoundError: No module named 'testfixtures'
_____________________________________________________________________________ ERROR collecting tests/data/test_adjustments.py ______________________________________________________________________________

on both environments I'm getting the error above when i run pytest test

the error repeats for the following test modules

========================================================================================= short test summary info ==========================================================================================
ERROR tests/data/bundles/test_core.py
ERROR tests/data/bundles/test_csvdir.py
ERROR tests/data/bundles/test_quandl.py
ERROR tests/data/test_adjustments.py
ERROR tests/data/test_daily_bars.py
ERROR tests/data/test_dispatch_bar_reader.py
ERROR tests/data/test_fx.py
ERROR tests/data/test_hdf5_daily_bars.py
ERROR tests/data/test_minute_bars.py
ERROR tests/data/test_resample.py
ERROR tests/events/test_events.py
ERROR tests/events/test_events_cme.py
ERROR tests/events/test_events_nyse.py
ERROR tests/finance/test_commissions.py
ERROR tests/finance/test_slippage.py
ERROR tests/metrics/test_core.py
ERROR tests/metrics/test_metrics.py
ERROR tests/pipeline/test_adjusted_array.py
ERROR tests/pipeline/test_alias.py
ERROR tests/pipeline/test_classifier.py
ERROR tests/pipeline/test_column.py
ERROR tests/pipeline/test_computable_term.py
ERROR tests/pipeline/test_domain.py
ERROR tests/pipeline/test_downsampling.py
ERROR tests/pipeline/test_dtypes.py
ERROR tests/pipeline/test_engine.py
ERROR tests/pipeline/test_events.py
ERROR tests/pipeline/test_factor.py
ERROR tests/pipeline/test_filter.py
ERROR tests/pipeline/test_hooks.py
ERROR tests/pipeline/test_international_markets.py
ERROR tests/pipeline/test_numerical_expression.py
ERROR tests/pipeline/test_pipeline_algo.py
ERROR tests/pipeline/test_quarters_estimates.py
ERROR tests/pipeline/test_slice.py
ERROR tests/pipeline/test_statistical.py
ERROR tests/pipeline/test_technical.py
ERROR tests/pipeline/test_term.py
ERROR tests/pipeline/test_us_equity_pricing_loader.py
ERROR tests/test_algorithm.py
ERROR tests/test_api_shim.py
ERROR tests/test_assets.py
ERROR tests/test_bar_data.py
ERROR tests/test_benchmark.py
ERROR tests/test_blotter.py
ERROR tests/test_cmdline.py
ERROR tests/test_continuous_futures.py
ERROR tests/test_data_portal.py
ERROR tests/test_examples.py
ERROR tests/test_execution_styles.py
ERROR tests/test_fetcher.py
ERROR tests/test_finance.py
ERROR tests/test_history.py
ERROR tests/test_labelarray.py
ERROR tests/test_ordering.py
ERROR tests/test_restrictions.py
ERROR tests/test_security_list.py
ERROR tests/test_testing.py
ERROR tests/test_tradesimulation.py
ERROR tests/utils/test_pandas_utils.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 60 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===================================================================================== 110 warnings, 60 errors in 3.96s =====================================================================================

@yxie80
Copy link

yxie80 commented Jul 7, 2024

This error shows up when testing package with python 3.12 with following command
from zipline.api import order_target, record, symbol
Screenshot 2024-07-07 at 10 54 40 PM

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

No branches or pull requests

3 participants