blankly-finance / blankly

🚀 💸 Easily build, backtest and deploy your algo in just a few lines of code. Trade stocks, cryptos, and forex across exchanges w/ one package.
https://package.blankly.finance
GNU Lesser General Public License v3.0
2.03k stars 261 forks source link

Error installing blankly. 'ti.pxd' not found #255

Open rod7760 opened 3 months ago

rod7760 commented 3 months ago

Description

I can't seem to install blankly.

Error (if applicable)

~/Projects ❯ pipx install blankly                                                                                                     2.7.8
Fatal error from pip prevented installation. Full pip output in file:
    /home/rick/.local/state/pipx/log/cmd_2024-03-13_22.57.36_pip_errors.log

pip failed to build package:
    newnewtulipy

Some possibly relevant errors from pip install:
    error: subprocess-exited-with-error
    tulipy/lib/__init__.pyx:37:8: 'ti.pxd' not found
    Cython.Compiler.Errors.CompileError: tulipy/lib/__init__.pyx

Error installing blankly.

Platform Info

rod7760 commented 3 months ago

Whoop. I realized I probably shouldn't have done pipx. However, the output is similar with pip.

Building wheels for collected packages: newnewtulipy
  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
  ╰─> [389 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-cpython-310
      creating build/lib.linux-aarch64-cpython-310/tulipy
      copying tulipy/__init__.py -> build/lib.linux-aarch64-cpython-310/tulipy
      running build_ext
      /tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/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: /tmp/pip-install-306lhwz4/newnewtulipy_9b0787c72d8243c99386440d273390e3/tulipy/lib/__init__.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)

      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 "/home/rick/Projects/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/home/rick/Projects/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/rick/Projects/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 410, in build_wheel
          return self._build_with_temp_dir(
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 18, in <module>
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 130, in build_extension
          new_ext = cythonize(
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
          cythonize_one(*args)
        File "/tmp/pip-build-env-gyjkajjm/overlay/lib/python3.10/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]

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

I had the same problem and I solved it by installing python 3.9 and everything works fine.