Hydrospheredata / hydro-serving

MLOps Platform
http://docs.hydrosphere.io
Apache License 2.0
271 stars 42 forks source link

"AttributeError: module 'numpy' has no attribute 'float128'" error on Windows #330

Closed gaopan1996 closed 4 years ago

gaopan1996 commented 4 years ago

Issue

"AttributeError: module 'numpy' has no attribute 'float128'" error occurred on Windows when running any "hs" command. hs==2.4.0

Description

I have started the quickstart documentation for the hs cli on my Windows10 machine. I installed hs==2.4.0 and am getting this error

Traceback (most recent call last):
    File "c:\program files\python36\lib\runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
    File "c:\program files\python36\lib\runpy.py", line 85, in _run_code
        exec(code, run_globals)
    File "C:\Users\K27793\AppData\Roaming\Python\Python36\Scripts\hs.exe\__main__.py", line 5, in <module>
    File "C:\Users\K27793\AppData\Roaming\Python\Python36\site-packages\hydroserving\cli\commands\__init__.py", line 1, in <module>
        from hydroserving.cli.commands.hs import * 
    File "C:\Users\K27793\AppData\Roaming\Python\Python36\site-packages\hydroserving\cli\commands\hs.py", line 7, in <module>
        from hydroserving.cli.context_object import ContextObject
    File "C:\Users\K27793\AppData\Roaming\Python\Python36\site-packages\hydroserving\cli\context_object.py", line 7, in <module>
        from hydroserving.core.apply import ApplyService
    File "C:\Users\K27793\AppData\Roaming\Python\Python36\site-packages\hydroserving\core\apply.py", line 8, in <module>
        from hydroserving.core.deployment_config.parser import parse_deployment_configuration
    File "C:\Users\K27793\AppData\Roaming\Python\Python36\site-packages\hydroserving\core\deployment_config\parser.py", line 3, in <module>
        from hydrosdk import DeploymentConfiguration
    File "C:\Users\K27793\AppData\Roaming\Python\Python36\site-packages\hydrosdk\__init__.py", line 3, in <module>
        from hydrosdk.modelversion import LocalModel, ModelVersion
    File "C:\Users\K27793\AppData\Roaming\Python\Python36\site-packages\hydrosdk\modelversion.py", line 19, in <module>
        from hydrosdk.contract import ModelContract_to_contract_dict, contract_dict_to_ModelContract, validate_contract
    File "C:\Users\K27793\AppData\Roaming\Python\Python36\site-packages\hydrosdk\contract.py", line 11, in <module>
        from hydrosdk.data.types import alias_to_proto_dtype, shape_to_proto, PY_TO_DTYPE, np_to_proto_dtype, proto_to_np_dtype
    File "C:\Users\K27793\AppData\Roaming\Python\Python36\site-packages\hydrosdk\data\types.py", line 130, in <module>
    np.float128: None,
AttributeError: module 'numpy' has no attribute 'float128'

which is related to this issue winpython/winpython#613. Seems like an issue with hydro-sdk on this line https://github.com/Hydrospheredata/hydro-serving-sdk/blob/master/hydrosdk/data/types.py#L130

Downgrading to hs==2.2.0, which doesn't have hydro-sdk dependency, worked on Windows10.

Valenzione commented 4 years ago

Hi, thanks for noticing this!

We'll address this issue in the next patch release. For now, I suggest the following:

I've pushed the fix to the fix/win_numpy_float128 branch in the hydrosdk repository.

Install it before you attempt to install the hs package:

pip install git+https://github.com/Hydrospheredata/hydro-serving-sdk/@fix/win_numpy_float128

Hope this tackles this issue!

gaopan1996 commented 4 years ago

After installing the updated hydrosdk, hs==2.4.0 cli was successful. Thanks

hs --version
hs version 2.4.0