yahoo/open_nsfw

No module named skimage.io

willswl opened this issue · 1 comments

I got ImportError error when run "sudo docker run --volume=$(pwd):/workspace caffe:cpu python ./classify_nsfw.py --model_def nsfw_model/deploy.prototxt --pretrained_model nsfw_model/resnet_50_1by2_nsfw.caffemodel test_image.png", the detail message:

sudo docker run --volume=$(pwd):/workspace caffe:cpu python ./classify_nsfw.py --model_def nsfw_model/deploy.prototxt --pretrained_model nsfw_model/resnet_50_1by2_nsfw.caffemodel test_image.png
libdc1394 error: Failed to initialize libdc1394
Traceback (most recent call last):
File "./classify_nsfw.py", line 16, in
import caffe
File "/opt/caffe/python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/opt/caffe/python/caffe/pycaffe.py", line 15, in
import caffe.io
File "/opt/caffe/python/caffe/io.py", line 2, in
import skimage.io
ImportError: No module named skimage.io

And I tired to import caffe from python console(I have installed caffe separately), the error is different :
python
Python 2.7.12 (default, Jul 1 2016, 15:12:24)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import caffe
Traceback (most recent call last):
File "", line 1, in
File "/home/wills/caffe/python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/home/wills/caffe/python/caffe/pycaffe.py", line 11, in
import numpy as np
File "/usr/lib/python2.7/dist-packages/numpy/init.py", line 180, in
from . import add_newdocs
File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/usr/lib/python2.7/dist-packages/numpy/lib/init.py", line 8, in
from .type_check import *
File "/usr/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/usr/lib/python2.7/dist-packages/numpy/core/init.py", line 58, in
from numpy.testing.nosetester import numpy_tester
File "/usr/lib/python2.7/dist-packages/numpy/testing/init.py", line 12, in
from . import decorators as dec
File "/usr/lib/python2.7/dist-packages/numpy/testing/decorators.py", line 21, in
from .utils import SkipTest
File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 15, in
from tempfile import mkdtemp, mkstemp
File "/usr/lib/python2.7/tempfile.py", line 32, in
import io as io
File "io.py", line 2, in
import skimage.io
File "/usr/lib/python2.7/dist-packages/skimage/init.py", line 171, in
from .util.dtype import *
File "/usr/lib/python2.7/dist-packages/skimage/util/init.py", line 1, in
from .dtype import (img_as_float, img_as_int, img_as_uint, img_as_ubyte,
File "/usr/lib/python2.7/dist-packages/skimage/util/dtype.py", line 8, in
dtype_range = {np.bool
: (False, True),
AttributeError: 'module' object has no attribute 'bool
'

I'm trying "Anaconda Python distribution" recommented by caffe now, but my questions is : does the NFSW really depend on caffe installed separately? Seems it's already included in the docker, and seems some dependencies missed in the docker file?

I also tried "pip install scikit-image" in the docker bash, but more error hit during pip install.
Then I gave up the docker, instead, I build up caffe from scratch, finally it works for me.