Error importing caffe in Anaconda Python

436 views
Skip to first unread message

Hoa Le

unread,
Sep 23, 2015, 6:42:54 AM9/23/15
to Caffe Users
I'm lost. I have all make pycaffe, make all, make test and make runtest ran fine, and had added path/to/caffe/python to $PYTHONPATH. However I always got a TypeError when importing caffe in ipython. The error traced back to _parse_config_file in skimage.io

Using gpu device 0: GeForce GTX 660 (CNMeM is disabled)
Traceback (most recent call last):
 
File "<string>", line 1, in <module>
 
File "/home/hoa/caffe/python/caffe/__init__.py", line 1, in <module>
   
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
 
File "/home/hoa/caffe/python/caffe/pycaffe.py", line 15, in <module>
   
import caffe.io
 
File "/home/hoa/caffe/python/caffe/io.py", line 2, in <module>
   
import skimage.io
 
File "/home/hoa/.conda/envs/caffe/lib/python2.7/site-packages/skimage/io/__init__.py", line 7, in <module>
   
from .manage_plugins import *
 
File "/home/hoa/.conda/envs/caffe/lib/python2.7/site-packages/skimage/io/manage_plugins.py", line 135, in <module>
    _scan_plugins
()
 
File "/home/hoa/.conda/envs/caffe/lib/python2.7/site-packages/skimage/io/manage_plugins.py", line 114, in _scan_plugins
    name
, meta_data = _parse_config_file(filename)
 
File "/home/hoa/.conda/envs/caffe/lib/python2.7/site-packages/skimage/io/manage_plugins.py", line 94, in _parse_config_file
    parser
= ConfigParser()
TypeError: 'module' object is not callable

I suspect that it has something to do with scikit-image and matplotlib not being able to upgrade to the latest version due to UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 54: ordinal not in range(128)

Nevertheless, both packages are already at 0.11.2 and 1.4.3, which satisfies the requirements indicated in caffe/python/requirements.txt

Any insights are deeply appreciated. 

Nikunj Saunshi

unread,
Jan 19, 2016, 2:05:17 AM1/19/16
to Caffe Users
Hello,

Any solution to this problem? I am facing the same issue.

Thanks

Chris Currivan

unread,
Jan 20, 2016, 2:42:16 AM1/20/16
to Caffe Users
I had this error. I was using python 2 but had a configparser module in my PYTHONPATH from an old Theano version. Removing it solved the problem.

if sys.version.startswith('3'): from configparser import ConfigParser # Python 3 else: from ConfigParser import ConfigParser # Python 2

Nikunj Saunshi

unread,
Jan 25, 2016, 1:41:18 AM1/25/16
to Caffe Users
Yes, I had the same problem. Figured it out but forgot to post here.
Thanks for the reply
Reply all
Reply to author
Forward
0 new messages