如何将预构建 python 包手动安装到 conda 环境中

how to manually install the pre-build python package into conda environment

需要通过 conda 安装 Azure cosmos-db python sdk。但是我最多只能安装3.1.2版本,项目中需要4.2.0。我想知道如何手动将预构建的 cosmo sdk 加载到 conda 环境中?

我有一个 env.yml 文件,如下所示,环境是通过 conda env create -f <path_to_env.yml>

创建的
name: cco_1410
channels:
  - conda-forge
dependencies:  
  - azure-cosmos=4.2.0 (this would lead to fail)
  - python=3
  - fastapi=0.65.0
  - pytest

无法通过 conda 安装 4.2.0 版本。 Conda 最多只能安装 3.1.2 版本

 conda search azure-cosmos

returns

/opt/miniconda3/lib/python3.9/site-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.2) or chardet (4.0.0) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Loading channels: done
# Name                       Version           Build  Channel
azure-cosmos                   3.0.2            py_0  conda-forge
azure-cosmos                   3.1.0            py_0  conda-forge
azure-cosmos                   3.1.1            py_0  conda-forge
azure-cosmos                   3.1.2            py_0  conda-forge
azure-cosmos                   3.1.2            py_0  pkgs/main

代替某人 fixing the Conda Forge feedstock 以便在 Conda 上可以使用较新的版本,它是一个 PyPI 包,因此也可以通过 Pip 安装它:

name: cco_1410
channels:
  - conda-forge
dependencies:  
  - python=3
  - fastapi=0.65.0
  - pytest
  - pip
  - pip:
    - azure-cosmos==4.2.0

请阅读the Conda documentation on installing non-Conda packages

Microsoft 在 Microsoft 频道 (https://anaconda.org/microsoft) 中每三个月发布一次适用于 conda 的 Azure SDK 包。

9 月版本中包含 azure-cosmos 4.2.0。

你可以从https://anaconda.org/microsoft/azure-cosmos找到它。

(我在 SDK 团队从事 MS 工作)