belangeo / pyo

Python DSP module
GNU Lesser General Public License v3.0
1.32k stars 132 forks source link

error installing on mac M1 system #267

Open dandante opened 1 year ago

dandante commented 1 year ago

Hello,

I have read many of the related issues that people are having and tried many of the solutions but I am still having trouble. First I installed pyo with pip but when I tried to import it I got

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyo/_pyo.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace (_Pa_AbortStream)

I then installed from source by cloning the repo and doing sudo python3 setup.py install and that succeeded, but when I import pyo I get:

ModuleNotFoundError: No module named 'pyo._pyo'

If I run python3 -c 'import pyo' from a different directory (other than the root of the repo) I am back to the original error of symbol not found in flat namespace.

Dependencies are installed via homebrew. I set up the following before building from source:

export LIBRARY_PATH="/opt/homebrew/lib:$LIBRARY_PATH"
export CPATH="/opt/homebrew/include:$CPATH"

Still having trouble.

Hope someone can help. Does this package run on an M1? Do I need to build it under Rosetta? BTW I am using an ARM (M1) version of Python.

Does pyo (including the wx/gui portions) work under Docker? I'd settle for a working docker image for the time being.

Thanks

RobertArbon commented 1 year ago

hey - I've almost got this working.

I had to:

However - it's still not working but that's because of a bad link to an internal module which i'm tempted make a PR for. Not much help but it will get you closer to it working.

RobertArbon commented 1 year ago

Actually - this still doesn't work. I'm at a loss.

scfleming commented 1 year ago

Had same issue on M1 Mac. Got this to work with normal pip install:

Edit your shell of choice with the following:

(if using bash, use export CFLAGS= syntax instead...) setenv CFLAGS '-I/opt/homebrew/include/' setenv LDFLAGS '-L/opt/homebrew/lib/'

Make sure you install portaduio using brew, as you've done already. I then got pip install pyo to install successfully since it will now compile the needed libraries looking in /opt/homebrew/ instead of /usr/local/

Hope this helps...

dandante commented 1 year ago

Thanks for all the comments everyone. I finally got this to work.

I had to install the following packages using brew:

portmidi libsndfile (maybe others that I have forgotten - but error messages should suggest what else you need to install).

I cloned this repo, cd'd to it, and activated a pre-existing virtual environment (you don't have to do this, but that's why I didn't install with sudo).

Then I set up the following variables in order to build:

export LIBRARY_PATH="/opt/homebrew/lib:$LIBRARY_PATH"
export CFLAGS='-I/opt/homebrew/include/'
export LDFLAGS='-L/opt/homebrew/lib/'

Then I just ran python setup.py install.

One weird thing is when I first tested it with python -c 'import pyo' I got an error, but all I had to do was change to a different directory. I went one level up (cd ..) and ran python -c 'import pyo' again and it worked.

Hopefully this helps someone.

Anthony-chianain commented 3 months ago

The pyo was installed and ran in my windows computer successfully but I had the same error, while trying to build a package with in kivy buildozer... I thought my own that maybe there are no recipies for it yet but right i do not know how i can make it work