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

RuntimeError with multiprocessing on windows 10 #356

Closed
oachk opened this issue Nov 2, 2018 · 4 comments
Closed

RuntimeError with multiprocessing on windows 10 #356

oachk opened this issue Nov 2, 2018 · 4 comments
Assignees
Labels
bug A confirmed issue that needs to be fixed Windows Requests for Windows support wontfix Requests that are out of the scope of this project

Comments

@oachk
Copy link

oachk commented Nov 2, 2018

Hi!
I'm trying to use the tomopy package on windows 10, installed via conda as recommended. At the moment I'm just trying to get one of the example scripts in the documentation to work (p.30 in the documentation):

import tomopy
obj = tomopy.shepp3d()
ang = tomopy.angles(180)
sim = tomopy.project(obj, ang)
rec = tomopy.recon(sim, ang, algorithm='art')
import pylab
pylab.imshow(rec[64], cmap='gray')
pylab.show()

I get the following error:

(base) C:\Users\Hanna>python .\Documents\PythonScripts\main_test_tomopy.py
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes 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 an executable.

It doesn't give me my prompt back neither. I think it is caused by the call of tomopy.project() (just testing using print() after each line of code).

I've first tried running it via spyder (didn't work in the ipython kernel but also didn't raise an error), via spyder using an external kernel (didn't work, same multiprocessing RuntimeError), via the windows prompt (after manually adding the path to my python.exe, which killed spyder so it would not launch anymore, which I somehow could not fix, so I de-installed Anaconda and installed it again) and running it via the Anaconda prompt (see RuntimeError above). By now I've installed and de-installed Anaconda a couple of times, trying to wipe the PC clean with anaconda-clean, using the Anaconda Deinstaller and manually deleting the leftovers in the regedit.
My latest try was only using Miniconda and manually installing the packages I need, because I've read that Spyder+Windows+Multiprocessing doesn't like each other.
I'm still running into the same error.

I have a Intel GPU, could that cause issues? (the astra toolbox doesn't work, but I thought maybe something basic in tomopy without astra should work nevertheless?)
Any ideas?
Shall I try to install tomopy from source instead?
I'm so close to installing Linux and trying there...

@carterbox carterbox self-assigned this Nov 2, 2018
@carterbox

This comment has been minimized.

@carterbox

This comment has been minimized.

@carterbox
Copy link
Member

@oachk, this is a quirk of the Windows 10 multiprocessing. The fix described here worked for me. In order to run your example code you should instead do this:

import tomopy
import pylab


def main():
    obj = tomopy.shepp3d()
    ang = tomopy.angles(180)
    sim = tomopy.project(obj, ang)
    rec = tomopy.recon(sim, ang, algorithm='art')
    pylab.imshow(rec[64], cmap='gray')
    pylab.show()


if __name__ == '__main__':
    main()

Please close this issue if it works for you!

@carterbox carterbox added the awaiting action Wating for more information, action, or confirmation label Nov 5, 2018
@carterbox carterbox removed their assignment Nov 5, 2018
@carterbox carterbox added question Troubleshooting requests wontfix Requests that are out of the scope of this project bug A confirmed issue that needs to be fixed and removed question Troubleshooting requests labels Nov 5, 2018
@oachk
Copy link
Author

oachk commented Nov 5, 2018

Thanks so much for looking into this!
It works perfectly, both in running it from the promt and spyder

@oachk oachk closed this as completed Nov 5, 2018
@carterbox carterbox pinned this issue Mar 1, 2019
@carterbox carterbox changed the title RunTime Error tomopy multiprocessing windows 10 RuntimeError with multiprocessing on windows 10 Mar 1, 2019
@carterbox carterbox added Windows Requests for Windows support and removed awaiting action Wating for more information, action, or confirmation labels Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A confirmed issue that needs to be fixed Windows Requests for Windows support wontfix Requests that are out of the scope of this project
Projects
None yet
Development

No branches or pull requests

2 participants