I have installed python using anaconda. However, when I go to folder python/caffe. I run python pycaffe.py, it gives error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users//anaconda/lib/python2.7/site-packages/numpy/__init__.py", line 153, in <module>
from . import add_newdocs
File "/Users//anaconda/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/Users//anaconda/lib/python2.7/site-packages/numpy/lib/__init__.py", line 22, in <module>
from .npyio import *
File "/Users//anaconda/lib/python2.7/site-packages/numpy/lib/npyio.py", line 4, in <module>
from . import format
File "/Users//anaconda/lib/python2.7/site-packages/numpy/lib/format.py", line 141, in <module>
import io
File "io.py", line 2, in <module>
import skimage.io
File "/Users//anaconda/lib/python2.7/site-packages/skimage/__init__.py", line 171, in <module>
from .util.dtype import *
File "/Users//anaconda/lib/python2.7/site-packages/skimage/util/__init__.py", line 1, in <module>
from .dtype import (img_as_float, img_as_int, img_as_uint, img_as_ubyte,
File "/Users//anaconda/lib/python2.7/site-packages/skimage/util/dtype.py", line 8, in <module>
dtype_range = {np.bool_: (False, True),
AttributeError: 'module' object has no attribute 'bool_'
If I just type
>>> python
>>> import numpy as np
in the folder, the same error also comes up.
It is quite strange and I think it may be my setting problem. However, I could not figure out the reason. Any help is appreciated. Thanks
It seems like compatibility between numpy and skimage - may not be a Caffe problem...
Thanks a lot. I thought so initially. But, it seems that I could use skim age and bumpy without any problem outside of Caffe… Maybe, I set something wrong.
On Jul 24, 2014, at 10:35 PM, Yangqing Jia [email protected] wrote:
It seems like compatibility between numpy and skimage - may not be a Caffe problem...
—
Reply to this email directly or view it on GitHub.
I just realized what happened - you are loading from the caffe python folder, which contains a file "io.py". When numpy is being loaded, it will load this io.py instead of loading numpy's io, and that causes the problem.
As a rule of thumb, do not invoke python in a module's source file folder - instead, go to a different folder like $HOME/research/mycode, and add caffe/python into your PYTHONPATH.
I'll create an enhancement issue and see if I can add some warning message to such scenario. Thanks for reporting this!
Yes, I realized that in the late evening last night. I was going to update
the issue this morning. But, you already figured it out. The warning
message would be helpful for people like me who are not familiar with
python. Thank you very much. I could run caffe in python now.
On Fri, Jul 25, 2014 at 7:33 AM, Yangqing Jia [email protected]
wrote:
I just realized what happened - you are loading from the caffe python
folder, which contains a file "io.py". When numpy is being loaded, it will
load this io.py instead of loading numpy's io, and that causes the problem.As a rule of thumb, do not invoke python in a module's source file folder
- instead, go to a different folder like $HOME/research/mycode, and add
caffe/python into your PYTHONPATH.I'll create an enhancement issue and see if I can add some warning message
to such scenario. Thanks for reporting this!—
Reply to this email directly or view it on GitHub
https://github.com/BVLC/caffe/issues/782#issuecomment-50157487.
Sincerely Yours
Xingwei Yang
https://sites.google.com/site/xingweiyang1223/
hi, happyyxw , I met this problem too, I fllowed Ynagqing's method, but still not work, how you sovled it ?
Hi, I still have the same issue. I added caffe/python/caffe into my PYTHONPATH in .bashrc file. The issue can be simply reproduced when "import numpy as np". I am not invoking python in the module folder. Any solutions?
I am having the same problem as the above poster too and I can reproduce the error by doing an "import numpy" at the python command line. Is this issue related to skimage or something else ?
Do not invoke python in a module's source file folder - instead, go to a different folder like $HOME/research/mycode, and add caffe/python into your PYTHONPATH.
Do not run python code from the caffe/python dir.
No, I am not doing that. I am running it from an external folder and I have added 'caffe/python/caffe' and 'caffe/python' paths to my PYTHONPATH variable.
caffe/python is the right dir for PYTHONPATH, not caffe/python/caffe. The path holds the enclosing dir, not the module itself.
Alright. I did a completely new install of caffe and compiled using ccmake instead of editing the makefile manually. I had no problems in the compilation. The compilation was in CPU mode and I built pycaffe too by setting the BUILD_PYTHON_LIBS flag to ON. I did "make runtest" and had no errors.
Then, I used this to try the feature extraction part:
http://caffe.berkeleyvision.org/gathered/examples/feature_extraction.html
I was able to do it with the given in-built network without any trouble. Next, for visualizing the filters I wanted to use the python interface as said here:
http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/filter_visualization.ipynb
Before running this piece of code, I set the PYTHONPATH variable to contain '
ImportError: No module named _caffe
Instead, If I add '
File "/usr/lib/python2.7/dist-packages/numpy/init.py", line 153, 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 22, in
from .npyio import *
File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 4, in
from . import format
File "/usr/lib/python2.7/dist-packages/numpy/lib/format.py", line 141, in
import io
File "/home/swami/packages_local/caffe/python/caffe/io.py", line 2, in
import skimage.io
File "/usr/local/lib/python2.7/dist-packages/skimage/init.py", line 171, in
from .util.dtype import *
File "/usr/local/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/local/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_'
Where am I going wrong here ?
There should not be any need to re-compile Caffe (as long as it was compiled with Python correctly the first time) -- our notebook examples set the PYTHONPATH correctly so you should check by running for instance the feature_visualization.ipynb as a notebook.
The following error:
File "/usr/local/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_'
makes me believe that there might be some incompatibility between skimage
and numpy.
Yangqing
On Tue, Jan 27, 2015 at 11:26 AM, Evan Shelhamer [email protected]
wrote:
There's absolutely no need to re-compile Caffe -- our notebook examples
set the PYTHONPATH correctly so you should check by running for instance
the feature_visualization.ipynb as a notebook.
Reply to this email directly or view it on GitHub
https://github.com/BVLC/caffe/issues/782#issuecomment-71710775.
I dont think its a compatibility problem and here is why. I tried running other notebook examples like detection.ipynb from the examples directory, as a notebook in the browser. Following is the error output : the first half is the output from sys.path to make sure what paths it contains:
['',
'/usr/local/lib/python2.7/dist-packages/VTK-6.0-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/setuptools-7.0-py2.7.egg',
'/home/swami/packages_local/caffe/examples',
'/home/swami/packages_local/caffe/python',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PILcompat',
'/usr/local/lib/ITK-4.6/Python',
'/usr/local/lib',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
'/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode',
'/usr/local/lib/python2.7/dist-packages/IPython/extensions']
Traceback (most recent call last):
File "../python/detect.py", line 24, in
import caffe
File "/home/swami/packages_local/caffe/python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver
File "/home/swami/packages_local/caffe/python/caffe/pycaffe.py", line 10, in
from ._caffe import Net, SGDSolver
ImportError: No module named _caffe
This directory: '/home/swami/packages_local/caffe/python' has the following file structure:
caffe (directory containing _init.py_ etc)
classify.py
CMakeLists.txt
detect.py
draw_net.py
requirements.txt
Also, the PYTHONPATH variable contains only this : /home/swami/packages_local/caffe/python
I really cannot figure out what is wrong here.
There should be a _caffe.so in caffe/python/caffe -- if it isn't there then you have a problem with the build, and I suggest the official Makefile or the new CMake bulid in #1667.
upgrading numpy and changing the PYTHONPATH as specified above solve the problem for me.
One reporting:
In page
http://caffe.berkeleyvision.org/tutorial/interfaces.html#python
Compile pycaffe by make pycaffe. The module dir caffe/python/caffe should be installed in your PYTHONPATH for import caffe.
the content above is conflicting to "caffe/python is the right dir for PYTHONPATH", please correct it~
THX~
I also have the same issue, and it seems like the above method did not solve the problem. I run on ubuntu 14
This is the issue:
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 have edded the path to PYTHONPATH
caffe/python/caffe( as mentioned above. )
and I already succefully compile pycaffe I think. there is _caffe.so in caffe/python/caffe
any other way to solve the problem?
thanks!
I encountered the same problem and solved it.
Firstly, you need to have _caffe.so in caffe/python/caffe. If not, run 'make pycaffe' in caffe source folder.
Secondly, you need to add only caffe/python to $PYTHONPATH but not caffe/python/caffe as mentioned in documentation. I don't know why adding caffe/python/caffe causes the error, though.
Hi. I was also stuck in here, with the famous error:
AttributeError: 'module' object has no attribute 'bool_'
I was feeling hopeless since I thought I had done everything. But I checked again and found out I didn't have that '_caffe.so' in caffe/python/caffe.
I just did a make pycaffe and the error was gone! (there were some other modules missing after this, but they were much easier to deal with).
Hope it's useful.
I fixed this issue by
1) "cd /path/to/caffe/" and then "sudo pip install -r ./python/requirements.txt"
2) export PYTHONPATH=/path/to/caffe/python
I encountered similar problem when I'm trying to run fast-rcnn. So I call '_caffe' from outside folder, and add $CAFFE_ROOT/python/caffe to $PYTHONPATH (note that if we add $CAFFE_ROOT/python instead, then we will have the problem of 'No module named _caffe').
Then when I try to run the demo.py, I get an error:
...
AttributeError: 'module' object has no attribute 'bool_'
it might result from the reason Yangqing has posted:
under the folder of caffe-master/python/caffe, where _caffe.so lies, there is an io.py, which would be wrongly used by numpy.
I've no idea how to fix this, yet.
@deartonym you should add $CAFFE_ROOT/python to your $PYTHONPATH, not $CAFFE_ROOT/python/caffe.
If you add "$CAFFE_ROOT/python/caffe", then you won't be able to do "import caffe".
If you succeeded "make pycaffe" without error and cannot solve the " AttributeError: 'module' object has no attribute 'bool_' " problem after you set PYTHONPATH, you'd better check if you set too much different PATHONPATH via "echo $PYTHONPATH", if have more than one path, you can logout and log in, then add "expoet PYTHONPATH=$PYTHONPATH:/home/develop/caffe/python", then have a try!
I got the same error, AttributeError: 'module' object has no attribute 'bool_'.
And I can import caffe, and import numpy. Meanwhile numpy.bool_ is okay, too.
@ntajbakhsh The two steps you just posted solved a different issue for me: "could not find libcaffe.so". Thanks!
I have finished this problem.
That if you have added caffe/python into your Path, you must take draw_net.py out of this folder, and put it in another folder, and then use it.
I am having the same issue, not being able to import caffe.
Yes, it compiled correctly, and I have a _caffe.so file in caffe/python/caffe.
No, I did not incorrectly set $PYTHONPATH to caffe/python/caffe. It is set correctly to caffe/python.
Have same error on ubuntu 14.04
I was doing all wrong
export PYTHONPATH=/home/user/Downloads/caffe/python/caffe:$PYTHONPATH
import pycaffe
but right thing was
export PYTHONPATH=/home/user/Downloads/caffe/python:$PYTHONPATH
import caffe
be careful
Please update documentation to make it clear for everyone:
http://caffe.berkeleyvision.org/tutorial/interfaces.html
Your path configuration is suspicous.
Check this out. (In my case, It was sensitive.)
in .bashrc
export PATH=/usr/local/cuda-6.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/home/ubuntu/opencv-2.4.10.1/build/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/home/ubuntu/caffe/python
export PYTHONPATH=/home/ubuntu/opencv-2.4.10.1/build/lib:$PYTHONPATH
export FRCN_ROOT=/home/ubuntu/frcnn
Hello guys, I encountered the same issue:
AttributeError: 'module' object has no attribute 'bool_'
I followed the steps mentioned above to set the environment variables:
export PYTHONPATH=/home/fred/caffe/python:$PYTHONPATH
Also I have _caffe.so file in caffe/python/caffe but it still not works..
Most people will probably have Python 2.7 and 3 on their system. I found that while using pip, some packages (pydotplus and skimage.io) were installed for Python3 and pip said they were already installed and ./python/draw_net.py gave errors of the kind reported here. This is still a usage error though it can be useful to use pip2.7 install foo
One thing to keep in mind:
If you ran export PYTHONPATH=/home/user/caffe/python/caffe:$PYTHONPATH and then changed it to export PYTHONPATH=/home/user/caffe/python:$PYTHONPATH, your PYTHONPATH variable will still hold the previous value as well.
The easy fix is to just start up a new terminal. This may seem obvious, but just putting it out there so that people see it, especially when they are pulling out their hair.
I encountered the same error AFTER an abnormal shutdown.
So wired.
And I cannot open the terminal, gedit, and spyder applications.
If anyone is still struggling to find a solution after following all the above steps (I was), here's a solution that worked for me. Extremely hacky, but it works until someone finds out a better way to do this.
First set PYTHONPATH as /usr/local/lib/python2.7/site-packages/ or /usr/local/lib/python2.7/dist-packages/ Either should work.
PYTHONPATH= /usr/local/lib/python2.7/site-packages/
Now, open python:
>> import numpy as np
>> import sys
>> sys.path.insert(0,'/home/brt/python/) # the folder where you have the python caffe. Note that this path is without the /caffe at the end.
>> import caffe
>> sys.path.insert(0,'/home/brt/python/caffe') #Note that this has /caffe at the end
>> import _caffe
This should work. Basically what I do is I force python to import numpy from the site-packages and then caffe and _caffe from the respective Caffe folders. If you have all three paths in your PYTHONPATH simultaneously, Python tries to import numpy from the io.py in the Caffe folders and not site-packages which causes the "no attribute 'bool_' error".
I have the exact same problem of AttributeError: 'module' object has no attribute 'bool_'.
Has any solution appeared since then?
Thanks.
upgrading numpy solved the issue.
i got the same error! anyone has solved this please give us the point. i compiled and set path correctly but still it give me no caffe module found
Hi guys :)
maybe it helps someone. I had a similar problem as in the first post. More specificlly, my problem was this:
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import caffe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
File "caffe/pycaffe.py", line 15, in <module>
import caffe.io
File "caffe/io.py", line 2, in <module>
import skimage.io
ImportError: No module named skimage.io
In my case, I forgot to install the requirements from
sudo pip install Cython
or
sudo pip install leveldb
They are about seventeen such packages.
I hope this was usefull :)
Good luck
I am having the error No Module named skimage.io. My Pythonpath is correctly set to caffe/python and not caffe/python/caffe. I am not invoking it from inside the folder. I have installed requirements.txt.
the error not be solved...anyone has solved this please give us the point.
@kunsa @sayadyaghoobi @axelbrz this was a bit of a nightmare issue to sort out, especially due to all of the feedback on this issue being not particularly helpful in explaining the root cause. May I suggest, if you've installed numpy via pip, to uninstall it, and re-install numpy via apt-get using the debian/ubuntu package. See: https://packages.debian.org/search?keywords=numpy&searchon=names&suite=stable§ion=all .
There is something in the way that numpy is installed via pip that creates a classpath namespace collision. A lot of this seems to depend on where pip is installing things. Rather than go down that path of trying to manually tweak the pythonpath, this worked well for me on 14.04 and 16.04. And upgrading numpy wasn't the solution necessarily either, although in some cases, upgrades to packages may solve a particular python/caffe issue.
And this begs the question, why isn't this particular landmine documented more clearly for debian/ubuntu users? Everyone seems to come across this problem. And then this leads to how to avoid this to begin with. We should all be using virtualenv, however, I don't know that caffe would work in the context of a virtualenv though I'd like to know if someone has done this. It would prevent the risk of corrupting a set up with a bad install of caffe.
@truedat101 the fact likes this: (sudo apt-get install python-numpy and )
1) I set the PYTHONPATH in ~/.bashrc : "export PYTHONPATH=/home/user/workspace/caffe/python:$PYTHONPATH" ,source ~./bashrc , then use "python" and "import caffe" in the /home/user/workspace/caffe/python after the success of "make pycaffe" , output :
Traceback (most recent call last):
File "
File "caffe/__init__.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "caffe/pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
ImportError: /home/user/workspace/caffe/python/caffe/../../build/lib/libcaffe.so.1.0.0-rc3: undefined symbol: _ZN5boost13match_resultsIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS5_EEEE12maybe_assignERKS9_
2) I set the PYTHONPATH in ~/.bashrc : "export PYTHONPATH=/home/user/workspace/caffe/python:$PYTHONPATH" , source ~./bashrc , then use "python" and "import caffe" in the /home/user/workspace/caffe/python/caffe after the success of "make pycaffe" , output :
Traceback (most recent call last):
File "
File "/home/user/workspace/caffe/python/caffe/__init__.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/home/user/workspace/caffe/python/caffe/pycaffe.py", line 11, in
import numpy as np
File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 142, in
from . import add_newdocs
File "/usr/local/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 8, in
from .type_check import *
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/dist-packages/numpy/core/__init__.py", line 72, in
from numpy.testing.nosetester import _numpy_tester
File "/usr/local/lib/python2.7/dist-packages/numpy/testing/__init__.py", line 12, in
from . import decorators as dec
File "/usr/local/lib/python2.7/dist-packages/numpy/testing/decorators.py", line 20, in
from .utils import SkipTest, assert_warns
File "/usr/local/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/local/lib/python2.7/dist-packages/skimage/__init__.py", line 158, in
from .util.dtype import *
File "/usr/local/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/local/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_'
3) I set the PYTHONPATH in ~/.bashrc : "export PYTHONPATH=/home/user/workspace/caffe/python/caffe:$PYTHONPATH" , source ~./bashrc , then use "python" and "import caffe" in the /home/user/Download after the success of "make pycaffe" , output :
Traceback (most recent call last):
File "
ImportError: No module named caffe
4) I set the PYTHONPATH in ~/.bashrc : "export PYTHONPATH=/home/user/workspace/caffe/python/caffe:$PYTHONPATH" ,source ~./bashrc , then use "python" and "import caffe" in the /home/user/workspace/caffe/python after the success of "make pycaffe" , output :
Traceback (most recent call last):
File "
File "caffe/__init__.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "caffe/pycaffe.py", line 11, in
import numpy as np
File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 142, in
from . import add_newdocs
File "/usr/local/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 8, in
from .type_check import *
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/dist-packages/numpy/core/__init__.py", line 72, in
from numpy.testing.nosetester import _numpy_tester
File "/usr/local/lib/python2.7/dist-packages/numpy/testing/__init__.py", line 12, in
from . import decorators as dec
File "/usr/local/lib/python2.7/dist-packages/numpy/testing/decorators.py", line 20, in
from .utils import SkipTest, assert_warns
File "/usr/local/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 "/home/wy/workspace/caffe/python/caffe/io.py", line 2, in
import skimage.io
File "/usr/local/lib/python2.7/dist-packages/skimage/__init__.py", line 158, in
from .util.dtype import *
File "/usr/local/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/local/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_'
how to solve it? THx!!
I also had the same problem, and I solve it though the following process. First of all, I will list my configuration in my Makefile.config:
After successfully compiling caffe, I open my ~/. bashrc file and input:
export PYTHONPATH=/path/to/caffe_root/python:$PYTHONPATH
source ~/.bashrc
and then
make clean
make all
make pycaffe
And I shut down my terminal and restart it,
then I open my python, and input import caffe, it succeed!
just try to change a diretory like home diretory,your error will ok
Most helpful comment
I just realized what happened - you are loading from the caffe python folder, which contains a file "io.py". When numpy is being loaded, it will load this io.py instead of loading numpy's io, and that causes the problem.
As a rule of thumb, do not invoke python in a module's source file folder - instead, go to a different folder like $HOME/research/mycode, and add caffe/python into your PYTHONPATH.
I'll create an enhancement issue and see if I can add some warning message to such scenario. Thanks for reporting this!