LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   anki on Slackware 13.37 (https://www.linuxquestions.org/questions/slackware-14/anki-on-slackware-13-37-a-906567/)

titopoquito 10-05-2011 09:00 AM

anki on Slackware 13.37
 
Hi all,

has anyone succeeded in running Anki (http://ankisrs.net/ , a flash-card program to learn facts) on Slackware 13.37? If so, could you please post the versions of python, sqlite, sqlalchemy and python-simplejson that you have installed?
I get an error each time I try to create a new card deck, exactly as described in http://code.google.com/p/anki/issues...tars%20Summary . Any hint on which versions of the afore mentioned apps work together so that you can create a new card deck is highly appreciated.

tito

chrissi29 10-06-2011 02:17 AM

Hello Tito,
not an answer to your question. But did you think about using Parley, which is very easy to install?

titopoquito 10-06-2011 03:23 AM

Quote:

Originally Posted by chrissi29 (Post 4491349)
Hello Tito,
not an answer to your question. But did you think about using Parley, which is very easy to install?

Hi Chrissi29,

yes, I have thought about Parley or other simpler flash card programs. Anki has advantages that come very very handy to me and that are not at all met by other apps like Parley. They are for my purpose way to simple and require twice or three times the time to get the same cards done*. But thanks for your suggestion.

Tito

* Anki uses "facts" to generate cards. You can assign several card layouts to one fact and Anki creates all the cards automatically once you have input the fact. For example imagine a simple irregular verb. You have the base form, past and perfect in language 1 and the translation of the verb in language 2. With Anki you can now create CardLayouts, for example "What means {verb-base} in {verb-translation}" or "What is the perfect form of {verb-base}" or "What is the past form that belongs to {verb-perfect}". That way you can create many cards in one step. Once you think to add a CardLayout or want to change one of the facts, you can automatically recreate all required cards without tinkering with every single one.

chrissi29 10-07-2011 02:52 AM

Hi Tito,
sounds really interesting, though I also could not get it to work on current.
I tried Salix64-Packages and the Debian packages from the official site...

titopoquito 10-07-2011 03:13 AM

I have it running on ArchLinux in VirtualBox without problems, but would prefer to run it directly on Slackware though. On my Laptop the virtual machine is a heavy burden, it slows down every other task.

pino_otto 10-07-2011 07:53 AM

I run anki on my Slackware 13.1

I just downloaded from the website, uncompressed and run.

titopoquito 10-07-2011 11:55 AM

Quote:

Originally Posted by pino_otto (Post 4492384)
I run anki on my Slackware 13.1

I just downloaded from the website, uncompressed and run.

Hi pino_otto,

thanks for your feedback. Could you tell me which versions you are running? python, anki, simplejson, SQLAlchemy and eventually sqlite are the ones that I need I think. That would be highly appreciated :)

tito

T3slider 10-11-2011 03:59 PM

The problem is that Slackware's sqlite was compiled with the SQLITE_ENABLE_STAT2 option, which adds further index data to the database in the form of an additional table (sqlite_stat2, which cannot be deleted) to increase query speeds. The development version of Anki has proper support for sqlite with that option, but the stable version does not. Unfortunately the dev version is not full-featured and is a *major* change from 1.x. You could compile the development version and use that, or you can try a workaround to get 1.x to work.

I myself compiled sqlite without the SQLITE_ENABLE_STAT2 option (in its own little directory, not system-wide) and exported LD_LIBRARY_PATH to point to the new sqlite installation before running anki. You might be able to get away with recompiling sqlite and installing it system-wide, but I have no idea whether or not it would break existing sqlite databases (which would contain the extra table) and the software that uses it (like KDE, for example).

Here's the diff for the SlackBuild I used (compared to the official Slackware 13.37 SlackBuild). You will have to adjust the directories used (TMP and PKG). Note that I built this using my regular user in my home directory -- it is *not* installed system wide. You can of course do as you please.

Code:

--- sqlite.SlackBuild.orig        2011-08-23 23:46:32.623392019 -0400
+++ sqlite.SlackBuild        2011-08-24 00:12:45.184517884 -0400
@@ -41,8 +41,9 @@
 fi
 
 CWD=$(pwd)
-TMP=${TMP:-/tmp}
-PKG=$TMP/package-$PKGNAM
+TMP=${TMP:-$CWD/tmp}
+PKG=$(readlink -f $CWD/../../pkg)
+echo $PKG
 
 if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
@@ -59,7 +60,7 @@
 fi
 
 # Enable some features:
-SLKCFLAGS="$SLKCFLAGS -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_DISABLE_DIRSYNC=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_STAT2=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_SECURE_DELETE=1"
+SLKCFLAGS="$SLKCFLAGS -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_DISABLE_DIRSYNC=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_SECURE_DELETE=1"
 
 rm -rf $PKG
 mkdir -p $TMP $PKG
@@ -67,7 +68,7 @@
 rm -rf $PKGNAM-$VERSION
 tar xvf $CWD/$PKGNAM-src-$VERSION.tar.?z* || exit 1
 cd $PKGNAM-src-$VERSION || exit 1
-chown -R root.root .
+#chown -R root.root .
 find . \
  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  -exec chmod 755 {} \; -o \
@@ -78,11 +79,12 @@
 CFLAGS="$SLKCFLAGS" \
 CXXFLAGS="$SLKCFLAGS" \
 ./configure \
-  --prefix=/usr \
-  --libdir=/usr/lib${LIBDIRSUFFIX} \
-  --sysconfdir=/etc \
-  --localstatedir=/var \
-  --mandir=/usr/man \
+  --prefix=$PKG/usr \
+  --libdir=$PKG/usr/lib${LIBDIRSUFFIX} \
+  --sysconfdir=$PKG/etc \
+  --localstatedir=$PKG/var \
+  --mandir=$PKG/usr/man \
+  --disable-tcl \
  --enable-threadsafe \
  --enable-cross-thread-connections \
  --enable-tempstore=yes \
@@ -99,7 +101,8 @@
 fi
 
 make $NUMJOBS || make || exit 1
-make install DESTDIR=$PKG || exit 1
+#make install DESTDIR=$PKG || exit 1
+make install || exit 1
 
 find $PKG | xargs file | grep -e "executable" -e "shared object" \
  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
@@ -125,5 +128,5 @@
 cat $CWD/slack-desc > $PKG/install/slack-desc
 
 cd $PKG
-/sbin/makepkg -l y -c n $TMP/$PKGNAM-$OLD_STYLE-$ARCH-$BUILD.txz
+#/sbin/makepkg -l y -c n $TMP/$PKGNAM-$OLD_STYLE-$ARCH-$BUILD.txz

I wrote a quick wrapper script to launch anki for me so I don't have to manually export LD_LIBRARY_PATH every time. I'll include that in case you want it:
Code:

#!/bin/sh

PRGNAM=anki
VERSION=1.2.9

ANKIDIR="$(dirname "$(readlink -f $0)")"
PREFIX="$ANKIDIR/deps/pkg/usr"
#PYTHON="$PREFIX/bin/python"
PYTHON="/usr/bin/python"
LD_LIBRARY_PATH="$PREFIX/lib64"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH"

cd "$ANKIDIR/$PRGNAM-$VERSION"
$PYTHON anki

You'll have to adjust the paths again here (ANKIDIR just gets the directory that this wrapper script lives in, but you may not want that. PREFIX is where the new sqlite lives. This script assumes anki is just an untarred anki package living in the same directory as the wrapper script (so anki-$VERSION)).

You'll probably have to fiddle a bit to get it to work but it does work fine with this ugly workaround.

titopoquito 10-12-2011 01:34 PM

Hi T3slider,

a big thank you for your great post. I am hoping to try it later this evening or tomorrow, but from what you wrote this looks more than promising. I had already tried different versions of all included apps but python, but I hadn't looked at the build options at all, nearsighted as I am. I appreciate your post very much and will report back if or better when I succeeded :D

titopoquito 10-13-2011 04:55 AM

Wonderful, it works. First I compiled sqlite the wrong way - instead of removing the part I set the option to "0" instead of "1" which didn't work. Now I have installed it system-wide. Since I am using Xfce4 and have not found any sqlite databases besides seamonkey and firefox configure files on my system, there should be no problems I guess. Your tip with the local per-user installation looks good, too, should I run in any problems. Thanks again for this solution T3slider, now I can concentrate on putting the data in and learning with Anki :)


All times are GMT -5. The time now is 10:21 PM.