Skip to content

requests: Can't connect to HTTPS URL because the SSL module is not available. #41

@huimzjty

Description

@huimzjty

I use this command to install the python3 by portable-python

yum install python3-pip
pip3 install portable-python

yum install -y libffi libffi-devel python3-devel openssl-devel
yum install -y perl-CPAN
cpan IPC::Cmd
cd /opt/
mkdir portable_with_openssl
cd portable_with_openssl/
portable-python build 3.11.7 -m openssl

mkdir /opt/versions
tar -C /opt/versions/  -xf dist/cpython-3.11.7-linux-x86_64.tar.gz
cd /opt/versions/3.11.7
./bin/python3.11 -mpip install requests

And after import the requests, i can request "http://google.com", but when i request "https://google.com", an error has occurred.

Python 3.11.7 (main, Mar 14 2024, 14:21:08) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>import requests
>>> requests.get("http://google.com")
<Response [200]>
>>> requests.get("https://google.com")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/urllib3/connectionpool.py", line 772, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/urllib3/connectionpool.py", line 295, in _get_conn
    return conn or self._new_conn()
                   ^^^^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1063, in _new_conn
    raise ImportError(
ImportError: Can't connect to HTTPS URL because the SSL module is not available.

Does the requests library only use the SSL module in the system to process HTTPS requests?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions