Layout-Parser / layout-parser

A Unified Toolkit for Deep Learning Based Document Image Analysis
https://layout-parser.github.io/
Apache License 2.0
4.64k stars 449 forks source link

LayoutParser Installation Video #199

Open PatrickGold555 opened 8 months ago

PatrickGold555 commented 8 months ago

After reading the issues board it seems like a lot of people are facing similar issues.

I have personally watched videos the LP team have posted on Youtube many times, but it seems like there is underlying configs / package installations that are not displayed or pointed out in the videos. from the issues board a lot of the issues seems to revolve around the detectron2 package.

I believe this project has real potential and a step by step installation video on different OS will be helpful, maybe even a community based instruction video set if others have managed to get this working locally and not in GoogleColab.

I have tried Ubuntu 22.04 as a system installation, but have resorted to using Ubuntu-22.04 within a WSL2 environment on windows, because i can quickly delete my WSL instance and start from scratch.

I Have created a list of packages i install on a fresh Ubuntu instance to try and LayoutParser installed, however i have the same issues others do (Detectron2) i hope my list can help others that are facing similar issues.

sudo apt-get update sudo apt-get upgrade -y sudo apt update sudo apt install python3.10-venv -y sudo apt install software-properties-common sudo apt install build-essential -y sudo apt-get install manpages-dev sudo add-apt-repository ppa:deadsnakes/ppa sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev -y sudo apt install python3.9 -y sudo apt install python3.9-venv -y sudo apt-get purge build sudo apt-get update sudo apt install poppler-utils sudo apt-get install libpoppler-dev -y

wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600 wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb sudo dpkg -i cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb sudo cp /var/cuda-repo-wsl-ubuntu-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/ sudo apt-get update sudo apt-get -y install cuda

Paste the following 2 lines at the bottom of your bashrc. file in your home directory Then restart your machine and type [nvcc --version] to check if it correctly displays the Cuda drivers (NO NOT RELY ON nvidia-smi command for cuda version) If using a different CUDA version please change the CUDA version in the below 2 lines

export PATH=/usr/local/cuda-11.8/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

python3.9 -m venv lp

cd lp source bin/activate

pip install --upgrade pip pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 pip install gcc7 pip install python-poppler pip install compiletools pip install jupyter pip install numpy pip install matplotlib pip install spacy pip install pandas pip install wheel pip install cython pip install ninja pip install poppler pip install pycocotools pip install funcy pip install bs4 pip install scikit-learn pip install imagesize pip install tqdm pip install tensorboard pip install setuptools pip install opencv-python pip install layoutparser pip install "layoutparser[effdet]" pip install "layoutparser[paddledetection]" pip install "layoutparser[ocr]"

git clone https://github.com/facebookresearch/detectron2.git python -m pip install -e detectron2