Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: replace broken pysqlcipher3 with sqlcipher3 for ARM64

LearningCircuitdb85599491ea
diff --git a/docs/SQLCIPHER_INSTALL.md b/docs/SQLCIPHER_INSTALL.md
index 15236c8ecc..44979408b8 100644
--- a/docs/SQLCIPHER_INSTALL.md
+++ b/docs/SQLCIPHER_INSTALL.md
@@ -15,9 +15,13 @@ sudo apt install sqlcipher libsqlcipher-dev
After installation, you can install the Python binding:
```bash
-pdm add pysqlcipher3
+# For x86_64 (Intel/AMD)
+pdm add sqlcipher3-binary
+# For ARM64/aarch64
+pdm add sqlcipher3
# or
-pip install pysqlcipher3
+pip install sqlcipher3-binary # x86_64
+pip install sqlcipher3 # ARM64
```
### macOS
@@ -32,7 +36,7 @@ You may need to set environment variables for the Python binding:
```bash
export LDFLAGS="-L$(brew --prefix sqlcipher)/lib"
export CPPFLAGS="-I$(brew --prefix sqlcipher)/include"
-pdm add pysqlcipher3
+pdm add sqlcipher3
```
### Windows
@@ -61,7 +65,7 @@ RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*
# Install Local Deep Research
-RUN pip install local-deep-research pysqlcipher3
+RUN pip install local-deep-research sqlcipher3
CMD ["ldr", "serve"]
```
@@ -75,7 +79,7 @@ You can verify SQLCipher is installed correctly:
sqlcipher --version
# Test Python binding
-python -c "import pysqlcipher3; print('SQLCipher is installed!')"
+python -c "from local_deep_research.database.sqlcipher_compat import get_sqlcipher_module; get_sqlcipher_module(); print('SQLCipher is installed!')"
```
## Fallback Mode
@@ -103,12 +107,14 @@ Make sure you've set the LDFLAGS and CPPFLAGS environment variables as shown abo
Ensure you're using the Visual Studio Native Tools Command Prompt and have all required dependencies installed.
-### Python: "No module named pysqlcipher3"
+### Python: "No module named sqlcipher3"
-Try using the alternative package:
-```bash
-pip install sqlcipher3
-```
+The project automatically selects the correct SQLCipher package based on your platform:
+- **x86_64 Linux**: Uses `sqlcipher3-binary` (pre-compiled wheel)
+- **ARM64 Linux**: Uses `sqlcipher3` (builds from source with system SQLCipher)
+- **Other platforms**: Uses `sqlcipher3`
+
+If you encounter issues, ensure you have `libsqlcipher-dev` installed first.
## For Developers
@@ -127,6 +133,7 @@ if command -v brew &> /dev/null; then
brew install sqlcipher
fi
-# Install Python package
-pip install pysqlcipher3 || pip install sqlcipher3
+# Install Python package (handled automatically by PDM based on platform)
+# For x86_64: sqlcipher3-binary will be installed
+# For ARM64: sqlcipher3 will be installed
```
diff --git a/pdm.lock b/pdm.lock
index d93af62f67..8bad9a75df 100644
--- a/pdm.lock
+++ b/pdm.lock
@@ -5,7 +5,7 @@
groups = ["default", "dev"]
strategy = ["inherit_metadata"]
lock_version = "4.5.0"
-content_hash = "sha256:a5ca7fd2b0ec5fff49a79e659712c76dd1c7c955e578c703ea5c8d448a18922e"
+content_hash = "sha256:f9c4a231d275893a6dee59b1ff0ad953b88f89262a8f7c859cddb5f70e259e60"
[[metadata.targets]]
requires_python = ">=3.11,<3.15"
@@ -4767,17 +4767,6 @@ files = [
{file = "pyphen-0.17.2.tar.gz", hash = "sha256:f60647a9c9b30ec6c59910097af82bc5dd2d36576b918e44148d8b07ef3b4aa3"},
]
-[[package]]
-name = "pysqlcipher3"
-version = "1.2.0"
-requires_python = ">=3.3"
-summary = "DB-API 2.0 interface for SQLCIPHER 3.x"
-groups = ["default"]
-marker = "(platform_machine == \"aarch64\" or platform_machine == \"arm64\") and sys_platform == \"linux\""
-files = [
- {file = "pysqlcipher3-1.2.0.tar.gz", hash = "sha256:3c8033812655947ebf29a809ac5106b2bc69be0274eaccef6b58f4580c8d06c5"},
-]
-
[[package]]
name = "pytest"
version = "8.4.2"
@@ -5848,7 +5837,7 @@ name = "sqlcipher3"
version = "0.5.4"
summary = "DB-API 2.0 interface for SQLCipher 3.x"
groups = ["default"]
-marker = "sys_platform != \"linux\""
+marker = "platform_machine == \"aarch64\" or platform_machine == \"arm64\" or sys_platform != \"linux\""
files = [
{file = "sqlcipher3-0.5.4.tar.gz", hash = "sha256:e30ff58d64dd43e19eceddd10116a1a27ad1d9888cc4245c75f2bda9b0384e77"},
]
diff --git a/pyproject.toml b/pyproject.toml
index c66cac164b..c2aac960ab 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -76,7 +76,7 @@ dependencies = [
"redis>=4.0.0",
"msgpack>=1.0.0",
"sqlcipher3-binary>=0.5.4; sys_platform == 'linux' and platform_machine == 'x86_64'",
- "pysqlcipher3>=1.2.0; sys_platform == 'linux' and (platform_machine == 'aarch64' or platform_machine == 'arm64')",
+ "sqlcipher3>=0.5.4; sys_platform == 'linux' and (platform_machine == 'aarch64' or platform_machine == 'arm64')",
"sqlcipher3>=0.5.0; sys_platform != 'linux'",
"lxml-html-clean>=0.4.2",
"weasyprint>=66.0",
diff --git a/src/local_deep_research/database/encrypted_db.py b/src/local_deep_research/database/encrypted_db.py
index 5a5f8ffca9..3e91a5dba2 100644
--- a/src/local_deep_research/database/encrypted_db.py
+++ b/src/local_deep_research/database/encrypted_db.py
@@ -108,7 +108,7 @@ class DatabaseManager:
"Your databases will NOT be encrypted.\n"
"To fix this:\n"
"1. Install SQLCipher: sudo apt install sqlcipher libsqlcipher-dev\n"
- "2. Install Python binding: pip install pysqlcipher3\n"
+ "2. Install Python binding: pip install sqlcipher3\n"
"Or use Docker with SQLCipher pre-installed.\n\n"
"To explicitly allow unencrypted databases (NOT RECOMMENDED):\n"
"export LDR_ALLOW_UNENCRYPTED=true"
diff --git a/src/local_deep_research/database/encryption_check.py b/src/local_deep_research/database/encryption_check.py
index d715dafb6c..b6f6bf3415 100644
--- a/src/local_deep_research/database/encryption_check.py
+++ b/src/local_deep_research/database/encryption_check.py
@@ -16,16 +16,7 @@ def check_sqlcipher_available() -> Tuple[bool, Optional[str]]:
Tuple of (is_available, error_message)
"""
try:
- # Try to import pysqlcipher3
- import importlib.util
-
- if importlib.util.find_spec("pysqlcipher3") is not None:
- return True, None
- except ImportError:
- pass
-
- try:
- # Try alternative package
+ # Try to import sqlcipher3 (covers both sqlcipher3 and sqlcipher3-binary)
import importlib.util
if importlib.util.find_spec("sqlcipher3") is not None:
@@ -46,7 +37,7 @@ def check_sqlcipher_available() -> Tuple[bool, Optional[str]]:
if result.returncode == 0:
return (
False,
- "SQLCipher is installed but Python bindings are missing. Run: pip install pysqlcipher3",
+ "SQLCipher is installed but Python bindings are missing. Run: pip install sqlcipher3",
)
except (subprocess.TimeoutExpired, FileNotFoundError):
pass
diff --git a/src/local_deep_research/database/sqlcipher_compat.py b/src/local_deep_research/database/sqlcipher_compat.py
index 55802d1183..5cb944f80d 100644
--- a/src/local_deep_research/database/sqlcipher_compat.py
+++ b/src/local_deep_research/database/sqlcipher_compat.py
@@ -2,8 +2,9 @@
SQLCipher compatibility module for cross-platform support.
Provides a unified interface for importing SQLCipher on different platforms:
-- x86_64: Uses sqlcipher3-binary
-- ARM64: Uses pysqlcipher3
+- x86_64 Linux: Uses sqlcipher3-binary (pre-compiled wheel)
+- ARM64 Linux: Uses sqlcipher3 (builds from source)
+- Other platforms: Uses sqlcipher3
"""
@@ -11,31 +12,21 @@ def get_sqlcipher_module():
"""
Get the appropriate SQLCipher module for the current platform.
- Returns the sqlcipher3 module on x86_64 or pysqlcipher3 on ARM64.
- For compatibility, both modules are wrapped to have the same API.
+ Returns the sqlcipher3 module (either sqlcipher3-binary or sqlcipher3
+ depending on platform and what's installed).
Returns:
module: The sqlcipher module with dbapi2 attribute
Raises:
- ImportError: If neither sqlcipher3 nor pysqlcipher3 is available
+ ImportError: If sqlcipher3 is not available
"""
try:
import sqlcipher3
return sqlcipher3
except ImportError:
- try:
- # pysqlcipher3 has a different API structure
- # We need to import dbapi2 directly and wrap it
- from pysqlcipher3 import dbapi2
- from types import SimpleNamespace
-
- # Create a wrapper that has the same API as sqlcipher3
- # Using SimpleNamespace to wrap the dbapi2 submodule
- return SimpleNamespace(dbapi2=dbapi2)
- except ImportError:
- raise ImportError(
- "Neither sqlcipher3 nor pysqlcipher3 is installed. "
- "Install with: pip install sqlcipher3-binary (x86_64) or pip install pysqlcipher3 (ARM64)"
- )
+ raise ImportError(
+ "sqlcipher3 is not installed. "
+ "Install with: pip install sqlcipher3-binary (x86_64) or pip install sqlcipher3 (ARM64)"
+ )
diff --git a/src/local_deep_research/database/sqlcipher_utils.py b/src/local_deep_research/database/sqlcipher_utils.py
index 0c6524642f..faae82273b 100644
--- a/src/local_deep_research/database/sqlcipher_utils.py
+++ b/src/local_deep_research/database/sqlcipher_utils.py
@@ -228,7 +228,8 @@ def create_sqlcipher_connection(db_path: str, password: str) -> Any:
sqlcipher3 = get_sqlcipher_module()
except ImportError:
raise ImportError(
- "Neither sqlcipher3 nor pysqlcipher3 is available for encrypted databases"
+ "sqlcipher3 is not available for encrypted databases. "
+ "Install with: pip install sqlcipher3-binary (x86_64) or pip install sqlcipher3 (ARM64)"
)
conn = sqlcipher3.connect(str(db_path))