# Pytorch failed after opencv installation

**URL:** <https://forum.opencv.org/t/pytorch-failed-after-opencv-installation/12318>\
**Category:** Python\
**Created:** [March 11, 2023, 8:11am UTC](https://forum.opencv.org/t/pytorch-failed-after-opencv-installation/12318 "2023-03-11T08:11:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dongho](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@dongho](https://forum.opencv.org/u/dongho)\
**Post date:** [March 11, 2023, 8:11am UTC](https://forum.opencv.org/t/pytorch-failed-after-opencv-installation/12318/1 "2023-03-11T08:11:04Z")

</div>

My python system is anaconda on ubuntu 22.04.

If I install pytorch after installing opencv, pytorch cuda stops working.

> > > torch.cuda.is\_available()  
> > > False

Pytorch worked well before I installed opencv.

If I install opencv after installing pytorch, it takes so much time than usual. Sometimes it returns with “find conflicts …” then I have to cancel the installation.

Finally I succeeded in installing opencv after pytorch, but then pytorch failed too.

```auto
$ conda install -c conda-forge opencv
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: done
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: done

## Package Plan ##

  environment location: /mnt/nvme/anaconda3/envs/torch

  added / updated specs:
    - opencv

The following packages will be downloaded:

    package | build
    ---------------------------|-----------------
    alsa-lib-1.2.8 | h166bdaf_0 578 KB conda-forge
    aom-3.5.0 | h27087fc_0 2.7 MB conda-forge
    attr-2.5.1 | h166bdaf_1 69 KB conda-forge
    blas-2.116 | openblas 13 KB conda-forge
    blas-devel-3.9.0 |16_linux64_openblas 12 KB conda-forge
    cairo-1.16.0 | ha61ee94_1014 1.5 MB conda-forge
    dbus-1.13.6 | h5008d03_3 604 KB conda-forge
    expat-2.5.0 | h27087fc_0 189 KB conda-forge
    ffmpeg-5.1.2 | gpl_h8dda1f0_106 9.2 MB conda-forge
    fftw-3.3.10 |nompi_hf0379b8_106 2.1 MB conda-forge
    font-ttf-dejavu-sans-mono-2.37| hab24e00_0 388 KB conda-forge
    font-ttf-inconsolata-3.000 | h77eed37_0 94 KB conda-forge
    font-ttf-source-code-pro-2.038| h77eed37_0 684 KB conda-forge
    font-ttf-ubuntu-0.83 | hab24e00_0 1.9 MB conda-forge
    fontconfig-2.14.2 | h14ed4e7_0 266 KB conda-forge
    fonts-conda-ecosystem-1 | 0 4 KB conda-forge
    fonts-conda-forge-1 | 0 4 KB conda-forge
    freeglut-3.2.2 | h9c3ff4c_1 162 KB conda-forge
    gettext-0.21.1 | h27087fc_0 4.1 MB conda-forge
    glib-2.74.1 | h6239696_1 474 KB conda-forge
    glib-tools-2.74.1 | h6239696_1 107 KB conda-forge
    gnutls-3.7.8 | hf3e180e_0 2.2 MB conda-forge
    graphite2-1.3.13 | h58526e2_1001 102 KB conda-forge
    gst-plugins-base-1.22.0 | h4243ec0_2 2.6 MB conda-forge
    gstreamer-1.22.0 | h25f0c4b_2 1.9 MB conda-forge
    gstreamer-orc-0.4.33 | h166bdaf_0 299 KB conda-forge
    harfbuzz-6.0.0 | h8e241bc_0 1.2 MB conda-forge
    hdf5-1.14.0 |nompi_hb72d44e_103 3.4 MB conda-forge
    jack-1.9.22 | h11f4161_0 453 KB conda-forge
    jasper-2.0.33 | h0ff4b12_1 709 KB conda-forge
    krb5-1.20.1 | h81ceb04_0 1.3 MB conda-forge
    libcap-2.66 | ha37c62d_0 97 KB conda-forge
    libclang-15.0.7 |default_had23c3d_1 130 KB conda-forge
    libclang13-15.0.7 |default_h3e3d535_1 9.1 MB conda-forge
    libcups-2.3.3 | h36d4200_3 4.3 MB conda-forge
    libcurl-7.88.1 | hdc1c0ab_0 350 KB conda-forge
    libdb-6.2.32 | h9c3ff4c_0 23.3 MB conda-forge
    libdrm-2.4.114 | h166bdaf_0 298 KB conda-forge
    libevent-2.1.10 | h28343ad_4 1.1 MB conda-forge
    libflac-1.4.2 | h27087fc_0 411 KB conda-forge
    libgcrypt-1.10.1 | h166bdaf_0 703 KB conda-forge
    libglib-2.74.1 | h606061b_1 3.1 MB conda-forge
    libglu-9.0.0 | he1b5a44_1001 413 KB conda-forge
    libgomp-12.2.0 | h65d4601_19 455 KB conda-forge
    libgpg-error-1.46 | h620e276_0 252 KB conda-forge
    libhwloc-2.9.0 | hd6dc26d_0 2.4 MB conda-forge
    libiconv-1.17 | h166bdaf_0 1.4 MB conda-forge
    liblapacke-3.9.0 |16_linux64_openblas 13 KB conda-forge
    libllvm15-15.0.7 | hadd5161_0 31.5 MB conda-forge
    libnghttp2-1.52.0 | h61bc06f_0 608 KB conda-forge
    libnsl-2.0.0 | h7f98852_0 31 KB conda-forge
    libogg-1.3.4 | h7f98852_1 206 KB conda-forge
    libopencv-4.7.0 | py39h2ca4621_1 29.1 MB conda-forge
    libpciaccess-0.17 | h166bdaf_0 39 KB conda-forge
    libpq-15.2 | hb675445_0 2.3 MB conda-forge
    libsndfile-1.2.0 | hb75c966_0 342 KB conda-forge
    libssh2-1.10.0 | hf14f497_3 234 KB conda-forge
    libsystemd0-252 | h2a991cd_0 384 KB conda-forge
    libtasn1-4.19.0 | h166bdaf_0 114 KB conda-forge
    libtool-2.4.7 | h27087fc_0 402 KB conda-forge
    libudev1-253 | h0b41bf4_0 116 KB conda-forge
    libva-2.17.0 | h0b41bf4_0 183 KB conda-forge
    libvorbis-1.3.7 | h9c3ff4c_0 280 KB conda-forge
    libvpx-1.11.0 | h9c3ff4c_3 1.1 MB conda-forge
    libxcb-1.13 | h7f98852_1004 391 KB conda-forge
    libxkbcommon-1.5.0 | h79f4944_0 549 KB conda-forge
    libxml2-2.10.3 | h7463322_0 754 KB conda-forge
    mkl-2022.2.1 | h84fe81f_16997 157.3 MB conda-forge
    mkl-service-2.4.0 | py39hb699420_0 55 KB conda-forge
    mkl_fft-1.3.3 | py39h53ac84d_0 195 KB conda-forge
    mkl_random-1.2.2 | py39h8b66066_1 370 KB conda-forge
    mpg123-1.31.2 | hcb278e6_0 474 KB conda-forge
    mysql-common-8.0.32 | ha901b37_0 727 KB conda-forge
    mysql-libs-8.0.32 | hd7da12d_0 1.5 MB conda-forge
    nettle-3.8.1 | hc379101_1 1.1 MB conda-forge
    nspr-4.35 | h27087fc_0 222 KB conda-forge
    nss-3.89 | he45b914_0 1.9 MB conda-forge
    openblas-0.3.21 |pthreads_h320a7e8_3 10.8 MB conda-forge
    opencv-4.7.0 | py39hf3d152e_1 24 KB conda-forge
    openh264-2.3.1 | hcb278e6_2 702 KB conda-forge
    openssl-3.0.8 | h0b41bf4_0 2.5 MB conda-forge
    p11-kit-0.24.1 | hc5aa10d_0 4.5 MB conda-forge
    pcre2-10.40 | hc3806b6_0 2.3 MB conda-forge
    pixman-0.40.0 | h36c2ea0_0 627 KB conda-forge
    pthread-stubs-0.4 | h36c2ea0_1001 5 KB conda-forge
    pulseaudio-16.1 | ha8d29e2_1 1.5 MB conda-forge
    py-opencv-4.7.0 | py39hcca971b_1 1.1 MB conda-forge
    python-3.9.16 |h2782a2a_0_cpython 23.0 MB conda-forge
    python_abi-3.9 | 3_cp39 6 KB conda-forge
    pytorch-1.13.1 |cpu_py39h14c4022_1 60.9 MB conda-forge
    qt-main-5.15.8 | h5d23da1_6 50.0 MB conda-forge
    sleef-3.5.1 | h9b69904_2 1.5 MB conda-forge
    svt-av1-1.4.1 | hcb278e6_0 2.4 MB conda-forge
    tbb-2021.8.0 | hf52228f_0 1.4 MB conda-forge
    x264-1!164.3095 | h166bdaf_2 877 KB conda-forge
    x265-3.5 | h924138e_3 3.2 MB conda-forge
    xcb-util-0.4.0 | h166bdaf_0 20 KB conda-forge
    xcb-util-image-0.4.0 | h166bdaf_0 24 KB conda-forge
    xcb-util-keysyms-0.4.0 | h166bdaf_0 12 KB conda-forge
    xcb-util-renderutil-0.3.9 | h166bdaf_0 15 KB conda-forge
    xcb-util-wm-0.4.1 | h166bdaf_0 55 KB conda-forge
    xorg-fixesproto-5.0 | h7f98852_1002 9 KB conda-forge
    xorg-inputproto-2.3.2 | h7f98852_1002 19 KB conda-forge
    xorg-libx11-1.8.4 | h0b41bf4_0 810 KB conda-forge
    xorg-libxau-1.0.9 | h7f98852_0 13 KB conda-forge
    xorg-libxdmcp-1.1.3 | h7f98852_0 19 KB conda-forge
    xorg-libxext-1.3.4 | h0b41bf4_2 49 KB conda-forge
    xorg-libxfixes-5.0.3 | h7f98852_1004 18 KB conda-forge
    xorg-libxi-1.7.10 | h7f98852_0 46 KB conda-forge
    xorg-libxrender-0.9.10 | h7f98852_1003 32 KB conda-forge
    xorg-xextproto-7.3.0 | h0b41bf4_1003 30 KB conda-forge
    ------------------------------------------------------------
                                           Total: 487.7 MB

The following NEW packages will be INSTALLED:

  alsa-lib conda-forge/linux-64::alsa-lib-1.2.8-h166bdaf_0 
  aom conda-forge/linux-64::aom-3.5.0-h27087fc_0 
  attr conda-forge/linux-64::attr-2.5.1-h166bdaf_1 
  blas-devel conda-forge/linux-64::blas-devel-3.9.0-16_linux64_openblas 
  c-ares conda-forge/linux-64::c-ares-1.18.1-h7f98852_0 
  cairo conda-forge/linux-64::cairo-1.16.0-ha61ee94_1014 
  dbus conda-forge/linux-64::dbus-1.13.6-h5008d03_3 
  expat conda-forge/linux-64::expat-2.5.0-h27087fc_0 
  fftw conda-forge/linux-64::fftw-3.3.10-nompi_hf0379b8_106 
  font-ttf-dejavu-s~ conda-forge/noarch::font-ttf-dejavu-sans-mono-2.37-hab24e00_0 
  font-ttf-inconsol~ conda-forge/noarch::font-ttf-inconsolata-3.000-h77eed37_0 
  font-ttf-source-c~ conda-forge/noarch::font-ttf-source-code-pro-2.038-h77eed37_0 
  font-ttf-ubuntu conda-forge/noarch::font-ttf-ubuntu-0.83-hab24e00_0 
  fontconfig conda-forge/linux-64::fontconfig-2.14.2-h14ed4e7_0 
  fonts-conda-ecosy~ conda-forge/noarch::fonts-conda-ecosystem-1-0 
  fonts-conda-forge conda-forge/noarch::fonts-conda-forge-1-0 
  freeglut conda-forge/linux-64::freeglut-3.2.2-h9c3ff4c_1 
  gettext conda-forge/linux-64::gettext-0.21.1-h27087fc_0 
  glib conda-forge/linux-64::glib-2.74.1-h6239696_1 
  glib-tools conda-forge/linux-64::glib-tools-2.74.1-h6239696_1 
  graphite2 conda-forge/linux-64::graphite2-1.3.13-h58526e2_1001 
  gst-plugins-base conda-forge/linux-64::gst-plugins-base-1.22.0-h4243ec0_2 
  gstreamer conda-forge/linux-64::gstreamer-1.22.0-h25f0c4b_2 
  gstreamer-orc conda-forge/linux-64::gstreamer-orc-0.4.33-h166bdaf_0 
  harfbuzz conda-forge/linux-64::harfbuzz-6.0.0-h8e241bc_0 
  hdf5 conda-forge/linux-64::hdf5-1.14.0-nompi_hb72d44e_103 
  icu conda-forge/linux-64::icu-70.1-h27087fc_0 
  jack conda-forge/linux-64::jack-1.9.22-h11f4161_0 
  jasper conda-forge/linux-64::jasper-2.0.33-h0ff4b12_1 
  keyutils conda-forge/linux-64::keyutils-1.6.1-h166bdaf_0 
  krb5 conda-forge/linux-64::krb5-1.20.1-h81ceb04_0 
  libaec conda-forge/linux-64::libaec-1.0.6-hcb278e6_1 
  libblas conda-forge/linux-64::libblas-3.9.0-16_linux64_openblas 
  libcap conda-forge/linux-64::libcap-2.66-ha37c62d_0 
  libcblas conda-forge/linux-64::libcblas-3.9.0-16_linux64_openblas 
  libclang conda-forge/linux-64::libclang-15.0.7-default_had23c3d_1 
  libclang13 conda-forge/linux-64::libclang13-15.0.7-default_h3e3d535_1 
  libcups conda-forge/linux-64::libcups-2.3.3-h36d4200_3 
  libcurl conda-forge/linux-64::libcurl-7.88.1-hdc1c0ab_0 
  libdb conda-forge/linux-64::libdb-6.2.32-h9c3ff4c_0 
  libdrm conda-forge/linux-64::libdrm-2.4.114-h166bdaf_0 
  libedit conda-forge/linux-64::libedit-3.1.20191231-he28a2e2_2 
  libev conda-forge/linux-64::libev-4.33-h516909a_1 
  libevent conda-forge/linux-64::libevent-2.1.10-h28343ad_4 
  libflac conda-forge/linux-64::libflac-1.4.2-h27087fc_0 
  libgcrypt conda-forge/linux-64::libgcrypt-1.10.1-h166bdaf_0 
  libgfortran-ng conda-forge/linux-64::libgfortran-ng-12.2.0-h69a702a_19 
  libgfortran5 conda-forge/linux-64::libgfortran5-12.2.0-h337968e_19 
  libglib conda-forge/linux-64::libglib-2.74.1-h606061b_1 
  libglu conda-forge/linux-64::libglu-9.0.0-he1b5a44_1001 
  libgpg-error conda-forge/linux-64::libgpg-error-1.46-h620e276_0 
  libhwloc conda-forge/linux-64::libhwloc-2.9.0-hd6dc26d_0 
  liblapack conda-forge/linux-64::liblapack-3.9.0-16_linux64_openblas 
  liblapacke conda-forge/linux-64::liblapacke-3.9.0-16_linux64_openblas 
  libllvm15 conda-forge/linux-64::libllvm15-15.0.7-hadd5161_0 
  libnghttp2 conda-forge/linux-64::libnghttp2-1.52.0-h61bc06f_0 
  libnsl conda-forge/linux-64::libnsl-2.0.0-h7f98852_0 
  libogg conda-forge/linux-64::libogg-1.3.4-h7f98852_1 
  libopenblas conda-forge/linux-64::libopenblas-0.3.21-pthreads_h78a6416_3 
  libopencv conda-forge/linux-64::libopencv-4.7.0-py39h2ca4621_1 
  libopus conda-forge/linux-64::libopus-1.3.1-h7f98852_1 
  libpciaccess conda-forge/linux-64::libpciaccess-0.17-h166bdaf_0 
  libpq conda-forge/linux-64::libpq-15.2-hb675445_0 
  libprotobuf conda-forge/linux-64::libprotobuf-3.21.12-h3eb15da_0 
  libsndfile conda-forge/linux-64::libsndfile-1.2.0-hb75c966_0 
  libsqlite conda-forge/linux-64::libsqlite-3.40.0-h753d276_0 
  libssh2 conda-forge/linux-64::libssh2-1.10.0-hf14f497_3 
  libsystemd0 conda-forge/linux-64::libsystemd0-252-h2a991cd_0 
  libtool conda-forge/linux-64::libtool-2.4.7-h27087fc_0 
  libudev1 conda-forge/linux-64::libudev1-253-h0b41bf4_0 
  libuuid conda-forge/linux-64::libuuid-2.32.1-h7f98852_1000 
  libva conda-forge/linux-64::libva-2.17.0-h0b41bf4_0 
  libvorbis conda-forge/linux-64::libvorbis-1.3.7-h9c3ff4c_0 
  libvpx conda-forge/linux-64::libvpx-1.11.0-h9c3ff4c_3 
  libxcb conda-forge/linux-64::libxcb-1.13-h7f98852_1004 
  libxkbcommon conda-forge/linux-64::libxkbcommon-1.5.0-h79f4944_0 
  libxml2 conda-forge/linux-64::libxml2-2.10.3-h7463322_0 
  libzlib conda-forge/linux-64::libzlib-1.2.13-h166bdaf_4 
  llvm-openmp conda-forge/linux-64::llvm-openmp-15.0.7-h0cdce71_0 
  mpg123 conda-forge/linux-64::mpg123-1.31.2-hcb278e6_0 
  mysql-common conda-forge/linux-64::mysql-common-8.0.32-ha901b37_0 
  mysql-libs conda-forge/linux-64::mysql-libs-8.0.32-hd7da12d_0 
  nspr conda-forge/linux-64::nspr-4.35-h27087fc_0 
  nss conda-forge/linux-64::nss-3.89-he45b914_0 
  openblas conda-forge/linux-64::openblas-0.3.21-pthreads_h320a7e8_3 
  opencv conda-forge/linux-64::opencv-4.7.0-py39hf3d152e_1 
  p11-kit conda-forge/linux-64::p11-kit-0.24.1-hc5aa10d_0 
  pcre2 conda-forge/linux-64::pcre2-10.40-hc3806b6_0 
  pixman conda-forge/linux-64::pixman-0.40.0-h36c2ea0_0 
  pthread-stubs conda-forge/linux-64::pthread-stubs-0.4-h36c2ea0_1001 
  pulseaudio conda-forge/linux-64::pulseaudio-16.1-ha8d29e2_1 
  py-opencv conda-forge/linux-64::py-opencv-4.7.0-py39hcca971b_1 
  python_abi conda-forge/linux-64::python_abi-3.9-3_cp39 
  qt-main conda-forge/linux-64::qt-main-5.15.8-h5d23da1_6 
  sleef conda-forge/linux-64::sleef-3.5.1-h9b69904_2 
  svt-av1 conda-forge/linux-64::svt-av1-1.4.1-hcb278e6_0 
  tbb conda-forge/linux-64::tbb-2021.8.0-hf52228f_0 
  x264 conda-forge/linux-64::x264-1!164.3095-h166bdaf_2 
  x265 conda-forge/linux-64::x265-3.5-h924138e_3 
  xcb-util conda-forge/linux-64::xcb-util-0.4.0-h166bdaf_0 
  xcb-util-image conda-forge/linux-64::xcb-util-image-0.4.0-h166bdaf_0 
  xcb-util-keysyms conda-forge/linux-64::xcb-util-keysyms-0.4.0-h166bdaf_0 
  xcb-util-renderut~ conda-forge/linux-64::xcb-util-renderutil-0.3.9-h166bdaf_0 
  xcb-util-wm conda-forge/linux-64::xcb-util-wm-0.4.1-h166bdaf_0 
  xorg-fixesproto conda-forge/linux-64::xorg-fixesproto-5.0-h7f98852_1002 
  xorg-inputproto conda-forge/linux-64::xorg-inputproto-2.3.2-h7f98852_1002 
  xorg-kbproto conda-forge/linux-64::xorg-kbproto-1.0.7-h7f98852_1002 
  xorg-libice conda-forge/linux-64::xorg-libice-1.0.10-h7f98852_0 
  xorg-libsm conda-forge/linux-64::xorg-libsm-1.2.3-hd9c2040_1000 
  xorg-libx11 conda-forge/linux-64::xorg-libx11-1.8.4-h0b41bf4_0 
  xorg-libxau conda-forge/linux-64::xorg-libxau-1.0.9-h7f98852_0 
  xorg-libxdmcp conda-forge/linux-64::xorg-libxdmcp-1.1.3-h7f98852_0 
  xorg-libxext conda-forge/linux-64::xorg-libxext-1.3.4-h0b41bf4_2 
  xorg-libxfixes conda-forge/linux-64::xorg-libxfixes-5.0.3-h7f98852_1004 
  xorg-libxi conda-forge/linux-64::xorg-libxi-1.7.10-h7f98852_0 
  xorg-libxrender conda-forge/linux-64::xorg-libxrender-0.9.10-h7f98852_1003 
  xorg-renderproto conda-forge/linux-64::xorg-renderproto-0.11.1-h7f98852_1002 
  xorg-xextproto conda-forge/linux-64::xorg-xextproto-7.3.0-h0b41bf4_1003 
  xorg-xproto conda-forge/linux-64::xorg-xproto-7.0.31-h7f98852_1007 

The following packages will be UPDATED:

  blas pkgs/main::blas-1.0-mkl --> conda-forge::blas-2.116-openblas 
  ffmpeg pytorch::ffmpeg-4.3-hf484d3e_0 --> conda-forge::ffmpeg-5.1.2-gpl_h8dda1f0_106 
  gnutls pkgs/main::gnutls-3.6.15-he1e5248_0 --> conda-forge::gnutls-3.7.8-hf3e180e_0 
  libgcc-ng pkgs/main::libgcc-ng-11.2.0-h1234567_1 --> conda-forge::libgcc-ng-12.2.0-h65d4601_19 
  libgomp pkgs/main::libgomp-11.2.0-h1234567_1 --> conda-forge::libgomp-12.2.0-h65d4601_19 
  libiconv pkgs/main::libiconv-1.16-h7f8727e_2 --> conda-forge::libiconv-1.17-h166bdaf_0 
  libstdcxx-ng pkgs/main::libstdcxx-ng-11.2.0-h12345~ --> conda-forge::libstdcxx-ng-12.2.0-h46fd767_19 
  libtasn1 pkgs/main::libtasn1-4.16.0-h27cfd23_0 --> conda-forge::libtasn1-4.19.0-h166bdaf_0 
  mkl pkgs/main::mkl-2021.4.0-h06a4308_640 --> conda-forge::mkl-2022.2.1-h84fe81f_16997 
  mkl_fft pkgs/main::mkl_fft-1.3.1-py39hd3c417c~ --> conda-forge::mkl_fft-1.3.3-py39h53ac84d_0 
  mkl_random pkgs/main::mkl_random-1.2.2-py39h5113~ --> conda-forge::mkl_random-1.2.2-py39h8b66066_1 
  nettle pkgs/main::nettle-3.7.3-hbbd107a_1 --> conda-forge::nettle-3.8.1-hc379101_1 
  openh264 pkgs/main::openh264-2.1.1-h4ff587b_0 --> conda-forge::openh264-2.3.1-hcb278e6_2 
  openssl pkgs/main::openssl-1.1.1t-h7f8727e_0 --> conda-forge::openssl-3.0.8-h0b41bf4_0 
  pytorch pytorch::pytorch-1.13.1-py3.9_cuda11.~ --> conda-forge::pytorch-1.13.1-cpu_py39h14c4022_1 
  zlib pkgs/main::zlib-1.2.13-h5eee18b_0 --> conda-forge::zlib-1.2.13-h166bdaf_4 

The following packages will be SUPERSEDED by a higher-priority channel:

  _libgcc_mutex pkgs/main::_libgcc_mutex-0.1-main --> conda-forge::_libgcc_mutex-0.1-conda_forge 
  _openmp_mutex pkgs/main::_openmp_mutex-5.1-1_gnu --> conda-forge::_openmp_mutex-4.5-2_kmp_llvm 
  ca-certificates pkgs/main::ca-certificates-2023.01.10~ --> conda-forge::ca-certificates-2022.12.7-ha878542_0 
  certifi pkgs/main/linux-64::certifi-2022.12.7~ --> conda-forge/noarch::certifi-2022.12.7-pyhd8ed1ab_0 
  mkl-service pkgs/main::mkl-service-2.4.0-py39h7f8~ --> conda-forge::mkl-service-2.4.0-py39hb699420_0 
  python pkgs/main::python-3.9.16-h7a1cb2a_2 --> conda-forge::python-3.9.16-h2782a2a_0_cpython 

The following packages will be DOWNGRADED:

  numpy 1.23.5-py39h14f4228_0 --> 1.23.5-py39hf838250_0 
  numpy-base 1.23.5-py39h31eccc5_0 --> 1.23.5-py39h1e6e340_0 

Proceed ([y]/n)?

```

---

<div class="post-metadata">

**Author:** ![HY\_Lou](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/hy_lou/32/8526_2.png) [@HY\_Lou](https://forum.opencv.org/u/HY_Lou)\
**Post date:** [August 13, 2023, 10:11am UTC](https://forum.opencv.org/t/pytorch-failed-after-opencv-installation/12318/2 "2023-08-13T10:11:32Z")

</div>

I have the same problem.

1. conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
2. python → torch.cuda.is\_available() → True
3. conda install opencv
4. python → torch.cuda.is\_available() → False

---

<div class="post-metadata">

**Author:** ![HY\_Lou](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/hy_lou/32/8526_2.png) [@HY\_Lou](https://forum.opencv.org/u/HY_Lou)\
**Post date:** [August 13, 2023, 11:03am UTC](https://forum.opencv.org/t/pytorch-failed-after-opencv-installation/12318/3 "2023-08-13T11:03:09Z")

</div>

I solved the problem by using `pip install opencv-python` instead of `conda install opencv`. It seems that conda thinks opencv depends on pytorch, and pytorch-cpu-2.0.1 \> pytorch-gpu, so the gpu version is always surpressed.
