shakfu / py-js

Python3 externals for Max / MSP
MIT License
106 stars 7 forks source link

errors in compilation of py-js on Mac M1 #9

Closed marcobn closed 1 year ago

marcobn commented 1 year ago

Dear Shakeeb, first of all thank you so much for this project. It is really cool! I have a problem in compiling py using my loaded python3 installation (numpy and other packages that I use routinely) but I am running into errors that I am not sure are related to the platform (Mac Book Pro M1) or my not understanding of the process. I am attaching a log of the error, and the slightly modified Makefile (with updated variables for my configuration). Any help is greatly appreciated! Thanks, marco (@marcobn)

Marco Buongiorno Nardelli (he/him) log.txt Makefile.txt

Regents Professor, University of North Texas External Professor, Santa Fe Institute CEMI, Center for Experimental Music and Intermedia iARTA, Initiative for Advanced Research in Technology and the Arts ArtSciLab, ATEC @ the University of Texas at Dallas

http://ermes.unt.edu/ http://www.materialssoundmusic.com/

shakfu commented 1 year ago

Hi @marcobn

Thanks for your interest in this project. May I suggest that you download some of the releases. I believe there are some which are Apple Silicon compatible.

If you insist on compiling then, from your log.txt attachment, it looks like you are trying to compile a static version of py as per the invocation of StaticPythonBuilder (and also that you have installed py-js in a location where the path has spaces.

First, please note that installing py-js in a path with spaces is not supported. This constraint is point 3 in the README quickstart section:

3. Git clone the py-js [repo](https://github.com/shakfu/py-js) to a path without a space...

So you'll have to fix this issue first.

Next, static build variations do not support numpy. This is stated in the comparison matrix in the 'Build Variations' section int the README.

So I recommend that you read and reread the README.md carefully.

If you fix the spaces issue, please note that for 80% of the time, you can just create a local python3 external and it'll do what you want since it will have access to all of your packages installed in your site-packages. To do this, just type:

make

The only issue with this is that it's not portable and cannot be used in Max packages and standalones. That's where all the others come in: all the other build variations are only needed if you are creating a standalone or a package.

If you are, then note you will have to manually populate this external or package with your own python packages. Again, there are examples of this in the 'Releases' section

Also, don't worry about numpy. There is hardly support for numpy in this project, it really is at the placeholder level, which is why I disabled the auto-switch which checks if it was installed and made it manual at the Makefile and cmake-level.

Adding real Numpy support is a whole subproject and requires mapping numpy data structures to Max atoms at the numpy c-api level which is on the todo list. This could be sped up by the developments in cython 3.x but today it's not there.

Hope the above clarifies things a little bit. Please feel free to ask further questions, and I will do my best to answer them for you.

marcobn commented 1 year ago

Thatnks! The space was indeed the problem. I just compiled successfully. And I see the problem with numpy. Thanks again for your help and the py-js project. marco

Marco Buongiorno Nardelli (he/him) Regents Professor, University of North Texas External Professor, Santa Fe Institute CEMI, Center for Experimental Music and Intermedia iARTA, Initiative for Advanced Research in Technology and the Arts ArtSciLab, ATEC @ the University of Texas at Dallas http://ermes.unt.edu http://www.materialssoundmusic.com

From: Shakeeb Alireza @.> Date: Tuesday, March 21, 2023 at 11:28 AM To: shakfu/py-js @.> Cc: Buongiorno Nardelli, Marco @.>, Mention @.> Subject: [EXT] Re: [shakfu/py-js] errors in compilation of py-js on Mac M1 (Issue #9)

Hi @marcobnhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmarcobn&data=05%7C01%7CMarco.BuongiornoNardelli%40unt.edu%7C841835d9b8bb487e1e9408db2a2959ca%7C70de199207c6480fa318a1afcba03983%7C0%7C0%7C638150129332583788%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=uUoFczjv2tQ4cg4VXQucppU91jmTBhI5lRliDlmU0Vg%3D&reserved=0

Thanks for your interest in this project. May I suggest that you download some of the releases. I believe there are some which are Apple Silicon compatible.

If you insist on compiling then, from your log.txt attachment, it looks like you are trying to compile a static version of py as per the invocation of StaticPythonBuilder (and also that you have installed py-js in a location where the path has spaces.

First, please note that installing py-js in a path with spaces is not supported. This constraint is point 3 in the README quickstart section:

  1. Git clone the py-js repo to a path without a space...

So you'll have to fix this issue first.

Next, static build variations do not support numpy. This is stated in the comparison matrix in the 'Build Variations' section int the README.

So I recommend that you read and reread the README.md carefully.

If you fix the spaces issue, please note that for 80% of the time, you can just create a local python3 external and it'll do what you want since it will have access to all of your packages installed in your site-packages. To do this, just type:

make

The only issue with this is that it's not portable and cannot be used in Max packages and standalones. That's where all the others come in: all the other build variations are only needed if you are creating a standalone or a package.

If you are, then note you will have to manually populate this external or package with your own python packages. Again, there are examples of this in the 'Releases' section

Also, don't worry about numpy. There is hardly support for numpy in this project, it really is at the placeholder level, which is why I disabled the auto-switch which checks if it was installed and made it manual at the Makefile and cmake-level.

Adding real Numpy support is a whole subproject and requires mapping numpy data structures to Max atoms at the numpy c-api level which is on the todo list. This could be sped up by the developments in cython 3.x but today it's not there.

Hope the above clarifies things a little bit. Please feel free to ask further questions, and I will do my best to answer them for you.

— Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fshakfu%2Fpy-js%2Fissues%2F9%23issuecomment-1478173523&data=05%7C01%7CMarco.BuongiornoNardelli%40unt.edu%7C841835d9b8bb487e1e9408db2a2959ca%7C70de199207c6480fa318a1afcba03983%7C0%7C0%7C638150129332583788%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5S1O3d6sV%2FVpsVebU89yug7A%2FKCm9zZuautdzW4jVMQ%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFQOHKRJDJRS64TCQFLNIQLW5HJMBANCNFSM6AAAAAAWCUPSLQ&data=05%7C01%7CMarco.BuongiornoNardelli%40unt.edu%7C841835d9b8bb487e1e9408db2a2959ca%7C70de199207c6480fa318a1afcba03983%7C0%7C0%7C638150129332583788%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=joPULcySm%2BEPWcMrgcZ2%2B3j0fZ0c2INzEermEGUgZFc%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

shakfu commented 1 year ago

Thanks. I'm glad it worked out for you. I will treat this issue as closed then.