k2-fsa / k2

FSA/FST algorithms, differentiable, with PyTorch compatibility.
https://k2-fsa.github.io/k2
Apache License 2.0
1.13k stars 215 forks source link

Runtime error after installed using conda #960

Closed DongjiGao closed 2 years ago

DongjiGao commented 2 years ago

I installed k2 using conda: conda install -c k2-fsa -c pytorch -c conda-forge k2 python=3.8 cudatoolkit=11.3 pytorch=1.11.0 and got this error while importing k2:

>>> import k2
Traceback (most recent call last):
  File "/export/b14/dgao/k2/k2/python/k2/__init__.py", line 3, in <module>
    from _k2 import DeterminizeWeightPushingType
ImportError: /export/b14/dgao/k2/build/lib/_k2.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor7reshapeEN3c108ArrayRefIlEE

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/export/b14/dgao/k2/k2/python/k2/__init__.py", line 8, in <module>
    raise ImportError(
ImportError: /export/b14/dgao/k2/build/lib/_k2.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor7reshapeEN3c108ArrayRefIlEE
Note: If you're using anaconda and importing k2 on MacOS,
      you can probably fix this by setting the environment variable:
  export DYLD_LIBRARY_PATH=$CONDA_PREFIX/lib/python3.8/site-packages:$DYLD_LIBRARY_PATH

my environment:

Collecting environment information...
PyTorch version: 1.11.0
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Debian GNU/Linux 10 (buster) (x86_64)
GCC version: (Debian 8.3.0-6) 8.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.28

Python version: 3.8.13 (default, Mar 28 2022, 11:38:47)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-4.19.0-20-amd64-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: 11.4.152
GPU models and configuration:
GPU 0: NVIDIA RTX A5000
GPU 1: NVIDIA RTX A5000
GPU 2: NVIDIA RTX A5000
GPU 3: NVIDIA RTX A5000

Nvidia driver version: 470.103.01
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.21.5
[pip3] torch==1.11.0
[pip3] torchaudio==0.11.0
[pip3] torchvision==0.12.0
[conda] blas                      1.0                         mkl
[conda] cudatoolkit               11.3.1               h2bc3f7f_2
[conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
[conda] k2                        1.14.dev20220316 cuda11.3_py3.8_torch1.11.0    k2-fsa
[conda] mkl                       2021.4.0           h06a4308_640
[conda] mkl-service               2.4.0            py38h7f8727e_0
[conda] mkl_fft                   1.3.1            py38hd3c417c_0
[conda] mkl_random                1.2.2            py38h51133e4_0
[conda] numpy                     1.21.5           py38he7a7128_1
[conda] numpy-base                1.21.5           py38hf524024_1
[conda] pytorch                   1.11.0          py3.8_cuda11.3_cudnn8.2.0_0    pytorch
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] torchaudio                0.11.0               py38_cu113    pytorch
[conda] torchvision               0.12.0               py38_cu113    pytorch
pkufool commented 2 years ago

Might be a torch version mismatching, see https://github.com/k2-fsa/k2/pull/949.

csukuangfj commented 2 years ago

ImportError: /export/b14/dgao/k2/build/lib/_k2.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor7reshapeEN3c108ArrayRefIlEE

I see that you use conda to install k2, but the above error message indicates that you installed k2 from source.

You can either remove the version of k2 installed from conda or disable the one compiled from source.

Also, the error indicates that you are not using torch 1.11 to compile k2 from source.

danpovey commented 2 years ago

I think with the latest master, this would have shown up more clearly as a Torch version mismatch.

On Tue, Apr 19, 2022 at 10:26 AM Fangjun Kuang @.***> wrote:

ImportError: /export/b14/dgao/k2/build/lib/_ k2.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor7reshapeEN3c108ArrayRefIlEE

I see that you use conda to install k2, but the above error message indicates that you installed k2 from source.

You can either remove the version of k2 installed from conda or disable the one compiled from source.

Also, the error indicates that you are not using torch 1.11 to compile k2 from source.

— Reply to this email directly, view it on GitHub https://github.com/k2-fsa/k2/issues/960#issuecomment-1101929665, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZFLOZMQVR2TUMIXCTJ3STVFYKVPANCNFSM5TWLMRTQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

DongjiGao commented 2 years ago

Thanks!