pyvips 라이브러리 사용 시 아래와 같은 오류를 마주할 수 있다.
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
~/anaconda3/envs/[ENV-NAME]/lib/python3.8/site-packages/pyvips/__init__.py in <module>
18 try:
---> 19 import _libvips
20
ModuleNotFoundError: No module named '_libvips'
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
<ipython-input-10-a7ddf1d6bb42> in <module>
4 import numpy as np
5
----> 6 import pyvips
7 import matplotlib.pyplot as plt
8
~/anaconda3/envs/[ENV-NAME]/lib/python3.8/site-packages/pyvips/__init__.py in <module>
69 # possibly use ctypes.util.find_library() to locate the lib?
70 gobject_lib = ffi.dlopen(_gobject_libname)
---> 71 vips_lib = ffi.dlopen(_vips_libname)
72 if _glib_libname:
73 glib_lib = ffi.dlopen(_glib_libname)
~/anaconda3/envs/[ENV-NAME]/lib/python3.8/site-packages/cffi/api.py in dlopen(self, name, flags)
148 "or an already-opened 'void *' handle")
149 with self._lock:
--> 150 lib, function_cache = _make_ffi_library(self, name, flags)
151 self._function_caches.append(function_cache)
152 self._libraries.append(lib)
~/anaconda3/envs/[ENV-NAME]/lib/python3.8/site-packages/cffi/api.py in _make_ffi_library(ffi, libname, flags)
830 def _make_ffi_library(ffi, libname, flags):
831 backend = ffi._backend
--> 832 backendlib = _load_backend_lib(backend, libname, flags)
833 #
834 def accessor_function(name):
~/anaconda3/envs/[ENV-NAME]/lib/python3.8/site-packages/cffi/api.py in _load_backend_lib(backend, name, flags)
825 if first_error is not None:
826 msg = "%s. Additionally, %s" % (first_error, msg)
--> 827 raise OSError(msg)
828 return backend.load_library(path, flags)
829
OSError: cannot load library 'libvips.so.42': libvips.so.42: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libvips.so.42'
아래와 두 가지 방법을 활용하여 위 오류를 해결할 수 있다.
나의 경우, 어떤 os에서는 첫 번째 방법으로 해결 가능했고, 어떤 경우는 2까지 동원해야 했다.
방법1:
출처: https://github.com/libvips/pyvips/issues/86
conda install -c conda-forge librsvg
conda install -c conda-forge libiconv
방법2:
# ubuntu
apt install libvips
# macOS
brew install vips
반응형
'CS > 삽질로그' 카테고리의 다른 글
[python] macos mysqlclient 설치 오류 (해결) (0) | 2022.11.23 |
---|---|
[docker, opencv] docker opencv 에러 (libGL.so.1: cannot open shared object file) (0) | 2022.11.09 |
[python] logging 라이브러리 오류 (0) | 2022.10.28 |
[kubeflow, kubernetes] 에러 파드 삭제하는 방법 (kubeflow delete error pod) (0) | 2022.10.28 |
[디버깅] tensorflow assertion failed: [predictions must be >= 0] 에러 해결 (1) | 2022.10.07 |