qbittorrent(<=4.4.0)'s search window fails with "Python is required to use the search engine but it does not seem to be installed"

  • Open
  • quality assurance status badge
Details
3 participants
  • Attila Lendvai
  • Jacob Hrbek
  • Maxime Devos
Owner
unassigned
Submitted by
Jacob Hrbek
Severity
normal
Merged with
J
J
Jacob Hrbek wrote on 18 Jan 2022 04:00
(address . bug-guix@gnu.org)
43f27323-66b8-d72b-9ab5-062c5a27a72b@rixotstudio.cz
qbittorrent <=4.4.0 (current latest version) fails with:

```
Missing Python Runtime

Python is required to use the search engine but it does not seem to be
installed
```

which is triggered from `qbittorrent/src/gui/mainwindow.cpp`:

```cpp

void MainWindow::on_actionSearchWidget_triggered()
{
if (!m_hasPython && m_ui->actionSearchWidget->isChecked())
{
const Utils::ForeignApps::PythonInfo pyInfo = Utils::ForeignApps::pythonInfo();

// Not installed
if (!pyInfo.isValid())
{
m_ui->actionSearchWidget->setChecked(false);
Preferences::instance()->setSearchEnabled(false);

#ifdef Q_OS_WIN
const QMessageBox::StandardButton buttonPressed = QMessageBox::question(this, tr("Missing Python Runtime")
, tr("Python is required to use the search eng
ine but it does not seem to be installed.\nDo you want to install it now?")
, (QMessageBox::Yes | QMessageBox::No), QMessageBox::Yes);
if (buttonPressed == QMessageBox::Yes)
installPython();
#else
QMessageBox::information(this, tr("Missing Python Runtime")
, tr("Python is required to use the search engine but it does not seem to be installed."));
#endif
return;
}

// Check version requirement
if (!pyInfo.isSupportedVersion())
{
m_ui->actionSearchWidget->setChecked(false);
Preferences::instance()->setSearchEnabled(false);

#ifdef Q_OS_WIN
const QMessageBox::StandardButton buttonPressed = QMessageBox::question(this, tr("Old Python Runtime")
, tr("Your Python version (%1) is outdated. Minimum requirement: %2.\nDo you want to install a newer version now?")
.arg(pyInfo.ve
rsion, QLatin1String("3.5.0"))
, (QMessageBox::Yes | QMessageBox::No), QMessageBox::Yes);
if (buttonPressed == QMessageBox::Yes)
installPython();
#else
QMessageBox::information(this, tr("Old Python Runtime")
, tr("Your Python version (%1) is outdated. Please upgrade to latest version for search engines to work.\nMinimum requirement: %2.")
.arg(pyInfo.version, QLatin1String("3.5.0")));
#endif
return;
}

m_hasPython = true;
m_ui->actionSearchWidget->setChecked(true);
Preferences::instance()->setSearchEnabled(true);
}

displaySearchTab(m_ui->actionSearchWidget->isChecked());
}
```

To call `Utils::ForeignApps::pythonInfo()` definition in
`qbittorrent/src/base/utils/foreignapps.cpp` as:

```cpp

pp#L272 */
PythonInfo Utils::ForeignApps::pythonInfo()
{
static PythonInfo pyInfo;
if (!pyInfo.isValid())
{
if (testPythonInstallation("python3", pyInfo))
return pyInfo;

if (testPythonInstallation("python", pyInfo))
return pyInfo;

#if defined(Q_OS_WIN)
if (testPythonInstallation(findPythonPath(), pyInfo))
return pyInfo;
#endif

LogMsg(QCoreApplication::translate("Utils::ForeignApps", "Python not detected"), Log::INFO);
}

return pyInfo;
}
```


Where:

```cpp
if (testPythonInstallation("python3", pyInfo)) ...
```

Is important as it's checking for a `python3` (or `python`) executable
in PATH that is not provided by guix's build procedure -> The package
has compatibility issues with GNU Guix and has to be patched.


### Steps to reproduce:
0. Get qbittorrent on GNU Guix
1. Open the GUI: View > Search engine and observe the highlighted error
pre
venting to use the search engine functionality

Relevants:

--
Jacob Hrbek
Attachment: file
Attachment: signature.asc
J
J
Jacob Hrbek wrote on 18 Jan 2022 04:01
Re: bug#53334: Acknowledgement (qbittorrent(<=4.4.0)'s search window fails with "Python is required to use the search engine but it does not seem to be installed")
(address . 53334@debbugs.gnu.org)
2f150fa5-3009-d893-b6a3-90189dc6aaec@rixotstudio.cz
Assigned myself to address the issue

On 1/18/22 04:01, help-debbugs@gnu.org wrote:
Toggle quote (22 lines)
> Thank you for filing a new bug report with debbugs.gnu.org.
>
> This is an automatically generated reply to let you know your message
> has been received.
>
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
>
> Your message has been sent to the package maintainer(s):
> bug-guix@gnu.org
>
> If you wish to submit further information on this problem, please
> send it to 53334@debbugs.gnu.org.
>
> Please do not send mail to help-debbugs@gnu.org unless you wish
> to report a problem with the Bug-tracking system.
>
> --
> 53334: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=53334
> GNU Bug Tracking System
> Contact help-debbugs@gnu.org with problems

