I installed typst on ubuntu (22) by downloading the typst binary and copying it to /usr/bin. So far so good :). I then wanted to use the basic-report template, but customize it beforehand. So I placed it in:
Note, that I had to create the typst directory and its subdirectories here myself, they were not created by typst.
I import the template into my main.typ file by:
#import "@local/basic-report:0.3.1": *
However, compiling the file yields:
#import error: package not found (searched for @local/basic-report:0.3.1)
It does work if I place the template folder in:
~/.cache/typst/packages/local/basic-report/0.3.1
I know that the snap install of typst has similar problems right now, and at first I had it installed via snap but removed it and downloaded the binary from the github releases page. I also tried to reboot several times.
Did someone encounter the same problem and has some pointers for me ?
Hi! It works perfectly on my Ubuntu.
I installed typst via GitHub from the begininng and didn’t use snap. However, I don’t think it will make any difference.
Could you share more information? Does which -a typst verify your installation? Have you set $XDG_DATA_HOME? What will happen if you specify the dir explicity (typst compile --package-path … …)?
Typst will create the file ~/.local/share/typst/greeted when you run typst without any argument for the first time. This feature might help you figure out what’s happening.
Hi!
Thank you for the quick response.
I set XDG_DATA_HOME to ~/.local/share and now it works.
Explicitly setting the package path worked as well, good to know that option. Thank you so much!
Typst v0.13.1 yields the same package not found error for several cases. Therefore, it’s hard to debug without editing the source code and recompiling typst.
EDIT: I believe it’s a typst bug, although I can’t prove it. Besides, I find that ~/.local/share/typst/greeted won’t be created if ~/.local/share/typst does not exist.
I just tried with a clean Ubuntu (container docker.io/library/ubuntu:22.04) and it works without having to set XDG_DATA_HOME so I wonder what the problem was. @Tim_Maier , @Raul_Durand could you try to remove your configuration that sets XDG_DATA_HOME, reboot and run “echo $XDG_DATA_HOME” to check if it was set to something else?
How can you be sure that a container version is the same as the full-fledged distro? Almost no container version is the same as the real deal, as everyone tries to save up on container image size. If you used snap version, it would be weird that it did work. Maybe snap also have different behavior in containers…
If it helps anything: I just had the XDG_DATA_HOME="$HOME/.local/share" line in bashrc commented out by accident and suddenly that variable held the path /home/USERNAME/snap/code/211/.local/share .