Linaom1214/TensorRT-For-YOLO-Series

Dockerfile has broken numpy dependency due to pycuda/tensorflow incompatibility

dnns92 opened this issue · 3 comments

When using the provided dockerfile, pycuda and tensorflow cannot coexist, because numpy is incompatible. It must be < 1.20 due to the error message below for pycuda to work, but it must be >1.20 for tensorflow to work. Which numpy version did you use exactly?

See error log with numpy 1.24.2

python3 export.py --help
/usr/local/lib/python3.8/dist-packages/pycuda/compyte/dtypes.py:120: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
  reg.get_or_register_dtype("bool", np.bool)
Traceback (most recent call last):
  File "export.py", line 9, in <module>
    import pycuda.autoinit
  File "/usr/local/lib/python3.8/dist-packages/pycuda/autoinit.py", line 7, in <module>
    from pycuda.tools import make_default_context
  File "/usr/local/lib/python3.8/dist-packages/pycuda/tools.py", line 49, in <module>
    _fill_dtype_registry(respect_windows=True)
  File "/usr/local/lib/python3.8/dist-packages/pycuda/compyte/dtypes.py", line 221, in _fill_dtype_registry
    fill_registry_with_c_types(
  File "/usr/local/lib/python3.8/dist-packages/pycuda/compyte/dtypes.py", line 120, in fill_registry_with_c_types
    reg.get_or_register_dtype("bool", np.bool)
  File "/usr/local/lib/python3.8/dist-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

When using numpy 1.19

trtuser@85c39cba7ce6:/workspace$ python3 export.py
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xd . Check the section C-API incompatibility at the Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for indications on how to solve this problem .
Traceback (most recent call last):
  File "export.py", line 8, in <module>
    import pycuda.driver as cuda
  File "/usr/local/lib/python3.8/dist-packages/pycuda/driver.py", line 62, in <module>
    from pycuda._driver import *  # noqa
SystemError: initialization of _driver raised unreported exception

I also met this problem. Have u solved it?

When using the provided dockerfile, pycuda and tensorflow cannot coexist, because numpy is incompatible. It must be < 1.20 due to the error message below for pycuda to work, but it must be >1.20 for tensorflow to work. Which numpy version did you use exactly?

See error log with numpy 1.24.2

python3 export.py --help
/usr/local/lib/python3.8/dist-packages/pycuda/compyte/dtypes.py:120: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
  reg.get_or_register_dtype("bool", np.bool)
Traceback (most recent call last):
  File "export.py", line 9, in <module>
    import pycuda.autoinit
  File "/usr/local/lib/python3.8/dist-packages/pycuda/autoinit.py", line 7, in <module>
    from pycuda.tools import make_default_context
  File "/usr/local/lib/python3.8/dist-packages/pycuda/tools.py", line 49, in <module>
    _fill_dtype_registry(respect_windows=True)
  File "/usr/local/lib/python3.8/dist-packages/pycuda/compyte/dtypes.py", line 221, in _fill_dtype_registry
    fill_registry_with_c_types(
  File "/usr/local/lib/python3.8/dist-packages/pycuda/compyte/dtypes.py", line 120, in fill_registry_with_c_types
    reg.get_or_register_dtype("bool", np.bool)
  File "/usr/local/lib/python3.8/dist-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

When using numpy 1.19

trtuser@85c39cba7ce6:/workspace$ python3 export.py
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xd . Check the section C-API incompatibility at the Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for indications on how to solve this problem .
Traceback (most recent call last):
  File "export.py", line 8, in <module>
    import pycuda.driver as cuda
  File "/usr/local/lib/python3.8/dist-packages/pycuda/driver.py", line 62, in <module>
    from pycuda._driver import *  # noqa
SystemError: initialization of _driver raised unreported exception

restart the container

When using the provided dockerfile, pycuda and tensorflow cannot coexist, because numpy is incompatible. It must be < 1.20 due to the error message below for pycuda to work, but it must be >1.20 for tensorflow to work. Which numpy version did you use exactly?
See error log with numpy 1.24.2

python3 export.py --help
/usr/local/lib/python3.8/dist-packages/pycuda/compyte/dtypes.py:120: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
  reg.get_or_register_dtype("bool", np.bool)
Traceback (most recent call last):
  File "export.py", line 9, in <module>
    import pycuda.autoinit
  File "/usr/local/lib/python3.8/dist-packages/pycuda/autoinit.py", line 7, in <module>
    from pycuda.tools import make_default_context
  File "/usr/local/lib/python3.8/dist-packages/pycuda/tools.py", line 49, in <module>
    _fill_dtype_registry(respect_windows=True)
  File "/usr/local/lib/python3.8/dist-packages/pycuda/compyte/dtypes.py", line 221, in _fill_dtype_registry
    fill_registry_with_c_types(
  File "/usr/local/lib/python3.8/dist-packages/pycuda/compyte/dtypes.py", line 120, in fill_registry_with_c_types
    reg.get_or_register_dtype("bool", np.bool)
  File "/usr/local/lib/python3.8/dist-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

When using numpy 1.19

trtuser@85c39cba7ce6:/workspace$ python3 export.py
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xd . Check the section C-API incompatibility at the Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for indications on how to solve this problem .
Traceback (most recent call last):
  File "export.py", line 8, in <module>
    import pycuda.driver as cuda
  File "/usr/local/lib/python3.8/dist-packages/pycuda/driver.py", line 62, in <module>
    from pycuda._driver import *  # noqa
SystemError: initialization of _driver raised unreported exception

restart the container