问题
I currently use Conda to capture my dependencies for a python project in a environment.yml
.
When I build a docker service from the project I need to reinstall these dependencies. I would like to get around, having to add (mini-)conda to my docker image.
Is it possible to parse environment.yml
with pip/pipenv or transform this into a corresponding requirements.txt
?
(I don't want to leave conda just yet, as this is what MLflow captures, when I log models)
回答1:
Nope.
conda
automatically installs dependencies of conda packages. These are resolved differently bypip
, so you'd have to resolve the Anaconda dependency tree in your transformation script.Many
conda
packages are non-Python. You couldn't install those dependencies withpip
at all.Some
conda
packages contain binaries that were compiled with the Anaconda compiler toolchain. Even if the correspondingpip
package can compile such binaries on installation, it wouldn't be using the Anaconda toolchain. What you'd get would be fundamentally different from the correspondingconda
package.Some
conda
packages have fixes applied, which are missing from correspondingpip
packages.
I hope this is enough to convince you that your idea won't fly.
Installing Miniconda isn't really a big deal. Just do it :-)
来源:https://stackoverflow.com/questions/56700687/installing-dependencies-from-conda-environment-yml-without-conda