coqui-ai / Trainer

🐸 - A general purpose model trainer, as flexible as it gets
196 stars 116 forks source link

Package is marked as platform-independent, but it does not import on Windows #88

Closed DManowitz closed 1 year ago

DManowitz commented 1 year ago

Describe the bug

Trying to import this package on Windows gives the following error:

  File "<stdin>", line 1, in <module>
  File "...\lib\site-packages\trainer\__init__.py", line 4, in <module>
    from trainer.trainer import *
  File "...\lib\site-packages\trainer\trainer.py", line 47, in <module>
    multiprocessing.set_start_method("fork")
  File "...\lib\multiprocessing\context.py", line 246, in set_start_method
    self._actual_context = self.get_context(method)
  File "...\lib\multiprocessing\context.py", line 238, in get_context
    return super().get_context(method)
  File "...\lib\multiprocessing\context.py", line 192, in get_context
    raise ValueError('cannot find context for %r' % method) from None
ValueError: cannot find context for 'fork'

Since there is no fork method on Windows, please either fix this issue or do not mark this package as platform-independent.

To Reproduce

Install this package on a Windows system. Start Python. Try to import trainer.

Expected behavior

No response

Logs

No response

Environment

- trainer v0.0.5 (installed via conda-forge)
- OS: Windows 10

Additional context

No response

erogol commented 1 year ago

Thanks for the issue. We don't support Windows officially. I hope someone with Win experience can help on that

DManowitz commented 1 year ago

At least for conda, you can make the __unix virtual package a dependency to prevent installation on Windows.

erogol commented 1 year ago

I have no idea how to do that. If you guide me I can do it.

DManowitz commented 1 year ago

I'm not 100% sure myself about configuring conda recipes, but I know there is a __unix package that you can make as a dependency of your package, and that will automatically not be solvable on Windows. It is not a real package that is ever installed, so it is a virtual package, but it will be available on MacOS and Linxux, but not Windows.

akx commented 1 year ago

This was fixed by bac036fc1744af9317e036db6308371b1b22ccc4.

erogol commented 1 year ago

Even better :)