Deluge Windows Builds

Specific support for Deluge on Microsoft Windows OS
doadin
Seeder
Seeder
Posts: 113
Joined: Mon Jun 30, 2014 9:24 am

Re: Deluge Windows Builds

Post by doadin »

mhertz wrote: Sat Jan 01, 2022 12:59 pm Looks like the windows users very soon will get an official installer, from your nice work. Awesome news, thanks again mate :)

I know nothing about pyinstaller, so have no input. There's some little info, when googling "pyinstaller can't find certifi", e.g. requests can't find the pem, and some code to add to make it work etc, plus another workaround of another pyinstaller/cerifi issue, but as not having it to "play" with myself, then hard to troubleshoot in blind, though anyway no need, as i'm sure you're better at this than me, so you'll figure it out eventually.

You say only a pem file in the certifi folder if understanding right, so does it work if you added the missing certifi files from the deluge unfreezed build's certifi folder under Lib\site-packages\certifi and into the dist\certifi folder of freezed app? Or else if not work, could play with the google-hits info. As said, I know nothing about pyinstaller/freezing so if saying something stupid here, then apologize in advance.

Good luck mate, and thanks again.

Edit: you're using the certifi hook of pyinstaller-hooks-contrib right? (Again, sorry if dumb question lol :) ) https://github.com/pyinstaller/pyinstal ... certifi.py

Edit2: Sorry, no solution, just wanted to say that above edit is useless so ignore - I made quick test with installing pyinstaller and making test.py with "from certifi import where; print(where())", and ran 'pyinstaller test.py', and it also only included the pem in dist\certifi, but still running test.exe ran fine and outputted to cmd the dir of the pem as per the certifi.where() function, and which is also that function which is the entirety of deluge's cerifi usage. Also, the certifi hook from contrib was auto-loaded I saw in pyinstaller building output. I Also even uninstalled certifi from host, to make sure not somehow loaded, and still worked, though test.py on host failing as certifi missing - I don't really get how that can work in freezed version, because only the pem seems included, but the certifi package when using where(), needs __init_.py and core.py, because there is where() even defined/included, and couldn't see included elsewhere under dist, but whatever, must regardless be somewhere included still and just wanted you to not spend extra time on my clever ideas, so need look elsewhere, just don't understand how your freezed deluge cannot find certifi distribution, when a simple example like mine worked.
So it seems to be just an error with pyinstaller I guess. If you edit or maybe even delete the requitments.txt from the dist/deluge-egg folder(don't remember the exact name). Deluge starts just fine from freeze with small exception of a few changes I need to correct just a couple files in the wrong place.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluge Windows Builds

Post by mhertz »

Indeed... As said I know nothing about pyinstaller, so cannot help here i'm affraid.

I was going to suggest that untill this issue fixed, then could make and add a patch to your delugebuildfromsource project, patching deluge source before the freeze, e.g. after I saw the certifi error of freezed app you stated, then in common.py of unfreezed app I changed it to instead of importing and setting SSL_CERT_FILE from certifi.where(), then patch that out and instead set it like e.g.

os.environ['SSL_CERT_FILE'] = os.path.abspath(os.path.join(os.path.dirname(__file__),os.path.pardir,"certifi"))

Though then need manually add pem and certifi folder from datas section in spec or alike, or just add in main dir, and last patch requires.txt under deluge-2.0.5.py3.7.egg\egg-info to omit the certifi dep listed. However, I just did that, and as I before tested a test case of certifi importing/usage that worked, then seemingly something else wrong here, because not showing that error anymore, but now instead showing a new missing distro error of pywin32 not found - I remember vagualy a report about such missing distribution errors with pyinstaller, with different modules reported missing, but cannot remember what they suggested, or if even related(think was also pywin32 related). Not more time tonight, very late here, and as said, i'm sure you can fix this much better than me anyways.

Anyway, sorry for long-windedness, and just wanted to add this.

Edit: Typed/tested while you posted inbetween - Awesome, great news to hear and good job :)
doadin
Seeder
Seeder
Posts: 113
Joined: Mon Jun 30, 2014 9:24 am

