【libGL.so.1: cannot open shared object file: No such file or directory】対処方法
はじめに
環境
- Windows11
- WSL2のUbuntu
- IPython
状況
import cv2
import cv2 ...: --------------------------------------------------------------------------- ImportError Traceback (most recent call last) Cell In[3], line 1 ----> 1 import cv2 ImportError: libGL.so.1: cannot open shared object file: No such file or directory
状況補足
- Matplotlibとcv2(OpenCV)を利用
- Matplotlibの後にOpenCVをインストールした
対処方法
原因
- MatplotlibとCV2のライブラリの競合(恐らく)
対処①
conda uninstall cv2
conda uninstall opencv
/bin/bash: /home/futa/miniconda3/lib/python3.10/site-packages/cv2/../../../../lib/libtinfo.so.6: no version information available (required by /bin/bash)
Collecting package metadata (repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /home/futa/miniconda3
removed specs:
- opencv
The following packages will be downloaded:
package | build
---------------------------|-----------------
requests-2.29.0 | py310h06a4308_0 97 KB
sqlite-3.41.2 | h5eee18b_0 1.2 MB
------------------------------------------------------------
Total: 1.3 MB
The following NEW packages will be INSTALLED:
mkl_fft pkgs/main/linux-64::mkl_fft-1.3.1-py310hd6ae3a3_0
mkl_random pkgs/main/linux-64::mkl_random-1.2.2-py310h00e6091_0
The following packages will be REMOVED:
cairo-1.16.0-hb05425b_4
eigen-3.3.7-hd09550d_1
ffmpeg-4.2.2-h20bf706_0
gmp-6.2.1-h295c915_3
gnutls-3.6.15-he1e5248_0
graphite2-1.3.14-h295c915_1
harfbuzz-4.3.0-hf52aaf7_1
hdf5-1.10.6-h3ffc7dd_1
lame-3.100-h7b6447c_0
libgfortran-ng-11.2.0-h00389a5_1
libgfortran5-11.2.0-h1234567_1
libidn2-2.3.2-h7f8727e_0
libopenblas-0.3.21-h043d6bf_0
libopus-1.3.1-h7b6447c_0
libprotobuf-3.20.3-he621ea3_0
libtasn1-4.19.0-h5eee18b_0
libunistring-0.9.10-h27cfd23_0
libvpx-1.7.0-h439df22_0
nettle-3.7.3-hbbd107a_1
opencv-4.6.0-py310h1128e8f_3
openh264-2.1.1-h4ff587b_0
openjpeg-2.4.0-h3ad879b_0
pixman-0.40.0-h7f8727e_1
x264-1!157.20191217-h7b6447c_0
The following packages will be UPDATED:
requests 2.28.1-py310h06a4308_1 --> 2.29.0-py310h06a4308_0
sqlite 3.41.1-h5eee18b_0 --> 3.41.2-h5eee18b_0
The following packages will be DOWNGRADED:
blas 1.0-openblas --> 1.0-mkl
numexpr 2.8.4-py310h757a811_0 --> 2.8.4-py310h8879344_0
numpy 1.24.3-py310hac523dd_0 --> 1.24.3-py310hd5efca6_0
numpy-base 1.24.3-py310h375b286_0 --> 1.24.3-py310h8e6c178_0
Proceed ([y]/n)? y
Downloading and Extracting Packages
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Note: you may need to restart the kernel to use updated packages.
- 上記コマンドをLinuxで実行
import cv2
- エラー出力されず
対処②
- MinicondaではなくAnacondaを利用する
- Anacondaであれば、メジャーなライブラリはコンフリクトない状態でインストールされている
- Python:ライブラリインストール
