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.

ImportError: cannot import name '_update_worker_pids'

See original GitHub issue

My setup:

  • Ubuntu 18.04.02
  • CUDA 10.0
  • PyTorch 1.1
  • Python3.5

Well, I tried to run the demo using: chmod +x demo_test.sh ./demo_test.sh

but the error came out:

Traceback (most recent call last): File “test.py”, line 11, in <module> from dataset import TestDataset File “/home/nhan/git_workspace/semantic-segmentation-pytorch/dataset.py”, line 4, in <module> import lib.utils.data as torchdata File “/home/nhan/git_workspace/semantic-segmentation-pytorch/lib/utils/data/init.py”, line 3, in <module> from .dataloader import DataLoader File “/home/nhan/git_workspace/semantic-segmentation-pytorch/lib/utils/data/dataloader.py”, line 3, in <module> from torch._C import _set_worker_signal_handlers, _update_worker_pids,
ImportError: cannot import name ‘_update_worker_pids’

What is the problem? Can you help me to solve it? Thanks.

Update 28 Mar 2019: Problem resolved. Rebuilding Pytorch v1.0.0 from source and it works now.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

37reactions
cplusxcommented, May 15, 2019

Though I see this issue has been solved by reinstalling pytorch version 1.0.1. But for those who has updated to 1.1.0 and does not want to downgrade. You can simply replace _update_worker_pids with _set_worker_pids. It works for me after replacement and I think it’s just a simple rename issue.

3reactions
AceCooooolcommented, Mar 27, 2019

This is due to update of dataloader in pytorch1.1(For example. this part is move to data._utils.worker.py file), you need to rewrite this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: cannot import name '_update_worker_pids' #18484
The code I used is: from torch._C import _update_worker_pids. and the error came out: ImportError: cannot import name '_update_worker_pids' ...
Read more >
How to Fix ImportError: Cannot Import Name in Python - Rollbar
The Python ImportError: cannot import name error occurs when an imported class is not accessible or is in a circular dependency.
Read more >
What can I do about "ImportError: Cannot import name X" or ...
I'm assume the error is due to importing entity twice - once in main.py and later in physics.py - but how can I...
Read more >
How to Fix : “ImportError: Cannot import name X” in Python?
You can solve the “ ImportError : Cannot import name X” Error by resolving the circular dependencies. You can do that either by...
Read more >
How do I fix the ImportError: cannot import name 'delayed'?
I am using the LORAS package from pyloras for imbalanced learning, but it requires importing the delayed package. I used the pip.main() to ......
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