Tutorial: Deluge 1.2.0 and flexget up and running in 30mins

Support for Deluge on Apple Mac OS
xml
New User
New User
Posts: 4
Joined: Wed Dec 09, 2009 8:40 am

Tutorial: Deluge 1.2.0 and flexget up and running in 30mins

Post by xml »

This tutorial requires terminal usage skills and that you have macports installed (thus requiring xcode installed aswell). If you don't understand anything of this, don't even try to follow this tutorial.

This tutorial will guide you on how to install Deluge 1.2.0 final and flexget in a clean and non-messy way with virtualenv and python 2.6 in Snowleopard. Virtualenv is a way to isolate python installations. Some may say that macports it self is a self contained isolation but if you do a lot of python development you may want to run different libs in different versions side by side. Let's just say it's good practice to keep your macports clean. It will take 30-60 minutes depending on your computers speed.

Anyway lets get going by starting to install python, boost etc and then deluge. We finish with installing flexget in the last steps.

1. sudo port install openssl gettext python26 +no_tkinter py26-setuptools python_select boost +python26 py26-game py26-gtk librsvg libnotify
(+no_tkinter builds python without unesscary x11 libs, who the fck uses IDLE anyway?) (This will take some time depending on your machine)
2. sudo python_select python26
3. sudo easy_install virtualenv virtualenvwrapper pip
4. Put this in your ~/.bashrc or modify it to zsh or whatever you are using and put it in corresponding rc file.

export PATH="/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin:$PATH"

export WORKON_HOME='/Users/<user>/virtualenvs'
export PIP_VIRTUALENV_BASE=$WORKON_HOME

if [ -f /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/virtualenvwrapper_bashrc ]; then
. /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/virtualenvwrapper_bashrc
fi

