eukarpov / openvino-plugins-ai-audacity

OpenVINO AI Plugins for Audacity on macOS M Generation Arm64
GNU General Public License v3.0
9 stars 5 forks source link

How to install openvino-plugins-ai-audacity on macOS Arm64 (M1 or later) #3

Open eukarpov opened 7 months ago

eukarpov commented 7 months ago

The installation process will be improved. In the meantime, here are the steps to use Audacity OpenVINO on macOS M generation with Arm64 processor.

Known issues:

The issue: After applying all steps, mod-openvino.so cannot be loaded.

The solutions: Remove Audacity or any unknown applications from System Settings - Privacy & Security - Files and Folders. This will prompt for access again upon startup to Documents or Downloads. or Move the Release folder to a location other than Documents or Downloads.

neokyol commented 7 months ago

I followed the steps with no luck. I can't get past the Unable to load the module "/Users/myuser/Documents/Release/Audacity.app/Contents/modules/mod-openvino.so". Error: No such file or directory. And the file is there. Is the message related to other files the .so is loading? I downloaded and unzipped all the models. I copied them into the apps folder and also into /usr/local/lib/ as the Linux instructive said.

eukarpov commented 7 months ago

Did you run from terminal? xattr -cr ~/Documents/Release Regarding models, you need to copy them only to the app folder.

neokyol commented 7 months ago

I did. I just re-did it, no luck. Are these 3 lines the same thing, right?

Add the required models to the Audacity application. Copy model files to Release/Audacity.app/Contents/openvino-models Follow these steps https://github.com/intel/openvino-plugins-ai-audacity/tree/main/doc/build_doc/linux#openvino-models-installation

I followed the guide then copied the resulting openvino-models folder into the Contents folder inside Release/Audacity.app. I'll try all the steps from scratch just to verify

eukarpov commented 7 months ago

You should be able to load mod-openvino even without models. Also, try moving the Release folder to a location other than Documents or Downloads, for instance, to /Applications.

neokyol commented 7 months ago

I extracted the Release folder, moved to /Applications, run the xattr command over the folder, run the app, enable the module, restart it: same unable to load mod-openvino module, no such file or directory. And the file is there algo the other modules.

neokyol commented 7 months ago

Maybe some missing dependency in my macOS. Btw I'm running 12.6.2 Monterey on an M1 Pro macbook.

eukarpov commented 7 months ago

It was tested on 14.3.1 Apple M1 MacBook Air. Does Release folder contain 3rdparty folder? Do you have clang++ available in the terminal?

neokyol commented 7 months ago

Yes to both questions. I don't have some System\Library deps mentioned in the .so. Like System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL

neokyol commented 7 months ago

Inside 3rdparty folder I only have a folder called tbb and one dylib inside it

neokyol commented 7 months ago

If I download the official 3.4.2, I can enable mod-openvino without issues.

neokyol commented 7 months ago

I'll update my OS and try again. Thanks for your help and for this work.

eukarpov commented 7 months ago

Let's try this code then

#include <iostream>
#include <dlfcn.h> // For dlopen, dlsym, dlclose

int main() {
    // Open the shared object file
    void* handle = dlopen("<path to>/Release/Audacity.app/Contents/modules/mod-openvino.so", RTLD_LAZY);
    if (!handle) {
        std::cerr << "Error loading shared object: " << dlerror() << std::endl;
        return 1;
    }

    // Close the shared object
    dlclose(handle);

    return 0;
}
clang++ -std=c++11 -o test test.cpp
./test
neokyol commented 7 months ago

Nice one:

Error loading shared object: dlopen(/Applications/Release/Audacity.app/Contents/modules/mod-openvino.so, 0x0001): Library not loaded: '@rpath/libomp.dylib'
  Referenced from: '/Applications/Release/Audacity.app/Contents/Frameworks/libtorch_cpu.dylib'
  Reason: tried: '/Users/runner/work/pytorch/pytorch/pytorch/build/lib/libomp.dylib' (no such file), '/Users/runner/work/_temp/anaconda/envs/wheel_py38/lib/libomp.dylib' (no such file), '/Users/runner/work/pytorch/pytorch/pytorch/build/lib/libomp.dylib' (no such file), '/usr/local/lib/libomp.dylib' (no such file), '/usr/lib/libomp.dylib' (no such file)
eukarpov commented 7 months ago

Try to install libomp

brew install libomp

neokyol commented 7 months ago

After doing that the test failed with more errors related to libomp. I installed libtorch and reinstalling libomp now... it's taking a while

neokyol commented 7 months ago

Nope. It still fails and test says

Error loading shared object: dlopen(/Applications/Release/Audacity.app/Contents/modules/mod-openvino.so, 0x0001): Library not loaded: '@rpath/libomp.dylib'
  Referenced from: '/Applications/Release/Audacity.app/Contents/Frameworks/libtorch_cpu.dylib'
  Reason: tried: '/Users/runner/work/pytorch/pytorch/pytorch/build/lib/libomp.dylib' (no such file), '/Users/runner/work/_temp/anaconda/envs/wheel_py38/lib/libomp.dylib' (no such file), '/Users/runner/work/pytorch/pytorch/pytorch/build/lib/libomp.dylib' (no such file), '/usr/local/lib/libomp.dylib' (no such file), '/usr/lib/libomp.dylib' (no such file)
eukarpov commented 7 months ago

do you have libomp.dylib in homebrew? /opt/homebrew//Cellar/libomp/18.1.3/lib/libomp.dylib if so, try to copy the library to /usr/local/lib

neokyol commented 7 months ago

It worked!!! Thank you very much, sir.

eukarpov commented 7 months ago

Thank you for testing it. I will recap the detected requirements and update the installation guide accordingly.

ra7kar commented 6 months ago

Hello @eukarpov , hope you are doing well, just a gentle follow up on the installation guide and step to setup openvino-plogins-ai-audacity on a MacOS - M1 Could you please share the link or details, Thank you so much.

eukarpov commented 6 months ago

This thread provides instructions how to install on Apple M1 or later. https://github.com/eukarpov/openvino-plugins-ai-audacity/issues/3#issue-2235697286

olsgo commented 4 months ago

Hi, eukarpov. Thanks for your work in the Mac department! Seems like the experimental build is no longer available for download. Could you perhaps post it again?

Thank you!

eukarpov commented 4 months ago

The references to the build has been updated.

olsgo commented 4 months ago

The references to the build has been updated.

Thank you so much! Gonna try to install it and report back if I have issues.

olsgo commented 4 months ago

Followed the instructions in the thread closely and everything works perfectly. Thank you so much @eukarpov !!!

dimako88 commented 3 months ago

PLease, @olsgo and @neokyol, and ofcourse @eukarpov - as You managed to handle it - May You advise how to follow the instructions? As hard as I try to follow them, as much I get only errors

1) % sudo apt install git-lfs The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt.

xjlin0 commented 2 months ago

@dimako88 for installing git-lfs on Mac, maybe you can try https://git-lfs.com/ instead of sudo apt install git-lfs:

brew install git-lfs
lordillusions commented 1 month ago

It worked fine here too, thanks. The piece with libomp is very important, same happened with me.

em77 commented 1 month ago

@eukarpov I tried all the above steps and got the error pop-up when opening audacity that the module couldn't be loaded. I then read all the comments and installed git-lfs and libomp with brew and copied libomp.dylib to /usr/local/lib/. I can now open and close the application and in the Module preferences it says openvino is enabled but it's not visible in the Effects menu or the plugins manager. What should I try next?

eukarpov commented 1 month ago

@em77 In which folder has Audacity been unpacked?

cicerojones commented 1 week ago

It seems like the build has expired again? (Short of downloading the source and trying to build the application myself, which seems like a process that might be fairly involved) Is there anything the user is supposed to do?

I gladly offer any help in the documentation process, as I think this is important work to make available to the community. Thank you!

eukarpov commented 1 week ago

Thanks for reporting it. The build link has been updated. The next step is to prepare the experimental release.

cicerojones commented 3 days ago

I too was able to use all the above (I'm on a 2020 M1, updated to 14.5) and get a working music separator. Of course, the process would be a little confusing for the uninitiated. I have no great macOS development skills, but I'm happy to help however I can in preparing the experimental release.

One note, the music separator function here is computationally intensive in a way that it wasn't when I used it on a standard Windows work laptop. I get an out of system memory warning and 2-3 minute songs can take anywhere from 15-30 minutes for separation into 4 tracks (would take a few minutes on my Windows machine). I only (!) have 8GB of RAM, don't know if anyone else has this issue or if anything can be done to tweak it, apart from getting more memory. Maybe there is supposed to be a GPU option (I only see CPU)?