fyears / electron-python-example

Electron as GUI of Python Applications
MIT License
2.03k stars 232 forks source link

How to use the latest electron #24

Open abulka opened 6 years ago

abulka commented 6 years ago

It would be good to be able to use the latest version of electron rather than be stuck with 1.7.6, however for some reason the dependency on the special version of zerorpc repo you have kindly provided prevents this - see #23.

I thought I had solved the problem by installing the latest versions of electron etc. and inspired by #22, even the latest "official" zerorpc, which resulted in these dependencies in my package.json:

"devDependencies": {
  "electron": "^1.8.4",
  "electron-packager": "^11.1.0",
  "electron-rebuild": "^1.7.3"
},
"dependencies": {
  "zerorpc": "^0.9.7"
}

After running these commands

brew install zeromq
npm install
./node_modules/.bin/electron-rebuild

I was able to run the example successfully.

Unfortunately when I package the app and run it on a virgin Mac system, libzmq.5.dylib is not found - same issue as https://github.com/zeromq/zeromq.js/issues/131.

Despite the advice in that issue to avoid brew's zeromq and to instead install npm's zeromq with npm i zeromq --save - the problem persists because zerorpc uses zmq which "doesn't provide prebuild statically linked binaries. So you can't package your app with this module". Which presumably is one of the reasons that you made your custom version of zerorpc which changes the source code slightly to require zeromq instead of zmq.

Its all a bit confusing - it seems strange to me that npm zeromq would tolerate being 'unpackagable' because it requires zmq. And I don't understand why using your custom zerorpc repo locks us into an old version of electron (module mismatch issue).

Aside: The need for specific version numbers all over the readme instructions, and the use of custom repos and old versions of electron might put people off this wonderful project/solution.

Is there a way we can use the latest electron e.g. 1.8.4 with this electron-python solution - in a way which is deployable/packagable?

abulka commented 6 years ago

After discovering that installing and running electron-rebuild fixes module mismatch problems (see #23) I can now successfully use the latest version of Electron.

I still have to use fyear's forked zerorpc repository if I want to successfully package my app. The good news is that the forked repo is up to date (as of March 2018) with the official https://github.com/0rpc/zerorpc-node and presumably can be kept up to date using git, so I'm now fine depending on a non official repo. The various questions re zerorpc and its dependencies remain for the curious, but no longer essential to understand ;-)

Incidentally, I have also since discovered that brew install zeromq is not needed, as the python pip install zerorpc is sufficient and also provides the zerorpc CLI for testing purposes.