1

I have Ubuntu 16.04 with installed Python 2.7 and 3.5. I've got Caffe from repository and successfully compiled, all tests are passed.

When I work in Terminal I can import caffe module and it has "io":

>>> import caffe
>>> caffe.io
<module 'caffe.io' from 'caffe/io.pyc'>

But when I use PyCharm "io" is absent:

    model = caffe.io.caffe_pb2.NetParameter()
AttributeError: 'module' object has no attribute 'io'

Code example that I'm trying to run is here https://github.com/google/deepdream/blob/master/dream.ipynb

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Verych
  • 431
  • 1
  • 5
  • 12
  • 2
    check whether you are using correct python interpreter in pycharm – mic4ael Aug 15 '16 at 14:10
  • What output does `print(caffe)` produce? You almost certainly have a local `caffe.py` file that is masking the installed library. – Martijn Pieters Aug 15 '16 at 14:12
  • @mic4ael: more importantly, the correct module; `import caffe` worked after all. – Martijn Pieters Aug 15 '16 at 14:12
  • Also, in future, please paste console output as text, which makes it searchable and for us that try to help you, copyable. Next, a *full traceback* is appreciated, because common errors like naming your script `caffe.py` will immediately be visible in such a traceback. – Martijn Pieters Aug 15 '16 at 14:14
  • @martijn-pieters thanks, there is local caffe.py file in the project – Verych Aug 15 '16 at 14:39

1 Answers1

0

The reason is local caffe.py file. thanks @martijn-pieters for your comment

Verych
  • 431
  • 1
  • 5
  • 12