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

No internet connection with R Studio to download wdpa data? #10

Closed
ankemueller opened this issue Feb 21, 2019 · 18 comments
Closed

No internet connection with R Studio to download wdpa data? #10

ankemueller opened this issue Feb 21, 2019 · 18 comments
Labels

Comments

@ankemueller
Copy link

Dear Jeff,
I was excited to try out your wdpar package and downloaded it yesterday. When I tried to let your example run I received the following error:

mlt_raw_pa_data <- wdpa_fetch("MLT", wait = TRUE)

Error in wdpa_fetch("MLT", wait = TRUE) :
data not found in download_dir, and no internet connectionto download it.

As far as I understood your description, WDPA data should be downloaded by your package automatically, so no need for me to manually put something in the download-dir, right? I do not understand why I get the "no internet connection" error as I am connected to the internet and downloading packages from CRAN works just fine. I use R Studio Version 1.1.463 and R Version 3.5.2.
Maybe you have an idea why it is not working for me?

Anyway, thanks for providing this cool package!
Cheers,
Anke

@jeffreyhanson
Copy link
Collaborator

Hi,

Yeah, you should be able to download the data automatically with wdpa_fetch. This package uses the pingr::is_online function to detect if you have an internet connection. Could you please try running pingr::is_online() to see if its working correctly?

Cheers,

Jeff

@jeffreyhanson
Copy link
Collaborator

I'm closing this due to inactivity, but please feel free to open this if you want to help solve the issue.

@neriiacopo
Copy link

neriiacopo commented Jun 27, 2019

Hi Jeff,
I am experiencing the same issue as Anke.
While running wdpa_fetch() on a window machine I get the same error.
As you suggested, I tried pingr::is_online() where I look incorrectly without an internet connection.
The https://cran.r-project.org is inaccessible at the moment (I guess they are having server issues).
I am wondering if this is the reason behind the error and if there is a way to overcome it...

update: I am now able to access https://cran.r-project.org from my browser but still pingr::is_online return a FALSE statement.
I have been trying curl::has_internet() , nslookup() , and the method showed in https://stackoverflow.com/questions/7012796/ping-a-website-in-r and they all return positive statement.
Maybe you have an idea what I am missing?

Looking forward to use Wdpar
thank you so much for you help

Iacopo

@jeffreyhanson jeffreyhanson reopened this Jun 28, 2019
@jeffreyhanson
Copy link
Collaborator

jeffreyhanson commented Jun 28, 2019

Hi, I don't think this is related to the CRAN issues. I have an idea for fixing this though, so I'll push a new version to GitHub later today and we can see if this fixes the problem.

@jeffreyhanson
Copy link
Collaborator

Actually, if curl::has_internet works - we can just use that instead of pingr::is_online. Thank you for trying out other options!

jeffreyhanson added a commit that referenced this issue Jun 28, 2019
@jeffreyhanson
Copy link
Collaborator

@neriiacopo, could you please try installing the developmental version of wdpar on GitHub (e.g. using the R code devtools::install_github("prioritizr/wdpar")) and try running the example code for wdpa_fetch (see https://prioritizr.github.io/wdpar/reference/wdpa_fetch.html) to see if it works for you?

@neriiacopo
Copy link

The examples work smoothly now!
Thank you so much!

@ankemueller
Copy link
Author

Does also work now for me, thanks a lot!

@jeffreyhanson
Copy link
Collaborator

Awesome - glad to hear it's working. I'll submit the new version to CRAN.

@ColineBoonman
Copy link

Hi Jeffrey,

I'm still getting the error that I do not have internet connection while running wdpa_fetch(). Following curl::has_internet tells me I am off line, but pingr::is_online() says (correctly) that I am online. It would be great if you could you help me out!!

I have downloaded the package both via github and via R directly, but both versions do not seem to work. I am using a windows machine if that makes a difference.

Thanks in advance for your response :)
Coline

@jeffreyhanson jeffreyhanson reopened this May 2, 2022
@jeffreyhanson
Copy link
Collaborator

Hi @ColineBoonman,

Thanks for reaching out! Just to check, could you please try re-installing curl to ensure that you have the latest version of curl installed? If wdpar still fails after that, I can update it so that it will think there is an active internet connection if either pingr or curl indicate an online connection.

@ColineBoonman
Copy link

Thanks for your quick response. I have re-installed curl, and it still says I don't have an internet connection > curl::has_internet() [1] FALSE (while pingr gives the opposite response: > pingr::is_online() [1] TRUE).

When I load the wdpar library and run the following line: lie_raw_data <- wdpa_fetch("Liechtenstein", wait = TRUE)
I get this Error:
Error in wdpa_fetch("Liechtenstein", wait = TRUE) : data not found in download_dir, and no internet connectionto download it.

It would be great if you could include the test of both pingr and curl to check for internet connection!

@jeffreyhanson
Copy link
Collaborator

@ColineBoonman, I'm so sorry - I missed the GitHub notification email for your post. I'll work on updating this now and let you know when it's ready.

@jeffreyhanson
Copy link
Collaborator

@ColineBoonman, I've just pushed a branch with the new pingr + curl internet checks. Could you please try it out and see if that fixes it for you? You can install it with remotes::install_github("prioritizr/wdpar@int-check").

@jeffreyhanson
Copy link
Collaborator

@ColineBoonman, I just wanted wanted to follow up and check if those updates fixed the issue?

@ColineBoonman
Copy link

I am sorry for my late response. It works now!! Thank you so much!

@jeffreyhanson
Copy link
Collaborator

No worries - thanks for confirming that it works now! I'll merge the fix into the main branch.

@jeffreyhanson
Copy link
Collaborator

Fixed by a93a5c4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants