Inconsistent caching behaviour

Hi All!

I’m experiencing inconsistent behavour when doing pip install over restored venv. Pip install has some version conflict warning (another issue), which passes and gets things installed first time. But when rebuild happens and venv is restored from the cache, pip fails hard with version inconsistencies. The weird part is that if I rebuild with ssh enabled and then execute the same pip install commands in the container, everything is fine.

Any ideas?

      - image: circleci/python:3.6.5
      - checkout
      - restore_cache:
          - v3-dependencies-{{ checksum "requirements.txt" }}-{{ checksum ""}}
      - run:
          name: Install dependencies
          command: |
            virtualenv venv --python=python3.6
            . venv/bin/activate
            pip install -r requirements.txt --extra-index-url https://xxxx --trusted-host xxxx
      - save_cache:
            - ./venv
          key: v3-dependencies-{{ checksum "requirements.txt" }}-{{ checksum ""}}
      - run:
          name: run tests
          command: |
            . venv/bin/activate

When you rebuild, are you doing so without cache? If so, it’s quite possible that the cache is causing this, and incrementing the cache key would be a fix (v3 to v4).

I rebuild with cache. Bumping cache version helps, because install succeedes when there is no cache found. But when a cache is found, it fails.

Could you post a link to a build where you’re building without cache, and one where you’re building with cache? Only CircleCI employees will be able to see the builds, unless they’re open source.

He is the build where cache is not found (success):
Here is the rebuild of the same one and it found cache from the previous run:

It looks like the venv is succeeding, and the pip command is failing. I’m not exactly sure why that is though. I’ll look at this further.

Exactly. Because the same pip command is OK the first time. Moreover, if you rerun with ssh, login there and try executing pip from shell, it runs with no problem.
We fixed this build by fixing pip warnings, but I’m just curious about this behaviour. It might suggest some CircleCI bug.

Glad to hear you fixed it at least – I’ll look into this further after the weekend.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.