Skip to content

Commit b8be2e2

Browse files
authored
chore: remove detectron from setup.py (#6)
Having a non-pip dependency prevents unstructured-inference from being installed as a package from pypi, so this PR removes detectron2 from the setup.py dependencies. Also removed the code to fail the install if torch isn't installed - torch will be installed with layoutparser, and will be present when the user builds Detectron2 from source.
1 parent 605c1f2 commit b8be2e2

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.2.1-dev1
1+
## 0.2.1
22

33
* Refactor to facilitate local inference
44
* Removes BasicConfig from logger configuration

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,26 @@ These models are invoked via API as part of the partitioning bricks in the `unst
1717

1818
### Package
1919

20-
Requires [`torch>=1.8`](https://pytorch.org/get-started/locally/). Once this is satisfied, run
21-
`pip install unstructured-inference`.
20+
Run `pip install unstructured-inference`.
21+
22+
### Detectron2
23+
24+
[Detectron2](https://github.com/facebookresearch/detectron2) is required for most inference tasks
25+
but is not automatically installed with this package.
26+
For MacOS and Linux, build from source with:
27+
```shell
28+
pip install 'git+https://github.com/facebookresearch/[email protected]#egg=detectron2'
29+
```
30+
Other install options can be found in the
31+
[Detectron2 installation guide](https://detectron2.readthedocs.io/en/latest/tutorials/install.html).
32+
33+
Windows is not officially supported by Detectron2, but some users are able to install it anyway.
34+
See discussion [here](https://layout-parser.github.io/tutorials/installation#for-windows-users) for
35+
tips on installing Detectron2 on Windows.
2236

2337
### Repository
2438

25-
Clone the repo and run `make install` to install dependencies.
39+
To install the repository for development, clone the repo and run `make install` to install dependencies.
2640
Run `make help` for a full list of install options.
2741

2842
## Getting Started

setup.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@
2121

2222
from unstructured_inference.__version__ import __version__
2323

24-
try:
25-
import torch
26-
27-
torch_ver = [int(x) for x in torch.__version__.split(".")[:2]]
28-
assert torch_ver >= [1, 8]
29-
except (ImportError, AssertionError) as e:
30-
raise Exception("Requires PyTorch >= 1.8") from e
31-
3224
setup(
3325
name="unstructured_inference",
3426
description="A library for performing inference using trained models.",
@@ -57,7 +49,6 @@
5749
entry_points={},
5850
install_requires=[
5951
"fastapi",
60-
"detectron2@git+https://github.com/facebookresearch/[email protected]#egg=detectron2",
6152
"layoutparser[layoutmodels,tesseract]",
6253
"python-multipart",
6354
"uvicorn",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.1-dev1" # pragma: no cover
1+
__version__ = "0.2.1" # pragma: no cover

0 commit comments

Comments
 (0)