ImportError: /home/name/anaconda3/envs/tf21/lib/python3.7/site-packages/torch/lib/../../../../libnvToolsExt.so.1: invalid ELF header

ubuntu conda install pytorch success,but when I code “import torch” and run, then occurs:

ImportError Traceback (most recent call last)
in
1 from future import print_function
----> 2 import torch
3 x = torch.rand(5, 3)
4 print(x)

~/anaconda3/envs/tf21/lib/python3.7/site-packages/torch/init.py in
79 del _dl_flags
80
—> 81 from torch._C import *
82
83 all += [name for name in dir(_C)

ImportError: /home/name/anaconda3/envs/tf21/lib/python3.7/site-packages/torch/lib/…/…/…/…/libnvToolsExt.so.1: invalid ELF header

And my conda list is as follow:

Name Version Build Channel

_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 1_llvm conda-forge
_py-xgboost-mutex 2.0 cpu_0 conda-forge
_tflow_select 2.1.0 gpu
absl-py 0.9.0 py37hc8dfbb8_1 conda-forge
alabaster 0.7.12 py_0 conda-forge
argh 0.26.2 py37_1001 conda-forge
astroid 2.4.2 py37hc8dfbb8_0 conda-forge
astunparse 1.6.3 py_0
atomicwrites 1.4.0 pyh9f0ad1d_0 conda-forge
attrs 19.3.0 py_0 conda-forge
autopep8 1.5.2 pyh9f0ad1d_0 conda-forge
babel 2.8.0 py_0 conda-forge
backcall 0.1.0 py_0 conda-forge
bleach 3.1.5 pyh9f0ad1d_0 conda-forge
blinker 1.4 py_1 conda-forge
brotlipy 0.7.0 py37h8f50634_1000 conda-forge
c-ares 1.15.0 h516909a_1001 conda-forge
ca-certificates 2020.6.24 0
cachetools 4.1.0 py_1 conda-forge
certifi 2020.6.20 py37_0
cffi 1.14.0 py37hd463f26_0 conda-forge
chardet 3.0.4 py37hc8dfbb8_1006 conda-forge
click 7.1.2 pyh9f0ad1d_0 conda-forge
cloudpickle 1.4.1 py_0 conda-forge
colorama 0.4.3 py_0 conda-forge
cryptography 2.9.2 py37hb09aad4_0 conda-forge
cudatoolkit 10.1.243 h6bb024c_0
cudnn 7.6.5 cuda10.1_0
cupti 10.1.168 0
cycler 0.10.0 py_2 conda-forge
dbus 1.13.6 he372182_0 conda-forge
decorator 4.4.2 py_0 conda-forge
defusedxml 0.6.0 py_0 conda-forge
diff-match-patch 20181111 py_0 conda-forge
docutils 0.16 py37hc8dfbb8_1 conda-forge
entrypoints 0.3 py37hc8dfbb8_1001 conda-forge
expat 2.2.9 he1b5a44_2 conda-forge
flake8 3.7.9 py37hc8dfbb8_1 conda-forge
fontconfig 2.13.1 h86ecdb6_1001 conda-forge
freetype 2.10.2 he06d7ca_0 conda-forge
future 0.18.2 py37hc8dfbb8_1 conda-forge
gast 0.3.3 py_0 conda-forge
gettext 0.19.8.1 hc5be6a0_1002 conda-forge
glib 2.64.3 h6f030ca_0 conda-forge
google-auth 1.16.1 pyh9f0ad1d_0 conda-forge
google-auth-oauthlib 0.4.1 py_2 conda-forge
google-pasta 0.2.0 pyh8c360ce_0 conda-forge
grpcio 1.27.2 py37hf8bcb03_0
gst-plugins-base 1.14.5 h0935bb2_2 conda-forge
gstreamer 1.14.5 h36ae1b5_2 conda-forge
h5py 2.10.0 nompi_py37h513d04c_102 conda-forge
hdf5 1.10.5 nompi_h3c11f04_1104 conda-forge
icu 64.2 he1b5a44_1 conda-forge
idna 2.9 py_1 conda-forge
imagesize 1.2.0 py_0 conda-forge
importlib-metadata 1.6.1 py37hc8dfbb8_0 conda-forge
importlib_metadata 1.6.1 0 conda-forge
intel-openmp 2020.1 217
intervaltree 3.0.2 py_0 conda-forge
ipykernel 5.3.2 py37h5ca1d4c_0
ipython 7.15.0 py37hc8dfbb8_0 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
ipywidgets 7.5.1 py_0 conda-forge
isort 4.3.21 py37hc8dfbb8_1 conda-forge
jedi 0.15.2 py37_0 conda-forge
jeepney 0.4.3 py_0 conda-forge
jinja2 2.11.2 pyh9f0ad1d_0 conda-forge
joblib 0.15.1 py_0 conda-forge
jpeg 9d h516909a_0 conda-forge
jsonschema 3.2.0 py37hc8dfbb8_1 conda-forge
jupyter 1.0.0 py37_7
jupyter_client 6.1.3 py_0 conda-forge
jupyter_console 6.1.0 py_1 conda-forge
jupyter_contrib_core 0.3.3 py_2 conda-forge
jupyter_contrib_nbextensions 0.5.1 py37_0 conda-forge
jupyter_core 4.6.3 py37hc8dfbb8_1 conda-forge
jupyter_highlight_selected_word 0.2.0 py37_1000 conda-forge
jupyter_latex_envs 1.4.6 py37_1000 conda-forge
jupyter_nbextensions_configurator 0.4.1 py37hc8dfbb8_1 conda-forge
keras-preprocessing 1.1.0 py_0 conda-forge
keras-tuner 1.0.1 py_0 conda-forge
keyring 21.2.1 py37hc8dfbb8_0 conda-forge
kiwisolver 1.2.0 py37h99015e2_0 conda-forge
lazy-object-proxy 1.4.3 py37h8f50634_2 conda-forge
lcms2 2.11 h396b838_0
libblas 3.8.0 16_openblas conda-forge
libcblas 3.8.0 16_openblas conda-forge
libclang 9.0.1 default_hde54327_0 conda-forge
libedit 3.1.20191231 h46ee950_0 conda-forge
libffi 3.2.1 he1b5a44_1007 conda-forge
libgcc-ng 9.2.0 h24d8f2e_2 conda-forge
libgfortran-ng 7.5.0 hdf63c60_6 conda-forge
libiconv 1.15 h516909a_1006 conda-forge
liblapack 3.8.0 16_openblas conda-forge
libllvm8 8.0.1 hc9558a2_0 conda-forge
libllvm9 9.0.1 he513fc3_1 conda-forge
libopenblas 0.3.9 h5ec1e0e_0 conda-forge
libpng 1.6.37 hed695b0_1 conda-forge
libprotobuf 3.12.3 h8b12597_0 conda-forge
libsodium 1.0.17 h516909a_0 conda-forge
libspatialindex 1.9.3 he1b5a44_3 conda-forge
libstdcxx-ng 9.2.0 hdf63c60_2 conda-forge
libtiff 4.1.0 h2733197_1
libuuid 2.32.1 h14c3975_1000 conda-forge
libxcb 1.13 h14c3975_1002 conda-forge
libxgboost 1.0.2 he1b5a44_1 conda-forge
libxkbcommon 0.10.0 he1b5a44_0 conda-forge
libxml2 2.9.10 hee79883_0 conda-forge
libxslt 1.1.33 h31b3aaa_0 conda-forge
llvm-openmp 10.0.0 hc9558a2_0 conda-forge
llvmlite 0.32.1 py37h5202443_0 conda-forge
lxml 4.5.1 py37hefd8a0e_0
lz4-c 1.9.2 he6710b0_1
markdown 3.2.2 py_0 conda-forge
markupsafe 1.1.1 py37h8f50634_1 conda-forge
matplotlib 3.2.1 0 conda-forge
matplotlib-base 3.2.1 py37h30547a4_0 conda-forge
mccabe 0.6.1 py_1 conda-forge
mistune 0.8.4 py37h8f50634_1001 conda-forge
mkl 2020.1 217
nbconvert 5.6.1 py37hc8dfbb8_1 conda-forge
nbformat 5.0.6 py_0 conda-forge
ncurses 6.1 hf484d3e_1002 conda-forge
ninja 1.10.0 py37hfd86e86_0
notebook 6.0.3 py37hc8dfbb8_0 conda-forge
nspr 4.25 he1b5a44_0 conda-forge
nss 3.47 he751ad9_0 conda-forge
numba 0.49.1 py37h0da4684_0 conda-forge
numpy 1.17.5 py37h95a1406_0 conda-forge
numpydoc 1.0.0 pyh9f0ad1d_0 conda-forge
oauthlib 3.0.1 py_0 conda-forge
olefile 0.46 py37_0
openssl 1.1.1g h7b6447c_0
opt_einsum 3.2.1 py_0 conda-forge
ordered-set 4.0.2 pypi_0 pypi
packaging 20.4 pyh9f0ad1d_0 conda-forge
pandas 1.0.4 py37h0da4684_0 conda-forge
pandoc 2.9.2.1 0 conda-forge
pandocfilters 1.4.2 py_1 conda-forge
parso 0.5.2 py_0 conda-forge
pathtools 0.1.2 py_1 conda-forge
patsy 0.5.1 py_0 conda-forge
pcre 8.44 he1b5a44_0 conda-forge
pexpect 4.8.0 py37hc8dfbb8_1 conda-forge
pickleshare 0.7.5 py37hc8dfbb8_1001 conda-forge
pillow 7.2.0 py37hb39fc2d_0
pip 20.1.1 py37_1
pluggy 0.13.1 py37hc8dfbb8_1 conda-forge
prometheus_client 0.8.0 pyh9f0ad1d_0 conda-forge
prompt-toolkit 3.0.5 py_0 conda-forge
prompt_toolkit 3.0.5 0 conda-forge
protobuf 3.12.3 py37h3340039_0 conda-forge
psutil 5.7.0 py37h8f50634_1 conda-forge
pthread-stubs 0.4 h14c3975_1001 conda-forge
ptyprocess 0.6.0 py_1001 conda-forge
py-xgboost 1.0.2 py37hc8dfbb8_1 conda-forge
pyasn1 0.4.8 py_0 conda-forge
pyasn1-modules 0.2.7 py_0 conda-forge
pycodestyle 2.5.0 py_0 conda-forge
pycparser 2.20 py_0 conda-forge
pydocstyle 5.0.2 py_0 conda-forge
pyflakes 2.1.1 py_0 conda-forge
pygments 2.6.1 py_0 conda-forge
pyjwt 1.7.1 py_0 conda-forge
pylint 2.5.2 py37hc8dfbb8_0 conda-forge
pyopenssl 19.1.0 py_1 conda-forge
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
pyqt 5.12.3 py37h8685d9f_3 conda-forge
pyqt5-sip 4.19.18 pypi_0 pypi
pyqtchart 5.12 pypi_0 pypi
pyqtwebengine 5.12.1 pypi_0 pypi
pyrsistent 0.16.0 py37h8f50634_0 conda-forge
pysocks 1.7.1 py37hc8dfbb8_1 conda-forge
python 3.7.4 h265db76_1
python-dateutil 2.8.1 py_0 conda-forge
python-graphviz 0.14.1 pypi_0 pypi
python-jsonrpc-server 0.3.4 pyh9f0ad1d_1 conda-forge
python-language-server 0.31.10 py37hc8dfbb8_0 conda-forge
python_abi 3.7 1_cp37m conda-forge
pytorch 1.4.0 py3.7_cuda10.1.243_cudnn7.6.3_0 pytorch
pytz 2020.1 pyh9f0ad1d_0 conda-forge
pyxdg 0.26 py_0 conda-forge
pyyaml 5.3.1 py37h8f50634_0 conda-forge
pyzmq 19.0.1 py37hac76be4_0 conda-forge
qdarkstyle 2.8.1 pyh9f0ad1d_0 conda-forge
qt 5.12.5 hd8c4c69_1 conda-forge
qtawesome 0.7.2 pyh9f0ad1d_0 conda-forge
qtconsole 4.7.4 pyh9f0ad1d_0 conda-forge
qtpy 1.9.0 py_0 conda-forge
readline 7.0 hf8c457e_1001 conda-forge
requests 2.23.0 pyh8c360ce_2 conda-forge
requests-oauthlib 1.2.0 py_0 conda-forge
rope 0.17.0 pyh9f0ad1d_0 conda-forge
rsa 4.0 py_0 conda-forge
rtree 0.9.4 py37h8526d28_1 conda-forge
scikit-learn 0.23.1 py37h8a51577_0 conda-forge
scikit-plot 0.3.7 py_1 conda-forge
scipy 1.4.1 py37ha3d9a3c_3 conda-forge
seaborn 0.10.1 1 conda-forge
seaborn-base 0.10.1 py_1 conda-forge
secretstorage 3.1.2 py37hc8dfbb8_1 conda-forge
send2trash 1.5.0 py_0 conda-forge
setuptools 47.1.1 py37hc8dfbb8_0 conda-forge
six 1.15.0 pyh9f0ad1d_0 conda-forge
snowballstemmer 2.0.0 py_0 conda-forge
sortedcontainers 2.2.1 pyh9f0ad1d_0 conda-forge
sphinx 3.1.0 py_0 conda-forge
sphinxcontrib-applehelp 1.0.2 py_0 conda-forge
sphinxcontrib-devhelp 1.0.2 py_0 conda-forge
sphinxcontrib-htmlhelp 1.0.3 py_0 conda-forge
sphinxcontrib-jsmath 1.0.1 py_0 conda-forge
sphinxcontrib-qthelp 1.0.3 py_0 conda-forge
sphinxcontrib-serializinghtml 1.1.4 py_0 conda-forge
spyder 4.1.3 py37hc8dfbb8_0 conda-forge
spyder-kernels 1.9.1 py37hc8dfbb8_0 conda-forge
sqlite 3.31.1 h7b6447c_0
statsmodels 0.11.1 py37h8f50634_2 conda-forge
tabulate 0.8.7 pyh9f0ad1d_0 conda-forge
tensorboard 2.2.1 pyh532a8cf_0
tensorboard-plugin-wit 1.6.0 py_0
tensorflow 2.2.0 gpu_py37h1a511ff_0
tensorflow-base 2.2.0 gpu_py37h8a81be8_0
tensorflow-estimator 2.2.0 pyh208ff02_0
tensorflow-gpu 2.2.0 h0d30ee6_0
termcolor 1.1.0 py_2 conda-forge
terminado 0.8.3 py37hc8dfbb8_1 conda-forge
terminaltables 3.1.0 py_0 conda-forge
testpath 0.4.4 py_0 conda-forge
threadpoolctl 2.1.0 pyh5ca1d4c_0 conda-forge
tk 8.6.10 hed695b0_0 conda-forge
toml 0.10.1 pyh9f0ad1d_0 conda-forge
torchmeta 1.4.6 pypi_0 pypi
torchvision 0.5.0 py37_cu101 pytorch
tornado 6.0.4 py37h8f50634_1 conda-forge
tqdm 4.46.1 pyh9f0ad1d_0 conda-forge
traitlets 4.3.3 py37hc8dfbb8_1 conda-forge
typed-ast 1.4.1 py37h516909a_0 conda-forge
ujson 1.35 py37h3340039_1002 conda-forge
urllib3 1.25.9 py_0 conda-forge
watchdog 0.10.2 py37_0 conda-forge
wcwidth 0.2.4 pyh9f0ad1d_0 conda-forge
webencodings 0.5.1 py_1 conda-forge
werkzeug 1.0.1 pyh9f0ad1d_0 conda-forge
wheel 0.34.2 py_1 conda-forge
widgetsnbextension 3.5.1 py37_0 conda-forge
wrapt 1.11.2 py37h8f50634_0 conda-forge
wurlitzer 2.0.0 py37hc8dfbb8_1 conda-forge
xorg-libxau 1.0.9 h14c3975_0 conda-forge
xorg-libxdmcp 1.1.3 h516909a_0 conda-forge
xz 5.2.5 h516909a_0 conda-forge
yaml 0.2.5 h516909a_0 conda-forge
yapf 0.29.0 py_0 conda-forge
zeromq 4.3.2 he1b5a44_2 conda-forge
zipp 3.1.0 py_0 conda-forge
zlib 1.2.11 h516909a_1006 conda-forge
zstd 1.4.5 h9ceee32_0

1 Like

Change directory or Install again.

Thank you very much!
I had changed the environment, the problem is the same. But I use pip install as the pytorch website shows us the problem is solved.

Use this method, it is OK
pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

It is the official method, so it must work.