Skip to content

Installation fails on Python 3.12 due to newnewtulipy #263

@nucflash

Description

@nucflash

Hi, first of all, thank you for developing in the open, and for making blankly open source! I've tried bt, backtrader, and now blankly, in this order. Options trading, the link to Alpaca, and the easyness of switching from backtest, to paper, to real accounts, brought me here from backtrader, an otherwise, excellent, and very well executed piece of software.

I'm using Python 3.12.1 for my project, but unfortunately, pip install fails on Python 3.12 on Mac OS 15.2 due to newnewtulipy. It works fine with Python 3.10, as described in the README.md.

A recent commit from late December 2024 shows that more recent python versions will be supported.

Is there a timeline when newnewtulipy will be upgraded to support Python 3.12?

💡Maybe the "heavy" dependencies, or the not so standard dependencies, can be offered as optional, e.g., blankly[all] to make the package more easy to port in more recent python versions?

Thanks!

Attached is the output:

  Building wheel for newnewtulipy (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for newnewtulipy (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [396 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build/lib.macosx-14.2-arm64-cpython-312/tulipy
      copying tulipy/__init__.py -> build/lib.macosx-14.2-arm64-cpython-312/tulipy
      running build_ext
      /private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-install-yvyvvfvr/newnewtulipy_e85f2fe585a444a78097fefd81f4ea9b/tulipy/lib/__init__.pyx


      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      from libc.limits cimport INT_MAX

      import numpy as np
      cimport numpy as np

      cimport ti
              ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:37:8: 'ti.pxd' not found

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          ti.TI_TYPE_SIMPLE:      b'simple',
          ti.TI_TYPE_COMPARATIVE: b'comparative',
      }

      cdef class _Indicator:
          cdef const ti.ti_indicator_info * info
                     ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:57:15: 'ti_indicator_info' is not a type identifier

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  # This would cause self.info.indicator to return ti.TI_INVALID_OPTION, but there would
                  # be a problem before we got there in creating the `outputs` np.ndarray below with a
                  # negative dimension
                  raise InvalidOptionError()

              cdef ti.TI_REAL * c_inputs[ti.TI_MAXINDPARAMS]
                   ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:107:13: 'TI_REAL' is not a type identifier

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  # This would cause self.info.indicator to return ti.TI_INVALID_OPTION, but there would
                  # be a problem before we got there in creating the `outputs` np.ndarray below with a
                  # negative dimension
                  raise InvalidOptionError()

              cdef ti.TI_REAL * c_inputs[ti.TI_MAXINDPARAMS]
                                           ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:107:37: cimported module has no attribute 'TI_MAXINDPARAMS'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  # This would cause self.info.indicator to return ti.TI_INVALID_OPTION, but there would
                  # be a problem before we got there in creating the `outputs` np.ndarray below with a
                  # negative dimension
                  raise InvalidOptionError()

              cdef ti.TI_REAL * c_inputs[ti.TI_MAXINDPARAMS]
                                           ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:107:37: Not allowed in a constant expression

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  # This would cause self.info.indicator to return ti.TI_INVALID_OPTION, but there would
                  # be a problem before we got there in creating the `outputs` np.ndarray below with a
                  # negative dimension
                  raise InvalidOptionError()

              cdef ti.TI_REAL * c_inputs[ti.TI_MAXINDPARAMS]
                                           ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:107:37: Array dimension not integer

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  else:
                      raise InvalidInputError("Input arrays must have a numeric dtype")
                  input_ref = inputs[i][-min_input_len:]
                  c_inputs[i] = &input_ref[0]

              cdef ti.TI_REAL * c_outputs[ti.TI_MAXINDPARAMS]
                   ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:120:13: 'TI_REAL' is not a type identifier

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  else:
                      raise InvalidInputError("Input arrays must have a numeric dtype")
                  input_ref = inputs[i][-min_input_len:]
                  c_inputs[i] = &input_ref[0]

              cdef ti.TI_REAL * c_outputs[ti.TI_MAXINDPARAMS]
                                            ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:120:38: cimported module has no attribute 'TI_MAXINDPARAMS'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  else:
                      raise InvalidInputError("Input arrays must have a numeric dtype")
                  input_ref = inputs[i][-min_input_len:]
                  c_inputs[i] = &input_ref[0]

              cdef ti.TI_REAL * c_outputs[ti.TI_MAXINDPARAMS]
                                            ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:120:38: Not allowed in a constant expression

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  else:
                      raise InvalidInputError("Input arrays must have a numeric dtype")
                  input_ref = inputs[i][-min_input_len:]
                  c_inputs[i] = &input_ref[0]

              cdef ti.TI_REAL * c_outputs[ti.TI_MAXINDPARAMS]

      tulipy/lib/__init__.pyx:120:38: Array dimension not integer

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      import numpy as np
      cimport numpy as np

      cimport ti

      TI_VERSION = ti.TI_VERSION
                     ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:39:15: cimported module has no attribute 'TI_VERSION'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      cimport numpy as np

      cimport ti

      TI_VERSION = ti.TI_VERSION
      TI_BUILD   = ti.TI_BUILD
                     ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:40:15: cimported module has no attribute 'TI_BUILD'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

      class InvalidInputError(ValueError):
          pass

      cdef dict _type_names = {
          ti.TI_TYPE_OVERLAY:     b'overlay',
            ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:49:6: cimported module has no attribute 'TI_TYPE_OVERLAY'

      Error compiling Cython file:
      -----------------------------------------------------------
      class InvalidInputError(ValueError):
          pass

      cdef dict _type_names = {
          ti.TI_TYPE_OVERLAY:     b'overlay',
          ti.TI_TYPE_INDICATOR:   b'indicator',
            ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:50:6: cimported module has no attribute 'TI_TYPE_INDICATOR'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          pass

      cdef dict _type_names = {
          ti.TI_TYPE_OVERLAY:     b'overlay',
          ti.TI_TYPE_INDICATOR:   b'indicator',
          ti.TI_TYPE_MATH:        b'math',
            ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:51:6: cimported module has no attribute 'TI_TYPE_MATH'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

      cdef dict _type_names = {
          ti.TI_TYPE_OVERLAY:     b'overlay',
          ti.TI_TYPE_INDICATOR:   b'indicator',
          ti.TI_TYPE_MATH:        b'math',
          ti.TI_TYPE_SIMPLE:      b'simple',
            ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:52:6: cimported module has no attribute 'TI_TYPE_SIMPLE'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      cdef dict _type_names = {
          ti.TI_TYPE_OVERLAY:     b'overlay',
          ti.TI_TYPE_INDICATOR:   b'indicator',
          ti.TI_TYPE_MATH:        b'math',
          ti.TI_TYPE_SIMPLE:      b'simple',
          ti.TI_TYPE_COMPARATIVE: b'comparative',
            ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:53:6: cimported module has no attribute 'TI_TYPE_COMPARATIVE'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef readonly const char * name
          cdef readonly const char * full_name
          cdef readonly const char * type

          def __init__(self, int index):
              assert 0 <= index < ti.TI_INDICATOR_COUNT
                                    ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:64:30: cimported module has no attribute 'TI_INDICATOR_COUNT'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef readonly const char * type

          def __init__(self, int index):
              assert 0 <= index < ti.TI_INDICATOR_COUNT

              self.info = ti.ti_indicators + index
                            ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:66:22: cimported module has no attribute 'ti_indicators'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  min_input_len = builtin_min(min_input_len, inputs[i].shape[0])

              option_list = options if options else [0.0]
              cdef np.ndarray[np.float64_t, ndim=1, mode='c'] c_options = np.array(option_list, dtype=np.float64)

              delta = self.info.start(&c_options[0])
                                      ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:100:32: Cannot convert 'float64_t *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  c_inputs[i] = &input_ref[0]

              cdef ti.TI_REAL * c_outputs[ti.TI_MAXINDPARAMS]
              cdef np.ndarray[np.float64_t, ndim=2, mode='c'] outputs = np.empty((self.info.outputs, min_input_len - delta))
              for i in range(self.info.outputs):
                  c_outputs[i] = &outputs[i,0]
                                 ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:123:27: Cannot take address of Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef ti.TI_REAL * c_outputs[ti.TI_MAXINDPARAMS]
              cdef np.ndarray[np.float64_t, ndim=2, mode='c'] outputs = np.empty((self.info.outputs, min_input_len - delta))
              for i in range(self.info.outputs):
                  c_outputs[i] = &outputs[i,0]

              ret = self.info.indicator(min_input_len, c_inputs, &c_options[0], c_outputs)
                                                                 ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:125:59: Cannot convert 'float64_t *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef np.ndarray[np.float64_t, ndim=2, mode='c'] outputs = np.empty((self.info.outputs, min_input_len - delta))
              for i in range(self.info.outputs):
                  c_outputs[i] = &outputs[i,0]

              ret = self.info.indicator(min_input_len, c_inputs, &c_options[0], c_outputs)
              if ret == ti.TI_INVALID_OPTION:
                          ^
      ------------------------------------------------------------

      tulipy/lib/__init__.pyx:126:20: cimported module has no attribute 'TI_INVALID_OPTION'
      Compiling tulipy/lib/__init__.pyx because it changed.
      [1/1] Cythonizing tulipy/lib/__init__.pyx
      Traceback (most recent call last):
        File "/Users/tsagias/.pyenv/versions/3.12.1/envs/finance/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/tsagias/.pyenv/versions/3.12.1/envs/finance/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/tsagias/.pyenv/versions/3.12.1/envs/finance/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 438, in build_wheel
          return _build(['bdist_wheel', '--dist-info-dir', str(metadata_directory)])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 426, in _build
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 407, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 320, in run_setup
          exec(code, locals())
        File "<string>", line 18, in <module>
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 117, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 186, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 202, in run_commands
          dist.run_commands()
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 983, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 999, in run_command
          super().run_command(command)
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 1002, in run_command
          cmd_obj.run()
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/command/bdist_wheel.py", line 379, in run
          self.run_command("build")
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 339, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 999, in run_command
          super().run_command(command)
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 1002, in run_command
          cmd_obj.run()
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build.py", line 136, in run
          self.run_command(cmd_name)
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 339, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 999, in run_command
          super().run_command(command)
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 1002, in run_command
          cmd_obj.run()
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 365, in run
          self.build_extensions()
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 481, in build_extensions
          self._build_extensions_serial()
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 507, in _build_extensions_serial
          self.build_extension(ext)
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/Cython/Distutils/build_ext.py", line 130, in build_extension
          new_ext = cythonize(
                    ^^^^^^^^^^
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
          cythonize_one(*args)
12/site-packages/setuptools/_distutils/command/build_ext.py", line 481, in build_extensions
          self._build_extensions_serial()
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 507, in _build_extensions_serial
          self.build_extension(ext)
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/Cython/Distutils/build_ext.py", line 130, in build_extension
          new_ext = cythonize(
                    ^^^^^^^^^^
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
          cythonize_one(*args)
        File "/private/var/folders/sl/t3yg0pt13h5fv85gcrnqxhxr0000gn/T/pip-build-env-lqj3gimy/overlay/lib/python3.12/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: tulipy/lib/__init__.pyx
      [end of output]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions