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

mu-editor hangs on macOS Big Sur #1147

Closed
ged99 opened this issue Nov 16, 2020 · 55 comments
Closed

mu-editor hangs on macOS Big Sur #1147

ged99 opened this issue Nov 16, 2020 · 55 comments

Comments

@ged99
Copy link

ged99 commented Nov 16, 2020

I have been using mu-editor successfully for a while under Catolina on my Mac. Today I upgraded the OS to Big Sur. Now the mu-editor does not open. When I launch it by clicking on the icon, the app just hangs. There are no error messages.

I have to close the application through the "Force Quit Applications". In this window it shows that mu-editor is running but not responding.

I re-installed the editor with the latest version from the website, but this did not work either.

If you are reporting a bug, we would like to know:

  • What you were trying to do: Launch the mu-editor
  • What steps you took to make this happen: click on its icon
  • What you expected to happen: Editor to open
  • What actually happened: editor just hung - no error messages
  • Why this difference is problematic (it may not be a bug!): The pp no longer works and I cannot run Python!!
  • Technical details like the version of Mu you're using, your OS version and
    other aspects of the context in which Mu was running.
    macOS Big Sur V 11.0.1
    mu_editor - the latest version (1.0.3? - hard to tell!)

Can't provide a log file as the editor does not open.

Please remember to attach a copy of the full log files for Mu. You can get
the logs by clicking on the cog icon in the bottom right of the editor window.
Click on the logs and use CTRL-A to select all, then CTRL-C to copy and CTRL-V
to paste the contents into the issue.

Thank you for contributing to Mu! :-)

@ged99
Copy link
Author

ged99 commented Nov 17, 2020

i have attached a screen shot showing that it is using cpu time while hanging. Also the Mac Dump Log that is generated when I do a Forced Quit
Screenshot 2020-11-17 at 09 36 33
Mu_dump.txt

@aivarannamaa
Copy link

@ajs256
Copy link
Contributor

ajs256 commented Nov 17, 2020

I have this issue too.

My logs
Starting Mu 1.0.3
2020-11-17 11:24:25,880 - root:113(run) INFO: uname_result(system='Darwin', node='greeble-mi.local', release='20.1.0', version='Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:11 PDT 2020; root:xnu-7195.50.7~2/RELEASE_X86_64', machine='x86_64', processor='i386')
2020-11-17 11:24:25,880 - root:114(run) INFO: Python path: ['/Users/ajs256/Applications/mu-editor_stable.app/Contents/MacOS', '/Users/ajs256/Applications/mu-editor_stable.app/Contents/Resources/python/lib/python36.zip', '/Users/ajs256/Applications/mu-editor_stable.app/Contents/Resources/python/lib/python3.6', '/Users/ajs256/Applications/mu-editor_stable.app/Contents/Resources/python/lib/python3.6/lib-dynload', '/Users/ajs256/Applications/mu-editor_stable.app/Contents/Resources/python/lib/python3.6/site-packages', '/Users/ajs256/Applications/mu-editor_stable.app/Contents/Resources/app', '/Users/alex/Applications/mu-editor_stable.app/Contents/Resources/app_packages', '/Users/ajs256/Applications/mu-editor_stable.app/Contents/Resources/app_packages/IPython/extensions']
2020-11-17 11:24:25,880 - root:115(run) INFO: Language code: en_US
2020-11-17 11:24:26,136 - mu.logic:543(__init__) INFO: Setting up editor.
2020-11-17 11:24:26,136 - mu.logic:562(__init__) INFO: Settings path: /Users/ajs256/Library/Application Support/mu/settings.json
2020-11-17 11:24:26,136 - mu.logic:563(__init__) INFO: Session path: /Users/ajs256/Library/Application Support/mu/session.json
2020-11-17 11:24:26,136 - mu.logic:564(__init__) INFO: Log directory: /Users/ajs256/Library/Logs/mu
2020-11-17 11:24:26,136 - mu.logic:565(__init__) INFO: Data directory: /Users/ajs256/Library/Application Support/mu
2020-11-17 11:24:26,149 - mu.logic:578(setup) INFO: Available modes: python, adafruit, microbit, debugger, pygamezero
2020-11-17 11:24:26,288 - mu.logic:1150(change_mode) INFO: Workspace directory: /Users/ajs256/mu_code
2020-11-17 11:24:26,289 - mu.logic:627(restore_session) INFO: Restoring session from: /Users/ajs256/Library/Application Support/mu/session.json
2020-11-17 11:24:26,289 - mu.logic:628(restore_session) DEBUG: {'theme': 'day', 'mode': 'circuitpython', 'paths': [], 'envars': [], 'minify': False, 'microbit_runtime': '', 'zoom_level': 2, 'window': {'x': 146, 'y': 90, 'w': 1152, 'h': 720}}
2020-11-17 11:24:26,289 - mu.logic:1107(select_mode) INFO: Showing available modes: ['python', 'adafruit', 'microbit', 'debugger', 'pygamezero']

@carlosperate
Copy link
Member

carlosperate commented Nov 18, 2020

Thanks for the reports everybody!

Unfortunately the log attached doesn't show any issues.

Could anybody experiencing this issue try to run Mu from source code? https://mu.readthedocs.io/en/latest/setup.html
This way we should hopefully see any errors and traces in the terminal.

In the past macOS updates have usually broken PyQt5, so I wouldn't be surprised if this is the culprit in this case as well. We should have a look at the mailing list.

In the meantime I found this: https://forums.macrumors.com/threads/pyqt5-and-big-sur.2260773/
If somebody is having this issue and can run Mu from source, can you try setting this env variable first and then running Mu?

$ export QT_MAC_WANTS_LAYER=1
$ python run.py

@ajs256
Copy link
Contributor

ajs256 commented Nov 20, 2020

@carlosperate Setting QT_MAC_WANTS_LAYER worked!

@ged99
Copy link
Author

ged99 commented Nov 20, 2020

I tried the suggested given above, but did not get anywhere. If someone would like to help me, then I will try to run this and provide whatever diagnostics I can. Please see my efforts below.

Running
$ export QT_MAC_WANTS_LAYER=1
in a terminal and then trying to run the mu-editor from an I can still leaves it hanging.

Screenshot 2020-11-20 at 15 53 26

@ajs256
Copy link
Contributor

ajs256 commented Nov 20, 2020

@ged99 A few tips:

  • git clone put everything into ~/mu. Move there with cd mu, then try using pip. That's why pip's returning an error.
  • The $ is used to indicate something should be run at the shell. It should not be used as part of your shell command.

@kurbonas
Copy link

@ajs256 having the same issue.

Your instruction is unclear. Could you write a more detailed guide?

Thank you!

@ajs256
Copy link
Contributor

ajs256 commented Nov 21, 2020

@kurbonas: Here’s my best guide for everything you need to do:

  1. Download Xcode and agree to the license. (Some of the tools you need are bundled with Xcode.)
  2. In a terminal, type git clone https://github.com/mu-editor/mu.git
  3. Move to the folder Mu downloaded to with cd mu
  4. Type python3 -m venv ~/mu-venv to create a virtual environment.
  5. Type source ~/mu-venv/bin/activate to activate the venv you created
  6. Install the dependencies with pip3 install -e ".[dev]"
    a. If that returns an error about SDL, follow these instructions:
    b. Install Homebrew following the instructions at brew.sh
    c. Run brew install sdl sdl_gfx sdl_image sdl_mixer sdl_ttf (I’m not sure which of those it actually needed)
    d. Try running the pip3 command above again
  7. Set the variable Qt needs with export QT_MAC_WANTS_LAYER=1
  8. Run Mu with python3 run.py

If anything was unclear there, let me know. If you want to exit the virtual environment, type deactivate.

@kurbonas
Copy link

@ajs256

Thanks, mate!

You are the best!

@keyra-coder
Copy link

Can reproduce the issue above. Managed to start Mu from the terminal after setting Qt variable. None of the previously successful programs run in Pygame Zero mode with the following error:
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
libpng warning: iCCP: known incorrect sRGB profile

@BobCochran
Copy link

I have this same issue as well on Big Sur. I think the code base should be refactored to avoid this type of breakage each time Apple updates Mac OS.

@ged99
Copy link
Author

ged99 commented Nov 29, 2020

4. python3 -m venv -p /usr/bin/python3 ~/mu-venv

Trying to follow your instructions. Latest Xcode installed. Here is a screen shot of where I got to
Screenshot 2020-11-29 at 23 01 46

@ajs256
Copy link
Contributor

ajs256 commented Nov 29, 2020

@ged99 Try running it like python3 -m venv ~/mu-venv (without the -p argument).

@ged99
Copy link
Author

ged99 commented Nov 29, 2020

@ajs256 Making progress bit-by-bit. I got as far as this before I got an error.

BTW, thanks for your help! Much appreciated

Screenshot 2020-11-30 at 01 41 18

@ajs256
Copy link
Contributor

ajs256 commented Nov 29, 2020

@ged99, try following steps A, B, and C to install SDL. That's what fixed that error for me.

@carlosperate carlosperate added this to the 1.1 milestone Dec 1, 2020
@ntomlin
Copy link

ntomlin commented Dec 5, 2020

Thanks @carlosperate, was getting ready to try the steps above even though way over my head, but then saw your post and just switched to the alpha version - problem solved!

@ged99
Copy link
Author

ged99 commented Dec 6, 2020

The Alpha Version!!! Yes, this works. Shame that I didn't find out about this until I saw @ntomlin comment. I'd been battling with this for weeks.

Anyway, happy once again!

@dybber
Copy link
Collaborator

dybber commented Dec 9, 2020

As pointed out by @ZanderBrown on Gitter, the newest PyQt5 version sets the QT_MAC_WANTS_LAYER=1 variable automatically: https://riverbankcomputing.com/news/PyQt_v5.15.2_Released

However, upgrading PyQt also means that we will have to say farewell to macOS 10.12 Sierra, as PyQt 5.15.2 only supports 10.13, 10.14, 10.15 (Mojave, Catalina, Big Sur)

@carlosperate
Copy link
Member

I thought the version of PyQt5 we have right now already dropped support for Sierra? And it's only 10.13 High Sierra or newer?

Either way, unless we find any bugs, I think I would prefer to stay in an older version of PyQt5 that supports an older macOS and manually add the env variable in the Mu source code. At least until we are force to update for any other reasons.

We get a few issues opened for Mu not being able to run in older macOS versions, and I think it's worth the trouble to try to maximise the versions Mu supports.

@dybber
Copy link
Collaborator

dybber commented Dec 9, 2020

This archived website says that 10.13 supports 10.12, 10.13, 10.14, but it might be outdated: https://doc.qt.io/archives/qt-5.13/supported-platforms.html

I agree that we should try adding the variable ourselves. I haven't dared upgrading to Big Sur, so I'm not able to test whether it works if I try to fix it.

@ged99
Copy link
Author

ged99 commented Dec 9, 2020

@dybber - I'm already fully committed to Big Sur. And it's been frustrating getting Mu to work on it. The Alpha version runs ok, but there is a problem importing libraries (as you know). I would be happy to help test anything out within reason.

I am having to use Mu on my Windows m/c (which is only until I get the Mac sorted)

@BobCochran
Copy link

BobCochran commented Dec 10, 2020 via email

@ajs256
Copy link
Contributor

ajs256 commented Dec 11, 2020

Huh...I'm not sure that's what's causing it.
I tried with a different app (PiBakery):
101930413-f82b9c80-3b8c-11eb-9893-4043c619416b
and WhatsYourSign reports it's unsigned, but:

% cd ~/Downloads/PiBakery-darwin-x64.app
% ls -l Contents/MacOS/PiBakery # the executable
-rwxr-xr-x@ 1 ajs256  staff  8608 Jun 29  2018 Contents/MacOS/PiBakery

It's still executable! Must be something weird with Github CI.

@dybber
Copy link
Collaborator

dybber commented Dec 11, 2020

Weird. I'm not sure either, but whatever is causing it, I'm pretty confident that it will be solved when we will shift our packaging infrastructure to use @tmontes' work on https://github.com/mu-editor/pup

@JakeWoodwardIRL
Copy link

Is this bug still under review? I haven't found that any of these workarounds have stopped Mu from "hanging" whenever it is launched. Currently running MacOS Big Sur 11.0.1.

@ged99
Copy link
Author

ged99 commented Dec 15, 2020

Is this bug still under review? I haven't found that any of these workarounds have stopped Mu from "hanging" whenever it is launched. Currently running MacOS Big Sur 11.0.1.

The "alpha" version on the mu website definitely works for me. The main stable version hangs.

The only problem for me is that I cannot get it to import external modules, in particular Matplotlib which I need for one application I am working on. These are known bugs but not sure when they will be fixed.

I must admit that I am now turning to the 'dark side' and using another IDE which works perfectly under Big Sur.

@dybber
Copy link
Collaborator

dybber commented Dec 15, 2020

Is this bug still under review? I haven't found that any of these workarounds have stopped Mu from "hanging" whenever it is launched. Currently running MacOS Big Sur 11.0.1.

Yes, it is still not closed, and we're waiting for confirmation that the proposed solution works (see #1147 (comment)). However, as people seems to have trouble opening that version and confirming that it solves the problem, we aren't moving forward with this before the Mac OS signing/notarization/packaging issues are resolved (which is a different issue entirely)

@ajs256
Copy link
Contributor

ajs256 commented Dec 26, 2020

EDIT: Never mind! I wasn't in a venv properly!

Previous question for reference: Hey there @dybber (or anyone else), maybe you can help me with this.

I tried to git pull and then update the dependencies, but it seems that the version of PyQt5 it requires is no longer on PyPI.

Here's my output:

ajs256@greeble mu % pip3 install -e ".[dev]"
Obtaining file:///Users/ajs256/code/mu
Collecting qtconsole==4.7.4
  Using cached qtconsole-4.7.4-py2.py3-none-any.whl (118 kB)
Collecting pyserial==3.4
  Using cached pyserial-3.4-py2.py3-none-any.whl (193 kB)
Collecting flake8>=3.8.3
  Using cached flake8-3.8.4-py2.py3-none-any.whl (72 kB)
Collecting appdirs>=1.4.3
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting semver>=2.8.0
  Using cached semver-2.13.0-py2.py3-none-any.whl (12 kB)
Collecting virtualenv
  Using cached virtualenv-20.2.2-py2.py3-none-any.whl (5.7 MB)
Requirement already satisfied: wheel in /usr/local/lib/python3.7/site-packages (from mu-editor==1.1.0a3) (0.34.2)
ERROR: Could not find a version that satisfies the requirement PyQt5==5.13.2 (from mu-editor==1.1.0a3) (from versions: 5.14.0, 5.14.1, 5.14.2, 5.15.0, 5.15.1, 5.15.2)
ERROR: No matching distribution found for PyQt5==5.13.2 (from mu-editor==1.1.0a3)

What should I do here?

@dybber
Copy link
Collaborator

dybber commented Dec 30, 2020

@ajs256 Good that you found a solution to your problem. Can you confirm that the solution in #1147 works?

@ajs256
Copy link
Contributor

ajs256 commented Dec 30, 2020

I think I'm running into the same problem as @ged99, where the executables are not executable and need a chmod +x to run. I can confirm that running chmod +x on the files in [APP]/Contents/MacOS/* and APP/Resources/python/bin/* fixes the problem.

@kyleplo
Copy link

kyleplo commented Dec 31, 2020

The alpha version on the download page works for me

@dwestbury
Copy link

@ajs256 I was able to get mu-editor to work based on the advice above:
#1147 (comment)

But, my setup on macOS Big Sur v11.1 required a couple additional steps:

  1. brew install pyqt5 this was missing
  2. brew install python@3.7 I was running 3.9, which was causing problems
  3. brew unlink python@3.9 && brew link python@3.7 changed my default python3 version to 3.7

Additionally, I still can't get it to launch from the mu-editor desktop icon, instead I had to write a quick shell script, which seems to work reliably, once all your aforementioned preparation steps have been completed:

## launching Adafruit Mu-Editor

cd ~/mu
python3 -m vent ~/mu-venv
source ~/mu-venv/bin/activate
export QT_MAC_WANTS_LAYER=1
python3 run.py

@Frederic-soft
Copy link

Frederic-soft commented Jan 26, 2021

I just installed mu-editor on Big Sur using brew install mu-editor, I edited the file /Applications/mu-editor.app/Contents/MacOS/mu-editor to change the second line into:

"exec" "env" "QT_MAC_WANTS_LAYER=1" "`dirname $0`/../Resources/python/bin/python3" "$0" "$@"

and it works fine.

@carlosperate
Copy link
Member

carlosperate commented Jan 26, 2021

brew install mu-editor

This is new to me, didn't realised there is a brew formula for Mu: https://formulae.brew.sh/cask/mu-editor
Does anybody know who is the maintainer?

Edit:
Looks like it's been available for almost 5 years:

But thankfully is just installing the dmg, I thought it would be running the code from source as a Python application.

@dwestbury
Copy link

dwestbury commented Jan 26, 2021

Terrific. Didn't even consider installing it as a Homebrew managed package. That approach worked well.
I did have to make the changes to /Applications/mu-editor.app/Contents/MacOS/mu-editor, as suggested above by @Frederic-soft, but that was relatively quick and painless.

Cheers!

@dybber
Copy link
Collaborator

dybber commented Jan 29, 2021

The problem was resolved by #1171, which I tested and confirmed yesterday on a machine running Big Sur.

To everyone here: thanks for the reports, the problem should be solved in the next release.

@DrNebin
Copy link

DrNebin commented Feb 8, 2021

This does not seem to be fixed. I am on OS Big Sur and downloaded and tried to run Mu today. The program hangs when it attempts to load and never actually starts. I will try attaching two screenshots if I can.... also note there seems to be no way for me to bypass the security denial (right clicking does not bypass it) and I have to go to settings and get to the "open anyway" button to have it make an attempt to load.... then it hangs and the program doesn't open.

Screen Shot 2021-02-08 at 2 36 09 PM
Screen Shot 2021-02-08 at 2 36 37 PM
Screen Shot 2021-02-08 at 2 37 41 PM

@dybber
Copy link
Collaborator

dybber commented Feb 9, 2021

The issue is solved, we just haven't been able to release a new version of Mu for Mac since the fix was made, I'm sorry.

@skarlekar
Copy link

If you are running into Mu Editor hanging on Big Sur, all you have to do is set the environment variable QT_MAC_WANTS_LAYER=1 at the terminal and open the mu-editor app from the terminal as follows:

export QT_MAC_WANTS_LAYER=1
open /Applications/mu-editor.app/

Just place the above in a shell script, make it executable and run the script from the terminal.

@BananaDok
Copy link

@dybber When can we expect the release with the resolved issue? I am just wondering if I should try to do a work around or wait, thanks!

@beebopkim
Copy link

If you are running into Mu Editor hanging on Big Sur, all you have to do is set the environment variable QT_MAC_WANTS_LAYER=1 at the terminal and open the mu-editor app from the terminal as follows:

export QT_MAC_WANTS_LAYER=1
open /Applications/mu-editor.app/

Just place the above in a shell script, make it executable and run the script from the terminal.

I just put a line - os.environ.putenv('QT_MAC_WANTS_LAYER', '1') - in mu-editor.app/Contents/MacOS/mu-editor and it works very well in Big Sur.
Screen Shot 2021-03-05 at 1 50 38 AM

@iadesdragon
Copy link

@beebopkim Yep, adding that line to mu-editor works like a charm! Thanks a lot for this helpful LiveHack :-)

@alsauter
Copy link

@beebopkim Yep, adding that line to mu-editor works like a charm! Thanks a lot for this helpful LiveHack :-)

Hi, could you please go through the process step by step? is it just a line on terminal...? or where? appreciate detail help as I am new to mu editor and using the terminal to run it...but need to get it to work on Mac OSX Sur
Thank you

Is it the same as this? @skarlekar

If you are running into Mu Editor hanging on Big Sur, all you have to do is set the environment variable QT_MAC_WANTS_LAYER=1 at the terminal and open the mu-editor app from the terminal as follows:

export QT_MAC_WANTS_LAYER=1
open /Applications/mu-editor.app/

Just place the above in a shell script, make it executable and run the script from the terminal.

@carlosperate
Copy link
Member

carlosperate commented May 31, 2021

Hi @alsauter,
These workarounds should no longer be necessary if you are using the latest beta releases: https://github.com/mu-editor/mu/releases

If you are still having issue in Big Sur with beta.4 could you open a new issue detailing the problem?
Thanks!

@alsauter
Copy link

Thanks @carlosperate ::

so that means I only need to download: Mu.Editor.1.1.0b4.dmg and it should work fine on Big Sur? To tell you the truth I am not on Big Sur, I have to fix this problem for a student (that does use Big Sur) using Mu Editor to program the Circuit Playground Express with Circuit Python. So I am trying to go ahead and know as much as I can before helping the student remotely.

Thank you so much.

@carlosperate
Copy link
Member

Yes, using beta.4 and these steps should get you set up in Big Sur: #1383 (comment)

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

No branches or pull requests