Windows 7 x64 - Python 3.6
Install Libtorrent On Windows 7
I am trying to install the libtorrent Python library in windows using the instructions here.
For those advanced cases where you need to build and install libtorrent from source, follow this guide: Building/libtorrent. Microsoft Windows: Omit sudo prefix. Installing libtorrent in Windows 7 (self.Python) submitted 1 year ago by Mixanologos I am trying to install the libtorrent python library in windows 7 with no luck so far.My python version is 3.6 32bit.
After navigating to the setup.py file, I used the following commands
In the cmd window, I get the following messages:
What else do I need to do? Because trying to import the libtorrent library, the interpreter comes up with this message:
No matter what, the proper DLL is not available in the Python folder and thus I can't import the library.
Using the MSI installer from the Sourceforge link doesn't help either since it's severely outdated.
Michael Mior1 Answer
If you took a quick look at the setup.py
file you are trying to install, you would see that it assumes you have installed the boost C++ libraries
in order to generate the libtorrent.pyd
required for Python. You would expect to get an error, but that's not how things are right now.
Installing libtorrent
for Python without building it
For your own convenience, I have built Python Wheels of libtorrent
which can be installed with pip install
. Please take into consideration, that if it does not work, it means you will have to build your own .pyd
for your machine.
Building and installing libtorrent
for Python on Windows 7
In order to get boost
working, you will first have to download and install:
After you are done installing those, you will have to add their directories to your PATH
:
Right-Click
Computer
and go toProperties
:Click
Advanced System Settings
at the left:Click
Environment Variables
at the bottom-right:Choose
PATH
from the top list and clickEdit...
:Inside the box that popped up add these if you want to be buildingfor 32-bit Python:
Or these for 64-bit:
Click
OK
both from the pop up and from theEnvironment Variables
window, and leave the other one opened, we will need it later on..
Now everything is set up and you are ready to install the boost C++ libraries
. Because libtorrent
's Python bindings have some issues with boost versions higher than 1.63
(in August 2017), make sure to download this one.After you have downloaded it:
Extract it
Open a
Command Prompt
andcd
into the extracted directoryRun
bootstrap.bat
to install the libraries
Libtorrent Rasterbar
After that is done, go to the System Properties
window you left open from earlier, and click Environment Variables
again.Click on New...
and add these:
and click OK
to both windows again.
There is one last step before you can actually start building libtorrent
, and that is specifying your Python version into a configuration file.
Open a new
Command Prompt
Execute
echo using python : <Python Version> : '<Python Path>' : '<Python Path>Include' : '<Python Path>libs' ; >> user-config.jam
For example:
echo using python : 3.5 : 'C:Program FilesPython35' : 'C:Program FilesPython35Include' : 'C:Program FilesPython35libs' ; >> user-config.jam
Now to build libtorrent
:
Rasterbar
Downloadand extract the repository
Open
<libtorrent extracted directory>includelibtorrentsession.hpp
in a notepad, find the line that starts withstd::snprintf
, removestd::
and save.In a
Command Prompt
,cd
into<libtorrent extracteddirectory>bindingspython
Now
if you are building for 32-bit Python execute:
bjam libtorrent-link=static boost-link=static stage_module
or
bjam libtorrent-link=static boost-link=static address-model=64 stage_module
for 64-bitJust be patient, when it finishes you will have a
libtorrent.pyd
in<libtorrent extracted directory>bindingspython
which you canimport inside Python!
Not the answer you're looking for? Browse other questions tagged pythonlibtorrent or ask your own question.
Libtorrent Github
Cygwin has a built in rTorrent package, so you only need to use the following method for installing rTorrent, if you need XMLRPC-C support.
Installing rTorrent on Windows
To be able to run rTorrent on Windows, you are going to need Cygwin.
Installing Cygwin
Download Cygwin 1.7 (or newer) from the Cygwin page (direct link).
Start the installer, choose 'Install from internet', select a directory to install Cygwin, and one for the packages to be downloaded to, then set up your connection and pick a mirror.
You're going to need the following packages in order to compile and run rTorrent:
cppunit
gcc4
git
libcurl-devel
libncurses-devel
libtool
make
openssl-devel
patch
pkg-config
subversion
wget
These might require some other packages, let them be installed. Wait until the installer downloads and installs the necessary packages, check wherever you want shortcuts, and close the installer. When you're done, start Cygwin (if you choose not create any shortcuts, you can start Cygwin with the cygwin.bat in your installation directory).
Now you can proceed with rTorrent.
Installing libsigc++
Since there is no libsigc++ package for Cygwin, you're going to need to compile this one first. By default, Cygwin has no /usr/localr/src, so create one.
mkdir -p /usr/local/src
Download, compile and install the latest libsigc++ source from the Gnome ftp site - at the time of writing this manual, it was 2.2.10.
cd /usr/local/src/
wget http://ftp.gnome.org/pub/GNOME/sourc...+-2.3.1.tar.xz
tar xJvf libsigc++-2.3.1.tar.bz2
cd /usr/local/src/libsigc++-2.3.1
./configure
make
make install
cd ..
Installing libTorrent
Download the latest libTorrent source from the git repository, compile, and install it.
cd /usr/local/src/
git clone https://github.com/rakshasa/libtorrent libtorrent-git
cd /usr/local/src/libtorrent-git
./autogen.sh
./configure --disable-mincore
make
make install
cd ..
Installing XMLRPC-C (optional)
If you want to be able to control rTorrent via XMLRPC-C, let's say by rTWi. For that, you need to install XMLRPC-C, preferably something over version 1.07.
cd /usr/local/src/
svn co https://xmlrpc-c.svn.sourceforge.net...lrpc-c/stable/ xmlrpc-c-svn
cd /usr/local/src/xmlrpc-c-svn
./configure --disable-cplusplus
make
make install
cd ..
If the 'make install' fails, try to copy the necessary files by yourself.
mkdir -p /usr/local/include/xmlrpc-c
cp /usr/local/src/xmlrpc-c-svn/include/xmlrpc-c/*.h /usr/local/include/xmlrpc-c/
ln -s /usr/local/include/xmlrpc-c/oldxmlrpc.h /usr/local/include/xmlrpc.h
ln -s /usr/local/include/xmlrpc-c/server.h /usr/local/include/xmlrpc_server.h
ln -s /usr/local/include/xmlrpc-c/server_abyss.h /usr/local/include/xmlrpc_abyss.h
ln -s /usr/local/include/xmlrpc-c/server_w32httpsys.h /usr/local/include/xmlrpc_server_w32httpsys.h
ln -s /usr/local/include/xmlrpc-c/client.h /usr/local/include/xmlrpc_client.h
ln -s /usr/local/include/xmlrpc-c/server_cgi.h /usr/local/include/xmlrpc_cgi.h;
cp /usr/local/src/xmlrpc-c-svn/xmlrpc-c-config /usr/local/bin/
cp /usr/local/src/xmlrpc-c-svn/lib/abyss/src/*.a /usr/local/lib/
cp /usr/local/src/xmlrpc-c-svn/lib/abyss/src/*.dll /usr/local/lib/
cp /usr/local/src/xmlrpc-c-svn/lib/expat/xmlparse/*.a /usr/local/lib/
cp /usr/local/src/xmlrpc-c-svn/lib/expat/xmlparse/*.dll /usr/local/lib/
cp /usr/local/src/xmlrpc-c-svn/lib/expat/xmltok/*.a /usr/local/lib/
cp /usr/local/src/xmlrpc-c-svn/lib/expat/xmltok/*.dll /usr/local/lib/
cp /usr/local/src/xmlrpc-c-svn/lib/libutil/*.a /usr/local/lib/
cp /usr/local/src/xmlrpc-c-svn/lib/libutil/*.dll /usr/local/lib/
cp /usr/local/src/xmlrpc-c-svn/src/*.a /usr/local/lib/
cp /usr/local/src/xmlrpc-c-svn/src/*.dll /usr/local/lib/
Installing rTorrent
Now download the latest rTorrent source from the git repository.
You are going to need to do some modification on the source code. Download and apply this patch (see ticket #1184 and ticket #1495 at the rTorrent trac). After you're done, you can compile and install rTorrent.
cd /usr/local/src/
git clone https://github.com/rakshasa/rtorrent rtorrent-git
cd /usr/local/src/rtorrent-git
wget http://static.jmk.hu/rtwi/downloads/misc/rtow.diff patch
patch -p0 < rtow.diff
./autogen.sh
./configure --with-xmlrpc-c
make
make install
cd ..
If 'make' fails, with the message 'fatal error: ncurses.h: No such file or directory' you might need to run ./configure with the CXXFLAGS option, i.e.:
./configure --with-xmlrpc-c CXXFLAGS=-I/usr/include/ncurses
You are now ready to run rTorrent on Windows, just type rtorrent into your Cygwin window.
Using rTorrent on Windows without installing Cygwin
Download rTorrent binaries for Windows
You can find all releases in the download section.
Direct download (7z archive)
Download and extract the .7z archive to a directory of your choice.
You can download the 7-Zip software from http://7-zip.org/.
BitTorrent download
Download the .torrent file and feed it to your current BitTorrent client. After the download is complete, move/rename the directory as you wish.
Configure rTorrent on Windows
The .rtorrent.rc configuration file can be found in the bin directory. There are some settings already set up for ease of usage, please do not modify them, unless you know what you are doing.
The default session directory is .session, and the default download directory is torrent.
You can access your partitions thru the cygdrive directory from rTorrent.
You are now ready to run rTorrent on Windows, just create a shortcut pointing to the rTorrent.cmd file, or start it directly.