# Libtorrent and Deluge from sources Using anaconda: ```bash conda create -n 'deluge' python=3.8 conda activate deluge ``` ## Libtorrent Install boost and GCC: ```bash= conda install anaconda::py-boost conda install anaconda::gxx_linux-64 ``` Clone repo: ```bash= git clone\ --recurse-submodules https://github.com/arvidn/libtorrent.git ``` Compile with debug symbols and install: ```bash= cd ./libtorrent/bindings/python python setup.py build_ext --b2-args=variant=debug install ``` Test it out: ```python= (deluge) ➜ Status python Python 3.8.20 (default, Oct 3 2024, 15:24:27) [GCC 11.2.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import libtorrent >>> ``` ## Deluge With the `deluge` conda env activated, switch to your preferred folder and clone Deluge's repo: ```bash= git clone https://github.com/deluge-torrent/deluge ``` You can't run Deluge without the distribution files, so I recommend you install the package in "editable" mode which symlinks source files onto the Python library path: ```bash= cd deluge pip install -e . ``` Once that's done, you can try firing the Deluge daemon: ```bash= mkdir config python -c "from deluge.core.daemon_entry import start_daemon; start_daemon()" -c ./config -d -L debug ``` ## Attaching a Debugger **To Deluge.** If you want to launch the Deluge daemon in a way that you can attach a debugger to it, you can modify `deluge.core.daemon_entry` and add at the end of the module: ```python= if __name__ == '__main__': start_daemon() ``` your IDE should then be able to launch the module `deluge.core.daemon_entry` and attach a debugger to it. **To libtorrent.** If you attach GDB to the Python interpreter that is running the Deluge daemon, it will honor breakpoints within libtorrent. You can actually run Python in debug mode too, which allows you to see both what's happening in Deluge and in libtorrent.