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

error installing on mac M1 system #267

Open
dandante opened this issue May 6, 2023 · 4 comments
Open

error installing on mac M1 system #267

dandante opened this issue May 6, 2023 · 4 comments

Comments

@dandante
Copy link

dandante commented May 6, 2023

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
Copy link

RobertArbon commented May 15, 2023

hey - I've almost got this working.

I had to:

  • reinstall homebrew and make sure all the dependencies are in the right place.
  • clone the git repo and install using sudo python setup.py install --use-coreaudio --use-double
  • fix the occaisional problem with it not finding header files by looking at the error message and making appropriate symbolic links to the various header file directories.

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
Copy link

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

@scfleming
Copy link

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
Copy link
Author

dandante commented Sep 5, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants