Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pycharm 下运行demo.py error ,ValueError: cannot find context for 'forkserver' ,pytorch-gpu,windows10 #195

Closed
luckhhn opened this issue Nov 14, 2018 · 9 comments

Comments

@luckhhn
Copy link

luckhhn commented Nov 14, 2018

感谢您的工作,谢谢分享!
我是在windows 10 环境下,pytorch-gpu,在pycharm打开运行demo.py
遇到错误是:ValueError: cannot find context for 'forkserver'
报错如下:
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\envs\my-pytorch-gpu\lib\multiprocessing\context.py", line 190, in get_context
ctx = _concrete_contexts[method]
KeyError: 'forkserver'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "F:/PythonProject/Alphapose/AlphaPose-pytorch/AlphaPose-pytorch/demo.py", line 26, in
torch.multiprocessing.set_start_method('forkserver', force=True)
File "D:\ProgramData\Anaconda3\envs\my-pytorch-gpu\lib\multiprocessing\context.py", line 246, in set_start_method
self._actual_context = self.get_context(method)
File "D:\ProgramData\Anaconda3\envs\my-pytorch-gpu\lib\multiprocessing\context.py", line 238, in get_context
return super().get_context(method)
File "D:\ProgramData\Anaconda3\envs\my-pytorch-gpu\lib\multiprocessing\context.py", line 192, in get_context
raise ValueError('cannot find context for %r' % method)
ValueError: cannot find context for 'forkserver'

Process finished with exit code 1

@luckhhn
Copy link
Author

luckhhn commented Nov 14, 2018

最后用python demo.py --indir ${img_directory} --outdir examples/res --sp在cmd中科院运行 也是看了 您的win_install

现在问题是:难道在pycharm下报错要怎么解决这个问题?

@luckhhn luckhhn changed the title run demo.py error ,ValueError: cannot find context for 'forkserver' ,pytorch-gpu,windows10 pycharm 下运行demo.py error ,ValueError: cannot find context for 'forkserver' ,pytorch-gpu,windows10 Nov 14, 2018
@xiaoweiChen
Copy link

pycharm其实和命令行没有什么区别,只不过pycharm是一个IDE罢了。

看你的问题应该是没有添加参数运行,建议去查一下运行脚本如何配置参数。

或者,去修改demo.py将一些选项的默认值写成你想要的。

@luckhhn
Copy link
Author

luckhhn commented Nov 14, 2018

好的 非常谢谢您的回复 我去试一试

@luckhhn
Copy link
Author

luckhhn commented Nov 15, 2018

已经解决了

@luckhhn luckhhn closed this as completed Nov 15, 2018
@mamamadoge
Copy link

已经解决了 能分享一下如何解决的吗,我这里显示一样的问题,--sp可以单线程运行,但是去掉就无法多线程

@wanghuahua2019
Copy link

我也是同样问题,请问解决了吗?

@yyh-pc
Copy link

yyh-pc commented Oct 12, 2019

已经解决了
你好,请问可以分享一下如何解决这个问题的吗

@carolchenyx
Copy link

Set the sp true in Alphapose/opt.py file.

@ylabminji
Copy link

Set the sp true in Alphapose/opt.py file.

really Thankyou

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants