我正在使用 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
显示的散列实际上是最新的提交,但是当我在更新后尝试使用代码时,它仍在使用旧代码并且没有反射(reflect)我对 ll4ma_util
包所做的更改.我成功的唯一方法是使用 conda env remove -n ll4ma_opt
完全删除我的环境,然后重新创建它。
有没有一种方法可以强制更新 BitBucket 包,这样如果我在 conda 环境中使用 git
和 pip
安装包,它将拉取并当我运行我的 conda 环境的更新时,是否使用 git 存储库中的任何最新更改?
最佳答案
作为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
关于python - 更新时从在 conda 环境中使用 pip 安装的 git repo 获取新提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70352727/