Error when calling sql.connect: ModuleNotFoundError: No module named 'packaging'
Code to reproduce
from databricks import sql
sql.connect('my_hostname', 'my_http_path')
Output
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<REDACTED>/.venv/lib/python3.11/site-packages/databricks/sql/__init__.py", line 88, in connect
from .client import Connection
File "<REDACTED>/.venv/lib/python3.11/site-packages/databricks/sql/client.py", line 24, in <module>
from databricks.sql.thrift_backend import ThriftBackend
File "<REDACTED>/.venv/lib/python3.11/site-packages/databricks/sql/thrift_backend.py", line 23, in <module>
import databricks.sql.auth.thrift_http_client
File "<REDACTED>/.venv/lib/python3.11/site-packages/databricks/sql/auth/thrift_http_client.py", line 16, in <module>
from databricks.sql.auth.retry import CommandType, DatabricksRetryPolicy
File "<REDACTED>/.venv/lib/python3.11/site-packages/databricks/sql/auth/retry.py", line 19, in <module>
from packaging import version
ModuleNotFoundError: No module named 'packaging'
Environment:
databricks-sql-connector Version: 4.0.2 (latest) pip version: 25.0.1 Python version 3.11.9
Current workaround:
Downgraded to version 4.0.0, it works fine.
Hey @edduardoo
pip usually comes with packaging module installed. Perhaps there was an error in your installation. Could you try installing it manually via pip install packaging?
In my GitHub Actions environment, it's also missing. Adding packaging to my dependencies resolved the issue, but I think it should be included in this package if it's needed. For instance, wheel also relies on packaging (wheel pyproject)
Environement
pip version: 25.0.1 Python version 3.11.9
[build-system] requires = ["setuptools==78.1.0", "wheel==0.46.0"] build-backend = "setuptools.build_meta"
Got it, I'll look to add it to our python requirements setup!