ipeaGIT / geobr

Easy access to official spatial data sets of Brazil in R and Python
https://ipeagit.github.io/geobr/
786 stars 118 forks source link

Problem connecting to data server #268

Closed lucasccdias closed 2 years ago

lucasccdias commented 2 years ago

I found this problem while trying to use geobr. It happened in my machine (Ubuntu 20.04) and the same error appears in the Python package via Google Colab.

geobr::read_municipality(code_muni = "SP")
#> Loading required namespace: sf
#> SSL certificate problem: unable to get local issuer certificate
#> Problem connecting to data server. Please try geobr again in a few minutes.
#> Error in curl::curl_fetch_disk(url, x$path, handle = handle): SSL certificate problem: unable to get local issuer certificate

Created on 2021-12-23 by the reprex package (v2.0.1)

lcjr86 commented 2 years ago

Hello everyone. I found yesterday (2021-Dec-23) the same issue that @lucasccdias found it. I tried to 'bypass' the SSL verification using:

import ssl ssl._create_default_https_context = ssl._create_unverified_context mun = read_municipality(code_muni=1200179, year=2017)

and I got the following error message:

` . . . raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='www.ipea.gov.br', port=443): Max retries exceeded with url: /geobr/data_gpkg/municipality/2017/12municipality_2017_simplified.gpkg (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)')))

. . .

Exception: Some internal url is broken. Please report to https://github.com/ipeaGIT/geobr/issues `

Looks like the source or changed his SSL or changed the link.

rafapereirabr commented 2 years ago

Hi all. Thanks for opening this issue. This kind o problem can occur sometimes when our data server is unstable, hence de message Problem connecting to data server. Please try geobr again in a few minutes.. The problem has been solved now.

luiz-dejesus commented 2 years ago

Hello @rafapereirabr, thanks for your reply. I just tried again (using one of the examples from the README.md) and I still have the SSL error.

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>

Is there something that I need to do on my side to get the fix, for example, reinstall the lib?

Many thanks in advance and best regards,

Luiz

rafapereirabr commented 2 years ago

Are you using the R package or the Python package?

lcjr86 commented 2 years ago

I'm using python. I don't have any VPN or Firewall on my side. Thanks again.