Skip to content

Commit

Permalink
TLDR-455 update installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
oksidgy committed Sep 5, 2023
1 parent b983d90 commit bcb8bca
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 15 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,20 @@ Start `dedoc` on the port `1231`:
docker-compose up --build
```

Start Dedoc with tests:
Start Dedoc with tests ([Install instruction using docker](https://dedoc.readthedocs.io/en/latest/getting_started/installation.html#install-and-run-dedoc-using-docker)):
```bash
test="true" docker-compose up --build
```

Now you can go to the `localhost:1231` and look at the docs and examples.
### Option: You can change the port of service:
you need to change environment DOCREADER_PORT
1. For local service launching on your_port (1166 example):

1. For local service launching on your_port (1166 example). [Install instruction from sources](https://dedoc.readthedocs.io/en/latest/getting_started/installation.html#install-and-run-dedoc-from-sources) and launch with environment:
```bash
export DOCREADER_PORT=1166
python dedoc/main.py -c ./dedoc/config.py
DOCREADER_PORT=1166 python dedoc/main.py -c ./dedoc/config.py
```

2. For service launching in docker-container you need to change port value in DOCREADER_PORT env and field 'ports' in docker-compose.yml file:
```yaml
...
Expand All @@ -90,7 +91,7 @@ python dedoc/main.py -c ./dedoc/config.py
## Install dedoc using pip
One can install the dedoc library via `pip`.
One can install the dedoc library via `pip` ([Install dedoc using pip](https://dedoc.readthedocs.io/en/latest/getting_started/installation.html#install-dedoc-using-pip))
To fulfil all the library requirements, you should have `torch~=1.11.0` and `torchvision~=0.12.0` installed.
You can install suitable for you versions of these libraries and install dedoc using `pip` command:

Expand Down
68 changes: 58 additions & 10 deletions docs/source/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,25 @@ Install dedoc using pip
If you don't want to use docker for running the application, it's possible to run dedoc locally.
However, it isn't suitable for any operating system (Ubuntu 20+ is recommended) and
there may be not enough machine's resources for its work.
You should have `python` (python3.8+ is recommended) and `pip` installed.
You should have `python` (python3.8, python3.9 are recommended) and `pip` installed.

.. _install_packages:

1. Install `libreoffice` and `djvulibre-bin` packages:
1. Install necessary packages:
******************************

.. code-block:: bash
sudo apt-get install -y libreoffice djvulibre-bin
sudo apt-get install -y libreoffice djvulibre-bin unzip unrar
These packages are used by converters (doc, odt to docx; xls, ods to xlsx; ppt, odp to pptx; djvu to pdf).
`libreoffice` and `djvulibre-bin` packages are used by converters (doc, odt to docx; xls, ods to xlsx; ppt, odp to pptx; djvu to pdf).
If you don't need converters, you can skip this step.
`unzip` and `unrar` packages are used in the process of extracting archives.

.. _install_tesseract:

2. Install `Tesseract OCR 5` framework.
***************************************
You can try any tutorial for this purpose or look `here <https://github.com/ispras/dedockerfiles/blob/master/dedoc_p3.9_base.Dockerfile>`_
to get the example of Tesseract installing for dedoc container or use next commands for building Tesseract OCR 5 from sources:

Expand All @@ -89,14 +94,17 @@ to get the example of Tesseract installing for dedoc container or use next comma

.. code-block:: bash
sudo add-apt-repository -y ppa:alex-p/tesseract-ocr-devel
sudo apt-get update --allow-releaseinfo-change
sudo apt-get install -y tesseract-ocr tesseract-ocr-rus
git clone --depth 1 --branch 5.0.0-beta-20210916 https://github.com/tesseract-ocr/tesseract/
cd tesseract && ./autogen.sh && sudo ./configure && sudo make && sudo make install && sudo ldconfig && cd ..
export TESSDATA_PREFIX=/usr/share/tesseract-ocr/5/tessdata/
sudo add-apt-repository -y ppa:alex-p/tesseract-ocr-devel
sudo apt-get update --allow-releaseinfo-change
sudo apt-get install -y tesseract-ocr tesseract-ocr-rus
git clone --depth 1 --branch 5.0.0-beta-20210916 https://github.com/tesseract-ocr/tesseract/
cd tesseract && ./autogen.sh && sudo ./configure && sudo make && sudo make install && sudo ldconfig && cd ..
export TESSDATA_PREFIX=/usr/share/tesseract-ocr/5/tessdata/
.. _install_library_via_pip:

3. Install the dedoc library via pip.
*************************************
To fulfil all the library requirements, you should have `torch~=1.11.0` and `torchvision~=0.12.0` installed.
You can install suitable for you versions of these libraries and install dedoc using pip command:

Expand All @@ -109,3 +117,43 @@ Or you can install dedoc with torch and torchvision included:
.. code-block:: bash
pip install "dedoc[torch]"
Install and run dedoc from sources
----------------------------------

If you want to run dedoc as a service from sources. it's possible to run dedoc locally.
However, it isn't suitable for any operating system (Ubuntu 20+ is recommended) and
there may be not enough machine's resources for its work.
You should have `python` (python3.8, python3.9 are recommended) and `pip` installed.

1. Install necessary packages: according to instructions :ref:`install_packages`

2. Build Tesseract from sources according to instructions :ref:`install_tesseract`

3. We recommend to install python's virtual environment (for example, via `virtualenvwrapper`)

Below are the instructions for installing the package `virtualenvwrapper`:

.. code-block:: bash
sudo pip3 install virtualenv virtualenvwrapper
mkdir ~/.virtualenvs
export WORKON_HOME=~/.virtualenvs
echo "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.8" >> ~/.bashrc
echo ". /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
source ~/.bashrc
mkvirtualenv dedoc_env
4. Install python's requirements and launch dedoc service on default port `1231`:

.. code-block:: bash
# clone dedoc project
git clone https://github.com/ispras/dedoc.git
cd dedoc
# check on your's python environment
workon dedoc_env
export PYTHONPATH=$PYTHONPATH:$(pwd)
pip install -r requirements.txt
pip install torch=1.11.0 torchvision==0.12.0 -f https://download.pytorch.org/whl/torch_stable.html
python dedoc/main.py -c ./dedoc/config.py

0 comments on commit bcb8bca

Please sign in to comment.