numcodecs icon indicating copy to clipboard operation
numcodecs copied to clipboard

ImportError during install

Open Qrokqt opened this issue 2 years ago • 1 comments

I tried to install zarr and it seems like it failed when trying to install numcodecs

(zarrvenv) joe@home:~/zarr$ python3 -m pip install zarr
Collecting zarr
  Downloading https://files.pythonhosted.org/packages/56/a6/817d25f7b77b695b1014030bfff90288846862a50d72c1ee85a8a233c040/zarr-2.12.0-py3-none-any.whl (185kB)
    100% |████████████████████████████████| 194kB 8.6MB/s
Collecting asciitree (from zarr)
  Downloading https://files.pythonhosted.org/packages/2d/6a/885bc91484e1aa8f618f6f0228d76d0e67000b0fdd6090673b777e311913/asciitree-0.3.3.tar.gz
Collecting numpy>=1.7 (from zarr)
  Downloading https://files.pythonhosted.org/packages/45/b7/de7b8e67f2232c26af57c205aaad29fe17754f793404f59c8a730c7a191a/numpy-1.21.6.zip (10.3MB)
    100% |████████████████████████████████| 10.3MB 210kB/s
  Installing build dependencies ... done
Collecting fasteners (from zarr)
  Downloading https://files.pythonhosted.org/packages/61/bf/fd60001b3abc5222d8eaa4a204cd8c0ae78e75adc688f33ce4bf25b7fafa/fasteners-0.19-py3-none-any.whl
Collecting numcodecs>=0.6.4 (from zarr)
  Downloading https://files.pythonhosted.org/packages/91/71/3942cb3cc8de0d702a896435c1d905a000facd55ba58afe33bd19b93f232/numcodecs-0.10.2.tar.gz (4.5MB)
    100% |████████████████████████████████| 4.5MB 447kB/s
    Complete output from command python setup.py egg_info:
    [numcodecs] setting up Blosc extension
    [numcodecs] compiling Blosc extension with SSE2 support
    [numcodecs] compiling Blosc extension with AVX2 support
    [numcodecs] setting up Zstandard extension
    [numcodecs] setting up LZ4 extension
    [numcodecs] setting up compat extension
    [numcodecs] setting up shuffle extension
    [numcodecs] setting up vlen extension
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-cz69yi5q/numcodecs/setup.py", line 380, in <module>
        run_setup(with_extensions)
      File "/tmp/pip-install-cz69yi5q/numcodecs/setup.py", line 373, in run_setup
        zip_safe=False,
      File "/path/to/venv/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.7/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/path/to/venv/lib/python3.7/site-packages/setuptools/dist.py", line 447, in __init__
        k: v for k, v in attrs.items()
      File "/usr/lib/python3.7/distutils/dist.py", line 292, in __init__
        self.finalize_options()
      File "/path/to/venv/lib/python3.7/site-packages/setuptools/dist.py", line 739, in finalize_options
        ep.load()(self, ep.name, value)
      File "/path/to/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2411, in load
        return self.resolve()
      File "/path/to/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2417, in resolve
        module = __import__(self.module_name, fromlist=['__name__'], level=0)
      File "/tmp/pip-install-cz69yi5q/numcodecs/.eggs/setuptools_scm-8.0.4-py3.7.egg/setuptools_scm/__init__.py", line 7, in <module>
        from ._config import Configuration
      File "/tmp/pip-install-cz69yi5q/numcodecs/.eggs/setuptools_scm-8.0.4-py3.7.egg/setuptools_scm/_config.py", line 11, in <module>
        from typing import Protocol
    ImportError: cannot import name 'Protocol' from 'typing' (/usr/lib/python3.7/typing.py)

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-cz69yi5q/numcodecs/

Qrokqt avatar Dec 14 '23 14:12 Qrokqt

Py3.7 is pretty old now. You might need to specify an older version of zarr or, better, update to a more recent python (v3.12 is the current one). Even easier might be to use conda, which is better at ensuring consistent sets of package versions for any version of python.

martindurant avatar Dec 14 '23 14:12 martindurant