{"id":2696,"library":"pylance","title":"Lance Python SDK","description":"Pylance is the Python SDK for the Lance columnar data format, an open lakehouse format optimized for AI/ML workflows. It offers high-performance vector search, efficient random access, and built-in data versioning and lineage. The library leverages Apache Arrow for data interchange and its core bindings are implemented in Rust via PyO3 for performance. It seamlessly integrates with popular data science tools like Pandas, DuckDB, Polars, PyArrow, and Ray. The current version is 4.0.0, released on March 30, 2026, and the project has a regular release cadence with stable releases approximately every two weeks, although its development status is currently marked as 'Alpha'.","status":"active","version":"4.0.0","language":"python","source_language":"en","source_url":"https://github.com/lance-format/lance","tags":["data format","columnar","ai","machine learning","vector search","lakehouse","apache arrow","data science"],"install":[{"cmd":"pip install pylance","lang":"bash","label":"Install stable version"},{"cmd":"pip install --pre --extra-index-url https://pypi.fury.io/lance-format/ pylance","lang":"bash","label":"Install preview version"}],"dependencies":[{"reason":"Lance is built on Apache Arrow for data interchange.","package":"pyarrow","optional":false},{"reason":"Commonly used for DataFrame creation and manipulation with Lance datasets.","package":"pandas","optional":true},{"reason":"Often used for array operations, particularly with vector data.","package":"numpy","optional":true}],"imports":[{"symbol":"lance","correct":"import lance"}],"quickstart":{"code":"import lance\nimport pandas as pd\nimport numpy as np\n\n# Create a simple Pandas DataFrame\ndf = pd.DataFrame({\n    \"id\": [1, 2, 3],\n    \"vector\": [[0.1, 0.2], [0.3, 0.4], [0.5, 0.6]],\n    \"text\": [\"apple\", \"banana\", \"cherry\"]\n})\n\n# Define a URI for your Lance dataset (local path in this case)\nlance_uri = \"./my_lance_dataset.lance\"\n\n# Write the DataFrame to Lance format\ndataset = lance.write_dataset(df, lance_uri, mode=\"overwrite\")\n\nprint(f\"Lance dataset created at: {lance_uri}\")\n\n# Open the dataset and read it back\nread_dataset = lance.dataset(lance_uri)\nread_df = read_dataset.to_pandas()\n\nprint(\"\\nData read from Lance dataset:\")\nprint(read_df)\n\n# Clean up the created directory (optional)\nimport shutil\nshutil.rmtree(lance_uri)\nprint(f\"\\nCleaned up {lance_uri}\")","lang":"python","description":"This quickstart demonstrates how to create a Lance dataset from a Pandas DataFrame, write it to disk, and then read it back. It also includes cleanup of the created files."},"warnings":[{"fix":"Be prepared for potential API changes and refer to the official documentation for the latest usage patterns.","message":"The library is currently in '3 - Alpha' development status, indicating that the API is not yet stable. Breaking changes may occur between minor versions.","severity":"gotcha","affected_versions":"All versions up to 4.0.0"},{"fix":"Familiarize yourself with cloud storage configurations and performance considerations when working with Lance datasets.","message":"Lance is optimized to be cloud-native, and remote object storage is now the default paradigm. Expect different performance characteristics and potentially require different setup compared to traditional local file-system workflows.","severity":"gotcha","affected_versions":"All versions from 0.3.0 onwards"},{"fix":"Ensure `duckdb` is updated to version 0.7+ if you plan to use it with Lance.","message":"When integrating with DuckDB, specific functionalities may require DuckDB version 0.7 or newer to avoid potential segfaults or unexpected behavior.","severity":"gotcha","affected_versions":"All versions up to 4.0.0"},{"fix":"Use `pip install pylance` for stable releases in production. For preview features, be prepared to update regularly or adjust dependencies.","message":"While preview releases offer the latest features and bug fixes and are tested similarly to stable releases, they are not guaranteed to be available for more than six months. For production environments, it is recommended to pin to stable releases.","severity":"gotcha","affected_versions":"All versions, particularly preview releases"}],"env_vars":null,"search_vec":"'2026':85 '30':84 '4.0.0':80 'access':32 'ai':113 'ai/ml':21 'alpha':109 'although':101 'apach':44,119 'approxim':97 'arrow':45,120 'bind':52 'built':35 'built-in':34 'cadenc':93 'columnar':12,112 'core':51 'current':77,106 'data':13,37,47,66,110,121 'develop':103 'duckdb':71 'effici':30 'everi':98 'format':14,18,111 'high':26 'high-perform':25 'implement':54 'integr':63 'interchang':48 'lakehous':17,118 'lanc':1,11 'learn':115 'leverag':43 'librari':42 'like':69 'lineag':40 'machin':114 'march':83 'mark':107 'offer':24 'open':16 'optim':19 'panda':70 'perform':27,60 'polar':72 'popular':65 'project':88 'pyarrow':73 'pylanc':4 'pyo3':58 'python':2,7 'random':31 'ray':75 'regular':91 'releas':81,92,96 'rust':56 'scienc':67,122 'sdk':3,8 'seamless':62 'search':29,117 'stabl':95 'status':104 'tool':68 'two':99 'vector':28,116 'version':38,78 'via':57 'week':100 'workflow':22","created_at":"2026-04-11T01:38:57.709599+00:00","updated_at":"2026-04-16T18:31:09.147006+00:00","problems":[{"fix":"Install the 'pylance' package using pip: `pip install pylance`. If using a virtual environment, ensure it is activated and the correct interpreter is selected in your IDE.","cause":"The 'pylance' Python SDK, which provides the 'lance' module, has not been installed, or the Python interpreter being used does not have access to the installed package.","error":"ModuleNotFoundError: No module named 'lance'"},{"fix":"Consult the official 'pylance' documentation for the correct method names and required parameters for vector search operations. Ensure your dataset has the necessary vector column and that any required indexes have been built. For example, a correct call might involve `dataset.search().vector(...)`.","cause":"This error likely occurs when attempting to call a vector search method (or any method) on a 'lance.Dataset' object with an incorrect name or if the method expects specific parameters or a pre-configured vector index that is not present. In alpha software like 'pylance', API names and required configurations can be subject to change or be less obvious.","error":"AttributeError: 'Dataset' object has no attribute 'vector_search'"},{"fix":"Convert the input data to one of the supported types before passing it to the 'pylance' function. For instance, if you have a list of dictionaries, convert it to a Pandas DataFrame or PyArrow Table first. Example: `df = pd.DataFrame(my_list_of_dicts)` followed by `lance.write(df, \"path/to/dataset\")`.","cause":"This type error indicates that data provided to a 'pylance' function (e.g., for writing a dataset) is not in one of the expected formats (Pandas DataFrame, PyArrow Table, or an iterable of PyArrow RecordBatches). The library requires specific input types for efficient data handling.","error":"TypeError: argument 'data' must be a pandas.DataFrame, pyarrow.Table or Iterable[pyarrow.RecordBatch], got: <class 'list'>"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"10.0.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://lancedb.github.io/lance/","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/pylance/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","vector-search","ai-ml","database","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}