5. source ~/.bashrc or whatever rc file you added the above to (or logout and login)
6. mkvirtualenv deluge
7. easy_install pyOpenSSL Mako Twisted pygeoip chardet pyxdg
8. Go to http://freedesktop.org/wiki/Software/pyxdg and find the download link for the latest pyxdg
9. easy_install http://url.to/latest/pyxdg-X.XX.tar.gz (replace with the link from step 6)
10. cd $WORKON_HOME/deluge && mkdir src && cd src
11. Get latest deluge from http://download.deluge-torrent.org/source/ (wget http://download.deluge-torrent.org/sour ... .0.tar.bz2)
12. Get the source code for rasterbar libtorrent - NOT THE LIBTORRENT THAT COMES WITH MACPORTS NOR THE LIBTORRENT THAT COMES WITH RTORRENT - from http://code.google.com/p/libtorrent/downloads/list (wget http://libtorrent.googlecode.com/files/ ... 4.8.tar.gz) or the appropriate link for you.
13. tar -xvjf deluge*.tar.bz2 && tar -xvzf libtorrent-rasterbar*.tar.gz && mv $(ls -d libtorrent-rasterbar*/) $(ls -d deluge*/)/libtorrent && cd $(ls -d deluge*/) && ln -s /opt/local/include/boost libtorrent/include/
14. Time to compile deluge and libtorrent. run python setup.py install
15. Get coffe or take a dump. This will take some minutes.
16. Test that deluge works with deluge -u web -L debug
17. If deluged runs fine (and it should if you did it right), ctrl+c to quit it. If it does'nt cry a river :)
18. Copy plugins into the correct place so that they will run. (cp deluge/plugins/*.egg ~/.config/deluge/plugins)
19. Edit your config in ~/.config/deluge to fit your needs ()
20. crontab -e and add this rows, replace <username> with your username:
@reboot source /Users/<username>/virtualenvs/deluge/bin/activate && deluged > /dev/null 2>&1 &
@reboot source /Users/<username>/virtualenvs/deluge/bin/activate && deluge-web -f > /dev/null 2>&1

Deluge is now installed in a virtualenv which we named deluge. If you log on to a new shell and type deluge it will not work.
However if you typ workon you will get a list of your available virtualenvs. Type workon deluge to work on the deluge virtualenv and be able to run deluge or deluge-console

Thanks comedian for the tutorial which this is based up on (http://forum.deluge-torrent.org/viewtop ... 13&t=26085).

Flexget

Getting flexget to work with deluge now is just a matter of installing flexget in the same virtualenv as deluge.

1. Type workon deluge in your terminal unless you are still in the same environment as above
2. Go to flexget.com and copy the download link for the latest version
3. easy_install http://download.flexget.com/unstable/Fl ... -py2.6.egg (replace with link to latest version)
4. Edit your config and initdb
5. crontab -e and add this to make flexget run each fifth minute of the hour:
*/5 * * * * source /Users/<username>/virtualenvs/deluge/bin/activate && flexget --cron > /dev/null 2>&1

Example conf: http://forum.deluge-torrent.org/viewtop ... 65&start=0
Last edited by xml on Wed Jan 13, 2010 12:29 pm, edited 2 times in total.
andar
Top Bloke
Top Bloke
Posts: 1050
Joined: Fri Jun 08, 2007 8:38 pm
Location: Victoria, BC
Contact:

Re: Tutorial: Deluge 1.2.0 and flexget up and running in 30mins

Post by andar »

Just one thing you may wish to alter. A new version of libtorrent was recently released, 0.14.8, and I would suggest using that instead of 0.14.7 since it has some good bug fixes. You can download it here: http://code.google.com/p/libtorrent/
xml
New User
New User
Posts: 4
Joined: Wed Dec 09, 2009 8:40 am

Re: Tutorial: Deluge 1.2.0 and flexget up and running in 30mins

Post by xml »

andar wrote:Just one thing you may wish to alter. A new version of libtorrent was recently released, 0.14.8, and I would suggest using that instead of 0.14.7 since it has some good bug fixes. You can download it here: http://code.google.com/p/libtorrent/
Thanks, updated it. Though I will not continue to update it everytime there's a new version.
Also updated it to add gtk support.
comedian
Member
Member
Posts: 29
Joined: Sat Nov 28, 2009 3:55 am

Re: Tutorial: Deluge 1.2.0 and flexget up and running in 30mins

Post by comedian »

Awesome! You've sold me on virtualenv xml!
User avatar
zachtib
Leecher
Leecher
Posts: 97
Joined: Thu May 24, 2007 3:26 pm
Location: Louisville, KY
Contact:

Re: Tutorial: Deluge 1.2.0 and flexget up and running in 30mins

Post by zachtib »

Stuck. You guys should probably stick to this method (assuming it works for you) until I can get a bundled app up
Former Deluge Developer
dan112
New User
New User
Posts: 5
Joined: Sun Jan 17, 2010 10:42 pm

Re: Tutorial: Deluge 1.2.0 and flexget up and running in 30mins

Post by dan112 »

Code: Select all

XXXXXXXX-macbook-pro% source ~/.bashrc
ERROR: Virtual environments directory '/Users/######/virtualenvs' does not exist.
ERROR: Virtual environments directory '/Users/######/virtualenvs' does not exist.
Any help?

I'm not too adept at this, so I'm not sure if I did step 4 properly. I put that in my bashrc, but idk what it means to modify it to zsh or my corresponding rc file. I know how to get into zsh, just by typing zsh.

Thanks
Last edited by dan112 on Tue Jan 19, 2010 8:24 am, edited 1 time in total.
comedian
Member
Member
Posts: 29
Joined: Sat Nov 28, 2009 3:55 am

Re: Tutorial: Deluge 1.2.0 and flexget up and running in 30mins

Post by comedian »

Code: Select all

XXXXXXXX-macbook-pro% source ~/.bashrc
ERROR: Virtual environments directory '/Users/danielsaewitz/virtualenvs' does not exist.
ERROR: Virtual environments directory '/Users/danielsaewitz/virtualenvs' does not exist.
Any help?

I'm not too adept at this, so I'm not sure if I did step 4 properly. I put that in my bashrc, but idk what it means to modify it to zsh or my corresponding rc file. I know how to get into zsh, just by typing zsh.

Thanks
Do a "mkdir -p ~/virtualenvs" (without the quotes).

That should solve your problem.

If not, follow it up with a "chown -R `whoami`:staff ~/virtualenvs && chmod -R 755 ~/virtualenvs".
Last edited by comedian on Tue Jan 19, 2010 4:31 pm, edited 1 time in total.
dan112
New User
New User
Posts: 5
Joined: Sun Jan 17, 2010 10:42 pm

Re: Tutorial: Deluge 1.2.0 and flexget up and running in 30mins

Post by dan112 »

Thanks for that.
I've been trying a ton of things, but I keep on getting errors.

Code: Select all

Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/deluge", line 8, in <module>
    load_entry_point('deluge==1.2.0', 'console_scripts', 'deluge')()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pkg_resources.py", line 318, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pkg_resources.py", line 2221, in load_entry_point
    return ep.load()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/deluge-1.2.0-py2.6-macosx-10.6-i386.egg/deluge/main.py", line 47, in <module>
    import deluge.common
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/deluge-1.2.0-py2.6-macosx-10.6-i386.egg/deluge/common.py", line 66, in <module>
    import xdg, xdg.BaseDirectory
ImportError: No module named xdg
xdg is installed. I'm not sure why it thinks it isn't.
comedian
Member
Member
Posts: 29
Joined: Sat Nov 28, 2009 3:55 am

Re: Tutorial: Deluge 1.2.0 and flexget up and running in 30mins

Post by comedian »

have you done a "workon deluge"?
dan112
New User
New User
Posts: 5
Joined: Sun Jan 17, 2010 10:42 pm

Re: Tutorial: Deluge 1.2.0 and flexget up and running in 30mins

Post by dan112 »

Yes.
When trying to easy_install pyxdg, I get this error. I think I may have found it.

Code: Select all

$ sudo easy_install pyxdg
Searching for pyxdg
Reading http://pypi.python.org/simple/pyxdg/
Couldn't find index page for 'pyxdg' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for pyxdg
Best match: None
Traceback (most recent call last):
  File "/Users/removed/virtualenvs/deluge/bin/easy_install", line 8, in <module>
    load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1712, in main
    
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
    
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1716, in <lambda>
    
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 987, in run_commands
    self.run_command(cmd)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 1007, in run_command
    cmd_obj.run()
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 211, in run
    
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 434, in easy_install
    
  File "build/bdist.linux-i686/egg/setuptools/package_index.py", line 475, in fetch_distribution
AttributeError: 'NoneType' object has no attribute 'clone'
However, building it outside of deluge works fine.

Code: Select all

$ sudo easy_install pyxdg
Searching for pyxdg
Best match: pyxdg 0.18
Processing pyxdg-0.18-py2.6.egg
pyxdg 0.18 is already the active version in easy-install.pth

Using /Library/Python/2.6/site-packages/pyxdg-0.18-py2.6.egg
Processing dependencies for pyxdg
Finished processing dependencies for pyxdg
Post Reply