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

Mac install update scripts #1765

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ananay22
Copy link

This version updates the docs for the proper installation on macOS systems.

caffe cannot be built as vecLib cannot be found:
The current patch relies on brew's caffe bottle.
This is not a good approach.
On top of that, homebrew built caffe with leveldb, and as this issue highlights, leveldb causes an issue with tcmalloc that causes the runtime Attempt to free Invalid Pointer error.

This version specifies the correct vecLib_INCLUDE_DIRS in the pre-requisites documentation. Rather than not build caffe from scratch and rely on homebrew, this version fixes the caffe build process.

Furthermore, it also shows to users how to build caffe without leveldb, which prevents the tcmalloc issue.

@ananay22
Copy link
Author

@soulslicer
Copy link
Collaborator

Thanks, will take a look at this next week after my conference deadline too!

@gineshidalgo99
Copy link
Member

Hi @ananay22,

Thanks for the PR, we will review it! Before being able to do so, could you please make sure there are no conflicting files? We can't review or merge it if there are merge conflicts.

Thanks!

@soulslicer
Copy link
Collaborator

@ananay22 Is this for the CPU compilation in OSX?

@jkelso662
Copy link

Hi @ananay22! I haven't been able to get python API installed on macOS Catalina.
I was having same issues as #1740 and have tried all of the suggestions by related issues also. I finally thought I had it sorted with this fix, finally getting the cafe building and install output I was expecting. However, after this ([100%] Completed 'openpose_lib'), I observe the following code looping continuously until I interrupt it.

Rerunning cmake after building Caffe submodule
-- GCC detected, adding compile flags
-- Building CPU Only.
-- Found gflags  (include: /usr/local/include, library: /usr/local/lib/libgflags.dylib)
-- Found glog    (include: /usr/local/include, library: /usr/local/lib/libglog.dylib)
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) 
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) 
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND) 
-- Caffe will be downloaded from source now. NOTE: This process might take several minutes depending
        on your internet connection.
-- Caffe has already been downloaded.
HEAD is now at 1807aada Added Ampere arch's (CUDA11)
M	CMakeLists.txt
M	cmake/Modules/FindvecLib.cmake
-- Caffe will be built from source now.
-- Download the models.
-- Downloading BODY_25 model...
-- Model already exists.
-- Not downloading body (COCO) model
-- Not downloading body (MPI) model
-- Downloading face model...
-- Model already exists.
-- Not downloading hand model
-- Models Downloaded.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/joshuas@kainos.com/Documents/Projects/Coventry/openpose

@soulslicer
Copy link
Collaborator

soulslicer commented Dec 11, 2020

Hi all,

I am currently on macOSX Mojave, and I pulled the latest master from openpose. I attempted to compile the default CPU version on OSX. The only issue I had was with the vecLib path which for some reason the existing patch is not working anymore. (Possibly as the caffe target may have changed).

https://gist.github.com/soulslicer/b31ca993fb63ce7880986c1131a1bbb4

This is the patch that should fix that vecLib issue.

@jkelso662
Copy link

Thank you @soulslicer for your suggested patch. It has successfully allowed me to build the python API successfully for the first time! It along with the suggestion from #1740 was what finally got the python API working!

@camrynfriedman
Copy link

Does anyone else have tips for the installation of OpenPose on MacOS? I'm on Big Sur.

@jalpanchal
Copy link

I am still facing this issue of src/tcmalloc.cc:333] Attempt to free invalid pointer 0x7fbbd9f09dc0
when I use the brew version for caffe.

Applying this fixes in this commit did not really solve my issue as I thin the caffe as of July 14 is still not good enough to work with BigSur

@Ananay-22
Copy link

Ananay-22 commented Jul 14, 2021

oh man I forgot about this will update the PR although im p sure its outdated by now.

The main issue that I had is that caffe had some dependencies that are broken on mac (some tcmalloc stuff that I am not the best person to discuss with). The fix was to rebuild caffe from source (using the same github link that the OpenPose provides to their version of caffe, and not the official caffe link) and remove the LevelDB requirements (Im not 100% sure about that library name, but its the one that requires tcmalloc).

Then there was the issue with the vecLib headers, which are provided by XCode. You have to install xcode and when you search in your developer folder for vecLib, you'll have to put that in your path in the cmake.

