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

Demo on Windows - RuntimeError with freeze_support #8

Closed
MaximeHoude opened this issue Apr 23, 2022 · 5 comments
Closed

Demo on Windows - RuntimeError with freeze_support #8

MaximeHoude opened this issue Apr 23, 2022 · 5 comments

Comments

@MaximeHoude
Copy link

Hi,

I created an environment following the Readme and I this following error on Windows 10, with GPU:

raise RuntimeError('''
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.

Thanks in advance!

@yael-vinker
Copy link
Owner

Hello, can you please provide more information?
At which stage this error has occurred?
Did you manage to install all the requirements?

@MaximeHoude
Copy link
Author

MaximeHoude commented Apr 25, 2022

Hello, can you please provide more information? At which stage this error has occurred? Did you manage to install all the requirements?

Sure, sorry for the lack of info. I created the entire environment with all the requirements. This happens when I start sketching the camel with default parameters, using GPU (Cuda + Nvidia 2070ti).

Here's the full error:

==================================================
Processing [camel.png] ...
Results will be saved to
[C:\code\CLIPasso/output_sketches/camel/] ...
==================================================
GPU: True
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python37\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "C:\Python37\lib\multiprocessing\spawn.py", line 114, in _main
    prepare(preparation_data)
  File "C:\Python37\lib\multiprocessing\spawn.py", line 225, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Python37\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
    run_name="__mp_main__")
  File "C:\Python37\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Python37\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\code\CLIPasso\run_object_sketching.py", line 73, in <module>
    manager = mp.Manager()
  File "C:\Python37\lib\multiprocessing\context.py", line 56, in Manager
    m.start()
  File "C:\Python37\lib\multiprocessing\managers.py", line 563, in start
    self._process.start()
  File "C:\Python37\lib\multiprocessing\process.py", line 112, in start
    self._popen = self._Popen(self)
  File "C:\Python37\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\Python37\lib\multiprocessing\popen_spawn_win32.py", line 46, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Python37\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
    _check_not_importing_main()
  File "C:\Python37\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    is not going to be frozen to produce an executable.''')
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.

@yael-vinker
Copy link
Owner

yael-vinker commented Apr 25, 2022

thanks (:
Can you please try to comment lines 72-73 in run_object_sketching.py:

manager = mp.Manager()
losses_all = manager.dict()

and add instead:
losses_all = {}

@MaximeHoude
Copy link
Author

Sorry for the delay, I tried so many options! I still get this error:

[C:\code\ClipMax2\CLIPasso/output_sketches/camel/] ...
==================================================
GPU: True
Traceback (most recent call last):
  File "painterly_rendering.py", line 18, in <module>
    import wandb
ModuleNotFoundError: No module named 'wandb'

Even if I Pip installed wandb. I thing the root of the problem comes from diffvg, which is unsteady on W10 (I tried with Py3.6, Py3.7 and Py3.8). I tried installing diffvg with your method and following their Readme, but still unstable. My last solution is to try with Poetry.

Also, I tried running your project on Docker, but enabling GPU is unavailable one Windows (even with Ubuntu WSL2). This is quiet a challenge, haha!

@yael-vinker
Copy link
Owner

Hi :)
You can try to comment the "import wandb" line, let me know if it worked.
Indeed, it is challenging to run the project on Windows (haven't tried:) due to diffvg compilation.
If you manage to make it work please update here to help others :)

Thanks!
Yael

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

2 participants