NVlabs / imaginaire

NVIDIA's Deep Imagination Team's PyTorch Library
Other
3.99k stars 444 forks source link

Install Error. cuda_runtime_api.h: No such file or directory #154

Open SYLin117 opened 2 years ago

SYLin117 commented 2 years ago

Hi, I'm using ubuntu 18.04 and 3090 with Cuda 11.1. I encountered this problem when I tried to install it by Conda. I already have tested Torch and Cuda, and both work. Any advice would be thankful.

`/home/ian/anaconda3/envs/imaginaire/lib/python3.8/site-packages/torch/include/ATen/ParallelOpenMP.h:87: warning: ignoring ‘#pragma omp parallel’ [-Wunknown-pragmas] 87 #pragma omp parallel for if ((end - begin) >= grain_size)

In file included from ./src/correlation_cuda.cc:4: /home/ian/anaconda3/envs/imaginaire/lib/python3.8/site-packages/torch/include/ATen/cuda/CUDAContext.h:5:10: fatal error: cuda_runtime_api.h: No such file or directory 5 | #include | ^~~~~~~~ compilation terminated. error: command '/usr/bin/gcc' failed with exit code 1 CUDA_VERSION: 11.1 `

Geniussh commented 2 years ago

First make sure you do conda activate imaginaire and then install the third-party packages.

I encountered similar "no such file or directory" errors when installing third-party packages. My local environment is CUDA 11.6. After installing requirements_conda.yaml I python=3.8 and pytorch=1.9 but with CUDA 11.4. So I checked if torch.cuda.available() which is False. I then went to my existing environment where pytorch can find gpu (python 3.9, cuda 11.3, pytorch 1.11) and added all the missing packages from requirements_conda.yaml. Then it worked. I have exported a working environment below for anyone installing through conda as well.

