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

Friture does not open on MacOS Big Sur #154

Closed
jssblck opened this issue Dec 15, 2020 · 43 comments
Closed

Friture does not open on MacOS Big Sur #154

jssblck opened this issue Dec 15, 2020 · 43 comments
Labels

Comments

@jssblck
Copy link

jssblck commented Dec 15, 2020

Screen Shot 2020-12-15 at 10 15 19 AM

Basically getting this issue. Installing pyopengl in my env doesn't help (I assume because friture has its own python installation).

(Another user posted in the google group here: http://friture.org/forum.html?place=msg%2Ffriture%2Fm-eNLpOqQDc%2Fsh4IlNNgCAAJ)

Happy to do any troubleshooting I can to help!

@korovkin
Copy link

i have the same issue

@korovkin
Copy link

Running the latest and greatest from sources give me this error:

Uploading image.png…

@korovkin
Copy link

2020-12-30 00:21:01,270 CRITICAL friture.exceptionhandler: Unhandled exception: Traceback (most recent call last):
  File "main.py", line 6, in <module>
    main()
  File "/Users/haim_grosman/v/friture/friture/analyzer.py", line 365, in main
    window = Friture()
  File "/Users/haim_grosman/v/friture/friture/analyzer.py", line 87, in __init__
    self.settings_dialog = Settings_Dialog(self)
  File "/Users/haim_grosman/v/friture/friture/settings.py", line 60, in __init__
    channels = AudioBackend().get_readable_current_channels()
  File "/Users/haim_grosman/v/friture/friture/audiobackend.py", line 379, in get_readable_current_channels
    nchannels = self.device['max_input_channels']
TypeError: 'NoneType' object is not subscriptable

@korovkin
Copy link

please let me know what else i can share to fix this. i like the app, but it's completely broken now on Big Sur

@enryfox
Copy link

enryfox commented Dec 31, 2020

Friture would actually work if built from source on Big Sur, but that was before the 11.1 upgrade. Now I get the same error when launching Friture from within the virtualenv

@korovkin
Copy link

korovkin commented Dec 31, 2020 via email

@enryfox
Copy link

enryfox commented Dec 31, 2020

You need to install homebrew https://brew.sh/index; following procedure is then the friture linux installation guide modified for macos (not fully tested, I just edited the procedure by memory)

1 Install git

brew install git

2 Install python 3.9

brew install python@3.9

3 Clone the repository

git clone https://github.com/tlecomte/friture.git
cd friture

4 Update pip, setuptools and virtualenv

python3 -m pip install --upgrade pip
pip3 install --upgrade setuptools
pip3 install --upgrade virtualenv

5 Create a virtualenv and activate it

virtualenv -p /usr/local/bin/python3 buildenv
source ./buildenv/bin/activate

6 Install Friture requirements (PyQt5, etc.)

pip3 install -r requirements.txt

7 Build Cython extensions

python3 setup.py build_ext --inplace

8 Run Friture

python3 main.py

@korovkin
Copy link

korovkin commented Dec 31, 2020 via email

@enryfox
Copy link

enryfox commented Dec 31, 2020

Python 3.8 has the same pyOpenGL problem as the official friture build. It is fixed in python 3.9, but anyway friture crashes with an error after the boot screen.

@tlecomte
Copy link
Owner

tlecomte commented Jan 8, 2021

Dear all,

Sorry for this issue. I don't have access to any Mac myself, and that does not make it to fix such errors.

I've just released Friture 0.42 (https://github.com/tlecomte/friture/releases/tag/v0.42), could you confirm that this version has the same problem ? (I guess it has the same problem since you tried building from source already)

It looks like some of you have succeeded building with Python 3.9 and that solved the problem ?

@korovkin
Copy link

korovkin commented Jan 8, 2021 via email

@korovkin
Copy link

korovkin commented Jan 8, 2021 via email

@tlecomte
Copy link
Owner

tlecomte commented Jan 8, 2021

Regarding building from source, the script used by the build pipeline can give you the steps: https://github.com/tlecomte/friture/blob/master/.github/workflows/install-macos.sh

@korovkin
Copy link

korovkin commented Jan 8, 2021 via email

@enryfox
Copy link

enryfox commented Jan 9, 2021

Just to summarise: python 3.8 has a problem with OpenGL libraries on Macos Big Sur; it can be fixed by manually editing a python file in the environment used to build friture (i can give details if needed). The OpenGL problem is fixed in python 3.9.

Either with Python 3.9 or a fixed python 3.8 you then get the error

File "/Users/haim_grosman/v/friture/friture/audiobackend.py", line 379,
in get_readable_current_channels
nchannels = self.device['max_input_channels']
TypeError: 'NoneType' object is not subscriptable

That is new to Macos 11.1, because I was able to have friture run in Macos 11.0.1. I have no idea how to fix that error.

@tlecomte
Copy link
Owner

tlecomte commented Jan 9, 2021

@enryfox or @korovkin: Would you be able to share the entire log file? I suspect this error is the result of a previous error when finding the first working input device. Thanks!

(I've landed the update to Python 3.9.1, so the next release should at least contain this first part of the fix)

@enryfox
Copy link

enryfox commented Jan 9, 2021

Here it is:

21-01-09 16:45:26,825 INFO friture.analyzer: Friture 0.42 starting on Darwin (darwin)
2021-01-09 16:45:27,024 INFO friture.analyzer: Applying Mac OS-specific setup
2021-01-09 16:45:27,024 INFO friture.analyzer: Adding the following to the Library paths: /usr/local/Cellar/python@3.9/3.9.1_5/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/PlugIns
2021-01-09 16:45:27,602 INFO friture.audiobackend: Initializing audio backend
2021-01-09 16:45:27,602 INFO friture.audiobackend: Opening the stream for device 'Built-in Microphone'
||PaMacCore (AUHAL)|| Error on line 1277: err='-66748', msg=Unknown Error
2021-01-09 16:45:27,632 ERROR friture.audiobackend: Failed to open stream
Traceback (most recent call last):
File "/Users/enrico/git/friture/friture/audiobackend.py", line 98, in init
(self.stream, self.ringBuffer, self.action, self.nchannels_max) = self.open_stream(device)
File "/Users/enrico/git/friture/friture/audiobackend.py", line 320, in open_stream
stream = rtmixer.Recorder(
File "/Users/enrico/git/friture/buildenv/lib/python3.9/site-packages/rtmixer.py", line 226, in init
_Base.init(self, kind='input', **kwargs)
File "/Users/enrico/git/friture/buildenv/lib/python3.9/site-packages/rtmixer.py", line 36, in init
_sd._StreamBase.init(
File "/Users/enrico/git/friture/buildenv/lib/python3.9/site-packages/sounddevice.py", line 892, in init
_check(_lib.Pa_OpenStream(self._ptr, iparameters, oparameters,
File "/Users/enrico/git/friture/buildenv/lib/python3.9/site-packages/sounddevice.py", line 2738, in _check
raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening Recorder: Internal PortAudio error [PaErrorCode -9986]
2021-01-09 16:45:27,648 CRITICAL friture.exceptionhandler: Unhandled exception: Traceback (most recent call last):
File "/Users/enrico/git/friture/main.py", line 6, in
main()
File "/Users/enrico/git/friture/friture/analyzer.py", line 365, in main
window = Friture()
File "/Users/enrico/git/friture/friture/analyzer.py", line 87, in init
self.settings_dialog = Settings_Dialog(self)
File "/Users/enrico/git/friture/friture/settings.py", line 60, in init
channels = AudioBackend().get_readable_current_channels()
File "/Users/enrico/git/friture/friture/audiobackend.py", line 379, in get_readable_current_channels
nchannels = self.device['max_input_channels']
TypeError: 'NoneType' object is not subscriptable

@tlecomte
Copy link
Owner

tlecomte commented Jan 9, 2021

Thanks!

So the initial error occurred when trying to read from the microphone:

2021-01-09 16:45:27,602 INFO friture.audiobackend: Opening the stream for device 'Built-in Microphone'
||PaMacCore (AUHAL)|| Error on line 1277: err='-66748', msg=Unknown Error
2021-01-09 16:45:27,632 ERROR friture.audiobackend: Failed to open stream
Traceback (most recent call last):
File "/Users/enrico/git/friture/friture/audiobackend.py", line 98, in init
(self.stream, self.ringBuffer, self.action, self.nchannels_max) = self.open_stream(device)
File "/Users/enrico/git/friture/friture/audiobackend.py", line 320, in open_stream
stream = rtmixer.Recorder(
File "/Users/enrico/git/friture/buildenv/lib/python3.9/site-packages/rtmixer.py", line 226, in init
_Base.init(self, kind='input', **kwargs)
File "/Users/enrico/git/friture/buildenv/lib/python3.9/site-packages/rtmixer.py", line 36, in init
_sd._StreamBase.init(
File "/Users/enrico/git/friture/buildenv/lib/python3.9/site-packages/sounddevice.py", line 892, in init
_check(_lib.Pa_OpenStream(self._ptr, iparameters, oparameters,
File "/Users/enrico/git/friture/buildenv/lib/python3.9/site-packages/sounddevice.py", line 2738, in _check
raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening Recorder: Internal PortAudio error [PaErrorCode -9986]

@tlecomte
Copy link
Owner

tlecomte commented Jan 9, 2021

I wonder if it might be because Friture is not asking for permission to read from the microphone. Are you getting the macos popup saying that Friture would like to access the microphone ?

@enryfox
Copy link

enryfox commented Jan 9, 2021

Actually I had already granted mic permission to the terminal app where I launch friture; i remember that in macos 11.0.1 it would not ask for permission, but friture would start and not capture anything from the mic. After allowing mic access to the terminal, friture was working fine.
With MacOS 11.1 it crashes regardless mic access is granted or not (I tried both cases and got the same exception)

@tlecomte
Copy link
Owner

tlecomte commented Jan 9, 2021

Ok, thanks. So there must be something else.

For my reference anyway, I think I'll review what might be added for proper mic permissions:
https://pyinstaller.readthedocs.io/en/stable/spec-files.html#spec-file-options-for-a-mac-os-x-bundle
https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos

@tlecomte
Copy link
Owner

tlecomte commented Jan 9, 2021

Another possibility is that the mic input does not support the format that Friture requests (48 kHz with 16 bit samples).

Just to confirm: does your mic input work from other apps ? If you could test with Audacity, that would be great.

Thanks!

@enryfox
Copy link

enryfox commented Jan 9, 2021

Audacity works fine, it can monitor and record from the microphone.

@enryfox
Copy link

enryfox commented Jan 9, 2021

as a side note it looks like also pyinstaller is having problem in big sur, it cannot find system libraries...

@enryfox
Copy link

enryfox commented Jan 9, 2021

as a side note it looks like also pyinstaller is having problem in big sur, it cannot find system libraries...

Sorry, may bad ... pyinstaller 4.1 works fine, it was 4.0 having problems

@tlecomte
Copy link
Owner

@enryfox I've pushed a change to log the supported input formats, to rule that scenario out.

That being said, I believe the issue is the one currently being discussed in PortAudio repository:

There is also an identical issue in the python-sounddevice repository (it's the portaudio wrapper that Friture uses):
spatialaudio/python-sounddevice#299 (comment)

In that thread, a workaround is suggested, by installing portaudio from the tip of the repo, with:

brew uninstall portaudio
brew install portaudio --HEAD

Would you be in position to test that workaround, and/or the latest Friture code from Git (for the supported formats log), please ?

@enryfox
Copy link

enryfox commented Jan 13, 2021

Updated my local repo and installed portaudio using the command

brew install portaudio --HEAD

good news is, now friture starts-up correctly and works fine (audio is captured from the internal mic). I'm still unable to generate a self-contained re-distributable application which works correctly: pyinstaller works fine (apparently) but the resulting app hangs on start-up with no error.

@stevemaser
Copy link

I just wanted to report (may not be helpful, but...) as we are validating software for macOS 11 here: We have the "PyOpenGL" error with Friture .41 on mac OS 11.1 (both Intel and M1), so I downloaded (today) .42 and installed that -- but when I launch it, it just throws up the Spinning Wheel of Death. From reading above it seems like some people got .42 working -- so is there something we might need to do on our end to get .42 to function? (.41 still works on our macOS 10.15 and earlier systems, fwiw...)

tlecomte added a commit that referenced this issue Jan 19, 2021
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154
tlecomte added a commit that referenced this issue Jan 19, 2021
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154
tlecomte added a commit that referenced this issue Jan 19, 2021
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154
tlecomte added a commit that referenced this issue Jan 19, 2021
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154
tlecomte added a commit that referenced this issue Jan 20, 2021
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154

Also remove the vcruntime140.dll workaround that is not needed with latest pyinstaller, and was getting confusing to apply next to the Macos setting.
tlecomte added a commit that referenced this issue Jan 23, 2021
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154

Also remove the vcruntime140.dll workaround that is not needed with latest pyinstaller, and was getting confusing to apply next to the Macos setting.
tlecomte added a commit that referenced this issue Jan 23, 2021
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154

Also remove the vcruntime140.dll workaround that is not needed with latest pyinstaller, and was getting confusing to apply next to the Macos setting.
tlecomte added a commit that referenced this issue Jan 23, 2021
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154

Also remove the vcruntime140.dll workaround that is not needed with latest pyinstaller, and was getting confusing to apply next to the Macos setting.
tlecomte added a commit that referenced this issue Jan 23, 2021
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154

Also remove the vcruntime140.dll workaround that is not needed with latest pyinstaller, and was getting confusing to apply next to the Macos setting.
tlecomte added a commit that referenced this issue Jan 23, 2021
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154

Also remove the vcruntime140.dll workaround that is not needed with latest pyinstaller, and was getting confusing to apply next to the Macos setting.
tlecomte added a commit that referenced this issue Jan 23, 2021
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154

Also remove the vcruntime140.dll workaround that is not needed with latest pyinstaller, and was getting confusing to apply next to the Macos setting.
tlecomte added a commit that referenced this issue Jan 23, 2021
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154

Also remove the vcruntime140.dll workaround that is not needed with latest pyinstaller, and was getting confusing to apply next to the Macos setting.
@tlecomte
Copy link
Owner

tlecomte commented Mar 7, 2021

Portaudio has now closed their GitHub issue about Macos Big Sur compatility. I have uploaded Friture 0.44 which contains the latest Portaudio code with all the Macos fixes.

Would you be able to test friture.dmg 0.44 please ? @stevemaser @enryfox @korovkin @kitified

@enryfox
Copy link

enryfox commented Mar 7, 2021

Your latest 0.44 hangs on start-up with no error message thrown.
By the way i checked latest brew package of portaudio and it still contains the Big Sur error. To have friture running, I still need to install -HEAD version.

@tlecomte
Copy link
Owner

tlecomte commented Mar 7, 2021

Thank you very much for trying @enryfox

The macos dmg is built with the portaudio brew package installed from HEAD: install-macos.sh#L16, and then we have a pyinstaller hook to use that version of the library: hook-sounddevice.py

So it seems that is not enough. Any idea ?

@enryfox
Copy link

enryfox commented Mar 7, 2021

The problem is not the portaudio library, but in the pyinstaller. Running friture from source code works fine, but the app bundle generated by pyinstaller does not work, it hangs on start-up with no indication of what is wrong. The app bundle I created on January 30th still works, but if I try to create a new one from source, I get the same result as with your latest 0.44 pkg.

tlecomte added a commit that referenced this issue Mar 8, 2021
Attempt to fix #154: Friture pyinstaller package does not work on Macos Big Sur.

There are multiple reports online about PyQt5 apps not starting correctly on Macos Big Sur. The fix involves setting the `QT_MAC_WANTS_LAYER` env variable, which is now done by default on PyQt5 5.15.2 and later.
Here we update to PyQt5 5.15.3.

References:
https://tickets.metabrainz.org/projects/PICARD/issues/PICARD-1858
https://stackoverflow.com/questions/64833558/apps-not-popping-up-on-macos-big-sur-11-0-1?noredirect=1&lq=1
https://stackoverflow.com/questions/64818879/is-there-any-solution-regarding-to-pyqt-library-doesnt-work-in-mac-os-big-sur
https://riverbankcomputing.com/news/PyQt_v5.15.2_Released
> The QT_MAC_WANTS_LAYER environment variable is automatically set on macOS.
@enryfox
Copy link

enryfox commented Mar 8, 2021

Thanks - working now

@stevemaser
Copy link

stevemaser commented Mar 8, 2021 via email

@tlecomte
Copy link
Owner

tlecomte commented Mar 8, 2021

@enryfox I assume your comment is about the PyQt5 update ? That's great news ! Thanks !!

@stevemaser Feel free to test again with Friture 0.45, freshly released a couple minutes ago: https://github.com/tlecomte/friture/releases/tag/v0.45

@stevemaser
Copy link

stevemaser commented Mar 8, 2021 via email

@enryfox
Copy link

enryfox commented Mar 8, 2021

@enryfox I assume your comment is about the PyQt5 update ? That's great news ! Thanks !!

I cloned the git branch from scratch and built the app bundle with the new QT and it now works. Unfortunately, the 0.45 release has the same issue as post #1: Have you reverted back to an older version of python ?

@srydblom
Copy link

Hi, are there any news on this subject? I tried to install friture 0.45 on the Mac OS Big Sur 11.2.3, but I get the same error “PyOpenGL must be installed to run this example” as shown. If I want to compile it myself, which version should I use then?
Best Regards,
/Stefani

@thirstyice
Copy link

@tlecomte Looks like Portaudio has upgraded to version 19.7.0, which supposedly fixes it on BigSur, in case you want to not build directly from the latest master

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

No branches or pull requests

7 participants