layout-parser icon indicating copy to clipboard operation
layout-parser copied to clipboard

Cannot run the model on Windows.

Open phuynhh opened this issue 3 years ago • 20 comments

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

phuynhh avatar Apr 09 '21 09:04 phuynhh

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

maxml7331 avatar Apr 09 '21 14:04 maxml7331

Hmmm very interesting. Looking into it.

lolipopshock avatar Apr 10 '21 20:04 lolipopshock

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!

maxml7331 avatar Apr 10 '21 20:04 maxml7331

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.

CrisChir avatar Apr 12 '21 06:04 CrisChir

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.

fcakyon avatar Apr 12 '21 22:04 fcakyon

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 .

lolipopshock avatar Apr 12 '21 22:04 lolipopshock

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!

fcakyon avatar Apr 12 '21 23:04 fcakyon

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

kenho211 avatar Apr 14 '21 04:04 kenho211

push, same here (Win10 user)

simonschoe avatar Apr 14 '21 09:04 simonschoe

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)

  • from this: filename = path.split("/")[-1]
  • to this: filename = parsed_url.path.split("/")[-1]

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

peter-malik avatar Apr 14 '21 14:04 peter-malik

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

simonschoe avatar Apr 15 '21 12:04 simonschoe

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

phuynhh avatar Apr 15 '21 13:04 phuynhh

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.

jacobcroope avatar May 04 '21 20:05 jacobcroope

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

chevaliermr avatar Aug 16 '21 15:08 chevaliermr

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 :)

erelin6613 avatar Sep 05 '21 20:09 erelin6613

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.

tariqph avatar Jun 09 '22 10:06 tariqph

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.

Sreevatsava1 avatar Aug 04 '22 17:08 Sreevatsava1

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 avatar Sep 23 '22 18:09 MarouaneZ1

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

MarouaneZ1 avatar Sep 23 '22 19:09 MarouaneZ1