opal icon indicating copy to clipboard operation
opal copied to clipboard

Failed running opal server on Windows due to incompatibility of gunicorn

Open noamisraeli opened this issue 2 years ago • 1 comments

Describe the bug After installing opal-server on Windows, when trying to run the opal-server entry point, it failed due to gunicorn import error.

To Reproduce

  • install opal-server on a Windows machine: pip install opal-server
  • run the entry point opal-server

the results:

C:\Users\97254>opal-server
Traceback (most recent call last):
  File "C:\Users\97254\AppData\Local\Programs\Python\Python37\Scripts\opal-server-script.py", line 11, in <module>
    load_entry_point('opal-server==0.1.21', 'console_scripts', 'opal-server')()
  File "C:\Users\97254\AppData\Local\Programs\Python\Python37\lib\site-packages\pkg_resources\__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "C:\Users\97254\AppData\Local\Programs\Python\Python37\lib\site-packages\pkg_resources\__init__.py", line 2862, in load_entry_point
    return ep.load()
  File "C:\Users\97254\AppData\Local\Programs\Python\Python37\lib\site-packages\pkg_resources\__init__.py", line 2462, in load
    return self.resolve()
  File "C:\Users\97254\AppData\Local\Programs\Python\Python37\lib\site-packages\pkg_resources\__init__.py", line 2468, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "C:\Users\97254\AppData\Local\Programs\Python\Python37\lib\site-packages\opal_server\cli.py", line 15, in <module>
    from opal_common.corn_utils import run_gunicorn, run_uvicorn
  File "C:\Users\97254\AppData\Local\Programs\Python\Python37\lib\site-packages\opal_common\corn_utils.py", line 6, in <module>
    import gunicorn.app.base
  File "C:\Users\97254\AppData\Local\Programs\Python\Python37\lib\site-packages\gunicorn\app\base.py", line 11, in <module>
    from gunicorn import util
  File "C:\Users\97254\AppData\Local\Programs\Python\Python37\lib\site-packages\gunicorn\util.py", line 8, in <module>
    import fcntl
ModuleNotFoundError: No module named 'fcntl'

Expected behavior opal-server will try to initial and import gunicorn only when requested by the cli option --engine-type. (like the uvicorn initialization implementation in https://github.com/permitio/opal/blob/112313560b1d67126e164948470aacbf71d10bbb/packages/opal-common/opal_common/corn_utils.py#L46) also, the cli should handle the edgecase of trying to use guvicorn on windows, few choices in mind:

  • removing the option from the cli when running on windows.
  • throw an indicative error for not supporting this running option on windows.

OPAL version

  • Version: 0.1.21

noamisraeli avatar May 10 '22 21:05 noamisraeli

Hi @noamisraeli thanks for the report, we currently did not check the library on windows - most users are running the docker images or on linux-based systems.

@roekatz can you take a look?

asafc avatar May 12 '22 18:05 asafc

Closed by #349

roekatz avatar May 09 '23 17:05 roekatz