Get new commits from a git repo installed with pip in a conda environment when updating

Viewed 225

I am using a YAML config to install a package from BitBucket into my conda environment, a subset of the file looks like this:

# config.yaml

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

This works great. I do conda env create -f config.yaml and it creates the environment just fine.

My problem is that when I make a change to the BitBucket package ll4ma_util, I do not get those changes in my conda environment, even after doing conda env update -f config.yaml

I see this output in the terminal when I try to do the update:

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

The hash shown is in fact the latest commit, but when I try to use the code after the update it's still using the old code and doesn't reflect the changes I made to the ll4ma_util package. The only way I've been successful is to completely remove my environment with conda env remove -n ll4ma_opt and then create it new again.

Is there a way I can force an update of the BitBucket package such that if I installed the package using git and pip in the conda environment, it will pull and use any recent changes from the git repo when I run an update of my conda environment?

1 Answers

As mentioned elsewhere, to have a Pip install that respects file changes (such as repository pulls), one needs the -e flag. In the Conda YAML context, you'd want:

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