Search code examples
pythonimage-processingjupyter-notebookanacondakraken-image-optimizer

Unable to install kraken (image optimizer)


I want to install kraken in my anaconda. So I followed this command got from PyPI -

pip install kraken

But I end up with an error and that is -

Collecting kraken
Using cached kraken-2.0.8-py3-none-any.whl (643 kB)
Collecting python-bidi
  Downloading python_bidi-0.4.2-py2.py3-none-any.whl (30 kB)
Collecting protobuf>=3.0.0
  Downloading protobuf-3.12.2-cp37-cp37m-win_amd64.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 30 kB/s
ERROR: Could not find a version that satisfies the requirement torch>=1.0.0 (from kraken) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch>=1.0.0 (from kraken)

I,ve also tried the instruction from anaconda -

conda install -c bioconda kraken

But this time I've got -

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

    - kraken

Current channels:

    - https://conda.anaconda.org/bioconda/win-64
    - https://conda.anaconda.org/bioconda/noarch
    - https://repo.anaconda.com/pkgs/main/win-64
    - https://repo.anaconda.com/pkgs/main/noarch
    - https://repo.anaconda.com/pkgs/r/win-64
    - https://repo.anaconda.com/pkgs/r/noarch
    - https://repo.anaconda.com/pkgs/msys2/win-64
    - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

All these command I've eneterd is in Anaconda Prompt. So please help me through on how can I install kraken. TIA.


Solution

  • The GitHub repository has instructions for installing through Conda. It shows creating a new env, which generally is good practice.

    Non-CUDA Version

    $ wget https://raw.githubusercontent.com/mittagessen/kraken/master/environment.yml
    $ conda env create -f environment.yml
    

    CUDA Version

    $ wget https://raw.githubusercontent.com/mittagessen/kraken/master/environment_cuda.yml
    $ conda env create -f environment_cuda.yml
    

    Note the --name flag can be used to specify an env name other than their default (kraken).

    Install in Existing Environment

    Technically, one can also use a YAML to install into an existing env. However, since it involves a pip-based installation, it is not recommended to install this to the base env (see Using Pip in a Conda Environment).

    conda env update -n my_env -f environment.yml