[Fixed] conda error: zstandard could not be imported – Conda

Ali Hasan
anaconda llama-cpp-python

Quick Fix: Try upgrading and reinstalling zstandard and zstd using pip with the --upgrade and --force-reinstall flags. This should resolve the error and allow you to import zstandard successfully.

The Problem:

The user is encountering a warning message while using Conda on Ubuntu 18.04. The error message indicates that the zstandard library could not be imported and suggests installing its Python bindings. Despite installing zstandard using both pip and conda, the error persists when attempting to collect package metadata using Conda. The installed versions of zstandard are listed as 0.19.0 from conda-forge and from PyPI, but the issue remains unresolved.

The Solutions:

Solution 1: Force reinstall packages

The conda error could be resolved by force reinstalling the packages zstandard and zstd using pip, as follows:

pip install --upgrade --force-reinstall zstandard
pip install --upgrade --force-reinstall zstd

This action reinstalls the packages and ensures that the latest versions are installed. If the default channels do not provide the latest versions, consider adding additional channels to the .condarc file.

Solution 2: Update zstandard via pip

In your case, you installed zstandard using both pip and conda, which might cause conflicts. To resolve this, try updating zstandard using pip only.

Follow these steps:

  1. Check the latest version of zstandard on PyPI using pip show zstandard.
  2. Install the latest version using pip install zstandard==<latest_version>.

Solution 3: Import zstandard in conda files

To resolve the “zstandard could not be imported” error, import zstandard in the following Python files:
This will enable conda support and eliminate the error message.

Video Explanation:

The following video, titled "python environment setup on Apple Silicon | M1, M1 Pro/Max with ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

... conda NativeScript training courses — https ... Your browser can't play this video. Learn more.