-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
CommandFailed
when using conda_install
while being offline, even if env is fully setup
#313
Comments
One solution to detect that the conda host is there , inspired by this post from socket import gethostbyname
import requests
CONDA_HOST = 'repo.anaconda.com'
def _is_connected(hostname=CONDA_HOST, dns_only=False):
try:
host = gethostbyname(hostname)
assert host is not None
# Do not use this: not HTTP proxy compliant
# s = socket.create_connection((host, 80), 2)
# s.close()
if not dns_only:
code = requests.get("https://%s" % REMOTE_HOST).status_code
assert code is not None
return True
except:
pass
return False |
Note that a less user-friendly alternative would be to propagate the flag into nox options, so that users wishing to execute a conda based session in an offline context could call |
smarie
pushed a commit
to smarie/nox
that referenced
this issue
Apr 21, 2020
… allows users to continue executing nox sessions on already installed environments. This behaviour can be disabled by setting `auto_offline=False`. Fixes wntrblm#313
theacodes
pushed a commit
that referenced
this issue
Jun 21, 2020
* Offline mode is now auto-detected by default by `conda_install`. This allows users to continue executing nox sessions on already installed environments. This behaviour can be disabled by setting `auto_offline=False`. Fixes #313 * Fixed args order for offline option and added tests * Black-ened code * Fixed conda options order again * Added a log message when doing auto-offline * Fixed mypy errors * Fixed mypy errors (2) * mypy fix (3) * Fixed last failing test * Improved coverage * Last coverage fix ? * Blackened * Last Flake8 fix * removed dependency to `requests` * removed dependency to `urllib3` * Simplified offline checks * fixed import * fixed test * Added pragma no cover Co-authored-by: Sylvain MARIE <sylvain.marie@se.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As opposed to
session.install
, that continues to work nicely when no internet connection is present but all required packages are already installed,session.conda_install
fails miserably.This is of course a conda shortcoming but I think that we could easily solve this in
conda_install
by detecting when network is unavailable and adding the"--offline"
flag when it is the case. I'll propose a PR.The text was updated successfully, but these errors were encountered: