oracle / graalpython

A Python 3 implementation built on GraalVM
Other
1.21k stars 104 forks source link

"unknown url type: https" when installing packages from PyPI #195

Closed domdfcoding closed 3 years ago

domdfcoding commented 3 years ago

Hi,

I was trying to install one of my modules from PyPI with ginstall. While my module downloads and builds fine, ginstall errors out when trying to download the dependencies:

Installed /home/domdf/.local/lib/python3.8/site-packages/domdf_python_tools-2.5.2-py3.8.egg
Processing dependencies for domdf-python-tools==2.5.2
Searching for importlib-metadata>=1.5.0
Reading https://pypi.org/simple/importlib-metadata/
Download error on https://pypi.org/simple/importlib-metadata/: unknown url type: https -- Some packages may not be found!
Couldn't find index page for 'importlib-metadata' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
Download error on https://pypi.org/simple/: unknown url type: https -- Some packages may not be found!
No local packages or working download links found for importlib-metadata>=1.5.0
error: Could not find suitable distribution for Requirement.parse('importlib-metadata>=1.5.0')

The index page for importlib-metadata definitely exists: https://pypi.org/simple/importlib-metadata/

I can induce a similar error when making a request using urllib.request.urlopen:

>>> import urllib.request
>>> urllib.request.urlopen("https://pypi.org/simple/importlib-metadata/")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/domdf/Downloads/graal-vm/languages/python/lib-python/3/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/home/domdf/Downloads/graal-vm/languages/python/lib-python/3/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/home/domdf/Downloads/graal-vm/languages/python/lib-python/3/urllib/request.py", line 547, in _open
    return self._call_chain(self.handle_open, 'unknown',
  File "/home/domdf/Downloads/graal-vm/languages/python/lib-python/3/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/home/domdf/Downloads/graal-vm/languages/python/lib-python/3/urllib/request.py", line 1421, in unknown_open
    raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: https>
>>> 

I am able to make HTTP requests without SSL fine, so the issue seems to be with HTTPS/SSL. Has graalpython been built without SSL support, or is there some extra step I need to take to enable it?

timfel commented 3 years ago

Hi, and thank you for trying out graalpython. We currently have no support for ssl at all, but are working on it to hopefully include a first version in the next release.

timfel commented 3 years ago

A current workaround is to setup a http-only local mirror of PyPI or run an ssl-stripping proxy locally.

msimacek commented 3 years ago

Another (IMHO easier) workaround is to use pip2pi to download the packages (with CPython) into a file repository and then pointing graalython to it using PIP_INDEX_URL. As for importlib-metadata in particular - it is a backport package for older python versions, I believe you don't actually need it under graalpython.

msimacek commented 3 years ago

SSL support has been merged to master