Layout-Parser / layout-parser

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

Cannot run the model on Windows. #15

Open phuynhh opened 3 years ago

phuynhh commented 3 years ago

Hi, Thank you very much for your brilliant work. I've just passed the first step to install the package on my Windows 10. However, I am currently stuck with the second step to run the model. Would you have any hints to solve this error? Please check out the attached files below if you have a moment. Thank you very much.

Screenshot (8) Screenshot (9)_LI

maxml7331 commented 3 years ago

Push! Have exact the same error. Help would be greatly appreciated

lolipopshock commented 3 years ago

Hmmm very interesting. Looking into it.

maxml7331 commented 3 years ago

Hmmm very interesting. Looking into it.

Hey loliposhock! Thanks for the great work and your help is much appreciated. Could you tell me on which system setup (python version, windows/linux etc pp.) the package is working for you? I am not able to get the lp.detrectron running (no matter which different version etc I install that were mentioned by other people here in the threads). Thanks a lot!

CrisChir commented 3 years ago

Detectron2 on windows is not supported:

  1. Can I install detectron2 on Win10? see https://github.com/facebookresearch/detectron2/issues/9 We do not officially support windows, but given that maskrcnn-benchmark can run on win10, it probably won't take a lot of changes to run detectron2 on win10.

More details on the link

  1. There is conansherry implemtentation: https://github.com/conansherry/detectron2

  2. https://ivanpp.cc/detectron2-walkthrough-windows/

  3. There are some reports that in version 0.3 It can be simply installed it with conda. but user report issues see the thread at point 1.

fcakyon commented 3 years ago

Have you considered using mmdetection that relies on mmcv and mmpycocotools, instead of detectron2?

All models in detectron2 + tens of sota pretrained models are present in mmdetection model zoo.

Moreover, they support both windows and linux. They can be directly installed by pip install mmdet in all platforms.

lolipopshock commented 3 years ago

Have you considered using mmdetection that relies on mmcv and mmpycocotools, instead of detectron2?

All models in detectron2 + tens of sota pretrained models are present in mmdetection model zoo.

Moreover, they support both windows and linux. They can be directly installed by pip install mmdet in all platforms.

Yes! It's actually on the roadmap, see https://github.com/Layout-Parser/layout-parser/blob/master/.github/CONTRIBUTING.md . And MMOCR is more relevant: https://github.com/open-mmlab/mmocr .

fcakyon commented 3 years ago

Have you considered using mmdetection that relies on mmcv and mmpycocotools, instead of detectron2? All models in detectron2 + tens of sota pretrained models are present in mmdetection model zoo. Moreover, they support both windows and linux. They can be directly installed by pip install mmdet in all platforms.

Yes! It's actually on the roadmap, see https://github.com/Layout-Parser/layout-parser/blob/master/.github/CONTRIBUTING.md . And MMOCR is more relevant: https://github.com/open-mmlab/mmocr .

Good to hear that. Thanks for providing the roadmap!

kenho211 commented 3 years ago

Have the same error, but the cache dir is iopath_cache instead of fvcore_cache Capture

simonschoe commented 3 years ago

push, same here (Win10 user)

peter-malik commented 3 years ago

A fix for this is to clone and modify iopath, since its a Windows10 file naming error. So clone iopath (this version worked for me) git clone https://github.com/facebookresearch/iopath --single-branch --branch v0.1.8

Change iopath/iopath/common/file_io.py; class: HTTPURLHandler; method: _get_local_path line 753 (line number might change with newer versions)

Then call: pip install -e iopath And it will work.

Also detectron2v0.4 didnt work. Installed the latest one via: python -m pip install "git+https://github.com/facebookresearch/detectron2.git"

The detectron2 installation will overwrite your modified iopath version because of dependency conflict, so its best to install iopath last. But it should work ok.

Update: It should also work with iopath v0.1.7, but i mentioned the newer one because it is in their GitHub tag release

simonschoe commented 3 years ago

@peter-malik thanks for the guidance! I made it work that way, albeit a somwhat dirty workaround I must damit...

phuynhh commented 3 years ago

Hi @peter-malik, thank you very much, your solution worked on my win10.

jacobcroope commented 3 years ago

Doesn't address the problem of running natively on Windows but a possible workaround for Win 10 users. I have a working install using WSL Ubuntu 20.0 and Jupyter-Notebook sideloaded on Linux and accessed through the browser.

chevaliermr commented 3 years ago

I have the same issue and have been unable to get the model path to work. Is there a fix for this soon?

erelin6613 commented 3 years ago

As I am forced to work on Windows I downloaded config files and weights, thus feeding config_path and model_path to DetectronLayoutModel :P As for detectron, indeed, it is pain in the neck to make it work on Windows. That worked for me:

conda install pywin32
pip install Cython
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
pip install git+https://github.com/DGMaxime/detectron2-windows.git

Hope it will help somebody :)

tariqph commented 2 years ago

As I am forced to work on Windows I downloaded config files and weights, thus feeding config_path and model_path to DetectronLayoutModel :P As for detectron, indeed, it is pain in the neck to make it work on Windows. That worked for me:

conda install pywin32
pip install Cython
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
pip install git+https://github.com/DGMaxime/detectron2-windows.git

Hope it will help somebody :)

Thanks so much. This worked for me and saved me hours.

Sreevatsava1 commented 2 years ago

One workaround I found is, to change the WEIGHTS path inside the config.yaml file.

If the path is like WEIGHTS: https://www.dropbox.com/s/8v4uqmz1at9v72a/model_final.pth?dl=1

Change it to WEIGHTS: https://www.dropbox.com/s/8v4uqmz1at9v72a/model_final.pth

By removing the ?dl=1 at the end of the path resolved the OS Error for me.

MarouaneZ1 commented 1 year ago
erreurDetectron erreurDetectronn

i'm trying to use detectron2 model for extraction information but i got this problem, i tried many ways but i failed to solve it, i tried to use google collab but it throws me :"ImportError: you cannot import is_directory", does anyone know how can i fix it ?

MarouaneZ1 commented 1 year ago

One workaround I found is, to change the WEIGHTS path inside the config.yaml file.

If the path is like WEIGHTS: https://www.dropbox.com/s/8v4uqmz1at9v72a/model_final.pth?dl=1

Change it to WEIGHTS: https://www.dropbox.com/s/8v4uqmz1at9v72a/model_final.pth

By removing the ?dl=1 at the end of the path resolved the OS Error for me.

can you plz send me the config.yaml file plz

Dimonka2 commented 3 weeks ago

Got the same error, just on a different file:

OSError: [Errno 22] Invalid argument: 'C:\Users\XXXXX/.torch/iopath_cache\s/ukbw5s673633hsw\publaynet-tf_efficientdet_d0.pth.tar?dl=1.lock'

is it still unresolved?