Re: Deluge Windows Builds

Post by doadin »

mhertz wrote: Sun Jan 02, 2022 2:18 am Indeed... As said I know nothing about pyinstaller, so cannot help here i'm affraid.

I was going to suggest that untill this issue fixed, then could make and add a patch to your delugebuildfromsource project, patching deluge source before the freeze, e.g. after I saw the certifi error of freezed app you stated, then in common.py of unfreezed app I changed it to instead of importing and setting SSL_CERT_FILE from certifi.where(), then patch that out and instead set it like e.g.

os.environ['SSL_CERT_FILE'] = os.path.abspath(os.path.join(os.path.dirname(__file__),os.path.pardir,"certifi"))

Though then need manually add pem and certifi folder from datas section in spec or alike, or just add in main dir, and last patch requires.txt under deluge-2.0.5.py3.7.egg\egg-info to omit the certifi dep listed. However, I just did that, and as I before tested a test case of certifi importing/usage that worked, then seemingly something else wrong here, because not showing that error anymore, but now instead showing a new missing distro error of pywin32 not found - I remember vagualy a report about such missing distribution errors with pyinstaller, with different modules reported missing, but cannot remember what they suggested, or if even related(think was also pywin32 related). Not more time tonight, very late here, and as said, i'm sure you can fix this much better than me anyways.

Anyway, sorry for long-windedness, and just wanted to add this.

Edit: Typed/tested while you posted inbetween - Awesome, great news to hear and good job :)
Yea I just need to confirm these last changes but it seems to run just fine, it would be better to get deluge from git vs like a hardcoded version so it will just pull the newest tag. @Cas, idk if you have been watching tried to get it working as mcuh as I could before tagging. Idk if you are interested in this to get windows builds going or not? I didn't test but im assuming plugins still wont work but a build is better than none? Its a pretty simple process but I can help if you want or make any changes if you want to suit what you want do.

Since this uses pyinstaller could potentially work on mac but I don't have one to test.
doadin
Seeder
Seeder
Posts: 113
Joined: Mon Jun 30, 2014 9:24 am

Re: Deluge Windows Builds

Post by doadin »

just some info about the end result.

diff from 1.3.15:
Installer is ~38MB in 1.3.15 it was ~16
Space needed for install is 173.3MB in 1.3.15 it was ~52

Compared to the other unofficial installer around which is ~45MB and install space needed 209.9MB.

