The LayoutLM Installation Fails
I want to installLayoutLMinGoogle ColaboratoryFirst, I have cloned theLayoutLMfrom thisGitHubrepositoryGitHubGitHub - microsoft/unilm: Large-scale Self-supervised Pre-training Across...Large-scale Self-supervised Pre-training Across Tasks, Languages, and Modalities - GitHub - microsoft/unilm: Large-scale Self-supervised Pre-training Across Tasks, Languages, and ModalitiesAfter that, I will install theLayoutLMby running itssetup.pyfile by running this code block:%%bash
cd /content/drive/MyDrive/LayoutLMMM/SROIE2019-20210928T080219Z-001/SROIE2019
# git clone https://github.com/microsoft/unilm.git
cd unilm/layoutlm/deprecated
pip install .However, when i tried to run the script, an error occursSuccessfully built layoutlm sacremoses
Failed to build tokenizers
  error: subprocess-exited-with-error
  
  × Building wheel for tokenizers (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tokenizers
ERROR: Could not build wheels for tokenizers, which is required to install pyproject.toml-based projectsAs I locate what library is causing the error, I found out that thetokenizerslibrary in thetransformersofHuggingFaceis returning this error.I have tried modifying thesetupfile by omitting thetransformerslibrary and modified the setup script of transformers to install the latest version oftokenizerto check if it can fix the error. Yes, this method works however, the results are not accurate.How can I install the LayoutLM without thebuilding wheel for tokenizers did not run successfullyerror?
2023-08-16T11:32:50Z
u got any solution for that?
2023-08-17T06:02:47Z
The problem in here is that theversionof thetokenizerslibrary is not supported in the latest version ofpython. Therefore inGoogle Colaboratory, I changed the python version with the command:# Download and Install Py 3.7
!sudo apt-get install python3.7.
!sudo apt-get update -y# Update the python version in Colab
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
! echo "2" | sudo update-alternatives --config python3   # Change the '2' with the number with the Python 3.7# Install the pip
!sudo apt install python3-pipTry this if there is a problem in the distutils:# Install distutils
!sudo apt install python3.7-distutilsThen you can try installing theLayoutLMwith the bash command:%%bash

...

pip install .NOT RECOMMENDEDAnother workaround that I did was omit the tokenizers library in the setup file of the LayoutLM library and install the latest version of tokenizers separately using the command:!pip install tokenizers