Get Canto

Debian/Ubuntu [out of date]


Debian (sid) and Ubuntu (trusty, xenial through zesty) running AMD64 can add the following line to their sources.list to get canto. If there is demand for i386, I can start to generate for them as well (unfortunately the curses C extension is architecture dependent).

deb http://codezen.org/debian [sid|trusty|xenial|yakkety|zesty] main

That repo is signed with a key you can add:

curl https://codezen.org/static/canto-pub.gpg | sudo apt-key add -

After you’ve added the repo and key, just apt-get update and then install python3-canto-curses.

Gentoo


Gentoo has native packages, canto-daemon and canto-curses. Latest version isn’t guaranteed however.

Arch


Arch has native packages, canto-daemon and canto-curses in the community repo.

Git variants are also available in the AUR.

NixOS


NixOS has native packages, canto-daemon and canto-curses.

Tarballs


The latest release can be downloaded (.tar.gz) here:

daemon 0.9.8
curses 0.9.9

Tag snapshots for older releases are also listed.

daemon
curses

Git


The source for Canto is available on Github:

canto-next
canto-curses

Installation from Source


Installation of canto is quite simple and follows the standard paradigm for Python packages.

Dependencies


daemon:


  • Python 3
  • Python 3 – feedparser

curses:


Runtime

  • Python 3
  • readline
  • ncursesw

Build (on distros with separate dev header packages)

  • python3-dev
  • libreadline6-dev
  • libncurses5-dev
  • libncursesw5-dev
  • Standard build tools (build-essential, GCC, etc.)

Git Install


  1. git clone https://github.com/themoken/canto-next.git
  2. cd canto-next
  3. sudo python3 setup.py install
  4. cd ../
  5. git clone https://github.com/themoken/canto-curses.git
  6. cd canto-curses
  7. sudo python3 setup.py install

Tarball Install


  1. download or wget [canto-next tarball]
  2. tar -xvzf canto-next-[version].tar.gz
  3. cd canto-next-[version]
  4. sudo python3 setup.py install
  5. cd ../
  6. download or wget [canto-curses tarball]
  7. tar -xvzf canto-curses-[version].tar.gz
  8. cd canto-curses-[version]
  9. sudo python3 setup.py install

Installation from Source (no root access)

This assumes that you have Python 3 installed already. If not, then getting a working Python 3 installation is step one. This is beyond the scope of this little walkthrough, but the official Python 3 docs and Google should be helpful.

Python has good support for installation to user directories via setup.py.

Using python3 setup.py install --prefix=/path/to/some/directory you can install a Python package into a custom directory.

You still need all of the dependencies available, they’re listed in the previous section.

Build dependencies can be a bit tricky without root access. Requiring compilers and headers on something like a shared host can be a pain. Fortunately, if you do have access to a machine with the same architecture as your host (like your laptop or desktop) running Linux, you can do the installation step on your machine and then copy your custom root directory wherever you need.

Install canto to a custom directory

It may seem odd to install canto before its runtime dependencies, but canto’s setup.py is simple enough to create a directory hierarchy at the prefix, even if one doesn’t exist, where feedparser will fail unless there’s already a hierarchy in place.

Here’s the rootless install for installing to ~/canto-root:

  1. git clone https://github.com/themoken/canto-next.git
  2. cd canto-next
  3. python3 setup.py install --prefix=~/canto-root
  4. cd ../
  5. git clone https://github.com/themoken/canto-curses.git
  6. cd canto-curses
  7. python3 setup.py install --prefix=~/canto-root

Install runtime dependencies to a custom directory

For the runtime dependencies, ncursesw and readline are usually non-issues (they are usually pulled in by base packages on most distros).

For Feedparser, you can download from github and install with setup.py, just like Canto. It is a little pickier about your installation target being in your PYTHONPATH already.

NOTE: The PYTHONPATH change includes the Python version, you’ll have to change it (or just tab complete it since the directory should’ve been created by the Canto install).

  1. mkdir ~/canto-root
  2. git clone https://github.com/kurtmckee/feedparser.git
  3. cd feedparser
  4. export PYTHONPATH=”/path/to/canto-root/lib/python3.X/site-packages/:$PYTHONPATH”
  5. python3 setup.py install --prefix=~/canto-root

Now ~/canto-root has a full install of Canto and can be moved around if you need to.

Running Canto out of the custom directory

In your shell setup (like .bashrc) or in your terminal / script add the following:

export PATH="/path/to/canto-root/bin:$PATH"
export PYTHONPATH="/path/to/canto-root/lib/python3.[X]/site-packages:$PYTHONPATH"

