SOLVED - ImportError: cannot open shared object file - On WSL

Just solved this, but posting for reference.

I’m trying to get the library working inside my WSL (Windows Subsystem for Linux). My understanding is it’s supposed to work except for the GPU).

However, when I try to import I get the following error:

ImportError                               Traceback (most recent call last)
<ipython-input-4-adec07e3e53e> in <module>()
----> 1 from fastai.imports import *
  2 from fastai.torch_imports import *
  3 from fastai.structured import *
  4 from fastai.dataset import *
  5 from fastai.column_data import *

~/fast.ai2/fastai/ in <module>()
 13 from pandas_summary import DataFrameSummary
 14 from IPython.lib.display import FileLink
---> 15 from PIL import Image, ImageEnhance, ImageOps
 16 from sklearn import metrics, ensemble, preprocessing

~/anaconda3/envs/fastai/lib/python3.6/site-packages/PIL/ in <module>()
 54     # Also note that Image.core is not a publicly documented interface,
 55     # and should be considered private and subject to change.
---> 56     from . import _imaging as core
 57     if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
 58         raise ImportError("The _imaging extension was built for another "

ImportError: cannot open shared object file: No such file or directory

It appears it can’t find this file.

Hence, I set variable LD_LIBRARY_PATH following:

  1. First I find the file:
    wbrucek@LAPTOP-SF5P3R2K:/etc$ apt-file search
    libjpeg-turbo8: /usr/lib/x86_64-linux-gnu/
    libjpeg-turbo8: /usr/lib/x86_64-linux-gnu/
  2. Then I add it to the LD_LIBRARY_PATH
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu
  3. Then I restarted jupyter notebook (in the same terminal)

Unfortunately this did not fix the error.

I checked and set the LD_LIBRARY_PATH directly inside jupyter notebook, without affecting the error.


1 Like

SOLUTION. In addition to what I did previously (i.e. setting LD_LIBRARY_PATH). What i figured out was that “apt-file search” is actually showing that you need to install “libjpeg-turbo8” to get “”.

So I installed it and everything works now!

sudo apt-get install libjpeg-turbo8


Thanks, works for me Ubuntu 16 GPU+ paperspace.

Thanks for figuring this out. It solved the problem for me on Ubuntu 16.04 within Docker.