Failed clean install of Pytorch

Hi!
I have a fresh install of Anaconda on Ubuntu 20.04 LTS and tried to install the latest version of Pytorch in a newly created conda environment but it “fails” - specifically, when I try to import torch, get the following error
OSError: libcufft.so.10: cannot open shared object file: No such file or directory

This is correct - the installation installs v11:
/home/mathias/anaconda3/envs/pytorch13/lib/libcufft.so /home/mathias/anaconda3/envs/pytorch13/lib/libcufft.so.11.0.0.21 /home/mathias/anaconda3/envs/pytorch13/lib/libcufftw.so.11
/home/mathias/anaconda3/envs/pytorch13/lib/libcufft.so.11 /home/mathias/anaconda3/envs/pytorch13/lib/libcufftw.so /home/mathias/anaconda3/envs/pytorch13/lib/libcufftw.so.11.0.0.21

What am I doing wrong and how do I rectify this ?
Best regards and thanks in advance,
Mathias

More details - step by step of what I did:
(base) mathias@mathias-System-Product-Name:~$ conda create -n pytorch13
Collecting package metadata (current_repodata.json): done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
current version: 22.9.0
latest version: 22.11.1

Please update conda by running

$ conda update -n base -c defaults conda

Package Plan

environment location: /home/mathias/anaconda3/envs/pytorch13

Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

To activate this environment, use

$ conda activate pytorch13

To deactivate an active environment, use

$ conda deactivate

Retrieving notices: …working… done
(base) mathias@mathias-System-Product-Name:~$ conda activate pytorch13

(pytorch13) mathias@mathias-System-Product-Name:~$ conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
current version: 22.9.0
latest version: 22.11.1

Please update conda by running

$ conda update -n base -c defaults conda

Package Plan

environment location: /home/mathias/anaconda3/envs/pytorch13

added / updated specs:
- pytorch
- pytorch-cuda=11.7
- torchaudio
- torchvision

The following packages will be downloaded:
(Long list of packages …)
The following NEW packages will be INSTALLED:
(Long list of packages …)

Proceed ([y]/n)? y

Downloading and Extracting Packages
(Packages are being downloaded …)

(pytorch13) mathias@mathias-System-Product-Name:~$ which python
/home/mathias/anaconda3/envs/pytorch13/bin/python

