Reputation: 121
I have Python 3.4 (32-bit) installed, and I installed the python-libtorrent-0.16.16.win32.msi on top of that.
My test code says: ImportError: DLL load failed: %1 is not a valid Win32 application.
My google results suggest this works fine with Python 2.7. Is that the solution? I have to down-grade my Python?
Upvotes: 2
Views: 2108
Reputation: 877
It does support python3
This docker file works for me (libtorrent
- local dir with the lib been checked out to version needed)
FROM debian:buster-slim
WORKDIR /app/libtorrent
COPY debian/backports.list /etc/apt/sources.list.d/
RUN apt-get update
RUN apt-get install -y -t buster-backports checkinstall
RUN apt-get install -y build-essential libboost-system-dev libboost-python-dev libboost-chrono-dev libboost-random-dev libssl-dev
RUN apt-get install -y autoconf automake libtool
ADD libtorrent /app/libtorrent
RUN ./autotool.sh
# RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
ENV PYTHON=/usr/bin/python3.7
RUN ./configure --enable-python-binding --with-libiconv
RUN make
RUN checkinstall
RUN ldconfig
Upvotes: 0
Reputation: 49
NO. Libtorrent doesn't support Python 3.
It compiles but doesn't work due to Python 3 utf8 handling difference. There was an unsuccessful effort to make it work a while back https://code.google.com/p/libtorrent/issues/detail?id=449
Current trunk even contains invalid Python 3 i.e. http://sourceforge.net/p/libtorrent/code/HEAD/tree/trunk/bindings/python/setup.py Line 70 > 'print cmdline'
For some reason there is an Ubuntu python3-libtorrent package which confuses people, but it definitely doesn't work, neither does manual compilation.
steps:
apt-get build-dep libtorrent-rasterbar
export 'PYTHON_VERSION=3.4'; export 'PYTHON=/usr/bin/python3.34'
./configure LDFLAGS="-L/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu/" --enable-python-binding --enable-geoip=no
--with-boost-python=boost_python-py34
ldconfig
>> python
import libtorrent
ses = libtorrent.session()
ses.save_state()
"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa2 in position 0: invalid start byte"
Upvotes: 1