flashinfer-ai / flashinfer

FlashInfer: Kernel Library for LLM Serving
https://flashinfer.ai
Apache License 2.0
822 stars 77 forks source link

Circular import error when importing built-from-source flashinfer #248

Open vedantroy opened 2 months ago

vedantroy commented 2 months ago

Tried to compile commit 3b3ce057c935730e15da67c6879c90cbe759cbf7f from source with pip install .

When importing flashinfer, I get the error:

>>> import flashinfer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/flashinfer/python/flashinfer/__init__.py", line 17, in <module>
    from .decode import (
  File "/tmp/flashinfer/python/flashinfer/decode.py", line 31, in <module>
    raise e
  File "/tmp/flashinfer/python/flashinfer/decode.py", line 22, in <module>
    from . import _kernels
ImportError: cannot import name '_kernels' from partially initialized module 'flashinfer' (most likely due to a circular import) (/tmp/flashinfer/python/flashinfer/__init__.py)
vedantroy commented 2 months ago

The error goes away if I use:

env FLASHINFER_GROUP_SIZES=8 pip install -e .