Once again, note that PYTHONPATH has a version in it that you’ll have to change to be appropriate for your install.

This should allow you to run canto-daemon, canto-curses, and canto-remote as usual.

25 thoughts on “Get Canto

  1. When I add your repository on Debian Sid and try to install python3-canto-curses I get:
    python3-canto-curses : Depends: python3 (< 3.5) but 3.5.1-3 is installed
    I get that on three different Debian installations.
    I also tried to install python3.4 without getting different results.
    Is that (<3.5) strict dependence important or can it be lifted?
    Anyway, thanks for your great software.

    1. Yeah, one of the problems with serving debs and not *using* Debian: sid’s Python version gets bumped and I don’t notice.

      I should have fresh debs up in the next few hours, possibly with a new repo key too since I think I lost the GPG key I used to sign it with when my previous laptop drive died.

  2. Hey Jack. I’ve added your key as documented above. I check with apt-key list and it is there. I ran apt-get update and then apt-get install ptyhon3-canto-curses. But I get:
    WARNING: The following packages cannot be authenticated!
    python3-canto-daemon python3-canto-curses

    Also, since the last major update of apt it will complain that your key is weak.

    Cheers,
    Marcel

  3. Hi Jack,

    Thanks for Canto! I (Ubuntu 16.04) have, however, one problem with the installation process: After adding “deb http://codezen.org/debian xenial main” I get the following error message:

    “http://codezen.org/debian/dists/xenial/Release.gpg: Signature by key 6D4E5FDE18249AE7E64D5416BBCE7DB21AA83D96 uses weak digest algorithm (SHA1)
    E: Failed to fetch http://codezen.org/debian/dists/xenial/Release Unable to find expected entry ‘main/binary-i386/Packages’ in Release file (Wrong sources.list entry or malformed file)
    E: Some index files failed to download. They have been ignored, or old ones used instead.”

    I guess this error is due to the address given: Probably it should read “http://codezen.org/debian/xenial/” instead of “http://codezen.org/debian/dists/xenial/”?

    All best,
    Peter

    PS: Installing the packages manually works (after an “apt install -f”) fine.

  4. I was a regular user of canto version 0.6.13 and then an upgrade broke my canto.
    I had this older version launch in the OSX Terminal App and I could hit the key “g” and it would open a link in the Safari browser.

    I have just installed canto-next and canto-curses .
    However when I run canto-curses in Terminal App I see garbled text for one link and then it crashes with “Abort trap 6”

    http://imgur.com/s7DUx46

    If I run it on OSX Iterm2 app . It opens a fuller list of urls and this does not crash if I try my old shortcut “g” but looks similarly garbled.
    http://imgur.com/PeBNXpa

    It seems that one of the dependencies are malfunctioning. could you help me troubleshoot.
    Thanks

    1. I’m glad that you decided to update because 0.6 is positively ancient, but unfortunately I can’t support OSX because it’s not free software. My guess, just from looking at your mangled output, is that your ncurses library is either really old (I’m running 6.0 here) or it’s a version that doesn’t support widechars. I’d start by making sure you’re up to date there, and potentially looking at any errors or warnings when canto was built (as part of the setup.py install output).

      1. I upgraded to ncurses 6.0.2 using homebrew and ran the standard setup.py install and also tried installing to a non system directory . Maybe the correct ncursessw did not get linked because I am still seeing the same output.
        Thanks for your suggestion…Ill contrinue trying to get it to look right

  5. I’m trying to install canto on debian. I’ve added the repository to sources.list and added the key with apt-key. However when I apt-get update I get the following error:

    W: GPG error: http://codezen.org/debian sid Release: The following signatures were invalid: 6D4E5FDE18249AE7E64D5416BBCE7DB21AA83D96
    E: The repository ‘http://codezen.org/debian sid Release’ is not signed.
    E: Failed to download some files

    1. I think it was actually the digest algorithm, I set that to SHA512 and it seems to have resolved the issue, even using the same RSA2048 key. Should be fixed now.

  6. On Ubuntu 16.04 I still get:
    “http://codezen.org/debian/dists/xenial/Release.gpg: Signature by key 6D4E5FDE18249AE7E64D5416BBCE7DB21AA83D96 uses weak digest algorithm (SHA1)”

  7. Was happily using canto-curses from the Ubuntu PPA under Ubuntu 17.04 (Zesty) with the following sources.list:

    deb [arch=amd64] http://codezen.org/debian zesty main

    Then I upgraded to 17.10 (Artful) but kept the Zesty PPA line. After the upgrade, whenever I try to run canto-curses, this happens:

    Traceback (most recent call last):
    File “/usr/bin/canto-curses”, line 3, in
    from canto_curses.main import CantoCurses
    File “/usr/lib/python3/dist-packages/canto_curses/main.py”, line 18, in
    from .gui import CantoCursesGui, GraphicalLog
    File “/usr/lib/python3/dist-packages/canto_curses/gui.py”, line 12, in
    from .tag import alltags
    File “/usr/lib/python3/dist-packages/canto_curses/tag.py”, line 14, in
    from .theme import FakePad, WrapPad, theme_print, theme_reset, theme_border, prep_for_display
    File “/usr/lib/python3/dist-packages/canto_curses/theme.py”, line 10, in
    from .widecurse import waddch, wcwidth
    ModuleNotFoundError: No module named ‘canto_curses.widecurse’

    Removing and reinstalling the canto-curses package doesn’t help. Doing a quick check on the widecurse shared lib:

    $ ldd /usr/lib/python3/dist-packages/canto_curses/widecurse.cpython-35m-x86_64-linux-gnu.so
    linux-vdso.so.1 => (0x00007ffce19de000)
    libncursesw.so.5 => /lib/x86_64-linux-gnu/libncursesw.so.5 (0x00007f199a310000)
    libreadline.so.7 => /lib/x86_64-linux-gnu/libreadline.so.7 (0x00007f199a0c6000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1999ea7000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1999ac7000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f19998c3000)
    libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f199969a000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f199a742000)

    Anything else I can try? Thanks much!

    1. *sigh* my guess is that artful uses python 3.6, so the widecurse file is either just named wrong or is actually now incompatible.

      Of course now the package script I have randomly can’t generate signed packages anymore (why is this always such a pain in the ass?) so for now your best bet is to install from git.

  8. Are you considering putting Canto available through Homebrew? I’ve been trying to install it through Git and canto-curses just won’t install…

    Thanks!

    1. I don’t own any Apple products so it would be impractical to support Homebrew since I can’t test. Honestly, I have enough trouble trying to cater to Linux package managers =P

      That said, I can’t think of a reason canto-curses shouldn’t work on OSX, so my guess is that you’re missing a dependency like readline or ncursesw that would cause the C module to fail to compile. If you want to file a bug with a log of the failure I might be able to point you in the right direction, but at the end of the day I can’t support OSX directly.

      1. I had canto working on OSX with python 3.6 for the last year or so. I accidentally removed the older python installations and now cannot get it to work with python 3.8. Everything builds fine , but canto-curses displays the feed incorrectly and crashes. I know you dont support OSX, but would you be able to point me to any place which has it working. I am regretting cleaning up my system and hope to get the compile working with python3.8 and exsiting ncurses and readline libs in my system.

  9. I’m trying to install via git, however when I try to install canto-curses, I get the following:

    In file included from canto_curses/widecurse.c:10:0:/usr/include/python3.6m/py_curses.h:50:10: fatal error: ncurses.h: No such file or directory
    #include
    compliation terminated.
    error: command ‘i686-linux-gnu-gcc’ failed with exit status 1

    I’m sure I’m missing something simple…

    1. You need ncurses headers installed – look at the build dependencies above. Depending on your distro it’s probably some variation on libncursesw-dev package.

  10. Hi I am trying to install canto on OSX and am getting the error below. I know you dont support OSX but I have successfully gotten it working many times in the past if I compiled Python from source with ncurses and readline support.

    I am now seeing the error below when I use that compiled python to install canto-curses.

    Is there anything I can do to get around the error. If not I will try with a different Python version.
    Thanks

    ➜ canto-curses git:(master) ✗ /usr/local/bin/python3.9 setup.py install
    running install
    running build
    running build_py
    copying canto_curses/main.py -> build/lib.macosx-11.0-x86_64-3.9/canto_curses
    running build_ext
    building ‘canto_curses.widecurse’ extension
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/local/opt/ncurses/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/include -I/opt/local/include -I/usr/local/include/python3.9 -c canto_curses/widecurse.c -o build/temp.macosx-11.0-x86_64-3.9/canto_curses/widecurse.o
    canto_curses/widecurse.c:63:4: error: implicit declaration of function
    ‘waddwstr’ is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    waddwstr(win, dest);
    ^
    canto_curses/widecurse.c:200:11: warning: result of comparison of constant
    9223372036854775807 with expression of type ‘int’ is always false
    [-Wtautological-constant-out-of-range-compare]
    if (len > PY_SSIZE_T_MAX) {
    ~~~ ^ ~~~~~~~~~~~~~~
    1 warning and 1 error generated.
    error: command ‘/usr/bin/gcc’ failed with exit code 1

Leave a Reply

Your email address will not be published. Required fields are marked *