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

ImportError: cannot import name 'process' #230

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

ImportError: cannot import name 'process' #230

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

Comments

@anthony-tuininga
Copy link
Collaborator

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
Copy link
Collaborator Author

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


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

@anthony-tuininga
Copy link
Collaborator Author

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


Is this the same as #214 ?

@Siecje
Copy link

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
Copy link

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
Copy link

Siecje commented Jan 31, 2017

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

@anthony-tuininga
Copy link
Collaborator Author

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
Copy link

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

@anthony-tuininga
Copy link
Collaborator Author

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

@reike
Copy link

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
Copy link

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
Projects
None yet
Development

No branches or pull requests

5 participants