Skip to content

from backtesting import Backtest Cause AttributeError: module 'numpy' has no attribute 'bool8'. Did you mean: 'bool'? #8

@xaritoku

Description

@xaritoku

Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library.

  • I checked the documentation and other Issues. I am using the latest version of this library.

Version of this library.

lucit-backtesting = "^1.0.0"

Hardware?

Local server/workstation

Operating System?

Linux

Python version?

Python3.10

Installed wheel files

No response

Installed packages

No response

Logging output

No response

Issue

Hello, this is a great library for backtesting. But there's a little bit version conflict when I'm using:

Traceback (most recent call last):
  File "/builds/repo/examples/run.py", line 2, in <module>
    from backtesting import Backtest
  File "/root/.cache/pypoetry/virtualenvs/project-env-py3.10/lib/python3.10/site-packages/backtesting/__init__.py", line 60, in <module>
    from . import lib  # noqa: F401
  File "/root/.cache/pypoetry/virtualenvs/project-env-py3.10/lib/python3.10/site-packages/backtesting/lib.py", line 23, in <module>
    from ._plotting import plot_heatmaps as _plot_heatmaps
  File "/root/.cache/pypoetry/virtualenvs/project-env-py3.10/lib/python3.10/site-packages/backtesting/_plotting.py", line 18, in <module>
    from bokeh.plotting import figure as _figure
  File "/root/.cache/pypoetry/virtualenvs/project-env-py3.10/lib/python3.10/site-packages/bokeh/plotting/__init__.py", line 22, in <module>
    from . import figure as _figure ; _figure
  File "/root/.cache/pypoetry/virtualenvs/project-env-py3.10/lib/python3.10/site-packages/bokeh/plotting/figure.py", line 25, in <module>
    from ..core.properties import (
  File "/root/.cache/pypoetry/virtualenvs/project-env-py3.10/lib/python3.10/site-packages/bokeh/core/properties.py", line 273, in <module>
    from .property.auto import Auto; Auto
  File "/root/.cache/pypoetry/virtualenvs/project-env-py3.10/lib/python3.10/site-packages/bokeh/core/property/auto.py", line 24, in <module>
    from .enum import Enum
  File "/root/.cache/pypoetry/virtualenvs/project-env-py3.10/lib/python3.10/site-packages/bokeh/core/property/enum.py", line 27, in <module>
    from .primitive import String
  File "/root/.cache/pypoetry/virtualenvs/project-env-py3.10/lib/python3.10/site-packages/bokeh/core/property/primitive.py", line 37, in <module>
    bokeh_bool_types += (np.bool8,)
  File "/root/.cache/pypoetry/virtualenvs/project-env-py3.10/lib/python3.10/site-packages/numpy/__init__.py", line 410, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'bool8'. Did you mean: 'bool'?

I use poetry for version control, I just using poetry add lucit-backtesting and poetry add pandas.

Here is part of my pyproject.toml content:

[tool.poetry.dependencies]
python = "^3.10"
lucit-backtesting = "^1.0.0"
pandas = "^2.2.2"

as version resolving results, numpy version is 2.0.1,and error happens.
I can change the wrong line in site-packagaes, but in test environment, it's not a good way.
Could we update bokeh version? or there's any environment constraint files files provide?

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions