-
-
Notifications
You must be signed in to change notification settings - Fork 29
Ability to have the pip --extra-index-urls
behaviour
#223
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
Comments
Hi @lesteve! I would rather say that this is the expected behaviour, as the I think we could consider this a feature request to add support for the |
I agree that it would be great to support an |
Or, if we were to make |
I don't think we'd want to diverge from pip here. |
Thanks for your answers! Indeed I was kind of expecting the |
--extra-index-urls
behaviour
Hi @lesteve, I don't think it is expected behavior. We actually fallback to the lockfile if the package is not found in the index URL. micropip/micropip/transaction.py Lines 184 to 200 in 71bc2e3
The problem is that it seems like the Anaconda package index does not set CORS headers when they get a 404 Not found error. When CORS error is raised, it is not converted as a So... I guess we need to ask Anaconda folks again if it would be possible to set CORS headers in 404 (or other 4XX) errors as well. We have the same issue in PyPI so I've fixed it before (pypi/warehouse#16339). |
Hi, @fpliger. Sorry to ping you again. Would it be possible to set the CORS headers in Anaconda package index for 4XX errors as well? |
Meanwhile, I think we can relax the exception condition to catch the CORS error. It is converted to |
@ryanking13 Do we actually need CORS on the 404? We can see in this case that the response was a 404, so they don't have the wheel? Can we tell the difference between:
|
Ah, just noticed the conversation here. I've just put up a PR to add |
Yes, all the errors were valueError everywhere, so basically if you had an incorrect URL, a captcha, a 500, a cors issue, invalid HTML or anything else micropip would just say "well, I guess this URL does not have a wheel, I'll check the next repo", so it was basically swallowing a bunch of legitimate errors. and note that it's
|
IN adition I think a special value ('LOCK') should be added to look into the lock file, it would avoid the boolean to look into lock for or not, and would allow customization or whether or not too look into lock and in which order) without extra parameters like extra_url. |
@agriyakhetarpal Yeah, thanks for the PR but I think we can be more careful about adding extra_index_urls. Also, we are accepting multiple index URLs because of some special situation of Pyodide (not all wheels will be in a single index URL), but IIRC PyPA folks do not like using multiple index URLs. It was because of the randomness in wheel resolution when multiple index URLs are provided. |
Okay, then let's update the code to consider CORS error just like other errors. @agriyakhetarpal Would you like to work on that? |
That makes sense. I get that there are reservations to using multiple index URLs, given that pypa/pip#8606 is still open (and valid). I'm trying to draw upon In general, we should make the |
Yes, sure, @ryanking13. Do you have any pointers? I haven't followed the previous discussions on this area. :) |
I think we can fix the code here: micropip/micropip/package_index.py Lines 316 to 323 in 71bc2e3
Instead of checking the HttpStatusError only, we can catch any |
To reproduce
Following pyodide/pyodide#4898 (comment), I wanted to try out the CORS headers in anaconda.org so I have built a scikit-learn Pyodide wheel locally and uploaded it to anaconda.org. I was hoping to use the anaconda.org PyPI index https://pypi.anaconda.org/lesteve/simple like this:
What I would have expected
scikit-learn dev wheel gets installed from my own index URL, but the dependencies (numpy, scipy, joblib, threadpoolctl) are installed from the lock-file
What happens instead
Looking at the browser console, it looks like it is trying to find dependencies in https://pypi.anaconda.org/lesteve/simple but this index only has scikit-learn so this fails.
Python traceback:
Part of the browser console that shows that micropip is trying to find dependencies in https://pypi.anaconda.org/lesteve/simple:
More context
A simple work-around is to first install the dependencies without specifying a
index_urls
so that uses the lock-file I guess or the PyPI index for pure-Python wheels:The text was updated successfully, but these errors were encountered: