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

Add support for Deluge 2 - python 3.8 #27

Open
bluesky509 opened this issue Dec 6, 2019 · 28 comments
Open

Add support for Deluge 2 - python 3.8 #27

bluesky509 opened this issue Dec 6, 2019 · 28 comments

Comments

@bluesky509
Copy link

bluesky509 commented Dec 6, 2019

Please see here:
https://forums.unraid.net/topic/44109-support-binhex-delugevpn/?do=findComment&comment=793371

this is all due to the fact that python 3.8 is now the latest stable release of python, sadly there is some catchup required with the developers to make their python modules 3.8 compatible, this also means certain deluge plugins (which are of course also written in python) are also not compatible with python 3.8 and thus may not work with the latest image.

@hitnrun30
Copy link

I 1 up this, i hate the error on my nginx server

@idlesign
Copy link
Owner

to make their python modules 3.8 compatible

Have no idea what's that about, since there was no backward incompatible changes 3.7->3.8.
Please post here an actual error you have.

@hitnrun30
Copy link

I use organizr and it checks if something is in Deluge If I was able to add your webapi I would be fine but since I have Deluge 2 running against python 3.8 I get the below error.

2020/01/23 10:42:09 [error] 15236#6484: *53 FastCGI sent in stderr: "PHP Fatal error: Uncaught Exception: Method request returned an error (no. 2): Unknown method in C:\HTPC\nginx\html\Organizr2\api\functions\deluge.class.php:564
Stack trace:
#0 C:\HTPC\nginx\html\Organizr2\api\functions\deluge.class.php(48): deluge->makeRequest('webapi.get_torr...', Array)
#1 C:\HTPC\nginx\html\Organizr2\api\functions\homepage-connect-functions.php(1121): deluge->getTorrents(NULL, 'comment, downlo...')
#2 C:\HTPC\nginx\html\Organizr2\api\functions\homepage-connect-functions.php(49): delugeConnect()
#3 C:\HTPC\nginx\html\Organizr2\api\index.php(364): homepageConnect(Array)
#4 {main}
thrown in C:\HTPC\nginx\html\Organizr2\api\functions\deluge.class.php on line 564" while reading response header from upstream, client: 50.239.81.178, server: xxx.ddns.net, request: "POST /organizr2/api/?v1/homepage/connect HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "xxx.ddns.net", referrer: "https://xxx.ddns.net/organizr2/"

@idlesign
Copy link
Owner

I get the below error.

Unfortunatelly this trace is not helpful, since it wrapped into organizr stuff.
Please provide log from Deluge itself, so that we could investigate it.

@hitnrun30
Copy link

This what I get when I try ot add a plugin to deluge

11:37:53 [ERROR ][deluge.ui.web.json_api :79 ] Error calling method web.upload_plugin: [Errno 2] No such file or directory: 'C:\HTPC\Deluge2\Configuration\plugins\'
11:37:53 [ERROR ][deluge.ui.web.json_api :79 ] [Errno 2] No such file or directory: 'C:\HTPC\Deluge2\Configuration\plugins\'
Traceback (most recent call last):
File "C:\HTPC\Deluge2\lib\site-packages\deluge\ui\web\json_api.py", line 160, in _handle_request
result = self._exec_local(method, params, request)
File "C:\HTPC\Deluge2\lib\site-packages\deluge\ui\web\json_api.py", line 122, in _exec_local
return meth(*params)
File "C:\HTPC\Deluge2\lib\site-packages\deluge\ui\web\json_api.py", line 953, in upload_plugin
shutil.copyfile(path, os.path.join(get_config_dir(), 'plugins', filename))
File "C:\HTPC\Deluge2\lib\shutil.py", line 121, in copyfile
with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\HTPC\Deluge2\Configuration\plugins\'

@idlesign
Copy link
Owner

This what I get when I try ot add a plugin to deluge

In the trace I can see nothing specific to webapi.
Check whether other plugins can be installed at all.

@hitnrun30
Copy link

no they can't this is so weird. Any help would be great.

@idlesign
Copy link
Owner

idlesign commented Feb 4, 2020

Please try to apply to Deluge support forum: https://forum.deluge-torrent.org

@Mycsina
Copy link

Mycsina commented Mar 25, 2020

@aircave I had the same issue with deluge not recognizing the plugin, even though it was in the plugins folder but after seeing that deluge was running on python 3.8.2 I decided to build the .egg file using that version, which made it work. Maybe try renaming to WebAPI-0.4.0-py3.8.egg and see if you can trick deluge into accepting it

@quorn23
Copy link

quorn23 commented Apr 4, 2020

@aircave could you possibly post the egg file you build? A friend is asking for it, but i'm not a python guy.

@bluesky509
Copy link
Author

@aircave could you possibly post the egg file you build? A friend is asking for it, but i'm not a python guy.

@Mycsina ...Question above was for you.

I gave up and switched Transmission.

@Mycsina
Copy link

Mycsina commented Apr 9, 2020

Sorry for the late response @quorn23!
Here's's a freshly built one
WebAPI-0.4.0-py3.8.zip

@quorn23
Copy link

quorn23 commented Apr 9, 2020

@Mycsina no worries at all, much appreciated, forwarding it to my friend with Deluge.

Edit: Quick feedback, Mycsinas egg works perfectly with Deluge 2.0.4.dev23

@niXta1
Copy link

niXta1 commented Apr 12, 2020

@Mycsina no worries at all, much appreciated, forwarding it to my friend with Deluge.

Edit: Quick feedback, Mycsinas egg works perfectly with Deluge 2.0.4.dev23

I'm just getting the box bouncing back when I try to check it. Permissions OK, out of ideas...

@Mycsina
Copy link

Mycsina commented Apr 12, 2020

@niXta1 Try to manually enable the plugin on one of the deluge conf files after closing it and then open it to see if it persists. When I was trying to use the 3.7 .egg plugin with Deluge running on 3.8 Python it simply wouldn't recognize, so check what Python version is deluge running on.

@niXta1
Copy link

niXta1 commented Apr 13, 2020

@niXta1 Try to manually enable the plugin on one of the deluge conf files after closing it and then open it to see if it persists. When I was trying to use the 3.7 .egg plugin with Deluge running on 3.8 Python it simply wouldn't recognize, so check what Python version is deluge running on.

Ok, closing deluge and editing the conf. ended up in that it got disabled anyway at start.
Im running on binhex, so it should be v3.8.

@lzacharski
Copy link

Just a reminder that to enable plugins in Deluge, you need to add their names to core.conf under enabled_plugins and restart.

Source

@niXta1
Copy link

niXta1 commented Apr 15, 2020

Just a reminder that to enable plugins in Deluge, you need to add their names to core.conf under enabled_plugins and restart.

Source

Yes:

   "download_location_paths_list": [],
    "enabled_plugins": [
        "LabelPlus",
        "AutoAdd",
        "Scheduler",
        "WebAPI"
    ],
    "enc_in_policy": 1,
    "enc_level": 1,
    "enc_out_policy": 1,
    "enc_prefer_rc4": true,
    "geoip_db_location": "/usr/share/GeoIP/GeoIP.dat",
    "ignore_limits_on_local_network": false,
    "info_sent": 0.0,

Error log:

22:10:19.116 [INFO    ][webapi.core                   :20  ] Enabling WebAPI plugin CORE ...
22:10:19.116 [INFO    ][webapi.core                   :57  ] Patching webui for CORS...
22:10:19.117 [ERROR   ][deluge.pluginmanagerbase      :193 ] Failed to start plugin: WebAPI
Traceback: <class 'KeyError'>: 'JSON'
/usr/lib/python3.8/site-packages/twisted/internet/defer.py:151:maybeDeferred
/usr/lib/python3.8/site-packages/deluge/plugins/init.py:27:enable
/config/plugins/WebAPI-0.4.0-py3.8.egg/webapi/core.py:26:enable
/config/plugins/WebAPI-0.4.0-py3.8.egg/webapi/core.py:59:patch_web_ui
/usr/lib/python3.8/site-packages/deluge/component.py:489:get

22:10:19.117 [INFO    ][webapi.core                   :29  ] Disabling WebAPI plugin CORE ...
22:10:19.117 [WARNING ][deluge.pluginmanagerbase      :246 ] Problems occured disabling plugin: WebAPI

@idlesign
Copy link
Owner

<class 'KeyError'>: 'JSON'
It doesn't relate to webapi per se. It means that JSON component of Deluge is not available for some reason. Try to digg that way.

@niXta1
Copy link

niXta1 commented Apr 16, 2020

<class 'KeyError'>: 'JSON'
It doesn't relate to webapi per se. It means that JSON component of Deluge is not available for some reason. Try to digg that way.

Progress, thanks!
Can you give me more hints? Is the JSON component a basic Deluge component or where does it come from?

@idlesign
Copy link
Owner

idlesign commented Apr 16, 2020

I see that JSON component is defined in https://git.deluge-torrent.org/deluge/tree/deluge/ui/web/json_api.py and is available with Deluge Web JSON-RPC API: https://deluge.readthedocs.io/en/latest/reference/webapi.html

@niXta1
Copy link

niXta1 commented Apr 19, 2020

I've now added WebUi in the core.conf, still get the same error though...

19:48:09.100 [INFO    ][webapi.core                   :20  ] Enabling WebAPI plugin CORE ...
19:48:09.100 [INFO    ][webapi.core                   :57  ] Patching webui for CORS...
19:48:09.100 [ERROR   ][deluge.pluginmanagerbase      :193 ] Failed to start plugin: WebAPI
Traceback: <class 'KeyError'>: 'JSON'
/usr/lib/python3.8/site-packages/twisted/internet/defer.py:151:maybeDeferred
/usr/lib/python3.8/site-packages/deluge/plugins/init.py:27:enable
/config/plugins/WebAPI-0.4.0-py3.8.egg/webapi/core.py:26:enable
/config/plugins/WebAPI-0.4.0-py3.8.egg/webapi/core.py:59:patch_web_ui
/usr/lib/python3.8/site-packages/deluge/component.py:489:get

19:48:09.100 [INFO    ][webapi.core                   :29  ] Disabling WebAPI plugin CORE ...
19:48:09.100 [WARNING ][deluge.pluginmanagerbase      :246 ] Problems occured disabling plugin: WebAPI

@idlesign
Copy link
Owner

idlesign commented Apr 29, 2020

Is it docker? If so to troubleshoot it further you may want first to try to reproduce the behaviour outside of docker.

@metril
Copy link

metril commented Jun 9, 2020

@niXta1
The WebAPI plugin works on 1st start. It fails on subsequent starts. I noticed that it generates the WebAPI.conf. In the deluged.log file, you'll notice that the plugin fails to start after it tries patching the WebUI for CORs. Go to the WebAPI.conf file and set CORS to false. The WebAPI will work again assuming you have the right python version of the egg.

@goldenpipes
Copy link

so i just ran through this myself, i just removed the WebAPI.conf and restarted deluge, which regenerated the WebAPI.conf and all seems well after restarteing deluge many times.

@Mycsina 's compiled egg

@chansearrington
Copy link

Just spent a couple hours trying to get this working before noticing that all the plugins in Deluge were labeled 3.8!!! @Mycsina thanks so much for this fix here. Had it working in 5 mins

@Brandoskey
Copy link

Brandoskey commented Mar 18, 2021

Also having this problem in the binhex container, no amount of editing conf files seems to do the trick. I've tried the 3.8 file linked above as well

Edit: turns out the binhex deluge container is now up to python 3.9, I renamed the webapi to 3.9 and it loaded and appears to work, still won't connect with organizr, though that could be another issue I need to work out

@kinduff
Copy link

kinduff commented Mar 28, 2021

@Brandoskey Hey! FYI, I just got this up and running.

I have Deluge setup with Docker using a volume for the /config. I downloaded this egg and extracted it at Deluge's plugin config folder /config/plugins. I renamed to 3.9 as you mentioned.

In the WebUI I enabled the plugin, and in Organizr I was able to enable, save, and test the integration. It works as expected.

Let me know if you need help.

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

No branches or pull requests