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

LDA Multicore Windows Error #940

Closed
hiral2cool opened this issue Oct 12, 2016 · 13 comments
Closed

LDA Multicore Windows Error #940

hiral2cool opened this issue Oct 12, 2016 · 13 comments
Labels
bug Issue described a bug difficulty easy Easy issue: required small fix

Comments

@hiral2cool
Copy link

os : windows 10
version : Python 2.7.10
all latest numpy,scipy everything upgraded

when i start ldamulticore error is like this

PYTHON

lda = gensim.models.LdaMulticore(corpus=corpus, id2word=id2word, num_topics=10)

ERROR

File "C:\Python27\lib\multiprocessing\forking.py", line 361, in get_command_line
is not going to be frozen to produce a Windows executable.''')
RuntimeError:
Attempt to start a new process before the current process
has finished its bootstrapping phase.

        This probably means that you are on Windows and you have
        forgotten to use the proper idiom in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce a Windows executable.

working perfect on Ubuntu but problem in windows version
any help will be useful

@tmylk tmylk added bug Issue described a bug difficulty easy Easy issue: required small fix labels Oct 13, 2016
@tmylk
Copy link
Contributor

tmylk commented Oct 13, 2016

Does anyone have windows 10 to try if adding if __name__ == '__main__': helps as in SO?

@hiral2cool
Copy link
Author

but at where i have to add this code ??
first i try to add this in main my python code file from which i am going to run LDA module

if name == 'main':
freeze_support()

i try this but same error

@tmylk
Copy link
Contributor

tmylk commented Oct 14, 2016

It should be in the main module of your program as in https://docs.python.org/dev/library/multiprocessing.html#multiprocessing.freeze_support

May I ask for the full code that reproduces the error?

@hiral2cool
Copy link
Author

hiral2cool commented Oct 14, 2016

Here i put all the files of
LDA multicore , Debug Console , Log files after execution

http://www.pastefile.com/hkNFWB

LDA single core working fine
but LDA multicore and LDA distributed both have same error and same problem

i also notice that
worker = 3
Queue size is = 3 x 2 = 6
and chunksize = 2000

so up to 5

2016-10-14 10:59:37,586 : INFO : PROGRESS: pass 0, dispatched chunk #1 = documents up to #4000/18206, outstanding queue size 2
2016-10-14 10:59:40,446 : INFO : PROGRESS: pass 0, dispatched chunk #2 = documents up to #6000/18206, outstanding queue size 3
2016-10-14 10:59:43,378 : INFO : PROGRESS: pass 0, dispatched chunk #3 = documents up to #8000/18206, outstanding queue size 4
2016-10-14 10:59:45,845 : INFO : PROGRESS: pass 0, dispatched chunk #4 = documents up to #10000/18206, outstanding queue size 5

then error ....

@tmylk
Copy link
Contributor

tmylk commented Oct 14, 2016

Hmm probably if name == 'main': freeze_support() should be on the top of code.py, straight after imports?
You can use gist for uploading files

@hiral2cool
Copy link
Author

yes i tried just now & everything is same
console output , log file ,error
everything same no change

don't know what is the problem i also try to debug code but not understand well

@tmylk
Copy link
Contributor

tmylk commented Oct 14, 2016

hmm maybe that line needs to be in LDAMultiCore?
This is not a specifically gensim issue though. It relates to forking on windows.

@hiral2cool
Copy link
Author

yup i know that it is problem of forking on windows
but it should work and something somewhere this library code will change to support new win 10 os

and i also try LDAMulticore
same issue remaining with same errors

@hiral2cool
Copy link
Author

adding this to main source code
if name == 'main':

run working of program successfully LDAmulticore
so Issue Fixed..
Thank you

@tmylk
Copy link
Contributor

tmylk commented Oct 17, 2016

@hiral2cool Thanks a lot for reporting your fix!
Which file was it added to?
May I kindly ask you to submit a Pull Request so that the community can benefit from your solution.

@tmylk
Copy link
Contributor

tmylk commented Oct 18, 2016

Ping @hiral2cool could you copy paste your fixed code here?

@hiral2cool
Copy link
Author

hiral2cool commented Oct 20, 2016

yaa sure here is my code
no need to change any files in gensim
just simply add line in main source code where parallel starts

http://www.pastefile.com/PZKSa3

but may be sometimes problem occurs with this is
this error may come many times

forrtl: error (200): program aborting due to control-C event

but we try to run again then also sometimes not come and run program successfully

@tmylk
Copy link
Contributor

tmylk commented Oct 20, 2016

Resolved by adding this code:

if __name__ == '__main__':
    freeze_support()
    lda = gensim.models.LdaMulticore(corpus=corpus, id2word=id2word, num_topics=4)

@tmylk tmylk closed this as completed Oct 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue described a bug difficulty easy Easy issue: required small fix
Projects
None yet
Development

No branches or pull requests

2 participants