2

I have a conda environment file that I use to create a new environment:

conda env create -f environment.yml

This installs all of my conda and pip packages. One of my pip packages, turicreate, installs mxnet as a dependency. This is a problem because the correct package for my application is mxnet-cu80, and the existence of mxnet breaks the application. I can uninstall mxnet manually, but I would rather force the above command to only install the listed packages (without dependencies). Is this possible?

The --no-deps flag only applies to conda create, not conda env create.

Dallan
  • 504
  • 4
  • 13
  • How does `turicreate` resolve the difference in dependencies? Why not just list your actual dependency in the `environment.yml` file? – darthbith Jul 08 '19 at 19:58
  • @darthbith `turicreate` requires `mxnet`, but `mxnet-cu80` can replace it for using GPUs. [The github](https://github.com/apple/turicreate/blob/master/LinuxGPU.md) explains this a little more. I do specify `mxnet-cu80==1.1.0` in `environment.yml` but the installation of `turicreate` erroneously installs `mxnet` as well, which needs to be removed or prevented from installing. – Dallan Jul 08 '19 at 20:51
  • That seems like a bug in `turicreate`, to be honest. They could consider using [`extras_require`](https://stackoverflow.com/a/45043494/2449192) to differentiate between normal and GPU requirements. Technically, to resolve this on the conda side you'd need to pass any options through to `pip` when it runs the installation commands. You're probably better off separately installing `turicreate` rather than specifying it in the `environment.yml` file, since it seems like this will take two steps anyways. – darthbith Jul 08 '19 at 21:02

1 Answers1

0

I don't know if it's possible, but it is certainly not a good idea. You don't know how many other dependencies might be missing in the new environment, which can create much bigger problems than you have now.

Mixing packages from conda and pip is always a potential problem. If you do that, conda calls pip, but pip doesn't know how to satisfy missing dependencies with packages from Anaconda repositories.

I recommend that you split your package list into an environment.yml for conda, and a requirements.txt for pip. Add mxnet-cu80, and any other dependencies you'd rather have from conda, to the environment.yml. Create the environment with only the conda packages, then install the remaining packages with pip in a second step.

Roland Weber
  • 3,395
  • 12
  • 26
  • Does the split need to be done by hand or there is a useful command for that? – AleB Jan 15 '20 at 09:35
  • @AleB since pip is not aware of Conda, nor conda of pip installed dependencies, it is best created by hand. Still, this is only secondary solution. If you use conda, try to stick to `conda install` as much as possible – Ciprian Tomoiagă May 18 '20 at 19:55