I was following the LanceDB quickstart from:
https://docs.lancedb.com/quickstart
After installing LanceDB with:
I copied the Python quickstart example and ran it. The example worked until the query result was converted with .to_polars(), at which point it failed because polars was not installed.
Error
Traceback (most recent call last):
File "run.py", line 19, in <module>
result = table.search(query_vector).limit(2).to_polars()
File ".../site-packages/lancedb/query.py", line 807, in to_polars
import polars as pl
ModuleNotFoundError: No module named 'polars'
Environment
Python: 3.10
LanceDB: 0.30.2
OS: Linux x86_64
Install command: pip install lancedb
Workaround
Installing polars separately resolved the issue:
After that, the quickstart example ran successfully and returned the expected result.
Suggested fix
The quickstart currently uses:
result = table.search(query_vector).limit(2).to_polars()
But polars does not appear to be installed by default with:
A few possible fixes:
- Update the quickstart install command to include
polars, for example:
pip install lancedb polars
-
Mention that .to_polars() requires installing polars separately.
-
Make polars part of the default lancedb install, if .to_polars() is intended to be used in the main quickstart path.
-
Use a default output method in the quickstart that works with the base lancedb installation, such as .to_list(), if that is preferred for the minimal path.
The current behavior is easy to work around, but it may trip up users who are naively following the quickstart from a clean environment.
I was following the LanceDB quickstart from:
https://docs.lancedb.com/quickstart
After installing LanceDB with:
I copied the Python quickstart example and ran it. The example worked until the query result was converted with
.to_polars(), at which point it failed becausepolarswas not installed.Error
Environment
Workaround
Installing
polarsseparately resolved the issue:After that, the quickstart example ran successfully and returned the expected result.
Suggested fix
The quickstart currently uses:
But
polarsdoes not appear to be installed by default with:A few possible fixes:
polars, for example:Mention that
.to_polars()requires installingpolarsseparately.Make
polarspart of the defaultlancedbinstall, if.to_polars()is intended to be used in the main quickstart path.Use a default output method in the quickstart that works with the base
lancedbinstallation, such as.to_list(), if that is preferred for the minimal path.The current behavior is easy to work around, but it may trip up users who are naively following the quickstart from a clean environment.