Skip to content

[Bug]: No module named 'packaging' #6216

Closed
@Peder2911

Description

@Peder2911

What happened?

I installed xarray 0.21.0 in a fresh venv and tried to import, but that raised the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/venv/lib/python3.8/site-packages/xarray/__init__.py", line 1, in <module>
    from . import testing, tutorial, ufuncs
  File "/tmp/venv/lib/python3.8/site-packages/xarray/testing.py", line 8, in <module>
    from xarray.core import duck_array_ops, formatting, utils
  File "/tmp/venv/lib/python3.8/site-packages/xarray/core/duck_array_ops.py", line 24, in <module>
    from . import dask_array_compat, dask_array_ops, dtypes, npcompat, nputils
  File "/tmp/venv/lib/python3.8/site-packages/xarray/core/dask_array_compat.py", line 4, in <module>
    from packaging.version import Version
ModuleNotFoundError: No module named 'packaging'

What did you expect to happen?

That the import would go fine

Minimal Complete Verifiable Example

python3.8 -m venv /tmp/venv
. /tmp/venv/bin/activate
pip install xarray==0.21.0
python -c "import xarray"


### Relevant log output

```python
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/venv/lib/python3.8/site-packages/xarray/__init__.py", line 1, in <module>
    from . import testing, tutorial, ufuncs
  File "/tmp/venv/lib/python3.8/site-packages/xarray/testing.py", line 8, in <module>
    from xarray.core import duck_array_ops, formatting, utils
  File "/tmp/venv/lib/python3.8/site-packages/xarray/core/duck_array_ops.py", line 24, in <module>
    from . import dask_array_compat, dask_array_ops, dtypes, npcompat, nputils
  File "/tmp/venv/lib/python3.8/site-packages/xarray/core/dask_array_compat.py", line 4, in <module>
    from packaging.version import Version
ModuleNotFoundError: No module named 'packaging'


### Anything else we need to know?

_No response_

### Environment

Can't import xarray to generate this output, but relevant versions are

python==3.8.5
pip==20.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions