You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fails to download from the internet if NSCI inticates offline #275
Hmm, that error is coming from the OS's own download function, so we can't do anything much to override it - if the OS is refusing to download a file, then it's refusing.
Can you try running with environment variable PYMANAGER_ENABLE_BITS_DOWNLOAD set to 0? That will skip the first method and try with the second - if the second also refuses to work, then we can't really work around this anyway, even if we were to try and detect the state of "connected but the OS thinks it is disconnected".
There is fallback behaviour - you just tested with it - we just don't use it when BITS reports that it failed because the internet isn't connected (since there's no point doing jittered/delayed retries when the problem is local).
Until extra handling is added for that particular case, the workaround is to set the environment variable to skip BITS.
I just use python for its tools, I am not skilled in programming. The only way I can think of implementing this would be to ping the download server with a fallback, and make that the default if success.
LOGGER.error("Failed to download. Please connect to the internet and try again.")
raiseRuntimeError("Failed to download. Please connect to the internet and try again.") fromex
So basically, that previous check should be skipped and we should always try twice, even when the user is offline. We need to make sure that it still behaves reasonably when users are actually offline (no offence, but that scenario matters more than people who deliberately block the test domain), but if it just delays the final error message by a few milliseconds, then no real harm.
Activity
zooba commentedon Feb 16, 2026
Hmm, that error is coming from the OS's own download function, so we can't do anything much to override it - if the OS is refusing to download a file, then it's refusing.
Can you try running with environment variable
PYMANAGER_ENABLE_BITS_DOWNLOADset to0? That will skip the first method and try with the second - if the second also refuses to work, then we can't really work around this anyway, even if we were to try and detect the state of "connected but the OS thinks it is disconnected".thatsprettygood commentedon Feb 16, 2026
Yup, that works.
It seems BITS will refuse to download anything if it thinks it's offline.
There should probably be fallback behavior in place.
zooba commentedon Feb 16, 2026
There is fallback behaviour - you just tested with it - we just don't use it when BITS reports that it failed because the internet isn't connected (since there's no point doing jittered/delayed retries when the problem is local).
Until extra handling is added for that particular case, the workaround is to set the environment variable to skip BITS.
thatsprettygood commentedon Feb 16, 2026
Should I keep the issue open until extra handling is implemented?
zooba commentedon Feb 16, 2026
Yeah, we'll leave this open to keep track. Unless you want to have a go at implementing it (should be in
urlutils.py), your work is done :)thatsprettygood commentedon Feb 16, 2026
I just use python for its tools, I am not skilled in programming. The only way I can think of implementing this would be to ping the download server with a fallback, and make that the default if success.
thatsprettygood commentedon Feb 16, 2026
I checked the code and am I reading that it is supposed to fallback in the no internet case?
pymanager/src/manage/urlutils.py
Lines 464 to 465 in a11b7d3
zooba commentedon Feb 17, 2026
Only if the function to check whether the OS thinks the internet is connected fails. These are the lines just above what you quoted:
pymanager/src/manage/urlutils.py
Lines 460 to 462 in a11b7d3
So basically, that previous check should be skipped and we should always try twice, even when the user is offline. We need to make sure that it still behaves reasonably when users are actually offline (no offence, but that scenario matters more than people who deliberately block the test domain), but if it just delays the final error message by a few milliseconds, then no real harm.
Allow fallback to WinHTTP if BITS reports 'no internet'
Allow fallback to WinHTTP if BITS reports 'no internet' (#318)