Things that need to be worked on is:
The end result as expected is plugins do not work. This is due to how plugins work and how parts of pyinstaller and python in general work, from my understanding.
deluge.exe does not start deluge as expected
deluged.exe works
deluged-debug.exe works
deluge-gtk.exe works (though will have a issue in thin client mode with connection manager due to a already known issue with twisted which a patch is available for but I didn't build with that sorry)
deluge-web.exe works (thought seemed kind of slow when fist login to the UI, not sure why)
deluge-web-debug.exe works
the installer say win32 but is a 64bit install
installer defaults to installing to program files(x86) though again is 64-bit.
(last two small changes needed)
installer still checks for msvc 2008 and leads to that install though this is just and installer change thats needed and was not built with 2008 and with build linked below msvc redist should not need to be installed but if you have issues install vs redist 2019.

I have noticed whcih this is not really a packaging issue but if I use ctrl + windows key + left arrow (for anyone that doesn't know this is the virtual desktop windows shortcut) the deluge window will go to the left side of the screen in the virtual space it is in) not a huge deal I guess and not packaging related? However at the least is a conflict in shortcut keys.

As far as installer size/space is concerned it appears there is a folder in dist/share called icons and it is 54MB. Icons could maybe be compressed or something? Other than that I don't see anything that could be improved space wise in dist/share there is another folder called locale and its is the second biggest at 19MB. The rest is fairly normal/small. Someone could correct me on this I'm sure.

Other than that it seems to download torrents just fine, haven't noticed an UI issues or anything. GTK UI loads in about 2 seconds with only 2 torrents loaded, have not tested with more.(though I wouldn't imagine load time to be packaging related so should be very similar to load times of the other builds if you have tried those.

I built using:
Windows 10
Visual Studio 2019
Python 3.7
GTK 3.24
Libtorrent 1.2.15 + OpenSSL_1_1_1m

If anyone is interested: https://mega.nz/file/aopQBTJZ#sFYAUsk3D ... EzpPgT4vKQ
highvoltage
Leecher
Leecher
Posts: 57
Joined: Mon Apr 11, 2016 11:11 pm
Location: Brazil

Re: Deluge Windows Builds

Post by highvoltage »

thank you very much for all the work doadin.

I can leave testing running 24hrs on a machine with windows 11 x64.
I executed the following file

"C:\Program Files (x86)\Deluge\deluge-gtk.exe"

The only plugin I use is ltconfig, but in this version it's not possible.

in preferences, network, test active port = deluge is closed - port test cannot be run
DjLegolas
Member
Member
Posts: 35
Joined: Thu Oct 12, 2017 3:31 pm

Re: Deluge Windows Builds

Post by DjLegolas »

@highvoltage - it is probably the same error I got yesterday, so I patched it and waiting for a merge:
https://github.com/deluge-torrent/deluge/pull/329
highvoltage
Leecher
Leecher
Posts: 57
Joined: Mon Apr 11, 2016 11:11 pm
Location: Brazil

Re: Deluge Windows Builds

Post by highvoltage »

@DjLegolas - oww great job thank you very much

@doadin - deluge > Preferences > Network > Peer TOS byte (it looks like the field is blank and I can't enter any value.)

Thank you all for your hard work and dedication.
doadin
Seeder
Seeder
Posts: 113
Joined: Mon Jun 30, 2014 9:24 am

Re: Deluge Windows Builds

Post by doadin »

DjLegolas wrote: Sun Jan 02, 2022 10:00 pm @highvoltage - it is probably the same error I got yesterday, so I patched it and waiting for a merge:
https://github.com/deluge-torrent/deluge/pull/329
@highvoltage @DjLegolas
If I open preferences > network and click the test active port button i get no crash and some progress lines animation next to it followed by a check mark icon.

Perhaps this is due to error handling in the test code if the test fails? Though I did try disableing upnp and setting a random port not firewall opened and the test failed as expected with no crash. So really not sure on this one.
I will note too I need to hit apply twice for the active port listed to update.

The peer TOS Byte field does appear to be blank with no way to edit. so that one is confirmed.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluge Windows Builds

Post by mhertz »

doadin wrote: Sun Jan 02, 2022 8:47 am Icons could maybe be compressed or something?
Personally I only included the scalable folder of the adwaita-icon-theme, and I believe ditched completely the locale dir, but to lazy to check now sorry(deluge includes its MO language files in its i18n dir, and the Linux deluge-2.0.5 packages neither includes anything from /usr/share/locale). You would save almost 50mb install size then, roughly. If librsvg installed with gtk3, as adwaita-icon-theme pulls in, then that single svg icons dir should work, and contain all the symbolic icons deluge uses as far as I know, and never gotten reports otherwise. I'm sure pyinstaller has some ignore or alike command, or could just delete the dirs before the freeze.

BTW, might wanna run a complete run of your build-scripts in clean environment, as some issues for me when tried a few days ago, and had to manually install python(well download/extract nuget python 3.7.9, but regardless). Also nitpicking but it's 14.2 in msvc ver of b2 - you don't have to specify any toolset however, if remember right, on above msvc-2017, but whatever. The built libtorrent pyd is in a subdir of bin and not direct in the cwd, for me atleast, so manually copied to site-packages(in my stuff is there in cwd, but was to lazy comparing what the diff is). Don't remember if more, but just a few slight things I thought to mention. Ohh, for me, in several runs, the freezed version(not your installer) wouldn't start, and to fix moved the deluge dir into the deluge-xxxxxx.egg folder, since needed a file from there, a glade UI one it complained.

I could not fix the plugins yesterday when tried - I refreezed many times with various extra imports, files, hidden imports, collect-alls and what not, and a pywin32 workaround posted, and included site module, as listed in deluge-warn.txt, plus pkg_requires(or pkg_resources cannot remember name now) as some parts of it also listed there, plus added site-packages dir specifically to extra pyinstaller paths, but for all still a no go. Also some dumb posts about needing run pyinstaller from actual dir of scripts to freeze, plus tried under the python dir etc etc. Since it didn't find certifi and pywin32 and continued with rest when commenting out these in the requires.txt(I know you delete it btw), despite those being there, then thinking it's same issue with plugins failing, as fails as cannot import deluge.plugins.init - I see needed files missing though, but still fails when copying into freezed plugins-dir, the init.py and __init__.py. Hope you can eventually figure out, as over my head honestly.

Thanks.

Edit: You can just download or clone deluge master branch, for latest stable always.
doadin
Seeder
Seeder
Posts: 113
Joined: Mon Jun 30, 2014 9:24 am

Re: Deluge Windows Builds

Post by doadin »

mhertz wrote: Mon Jan 03, 2022 11:55 am
doadin wrote: Sun Jan 02, 2022 8:47 am Icons could maybe be compressed or something?
Personally I only included the scalable folder of the adwaita-icon-theme, and I believe ditched completely the locale dir, but to lazy to check now sorry(deluge includes its MO language files in its i18n dir, and the Linux deluge-2.0.5 packages neither includes anything from /usr/share/locale). You would save almost 50mb install size then, roughly. If librsvg installed with gtk3, as adwaita-icon-theme pulls in, then that single svg icons dir should work, and contain all the symbolic icons deluge uses as far as I know, and never gotten reports otherwise. I'm sure pyinstaller has some ignore or alike command, or could just delete the dirs before the freeze.

BTW, might wanna run a complete run of your build-scripts in clean environment, as some issues for me when tried a few days ago, and had to manually install python(well download/extract nuget python 3.7.9, but regardless). Also nitpicking but it's 14.2 in msvc ver of b2 - you don't have to specify any toolset however, if remember right, on above msvc-2017, but whatever. The built libtorrent pyd is in a subdir of bin and not direct in the cwd, for me atleast, so manually copied to site-packages(in my stuff is there in cwd, but was to lazy comparing what the diff is). Don't remember if more, but just a few slight things I thought to mention. Ohh, for me, in several runs, the freezed version(not your installer) wouldn't start, and to fix moved the deluge dir into the deluge-xxxxxx.egg folder, since needed a file from there, a glade UI one it complained.

I could not fix the plugins yesterday when tried - I refreezed many times with various extra imports, files, hidden imports, collect-alls and what not, and a pywin32 workaround posted, and included site module, as listed in deluge-warn.txt, plus pkg_requires(or pkg_resources cannot remember name now) as some parts of it also listed there, plus added site-packages dir specifically to extra pyinstaller paths, but for all still a no go. Also some dumb posts about needing run pyinstaller from actual dir of scripts to freeze, plus tried under the python dir etc etc. Since it didn't find certifi and pywin32 and continued with rest when commenting out these in the requires.txt(I know you delete it btw), despite those being there, then thinking it's same issue with plugins failing, as fails as cannot import deluge.plugins.init - I see needed files missing though, but still fails when copying into freezed plugins-dir, the init.py and __init__.py. Hope you can eventually figure out, as over my head honestly.

Thanks.

Edit: You can just download or clone deluge master branch, for latest stable always.
I've made changes to the script a while ago to include some changes you mentioned here. If you are using the update script I'm not sure its working. Best to just download it manually.
Post Reply