Michael Moreno
Michael Moreno

Reputation: 1359

Force conda install --file to ignore fails and install what it can

I have requirements.txt containing a list of packages

0x-contract-addresses
0x-contract-wrappers
0x-order-utils
aioconsole
aiohttp
aiokafka
appdirs
appnope

I run conda install --yes --file requirements.txt

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:

  - aiokafka
  - 0x-contract-addresses
  - 0x-contract-wrappers
  - 0x-order-utils
  - aioconsole

Current channels:

  - https://repo.anaconda.com/pkgs/main/osx-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-64
  - https://repo.anaconda.com/pkgs/r/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.

As you can see, it doesn't even attempt to install appdirs because of the other package installation failures, even though conda install appdirs would work.

How can I tell conda to simply ignore the failures and proceed with installing what it can? Having to try installing each of them individually is time-consuming and inconvenient.

Upvotes: 1

Views: 1726

Answers (1)

CumminUp07
CumminUp07

Reputation: 1968

So this is actually the expected behavior as Anaconda wants to maintain environment integrity, to get around this you could run something like the following:

while read requirement; do conda install --yes $requirement || pip install $requirement; done < requirements.txt

This will install the packages with conda if available and then fall back to pip if it's not available. You could modify this to your needs to build the environment you want.

Upvotes: 1

Related Questions