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 connect to HTTPS URL because the SSL module is not available #450

Closed
mimong2 opened this issue Feb 12, 2021 · 2 comments
Closed

Can't connect to HTTPS URL because the SSL module is not available #450

mimong2 opened this issue Feb 12, 2021 · 2 comments
Labels

Comments

@mimong2
Copy link

mimong2 commented Feb 12, 2021

I am trying to install an external module using pip

gradle code:
apply plugin: 'com.android.application'
apply plugin: 'com.chaquo.python'

android {
compileSdkVersion 30
buildToolsVersion "29.0.3"

defaultConfig {
    applicationId "com.chaquo.python.hello"
    minSdkVersion 16
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    python {
        // If Chaquopy fails to find Python on your build machine, enable the following
        // line and edit it to point to Python 3.5 or later.
        // buildPython "C:/Python36/python.exe"
        pip{
            install "requests"
        }
        staticProxy "hello"
    }
    ndk {
        abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
    }

}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

}

Here is the error:

**> Task :app:generateDebugPythonRequirements
C:\Users\user\Downloads\chaquopy-hello-master\chaquopy-hello-master\app\build\generated\python\bp.zip\pip_vendor\ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
C:\Users\user\Downloads\chaquopy-hello-master\chaquopy-hello-master\app\build\generated\python\bp.zip\pip_vendor\ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
Chaquopy: Installing for arm64-v8a
C:\Users\user\Downloads\chaquopy-hello-master\chaquopy-hello-master\app\build\generated\python\bp.zip\pip_vendor\ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
C:\Users\user\Downloads\chaquopy-hello-master\chaquopy-hello-master\app\build\generated\python\bp.zip\pip_vendor\ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-7.0
Collecting requests
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
Could not fetch URL https://pypi.org/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/requests/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/requests/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/requests/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/requests/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/requests/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/requests/
Could not fetch URL https://chaquo.com/pypi-7.0/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='chaquo.com', port=443): Max retries exceeded with url: /pypi-7.0/requests/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
Chaquopy: Exit status 1

Task :app:generateDebugPythonRequirements FAILED**

@mimong2 mimong2 closed this as completed Feb 12, 2021
@mhsmith mhsmith transferred this issue from chaquo/chaquopy-hello Feb 12, 2021
@mhsmith mhsmith changed the title pip Can't connect to HTTPS URL because the SSL module is not available Feb 12, 2021
@mhsmith
Copy link
Member

mhsmith commented Feb 12, 2021

This is probably caused by using Anaconda Python without having its libraries on the PATH, as described in the Conda FAQ. The easiest solution is to install Python from python.org, then if necessary, set the buildPython line to point at it.

We'll try to implement a workaround for this in the next version of Chaquopy.

@mhsmith
Copy link
Member

mhsmith commented Sep 22, 2021

This issue is fixed in Chaquopy 10.0.1. To upgrade, edit your app's top-level build.gradle file and change the version number of com.chaquo.python:gradle.

@mhsmith mhsmith closed this as completed Sep 22, 2021
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

2 participants