Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Grinkers
Copy link
Contributor

@Grinkers Grinkers commented Jul 4, 2025

A potential fix for https://forums.ankiweb.net/t/bug-anki-25-07-fails-to-launch/63475/7.

I'm not exactly sure how this wasn't an issue before. It may be a system specific thing (I'm on Fedora 42 and had uv installed). I would be curious to know if .local/share/AnkiProgramFiles/python got properly populated for others before this.

However I was able to reproduce the issue even with trying to clean everything (uv cache clean and removing my uv binaries). It happened on both uv 0.7.13 (bundled in the launcher release) and uv 0.7.19 (e8bc3950e 2025-07-03) (git).

"Minimal" repro
Try running ./anki and have

Updating Anki...

error: No interpreter found for Python 3.13.5 in managed installations
Install failed: Failed with code Some(2): /home/grinkers/tools/anki-launcher/uv.amd64 sync --upgrade --managed-python --python 3.13.5

then

cd "/home/grinkers/.local/share/AnkiProgramFiles" && UV_PYTHON_INSTALL_DIR="/home/grinkers/.local/share/AnkiProgramFiles/python" "/home/grinkers/opt/anki-launcher/uv.amd64" "sync" "--upgrade" "--managed-python" "--python" "3.13.5"
error: No interpreter found for Python 3.13.5 in managed installations

@dae
Copy link
Member

dae commented Jul 4, 2025

Thanks for looking into this! Let's see how these changes fare for the other affected users.

@dae dae merged commit fc6447a into ankitects:main Jul 4, 2025
1 check passed
@dae
Copy link
Member

dae commented Jul 4, 2025

Just for future reference, this PR accidentally committed changes to the FTL subrepos, and I missed that during review, so I'll revert that part of the change in a follow-up.

@dae
Copy link
Member

dae commented Jul 4, 2025

I was going to rush this out, but I've noticed you haven't included --managed-python in the python install line. Can you show what appears on a fresh installation when that command is run, and what happens if --managed-python is included as well? I noticed both you and the other reporter seem to have the pinned python version already installed, and I'm wondering if it's trying to use that version instead.

@Grinkers
Copy link
Contributor Author

Grinkers commented Jul 4, 2025

I was going to rush this out, but I've noticed you haven't included --managed-python in the python install line. Can you show what appears on a fresh installation when that command is run, and what happens if --managed-python is included as well? I noticed both you and the other reporter seem to have the pinned python version already installed, and I'm wondering if it's trying to use that version instead.

I'm not 100% sure what you mean, but I hope this log will be useful. There doesn't seem to be a difference with this flag. I wonder if there's some magic caching/linking going on for systems that aren't having issues.

env:

grinkers@werk ~/.local/share/AnkiProgramFiles> ls -lah
total 16K
drwxr-xr-x. 1 grinkers grinkers  58 Jul  5 02:34 ./
drwxr-xr-x. 1 grinkers grinkers 346 Jul  5 02:25 ../
-rw-r--r--. 1 grinkers grinkers 158 Jul  5 02:26 pyproject.toml
-rw-r--r--. 1 grinkers grinkers   7 Jul  5 02:26 .python-version

grinkers@werk ~/.local/share/AnkiProgramFiles> cat pyproject.toml
[project]
name = "anki-launcher"
version = "1.0.0"
description = "UV-based launcher for Anki."
requires-python = ">=3.9"
dependencies = [
  "anki-release",
]

grinkers@werk ~/.local/share/AnkiProgramFiles> cat .python-version
3.13.5

grinkers@werk ~/.local/share/AnkiProgramFiles> /home/grinkers/opt/anki-launcher/uv.amd64 --version
uv 0.7.13

without --managed-python for python install, but with for uv sync.

grinkers@werk ~/.local/share/AnkiProgramFiles [2]> ls -lah
total 16K
drwxr-xr-x. 1 grinkers grinkers  58 Jul  5 02:38 ./
drwxr-xr-x. 1 grinkers grinkers 346 Jul  5 02:25 ../
-rw-r--r--. 1 grinkers grinkers 158 Jul  5 02:26 pyproject.toml
-rw-r--r--. 1 grinkers grinkers   7 Jul  5 02:26 .python-version
grinkers@werk ~/.local/share/AnkiProgramFiles> UV_PYTHON_INSTALL_DIR="/home/grinkers/.local/share/AnkiProgramFiles/python" "/home/grinkers/opt/anki-launcher/uv.amd64" "python" "install"
Installed Python 3.13.5 in 1.80s
 + cpython-3.13.5-linux-x86_64-gnu
grinkers@werk ~/.local/share/AnkiProgramFiles> ls -lah
total 16K
drwxr-xr-x. 1 grinkers grinkers  70 Jul  5 02:38 ./
drwxr-xr-x. 1 grinkers grinkers 346 Jul  5 02:25 ../
-rw-r--r--. 1 grinkers grinkers 158 Jul  5 02:26 pyproject.toml
drwxr-xr-x. 1 grinkers grinkers 102 Jul  5 02:38 python/
-rw-r--r--. 1 grinkers grinkers   7 Jul  5 02:26 .python-version
grinkers@werk ~/.local/share/AnkiProgramFiles> UV_PYTHON_INSTALL_DIR="/home/grinkers/.local/share/AnkiProgramFiles/python" "/home/grinkers/opt/anki-launcher/uv.amd64" "sync" "--upgrade" "--managed-python" "--python" "3.13.5"
Using CPython 3.13.5
Creating virtual environment at: .venv
Resolved 49 packages in 44ms
Prepared 39 packages in 0.67ms
Installed 39 packages in 57ms
 + anki==25.7
 + anki-release==25.7
 ... omitted ... 

with --managed-python

grinkers@werk ~/.local/share/AnkiProgramFiles> ls -lah
total 16K
drwxr-xr-x. 1 grinkers grinkers  58 Jul  5 02:40 ./
drwxr-xr-x. 1 grinkers grinkers 346 Jul  5 02:25 ../
-rw-r--r--. 1 grinkers grinkers 158 Jul  5 02:26 pyproject.toml
-rw-r--r--. 1 grinkers grinkers   7 Jul  5 02:26 .python-version
grinkers@werk ~/.local/share/AnkiProgramFiles> UV_PYTHON_INSTALL_DIR="/home/grinkers/.local/share/AnkiProgramFiles/python" "/home/grinkers/opt/anki-launcher/uv.amd64" "sync" "--upgrade" "--managed-python" "--python" "3.13.5"
error: No interpreter found for Python 3.13.5 in managed installations
grinkers@werk ~/.local/share/AnkiProgramFiles [2]> UV_PYTHON_INSTALL_DIR="/home/grinkers/.local/share/AnkiProgramFiles/python" "/home/grinkers/opt/anki-launcher/uv.amd64" "python" "install" "--managed-python"
Installed Python 3.13.5 in 1.67s
 + cpython-3.13.5-linux-x86_64-gnu
grinkers@werk ~/.local/share/AnkiProgramFiles> ls -lah
total 16K
drwxr-xr-x. 1 grinkers grinkers  70 Jul  5 02:41 ./
drwxr-xr-x. 1 grinkers grinkers 346 Jul  5 02:25 ../
-rw-r--r--. 1 grinkers grinkers 158 Jul  5 02:26 pyproject.toml
drwxr-xr-x. 1 grinkers grinkers 102 Jul  5 02:41 python/
-rw-r--r--. 1 grinkers grinkers   7 Jul  5 02:26 .python-version
grinkers@werk ~/.local/share/AnkiProgramFiles> UV_PYTHON_INSTALL_DIR="/home/grinkers/.local/share/AnkiProgramFiles/python" "/home/grinkers/opt/anki-launcher/uv.amd64" "sync" "--upgrade" "--managed-python" "--python" "3.13.5"
Using CPython 3.13.5
Creating virtual environment at: .venv
Resolved 49 packages in 47ms
Prepared 39 packages in 0.83ms
Installed 39 packages in 54ms
 + anki==25.7
 + anki-release==25.7
 ... omitted ... 

@Grinkers
Copy link
Contributor Author

Grinkers commented Jul 4, 2025

For completion

grinkers@werk ~/.local/share> rm -rf AnkiProgramFiles/

release extract, but I replaced launcher.amd64, clean rebuild from main 08a8b6691

opt/anki-launcher> ./anki
Anki Launcher

1) Latest Anki (just press enter)
2) Choose a version

