openvinotoolkit / anomalib

An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.
https://anomalib.readthedocs.io/en/latest/
Apache License 2.0
3.4k stars 615 forks source link

[Bug]: Error installing with pip version 24.1 #2156

Open FedericoDeBona opened 1 week ago

FedericoDeBona commented 1 week ago

Describe the bug

Installing anomalib with:

git clone https://github.com/openvinotoolkit/anomalib.git
cd anomalib
pip install -e .
anomalib install

with pip version 24.1 gives error on anomalib install:

[16:59:23] Installation list: ['nbsphinx', 'pytest-xdist', 'onnx>=1.16.0', 'ipykernel', 'einops>=0.3.2', 'openvino>=2024.0',               install.py:73
           'sphinx-autodoc-typehints', 'pytest', 'wandb<=0.15.9,>=0.12.17', 'omegaconf>=2.1.1', 'pytest-sugar', 'torchmetrics>=1.3.2',                  
           'coverage', 'av>=10.0.0', 'opencv-python>=4.5.3.56', 'anomalib', 'tox', 'anomalib', 'tensorboard', 'sphinx-book-theme',                      
           'pytest-mock', 'notebook', 'lightning>=2.2', 'matplotlib>=3.4.3', 'freia>=0.2', 'ipywidgets', 'kornia>=0.6.6',                               
           'open-clip-torch>=2.23.0', 'docstring-parser', 'pandoc', 'pytest-cov', 'sphinx-copybutton', 'nncf>=2.10.0', 'rich-argparse',                 
           'sphinx-design', 'imgaug==0.4.0', 'myst-parser', 'sphinx<8.0', 'mlflow>=1.0.0', 'jsonargparse>=4.27.7', 'gradio>=4',                         
           'gitpython', 'pre-commit', 'rich>=13.5.2', 'pandas>=1.1.0', 'timm<=1.0.3,>=0.5.4', 'comet-ml>=3.31.7', '--extra-index-url',                  
           'https://download.pytorch.org/whl/cpu', 'torch>=2+cpu', 'torchvision>=0.16.2']                                                               
[06/26/24 16:59:23] Invalid requirement: 'torch>=2+cpu': Local version label can only be used with `==` or `!=` operators                               
                        torch>=2+cpu                                                                                                                    
                             ~~~^                                                                                                                       
⠹ Installing packages...  This may take a few minutes.
ERROR: Invalid requirement: 'torch>=2+cpu': Local version label can only be used with `==` or `!=` operators
    torch>=2+cpu

Downgrading it to 24.0 solved the issue

Dataset

N/A

Model

N/A

Steps to reproduce the behavior

  1. git clone https://github.com/openvinotoolkit/anomalib.git
  2. cd anomalib
  3. pip install -e .
  4. anomalib install

OS information

OS information:

Expected behavior

Installation ends without errors

Screenshots

No response

Pip/GitHub

GitHub

What version/branch did you use?

1.1.0

Configuration YAML

-

Logs

-

Code of Conduct

WestwardWinds commented 1 week ago

I am also having this issue installing today, also got around it by reverting pip to 24.0:

OS information:

-OS: Windows 10 -Python version: 3.11.0 -Anomalib version: 1.1.0 -Pip version: 24.1

Installing anomalib with:

pip install anomalib anomalib install -v

Result of anomalib install -v:

anomalib install -v
To use other subcommand using `anomalib install`
Could not find anomalib. To use this feature, ensure that you have anomalib installed.
Could not find openvino. To use this feature, ensure that you have openvino installed.
To use any logger install it using `anomalib install -v`
C:\xxx\xxx\xxx\xxx\Lib\site-packages\anomalib\cli\install.py:63: UserWarning: Torch Version will be selected as 2.2.0.
  torch_install_args = get_torch_install_args(torch_requirement)
'nvcc' is not recognized as an internal or external command,
operable program or batch file.
[13:58:27] Installation list: ['freia>=0.2', 'nbsphinx', 'pytest', 'open-clip-torch>=2.23.0', 'anomalib', install.py:73
           'kornia>=0.6.6', 'gradio>=4', 'sphinx-design', 'sphinx<8.0', 'tox', 'nncf>=2.10.0',
           'pytest-mock', 'gitpython', 'pre-commit', 'torchmetrics>=1.3.2', 'pandoc', 'rich-argparse',
           'anomalib', 'sphinx-copybutton', 'pandas>=1.1.0', 'omegaconf>=2.1.1', 'docstring-parser',
           'myst-parser', 'sphinx-book-theme', 'mlflow>=1.0.0', 'ipywidgets', 'av>=10.0.0', 'ipykernel',
           'tensorboard', 'jsonargparse>=4.27.7', 'lightning>=2.2', 'comet-ml>=3.31.7', 'einops>=0.3.2',
           'wandb<=0.15.9,>=0.12.17', 'coverage', 'openvino>=2024.0', 'rich>=13.5.2',
           'timm<=1.0.3,>=0.5.4', 'onnx>=1.16.0', 'opencv-python>=4.5.3.56', 'pytest-sugar',
           'matplotlib>=3.4.3', 'pytest-cov', 'imgaug==0.4.0', 'sphinx-autodoc-typehints',
           'pytest-xdist', 'notebook', '--extra-index-url', 'https://download.pytorch.org/whl/cpu',
           'torch>=2+cpu', 'torchvision>=0.16.2']
[06/26/24 13:58:27] Invalid requirement: 'torch>=2+cpu': Local version label can only be used with `==` or `!=`
                    operators
                        torch>=2+cpu
                             ~~~^
ERROR: Invalid requirement: 'torch>=2+cpu': Local version label can only be used with `==` or `!=` operators
    torch>=2+cpu
         ~~~^