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

disable SSL verification when installing keras and tensorflow for R? #1389

Open
wisamb opened this issue Dec 28, 2023 · 2 comments
Open

disable SSL verification when installing keras and tensorflow for R? #1389

wisamb opened this issue Dec 28, 2023 · 2 comments

Comments

@wisamb
Copy link

wisamb commented Dec 28, 2023

Is there a way to disable SSL verification when installing keras and tensorflow for R? I am running into an SSL verification issue when I installed keras and tensorflow in R and also in Python. In Anaconda, I disabled SSL verification in the settings and was able to install keras and tensorflow. Is there a way to do the same in R. The following is the error that I am getting in R:

> install_keras(method = "virtualenv",tensorflow = "2.7")
Virtual environment "r-tensorflow" removed.
Using Python: C:/Program Files/Python311/python.exe
Creating virtual environment "r-tensorflow" ...
+ "C:/Program Files/Python311/python.exe" -m venv "C:/Users/Wisam.Barkho/Documents/.virtualenvs/r-tensorflow"
Done!
Installing packages: pip, wheel, setuptools
+ "C:/Users/Wisam.Barkho/Documents/.virtualenvs/r-tensorflow/Scripts/python.exe" -m pip install --upgrade pip wheel setuptools
Requirement already satisfied: pip in c:\users\wisam~1.bar\docume~1\virtua~1\r-tens~1\lib\site-packages (23.1.2)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /simple/pip/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /simple/pip/
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='[pypi.org](http://pypi.org/)', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))) - skipping
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /simple/wheel/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /simple/wheel/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /simple/wheel/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /simple/wheel/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /simple/wheel/
Could not fetch URL https://pypi.org/simple/wheel/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='[pypi.org](http://pypi.org/)', port=443): Max retries exceeded with url: /simple/wheel/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))) - skipping
ERROR: Could not find a version that satisfies the requirement wheel (from versions: none)
ERROR: No matching distribution found for wheel
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='[pypi.org](http://pypi.org/)', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))) - skipping
Error: Error installing package(s): "pip", "wheel", "setuptools"
@t-kalinowski
Copy link
Member

t-kalinowski commented Dec 29, 2023

My guess is that there is a corporate firewall interfering with pip downloads.

Do the same commands fail if you open up cmd.exe and run them?

"C:/Program Files/Python311/python.exe" -m venv "C:/Users/Wisam.Barkho/Documents/.virtualenvs/r-tensorflow"

"C:/Users/Wisam.Barkho/Documents/.virtualenvs/r-tensorflow/Scripts/python.exe" -m pip install --upgrade pip wheel setuptools

"C:/Users/Wisam.Barkho/Documents/.virtualenvs/r-tensorflow/Scripts/python.exe" -m pip install --upgrade tensorflow

If yes, then maybe manually adding trusted hosts to pip config may fix the issue https://stackoverflow.com/a/67796873/5128728

Or passing some variation of trusted-hosts to pip, either via pip options like

install_tensorflow(pip_options = "--trusted-hosts=pypi.python.org")

or by setting an env var

Sys.setenv(PIP_TRUSTED_HOSTS="pypi.python.org")
install_tensorflow()

You may have to confer with your IT department or Python-using colleagues for how to install pip packages with the corporate firewall settings.

@wisamb
Copy link
Author

wisamb commented Dec 29, 2023

Yes, I am getting the same errors when running those commands from cmd.exe. The solution from StackOverflow worked (didn't try the others), not in standalone RStudio but when launching RStudio through Anaconda. Thank you! Been trying to get this to work forever!

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

2 participants