Skip to content

[Bug] ImportError: cannot import name '_mul_broadcast_shape' from 'gpytorch.utils.broadcasting' #1370

@harupy

Description

@harupy

🐛 Bug

To reproduce

** Code snippet to reproduce **

docker run --rm python:3.8 bash -c "pip install botorch && python -c 'import botorch'"

** Stack trace/error message **

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/botorch/__init__.py", line 7, in <module>
    from botorch import (
  File "/usr/local/lib/python3.8/site-packages/botorch/acquisition/__init__.py", line 7, in <module>
    from botorch.acquisition.acquisition import (
  File "/usr/local/lib/python3.8/site-packages/botorch/acquisition/acquisition.py", line 16, in <module>
    from botorch.models.model import Model
  File "/usr/local/lib/python3.8/site-packages/botorch/models/__init__.py", line 7, in <module>
    from botorch.models.approximate_gp import (
  File "/usr/local/lib/python3.8/site-packages/botorch/models/approximate_gp.py", line 35, in <module>
    from botorch.models.gpytorch import GPyTorchModel
  File "/usr/local/lib/python3.8/site-packages/botorch/models/gpytorch.py", line 23, in <module>
    from botorch.acquisition.objective import PosteriorTransform
  File "/usr/local/lib/python3.8/site-packages/botorch/acquisition/objective.py", line 18, in <module>
    from botorch.models.model import Model
  File "/usr/local/lib/python3.8/site-packages/botorch/models/model.py", line 24, in <module>
    from botorch.models.utils.assorted import fantasize as fantasize_flag
  File "/usr/local/lib/python3.8/site-packages/botorch/models/utils/__init__.py", line 7, in <module>
    from botorch.models.utils.assorted import (
  File "/usr/local/lib/python3.8/site-packages/botorch/models/utils/assorted.py", line 21, in <module>
    from gpytorch.utils.broadcasting import _mul_broadcast_shape
ImportError: cannot import name '_mul_broadcast_shape' from 'gpytorch.utils.broadcasting' (/usr/local/lib/python3.8/site-packages/gpytorch/utils/broadcasting.py)

Expected Behavior

import botorch should succeed.

System information

Please complete the following information:

  • 0.6.6
  • 1.10
  • 1.9.0
  • Debian GNU/Linux

Additional context

Add any other context about the problem here.

pip installation log

Collecting botorch
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /packages/12/29/4e382ca14a4e5b759615fc8834bdd1345bfba2a176bf432aa473991243a4/botorch-0.6.6-py3-none-any.whl
  Downloading botorch-0.6.6-py3-none-any.whl (387 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 387.4/387.4 KB 9.6 MB/s eta 0:00:00
Collecting torch>=1.10
  Downloading torch-1.12.1-cp38-cp38-manylinux1_x86_64.whl (776.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 776.3/776.3 MB 3.9 MB/s eta 0:00:00
Collecting gpytorch>=1.8.1
  Downloading gpytorch-1.9.0-py3-none-any.whl (245 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 245.8/245.8 KB 6.0 MB/s eta 0:00:00
Collecting multipledispatch
  Downloading multipledispatch-0.6.0-py3-none-any.whl (11 kB)
Collecting pyro-ppl>=1.8.0
  Downloading pyro_ppl-1.8.1-py3-none-any.whl (718 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 718.2/718.2 KB 9.8 MB/s eta 0:00:00
Collecting scipy
  Downloading scipy-1.9.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (43.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.4/43.4 MB 10.5 MB/s eta 0:00:00
Collecting scikit-learn
  Downloading scikit_learn-1.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (31.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 31.2/31.2 MB 10.3 MB/s eta 0:00:00
Collecting linear-operator>=0.1.1
  Downloading linear_operator-0.1.1-py3-none-any.whl (145 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 145.9/145.9 KB 10.3 MB/s eta 0:00:00
Collecting opt-einsum>=2.3.2
  Downloading opt_einsum-3.3.0-py3-none-any.whl (65 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.5/65.5 KB 9.3 MB/s eta 0:00:00
Collecting pyro-api>=0.1.1
  Downloading pyro_api-0.1.2-py3-none-any.whl (11 kB)
Collecting tqdm>=4.36
  Downloading tqdm-4.64.0-py2.py3-none-any.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.4/78.4 KB 8.5 MB/s eta 0:00:00
Collecting numpy>=1.7
  Downloading numpy-1.23.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.1/17.1 MB 8.2 MB/s eta 0:00:00
Collecting typing-extensions
  Downloading typing_extensions-4.3.0-py3-none-any.whl (25 kB)
Collecting six
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting joblib>=1.0.0
  Downloading joblib-1.1.0-py2.py3-none-any.whl (306 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 307.0/307.0 KB 8.7 MB/s eta 0:00:00
Collecting threadpoolctl>=2.0.0
  Downloading threadpoolctl-3.1.0-py3-none-any.whl (14 kB)
Installing collected packages: pyro-api, typing-extensions, tqdm, threadpoolctl, six, numpy, joblib, torch, scipy, opt-einsum, multipledispatch, scikit-learn, pyro-ppl, linear-operator, gpytorch, botorch
Successfully installed botorch-0.6.6 gpytorch-1.9.0 joblib-1.1.0 linear-operator-0.1.1 multipledispatch-0.6.0 numpy-1.23.2 opt-einsum-3.3.0 pyro-api-0.1.2 pyro-ppl-1.8.1 scikit-learn-1.1.2 scipy-1.9.1 six-1.16.0 threadpoolctl-3.1.0 torch-1.12.1 tqdm-4.64.0 typing-extensions-4.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions