NVIDIA / nvtx-plugins

Python bindings for NVTX
https://docs.nvidia.com/deeplearning/frameworks/nvtx-plugins/user-guide/docs/en/stable/
Apache License 2.0
66 stars 15 forks source link

build_ext recipe for setup.py fails with TF2.2 and python3.7 #22

Open mshaikh786 opened 3 years ago

mshaikh786 commented 3 years ago

Hello Jonathan, I got your email contact from the Dockerfile for circle CI in the release tarball of nvtx-plugins 0.1.8

I tried to pip install nvtx-plugins and when importing the module got an error:

python -c ‘import nvtx.plugins.tf’
2020-12-01 18:08:42.618635: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.2
Traceback (most recent call last):
 File “<string>“, line 1, in <module>
 File “/sw/csgv/dl/apps/nvtx_plugins/0.1.8/lib/python3.7/site-packages/nvtx/plugins/tf/__init__.py”, line 33, in <module>
  import nvtx.plugins.tf.ops
 File “/sw/csgv/dl/apps/nvtx_plugins/0.1.8/lib/python3.7/site-packages/nvtx/plugins/tf/ops.py”, line 29, in <module>
  nvtx_tf_ops = load_library(‘lib/nvtx_ops’ + get_ext_suffix())
 File “/sw/csgv/dl/apps/nvtx_plugins/0.1.8/lib/python3.7/site-packages/nvtx/plugins/tf/ext_utils.py”, line 54, in load_library
  library = _load_library.load_op_library(filename)
 File “/sw/csgv/dl/apps/tensorflow/2.2/lib/python3.7/site-packages/tensorflow/python/framework/load_library.py”, line 58, in load_op_library
  lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /sw/csgv/dl/apps/nvtx_plugins/0.1.8/lib/python3.7/site-packages/nvtx/plugins/tf/lib/nvtx_ops.cpython-37m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory

I assume build_ext need to be run to produce this Cpython object, however

python setup.py build_ext
fails with the following error:
-bash-4.2$ python setup.py build_ext
Traceback (most recent call last):
  File "setup.py", line 186, in <module>
    keywords=__keywords__,
  File "/sw/csgv/dl/apps/intelpython3/2020.0.014/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/sw/csgv/dl/apps/intelpython3/2020.0.014/lib/python3.7/distutils/core.py", line 134, in setup
    ok = dist.parse_command_line()
  File "/sw/csgv/dl/apps/intelpython3/2020.0.014/lib/python3.7/site-packages/setuptools/dist.py", line 703, in parse_command_line
    result = _Distribution.parse_command_line(self)
  File "/sw/csgv/dl/apps/intelpython3/2020.0.014/lib/python3.7/distutils/dist.py", line 483, in parse_command_line
    args = self._parse_command_opts(parser, args)
  File "/sw/csgv/dl/apps/intelpython3/2020.0.014/lib/python3.7/site-packages/setuptools/dist.py", line 1018, in _parse_command_opts
    nargs = _Distribution._parse_command_opts(self, parser, args)
  File "/sw/csgv/dl/apps/intelpython3/2020.0.014/lib/python3.7/distutils/dist.py", line 545, in _parse_command_opts
    if not issubclass(cmd_class, Command):
TypeError: issubclass() arg 1 must be a class

Any clues?

DEKHTIARJonathan commented 3 years ago

This project is not tested to be built using python setup.py build_ext.

Please use the following:

python setup.py sdist
pip install -U dist/*

Though I never tried to build the project on Python 3.7. That could be the issue

mshaikh786 commented 3 years ago

Hi With python3.7, your suggested commands fail to creat the cpython library object file.

DEKHTIARJonathan commented 3 years ago

What is the error you get ?