diff --git a/snakemake/remote/__init__.py b/snakemake/remote/__init__.py index 19a4bf7f5..b3ba59e3e 100644 --- a/snakemake/remote/__init__.py +++ b/snakemake/remote/__init__.py @@ -471,10 +471,14 @@ def protocol_mapping(self): # assemble scheme mapping protocol_dict = {} for Provider in provider_list: - for protocol in Provider().available_protocols: - protocol_short = protocol[:-3] # remove "://" suffix - protocol_dict[protocol_short] = Provider - + try: + for protocol in Provider().available_protocols: + protocol_short = protocol[:-3] # remove "://" suffix + protocol_dict[protocol_short] = Provider + except Exception as e: + # If for any reason Provider() fails (e.g. missing python + # packages or config env vars), skip this provider. + logger.debug(f"Instantiating {Provider.__class__.__name__} failed: {e}") return protocol_dict def remote(self, value, *args, provider_kws=None, **kwargs): diff --git a/tests/test_remote_auto/Snakefile b/tests/test_remote_auto/Snakefile new file mode 100644 index 000000000..212206946 --- /dev/null +++ b/tests/test_remote_auto/Snakefile @@ -0,0 +1,10 @@ +#import re, os, sys +shell.executable("bash") + +from snakemake.remote import AUTO + +rule all: + input: + AUTO.remote("https://github.com/snakemake/snakemake/raw/main/images/logo.png") + run: + shell("cp {input} ./") diff --git a/tests/test_remote_auto/expected-results/logo.png b/tests/test_remote_auto/expected-results/logo.png new file mode 100644 index 000000000..90388b4fb Binary files /dev/null and b/tests/test_remote_auto/expected-results/logo.png differ