--
Jacob Hrbek
Attachment: signature.asc
J
J
Jacob Hrbek wrote on 18 Jan 2022 04:16
[PATCH] qbittorrent: Phase patch to use full nix path for python-gate to avoid "Missing Python Runtime" failure on search engine
(address . 53334@debbugs.gnu.org)(name . Jacob Hrbek)(address . kreyren@rixotstudio.cz)
20220118031617.17242-1-kreyren@rixotstudio.cz

Signed-off-by: Jacob Hrbek <kreyren@rixotstudio.cz>
---
gnu/packages/bittorrent.scm | 7 +++++++
1 file changed, 7 insertions(+)

Toggle diff (19 lines)
diff --git a/gnu/packages/bittorrent.scm b/gnu/packages/bittorrent.scm
index fa88c91163..f222b87692 100644
--- a/gnu/packages/bittorrent.scm
+++ b/gnu/packages/bittorrent.scm
@@ -491,6 +491,13 @@ (define-public qbittorrent
(guix build qt-utils))
#:phases
(modify-phases %standard-phases
+ ;; The package is checking for a `python` or `python3` executable in an environment variable `PATH` which causes the search engine to fail with "Missing Python Runtime" this phase substitutes the python executables with full path in the nix store executable -- https://issues.guix.gnu.org/53334
+ ;; FIXME-QA(Krey): This codeblock depends on upstream's declaration of https://github.com/qbittorrent/qBittorrent/blob/master/src/base/utils/foreignapps.cpp#L277, if the fi
le declaration changes then this phase will be malfunction -> Consider optimizing the upstream code for nix userland
+ (add-after 'unpack 'python-path-compat
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "src/base/utils/foreignapps.cpp"
+ (("if \\(testPythonInstallation\\(\"python3\", pyInfo\\)\\)")
+ (string-append "if (testPythonInstallation(\"" (search-input-file inputs "/bin/python") "\", pyInfo))")))))
(add-after 'install 'wrap-qt
(lambda* (#:key outputs inputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
--
2.34.0
Attachment: signature.asc
A
A
Attila Lendvai wrote on 18 Jan 2022 10:53
(No Subject)
(name . 53334@debbugs.gnu.org)(address . 53334@debbugs.gnu.org)
6BfMyuL9LvAT1mDvoGBt8Vqt99fIs0bHR3M9Oev-sqNlLyGAQFMm8A78i4VzLqOyUYqS5pJJZVfF16eTN0tAgQYUt9pzrlv3f3m0J-yuMXo=@lendvai.name
i may be misunderstanding something here... but when i add python to
my user's profile, then for me search does work in vanilla
qBittorrent.

i think the entire point of this is to keep the python dependency
optional at runtime.

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“If you have 10,000 regulations, you destroy all respect for the law.”
— Winston Churchill (1874–1965)
J
J
Jacob Hrbek wrote on 19 Jan 2022 08:15
Re: bug#53334: Acknowledgement (qbittorrent(<=4.4.0)'s search window fails with "Python is required to use the search engine but it does not seem to be installed")
(address . 53334@debbugs.gnu.org)
2a1debaf-2c9a-80ab-1240-c434b4754848@rixotstudio.cz
Toggle quote (1 lines)
> i may be misunderstanding something here... but when i add python to
my user's profile, then for me search does work in vanilla qBittorrent.
> i think the entire point of this is to keep the python dependency
optional at runtime. -- Landvai
`$ guix shell qbittorrent python` works, but i think it's better to
address it this way to make sure that it works out of the box since the
dependency (afaik) is in the store either way if qbittorrent is installed.
On 1/18/22 04:01, Jacob Hrbek wrote:
Toggle quote (25 lines)
> Assigned myself to address the issue
>
> On 1/18/22 04:01, help-debbugs@gnu.org wrote:
>> Thank you for filing a new bug report with debbugs.gnu.org.
>>
>> This is an automatically generated reply to let you know your message
>> has been received.
>>
>> Your message is being forwarded to the package maintainers and other
>> interested parties for their attention; they will reply in due course.
>>
>> Your message has been sent to the package maintainer(s):
>>   bug-guix@gnu.org
>>
>> If you wish to submit further information on this problem, please
>> send it to 53334@debbugs.gnu.org.
>>
>> Please do not send mail to help-debbugs@gnu.org unless you wish
>> to report a problem with the Bug-tracking system.
>>
>> --
>> 53334: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=53334
>> GNU Bug Tracking System
>> Contact help-debbugs@gnu.org with problems
>
--
Jacob Hrbek
Attachment: signature.asc
J
M
M
Maxime Devos wrote on 29 Sep 2022 14:30
Re: bug#43184: Qbittorent Search Doesnt work.
(address . control@debbugs.gnu.org)
7e8eab5b-cb77-5beb-9b64-dd18bf3ab7f4@telenet.be
reopen 43184
merge 43184 53334
thanks
(Forgot to send it to control@debbugs.gnu.org)
Attachment: OpenPGP_signature
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 53334@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 53334
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch