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

Update requirements.txt for MacOS #670

Closed
Athanasius opened this issue Aug 21, 2020 · 10 comments
Closed

Update requirements.txt for MacOS #670

Athanasius opened this issue Aug 21, 2020 · 10 comments
Labels
bug unconfirmed An unconfirmed bug

Comments

@Athanasius
Copy link
Contributor

Current stable code doesn't work on MacOS due to missing packages.

We need someone with a MacOS machine to test possible changes.

[11:58] A_D (EDMC) : also, for requirements.txt, apparently we can do constraints in one file
[11:59] A_D (EDMC) : so assuming its pyobjc, we need pyobjc==$version; sys_platform == 'darwin'

@Athanasius Athanasius added bug unconfirmed An unconfirmed bug labels Aug 21, 2020
@Tenzian
Copy link

Tenzian commented Dec 25, 2020

After installing requirements.txt I did a quick pip3 install pyobjc which installs 7.0.1.

It looks like it satisfies the dependencies, but there's an out of scope bug with tkinter and macOS 11.1 that's causing python to crash:

tenz@silverthorn ~/R/EDMarketConnector stable ❯ python3 -c 'import sysconfig; print(sysconfig.get_platform())'
macosx-11-x86_64
tenz@silverthorn ~/R/EDMarketConnector stable ❯ python3 -m tkinter                                            
macOS 11 or later required !
[1]    13248 abort      python3 -m tkinter

...it's likely that the Homebrew version of python 3.9 is linking to deprecated tcl/tk libraries and I'm not going down that rabbit hole 😁

@Athanasius
Copy link
Contributor Author

Ah, lovely. So there's no way to get EDMC running from source on recent MacOS without doing an end-run around the system tcl/tk.

And from comments in the linked bug report a user would need to use Python 3.9.x. We don't officially support that yet, but in principle there's no reason why it wouldn't work (with either stable or develop).

Thanks for the info!

@Tenzian
Copy link

Tenzian commented Dec 26, 2020

Some further tinkering...

If you download the installer for python 3.9.1 from python.org (I normally use Homebrew) it comes bundled with a compatible tcl/tk version.

EDMC runs fine after pip installing requirements.txt and pyobjc.

The only issue I've found is when you go to Preferences → Configuration there's an E:D Market Connector needs permission to use shortcuts warning. Clicking on the button to open system preferences causes EDMC to shut down:

2020-12-25 23:44:15.290 - DEBUG - companion.Session.login:408: already logged in (is_beta = False)
2020-12-25 23:44:15.566 - INFO - EDMarketConnector.AppWindow.onexit:1066: Starting shutdown procedures...
2020-12-25 23:44:15.566 - INFO - EDMarketConnector.AppWindow.onexit:1068: Closing protocol handler...
2020-12-25 23:44:15.910 - INFO - EDMarketConnector.AppWindow.onexit:1071: Unregistering hotkey manager...
2020-12-25 23:44:15.910 - INFO - EDMarketConnector.AppWindow.onexit:1074: Closing dashboard...
Stopping monitoring Dashboard
2020-12-25 23:44:15.911 - INFO - EDMarketConnector.AppWindow.onexit:1077: Closing journal monitor...
Stopping monitoring Journal
2020-12-25 23:44:15.911 - INFO - EDMarketConnector.AppWindow.onexit:1080: Notifying plugins to stop...
2020-12-25 23:44:16.081 - INFO - EDMarketConnector.AppWindow.onexit:1083: Closing update checker...
2020-12-25 23:44:16.081 - INFO - EDMarketConnector.AppWindow.onexit:1086: Closing Frontier CAPI sessions...
2020-12-25 23:44:16.082 - INFO - EDMarketConnector.AppWindow.onexit:1089: Closing config...
2020-12-25 23:44:16.083 - INFO - EDMarketConnector.AppWindow.onexit:1092: Destroying app window...
2020-12-25 23:44:16.087 - INFO - EDMarketConnector.AppWindow.onexit:1095: Done.
2020-12-25 23:44:16.087 - INFO - EDMarketConnector.__main__:1364: Exiting

@Tenzian
Copy link

Tenzian commented Jan 11, 2021

Homebrew's python@3.9 formula now installs a compatible tcl/tk version too. 😄
image

@Athanasius
Copy link
Contributor Author

https://github.com/EDCD/EDMarketConnector/tree/fix/670/macos-requirements contains a tweak to requirements.txt which should get pyobc installed on MacOS. Please test!

We'll need some logs, or preferably someone comfortable with running the code under a debugger to try and track down the issue with Preferences.

@Athanasius
Copy link
Contributor Author

I've managed to find a way to test on MacOS, so will hopefully be addressing any issues on it over the next few days (depending on how good/accessible docs are for MacOS-specific calls).

I will NOT be reinstating the MacOS packages, you'll still be running from source, but with updated documentation our end to make that go as smoothly as possible.

@Athanasius
Copy link
Contributor Author

EDMC runs fine after pip installing requirements.txt and pyobjc.

The only issue I've found is when you go to Preferences → Configuration there's an E:D Market Connector needs permission to use shortcuts warning. Clicking on the button to open system preferences causes EDMC to shut down:

The shutdown of EDMC seems to be intended. That prefs.py code has always (since back to 3.43 at least) been like that and is explicitly causing it to quit out. I can only guess that the idea is you need to grant the required permission and restart EDMC, so it helpfully quits for you.

However... with MacOS Catalina granting that permission turns out to be a royal pain in the ass.

  1. I think the permission is now under 'Input Monitoring' section.
  2. As EDMC isn't actually requesting it there's nothing in the list, and no + button to add an application.
  3. I'm having zero luck finding any Apple developer documentation about how you're meant to request the permission.
  4. I could possibly try dragging the python application into the list, but would really prefer the user just get prompted and hit 'Allow'.

Investigation continues....

@Athanasius
Copy link
Contributor Author

PR #905 is where I'm working on this currently.

@Athanasius
Copy link
Contributor Author

Athanasius commented Mar 13, 2021

  1. I could possibly try dragging the python application into the list, but would really prefer the user just get prompted and hit 'Allow'.

Nope, once I tracked down the python 3.9 file and dragged it, it just bounced right back out again.

@Athanasius
Copy link
Contributor Author

So, at least the requirements are fixed for macOS, and basic functionality seemed to work in testing. I've documented the whole hotkey/shortcuts mess, so will close this ticket.

NB: I only fixed it on the develop branch. I guess it's a small enough change (pyobjc in requirements.txt) to quickly cherry-pick that into stable as well.

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

No branches or pull requests

2 participants