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.

AttributeError: module 'portalocker' has no attribute 'Lock'

See original GitHub issue

Thanks for sharing your great work. I am sorry that I have a bug when I use python ./tools/train_net.py --num-gpus 1 --config-file ./configs/yolof_R_50_C5_1x.yaml

Bug log below as :

[03/26 07:38:03 d2.data.build]: Using training sampler TrainingSampler [03/26 07:38:03 d2.data.common]: Serializing 117266 elements to byte tensors and concatenating them all … [03/26 07:38:10 d2.data.common]: Serialized dataset takes 451.21 MiB [03/26 07:38:15 fvcore.common.checkpoint]: Loading checkpoint from detectron2://ImageNetPretrained/MSRA/R-50.pkl Traceback (most recent call last): File “./tools/train_net.py”, line 234, in <module> args=(args,), File “/home/cw/miniconda3/envs/yolof/lib/python3.6/site-packages/detectron2/engine/launch.py”, line 62, in launch main_func(*args) File “./tools/train_net.py”, line 215, in main trainer.resume_or_load(resume=args.resume) File “/home/cw/miniconda3/envs/yolof/lib/python3.6/site-packages/detectron2/engine/defaults.py”, line 353, in resume_or_load checkpoint = self.checkpointer.resume_or_load(self.cfg.MODEL.WEIGHTS, resume=resume) File “/home/cw/miniconda3/envs/yolof/lib/python3.6/site-packages/fvcore/common/checkpoint.py”, line 215, in resume_or_load return self.load(path, checkpointables=[]) File “/home/cw/miniconda3/envs/yolof/lib/python3.6/site-packages/fvcore/common/checkpoint.py”, line 140, in load path = self.path_manager.get_local_path(path) File “/home/cw/miniconda3/envs/yolof/lib/python3.6/site-packages/iopath/common/file_io.py”, line 1100, in get_local_path path, force=force, **kwargs File “/home/cw/miniconda3/envs/yolof/lib/python3.6/site-packages/detectron2/utils/file_io.py”, line 29, in _get_local_path return PathManager.get_local_path(self.S3_DETECTRON2_PREFIX + name, **kwargs) File “/home/cw/miniconda3/envs/yolof/lib/python3.6/site-packages/iopath/common/file_io.py”, line 1100, in get_local_path path, force=force, **kwargs File “/home/cw/miniconda3/envs/yolof/lib/python3.6/site-packages/iopath/common/file_io.py”, line 755, in _get_local_path with file_lock(cached): File “/home/cw/miniconda3/envs/yolof/lib/python3.6/site-packages/iopath/common/file_io.py”, line 82, in file_lock return portalocker.Lock(path + “.lock”, timeout=3600) # type: ignore AttributeError: module ‘portalocker’ has no attribute ‘Lock’

I woule be grateful if you could give me some advice. Thanks.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:31 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
Wei-icommented, Mar 26, 2021

first pip uninstall portalocker and conda install portalocker then bug will be fixed.

1reaction
Wei-icommented, Mar 27, 2021

另外有一个小地方,我觉得您可以考虑修改下 。 就是您建议安装的mish-cuda,好像不能够直接 build After git clone,you should movemish-cuda/external/CUDAApplyUtils.cuh to csrc/ before python setup.py build install

link-issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - AttributeError: 'module' object has no attribute 'lock'
As part of my unit testing procedure i'm evaluating the type of a variable which has been returned from a ...
Read more >
AttributeError: module 'anyio' has no attribute 'Lock' - Forum
Hi,. I face this error message when running python with eikon api today. The error message is module 'anyio' has no attribute 'Lock'....
Read more >
[Tutor] Portalocker - tutor@python.org
AttributeError : 'module' object has no attribute 'lock' I rechecked to see if I installed the module correctly and I did. Anyone know...
Read more >
[Tutor] Portalocker
LOCK_EX) AttributeError: 'module' object has no attribute 'lock' I rechecked to see if I installed the module correctly and I did.
Read more >
Python – AttributeError: 'module' object has no attribute 'lock'
Python – AttributeError: 'module' object has no attribute 'lock'. attributeerrormultithreadingpythontypesunit-testing. As part of my unit testing procedure ...
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