NOTE: This repo does not have any changes in actual code, I'd just changed the documentation. You just have to follow the additional steps. Last time I compiled openpose on macOS BigSur, it worked perfectly. I haven't kept track on this library (great tool thought, just wasn't right for my application), so I am not sure if my fixes in the installation guide are still accurate. I will experiment and revert. But if you are ok with the version this repo was forked from, just following the steps in the modified installation and prerequisites files should work.

Again really sorry on not keeping track of this, but if you have any questions just send a message here, I'll try and respond over the next few days as I experiment with this.

@Ananay-22
Copy link

@jalpanchal Caffe was not the issue per se, it was one of its optional dependencies, leveldb that had the issue.
A simple fix would be to turn off the leveldb option in the cmakelist file for caffe. I've described it in the installation / prerequisite guides. This is a documented issue with leveldb last I checked

@Ananay-22
Copy link

@camrynfriedman I think the biggest issue is making sure cmake is able to find vecLib, and last I remember, it's find_veclib macro was not doing that properly. I'm not sure if the leveldb/ tcmalloc issue comes for every macOS build or not, but that is another one to look out for, as that happens on runtime and not compiletime

@jalpanchal
Copy link

Thank you for the quick response. @ananay22

TO clarify a few things, you mentioned you have no issues on Big Sur. Was it with the version this was forked from or a recent master/main of openpose ?

AFAIK the caffe with the openpose does not work and I see multiple posts about it and that's why the suggestion for using the brew caffe exists. Can the brew Caffe version be modified to reomve the issues with leveldd and vecLib ?

@Ananay-22
Copy link

Oh okay so, this was not recent, which is why I need to recheck this PR before actually asking for the merge.

But I remember having all those issues with caffe, and the thing is its very hard to fix those as they aren't that well documented.

I think you can modify the brew caffe installation rb file, but I would recommend using the github repo that the openpose developers provide, for the simple reason that I experimented with modifying / patching the brew build for a while, and either ran into a whole bunch of make issues or a whole bunch of runtime issues. And, from what I remember, the official caffe library is slightly different from the one provided.

If you do go through with it, and your issue is the tcmalloc thing, then you should disable the leveldb dependency in the brew rb file.

You can see how to edit a brew formula here: https://stackoverflow.com/a/3949908

@Ananay-22
Copy link

So just tested fresh builds, most issues seem to be fixed!

The tcmalloc error did not show up on 2 different systems. This was however, with the CMU_Perceptual_Computing_Lab Caffe fork, and not the official / brew version.
I did have an issue with the vecLib header on 1 system, but that would be because I might've had multiple / beta xcode installs. The xcode tools paths change a lot depending on that, and I dont think there is a '1-size-fits-all' solution for that. I see that the devs added in some well known / default xcode tool paths, but the paths can still differ a lot. You will have to manually go into openpose/3rdparty/caffe/cmake/Modules/, open the findVecLib file, and add your path in the paths option (you can find the vecLib.h file by searching it in finder), otherwise it might not work.
Maybe a more acceptable solution would be to put it on the CMake-Gui as an option @soulslicer @gineshidalgo99 ? I am not well versed with this stuff, so am not sure how feasible that would be, but i noticed there was an option to specify the caffe path, so maybe this might help too. Or it could be an issue that needs to be fixed on the caffe repository, I'll try and read up on how to do it and maybe submit a pull request there.

But for now, this fork is not helpful, the latest version seems to be working fine. Sorry that I forgot about this PR, but most issues seem to have resolved themselves!

@jalpanchal
Copy link

This is interesting. I get the tcmalloc error only when I use the brew's caffe version.

Nothing I did could resolve this. Thank you for your inputs though.

I finally got the OpenPose built and working using the provided Caffe using the steps by : https://medium.com/@alok.gandhi2002/build-openpose-with-without-gpu-support-for-macos-catalina-10-15-6-8fb936c9ab05

@ananay22
Copy link
Author

Yeah. Brew built caffe with levels and hence the tcmalloc error. The website makes you build caffe from the same source as openpose's documentation. I'm assuming they've also stopped building it with levels, hence no error

@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale/old label Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants