【问题标题】:Get new commits from a git repo installed with pip in a conda environment when updating更新时从在 conda 环境中使用 pip 安装的 git repo 获取新提交
【发布时间】:2022-01-17 23:48:36
【问题描述】:

我正在使用 YAML 配置将来自 BitBucket 的包安装到我的 conda 环境中,文件的子集如下所示:

# config.yaml

name: ll4ma_opt
channels:
- defaults
- conda-forge
dependencies:
- pip
- pip:
  - git+https://bitbucket.org/robot-learning/ll4ma_util.git

这很好用。我做conda env create -f config.yaml,它创造的环境很好。

我的问题是,当我对 BitBucket 包 ll4ma_util 进行更改时,即使在执行 conda env update -f config.yaml 之后,我也没有在我的 conda 环境中得到这些更改

当我尝试进行更新时,我在终端中看到了这个输出:

Pip subprocess output:
Collecting git+https://bitbucket.org/robot-learning/ll4ma_util.git (from -r /home/adam/ll4ma-opt-sandbox/conda/condaenv.65mn0x4h.requirements.txt (line 3))
  Cloning https://bitbucket.org/robot-learning/ll4ma_util.git to /tmp/pip-req-build-5qdqlgww
  Resolved https://bitbucket.org/robot-learning/ll4ma_util.git to commit 9673a4ff2025356a4eff72b0ee44e7f02d76b414

显示的哈希实际上是最新的提交,但是当我在更新后尝试使用代码时,它仍在使用旧代码,并且不反映我对 ll4ma_util 包所做的更改。我成功的唯一方法是使用 conda env remove -n ll4ma_opt 完全删除我的环境,然后重新创建它。

有没有一种方法可以强制更新 BitBucket 包,这样如果我在 conda 环境中使用 gitpip 安装了该包,当我使用 git 存储库中的任何最新更改时,它会提取并使用它更新我的 conda 环境?

【问题讨论】:

  • @merv 你说得对,这是我遗漏的关键,使用 -e 标志它创建了一个本地版本来提取更改。如果你回答我可以标记为接受

标签: python pip conda


【解决方案1】:

作为mentioned elsewhere,要进行尊重文件更改(例如存储库拉取)的 Pip 安装,需要-e 标志。在 Conda YAML 上下文中,您需要:

name: ll4ma_opt
channels:
  - defaults
  - conda-forge
dependencies:
  - pip
  - pip:
    - -e git+https://bitbucket.org/robot-learning/ll4ma_util.git

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-16
    • 1970-01-01
    • 2020-12-02
    • 2022-08-03
    • 1970-01-01
    • 2020-07-17
    • 2018-03-14
    相关资源
    最近更新 更多