(pytorch13) mathias@mathias-System-Product-Name:~$ python
Python 3.10.8 (main, Nov 24 2022, 14:13:03) [GCC 11.2.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import torch
Traceback (most recent call last):
File “”, line 1, in
File “/home/mathias/anaconda3/envs/pytorch13/lib/python3.10/site-packages/torch/init.py”, line 191, in
_load_global_deps()
File “/home/mathias/anaconda3/envs/pytorch13/lib/python3.10/site-packages/torch/init.py”, line 153, in _load_global_deps
ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
File “/home/mathias/anaconda3/envs/pytorch13/lib/python3.10/ctypes/init.py”, line 374, in init
self._handle = _dlopen(self._name, mode)
OSError: libcufft.so.10: cannot open shared object file: No such file or directory

Additional info (if it matters):
(pytorch13) mathias@mathias-System-Product-Name:~$ nvidia-smi
Mon Dec 12 00:34:56 2022
±----------------------------------------------------------------------------+
| NVIDIA-SMI 515.86.01 Driver Version: 515.86.01 CUDA Version: 11.7 |
|-------------------------------±---------------------±---------------------+

(pytorch13) mathias@mathias-System-Product-Name:~/anaconda3/envs/pytorch13/lib$ conda list

packages in environment at /home/mathias/anaconda3/envs/pytorch13:

Name Version Build Channel

_libgcc_mutex 0.1 main
_openmp_mutex 5.1 1_gnu
blas 1.0 mkl
brotlipy 0.7.0 py310h7f8727e_1002
bzip2 1.0.8 h7b6447c_0
ca-certificates 2022.10.11 h06a4308_0
certifi 2022.9.24 py310h06a4308_0
cffi 1.15.1 py310h5eee18b_3
charset-normalizer 2.0.4 pyhd3eb1b0_0
cryptography 38.0.1 py310h9ce1e76_0
cuda 11.7.1 0 nvidia
cuda-cccl 11.7.91 0 nvidia
cuda-command-line-tools 11.7.1 0 nvidia
cuda-compiler 11.7.1 0 nvidia
cuda-cudart 11.7.99 0 nvidia
cuda-cudart-dev 11.7.99 0 nvidia
cuda-cuobjdump 11.7.91 0 nvidia
cuda-cupti 11.7.101 0 nvidia
cuda-cuxxfilt 11.7.91 0 nvidia
cuda-demo-suite 12.0.76 0 nvidia
cuda-documentation 12.0.76 0 nvidia
cuda-driver-dev 11.7.99 0 nvidia
cuda-gdb 12.0.90 0 nvidia
cuda-libraries 11.7.1 0 nvidia
cuda-libraries-dev 11.7.1 0 nvidia
cuda-memcheck 11.8.86 0 nvidia
cuda-nsight 12.0.78 0 nvidia
cuda-nsight-compute 12.0.0 0 nvidia
cuda-nvcc 11.7.99 0 nvidia
cuda-nvdisasm 12.0.76 0 nvidia
cuda-nvml-dev 11.7.91 0 nvidia
cuda-nvprof 12.0.90 0 nvidia
cuda-nvprune 11.7.91 0 nvidia
cuda-nvrtc 11.7.99 0 nvidia
cuda-nvrtc-dev 11.7.99 0 nvidia
cuda-nvtx 11.7.91 0 nvidia
cuda-nvvp 12.0.90 0 nvidia
cuda-runtime 11.7.1 0 nvidia
cuda-sanitizer-api 12.0.90 0 nvidia
cuda-toolkit 11.7.1 0 nvidia
cuda-tools 11.7.1 0 nvidia
cuda-visual-tools 11.7.1 0 nvidia
ffmpeg 4.3 hf484d3e_0 pytorch
flit-core 3.6.0 pyhd3eb1b0_0
freetype 2.12.1 h4a9f257_0
gds-tools 1.5.0.59 0 nvidia
giflib 5.2.1 h7b6447c_0
gmp 6.2.1 h295c915_3
gnutls 3.6.15 he1e5248_0
idna 3.4 py310h06a4308_0
intel-openmp 2021.4.0 h06a4308_3561
jpeg 9e h7f8727e_0
lame 3.100 h7b6447c_0
lcms2 2.12 h3be6417_0
ld_impl_linux-64 2.38 h1181459_1
lerc 3.0 h295c915_0
libcublas 12.0.1.189 0 nvidia
libcublas-dev 12.0.1.189 0 nvidia
libcufft 11.0.0.21 0 nvidia
libcufft-dev 11.0.0.21 0 nvidia
libcufile 1.5.0.59 0 nvidia
libcufile-dev 1.5.0.59 0 nvidia
libcurand 10.3.1.50 0 nvidia
libcurand-dev 10.3.1.50 0 nvidia
libcusolver 11.4.2.57 0 nvidia
libcusolver-dev 11.4.2.57 0 nvidia
libcusparse 12.0.0.76 0 nvidia
libcusparse-dev 12.0.0.76 0 nvidia
libdeflate 1.8 h7f8727e_5
libffi 3.4.2 h6a678d5_6
libgcc-ng 11.2.0 h1234567_1
libgomp 11.2.0 h1234567_1
libiconv 1.16 h7f8727e_2
libidn2 2.3.2 h7f8727e_0
libnpp 12.0.0.30 0 nvidia
libnpp-dev 12.0.0.30 0 nvidia
libnvjpeg 12.0.0.28 0 nvidia
libnvjpeg-dev 12.0.0.28 0 nvidia
libpng 1.6.37 hbc83047_0
libstdcxx-ng 11.2.0 h1234567_1
libtasn1 4.16.0 h27cfd23_0
libtiff 4.4.0 hecacb30_2
libunistring 0.9.10 h27cfd23_0
libuuid 1.41.5 h5eee18b_0
libwebp 1.2.4 h11a3e52_0
libwebp-base 1.2.4 h5eee18b_0
lz4-c 1.9.3 h295c915_1
mkl 2021.4.0 h06a4308_640
mkl-service 2.4.0 py310h7f8727e_0
mkl_fft 1.3.1 py310hd6ae3a3_0
mkl_random 1.2.2 py310h00e6091_0
ncurses 6.3 h5eee18b_3
nettle 3.7.3 hbbd107a_1
nsight-compute 2022.4.0.15 0 nvidia
numpy 1.23.4 py310hd5efca6_0
numpy-base 1.23.4 py310h8e6c178_0
openh264 2.1.1 h4ff587b_0
openssl 1.1.1s h7f8727e_0
pillow 9.2.0 py310hace64e9_1
pip 22.3.1 py310h06a4308_0
pycparser 2.21 pyhd3eb1b0_0
pyopenssl 22.0.0 pyhd3eb1b0_0
pysocks 1.7.1 py310h06a4308_0
python 3.10.8 h7a1cb2a_1
pytorch 1.13.0 py3.10_cuda11.7_cudnn8.5.0_0 pytorch
pytorch-cuda 11.7 h67b0de4_0 pytorch
pytorch-mutex 1.0 cuda pytorch
readline 8.2 h5eee18b_0
requests 2.28.1 py310h06a4308_0
setuptools 65.5.0 py310h06a4308_0
six 1.16.0 pyhd3eb1b0_1
sqlite 3.40.0 h5082296_0
tk 8.6.12 h1ccaba5_0
torchaudio 0.13.0 py310_cu117 pytorch
torchvision 0.14.0 py310_cu117 pytorch
typing_extensions 4.4.0 py310h06a4308_0
tzdata 2022g h04d1e81_0
urllib3 1.26.13 py310h06a4308_0
wheel 0.37.1 pyhd3eb1b0_0
xz 5.2.8 h5eee18b_0
zlib 1.2.13 h5eee18b_0
zstd 1.5.2 ha4553b6_0

I cannot reproduce the issue using the 1.13.0 conda binaries with the CUDA 11.7 runtime:

conda create -n 1.13.0_conda_cu117 python=3.8
...
conda activate 1.13.0_conda_cu117
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
...
The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    cuda-11.7.1                |                0           1 KB  nvidia
    cuda-cccl-11.7.91          |                0         1.2 MB  nvidia
    cuda-command-line-tools-11.7.1|                0           1 KB  nvidia
    cuda-compiler-11.7.1       |                0           1 KB  nvidia
    cuda-cudart-11.7.99        |                0         194 KB  nvidia
    cuda-cudart-dev-11.7.99    |                0         1.1 MB  nvidia
    cuda-cuobjdump-11.7.91     |                0         158 KB  nvidia
    cuda-cupti-11.7.101        |                0        22.9 MB  nvidia
    cuda-cuxxfilt-11.7.91      |                0         293 KB  nvidia
    cuda-demo-suite-12.0.76    |                0         5.0 MB  nvidia
    cuda-documentation-12.0.76 |                0          89 KB  nvidia
    cuda-driver-dev-11.7.99    |                0          16 KB  nvidia
    cuda-gdb-12.0.90           |                0         5.3 MB  nvidia
    cuda-libraries-11.7.1      |                0           1 KB  nvidia
    cuda-libraries-dev-11.7.1  |                0           2 KB  nvidia
    cuda-nsight-12.0.78        |                0       113.6 MB  nvidia
    cuda-nsight-compute-12.0.0 |                0           1 KB  nvidia
    cuda-nvcc-11.7.99          |                0        42.7 MB  nvidia
    cuda-nvdisasm-12.0.76      |                0        47.9 MB  nvidia
    cuda-nvml-dev-11.7.91      |                0          80 KB  nvidia
    cuda-nvprof-12.0.90        |                0         4.3 MB  nvidia
    cuda-nvprune-11.7.91       |                0          64 KB  nvidia
    cuda-nvrtc-11.7.99         |                0        17.3 MB  nvidia
    cuda-nvrtc-dev-11.7.99     |                0        16.9 MB  nvidia
    cuda-nvtx-11.7.91          |                0          57 KB  nvidia
    cuda-nvvp-12.0.90          |                0       114.3 MB  nvidia
    cuda-runtime-11.7.1        |                0           1 KB  nvidia
    cuda-sanitizer-api-12.0.90 |                0        16.6 MB  nvidia
    cuda-toolkit-11.7.1        |                0           1 KB  nvidia
    cuda-tools-11.7.1          |                0           1 KB  nvidia
    cuda-visual-tools-11.7.1   |                0           1 KB  nvidia
    gds-tools-1.5.0.59         |                0        40.9 MB  nvidia
    libcublas-12.0.1.189       |                0       323.3 MB  nvidia
    libcublas-dev-12.0.1.189   |                0          74 KB  nvidia
    libcufft-11.0.0.21         |                0        75.5 MB  nvidia
    libcufft-dev-11.0.0.21     |                0          14 KB  nvidia
    libcufile-1.5.0.59         |                0         754 KB  nvidia
    libcufile-dev-1.5.0.59     |                0          13 KB  nvidia
    libcurand-10.3.1.50        |                0        51.7 MB  nvidia
    libcurand-dev-10.3.1.50    |                0         449 KB  nvidia
    libcusolver-11.4.2.57      |                0        98.3 MB  nvidia
    libcusolver-dev-11.4.2.57  |                0          50 KB  nvidia
    libcusparse-12.0.0.76      |                0       133.6 MB  nvidia
    libcusparse-dev-12.0.0.76  |                0       133.6 MB  nvidia
    libnpp-12.0.0.30           |                0       139.3 MB  nvidia
    libnpp-dev-12.0.0.30       |                0         513 KB  nvidia
    libnvjpeg-12.0.0.28        |                0         2.3 MB  nvidia
    libnvjpeg-dev-12.0.0.28    |                0          13 KB  nvidia
    nsight-compute-2022.4.0.15 |                0       764.0 MB  nvidia
    pytorch-1.13.0             |py3.8_cuda11.7_cudnn8.5.0_0        1.15 GB  pytorch
    pytorch-cuda-11.7          |       h67b0de4_0           7 KB  pytorch
    pytorch-mutex-1.0          |             cuda           3 KB  pytorch
    torchaudio-0.13.0          |       py38_cu117         6.5 MB  pytorch
    torchvision-0.14.0         |       py38_cu117        29.5 MB  pytorch
    ------------------------------------------------------------
                                           Total:        3.30 GB

Output:

python
>>> import torch
>>> torch.__version__
'1.13.0'
>>> torch.version.cuda
'11.7'
>>> torch.randn(1).cuda()
tensor([0.5558], device='cuda:0')

Thank you for your prompt reply. Unfortunately, I still have the same problem.

Do you get any of the following while solving the environment ?
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.

Also, do you know how I can change the input to
lib/python3.8/site-packages/torch/init.py
so that it wants v11 instead of v10 ?

Thanks again!
Mathias

I don’t think you should try to manipulate any installed PyTorch files, as the issue seems to come from your conda env and fixing one issues could result in other failures.
Could you check if your base conda env contains any PyTorch installations and delete them if that’s the case?

Good idea. I had a Pytorch version installed, but removing it did not resolve the issue.
However, I managed to get the 2.0-version to work, so maybe I’ll just stick to that one.
Thank you for all your help.