ChatGPT解决这个技术问题 Extra ChatGPT

What does conda do when "solving environment"

Whenever I run conda install/remove/update <package>, it tells me it's "Solving environment" for some time before telling me the list of things it's going to download/install/update. Presumably it's looking for dependencies for <package>, but why does it sometimes remove packages after doing this operation? For example, as I was trying to install Mayavi, it decided it needed to remove Anaconda Navigator.

Furthermore it does not provide an option to perform only a subset of the suggested operations. Is there a way to specify that I don't want a package removed?

Well, the reason that it requires removing packages is because there are dependency conflicts, and removing one package was the easiest way for conda to resolve the conflict (for whatever definition of easy the conda solver uses). This is also the reason you cannot perform a subset of the operations, because your environment might end up in an inconsistent state. I'm not sure of the specific algorithm that's used, but the code is open source: github.com/conda/conda

z
zhaofeng-shu33

You can add --debug option to the conda command and see the output from console(or terminal). For example, type conda update --debug numpy. From the output, we can see that the client requests repodata.json from channel list and do some computation locally in the Solving Environment Step.


K
Katyjean57

As a side note on the "Solving Environment" step... Lack of administrator privileges may affect whether or where you can install python packages.

I observed that my installs would hang on the "Solving Environment" step and never get through when attempting to install packages while logged in as a non-administrator.

Getting switched to admin was possible for me on the machine I was stuck on, so I just did that and it solved the problem.

Commenter explains workaround when this is not possible.


It's really not accurate. when you create environment in a a folder that doesn't need administrator privilege you don't need one in order to install python packages and for nothing else for that matter. You can of course create one very easily - I would edit the answer
thanks. I wasn't aware of this. I was trying to figure out how to get around that issue at work where I can't just make myself the admin. and you're saying I can get around that so that's good news!!! I simply posted this because when I had my issue, my search for help led me here and I didn't find it.
S
Stuart Rucker

JUST WAIT! I wasted hours trying to fix this. It turns out, it just took around 45 minutes :/


S
Suraj Rao

conda install --prune <<package>> helped me to install the right channel.

Suspecting environment used are for zipline and channel used not compatible with existing one. prune takes a lot of time but helped me in solving the environment issues.