{ "cells": [ { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collection 'formpilot_docs' already exists\n", "i-485instr.pdf: 100%|█████████████████████████| 545/545 [02:23<00:00, 3.80it/s]\n", "i-485.pdf: 100%|██████████████████████████████| 195/195 [00:52<00:00, 3.75it/s]\n", "✅ Upserted 740 vectors across 2 forms\n" ] } ], "source": [ "!python ingest/ingest_forms.py" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "ename": "RuntimeError", "evalue": "Storage folder qdrant_data is already accessed by another instance of Qdrant client. If you require concurrent access, use Qdrant server instead.", "output_type": "error", "traceback": [ "\u001b[31m---------------------------------------------------------------------------\u001b[39m", "\u001b[31mBlockingIOError\u001b[39m Traceback (most recent call last)", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/portalocker/portalocker.py:118\u001b[39m, in \u001b[36mlock\u001b[39m\u001b[34m(file_, flags)\u001b[39m\n\u001b[32m 117\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m118\u001b[39m \u001b[43mLOCKER\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfile_\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mflags\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 119\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc_value:\n\u001b[32m 120\u001b[39m \u001b[38;5;66;03m# Python can use one of several different exception classes to\u001b[39;00m\n\u001b[32m 121\u001b[39m \u001b[38;5;66;03m# represent timeout (most likely is BlockingIOError and IOError),\u001b[39;00m\n\u001b[32m (...)\u001b[39m\u001b[32m 126\u001b[39m \u001b[38;5;66;03m# inherit) and check the errno (which should be EACCESS or EAGAIN\u001b[39;00m\n\u001b[32m 127\u001b[39m \u001b[38;5;66;03m# according to the spec).\u001b[39;00m\n", "\u001b[31mBlockingIOError\u001b[39m: [Errno 35] Resource temporarily unavailable", "\nThe above exception was the direct cause of the following exception:\n", "\u001b[31mAlreadyLocked\u001b[39m Traceback (most recent call last)", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/qdrant_client/local/qdrant_local.py:111\u001b[39m, in \u001b[36mQdrantLocal._load\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 110\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m111\u001b[39m \u001b[43mportalocker\u001b[49m\u001b[43m.\u001b[49m\u001b[43mlock\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 112\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_flock_file\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 113\u001b[39m \u001b[43m \u001b[49m\u001b[43mportalocker\u001b[49m\u001b[43m.\u001b[49m\u001b[43mLockFlags\u001b[49m\u001b[43m.\u001b[49m\u001b[43mEXCLUSIVE\u001b[49m\u001b[43m \u001b[49m\u001b[43m|\u001b[49m\u001b[43m \u001b[49m\u001b[43mportalocker\u001b[49m\u001b[43m.\u001b[49m\u001b[43mLockFlags\u001b[49m\u001b[43m.\u001b[49m\u001b[43mNON_BLOCKING\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 114\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 115\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m portalocker.exceptions.LockException:\n", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/portalocker/portalocker.py:131\u001b[39m, in \u001b[36mlock\u001b[39m\u001b[34m(file_, flags)\u001b[39m\n\u001b[32m 128\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m exc_value.errno \u001b[38;5;129;01min\u001b[39;00m (errno.EACCES, errno.EAGAIN):\n\u001b[32m 129\u001b[39m \u001b[38;5;66;03m# A timeout exception, wrap this so the outer code knows to try\u001b[39;00m\n\u001b[32m 130\u001b[39m \u001b[38;5;66;03m# again (if it wants to).\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m131\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m exceptions.AlreadyLocked(\n\u001b[32m 132\u001b[39m exc_value,\n\u001b[32m 133\u001b[39m fh=file_,\n\u001b[32m 134\u001b[39m ) \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mexc_value\u001b[39;00m\n\u001b[32m 135\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 136\u001b[39m \u001b[38;5;66;03m# Something else went wrong; don't wrap this so we stop\u001b[39;00m\n\u001b[32m 137\u001b[39m \u001b[38;5;66;03m# immediately.\u001b[39;00m\n", "\u001b[31mAlreadyLocked\u001b[39m: [Errno 35] Resource temporarily unavailable", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[31mRuntimeError\u001b[39m Traceback (most recent call last)", "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[13]\u001b[39m\u001b[32m, line 3\u001b[39m\n\u001b[32m 1\u001b[39m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mqdrant_client\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m QdrantClient\n\u001b[32m----> \u001b[39m\u001b[32m3\u001b[39m client = \u001b[43mQdrantClient\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 4\u001b[39m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[43m=\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mqdrant_data\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m 5\u001b[39m \u001b[43m \u001b[49m\u001b[43mforce_disable_check_same_thread\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# disable the lock‑safety check\u001b[39;49;00m\n\u001b[32m 6\u001b[39m \u001b[43m)\u001b[49m\n\u001b[32m 7\u001b[39m collections, _ = client.get_collections()\n\u001b[32m 8\u001b[39m \u001b[38;5;28mprint\u001b[39m(\u001b[33m\"\u001b[39m\u001b[33mCollections:\u001b[39m\u001b[33m\"\u001b[39m, [c.name \u001b[38;5;28;01mfor\u001b[39;00m c \u001b[38;5;129;01min\u001b[39;00m collections])\n", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/qdrant_client/qdrant_client.py:101\u001b[39m, in \u001b[36mQdrantClient.__init__\u001b[39m\u001b[34m(self, location, url, port, grpc_port, prefer_grpc, https, api_key, prefix, timeout, host, path, force_disable_check_same_thread, grpc_options, **kwargs)\u001b[39m\n\u001b[32m 96\u001b[39m \u001b[38;5;28mself\u001b[39m._client = QdrantLocal(\n\u001b[32m 97\u001b[39m location=location,\n\u001b[32m 98\u001b[39m force_disable_check_same_thread=force_disable_check_same_thread,\n\u001b[32m 99\u001b[39m )\n\u001b[32m 100\u001b[39m \u001b[38;5;28;01melif\u001b[39;00m path \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m101\u001b[39m \u001b[38;5;28mself\u001b[39m._client = \u001b[43mQdrantLocal\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 102\u001b[39m \u001b[43m \u001b[49m\u001b[43mlocation\u001b[49m\u001b[43m=\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 103\u001b[39m \u001b[43m \u001b[49m\u001b[43mforce_disable_check_same_thread\u001b[49m\u001b[43m=\u001b[49m\u001b[43mforce_disable_check_same_thread\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 104\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 105\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 106\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m location \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m url \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/qdrant_client/local/qdrant_local.py:60\u001b[39m, in \u001b[36mQdrantLocal.__init__\u001b[39m\u001b[34m(self, location, force_disable_check_same_thread)\u001b[39m\n\u001b[32m 58\u001b[39m \u001b[38;5;28mself\u001b[39m.aliases: Dict[\u001b[38;5;28mstr\u001b[39m, \u001b[38;5;28mstr\u001b[39m] = {}\n\u001b[32m 59\u001b[39m \u001b[38;5;28mself\u001b[39m._flock_file: Optional[TextIOWrapper] = \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m---> \u001b[39m\u001b[32m60\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_load\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 61\u001b[39m \u001b[38;5;28mself\u001b[39m._closed: \u001b[38;5;28mbool\u001b[39m = \u001b[38;5;28;01mFalse\u001b[39;00m\n", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/qdrant_client/local/qdrant_local.py:116\u001b[39m, in \u001b[36mQdrantLocal._load\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 111\u001b[39m portalocker.lock(\n\u001b[32m 112\u001b[39m \u001b[38;5;28mself\u001b[39m._flock_file,\n\u001b[32m 113\u001b[39m portalocker.LockFlags.EXCLUSIVE | portalocker.LockFlags.NON_BLOCKING,\n\u001b[32m 114\u001b[39m )\n\u001b[32m 115\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m portalocker.exceptions.LockException:\n\u001b[32m--> \u001b[39m\u001b[32m116\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[32m 117\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mStorage folder \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m.location\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m is already accessed by another instance of Qdrant client.\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 118\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33m If you require concurrent access, use Qdrant server instead.\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 119\u001b[39m )\n", "\u001b[31mRuntimeError\u001b[39m: Storage folder qdrant_data is already accessed by another instance of Qdrant client. If you require concurrent access, use Qdrant server instead." ] } ], "source": [ "from qdrant_client import QdrantClient\n", "\n", "client = QdrantClient(\n", " path=\"qdrant_data\",\n", " force_disable_check_same_thread=True # disable the lock‑safety check\n", ")\n", "collections, _ = client.get_collections()\n", "print(\"Collections:\", [c.name for c in collections])\n", "count = client.count(\"formpilot_docs\").count\n", "print(\"Count:\", count)\n", "\n" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "ename": "RuntimeError", "evalue": "Storage folder qdrant_data is already accessed by another instance of Qdrant client. If you require concurrent access, use Qdrant server instead.", "output_type": "error", "traceback": [ "\u001b[31m---------------------------------------------------------------------------\u001b[39m", "\u001b[31mBlockingIOError\u001b[39m Traceback (most recent call last)", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/portalocker/portalocker.py:118\u001b[39m, in \u001b[36mlock\u001b[39m\u001b[34m(file_, flags)\u001b[39m\n\u001b[32m 117\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m118\u001b[39m \u001b[43mLOCKER\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfile_\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mflags\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 119\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc_value:\n\u001b[32m 120\u001b[39m \u001b[38;5;66;03m# Python can use one of several different exception classes to\u001b[39;00m\n\u001b[32m 121\u001b[39m \u001b[38;5;66;03m# represent timeout (most likely is BlockingIOError and IOError),\u001b[39;00m\n\u001b[32m (...)\u001b[39m\u001b[32m 126\u001b[39m \u001b[38;5;66;03m# inherit) and check the errno (which should be EACCESS or EAGAIN\u001b[39;00m\n\u001b[32m 127\u001b[39m \u001b[38;5;66;03m# according to the spec).\u001b[39;00m\n", "\u001b[31mBlockingIOError\u001b[39m: [Errno 35] Resource temporarily unavailable", "\nThe above exception was the direct cause of the following exception:\n", "\u001b[31mAlreadyLocked\u001b[39m Traceback (most recent call last)", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/qdrant_client/local/qdrant_local.py:111\u001b[39m, in \u001b[36mQdrantLocal._load\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 110\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m111\u001b[39m \u001b[43mportalocker\u001b[49m\u001b[43m.\u001b[49m\u001b[43mlock\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 112\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_flock_file\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 113\u001b[39m \u001b[43m \u001b[49m\u001b[43mportalocker\u001b[49m\u001b[43m.\u001b[49m\u001b[43mLockFlags\u001b[49m\u001b[43m.\u001b[49m\u001b[43mEXCLUSIVE\u001b[49m\u001b[43m \u001b[49m\u001b[43m|\u001b[49m\u001b[43m \u001b[49m\u001b[43mportalocker\u001b[49m\u001b[43m.\u001b[49m\u001b[43mLockFlags\u001b[49m\u001b[43m.\u001b[49m\u001b[43mNON_BLOCKING\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 114\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 115\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m portalocker.exceptions.LockException:\n", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/portalocker/portalocker.py:131\u001b[39m, in \u001b[36mlock\u001b[39m\u001b[34m(file_, flags)\u001b[39m\n\u001b[32m 128\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m exc_value.errno \u001b[38;5;129;01min\u001b[39;00m (errno.EACCES, errno.EAGAIN):\n\u001b[32m 129\u001b[39m \u001b[38;5;66;03m# A timeout exception, wrap this so the outer code knows to try\u001b[39;00m\n\u001b[32m 130\u001b[39m \u001b[38;5;66;03m# again (if it wants to).\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m131\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m exceptions.AlreadyLocked(\n\u001b[32m 132\u001b[39m exc_value,\n\u001b[32m 133\u001b[39m fh=file_,\n\u001b[32m 134\u001b[39m ) \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mexc_value\u001b[39;00m\n\u001b[32m 135\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 136\u001b[39m \u001b[38;5;66;03m# Something else went wrong; don't wrap this so we stop\u001b[39;00m\n\u001b[32m 137\u001b[39m \u001b[38;5;66;03m# immediately.\u001b[39;00m\n", "\u001b[31mAlreadyLocked\u001b[39m: [Errno 35] Resource temporarily unavailable", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[31mRuntimeError\u001b[39m Traceback (most recent call last)", "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[11]\u001b[39m\u001b[32m, line 4\u001b[39m\n\u001b[32m 1\u001b[39m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mqdrant_client\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m QdrantClient\n\u001b[32m 3\u001b[39m \u001b[38;5;66;03m# point at the local store\u001b[39;00m\n\u001b[32m----> \u001b[39m\u001b[32m4\u001b[39m client = \u001b[43mQdrantClient\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m=\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mqdrant_data\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[32m 6\u001b[39m \u001b[38;5;66;03m# fetch and print the current vector count\u001b[39;00m\n\u001b[32m 7\u001b[39m col = \u001b[33m\"\u001b[39m\u001b[33mformpilot_docs\u001b[39m\u001b[33m\"\u001b[39m\n", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/qdrant_client/qdrant_client.py:101\u001b[39m, in \u001b[36mQdrantClient.__init__\u001b[39m\u001b[34m(self, location, url, port, grpc_port, prefer_grpc, https, api_key, prefix, timeout, host, path, force_disable_check_same_thread, grpc_options, **kwargs)\u001b[39m\n\u001b[32m 96\u001b[39m \u001b[38;5;28mself\u001b[39m._client = QdrantLocal(\n\u001b[32m 97\u001b[39m location=location,\n\u001b[32m 98\u001b[39m force_disable_check_same_thread=force_disable_check_same_thread,\n\u001b[32m 99\u001b[39m )\n\u001b[32m 100\u001b[39m \u001b[38;5;28;01melif\u001b[39;00m path \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m101\u001b[39m \u001b[38;5;28mself\u001b[39m._client = \u001b[43mQdrantLocal\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 102\u001b[39m \u001b[43m \u001b[49m\u001b[43mlocation\u001b[49m\u001b[43m=\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 103\u001b[39m \u001b[43m \u001b[49m\u001b[43mforce_disable_check_same_thread\u001b[49m\u001b[43m=\u001b[49m\u001b[43mforce_disable_check_same_thread\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 104\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 105\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 106\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m location \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m url \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/qdrant_client/local/qdrant_local.py:60\u001b[39m, in \u001b[36mQdrantLocal.__init__\u001b[39m\u001b[34m(self, location, force_disable_check_same_thread)\u001b[39m\n\u001b[32m 58\u001b[39m \u001b[38;5;28mself\u001b[39m.aliases: Dict[\u001b[38;5;28mstr\u001b[39m, \u001b[38;5;28mstr\u001b[39m] = {}\n\u001b[32m 59\u001b[39m \u001b[38;5;28mself\u001b[39m._flock_file: Optional[TextIOWrapper] = \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m---> \u001b[39m\u001b[32m60\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_load\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 61\u001b[39m \u001b[38;5;28mself\u001b[39m._closed: \u001b[38;5;28mbool\u001b[39m = \u001b[38;5;28;01mFalse\u001b[39;00m\n", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/qdrant_client/local/qdrant_local.py:116\u001b[39m, in \u001b[36mQdrantLocal._load\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 111\u001b[39m portalocker.lock(\n\u001b[32m 112\u001b[39m \u001b[38;5;28mself\u001b[39m._flock_file,\n\u001b[32m 113\u001b[39m portalocker.LockFlags.EXCLUSIVE | portalocker.LockFlags.NON_BLOCKING,\n\u001b[32m 114\u001b[39m )\n\u001b[32m 115\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m portalocker.exceptions.LockException:\n\u001b[32m--> \u001b[39m\u001b[32m116\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[32m 117\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mStorage folder \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m.location\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m is already accessed by another instance of Qdrant client.\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 118\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33m If you require concurrent access, use Qdrant server instead.\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 119\u001b[39m )\n", "\u001b[31mRuntimeError\u001b[39m: Storage folder qdrant_data is already accessed by another instance of Qdrant client. If you require concurrent access, use Qdrant server instead." ] } ], "source": [ "from qdrant_client import QdrantClient\n", "\n", "# point at the local store\n", "client = QdrantClient(path=\"qdrant_data\")\n", "\n", "# fetch and print the current vector count\n", "col = \"formpilot_docs\"\n", "count = client.count(col).count\n", "print(f\"Collection '{col}' contains {count} vectors\")\n" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "ename": "RuntimeError", "evalue": "Storage folder qdrant_data is already accessed by another instance of Qdrant client. If you require concurrent access, use Qdrant server instead.", "output_type": "error", "traceback": [ "\u001b[31m---------------------------------------------------------------------------\u001b[39m", "\u001b[31mBlockingIOError\u001b[39m Traceback (most recent call last)", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/portalocker/portalocker.py:118\u001b[39m, in \u001b[36mlock\u001b[39m\u001b[34m(file_, flags)\u001b[39m\n\u001b[32m 117\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m118\u001b[39m \u001b[43mLOCKER\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfile_\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mflags\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 119\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc_value:\n\u001b[32m 120\u001b[39m \u001b[38;5;66;03m# Python can use one of several different exception classes to\u001b[39;00m\n\u001b[32m 121\u001b[39m \u001b[38;5;66;03m# represent timeout (most likely is BlockingIOError and IOError),\u001b[39;00m\n\u001b[32m (...)\u001b[39m\u001b[32m 126\u001b[39m \u001b[38;5;66;03m# inherit) and check the errno (which should be EACCESS or EAGAIN\u001b[39;00m\n\u001b[32m 127\u001b[39m \u001b[38;5;66;03m# according to the spec).\u001b[39;00m\n", "\u001b[31mBlockingIOError\u001b[39m: [Errno 35] Resource temporarily unavailable", "\nThe above exception was the direct cause of the following exception:\n", "\u001b[31mAlreadyLocked\u001b[39m Traceback (most recent call last)", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/qdrant_client/local/qdrant_local.py:111\u001b[39m, in \u001b[36mQdrantLocal._load\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 110\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m111\u001b[39m \u001b[43mportalocker\u001b[49m\u001b[43m.\u001b[49m\u001b[43mlock\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 112\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_flock_file\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 113\u001b[39m \u001b[43m \u001b[49m\u001b[43mportalocker\u001b[49m\u001b[43m.\u001b[49m\u001b[43mLockFlags\u001b[49m\u001b[43m.\u001b[49m\u001b[43mEXCLUSIVE\u001b[49m\u001b[43m \u001b[49m\u001b[43m|\u001b[49m\u001b[43m \u001b[49m\u001b[43mportalocker\u001b[49m\u001b[43m.\u001b[49m\u001b[43mLockFlags\u001b[49m\u001b[43m.\u001b[49m\u001b[43mNON_BLOCKING\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 114\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 115\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m portalocker.exceptions.LockException:\n", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/portalocker/portalocker.py:131\u001b[39m, in \u001b[36mlock\u001b[39m\u001b[34m(file_, flags)\u001b[39m\n\u001b[32m 128\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m exc_value.errno \u001b[38;5;129;01min\u001b[39;00m (errno.EACCES, errno.EAGAIN):\n\u001b[32m 129\u001b[39m \u001b[38;5;66;03m# A timeout exception, wrap this so the outer code knows to try\u001b[39;00m\n\u001b[32m 130\u001b[39m \u001b[38;5;66;03m# again (if it wants to).\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m131\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m exceptions.AlreadyLocked(\n\u001b[32m 132\u001b[39m exc_value,\n\u001b[32m 133\u001b[39m fh=file_,\n\u001b[32m 134\u001b[39m ) \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mexc_value\u001b[39;00m\n\u001b[32m 135\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 136\u001b[39m \u001b[38;5;66;03m# Something else went wrong; don't wrap this so we stop\u001b[39;00m\n\u001b[32m 137\u001b[39m \u001b[38;5;66;03m# immediately.\u001b[39;00m\n", "\u001b[31mAlreadyLocked\u001b[39m: [Errno 35] Resource temporarily unavailable", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[31mRuntimeError\u001b[39m Traceback (most recent call last)", "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[10]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m client = \u001b[43mQdrantClient\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m=\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mqdrant_data\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[32m 2\u001b[39m \u001b[38;5;66;03m# Unpack the tuple: first element is the list of collections\u001b[39;00m\n\u001b[32m 3\u001b[39m collections, _ = client.get_collections()\n", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/qdrant_client/qdrant_client.py:101\u001b[39m, in \u001b[36mQdrantClient.__init__\u001b[39m\u001b[34m(self, location, url, port, grpc_port, prefer_grpc, https, api_key, prefix, timeout, host, path, force_disable_check_same_thread, grpc_options, **kwargs)\u001b[39m\n\u001b[32m 96\u001b[39m \u001b[38;5;28mself\u001b[39m._client = QdrantLocal(\n\u001b[32m 97\u001b[39m location=location,\n\u001b[32m 98\u001b[39m force_disable_check_same_thread=force_disable_check_same_thread,\n\u001b[32m 99\u001b[39m )\n\u001b[32m 100\u001b[39m \u001b[38;5;28;01melif\u001b[39;00m path \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m101\u001b[39m \u001b[38;5;28mself\u001b[39m._client = \u001b[43mQdrantLocal\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 102\u001b[39m \u001b[43m \u001b[49m\u001b[43mlocation\u001b[49m\u001b[43m=\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 103\u001b[39m \u001b[43m \u001b[49m\u001b[43mforce_disable_check_same_thread\u001b[49m\u001b[43m=\u001b[49m\u001b[43mforce_disable_check_same_thread\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 104\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 105\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 106\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m location \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m url \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/qdrant_client/local/qdrant_local.py:60\u001b[39m, in \u001b[36mQdrantLocal.__init__\u001b[39m\u001b[34m(self, location, force_disable_check_same_thread)\u001b[39m\n\u001b[32m 58\u001b[39m \u001b[38;5;28mself\u001b[39m.aliases: Dict[\u001b[38;5;28mstr\u001b[39m, \u001b[38;5;28mstr\u001b[39m] = {}\n\u001b[32m 59\u001b[39m \u001b[38;5;28mself\u001b[39m._flock_file: Optional[TextIOWrapper] = \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m---> \u001b[39m\u001b[32m60\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_load\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 61\u001b[39m \u001b[38;5;28mself\u001b[39m._closed: \u001b[38;5;28mbool\u001b[39m = \u001b[38;5;28;01mFalse\u001b[39;00m\n", "\u001b[36mFile \u001b[39m\u001b[32m~/AI Projects/Certification Challenge/formpilot/.venv/lib/python3.13/site-packages/qdrant_client/local/qdrant_local.py:116\u001b[39m, in \u001b[36mQdrantLocal._load\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 111\u001b[39m portalocker.lock(\n\u001b[32m 112\u001b[39m \u001b[38;5;28mself\u001b[39m._flock_file,\n\u001b[32m 113\u001b[39m portalocker.LockFlags.EXCLUSIVE | portalocker.LockFlags.NON_BLOCKING,\n\u001b[32m 114\u001b[39m )\n\u001b[32m 115\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m portalocker.exceptions.LockException:\n\u001b[32m--> \u001b[39m\u001b[32m116\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[32m 117\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mStorage folder \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m.location\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m is already accessed by another instance of Qdrant client.\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 118\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33m If you require concurrent access, use Qdrant server instead.\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 119\u001b[39m )\n", "\u001b[31mRuntimeError\u001b[39m: Storage folder qdrant_data is already accessed by another instance of Qdrant client. If you require concurrent access, use Qdrant server instead." ] } ], "source": [ "client = QdrantClient(path=\"qdrant_data\")\n", "# Unpack the tuple: first element is the list of collections\n", "collections, _ = client.get_collections()\n", "\n", "print(\"Collections in this store:\", [c.name for c in collections])\n", "\n", "# And the vector count\n", "col = \"formpilot_docs\"\n", "count = client.count(col).count\n", "print(f\"Collection '{col}' contains {count} vectors\")\n" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.3" } }, "nbformat": 4, "nbformat_minor": 2 }