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

ImportError: cannot import name 'process' #230

Closed
anthony-tuininga opened this Issue Jan 13, 2017 · 10 comments

Comments

Projects
None yet
5 participants
@anthony-tuininga
Owner

anthony-tuininga commented Jan 13, 2017

Originally reported by: zaazbb (Bitbucket: zaazbb, GitHub: zaazbb)


import Process from multiprocessing, build a exe and run it, met a import error.

#!python

from multiprocessing import Process, Pipe, freeze_support

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

@anthony-tuininga

This comment has been minimized.

Owner

anthony-tuininga commented Jan 13, 2017

Original comment by zaazbb (Bitbucket: zaazbb, GitHub: zaazbb):


if i import Process from multiprocessing.context, it runs ok, no import error.

@anthony-tuininga

This comment has been minimized.

Owner

anthony-tuininga commented Jan 16, 2017

Original comment by Graham Jones (Bitbucket: grahamrjuk, GitHub: grahamrjuk):


Is this the same as #214 ?

@Siecje

This comment has been minimized.

Siecje commented Jan 31, 2017

I also have this problem with cx_Freeze==5.0.1 on Windows.

from multiprocessing.context import Process does not work.

@grahamrjuk

This comment has been minimized.

grahamrjuk commented Jan 31, 2017

I have my own (new) solution which works for me at the moment (assuming the detail is the same as in #214). I forked cx_Freeze and pushed a branch named proceess_import:
https://github.com/grahamrjuk/cx_Freeze/tree/process_import

I give no guarantee that it is the right solution.

Since it may not be the best solution I haven't raised a pull-request for it at the moment. Perhaps that is the best way to find out if I am close to a sensible solution.

@Siecje

This comment has been minimized.

Siecje commented Jan 31, 2017

I think creating a pull-request is a good idea, even if it doesn't get merged.

@anthony-tuininga

This comment has been minimized.

Owner

anthony-tuininga commented May 14, 2017

The problem is that the multiprocessing package has both Process (class) and process (submodule) but the imp.find_module() function on Windows finds both of them as submodules! I have pushed a change to cx_Freeze that tells it to ignore multiprocessing.Process. You can see more details on pull request #241 .

@grahamrjuk

This comment has been minimized.

grahamrjuk commented May 15, 2017

I knew there would be a better solution than my original go. Thanks for working this out.

@anthony-tuininga

This comment has been minimized.

Owner

anthony-tuininga commented May 15, 2017

No problem. Thanks for creating the pull request. It was helpful in that it pointed to the problem that was taking place!

@reike

This comment has been minimized.

reike commented Sep 25, 2017

Hi everyone,
I upgraded cx_Freeze to the latest version :
In [1]: import cx_Freeze
In [2]: cx_Freeze.version
Out[2]: 6.0b1

Still, I get the same error :
File "C:\Users\HP\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\__init__.py", line 16, in <module> from . import context File "C:\Users\HP\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\context.py", line 5, in <module> from . import process ImportError: cannot import name 'process'

Has the problem actually been fixed ?

Thanks !

@niecore

This comment has been minimized.

niecore commented Apr 16, 2018

I think its not fixed. Same actually happens for multiprocessing.pool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment