Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't load showtext #30

Closed
gpsccs opened this issue Jan 15, 2020 · 9 comments
Closed

Can't load showtext #30

gpsccs opened this issue Jan 15, 2020 · 9 comments

Comments

@gpsccs
Copy link

@gpsccs gpsccs commented Jan 15, 2020

Hello, when I try to use showtext, it occour the following error:

Error: package or namespace load failed for ‘showtext’:
loadNamespace()里算'showtext'时.onLoad失败了,详细内容:
调用(call): utils::unzip(font_file, exdir = out_dir, overwrite = FALSE)
错误(error): 'exdir' does not exist

How can I fix it?

@yixuan
Copy link
Owner

@yixuan yixuan commented Jan 26, 2020

Have you tried to reinstall the package?

@jinyancool
Copy link

@jinyancool jinyancool commented Feb 2, 2020

I have same errors.

*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘showtext’:
.onLoad failed in loadNamespace() for 'showtext', details:
call: file.exists(path)
error: invalid 'file' argument
Error: loading failed
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
Error: package or namespace load failed for ‘showtext’:
.onLoad failed in loadNamespace() for 'showtext', details:
call: file.exists(path)
error: invalid 'file' argument
Error: loading failed
Error: .onLoad failed in loadNamespace() for 'showtext', details:
call: file.exists(path)
error: invalid 'file' argument
** testing if installed package keeps a record of temporary installation path

  • DONE (showtext)
@yixuan
Copy link
Owner

@yixuan yixuan commented Apr 17, 2020

These issues seem to be related to the write access of temporary directories. Make sure that the folder pointed by tempdir() is writable.

@yihui
Copy link

@yihui yihui commented May 30, 2020

I think @jinyancool's issue is different from @gpsccs's issue. For @jinyancool's issue (reproduced by @XiangyunHuang: https://d.cosx.org/d/419265/3), my guess is that this is not a good idea: https://github.com/yixuan/sysfonts/blob/eae090/R/font.R#L367 The reason is that R will try to load a package from a temporary location when the package is installed. I wonder why you need lib.loc at all: https://github.com/yixuan/sysfonts/blob/eae090/R/font.R#L373 It doesn't seem to be necessary to me.

For @gpsccs's issue, you probably need to dir.create() the dir first, although it should be rare that the temp dir doesn't exist. If the creation of the dir fails, give users a more informative error message. https://github.com/yixuan/showtextdb/blob/fe105fc/R/load_showtext_fonts.R#L36

@yixuan
Copy link
Owner

@yixuan yixuan commented May 30, 2020

Thanks for the debugging! I'll create patches later.

@yixuan
Copy link
Owner

@yixuan yixuan commented May 31, 2020

The problem that @jinyancool encountered was likely due to these lines.

Inside the showtextdb/fonts folder there may exist some font folders such as source-han-serif-cn, but somehow the folder does not contain any fonts, and a NULL value will be passed to sysfonts::font_add(), causing the error above. I'll add more informative messages to the sysfonts and showtextdb packages.

@XiangyunHuang
Copy link

@XiangyunHuang XiangyunHuang commented May 31, 2020

@yixuan Yeah, source-han-serif-cn/ is exist but no fonts, because I failed to install the font before.

@yixuan
Copy link
Owner

@yixuan yixuan commented May 31, 2020

These issues should have been fixed by the latest version of the showtextdb package, which I will submit to CRAN later.

@yixuan
Copy link
Owner

@yixuan yixuan commented Jun 4, 2020

The new version of showtextdb is on CRAN now.

@yixuan yixuan closed this Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.