5) Allow betas: off
6) Cache downloads: on

7) Uninstall
8) Quit
>

Updating Anki...

Installed Python 3.13.5 in 1.52s
 + cpython-3.13.5-linux-x86_64-gnu
Using CPython 3.13.5
Creating virtual environment at: .venv
Resolved 49 packages in 927ms
Prepared 39 packages in 3.91s
Installed 39 packages in 60ms
 + anki==25.7
 + anki-release==25.7
 + aqt==25.7
  ... omitted ... 
grinkers@werk ~/.local/share> ls -lah AnkiProgramFiles/
total 196K
drwxr-xr-x. 1 grinkers grinkers  132 Jul  5 02:53 ./
drwxr-xr-x. 1 grinkers grinkers  346 Jul  5 02:53 ../
drwxr-xr-x. 1 grinkers grinkers  148 Jul  5 02:53 cache/
-rw-r--r--. 1 grinkers grinkers  158 Jul  5 02:53 pyproject.toml
drwxr-xr-x. 1 grinkers grinkers  102 Jul  5 02:53 python/
-rw-r--r--. 1 grinkers grinkers    7 Jul  5 02:53 .python-version
-rw-r--r--. 1 grinkers grinkers   10 Jul  5 02:53 .sync_complete
-rw-r--r--. 1 grinkers grinkers 177K Jul  5 02:53 uv.lock
drwxr-xr-x. 1 grinkers grinkers   96 Jul  5 02:53 .venv/
grinkers@werk ~/.local/share> ls -lah AnkiProgramFiles/python/
total 4.0K
drwxr-xr-x. 1 grinkers grinkers 102 Jul  5 02:53 ./
drwxr-xr-x. 1 grinkers grinkers 132 Jul  5 02:53 ../
drwxr-xr-x. 1 grinkers grinkers  36 Jul  5 02:53 cpython-3.13.5-linux-x86_64-gnu/
-rw-r--r--. 1 grinkers grinkers   1 Jul  5 02:53 .gitignore
-rwxrwxrwx. 1 grinkers grinkers   0 Jul  5 02:53 .lock*
drwxr-xr-x. 1 grinkers grinkers   0 Jul  5 02:53 .temp/

@dae
Copy link
Member

dae commented Jul 4, 2025

Much appreciated 🙏 While --managed-python doesn't appear to be required here, since it seems to work in either case, I'll add it just to be explicit.

@Grinkers
Copy link
Contributor Author

Grinkers commented Jul 4, 2025

np. Thanks for the great project. I've been using Anki for over 15 years, and it's nice to help out, even if just a little bit, beyond purchasing AnkiMobile

dae added a commit that referenced this pull request Jul 4, 2025
(cherry picked from commit 09495d3,
as #4162 accidentally reverted them)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants