Drakkar-Software / OctoBot

Open source crypto trading bot
https://www.octobot.cloud
GNU General Public License v3.0
3.28k stars 756 forks source link

Fail to pip install requirements on MacOS, stuck with Octobot-Tulipy #2678

Closed bachtly closed 2 months ago

bachtly commented 2 months ago

Step 1: Have you search for this issue before posting it?

I have found a related at #1973 but they are not identical. The differences are the OS (MacOS vs Ubuntu) and the stack trace (this issue's stack trace looks related to cythonize)

Step 2: Describe your environment

Step 3: Describe the problem:

I run

python3 -m pip install -Ur requirements.txt

Expected behavior No issue

Observed Results:

Here is the log

Building wheels for collected packages: OctoBot-Tulipy Building wheel for OctoBot-Tulipy (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for OctoBot-Tulipy (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [395 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.macosx-14.0-arm64-cpython-312 creating build/lib.macosx-14.0-arm64-cpython-312/tulipy copying tulipy/init.py -> build/lib.macosx-14.0-arm64-cpython-312/tulipy running build_ext /private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/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/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-install-c3_647aa/octobot-tulipy_383989d838a343369b7a8c3c7e721551/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 "/Users/lybach/Projects/OctoBot/octobotvenv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/Users/lybach/Projects/OctoBot/octobotvenv/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/lybach/Projects/OctoBot/octobotvenv/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/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 415, in build_wheel
      return self._build_with_temp_dir(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
      self.run_setup()
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 313, in run_setup
      exec(code, locals())
    File "<string>", line 18, in <module>
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 103, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 184, in setup
      return run_commands(dist)
             ^^^^^^^^^^^^^^^^^^
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
      dist.run_commands()
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 970, in run_commands
      self.run_command(cmd)
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 974, in run_command
      super().run_command(command)
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 989, in run_command
      cmd_obj.run()
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/command/bdist_wheel.py", line 373, in run
      self.run_command("build")
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
      self.distribution.run_command(command)
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 974, in run_command
      super().run_command(command)
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 989, in run_command
      cmd_obj.run()
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
      self.distribution.run_command(command)
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 974, in run_command
      super().run_command(command)
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 989, in run_command
      cmd_obj.run()
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
      self.build_extensions()
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 479, in build_extensions
      self._build_extensions_serial()
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 505, in _build_extensions_serial
      self.build_extension(ext)
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/Cython/Distutils/build_ext.py", line 130, in build_extension
      new_ext = cythonize(
                ^^^^^^^^^^
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/overlay/lib/python3.12/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
      cythonize_one(*args)
    File "/private/var/folders/m5/qnsxtd3n4db6g6hbz6tpt1rm0000gn/T/pip-build-env-mh7kdplj/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]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for OctoBot-Tulipy Failed to build OctoBot-Tulipy ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (OctoBot-Tulipy)

Herklos commented 2 months ago

Hello,

Python3.12 is not yet supported. You have to use python3.10.

You can find a guide on how to install OctoBot with python at https://www.octobot.cloud/en/guides/octobot-installation/install-octobot-with-python-and-git#requirements

bachtly commented 2 months ago

Works like a charm, thank you