← All tasks
pythonpydata/patsy #237Not a task: already works

ModuleNotFoundError: No module named 'packaging' starting with 1.0.2

envgap__pydata__patsy-237

01 / FAILURE SIGNATURE

As reported upstream

ModuleNotFoundError: No module named 'packaging'
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
34852d6bd9b39bccf6b2813f8b3208cc44296d0a
Manifest
setup.py
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

pydata/patsy #237 · read the original issue
Since version 1.0.2, if `pandas` is installed, patsy should require `packaging` to be installed too because it now runs `import packaging.version` with no try/except around it.

# Reproduction

```shell
❯ python3.10 -m venv venv
❯ source venv/bin/activate
❯ pip install patsy pandas
[...]
Successfully installed numpy-2.2.6 pandas-2.3.3 patsy-1.0.2 python-dateutil-2.9.0.post0 pytz-2025.2 six-1.17.0 tzdata-2025.2

[notice] A new release of pip is available: 23.0.1 -> 25.2
[notice] To update, run: pip install --upgrade pip

❯ python -c "import patsy"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "venv/lib/python3.10/site-packages/patsy/__init__.py", line 87, in <module>
    import patsy.highlevel
  File "venv/lib/python3.10/site-packages/patsy/highlevel.py", line 18, in <module>
    from patsy.design_info import DesignMatrix, DesignInfo
  File "venv/lib/python3.10/site-packages/patsy/design_info.py", line 28, in <module>
    from patsy.util import atleast_2d_column_default
  File "venv/lib/python3.10/site-packages/patsy/util.py", line 46, in <module>
    import packaging.version
ModuleNotFoundError: No module named 'packaging'
```

Introduced in https://github.com/pydata/patsy/commit/efa450f67d57f4b280b4423b6062f9096a048bfb#diff-7824b5b016cfbc41ef1ae2359d3e8f72bb84840518a6074430a2a9a7a04110adR46-R57

# Workaround

No such issue without `pandas` nor with `patsy<1.0.2` as expected.
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]