pip: have_directory_for_build AssertionError when installing with --no-cache-dir (19.0.1)

  • pip version: 19.0.1

With the 19.0.1 release, some people are still reporting an AssertionError when installing with --no-cache-dir similar to the one in #6158. This issue is for the 19.0.1-specific issue as it is narrower in scope.

Here are details for a couple reports: https://github.com/pypa/pip/issues/6158#issuecomment-456882072 and https://github.com/pypa/pip/issues/6158#issuecomment-456949839

The traceback looks like this:

Exception:
Traceback (most recent call last):
  File "/mnt/jenkins/workspace/venv/local/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 176, in main
    status = self.run(options, args)
  File "/mnt/jenkins/workspace/venv/local/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 346, in run
    session=session, autobuilding=True
  File "/mnt/jenkins/workspace/venv/local/lib/python2.7/site-packages/pip/_internal/wheel.py", line 886, in build
    assert have_directory_for_build
AssertionError

Some work-arounds (feel free to add to the list):

  • Use pip version 18.1.
  • Pass --no-use-pep517 in your invocation.
  • See issue #6158 for some other possibilities.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 26
  • Comments: 18 (10 by maintainers)

Commits related to this issue

Most upvoted comments

pip 19.0.2 has been released with a fix for this.

Easily reproducable in docker:

# Same for 3.5.6, 3.6.8, etc.
FROM python:3.7.2-alpine

RUN pip3 install -U pip

RUN pip3 install --no-cache-dir pendulum

@cjerdonek figured out a nice fix for this in #6219 and that’s now merged. I’ll make a 19.0.2 in the coming week, with that fix and more.

I’ll go ahead and close this issue. I’ll ping here when the release is made.

Same but Python 3.7

Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 176, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 346, in run
    session=session, autobuilding=True
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/wheel.py", line 886, in build
    assert have_directory_for_build
AssertionError

Reverting to pip 18.1 worked for me.

@pradyunsg May be worth pinning this one as well, as I ran into it while trying to test the PRs for #6163 (see https://github.com/pypa/pip/pull/6212#issuecomment-458166386)

Using --no-use-pep517 didn’t work for me, downgrading to 18.1 did (using FROM python:3.6-alpine)

Could you provide us a reproducing case for this issue?

@pfmoore I ran into this myself, basically just passing --no-cache breaks pip when discovering and installing a PEP-517 package. We need either to fallback to disable PEP-517 build, or instead use the TMPDIR env var.

Hitting this from jython that does not support pip cache mechanism inside virtualenv.