5

A few days ago I started having problems in my Windows 10 machine with installing packages with conda. It was giving me an error message UserWarning: zstandard could not be imported. Running without .conda support.

I did some Googling and tried to reinstall Anaconda. I could not do anaconda--clean because it would not install for me because of the conda issues. But, I used the uninstall program and then deleted the .conda, etc. folders -- everything I could find. I re-installed. Same issue. I then uninstalled again and reinstalled, this time choosing the "add to path" option. It seemed to work while I loaded a few packages, but when I created a new environment and activated it, Jupyter notebook could not recognize the packages. Then it started giving me the error messages in conda again:

conda list
C:\Users\USERNAME\anaconda3\lib\site-packages\conda_package_streaming\package_streaming.py:19: warnings.warn("zstandard could not be imported. Running without .conda support.")

C:\Users\USERNAME\anaconda3\lib\site-packages\conda_package_handling\api.py:29: 
UserWarning: Install zstandard Python bindings for .conda support  _warnings.warn("Install zstandard Python bindings for .conda support")

I have used Anaconda for a half dozen years and this is the first major problem I've had with it. I've spent about 8 hours so far trying to figure this out and am going a bit nuts so I would really appreciate any suggestions. I have looked at this question and tried the second solution but it didn't work. There does not appear to be a lot on Google so this might be rare.

Thanks!

Gregory Saxton
  • 1,241
  • 4
  • 13
  • 29
  • "*an error message: UserWarning*" please don't equate *warning* with *error*. You probably just need to upgrade `conda` to a newer version that uses the `conda-package-handling` package. It will handle the correct dependency libraries - non-advanced users should not be adjusting those manually. If you've borked the **base** environment, Micromamba can be used to recover, as detailed [in this answer](https://stackoverflow.com/a/54563455/570918). – merv May 22 '23 at 19:07
  • 1
    Thank you. I don't quite understand your suggestion but I can say that this is now also happening with a fresh install of Anaconda so the conda I'm using SHOULD be a newer version. – Gregory Saxton May 24 '23 at 03:16
  • Any chance you have packages installed in [user site](https://stackoverflow.com/a/46071447/570918)? It's possible they could interfere with expected function by loading incompatible versions. (Conda users are generally discouraged from installing to user site.) – merv May 24 '23 at 17:59
  • This [https://stackoverflow.com/questions/75954582/conda-error-zstandard-could-not-be-imported](stackoverflow question) might be relevant to your question. – Kolyan1 May 25 '23 at 08:22
  • @Kolyan1 thanks but that is the question I linked to above. Didn’t work. – Gregory Saxton May 25 '23 at 18:20
  • @Kolyan1 I tried the first answer in that answer a second time and this time it looked like it worked? Thanks for that. I am not sure how I can award the bounty to you but that seems to be the answer here. Much appreciated. – Gregory Saxton May 26 '23 at 03:25

2 Answers2

2

Run:

conda install -n base --force-reinstall zstandard
conda install -n base --force-reinstall conda-package-handling
conda install -n base --force-reinstall conda-package-streaming

The warning itself shouldn't preclude you from installing packages as far as I know though. If my suggestion doesn't help, could you provide some additional info?

  • when did the issues start? Did you upgrade some package?
  • how you're installing packages? conda, pip?
  • how are you creating virtual environments? (conda, venv)
merv
  • 67,214
  • 13
  • 180
  • 245
ini
  • 175
  • 9
  • Thanks but this didn't work. I can't say what exactly caused the issue but I had been using Anaconda python and conda for a few years on this Windows 10 machine without issue. I got the warning message and so tried some fixes and then deleted & reinstalled Anaconda twice. The issue is still there. I use conda for as much as I can and then pip when needed. I don't use environments as much as I should but I did try it with this new install and even after activating the environment my Python scripts wouldn't work unless I added the packages to the base environment (I know that's not recommended). – Gregory Saxton May 24 '23 at 03:37
  • For me, this is specifically related to `conda-package-handling` and the use of the `conda-libmamba` solver. Only the following line was required: `conda install -n base --force-reinstall conda-package-handling --solver=classic`. This changes the version from 2.1.0 to 1.9.0 which fixes things on my end. – jpmorr Jul 14 '23 at 09:54
1

I think this is a recent bug in conda. I am facing this problem myself. I finished reinstalling and it worked but few updates in and it all breaks again with the same error. The error seems to arise from the libarchive and libgcc_mutex libraries. What I noticed was that, each time a library asks conda to update libgcc_mutex and switch channels to conda-forge, it causes some kind of dependency conflict and then the environment just breaks. Using force-reinstalled broke conda and it stopped working in all for me.

Update: The warning went away after I ran the following code.

conda update _libgcc_mutex zstandard zstd -c defaults

It indeed seems to be an issue with the libgcc_mutex from conda-forge I think.

  • @gregory-saxton can you try in a clean install by updating a package (pandas maybe) using conda that modifies stuff related to libgcc_mutex. Can you check if the warning comes up? (I don't have enough reputation to comment on your original post but will update my answer after experimenting more and finding a solution.) – Raghavendra N.V Jul 05 '23 at 07:19