python: symbol lookup error: /data/home/xxxxxproject/venv/lib/python3.9/site-packages/torch/lib/../../nvidia/cudnn/lib/libcudnn_cnn_infer.so.8: undefined symbol: _ZN15TracebackLoggerC1EPKc, version libcudnn_ops_infer.so.8
如果你遇到上面错误,可以ldd看一下libcudnn_ops_infer.so.8 指向的不是我们的venv下的目标so
ldd /data/home/projxxx/venv/lib/python3.9/site-packages/torch/lib/../../nvidia/cudnn/lib/libcudnn_cnn_infer.so.8 ldd: warning: you do not have execution permission for `/data/home/xxxxxxxproject/venv/lib/python3.9/site-packages/torch/lib/../../nvidia/cudnn/lib/libcudnn_cnn_infer.so.8' linux-vdso.so.1 (0x00007ffcee0e1000) /$LIB/libonion_block.so => /lib64/libonion_block.so (0x00007f81c7053000) /$LIB/libonion.so => /lib64/libonion.so (0x00007f81ee291000) libcudnn_ops_infer.so.8 => /usr/local/cuda-11.0/lib64/libcudnn_ops_infer.so.8 (0x00007f81b5507000) libz.so.1 => /lib64/libz.so.1 (0x00007f81b52f0000) librt.so.1 => /lib64/librt.so.1 (0x00007f81b50e7000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f81b4ec7000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f81b4cc3000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f81b4b2b000) libm.so.6 => /lib64/libm.so.6 (0x00007f81b47a9000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f81ee261000) libc.so.6 => /lib64/libc.so.6 (0x00007f81b43e7000) /lib64/ld-linux-x86-64.so.2 (0x00007f81ee172000)
可以看到,libcudnn_ops_infer 并非指像我们虚拟环境下的路径,可以重新指定搜索路径
export LD_LIBRARY_PATH=~/projectxxxxxx/venv/lib/python3.9/site-packages/nvidia/cudnnib:$LD_LIBRARY_PATH
上面xxxxxx 就是你的项目地址, venv是虚拟环境目录
看了一大堆blog,就你写的这个是靠谱的,感谢LZ