``` name: imaginaire channels: - pytorch - conda-forge - defaults dependencies: - _libgcc_mutex=0.1=conda_forge - _openmp_mutex=4.5=2_kmp_llvm - absl-py=0.15.0=pyhd3eb1b0_0 - aiohttp=3.8.1=py39h7f8727e_1 - aiosignal=1.2.0=pyhd3eb1b0_0 - albumentations=1.0.3=pyhd8ed1ab_0 - alsa-lib=1.2.6.1=h7f98852_0 - aom=3.3.0=h27087fc_1 - asttokens=2.0.5=pyhd8ed1ab_0 - async-timeout=4.0.1=pyhd3eb1b0_0 - attr=2.5.1=h166bdaf_0 - attrs=21.4.0=pyhd3eb1b0_0 - backcall=0.2.0=pyh9f0ad1d_0 - backports=1.0=py_2 - backports.functools_lru_cache=1.6.4=pyhd8ed1ab_0 - blas=1.0=mkl - blinker=1.4=py39h06a4308_0 - blosc=1.21.1=h83bc5f7_3 - boto3=1.24.17=pyhd8ed1ab_0 - brotli=1.0.9=he6710b0_2 - brotlipy=0.7.0=py39h27cfd23_1003 - brunsli=0.1=h9c3ff4c_0 - bzip2=1.0.8=h7b6447c_0 - c-ares=1.18.1=h7f8727e_0 - c-blosc2=2.1.1=h7a311fb_2 - ca-certificates=2022.6.15=ha878542_0 - cachetools=4.2.2=pyhd3eb1b0_0 - cairo=1.16.0=ha61ee94_1011 - certifi=2022.6.15=py39hf3d152e_0 - cffi=1.15.0=py39hd667e15_1 - cfitsio=4.1.0=hd9d235c_0 - charls=2.3.4=h9c3ff4c_0 - charset-normalizer=2.0.4=pyhd3eb1b0_0 - click=8.0.4=py39h06a4308_0 - cloudpickle=2.1.0=pyhd8ed1ab_0 - cmake=3.23.2=h5432695_0 - cryptography=3.4.8=py39hd23ed53_0 - cudatoolkit=11.3.1=h2bc3f7f_2 - cudatoolkit-dev=11.4.0=h5e8e339_5 - cycler=0.11.0=pyhd3eb1b0_0 - cython=0.29.30=py39h5a03fae_0 - cytoolz=0.11.2=py39hb9d737c_2 - dask-core=2022.6.1=pyhd8ed1ab_0 - dataclasses=0.8=pyh6d0b6a4_7 - dbus=1.13.18=hb2f20db_0 - decorator=5.1.1=pyhd8ed1ab_0 - diskcache=5.4.0=pyhd8ed1ab_0 - dlib=19.24.0=py39h9ea2e13_0 - docker-pycreds=0.4.0=py_0 - executing=0.8.3=pyhd8ed1ab_0 - expat=2.4.8=h27087fc_0 - ffmpeg=4.4.2=habc3f16_0 - fftw=3.3.10=nompi_h77c792f_102 - font-ttf-dejavu-sans-mono=2.37=hab24e00_0 - font-ttf-inconsolata=3.000=h77eed37_0 - font-ttf-source-code-pro=2.038=h77eed37_0 - font-ttf-ubuntu=0.83=hab24e00_0 - fontconfig=2.14.0=h8e229c2_0 - fonts-conda-ecosystem=1=0 - fonts-conda-forge=1=0 - fonttools=4.25.0=pyhd3eb1b0_0 - freeglut=3.2.2=h9c3ff4c_1 - freetype=2.11.0=h70c0345_0 - frozenlist=1.2.0=py39h7f8727e_0 - fsspec=2022.5.0=pyhd8ed1ab_0 - future=0.18.2=py39hf3d152e_5 - geos=3.10.3=h27087fc_0 - gettext=0.19.8.1=h73d1719_1008 - giflib=5.2.1=h7b6447c_0 - gitdb=4.0.9=pyhd8ed1ab_0 - gitpython=3.1.27=pyhd8ed1ab_0 - glib=2.70.2=h780b84a_4 - glib-tools=2.70.2=h780b84a_4 - gmp=6.2.1=h295c915_3 - gnutls=3.7.6=hb5d6004_1 - google-auth=2.6.0=pyhd3eb1b0_0 - google-auth-oauthlib=0.4.1=py_2 - graphite2=1.3.13=h58526e2_1001 - grpcio=1.42.0=py39hce63b2e_0 - gst-plugins-base=1.20.3=hf6a322e_0 - gstreamer=1.20.3=hd4edc92_0 - harfbuzz=4.3.0=hf9f4e7c_0 - hdf5=1.12.1=nompi_h2386368_104 - icu=70.1=h27087fc_0 - imagecodecs=2022.2.22=py39hfcd4fa2_6 - imageio=2.19.3=pyhcf75d05_0 - imageio-ffmpeg=0.4.7=pyhd8ed1ab_0 - imgaug=0.4.0=pyhd8ed1ab_1 - importlib-metadata=4.11.3=py39h06a4308_0 - imutils=0.5.4=py39hf3d152e_1 - intel-openmp=2021.4.0=h06a4308_3561 - ipdb=0.13.9=pyhd8ed1ab_0 - ipython=8.4.0=py39hf3d152e_0 - jack=1.9.18=h8c3723f_1002 - jasper=2.0.33=ha77e612_0 - jedi=0.18.1=py39hf3d152e_1 - jmespath=1.0.1=pyhd8ed1ab_0 - joblib=1.1.0=pyhd8ed1ab_0 - jpeg=9e=h7f8727e_0 - jxrlib=1.1=h7f98852_2 - keyutils=1.6.1=h166bdaf_0 - kiwisolver=1.4.2=py39h295c915_0 - krb5=1.19.3=h3790be6_0 - lame=3.100=h7b6447c_0 - lcms2=2.12=h3be6417_0 - ld_impl_linux-64=2.38=h1181459_1 - lerc=3.0=h9c3ff4c_0 - libaec=1.0.6=h9c3ff4c_0 - libavif=0.10.1=h166bdaf_0 - libblas=3.9.0=12_linux64_mkl - libbrotlicommon=1.0.9=h166bdaf_7 - libbrotlidec=1.0.9=h166bdaf_7 - libbrotlienc=1.0.9=h166bdaf_7 - libcap=2.64=ha37c62d_0 - libcblas=3.9.0=12_linux64_mkl - libclang=14.0.6=default_h2e3cab8_0 - libclang13=14.0.6=default_h3a83d3e_0 - libcups=2.3.3=hf5a7f15_1 - libcurl=7.83.1=h7bff187_0 - libdb=6.2.32=h9c3ff4c_0 - libdeflate=1.12=h166bdaf_0 - libdrm=2.4.111=h166bdaf_0 - libedit=3.1.20191231=he28a2e2_2 - libev=4.33=h516909a_1 - libevent=2.1.10=h9b69904_4 - libffi=3.4.2=h7f98852_5 - libflac=1.3.4=h27087fc_0 - libgcc-ng=12.1.0=h8d9b700_16 - libgfortran-ng=12.1.0=h69a702a_16 - libgfortran5=12.1.0=hdcd56e2_16 - libglib=2.70.2=h174f98d_4 - libglu=9.0.0=he1b5a44_1001 - libiconv=1.16=h7f8727e_2 - libidn2=2.3.2=h7f8727e_0 - liblapack=3.9.0=12_linux64_mkl - liblapacke=3.9.0=12_linux64_mkl - libllvm14=14.0.6=he0ac6c6_0 - libnghttp2=1.47.0=h727a467_0 - libnsl=2.0.0=h7f98852_0 - libogg=1.3.4=h7f98852_1 - libopencv=4.5.5=py39hd011c1b_11 - libopus=1.3.1=h7f98852_1 - libpciaccess=0.16=h516909a_0 - libpng=1.6.37=hbc83047_0 - libpq=14.4=hd77ab85_0 - libprotobuf=3.20.1=h4ff587b_0 - libsndfile=1.0.31=h9c3ff4c_1 - libssh2=1.10.0=ha56f1ee_2 - libstdcxx-ng=12.1.0=ha89aaad_16 - libtasn1=4.16.0=h27cfd23_0 - libtiff=4.4.0=hc85c160_1 - libtool=2.4.6=h9c3ff4c_1008 - libudev1=249=h166bdaf_4 - libunistring=0.9.10=h27cfd23_0 - libuuid=2.32.1=h7f98852_1000 - libuv=1.40.0=h7b6447c_0 - libva=2.14.0=h7f98852_0 - libvorbis=1.3.7=h9c3ff4c_0 - libvpx=1.11.0=h9c3ff4c_3 - libwebp=1.2.2=h55f646e_0 - libwebp-base=1.2.2=h7f8727e_0 - libxcb=1.13=h7f98852_1004 - libxkbcommon=1.0.3=he3ba5ed_0 - libxml2=2.9.14=h22db469_0 - libzlib=1.2.12=h166bdaf_1 - libzopfli=1.0.3=h9c3ff4c_0 - llvm-openmp=14.0.4=he0ac6c6_0 - locket=1.0.0=pyhd8ed1ab_0 - lz4-c=1.9.3=h295c915_1 - markdown=3.3.4=py39h06a4308_0 - matplotlib=3.5.1=py39h06a4308_1 - matplotlib-base=3.5.1=py39ha18d171_1 - matplotlib-inline=0.1.3=pyhd8ed1ab_0 - mkl=2021.4.0=h06a4308_640 - mkl-service=2.4.0=py39h7f8727e_0 - mkl_fft=1.3.1=py39hd3c417c_0 - mkl_random=1.2.2=py39h51133e4_0 - multidict=5.2.0=py39h7f8727e_2 - munkres=1.1.4=py_0 - mysql-common=8.0.29=haf5c9bc_1 - mysql-libs=8.0.29=h28c427c_1 - ncurses=6.3=h7f8727e_2 - nettle=3.7.3=hbbd107a_1 - networkx=2.8.4=pyhd8ed1ab_0 - ninja=1.11.0=h924138e_0 - nspr=4.32=h9c3ff4c_1 - nss=3.78=h2350873_0 - numpy=1.22.3=py39he7a7128_0 - numpy-base=1.22.3=py39hf524024_0 - oauthlib=3.2.0=pyhd3eb1b0_0 - opencv=4.5.5=py39hf3d152e_11 - openh264=2.1.1=h4ff587b_0 - openjpeg=2.4.0=hb52868f_1 - openssl=1.1.1p=h166bdaf_0 - packaging=21.3=pyhd3eb1b0_0 - parso=0.8.3=pyhd8ed1ab_0 - partd=1.2.0=pyhd8ed1ab_0 - pathtools=0.1.2=py_1 - pcre=8.45=h295c915_0 - pexpect=4.8.0=pyh9f0ad1d_2 - pickleshare=0.7.5=py_1003 - pillow=9.0.1=py39h22f2fdc_0 - pip=21.2.4=py39h06a4308_0 - pixman=0.40.0=h36c2ea0_0 - portaudio=19.6.0=h57a0ea0_5 - promise=2.3=py39hf3d152e_6 - prompt-toolkit=3.0.30=pyha770c72_0 - protobuf=3.20.1=py39h295c915_0 - psutil=5.9.1=py39hb9d737c_0 - pthread-stubs=0.4=h36c2ea0_1001 - ptyprocess=0.7.0=pyhd3deb0d_0 - pulseaudio=14.0=h7f54b18_8 - pure_eval=0.2.2=pyhd8ed1ab_0 - py-opencv=4.5.5=py39hef51801_11 - pyasn1=0.4.8=pyhd3eb1b0_0 - pyasn1-modules=0.2.8=py_0 - pycparser=2.21=pyhd3eb1b0_0 - pyglet=1.5.16=py39hf3d152e_1 - pygments=2.12.0=pyhd8ed1ab_0 - pyjwt=2.1.0=py39h06a4308_0 - pynvml=11.4.1=pyhd8ed1ab_0 - pyopenssl=21.0.0=pyhd3eb1b0_1 - pyparsing=3.0.4=pyhd3eb1b0_0 - pyqt=5.15.4=py39h18e9c17_1 - pyqt5-sip=12.9.0=py39h5a03fae_1 - pysocks=1.7.1=py39h06a4308_0 - python=3.9.13=h9a8a25e_0_cpython - python-dateutil=2.8.2=pyhd3eb1b0_0 - python-lmdb=1.3.0=py39he80948d_0 - python_abi=3.9=2_cp39 - pytorch=1.11.0=py3.9_cuda11.3_cudnn8.2.0_0 - pytorch-mutex=1.0=cuda - pywavelets=1.3.0=py39hd257fcd_1 - qimage2ndarray=1.8.3=pyhd8ed1ab_0 - qt-main=5.15.4=ha5833f6_2 - readline=8.1.2=h7f8727e_1 - requests-oauthlib=1.3.0=py_0 - rhash=1.4.3=h166bdaf_0 - s3transfer=0.6.0=pyhd8ed1ab_0 - scikit-image=0.19.3=py39h1832856_0 - scikit-learn=1.1.1=py39h4037b75_0 - scikit-video=1.1.11=pyh24bf2e0_0 - scipy=1.8.1=py39he49c0e8_0 - sentry-sdk=1.6.0=pyhd8ed1ab_0 - setproctitle=1.2.3=py39hb9d737c_0 - setuptools=61.2.0=py39h06a4308_0 - shapely=1.8.2=py39h4fbd0eb_2 - shortuuid=1.0.8=py39hf3d152e_1 - sip=6.5.1=py39he80948d_2 - six=1.16.0=pyhd3eb1b0_1 - smmap=3.0.5=pyh44b312d_0 - snappy=1.1.9=hbd366e4_1 - sqlite=3.39.0=h4ff8645_0 - stack_data=0.3.0=pyhd8ed1ab_0 - svt-av1=1.1.0=h27087fc_1 - tensorboard=2.6.0=py_1 - tensorboard-data-server=0.6.0=py39hca6d32c_0 - tensorboard-plugin-wit=1.6.0=py_0 - threadpoolctl=3.1.0=pyh8a188c0_0 - tifffile=2022.5.4=pyhd8ed1ab_0 - timm=0.4.12=pyhd8ed1ab_0 - tk=8.6.12=h1ccaba5_0 - toml=0.10.2=pyhd8ed1ab_0 - toolz=0.11.2=pyhd8ed1ab_0 - torchaudio=0.11.0=py39_cu113 - torchvision=0.12.0=py39_cu113 - tornado=6.1=py39h27cfd23_0 - tqdm=4.64.0=pyhd8ed1ab_0 - traitlets=5.3.0=pyhd8ed1ab_0 - typing-extensions=4.1.1=hd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - tzdata=2022a=hda174b7_0 - urllib3=1.26.9=py39h06a4308_0 - wandb=0.12.19=pyhd8ed1ab_0 - wcwidth=0.2.5=pyh9f0ad1d_2 - werkzeug=2.0.3=pyhd3eb1b0_0 - wheel=0.37.1=pyhd3eb1b0_0 - x264=1!161.3030=h7f98852_1 - x265=3.5=h924138e_3 - xcb-util=0.4.0=h166bdaf_0 - xcb-util-image=0.4.0=h166bdaf_0 - xcb-util-keysyms=0.4.0=h166bdaf_0 - xcb-util-renderutil=0.3.9=h166bdaf_0 - xcb-util-wm=0.4.1=h166bdaf_0 - xorg-fixesproto=5.0=h7f98852_1002 - xorg-inputproto=2.3.2=h7f98852_1002 - xorg-kbproto=1.0.7=h7f98852_1002 - xorg-libice=1.0.10=h7f98852_0 - xorg-libsm=1.2.3=hd9c2040_1000 - xorg-libx11=1.7.2=h7f98852_0 - xorg-libxau=1.0.9=h7f98852_0 - xorg-libxdmcp=1.1.3=h7f98852_0 - xorg-libxext=1.3.4=h7f98852_1 - xorg-libxfixes=5.0.3=h7f98852_1004 - xorg-libxi=1.7.10=h7f98852_0 - xorg-libxrender=0.9.10=h7f98852_1003 - xorg-renderproto=0.11.1=h7f98852_1002 - xorg-xextproto=7.3.0=h7f98852_1002 - xorg-xproto=7.0.31=h7f98852_1007 - xz=5.2.5=h7f8727e_1 - yaml=0.2.5=h7f98852_2 - yarl=1.6.3=py39h27cfd23_0 - zfp=0.5.5=h9c3ff4c_8 - zipp=3.8.0=py39h06a4308_0 - zlib=1.2.12=h166bdaf_1 - zlib-ng=2.0.6=h166bdaf_0 - zstd=1.5.2=ha4553b6_0 - pip: - av==9.2.0 - awscli==1.25.18 - awscli-plugin-endpoint==0.4 - beautifulsoup4==4.11.1 - bias-act-cuda==0.0.0 - botocore==1.27.18 - channelnorm-cuda==0.0.0 - chardet==4.0.0 - clean-fid==0.1.24 - colorama==0.4.4 - correlation-cuda==0.0.0 - docutils==0.16 - face-alignment==1.3.5 - filelock==3.7.1 - gdown==4.5.1 - idna==2.10 - llvmlite==0.38.1 - lpips==0.1.4 - numba==0.55.2 - nvidia-ml-py3==7.352.0 - opencv-python==4.6.0.66 - pytz==2022.1 - pyyaml==5.4.1 - requests==2.25.1 - resample2d-cuda==0.0.0 - rsa==4.7.2 - soupsieve==2.3.2.post1 - upfirdn2d-cuda==0.0.0 ```
hello-trouble commented 2 years ago

Thank you very much for your kindly help. I also encounter this similar problem when I run the bash as follows: conda env create --file scripts/requirements_conda.yaml but it fails with the following information:

FileNotFoundError(2, "No such file or directory: '/home/hello_LY/anaconda3/envs/imaginaire/bin/python3.8'")

Looking forward to your help.

Geniussh commented 2 years ago

Note requirements_conda.yaml installed Python3.9, so I do not know where that "cannot find python3.8" error comes from