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

the command "download_google_material()" does not work #70

Open
with-fan opened this issue Apr 2, 2022 · 7 comments
Open

the command "download_google_material()" does not work #70

with-fan opened this issue Apr 2, 2022 · 7 comments

Comments

@with-fan
Copy link

with-fan commented Apr 2, 2022

the command "download_google_material()" does not work
error is

"Error in utils::unzip(dl_file, exdir = dl_dir) :
cannot open file 'C:/Users/yangd/AppData/Local/Temp/RtmpG8ix86/icon_dlaa107b92186/material-design-icons-master/android/device/signal_cellular_connected_no_internet_0_bar/materialiconsoutlined/black/res/drawable-hdpi/outline_signal_cellular_connected_no_internet_0_bar_black_18.png': No such file or directory"_

I find this file updated before 5 days, it's likely some files do not exist. Could you please give me a solution? Thank you very much.

@garthtarr
Copy link
Contributor

I don't think this is an issue with the icons package. The error is in the unzipping, utils::unzip(). The zip file that download_google_material() attempts to download is a bit over 2GB, so this is a pretty big thing to unzip, perhaps it was corrupted during the download somehow?

Just for others who may stumble on this in the future, I had a different error when I tried to run download_google_material() to reproduce this:

> download_google_material()
trying URL 'https://github.com/google/material-design-icons/archive/master.zip'
downloaded 205.4 MB

Error in download.file(url, dl_file) : 
  download from 'https://github.com/google/material-design-icons/archive/master.zip' failed
In addition: Warning message:
In download.file(url, dl_file) :
  URL 'https://codeload.github.com/google/material-design-icons/zip/refs/heads/master': Timeout of 60 seconds was reached

The solution was to give R a bit more time to complete the download. The default is 60 seconds but likely need longer, for example, allow for 10 minutes using options(timeout = max(600, getOption("timeout"))). After that the download worked fine and there was no issue unzipping it except that it took a long time due to the size.

If you do this, afterwards it's probably a good idea to change the timeout back to the default:

options(timeout = max(60, getOption("timeout")))

@mitchelloharawild
Copy link
Owner

Thanks for responding to this @garthtarr - I thought I had earlier but evidently not.
Unfortunately there isn't a particularly neat way of pulling out only the SVGs from Google's material design repo (or at least one that I know of), and so the download size is very large as there are many different rastered sizes for the icons.
Their repo structure isn't particularly friendly for extracting only SVG, so downloading the full repo is simplest, but uses a lot of bandwidth and is slow. If google/material-design-icons provided a SVG export, I'd be happy to switch the icon's download source to it.

@garthtarr
Copy link
Contributor

@mitchelloharawild the "latest" 4.0.0 release source file is a lot smaller (~300MB) and still appears to have the SVG files:

https://github.com/google/material-design-icons/archive/refs/tags/4.0.0.zip

Not sure if pointing to that is a sustainable long term solution though for two reasons: (1) not clear that future releases will be similarly smaller than the current master and (2) I can't work out how to automatically link to the "latest source" - there is some ability to use latest in a GitHub URL but in my few minutes playing I couldn't work out how to get it to redirect to the latest source zip file (the idea being it should be dynamic for future releases).

@mitchelloharawild
Copy link
Owner

My concern with using releases is that I expect an upcoming release would be 2.2GB. When I wrote the download_google_material() function, the download size was ~300MB. They must have added many more rendered outputs which are bloating the repo.

One option would be to download & use their SVG font files only. I wanted to avoid this because font files aren't as easy to import and work with, but 2.2GB is insane.

@mitchelloharawild
Copy link
Owner

Just checked, the src folder containing SVGs is ~60MB, which can probably be reduced to ~40MB. This is similar to what it was when I wrote the function (large, but workable).
I don't think it's possible to download a zip of a single folder from a repo though.

@garthtarr
Copy link
Contributor

Yeah... from what I can see there's not an official way to do that. Some ad hoc solutions here https://stackoverflow.com/questions/7106012/download-a-single-folder-or-directory-from-a-github-repo/70729494#70729494 but nothing I can see that you'd really want to rely on.

@mitchelloharawild
Copy link
Owner

git sparse checkout, or svn sounds promising - but I agree, there doesn't seem to be anything suitable for this package.

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

No branches or pull requests

3 participants