question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't run demo, model filename is too long

See original GitHub issue

πŸ› Bug

When I run webcam.py the script tries to download weights for the model, but the filaname for cached files is too long. Max filename is usually 255 characters.

To Reproduce

Steps to reproduce the behavior:

  1. Install repo
  2. Run python webcam.py

Error:

Downloading: "https://dl.fbaipublicfiles.com/detectron/35858933/12_2017_baselines/e2e_mask_rcnn_R-50-FPN_1x.yaml.01_48_14.DzEQe4wC/output/train/coco_2014_train%3Acoco_2014_valminusminival/generalized_rcnn/model_final.pkl" to /home/rizhiy/.torch/models/_detectron_35858933_12_2017_baselines_e2e_mask_rcnn_R-50-FPN_1x.yaml.01_48_14.DzEQe4wC_output_train_coco_2014_train%3Acoco_2014_valminusminival_generalized_rcnn_model_final.pkl
100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 362433370/362433370 [00:32<00:00, 11090137.90it/s]
Traceback (most recent call last):
  File "/home/rizhiy/anaconda3/envs/liveness/lib/python3.6/shutil.py", line 544, in move
    os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/tmp/tmp5d8g6paz' -> '/home/rizhiy/.torch/models/_detectron_35858933_12_2017_baselines_e2e_mask_rcnn_R-50-FPN_1x.yaml.01_48_14.DzEQe4wC_output_train_coco_2014_train%3Acoco_2014_valminusminival_generalized_rcnn_model_final.pkl'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "webcam.py", line 80, in <module>
    main()
  File "webcam.py", line 64, in main
    min_image_size=args.min_image_size,
  File "/home/rizhiy/liveness/maskrcnn-benchmark/demo/predictor.py", line 117, in __init__
    _ = checkpointer.load(cfg.MODEL.WEIGHT)
  File "/home/rizhiy/liveness/maskrcnn-benchmark/maskrcnn_benchmark/utils/checkpoint.py", line 61, in load
    checkpoint = self._load_file(f)
  File "/home/rizhiy/liveness/maskrcnn-benchmark/maskrcnn_benchmark/utils/checkpoint.py", line 129, in _load_file
    cached_f = cache_url(f)
  File "/home/rizhiy/liveness/maskrcnn-benchmark/maskrcnn_benchmark/utils/model_zoo.py", line 54, in cache_url
    _download_url_to_file(url, cached_file, hash_prefix, progress=progress)
  File "/home/rizhiy/anaconda3/envs/liveness/lib/python3.6/site-packages/torch/utils/model_zoo.py", line 103, in _download_url_to_file
    shutil.move(f.name, dst)
  File "/home/rizhiy/anaconda3/envs/liveness/lib/python3.6/shutil.py", line 558, in move
    copy_function(src, real_dst)
  File "/home/rizhiy/anaconda3/envs/liveness/lib/python3.6/shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/rizhiy/anaconda3/envs/liveness/lib/python3.6/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
OSError: [Errno 36] File name too long: '/home/rizhiy/.torch/models/_detectron_35858933_12_2017_baselines_e2e_mask_rcnn_R-50-FPN_1x.yaml.01_48_14.DzEQe4wC_output_train_coco_2014_train%3Acoco_2014_valminusminival_generalized_rcnn_model_final.pkl'

Expected behavior

Check filename length and abbreviate if too long.

Environment

  • PyTorch Version (e.g., 1.0): 1.0.0
  • OS (e.g., Linux): Ubuntu 16.04

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Rizhiycommented, Jan 23, 2019

This seems to be related: https://stackoverflow.com/questions/34503540/why-does-python-give-oserror-errno-36-file-name-too-long-for-filename-short I encrypt my home directory and it seems the filename length limit is 143 in such case.

0reactions
apple1987commented, Jul 25, 2019

I meet the same problem, I commented out this line : filename = parts.path.replace(β€œ/”, β€œ_”) and it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I get an error 'The file name is too long' when ...
1. Reduce original model name length less than 63. Β· 2. Rename postfix of output model. Click Simulation -> Model Configuration Parameter ->...
Read more >
How To Fix 'Filename Is Too Long' Issue In Windows
It's obvious who the offender is in this case. Find the file in Windows Explorer, or File Explorer as it's called in Windows...
Read more >
CreateProcess error=206, The filename or extension is too ...
I created a util file that has a main() method that basically drops and re-creates the schema. I run the main() methos when...
Read more >
Error message when you open or save a file in Microsoft ...
This error message occurs when you save or open a file if the path to the file (including the file name) exceeds 218...
Read more >
The specified path, file name, or both are too long - Support
In Windows typically the fully qualified file name must be less than 260 characters, and the directory name must be less than 248...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found