Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build broken with latest setuptools 70.0.0 #29

Closed
stweil opened this issue May 23, 2024 · 3 comments
Closed

Build broken with latest setuptools 70.0.0 #29

stweil opened this issue May 23, 2024 · 3 comments

Comments

@stweil
Copy link
Contributor

stweil commented May 23, 2024

Build fails (and breaks ocrd_all builds, too). This is the failing part:

pip3 install --no-build-isolation -f "https://dl.fbaipublicfiles.com/detectron2/wheels/$CUDA/torch1.10/index.html" "git+https://github.com/facebookresearch/[email protected]#egg=detectron2"
Looking in links: https://dl.fbaipublicfiles.com/detectron2/wheels/cu122/torch1.10/index.html
Collecting detectron2
  Cloning https://github.com/facebookresearch/detectron2 (to revision v0.6) to /tmp/pip-install-mv14g2ap/detectron2_96226a9ef17042e2b5931862b54f45cf
  Running command git clone --filter=blob:none --quiet https://github.com/facebookresearch/detectron2 /tmp/pip-install-mv14g2ap/detectron2_96226a9ef17042e2b5931862b54f45cf
  Running command git checkout -q d1e04565d3bec8719335b88be9e9b961bf3ec464
  Resolved https://github.com/facebookresearch/detectron2 to commit d1e04565d3bec8719335b88be9e9b961bf3ec464
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [9 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-mv14g2ap/detectron2_96226a9ef17042e2b5931862b54f45cf/setup.py", line 11, in <module>
          from torch.utils.cpp_extension import CUDA_HOME, CppExtension, CUDAExtension
        File "/OCR-D/venv/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 28, in <module>
          from pkg_resources import packaging  # type: ignore[attr-defined]
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      ImportError: cannot import name 'packaging' from 'pkg_resources' (/OCR-D/venv/lib/python3.11/site-packages/pkg_resources/__init__.py)
      [end of output]

The failure is due to deprecation of pkg_resources API from setuptools since version 68: https://setuptools.pypa.io/en/latest/pkg_resources.html.

@bertsky
Copy link
Owner

bertsky commented May 23, 2024

Too bad py311 already threw this long-standing practise out. But I'm afraid there's not much downstream tools can do about this.

Or what are you suggesting – that I patch pytorch?

The only way out of this mess (CUDA, ML framework API changes, Numpy and OpenCV API changes, pure Python libs getting changed, Python version) is freezing dependencies for all processors and encapsulating them as a service container (see OCR-D/ocrd_all#386 for our current state of affairs in that direction).

@stweil
Copy link
Contributor Author

stweil commented May 25, 2024

It is broken with any Python version.

@bertsky
Copy link
Owner

bertsky commented Oct 2, 2024

So I've finally decided to get rid of the wheel option for detectron2 and always install from master. That in turn allows using more recent Torch versions, which are compatible with current setuptools, numpy and whathaveyou.

@bertsky bertsky closed this as completed Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants