Is there a way to use pip as a 'fallback' option for some packages in a conda environment, like you can have multiple prioritized conda channels?
For normal conda channels, my environment.yml would be as follows:
name: my_env
channels:
- defaults
- conda-forge
dependencies:
- some-package>=1.2.3
Where some-package
would be installed from default channels if possible, or conda-forge otherwise. It would fail if neither channel has the appropriate package version.
The environment.yml with pip:
name: my_env
channels:
- defaults
- conda-forge
dependencies:
- pip
- pip:
- some-package>=1.2.3
Where some-package
would always come from pip.
But what I want is something like this:
name: my_env
channels:
- defaults
- conda-forge
dependencies:
- some-package>=1.2.3
- pip
- pip:
- some-package>=1.2.3
Where the package would come from defaults first, else conda-forge, or else from pip.
However, this gives a ResolvePackageNotFound error before trying pip. Is there any way to achieve this?
I've read somewhere that conda shall be extended to allow satisfying dependencies with pip-installed packages. But I cannot find the reference with a quick search, and I don't think it's a production-ready feature anyway. And what I remember was not conda installing pip packages, but conda accepting already present packages that have been installed by pip.
Anaconda packages define their dependencies in terms of other Anaconda packages. Therefore, conda
resolves dependencies of Anaconda packages within its own world of packages and metadata. Some packages don't even have the same name in Anaconda channels and on PyPI.
In other words: No, I don't think that what you want is possible. You'll have to call pip
when you want something installed by pip
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.