I’m trying to update the tribler package from 7.14.0 to 8.0.7. Tribler is a python application. But I am pretty stuck. When I run the application with my updated install script, it complains the following:
********************************************************************************
A AttributeError occurred
********************************************************************************
Traceback (most recent call last):
File "/nix/store/6cl141m3vxywkjr3j92297c6c3jliqb7-tribler-8.0.7/src/run_tribler.py", line 64, in <module>
from tribler.core.session import Session
File "/nix/store/6cl141m3vxywkjr3j92297c6c3jliqb7-tribler-8.0.7/src/tribler/core/session.py", line 29, in <module>
from tribler.core.libtorrent.download_manager.download_manager import DownloadManager
File "/nix/store/6cl141m3vxywkjr3j92297c6c3jliqb7-tribler-8.0.7/src/tribler/core/libtorrent/download_manager/download_manager.py", line 53, in <module>
lt.create_ut_metadata_plugin,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'libtorrent' has no attribute 'create_ut_metadata_plugin'
********************************************************************************
Error while showing a message box: [Errno 2] No such file or directory: 'xmessage'
So apparently, the dependency libtorrent
loaded by tribler is broken. I investigated a bit. The provider of libtorrent
is libtorrent-rasterbar-1_2_x
. And it is supposed to contain the attribute create_ut_metadata_plugin
. I tried to replicate the bug with my tribler installation using the following script:
#!/usr/bin/env python3.11
import sys
sys.path.insert(0, '/nix/store/ay379gxsbkz5d07k8c8cjbwdlq39mmm3-libtorrent-rasterbar-1.2.19-python/lib/python3.11/site-packages/')
import libtorrent as lt
# Copy-paste from tribler source code
DEFAULT_LT_EXTENSIONS = [
lt.create_ut_metadata_plugin,
lt.create_ut_pex_plugin,
lt.create_smart_ban_plugin
]
print(DEFAULT_LT_EXTENSIONS)
But running this script, I get no errors. So somehow, the line lt.create_ut_metadata_plugin
works when loading libtorrent
manually, but not when tribler loads it…
For tribler, I use the following install script (adapted from version 7.14.0):
installPhase = ''
mkdir -pv $out
# Nasty hack; call wrapPythonPrograms to set program_PYTHONPATH.
wrapPythonPrograms
cp -prvd ./* $out/
makeWrapper ${python3.pkgs.python}/bin/python $out/bin/tribler \
--set _TRIBLERPATH "$out/src" \
--set PYTHONPATH $out/src/tribler/core:$out/src/tribler/ui:$program_PYTHONPATH \
--set NO_AT_BRIDGE 1 \
--chdir "$out/src" \
--add-flags "-O $out/src/run_tribler.py"
# Test code inserted for the purpose of this bug report.
echo "$program_PYTHONPATH"
$out/bin/tribler --help
# More stuff cut out for brevity
'';
The output of echo "$program_PYTHONPATH"
includes as the first path the exact location of libtorrent-rasterbar-1_2_x
that I tested. When I load it manually, it contains the attribute mentioned above. But already inside the install script, simply running $out/bin/tribler --help
, I get the error mentioned in the beginning.
When I remove the line $out/bin/tribler --help
, the install script runs fine. But then I get the same error once running the application from the terminal.
So yeah, I am pretty stuck. I have no idea how to debug this. Somehow, if tribler loads libtorrent
it misses some attributes that would exist if I load it manually.