-
Notifications
You must be signed in to change notification settings - Fork 10
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
Embed Max python3 external #2
Comments
oh sweet! i was looking for something like this to make setup easier! I'll take a look and see if I can build it into this! |
Unless you have a strong preference to compile everything from source, I think the quickest way for you to get started is just to use one of recent build variants from the releases section. There are a bunch which serve different deployment purposes (the
|
I'm trying to work with |
Is py-js-static-ext-darwin-arm64-3.11.2.dmg.zip signed? seem to be running into a quarantine issue with it |
seem to be running into the same issue with py-js-shared-ext-darwin-x86-3.11-170c83f.zip. Got the releases from here: https://github.com/shakfu/py-js/releases |
I'm not sure why, if you have not modified it any way, it should work. I'll also check on an M1 mac, but on intel MacBook pro I just checked the static-ext version: $ codesign --check-notarization --verify -v externals/py.mxo/Contents/MacOS/py
externals/py.mxo/Contents/MacOS/py: valid on disk
externals/py.mxo/Contents/MacOS/py: satisfies its Designated Requirement |
Here's the same from an M1 MacBook: % uname -a
Darwin minx 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:19 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8103 arm64
% codesign -v --check-notarization --verify py.mxo/Contents/MacOS/py
py.mxo/Contents/MacOS/py: valid on disk
py.mxo/Contents/MacOS/py: satisfies its Designated Requirement |
ah! my bad, seems like adding dropping in the packages in |
gonna try building from source! |
Well, at least you have a working baseline. Incidentally, I checked the dependencies of $ virtualenv venv && source venv/bin/activate
created virtual environment CPython3.11.4.final.0-64 in 500ms
(venv) $ pip install vamp
Collecting vamp
Using cached vamp-1.1.0-cp311-cp311-macosx_12_0_x86_64.whl
Installing collected packages: vamp
Successfully installed vamp-1.1.0
(venv) $ cd venv/lib/python3.11/site-packages/
(venv) $ ls
__pycache__/ setuptools/
_distutils_hack/ setuptools-67.8.0.dist-info/
_virtualenv.pth setuptools-67.8.0.virtualenv
_virtualenv.py vamp/
distutils-precedence.pth vamp-1.1.0.dist-info/
pip/ vampyhost.cpython-311-darwin.so*
pip-23.1.2.dist-info/ wheel/
pip-23.1.2.virtualenv wheel-0.40.0.dist-info/
pkg_resources/ wheel-0.40.0.virtualenv
(venv)$ fd --glob '*.so'
vampyhost.cpython-311-darwin.so As you can see Hope this helps. |
Thanks! I've got one last question, is there a way to build |
Feel free to compile as you like (the README is helpful), but you'll end up with the same codesign issue as above. By the way, can you try the following as an experiment:
|
I just found a newly introduced bug that will break compilation. I've fixed it now. |
You can build them in manually as above, or you can set the python path in the external itself (see README). |
after reading the readme a bit, maybe what I need is to build a |
Ok, I've done it. |
Yes, that's exactly right, but in my efforts to shrink the externals, I dropped unicodedata and you need it to pip install (if you want pip install), but manual installation works.. until I fix the pip issue. Anyway, try the external I linked to above and let me know if it works for you somehow. |
@hugofloresgarcia in case you missed it somehow: py-js-shared-ext-darwin-arm64-3.11.4-vamp.dmg.zip imports vamp without errors. I maybe able to reduce its size a little but numpy is a sizeable dependency. Have fun. |
Ah, thanks so much for helping me figure this out, and getting that binary w/ the libraries in it! Trying it now. |
Ah! looks like the vamp package that's in there is actually this, hence the need for numpy I think? The |
We're you able to create that executable by installing the packages in a separate environment, copying them over to the external, then re-signing the executable? I'd like to be able to figure out how to do it on my end, so I can change the python packages if needed for unloop. |
After getting some sleep, I had another go and here's the result:
So in summary (1) is a self-contained code signed and notarized external with compiled extensions and (2) is a folder of the same dependencies but with extensions removed and it works well in a Also there's a third way here: if you want to make changes going forward and must use compiled extensions just create something like the DEPS folder using a virtualenv (until there's a more user-friendly mechanism, that is) and copy the contents into the This will codesign the external with an ad-hoc signature and then you can package the result and ship it to users even if you don't have an apple developer subscription with the caveat that there will be a "remove quarantine" dialog on Max the moment it's used. But this is a one time thing, and users are kind of used to it by now. Of course, you can get rid of that quarantine by getting an apple dev subscription (around 100. USD / year), but in this case, and in the case of open-source software in general, it's clearly not worth the cost. Have fun. |
@hugofloresgarcia did you have any luck with the last external I attached above? |
hey @shakfu! haven't gotten a chance to try it yet, dealing with some other research stuff today. will probably get a chance to try it in a couple hours and i'll let you know! |
Not sure you how got along... But in case you are still interested to embed your python code into a Max package or a standalone. There's a very simple solution now: just This will install a relocatable Python.framework in the support directory (it will have pip, so you can install whatever you like into it), it will also build and link a python3 external against this framework. This structure can be used in a Max package or a standalone. |
Thanks so much @shakfu!!! I have a deadline coming up on the 31st for another project that's taking a bunch of my time, but planning to get back on this to make this easier to distribute! Thanks a lot for your help! |
Cool project, I think you are the first Max project which may actually have a use for one of my python3 externals for Max
It looks like you are just using a python client to contact, in that case you can easily embed the client n your Python3 external and then package your Max patch as a Max Package or a Standalone. In any case, check out the project. It even has code signed and notarized releases. (-:
One big caveat though: it's macOS only.
The text was updated successfully, but these errors were encountered: