setuptools: find_on_path distribution finder can cause "maximum recursion depth exceeded in comparison"

A few days ago someone filed an issue on pip’s tracker that looks like a setuptools issue: https://github.com/pypa/pip/issues/6288

Basically, it looks like the issue is that find_on_path() (the “distribution finder” corresponding to pkgutil.ImpImporter and FileFinder) can get into a situation where it’s calling itself in an (infinite) recursive loop. Also, I believe this is happening in the find_on_path(only=False) case, rather than only=True.

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

I ran into this problem today and found a solution for my case. My setup is probably different than the OP, but the errors appear to be the same.

I had a docker container w/ the following,

RUN cd /usr/local/lib/python3.7/dist-packages && python /src/setup.py develop

Purpose was so that the .egg-link doesn’t live under /src and I can mount a src volume. Not doing this would overwrite the .egg-link when mounting.

Then, once in the container, trying to run any pip install ... returns the find_path() recursion failure. The problem was that I was using dist-packages, should have been site-packages (the latter of which didn’t initially exist in the container). Here’s what fixed the problem,

ENV PYTHONPATH=/src
COPY . /src
RUN cd /usr/local/lib/python3.7 && \
    mkdir site-packages && \
    cd site-packages && \
    python /src/setup.py develop
WORKDIR /src