Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when call 'make pycaffe' #44

Closed
middlecode opened this issue Jan 21, 2014 · 6 comments
Closed

error when call 'make pycaffe' #44

middlecode opened this issue Jan 21, 2014 · 6 comments

Comments

@middlecode
Copy link

Hi,
Need help for this.
When i compile the caffe 'make all' , everything is ok. But when compile for python 'make pycaffe' , it showed error :


python/caffe/pycaffe.cpp: In member function âboost::python::api::object CaffeBlobWrap::get_data()â:
python/caffe/pycaffe.cpp:72:74: error: âPyArray_SetBaseObjectâ was not declared in this scope
python/caffe/pycaffe.cpp: In member function âboost::python::api::object CaffeBlobWrap::get_diff()â:
python/caffe/pycaffe.cpp:85:74: error: âPyArray_SetBaseObjectâ was not declared in this scope

I followed installed all the library which is mentioned inside 'Prerequisites' part. Looking in google but can find any clue.
I use Ubuntu 12.04.

Thanks.

@longjon
Copy link
Contributor

longjon commented Jan 21, 2014

The new pycaffe updates require numpy >= 1.7 (which was added to Ubuntu in 13.04). If upgrading numpy (or using Anaconda etc.) is not an option, I believe the following patch should work around the issue, although I don't have a build environment I can use to test it right now.

diff --git a/python/caffe/pycaffe.cpp b/python/caffe/pycaffe.cpp
index 2bfae9e..59424ce 100644
--- a/python/caffe/pycaffe.cpp
+++ b/python/caffe/pycaffe.cpp
@@ -13,6 +13,7 @@
 // Temporary solution for numpy < 1.7 versions: old macro.
 #ifndef NPY_ARRAY_C_CONTIGUOUS
 #define NPY_ARRAY_C_CONTIGUOUS NPY_C_CONTIGUOUS
+#define PyArray_SetBaseObject(arr, x) (PyArray_BASE(arr) = (x))
 #endif

@middlecode
Copy link
Author

thanks man 👍

@simmers
Copy link

simmers commented Jan 24, 2014

Sorry for making a dupe (#50)...haven't done much github and didn't see the full list of issues.

It turned out that my numpy version was pre 1.7 so I upgraded to 1.8.0 and did a clean build and tried 'make pycaffe' again but got the exact same errors.

@shelhamer
Copy link
Member

Are you sure it isn't still including the header files of an older, less than 1.7, version of numpy? Please check your Makefile.config to see that the numpy 1.8.0 headers are included.

A common case is accidentally including an older, system, numpy over a recent, local, numpy (such as anaconda).

@SophieZhou
Copy link

@longjon Thanks

@bittnt
Copy link

bittnt commented Feb 12, 2014

@middlecode I think the main problem you might have is because you install numpy through "sudo apt-get install python-numpy" rather than through "sudo pip install numpy". Notice that if you do both, you would probably get the same errors. So make sure you run "sudo apt-get remove python-numpy" and also you run "sudo pip install numpy" as the readme suggested.

BTW, anyone has a suggestions on the alternative for apt-get? It seems apt-get is bad and it always get the outofdate libraries. Although this question is out of interest. :)

@kloudkl kloudkl mentioned this issue Feb 13, 2014
shelhamer added a commit that referenced this issue Feb 14, 2014
mitmul pushed a commit to mitmul/caffe that referenced this issue Sep 30, 2014
lukeyeager added a commit to lukeyeager/caffe that referenced this issue Oct 28, 2015
naibaf7 added a commit that referenced this issue Aug 26, 2016
solver.cpp: do not include hdf5
DVEfremov pushed a commit to DVEfremov/caffe that referenced this issue Jan 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants