An old man in the sea.
An old man in the sea.

Reputation: 1528

Installing Keras: Solving environment - failed

I'm trying to install Keras with anaconda, and on https://anaconda.org/conda-forge/keras , it's stated that I should run conda install -c conda-forge keras.

Below is the output I got:

C:\pathname>conda install -c conda-forge keras
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

And then I just interrupted the process.

Why is this happening?

Upvotes: 0

Views: 3372

Answers (1)

merv
merv

Reputation: 77098

There are a couple things going on here that make it extra hard for Conda to install this package:

  1. Anaconda base env is huge and often requires reconfiguring packages in order to add new ones. This makes it take really long. Rather than trying to cram everything into base it is usually much less of a hassle to create new environments for each project or task.

    conda create -n keras_env -c conda-forge keras
    
  2. Mixing channels is generally not recommended (Conda Forge and Anaconda use different build stacks). Moreover, because Conda can't satisfy the request with a frozen install (i.e., it has to change some versions of existing packages), it opens up many of your packages be reprioritized to the Conda Forge channel, not just Keras. Instead, either:

    a. If you really want keras in your base env, then get it from the defaults channel:

    conda install -n base keras
    

    b. Otherwise, if you really want to use Conda Forge's keras build and still want all the other Anaconda packages, then create a new env plus anaconda, similar to 1:

    conda create -n keras_env -c conda-forge anaconda keras
    

Note that if you plan to use mostly Conda Forge, you'd be much better off dumping Anaconda in favor of a Miniforge install.

Upvotes: 2

Related Questions