Can I run 2.1.29 from source / using qt/runanki?

Up until now I used to run Anki from source via
ANKI_NOHIGHDPI=1 /path/to/anki/runanki
(no prior installation, make, or anything)

Today I upgraded to 2.1.29 and noticed that runanki moved from the directory root to /qt and, when trying to execute it, I get a ModuleNotFoundError: No module named 'anki'.

As I’d prefer to manage dependencies on my system myself and run Anki from source instead of the >400MB package I’d like to ask: is there still the possibility to just run from the source?

Thanks. :‌)

See README.development.

1 Like

Thanks for the pointer.

So given the wording used to be

And now you're ready to run Anki:                                                                                       
$ ./runanki

with runanki being a Python script. But now is

Once you've installed the above components, execute ./run in this repo,                                                 
which will build the subcomponents, and start Anki. Any arguments included                                              
on the command line will be passed on to Anki. The first run will take                                                  
quite a while to download and build everything - please be patient.

with run being a bash script that runs make, the answer would be no?

I looked into the makefile and found $ ANKIDEV=1 ANKI_API_PORT=9001 python qt/runanki. Also, I found the anki folder in pylib/. Running runanki from the directory root though (as python qt/runanki from the makefile would suggest) doesn’t result in python finding anki as a module (as it’s within pylib/). Is the makefile moving around folders? Or do some flags/env variables need to be set in order for the makefile line to work?

I don’t know much about the details but I think Anki sets a virtual environment to manage modules and I don’t think it moves folders around.

running run should be enough for running from source.

Thanks for the reply.

My problem with that way of running is, that it (according to README.development at least) requires rustup, which, as far as I can tell, is not available through any repository but just through curl --proto '=https' --tlsv1.2 -sSf | sh, which I’d rather not run if avoidable.

I’ll see if I can figure out a way myself. (‌:

just in case someone else also tries to do this
PYTHONPATH=./pylib python3.7 qt/runanki
is a start, but because pylib/Makefile seems to create two files (pylib/anki/ and pylib/anki/ this has do be done manually first I guess

You dont really need nightly rust, you can use stable one (tested with 2.1.28):

  1. comment out 3 lines with rustup string in rslib/Makefile and rspy/Makefile
  2. change pyo3 version from 0.8.0 to 0.11.0 in rspy/Cargo.toml
  3. run make :slight_smile:

Definitely, but the anki folder takes up about 5.87 GB :smile: of storage space on my system (Windows 10).

It seems to be possible to run Anki without rust by copying ankirspy.cp38-*.pyd from the Anki build to pyenv\Lib\site-packages\ankirspy.cp38-*.pyd and replacing DEVEL := rslib rspy pylib ts qt with DEVEL := pylib ts qt in Makefile. With this step the anki folder got reduced to 763 MB.

A quick proof-of-concept.

git clone
cd anki

$version = git describe --abbrev=0
git checkout $version

make pyenv

$ankirspy = "ankirspy.cp38-win_amd64.pyd"
curl -LJO$version/anki-$version-windows.exe
& "C:\Program Files (x86)\7-Zip\7z" e anki-$version-windows.exe -y -opyenv\Lib\site-packages $ankirspy > $null

sed -i "s/DEVEL := rslib rspy pylib ts qt/DEVEL := pylib ts qt/" Makefile

make run