ShenhanQian / VHAP

A complete head tracking pipeline from videos to NeRF/3DGS-ready datasets.
Other
100 stars 12 forks source link

no nvdiffrast_plugin_gl.so error. Any suggestion? #11

Closed garrisonz closed 2 weeks ago

garrisonz commented 1 month ago

Thanks for your great work!!

After run "pip install ." , successfully installed VHAP-0.0.1 nvdiffrast-0.3.1

But I cannot run track.py as no nvdiffrast_plugin_gl.so error. Any suggestion?

The log is following:

(VHAP) :~/w/3drecon/VHAP$ python vhap/track.py --data.root_folder "data/monocular/" --exp.output_folder output/monocular/zyp3_whiteBg_staticOffset --data.sequence zyp3
2024-10-06 22:06:56.796809: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-10-06 22:06:56.825984: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-10-06 22:06:57.213637: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Ignoring unknown cluster teeth.
/home/zhangyupeng/miniconda3/envs/VHAP/lib/python3.10/site-packages/pytorch3d/ops/laplacian_matrices.py:51: UserWarning: torch.sparse.SparseTensor(indices, values, shape, *, device=) is deprecated.  Please use torch.sparse_coo_tensor(indices, values, shape, dtype=, device=). (Triggered internally at ../torch/csrc/utils/tensor_new.cpp:641.)
  A = torch.sparse.FloatTensor(idx, ones, (V, V))
/home/zhangyupeng/miniconda3/envs/VHAP/lib/python3.10/site-packages/torch/utils/cpp_extension.py:1965: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
  warnings.warn(
Traceback (most recent call last):
  File "/home/zhangyupeng/w/3drecon/VHAP/vhap/track.py", line 20, in <module>
    tracker = GlobalTracker(cfg)
  File "/home/zhangyupeng/w/3drecon/VHAP/vhap/model/tracker.py", line 1325, in __init__
    super().__init__(cfg)
  File "/home/zhangyupeng/w/3drecon/VHAP/vhap/model/tracker.py", line 68, in __init__
    self.render = NVDiffRenderer(
  File "/home/zhangyupeng/w/3drecon/VHAP/vhap/util/render_nvdiffrast.py", line 72, in __init__
    self.glctx = dr.RasterizeGLContext() if use_opengl else dr.RasterizeCudaContext()
  File "/home/zhangyupeng/miniconda3/envs/VHAP/lib/python3.10/site-packages/nvdiffrast/torch/ops.py", line 221, in __init__
    self.cpp_wrapper = _get_plugin(gl=True).RasterizeGLStateWrapper(output_db, mode == 'automatic', cuda_device_idx)
  File "/home/zhangyupeng/miniconda3/envs/VHAP/lib/python3.10/site-packages/nvdiffrast/torch/ops.py", line 118, in _get_plugin
    torch.utils.cpp_extension.load(name=plugin_name, sources=source_paths, extra_cflags=opts, extra_cuda_cflags=opts+['-lineinfo'], extra_ldflags=ldflags, with_cuda=True, verbose=False)
  File "/home/zhangyupeng/miniconda3/envs/VHAP/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1312, in load
    return _jit_compile(
  File "/home/zhangyupeng/miniconda3/envs/VHAP/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1747, in _jit_compile
    return _import_module_from_library(name, build_directory, is_python_module)
  File "/home/zhangyupeng/miniconda3/envs/VHAP/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2141, in _import_module_from_library
    module = importlib.util.module_from_spec(spec)
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1176, in create_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
ImportError: /home/zhangyupeng/.cache/torch_extensions/py310_cu121/nvdiffrast_plugin_gl/nvdiffrast_plugin_gl.so: cannot open shared object file: No such file or directory
ShenhanQian commented 1 month ago

Hi, seems like nvdiffrast is not successfully installed/compiled. Please try reinstall it via:

pip uninstall nvdiffrast
rm -r ~/.cache/torch_extensions/*/nvdiffrast*
pip install nvdiffrast@git+https://github.com/ShenhanQian/nvdiffrast@backface-culling
garrisonz commented 1 month ago

@ShenhanQian

After run reinstall it:

(VHAP) :~/w/3drecon/VHAP$ pip install nvdiffrast@git+https://github.com/ShenhanQian/nvdiffrast@backface-culling
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting nvdiffrast@ git+https://github.com/ShenhanQian/nvdiffrast@backface-culling
  Cloning https://github.com/ShenhanQian/nvdiffrast (to revision backface-culling) to /tmp/pip-install-fjcqfrbd/nvdiffrast_742fb56d361d40d093cb41d5ca4d9fed
  Running command git clone --filter=blob:none --quiet https://github.com/ShenhanQian/nvdiffrast /tmp/pip-install-fjcqfrbd/nvdiffrast_742fb56d361d40d093cb41d5ca4d9fed
  Running command git checkout -b backface-culling --track origin/backface-culling
  Switched to a new branch 'backface-culling'
  Branch 'backface-culling' set up to track remote branch 'backface-culling' from 'origin'.
  Resolved https://github.com/ShenhanQian/nvdiffrast to commit 22718580f24a313c429ba2c304794c264351f108
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in /home/zhangyupeng/miniconda3/envs/VHAP/lib/python3.10/site-packages (from nvdiffrast@ git+https://github.com/ShenhanQian/nvdiffrast@backface-culling) (1.22.3)

The above error "nvdiffrast_plugin_gl.so: cannot open shared object file: No such file or directory" still there

ShenhanQian commented 1 month ago

Can you show the result of ls ~/.cache/torch_extensions/*/nvdiffrast*

garrisonz commented 1 month ago
(VHAP) :~/w/3drecon/VHAP$ ls ~/.cache/torch_extensions/*/nvdiffrast*
/home/zhangyupeng/.cache/torch_extensions/py310_cu121/nvdiffrast_plugin:
build.ninja

/home/zhangyupeng/.cache/torch_extensions/py310_cu121/nvdiffrast_plugin_gl:
build.ninja

For more information, there is only one file under nvdiffrast_plugin_gl folder :

(VHAP) :~/w/3drecon/VHAP$ ll /home/zhangyupeng/.cache/torch_extensions/py310_cu121/nvdiffrast_plugin_gl/
total 12
drwxrwxr-x 2 zhangyupeng zhangyupeng 4096 10月  6 22:34 ./
drwxrwxr-x 4 zhangyupeng zhangyupeng 4096 10月  6 22:31 ../
-rw-rw-r-- 1 zhangyupeng zhangyupeng 3610 10月  6 22:27 build.ninja
(VHAP) :~/w/3drecon/VHAP$
ShenhanQian commented 1 month ago

Looks like the compilation does run as expected. You may refer to nvdiffrast's repo

Lxiangyue commented 2 weeks ago

I met the cuda 304 error, and the [F glutil.cpp:338] eglInitialize() failed

I fixed it simply with replacing dr.RasterizeGLContext with dr.RasterizeCudaContext in ShenhanQian/nvdiffrec and VHAP. And re-install these two repo.

ShenhanQian commented 2 weeks ago

Xiangyue, thanks for sharing your solution!

Given an upgrade of nvdiffrast, VHAP now runs entirely based on CUDA. Please pull the latest commit and upgrade nvdiffrast as instructed here: https://github.com/ShenhanQian/VHAP/releases/tag/v0.0.2

garrisonz commented 2 weeks ago

Sovlved by

export LD_LIBRARY_PATH=/home/xxxxxx/miniconda3/envs/VHAP/lib/:$LD_LIBRARY_PATH