Closed y5252 closed 6 months ago
You can disable the Cloudflare plugin if you're not using it. If you are using it, point python in /rutorrent/config/config.php
https://github.com/Novik/ruTorrent/blob/d4c4c4c3f229dd3b2187c8a53eb98ba4dd5936fa/conf/config.php#L54C2-L60
Alternatively, I recommend using an install script like swizzin to automatically setup everything and patch rTorrent with crash fixes.
Which setup setting will point python in /rutorrent/config/config.php ? Could you provide with more detailed instructions? My /rutorrent/config/config.php has already been completed as follows :
$pathToExternals = array(
"python" => '/usr/bin/python3', // added by myself
"php" => '', // Something like /usr/bin/php. If empty, will be found in PATH.
"curl" => '', // Something like /usr/bin/curl. If empty, will be found in PATH.
"gzip" => '', // Something like /usr/bin/gzip. If empty, will be found in PATH.
"id" => '', // Something like /usr/bin/id. If empty, will be found in PATH.
"stat" => '', // Something like /usr/bin/stat. If empty, will be found in PATH.
);
Which setup setting will point python in /rutorrent/config/config.php ? Could you provide with more detailed instructions? My /rutorrent/config/config.php has already been completed as follows :
$pathToExternals = array( "python" => '/usr/bin/python3', // added by myself "php" => '', // Something like /usr/bin/php. If empty, will be found in PATH. "curl" => '', // Something like /usr/bin/curl. If empty, will be found in PATH. "gzip" => '', // Something like /usr/bin/gzip. If empty, will be found in PATH. "id" => '', // Something like /usr/bin/id. If empty, will be found in PATH. "stat" => '', // Something like /usr/bin/stat. If empty, will be found in PATH. );
This is correct assuming that's where python is located. You can type python3 -c "import cloudscraper"
in shell. You will find that python can not find cloudscraper
on your system. I would recommend taking steps to resolve this problem. I believe pip3
might be able to help you, however I'm not an expert on python.
The module is not found as expected :
Traceback (most recent call last):
File "
Pip3 doesn't help either unless you want override system-packages :
error: externally-managed-environment
× This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification.
The last remark: it may well be that plugins are not loaded due to another reason. Initial error points to a JS error in noty.js : [http://tiger.hmnet.ucp/rutorrent/plugins/_noty/jquery.noty.js : 130] Uncaught TypeError: Cannot read properties of undefined (reading 'animateClose') Could this error be fixed in any way ?
I believe that I've got a confirmation to the idea, that plugins are not at the origin of the error. Here are the plugins :
venvs are in /root/.local/pipx/venvs apps are exposed on your $PATH at /root/.local/bin package cloudflare 2.16.0, installed using Python 3.11.2
I've set a system-wide # echo $PYTHONPATH :/root/.local/pipx/venvs
Now # python3 -c "import cloudscraper" executes without an error. But ruTorrent still raises a red notification : _cloudflare plugin: Le module cloudscraper ne peut pas être chargé dans Python [14.01.2024 23:04:39] JS error: [http://tiger.hmnet.ucp/rutorrent/plugins/_noty/jquery.noty.js : 130] Uncaught TypeError: Cannot read properties of undefined (reading 'animateClose')
Although I may well be mistaken as after flashing the cache the only error shows up : 14.01.2024 23:20:01] _cloudflare plugin: Le module cloudscraper ne peut pas être chargé dans Python
The virtual python environment needs to be exposed to your web server. Try restarting it. Alternatively, you can do what it says and use pip3 install --break-system-packages cloudflare
to bypass the apt package manager and install it that way.
Try clearing your web browser cache. I'm using Google Chrome with ruTorrent and not getting that noty js error.
The way you are installing ruTorrent is for advanced users. There are install scripts to perform the task easier. If you require support to install ruTorrent, chances are this method is not for you.
Apache2 was restarted. I could have bypassed the apt package manager, but it would be better avoiding a mess in the system. Plugins are installed the way they were meant to under Debian 12. I don't think any install scripts would do the job better as the underlying reason is not discovered and the fix is not found at this stage. Scripts developments are always behind and not ahead of migration to new OS version. They could be worth using for old OS setup. JS error is not appearing now. The only error remains: [15.01.2024 10:28:11] _cloudflare plugin: Le module cloudscraper ne peut pas être chargé dans Python This is the only fix required.
You need to create a virtual python environment for your Apache2 web server, if you want the Cloudflare plugin to work. If you don't know how, the bypass method is an easy solution. It will not break your operating system. It will just add a python plugin.
I help maintain the swizzin install script for Ubuntu and Debian. As long as you don't upgrade too early to the next operating system release, it works perfectly. There is usually a four of five year support window. It doesn't hurt to wait one year. The rTorrent version from the package manger is also unstable compared to the version on swizzin with ten patches. The software owner has chosen not to tag new versions. As a result, there are major performance and stability issues.
I have an impression, that nobody has tried sorting out plugins integration into ruTorrent under Debian 12 as yet. Everything worked well under Debian 11. Systemic solution will be restoring same functionality with regular OS means and not adding more complexity with add-in's, unless one has a specific task like heavy and 24-hours usage.
Curiously enough Swizzin hasn't done it either, as they report it : https://swizzin.ltd/applications/rtorrent#rutorrent[add-in](https://www.multitran.com/m.exe?s=add-in&l1=4&l2=2) The cloudlfare plugin does not work.
I would rather prefer not discussing implementation approaches here, but specific actions fixing cloudflare plugin loading into Python.
I was able resolving _cloudflare plugin error by cloning cloudscraper repository from https://github.com/VeNoMouS/cloudscraper
Afterwards I followed install directions from the same repository :
It gave an expected warning, which coincides with the previous experience : SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( /usr/lib/python3/dist-packages/setuptools/command/easy_install.py:146: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn(
Anyway, the build was executed without errors and apparently necessary modules installed in the local directory.
total 20 drwxr-xr-x 4 root root 4096 Feb 11 22:22 . drwxr-xr-x 3 root root 4096 Aug 22 07:06 .. drwxr-xr-x 4 root root 4096 Feb 11 22:22 cloudscraper-1.2.71-py3.11.egg -rw-r--r-- 1 root root 70 Feb 11 22:22 easy-install.pth drwxr-xr-x 4 root root 4096 Feb 11 22:22 requests_toolbelt-1.0.0-py3.11.egg
They complete CloudFlare modules installed with Debian 12 package. drwxr-xr-x 3 root root 4096 Jan 13 21:21 CloudFlare drwxr-xr-x 2 root root 4096 Jan 13 21:21 cloudflare-2.11.1.egg-info
rutorrent frontend doesn't issue red window warning and works as expected.
In conclusion cloudscraper integration with other standards-based tools like pipx or debian package would be necessary for Debian 12.
Glad, you resolved this issue. Closing off this question, since it's been resolved.
Please complete the following tasks.
Tell us about your environment
Google Chrome Version 120.0.6099.130 (Build officiel) (64 bits) ruTorrent: 4.2.9 PHP 8.2.7 (cli) (built: Jun 9 2023 19:37:27) (NTS) Python 3.11.2 OS : Debian 12 Bookworm
Tell us how you installed ruTorrent
git clone https://github.com/Novik/ruTorrent.git /var/www/rutorrent/
pipx install --include-deps cloudscraper
pipx install cloudflare
Describe the bug
After new rutorrent setup on a fresh system the following error appears in WebUI : 14.01.2024 11:29:51] _cloudflare plugin: Le module cloudscraper ne peut pas être chargé dans Python [14.01.2024 11:29:53] JS error: [http://tiger.hmnet.ucp/rutorrent/plugins/_noty/jquery.noty.js : 130] Uncaught TypeError: Cannot read properties of undefined (reading 'animateClose')
Steps to reproduce
Produces every time after login or browser refresh (F5).
Expected behavior
As of my previous usage with Debian 11 Bulleye and plugins install with
pip install cloudflare
pip install cloudscraper
a green notification rose in ruTorrent WebUI
Additional context
when installing plugins
pipx install --include-deps cloudscraper
pipx install cloudflare
an uncertainty with PATH comes up : Note: '/root/.local/bin' is not on your PATH environment variable. These apps will not be globally accessible until your PATH is updated. Run
pipx ensurepath
to automatically add it, or manually modify your PATH in your shell's config file (i.e. ~/.bashrc).What is the best way installing plugins and resolve the PATH issue?