AttributeError: 'module' object has no attribute 'Net'

1,190 views
Skip to first unread message

Alonso Ali Goncalves

unread,
Jan 23, 2017, 8:36:26 PM1/23/17
to Caffe Users
Hello everyone. My old Caffe build was all messed up so I decided to do a fresh install of Caffe on my Mac OSX 10.12 (Sierra). Did it with no errors during make (make all, runtest, pycaffe and distribute). After the whole setup process I tried to run a simple python -c "import caffe" to make sure everything was working but to my surprise I'm getting a wall of text of errors and warnings. After a little research it seems those warnings can be ignored, but the main problem is "AttributeError: 'module' object has no attribute 'Net'". Anyone knows what's up with this? I wasn't able to find an explanation online to this. The whole error is:

dyld: warning, LC_RPATH @executable_path/ in /usr/local/cuda/lib/libcublas.8.0.dylib being ignored in restricted program because of @executable_path

dyld: warning, LC_RPATH @executable_path/ in /usr/local/cuda/lib/libcurand.8.0.dylib being ignored in restricted program because of @executable_path

/Library/Python/2.7/site-packages/caffe/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for caffe::SolverParameter already registered; second conversion method ignored.

  from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \

/Library/Python/2.7/site-packages/caffe/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for caffe::LayerParameter already registered; second conversion method ignored.

  from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \

/Library/Python/2.7/site-packages/caffe/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for std::__1::vector<boost::shared_ptr<caffe::Blob<float> >, std::__1::allocator<boost::shared_ptr<caffe::Blob<float> > > > already registered; second conversion method ignored.

  from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \

/Library/Python/2.7/site-packages/caffe/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for std::__1::vector<caffe::Blob<float>*, std::__1::allocator<caffe::Blob<float>*> > already registered; second conversion method ignored.

  from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \

/Library/Python/2.7/site-packages/caffe/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for std::__1::vector<boost::shared_ptr<caffe::Layer<float> >, std::__1::allocator<boost::shared_ptr<caffe::Layer<float> > > > already registered; second conversion method ignored.

  from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \

/Library/Python/2.7/site-packages/caffe/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > already registered; second conversion method ignored.

  from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \

/Library/Python/2.7/site-packages/caffe/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for std::__1::vector<int, std::__1::allocator<int> > already registered; second conversion method ignored.

  from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \

/Library/Python/2.7/site-packages/caffe/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for std::__1::vector<float, std::__1::allocator<float> > already registered; second conversion method ignored.

  from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \

/Library/Python/2.7/site-packages/caffe/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for std::__1::vector<boost::shared_ptr<caffe::Net<float> >, std::__1::allocator<boost::shared_ptr<caffe::Net<float> > > > already registered; second conversion method ignored.

  from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \

/Library/Python/2.7/site-packages/caffe/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for std::__1::vector<bool, std::__1::allocator<bool> > already registered; second conversion method ignored.

  from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/Library/Python/2.7/site-packages/caffe/__init__.py", line 1, in <module>

    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer

  File "/Library/Python/2.7/site-packages/caffe/pycaffe.py", line 15, in <module>

    import caffe.io

  File "/Library/Python/2.7/site-packages/caffe/caffe/__init__.py", line 5, in <module>

    from .classifier import Classifier

  File "/Library/Python/2.7/site-packages/caffe/caffe/classifier.py", line 11, in <module>

    class Classifier(caffe.Net):

AttributeError: 'module' object has no attribute 'Net'



Thank you.

Nima Forouzandeh

unread,
Mar 15, 2022, 1:30:19 PM3/15/22
to Caffe Users
Hi,
could you solve this issue?
I get a similar error from my code: 
module 'caffe' has no attribute 'Classifier'

I think these two can be solved the same way. 
Reply all
Reply to author
Forward
0 new messages