You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Package installations interfer when multiple Typst instances are running #2739
One may resonably believe that compiling Typst is a "clean" operation, so it should be okay to run several compiling jobs at the same time. In fact, that works perfectly until packages are involved.
When compiling several documents that use a package that isn't installed yet, both Typst processes start downloading this package, but some of processes fail with messages like this one:
downloading @preview/cetz:0.1.2
45.9 KiB / 45.9 KiB (100 %) 45.9 KiB/s in 0s ETA: 0s
error: file not found (searched at C:\Users\andr\AppData\Local\typst/packages/preview/cetz/0.1.2\typst.toml)
┌─ \\?\C:\Users\andr\Desktop\projects\typstlike\typst-examples-book\src\packages\typst-src\05a1dbe2a2d17e5e81991406bed640775db6ab4ce2d585bc5a0d1175def43ea1.typ:4:8
│
4 │ #import "@preview/cetz:0.1.2": canvas, draw
│ ^^^^^^^^^^^^^^^^^^^^^
Note: in the end, package is installed correctly, so recompilation fixes it all.
This isn't a really important thing, of course. There are several ways to avoid this error, but I think it would be nice if Typst could "lock" package directories to make such errors impossible.
P.S. The error is currently observed both on Windows and Linux.
Reproduction URL
No response
Operating system
No response
Typst version
I am using the latest version of Typst
Reacted by Myriad-Dreamin, +merlan #flirora and Andrew Voynov
As I noted in the other issue, this race may lead to consistently broken builds, where Typst seems to assume the package is installed correctly while it is in some corrupted state. Even repeated compilations (of individual documents, so no further race condition) do not solve the issue.
I still have to experiment, but I think with sufficiently bad luck, you may actually convince Typst that the package exists in the local cache and isn't a package at all. I will update this when I manage that.
EDIT: The best I've managed so far has been this error, which happens consistently until the broken package is removed from the cache.
error: file not found (searched at C:\Users\Markus Haug\AppData\Local\typst/packages\preview/valkyrie/0.2.2\src\lib.typ)
┌─ \\?\C:\Users\Markus Haug\tests\typst\parallel-package-downloads\document.typ:1:8
│
1 │ #import "@preview/valkyrie:0.2.2" as z
│ ^^^^^^^^^^^^^^^^^^^^^^^^^
While it may seem similar at first blush, the error for a non-existent package (version) differs.
Activity
Enter-tainer commentedon Nov 23, 2023
https://github.com/rust-lang/cargo/blob/463f30742514ad54dfe24b2c3e151bf5b1c2f7c9/src/cargo/util/flock.rs
Andrew15-5 commentedon Jul 31, 2024
I'm on it.
m-haug commentedon Feb 17, 2025
Sorry for the initial double post.
As I noted in the other issue, this race may lead to consistently broken builds, where Typst seems to assume the package is installed correctly while it is in some corrupted state. Even repeated compilations (of individual documents, so no further race condition) do not solve the issue.
I still have to experiment, but I think with sufficiently bad luck, you may actually convince Typst that the package exists in the local cache and isn't a package at all. I will update this when I manage that.
EDIT: The best I've managed so far has been this error, which happens consistently until the broken package is removed from the cache.
While it may seem similar at first blush, the error for a non-existent package (version) differs.
laurmaedje commentedon Feb 23, 2025
I opened #5935, which is a similar problem. Maybe #5935 (comment) could be a fix for both?
Andrew15-5 commentedon Feb 23, 2025
We still have to do some locking for this issue, regardless of the target/temporary location.Actually, see #5935 (comment).