after_merge
stringlengths
28
79.6k
before_merge
stringlengths
20
79.6k
url
stringlengths
38
71
full_traceback
stringlengths
43
922k
traceback_type
stringclasses
555 values
def execute(args, parser): spec = MatchSpec(args.match_spec) if spec.get_exact_value("subdir"): subdirs = (spec.get_exact_value("subdir"),) elif args.platform: subdirs = (args.platform,) else: subdirs = context.subdirs with Spinner( "Loading channels", not context.verbosity and not context.quiet, context.json ): spec_channel = spec.get_exact_value("channel") channel_urls = (spec_channel,) if spec_channel else context.channels matches = sorted( SubdirData.query_all(channel_urls, subdirs, spec), key=lambda rec: (rec.name, VersionOrder(rec.version), rec.build), ) if not matches: channels_urls = tuple( calculate_channel_urls( channel_urls=context.channels, prepend=not args.override_channels, platform=subdirs[0], use_local=args.use_local, ) ) from ..exceptions import PackagesNotFoundError raise PackagesNotFoundError((text_type(spec),), channels_urls) if context.json: json_obj = defaultdict(list) for match in matches: json_obj[match.name].append(match) stdout_json(json_obj) elif args.info: for record in matches: pretty_record(record) else: builder = [ "%-25s %-15s %15s %-15s" % ( "Name", "Version", "Build", "Channel", ) ] for record in matches: builder.append( "%-25s %-15s %15s %-15s" % ( record.name, record.version, record.build, record.schannel, ) ) print("\n".join(builder))
def execute(args, parser): spec = MatchSpec(args.match_spec) if spec.get_exact_value("subdir"): subdirs = (spec.get_exact_value("subdir"),) elif args.platform: subdirs = (args.platform,) else: subdirs = context.subdirs with spinner( "Loading channels", not context.verbosity and not context.quiet, context.json ): spec_channel = spec.get_exact_value("channel") channel_urls = (spec_channel,) if spec_channel else context.channels matches = sorted( SubdirData.query_all(channel_urls, subdirs, spec), key=lambda rec: (rec.name, VersionOrder(rec.version), rec.build), ) if not matches: channels_urls = tuple( calculate_channel_urls( channel_urls=context.channels, prepend=not args.override_channels, platform=subdirs[0], use_local=args.use_local, ) ) from ..exceptions import PackagesNotFoundError raise PackagesNotFoundError((text_type(spec),), channels_urls) if context.json: json_obj = defaultdict(list) for match in matches: json_obj[match.name].append(match) stdout_json(json_obj) elif args.info: for record in matches: pretty_record(record) else: builder = [ "%-25s %-15s %15s %-15s" % ( "Name", "Version", "Build", "Channel", ) ] for record in matches: builder.append( "%-25s %-15s %15s %-15s" % ( record.name, record.version, record.build, record.schannel, ) ) sys.stdout.write("\n".join(builder)) sys.stdout.write("\n")
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def pretty_record(record): def push_line(display_name, attr_name): value = getattr(record, attr_name, None) if value is not None: builder.append("%-12s: %s" % (display_name, value)) builder = [] builder.append(record.name + " " + record.version + " " + record.build) builder.append("-" * len(builder[0])) push_line("file name", "fn") push_line("name", "name") push_line("version", "version") push_line("build string", "build") push_line("build number", "build_number") builder.append("%-12s: %s" % ("size", human_bytes(record.size))) push_line("arch", "arch") push_line("constrains", "constrains") push_line("platform", "platform") push_line("license", "license") push_line("subdir", "subdir") push_line("url", "url") push_line("md5", "md5") builder.append("%-12s: %s" % ("dependencies", dashlist(record.depends))) builder.append("\n") print("\n".join(builder))
def pretty_record(record): def push_line(display_name, attr_name): value = getattr(record, attr_name, None) if value is not None: builder.append("%-12s: %s" % (display_name, value)) builder = [] builder.append(record.name + " " + record.version + " " + record.build) builder.append("-" * len(builder[0])) push_line("file name", "fn") push_line("name", "name") push_line("version", "version") push_line("build string", "build") push_line("build number", "build_number") builder.append("%-12s: %s" % ("size", human_bytes(record.size))) push_line("arch", "arch") push_line("constrains", "constrains") push_line("platform", "platform") push_line("license", "license") push_line("subdir", "subdir") push_line("url", "url") push_line("md5", "md5") builder.append("%-12s: %s" % ("dependencies", dashlist(record.depends))) builder.append("\n") sys.stdout.write("\n".join(builder)) sys.stdout.write("\n")
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def __init__(self, message, enabled=True, json=False): self.message = message self.enabled = enabled self.json = json self._stop_running = Event() self._spinner_thread = Thread(target=self._start_spinning) self._indicator_length = len(next(self.spinner_cycle)) + 1 self.fh = sys.stdout self.show_spin = ( enabled and not json and hasattr(self.fh, "isatty") and self.fh.isatty() )
def __init__(self, enable_spin=True): self._stop_running = Event() self._spinner_thread = Thread(target=self._start_spinning) self._indicator_length = len(next(self.spinner_cycle)) + 1 self.fh = sys.stdout self.show_spin = enable_spin and hasattr(self.fh, "isatty") and self.fh.isatty()
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def start(self): if self.show_spin: self._spinner_thread.start() elif not self.json: self.fh.write("...working... ") self.fh.flush()
def start(self): if self.show_spin: self._spinner_thread.start() else: self.fh.write("...working... ") self.fh.flush()
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def stop(self): if self.show_spin: self._stop_running.set() self._spinner_thread.join() self.show_spin = False
def stop(self): if self.show_spin: self._stop_running.set() self._spinner_thread.join()
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def _start_spinning(self): try: while not self._stop_running.is_set(): self.fh.write(next(self.spinner_cycle) + " ") self.fh.flush() sleep(0.10) self.fh.write("\b" * self._indicator_length) except EnvironmentError as e: if e.errno in (EPIPE, ESHUTDOWN): self.stop() else: raise
def _start_spinning(self): while not self._stop_running.is_set(): self.fh.write(next(self.spinner_cycle) + " ") self.fh.flush() sleep(0.10) self.fh.write("\b" * self._indicator_length)
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def __init__(self, description, enabled=True, json=False): """ Args: description (str): The name of the progress bar, shown on left side of output. enabled (bool): If False, usage is a no-op. json (bool): If true, outputs json progress to stdout rather than a progress bar. Currently, the json format assumes this is only used for "fetch", which maintains backward compatibility with conda 4.3 and earlier behavior. """ self.description = description self.enabled = enabled self.json = json if json: pass elif enabled: bar_format = "{desc}{bar} | {percentage:3.0f}% " try: self.pbar = tqdm( desc=description, bar_format=bar_format, ascii=True, total=1 ) except EnvironmentError as e: if e.errno in (EPIPE, ESHUTDOWN): self.enabled = False else: raise
def __init__(self, description, enabled=True, json=False): """ Args: description (str): The name of the progress bar, shown on left side of output. enabled (bool): If False, usage is a no-op. json (bool): If true, outputs json progress to stdout rather than a progress bar. Currently, the json format assumes this is only used for "fetch", which maintains backward compatibility with conda 4.3 and earlier behavior. """ self.description = description self.enabled = enabled self.json = json if json: pass elif enabled: bar_format = "{desc}{bar} | {percentage:3.0f}% " self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1)
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def update_to(self, fraction): try: if self.json and self.enabled: sys.stdout.write( '{"fetch":"%s","finished":false,"maxval":1,"progress":%f}\n\0' % (self.description, fraction) ) elif self.enabled: self.pbar.update(fraction - self.pbar.n) except EnvironmentError as e: if e.errno in (EPIPE, ESHUTDOWN): self.enabled = False else: raise
def update_to(self, fraction): if self.json: sys.stdout.write( '{"fetch":"%s","finished":false,"maxval":1,"progress":%f}\n\0' % (self.description, fraction) ) elif self.enabled: self.pbar.update(fraction - self.pbar.n)
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def close(self): if self.enabled and self.json: sys.stdout.write( '{"fetch":"%s","finished":true,"maxval":1,"progress":1}\n\0' % self.description ) sys.stdout.flush() elif self.enabled: self.pbar.close()
def close(self): try: if self.json: sys.stdout.write( '{"fetch":"%s","finished":true,"maxval":1,"progress":1}\n\0' % self.description ) sys.stdout.flush() elif self.enabled: self.pbar.close() except (IOError, OSError) as e: # Ignore BrokenPipeError and errors related to stdout or stderr being # closed by a downstream program. if e.errno not in (EPIPE, ESHUTDOWN): raise self.enabled = False
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def prepare(self): if self._prepared: return self.transaction_context = {} with Spinner( "Preparing transaction", not context.verbosity and not context.quiet, context.json, ): for stp in itervalues(self.prefix_setups): grps = self._prepare( self.transaction_context, stp.target_prefix, stp.unlink_precs, stp.link_precs, stp.remove_specs, stp.update_specs, ) self.prefix_action_groups[stp.target_prefix] = PrefixActionGroup(*grps) self._prepared = True
def prepare(self): if self._prepared: return self.transaction_context = {} with spinner( "Preparing transaction", not context.verbosity and not context.quiet, context.json, ): for stp in itervalues(self.prefix_setups): grps = self._prepare( self.transaction_context, stp.target_prefix, stp.unlink_precs, stp.link_precs, stp.remove_specs, stp.update_specs, ) self.prefix_action_groups[stp.target_prefix] = PrefixActionGroup(*grps) self._prepared = True
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def verify(self): if not self._prepared: self.prepare() assert not context.dry_run if context.safety_checks == SafetyChecks.disabled: self._verified = True return with Spinner( "Verifying transaction", not context.verbosity and not context.quiet, context.json, ): exceptions = self._verify(self.prefix_setups, self.prefix_action_groups) if exceptions: try: maybe_raise(CondaMultiError(exceptions), context) except: rm_rf(self.transaction_context["temp_dir"]) raise log.info(exceptions) self._verified = True
def verify(self): if not self._prepared: self.prepare() assert not context.dry_run if context.safety_checks == SafetyChecks.disabled: self._verified = True return with spinner( "Verifying transaction", not context.verbosity and not context.quiet, context.json, ): exceptions = self._verify(self.prefix_setups, self.prefix_action_groups) if exceptions: try: maybe_raise(CondaMultiError(exceptions), context) except: rm_rf(self.transaction_context["temp_dir"]) raise log.info(exceptions) self._verified = True
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def _execute(cls, all_action_groups): with signal_handler(conda_signal_handler), time_recorder("unlink_link_execute"): pkg_idx = 0 try: with Spinner( "Executing transaction", not context.verbosity and not context.quiet, context.json, ): for pkg_idx, axngroup in enumerate(all_action_groups): cls._execute_actions(pkg_idx, axngroup) except CondaMultiError as e: action, is_unlink = (None, axngroup.type == "unlink") prec = axngroup.pkg_data log.error( "An error occurred while %s package '%s'.\n" "%r\n" "Attempting to roll back.\n", "uninstalling" if is_unlink else "installing", prec and prec.dist_str(), e.errors[0], ) # reverse all executed packages except the one that failed rollback_excs = [] if context.rollback_enabled: with Spinner( "Rolling back transaction", not context.verbosity and not context.quiet, context.json, ): failed_pkg_idx = pkg_idx reverse_actions = reversed( tuple(enumerate(take(failed_pkg_idx, all_action_groups))) ) for pkg_idx, axngroup in reverse_actions: excs = cls._reverse_actions(pkg_idx, axngroup) rollback_excs.extend(excs) raise CondaMultiError( tuple( concatv( (e.errors if isinstance(e, CondaMultiError) else (e,)), rollback_excs, ) ) ) else: for axngroup in all_action_groups: for action in axngroup.actions: action.cleanup()
def _execute(cls, all_action_groups): with signal_handler(conda_signal_handler), time_recorder("unlink_link_execute"): pkg_idx = 0 try: with spinner( "Executing transaction", not context.verbosity and not context.quiet, context.json, ): for pkg_idx, axngroup in enumerate(all_action_groups): cls._execute_actions(pkg_idx, axngroup) except CondaMultiError as e: action, is_unlink = (None, axngroup.type == "unlink") prec = axngroup.pkg_data log.error( "An error occurred while %s package '%s'.\n" "%r\n" "Attempting to roll back.\n", "uninstalling" if is_unlink else "installing", prec and prec.dist_str(), e.errors[0], ) # reverse all executed packages except the one that failed rollback_excs = [] if context.rollback_enabled: with spinner( "Rolling back transaction", not context.verbosity and not context.quiet, context.json, ): failed_pkg_idx = pkg_idx reverse_actions = reversed( tuple(enumerate(take(failed_pkg_idx, all_action_groups))) ) for pkg_idx, axngroup in reverse_actions: excs = cls._reverse_actions(pkg_idx, axngroup) rollback_excs.extend(excs) raise CondaMultiError( tuple( concatv( (e.errors if isinstance(e, CondaMultiError) else (e,)), rollback_excs, ) ) ) else: for axngroup in all_action_groups: for action in axngroup.actions: action.cleanup()
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def solve_for_transaction( self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, force_remove=NULL, force_reinstall=False, ): """Gives an UnlinkLinkTransaction instance that can be used to execute the solution on an environment. Args: deps_modifier (DepsModifier): See :meth:`solve_final_state`. prune (bool): See :meth:`solve_final_state`. ignore_pinned (bool): See :meth:`solve_final_state`. force_remove (bool): See :meth:`solve_final_state`. force_reinstall (bool): See :meth:`solve_for_diff`. Returns: UnlinkLinkTransaction: """ with Spinner( "Solving environment", not context.verbosity and not context.quiet, context.json ): if self.prefix == context.root_prefix and context.enable_private_envs: # This path has the ability to generate a multi-prefix transaction. The basic logic # is in the commented out get_install_transaction() function below. Exercised at # the integration level in the PrivateEnvIntegrationTests in test_create.py. raise NotImplementedError() else: unlink_precs, link_precs = self.solve_for_diff( deps_modifier, prune, ignore_pinned, force_remove, force_reinstall ) stp = PrefixSetup( self.prefix, unlink_precs, link_precs, self.specs_to_remove, self.specs_to_add, ) # TODO: Only explicitly requested remove and update specs are being included in # History right now. Do we need to include other categories from the solve? if context.notify_outdated_conda: conda_newer_spec = MatchSpec("conda >%s" % CONDA_VERSION) if not any(conda_newer_spec.match(prec) for prec in link_precs): conda_newer_records = sorted( SubdirData.query_all(self.channels, self.subdirs, conda_newer_spec), key=lambda x: VersionOrder(x.version), ) if conda_newer_records: latest_version = conda_newer_records[-1].version print( dedent(""" ==> WARNING: A newer version of conda exists. <== current version: %s latest version: %s Please update conda by running $ conda update -n base conda """) % (CONDA_VERSION, latest_version), file=sys.stderr, ) return UnlinkLinkTransaction(stp)
def solve_for_transaction( self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, force_remove=NULL, force_reinstall=False, ): """Gives an UnlinkLinkTransaction instance that can be used to execute the solution on an environment. Args: deps_modifier (DepsModifier): See :meth:`solve_final_state`. prune (bool): See :meth:`solve_final_state`. ignore_pinned (bool): See :meth:`solve_final_state`. force_remove (bool): See :meth:`solve_final_state`. force_reinstall (bool): See :meth:`solve_for_diff`. Returns: UnlinkLinkTransaction: """ with spinner( "Solving environment", not context.verbosity and not context.quiet, context.json ): if self.prefix == context.root_prefix and context.enable_private_envs: # This path has the ability to generate a multi-prefix transaction. The basic logic # is in the commented out get_install_transaction() function below. Exercised at # the integration level in the PrivateEnvIntegrationTests in test_create.py. raise NotImplementedError() else: unlink_precs, link_precs = self.solve_for_diff( deps_modifier, prune, ignore_pinned, force_remove, force_reinstall ) stp = PrefixSetup( self.prefix, unlink_precs, link_precs, self.specs_to_remove, self.specs_to_add, ) # TODO: Only explicitly requested remove and update specs are being included in # History right now. Do we need to include other categories from the solve? if context.notify_outdated_conda: conda_newer_spec = MatchSpec("conda >%s" % CONDA_VERSION) if not any(conda_newer_spec.match(prec) for prec in link_precs): conda_newer_records = sorted( SubdirData.query_all(self.channels, self.subdirs, conda_newer_spec), key=lambda x: VersionOrder(x.version), ) if conda_newer_records: latest_version = conda_newer_records[-1].version sys.stderr.write( dedent(""" ==> WARNING: A newer version of conda exists. <== current version: %s latest version: %s Please update conda by running $ conda update -n base conda """) % (CONDA_VERSION, latest_version) ) return UnlinkLinkTransaction(stp)
https://github.com/conda/conda/issues/6582
error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def verify(self): validation_error = super(PrefixReplaceLinkAction, self).verify() if validation_error: return validation_error if islink(self.source_full_path): log.trace( "ignoring prefix update for symlink with source path %s", self.source_full_path, ) # return assert False, "I don't think this is the right place to ignore this" self.intermediate_path = join( self.transaction_context["temp_dir"], text_type(uuid4()) ) log.trace("copying %s => %s", self.source_full_path, self.intermediate_path) create_link(self.source_full_path, self.intermediate_path, LinkType.copy) make_writable(self.intermediate_path) try: log.trace("rewriting prefixes in %s", self.target_full_path) update_prefix( self.intermediate_path, context.target_prefix_override or self.target_prefix, self.prefix_placeholder, self.file_mode, ) except _PaddingError: raise PaddingError( self.target_full_path, self.prefix_placeholder, len(self.prefix_placeholder) ) sha256_in_prefix = compute_sha256sum(self.intermediate_path) self.prefix_path_data = PathDataV1.from_objects( self.prefix_path_data, file_mode=self.file_mode, path_type=PathType.hardlink, prefix_placeholder=self.prefix_placeholder, sha256_in_prefix=sha256_in_prefix, ) self._verified = True
def verify(self): validation_error = super(PrefixReplaceLinkAction, self).verify() if validation_error: return validation_error if islink(self.source_full_path): log.trace( "ignoring prefix update for symlink with source path %s", self.source_full_path, ) # return assert False, "I don't think this is the right place to ignore this" self.intermediate_path = join( self.transaction_context["temp_dir"], text_type(uuid4()) ) log.trace("copying %s => %s", self.source_full_path, self.intermediate_path) create_link(self.source_full_path, self.intermediate_path, LinkType.copy) try: log.trace("rewriting prefixes in %s", self.target_full_path) update_prefix( self.intermediate_path, context.target_prefix_override or self.target_prefix, self.prefix_placeholder, self.file_mode, ) except _PaddingError: raise PaddingError( self.target_full_path, self.prefix_placeholder, len(self.prefix_placeholder) ) sha256_in_prefix = compute_sha256sum(self.intermediate_path) self.prefix_path_data = PathDataV1.from_objects( self.prefix_path_data, file_mode=self.file_mode, path_type=PathType.hardlink, prefix_placeholder=self.prefix_placeholder, sha256_in_prefix=sha256_in_prefix, ) self._verified = True
https://github.com/conda/conda/issues/6852
Traceback (most recent call last): File "/miniconda/lib/python3.6/site-packages/conda/exceptions.py", line 772, in __call__ return func(*args, **kwargs) File "/miniconda/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/miniconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 77, in do_call exit_code = getattr(module, func_name)(args, parser) File "/miniconda/lib/python3.6/site-packages/conda/cli/main_create.py", line 11, in execute install(args, parser, 'create') File "/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 285, in handle_txn unlink_link_transaction.execute() File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 220, in execute self.verify() File "/miniconda/lib/python3.6/site-packages/conda/common/io.py", line 441, in decorated return f(*args, **kwds) File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 207, in verify exceptions = self._verify(self.prefix_setups, self.prefix_action_groups) File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 460, in _verify cls._verify_transaction_level(prefix_setups), File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 455, in <genexpr> exceptions = tuple(exc for exc in concatv( File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 323, in _verify_individual_level error_result = axn.verify() File "/miniconda/lib/python3.6/site-packages/conda/core/path_actions.py", line 410, in verify self.file_mode) File "/miniconda/lib/python3.6/site-packages/conda/core/portability.py", line 57, in update_prefix update_file_in_place_as_binary(realpath(path), _update_prefix) File "/miniconda/lib/python3.6/site-packages/conda/gateways/disk/update.py", line 33, in update_file_in_place_as_binary fh = exp_backoff_fn(open, file_full_path, 'rb+') File "/miniconda/lib/python3.6/site-packages/conda/gateways/disk/__init__.py", line 23, in exp_backoff_fn return fn(*args, **kwargs) PermissionError: [Errno 13] Permission denied: '/tmp/tmpp4kwvm4j/be616029-6651-4227-a448-4e595cd8e473'
PermissionError
def _pip_install_via_requirements(prefix, specs, args, *_, **kwargs): """ Installs the pip dependencies in specs using a temporary pip requirements file. Args ---- prefix: string The path to the python and pip executables. specs: iterable of strings Each element should be a valid pip dependency. See: https://pip.pypa.io/en/stable/user_guide/#requirements-files https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format """ try: pip_workdir = op.dirname(op.abspath(args.file)) except AttributeError: pip_workdir = None requirements = None try: # Generate the temporary requirements file requirements = tempfile.NamedTemporaryFile( mode="w", prefix="condaenv.", suffix=".requirements.txt", dir=pip_workdir, delete=False, ) requirements.write("\n".join(specs)) requirements.close() # pip command line... args, pip_version = pip_args(prefix) if args is None: return pip_cmd = args + ["install", "-r", requirements.name] # ...run it process = subprocess.Popen(pip_cmd, cwd=pip_workdir, universal_newlines=True) process.communicate() if process.returncode != 0: raise CondaValueError("pip returned an error") finally: # Win/Appveyor does not like it if we use context manager + delete=True. # So we delete the temporary file in a finally block. if requirements is not None and op.isfile(requirements.name): os.remove(requirements.name)
def _pip_install_via_requirements(prefix, specs, args, *_, **kwargs): """ Installs the pip dependencies in specs using a temporary pip requirements file. Args ---- prefix: string The path to the python and pip executables. specs: iterable of strings Each element should be a valid pip dependency. See: https://pip.pypa.io/en/stable/user_guide/#requirements-files https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format """ try: pip_workdir = op.dirname(op.abspath(args.file)) except AttributeError: pip_workdir = None requirements = None try: # Generate the temporary requirements file requirements = tempfile.NamedTemporaryFile( mode="w", prefix="condaenv.", suffix=".requirements.txt", dir=pip_workdir, delete=False, ) requirements.write("\n".join(specs)) requirements.close() # pip command line... args, pip_version = pip_args(prefix) pip_cmd = args + ["install", "-r", requirements.name] # ...run it process = subprocess.Popen(pip_cmd, cwd=pip_workdir, universal_newlines=True) process.communicate() if process.returncode != 0: raise CondaValueError("pip returned an error") finally: # Win/Appveyor does not like it if we use context manager + delete=True. # So we delete the temporary file in a finally block. if requirements is not None and op.isfile(requirements.name): os.remove(requirements.name)
https://github.com/conda/conda/issues/6208
Traceback (most recent call last): File "/home/snadar/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 640, in conda_exception_handler return_value = func(*args, **kwargs) File "/home/snadar/anaconda3/lib/python3.6/site-packages/conda_env/cli/main_create.py", line 108, in execute installer.install(prefix, pkg_specs, args, env) File "/home/snadar/anaconda3/lib/python3.6/site-packages/conda_env/installers/pip.py", line 8, in install pip_cmd = pip_args(prefix) + ['install', ] + specs TypeError: can only concatenate list (not "NoneType") to list
TypeError
def configure_parser_config(sub_parsers): descr = ( dedent(""" Modify configuration values in .condarc. This is modeled after the git config command. Writes to the user .condarc file (%s) by default. """) % escaped_user_rc_path ) # Note, the extra whitespace in the list keys is on purpose. It's so the # formatting from help2man is still valid YAML (otherwise it line wraps the # keys like "- conda - defaults"). Technically the parser here still won't # recognize it because it removes the indentation, but at least it will be # valid. additional_descr = ( """ See `conda config --describe` or %s/docs/config.html for details on all the options that can go in .condarc. Examples: Display all configuration values as calculated and compiled: conda config --show Display all identified configuration sources: conda config --show-sources Describe all available configuration options: conda config --describe Add the conda-canary channel: conda config --add channels conda-canary Set the output verbosity to level 3 (highest): conda config --set verbosity 3 Get the channels defined in the system .condarc: conda config --get channels --system Add the 'foo' Binstar channel: conda config --add channels foo Disable the 'show_channel_urls' option: conda config --set show_channel_urls no """ % CONDA_HOMEPAGE_URL ) p = sub_parsers.add_parser( "config", description=descr, help=descr, epilog=additional_descr, ) add_parser_json(p) # TODO: use argparse.FileType location = p.add_mutually_exclusive_group() location.add_argument( "--system", action="store_true", help="""Write to the system .condarc file ({system}). Otherwise writes to the user config file ({user}).""".format( system=escaped_sys_rc_path, user=escaped_user_rc_path ), ) location.add_argument( "--env", action="store_true", help="Write to the active conda environment .condarc file (%s). " "If no environment is active, write to the user config file (%s)." "" % ( os.getenv("CONDA_PREFIX", "<no active environment>").replace("%", "%%"), escaped_user_rc_path, ), ) location.add_argument( "--file", action="store", help="""Write to the given file. Otherwise writes to the user config file ({user}) or the file path given by the 'CONDARC' environment variable, if it is set (default: %(default)s).""".format(user=escaped_user_rc_path), default=os.environ.get("CONDARC", user_rc_path), ) # XXX: Does this really have to be mutually exclusive. I think the below # code will work even if it is a regular group (although combination of # --add and --remove with the same keys will not be well-defined). action = p.add_mutually_exclusive_group(required=True) action.add_argument( "--show", nargs="*", default=None, help="Display configuration values as calculated and compiled. " "If no arguments given, show information for all configuration values.", ) action.add_argument( "--show-sources", action="store_true", help="Display all identified configuration sources.", ) action.add_argument( "--validate", action="store_true", help="Validate all configuration sources.", ) action.add_argument( "--describe", nargs="*", default=None, help="Describe given configuration parameters. If no arguments given, show " "information for all configuration parameters.", ) action.add_argument( "--write-default", action="store_true", help="Write the default configuration to a file. " "Equivalent to `conda config --describe > ~/.condarc` " "when no --env, --system, or --file flags are given.", ) action.add_argument( "--get", nargs="*", action="store", help="Get a configuration value.", default=None, metavar="KEY", ) action.add_argument( "--append", nargs=2, action="append", help="""Add one configuration value to the end of a list key.""", default=[], metavar=("KEY", "VALUE"), ) action.add_argument( "--prepend", "--add", nargs=2, action="append", help="""Add one configuration value to the beginning of a list key.""", default=[], metavar=("KEY", "VALUE"), ) action.add_argument( "--set", nargs=2, action="append", help="""Set a boolean or string key""", default=[], metavar=("KEY", "VALUE"), ) action.add_argument( "--remove", nargs=2, action="append", help="""Remove a configuration value from a list key. This removes all instances of the value.""", default=[], metavar=("KEY", "VALUE"), ) action.add_argument( "--remove-key", nargs=1, action="append", help="""Remove a configuration key (and all its values).""", default=[], metavar="KEY", ) action.add_argument( "--stdin", action="store_true", help="Apply configuration information given in yaml format piped through stdin.", ) p.add_argument( "-f", "--force", action="store_true", default=NULL, help=SUPPRESS, # TODO: No longer used. Remove in a future release. ) p.set_defaults(func=".main_config.execute")
def configure_parser_config(sub_parsers): descr = ( dedent(""" Modify configuration values in .condarc. This is modeled after the git config command. Writes to the user .condarc file (%s) by default. """) % user_rc_path ) # Note, the extra whitespace in the list keys is on purpose. It's so the # formatting from help2man is still valid YAML (otherwise it line wraps the # keys like "- conda - defaults"). Technically the parser here still won't # recognize it because it removes the indentation, but at least it will be # valid. additional_descr = ( """ See `conda config --describe` or %s/docs/config.html for details on all the options that can go in .condarc. Examples: Display all configuration values as calculated and compiled: conda config --show Display all identified configuration sources: conda config --show-sources Describe all available configuration options: conda config --describe Add the conda-canary channel: conda config --add channels conda-canary Set the output verbosity to level 3 (highest): conda config --set verbosity 3 Get the channels defined in the system .condarc: conda config --get channels --system Add the 'foo' Binstar channel: conda config --add channels foo Disable the 'show_channel_urls' option: conda config --set show_channel_urls no """ % CONDA_HOMEPAGE_URL ) p = sub_parsers.add_parser( "config", description=descr, help=descr, epilog=additional_descr, ) add_parser_json(p) # TODO: use argparse.FileType location = p.add_mutually_exclusive_group() location.add_argument( "--system", action="store_true", help="""Write to the system .condarc file ({system}). Otherwise writes to the user config file ({user}).""".format(system=sys_rc_path, user=user_rc_path), ) location.add_argument( "--env", action="store_true", help="Write to the active conda environment .condarc file (%s). " "If no environment is active, write to the user config file (%s)." "" % (os.getenv("CONDA_PREFIX", "<no active environment>"), user_rc_path), ) location.add_argument( "--file", action="store", help="""Write to the given file. Otherwise writes to the user config file ({user}) or the file path given by the 'CONDARC' environment variable, if it is set (default: %(default)s).""".format(user=user_rc_path), default=os.environ.get("CONDARC", user_rc_path), ) # XXX: Does this really have to be mutually exclusive. I think the below # code will work even if it is a regular group (although combination of # --add and --remove with the same keys will not be well-defined). action = p.add_mutually_exclusive_group(required=True) action.add_argument( "--show", nargs="*", default=None, help="Display configuration values as calculated and compiled. " "If no arguments given, show information for all configuration values.", ) action.add_argument( "--show-sources", action="store_true", help="Display all identified configuration sources.", ) action.add_argument( "--validate", action="store_true", help="Validate all configuration sources.", ) action.add_argument( "--describe", nargs="*", default=None, help="Describe given configuration parameters. If no arguments given, show " "information for all configuration parameters.", ) action.add_argument( "--write-default", action="store_true", help="Write the default configuration to a file. " "Equivalent to `conda config --describe > ~/.condarc` " "when no --env, --system, or --file flags are given.", ) action.add_argument( "--get", nargs="*", action="store", help="Get a configuration value.", default=None, metavar="KEY", ) action.add_argument( "--append", nargs=2, action="append", help="""Add one configuration value to the end of a list key.""", default=[], metavar=("KEY", "VALUE"), ) action.add_argument( "--prepend", "--add", nargs=2, action="append", help="""Add one configuration value to the beginning of a list key.""", default=[], metavar=("KEY", "VALUE"), ) action.add_argument( "--set", nargs=2, action="append", help="""Set a boolean or string key""", default=[], metavar=("KEY", "VALUE"), ) action.add_argument( "--remove", nargs=2, action="append", help="""Remove a configuration value from a list key. This removes all instances of the value.""", default=[], metavar=("KEY", "VALUE"), ) action.add_argument( "--remove-key", nargs=1, action="append", help="""Remove a configuration key (and all its values).""", default=[], metavar="KEY", ) action.add_argument( "--stdin", action="store_true", help="Apply configuration information given in yaml format piped through stdin.", ) p.add_argument( "-f", "--force", action="store_true", default=NULL, help=SUPPRESS, # TODO: No longer used. Remove in a future release. ) p.set_defaults(func=".main_config.execute")
https://github.com/conda/conda/issues/6645
Traceback (most recent call last): File "E:\Miniconda3\lib\site-packages\conda\exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "E:\Miniconda3\lib\site-packages\conda\cli\main.py", line 71, in _main args = p.parse_args(args[1:]) File "E:\Miniconda3\lib\argparse.py", line 1730, in parse_args args, argv = self.parse_known_args(args, namespace) File "E:\Miniconda3\lib\argparse.py", line 1762, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "E:\Miniconda3\lib\argparse.py", line 1968, in _parse_known_args start_index = consume_optional(start_index) File "E:\Miniconda3\lib\argparse.py", line 1908, in consume_optional take_action(action, args, option_string) File "E:\Miniconda3\lib\argparse.py", line 1836, in take_action action(self, namespace, argument_values, option_string) File "E:\Miniconda3\lib\argparse.py", line 1020, in __call__ parser.print_help() File "E:\Miniconda3\lib\site-packages\conda\cli\conda_argparse.py", line 149, in print_help super(ArgumentParser, self).print_help() File "E:\Miniconda3\lib\argparse.py", line 2362, in print_help self._print_message(self.format_help(), file) File "E:\Miniconda3\lib\argparse.py", line 2346, in format_help return formatter.format_help() File "E:\Miniconda3\lib\argparse.py", line 282, in format_help help = self._root_section.format_help() File "E:\Miniconda3\lib\argparse.py", line 213, in format_help item_help = join([func(*args) for func, args in self.items]) File "E:\Miniconda3\lib\argparse.py", line 213, in <listcomp> item_help = join([func(*args) for func, args in self.items]) File "E:\Miniconda3\lib\argparse.py", line 213, in format_help item_help = join([func(*args) for func, args in self.items]) File "E:\Miniconda3\lib\argparse.py", line 213, in <listcomp> item_help = join([func(*args) for func, args in self.items]) File "E:\Miniconda3\lib\argparse.py", line 531, in _format_action parts.append(self._format_action(subaction)) File "E:\Miniconda3\lib\argparse.py", line 519, in _format_action help_text = self._expand_help(action) File "E:\Miniconda3\lib\argparse.py", line 606, in _expand_help return self._get_help_string(action) % params ValueError: unsupported format character 'U' (0x55) at index 140
ValueError
def revert_actions(prefix, revision=-1, index=None): # TODO: If revision raise a revision error, should always go back to a safe revision # change h = History(prefix) user_requested_specs = itervalues(h.get_requested_specs_map()) try: state = h.get_state(revision) except IndexError: raise CondaIndexError("no such revision: %d" % revision) curr = h.get_state() if state == curr: return UnlinkLinkTransaction() _supplement_index_with_prefix(index, prefix) r = Resolve(index) state = r.dependency_sort({d.name: d for d in (Dist(s) for s in state)}) curr = set(Dist(s) for s in curr) link_dists = tuple(d for d in state if not is_linked(prefix, d)) unlink_dists = set(curr) - set(state) # check whether it is a safe revision for dist in concatv(link_dists, unlink_dists): if dist not in index: from .exceptions import CondaRevisionError msg = "Cannot revert to {}, since {} is not in repodata".format( revision, dist ) raise CondaRevisionError(msg) unlink_precs = tuple(index[d] for d in unlink_dists) link_precs = tuple(index[d] for d in link_dists) stp = PrefixSetup(prefix, unlink_precs, link_precs, (), user_requested_specs) txn = UnlinkLinkTransaction(stp) return txn
def revert_actions(prefix, revision=-1, index=None): # TODO: If revision raise a revision error, should always go back to a safe revision # change h = History(prefix) h.update() user_requested_specs = itervalues(h.get_requested_specs_map()) try: state = h.get_state(revision) except IndexError: raise CondaIndexError("no such revision: %d" % revision) curr = h.get_state() if state == curr: return {} # TODO: return txn with nothing_to_do _supplement_index_with_prefix(index, prefix) r = Resolve(index) state = r.dependency_sort({d.name: d for d in (Dist(s) for s in state)}) curr = set(Dist(s) for s in curr) link_dists = tuple(d for d in state if not is_linked(prefix, d)) unlink_dists = set(curr) - set(state) # dists = (Dist(s) for s in state) # actions = ensure_linked_actions(dists, prefix) # for dist in curr - state: # add_unlink(actions, Dist(dist)) # check whether it is a safe revision for dist in concatv(link_dists, unlink_dists): if dist not in index: from .exceptions import CondaRevisionError msg = "Cannot revert to {}, since {} is not in repodata".format( revision, dist ) raise CondaRevisionError(msg) unlink_precs = tuple(index[d] for d in unlink_dists) link_precs = tuple(index[d] for d in link_dists) stp = PrefixSetup(prefix, unlink_precs, link_precs, (), user_requested_specs) txn = UnlinkLinkTransaction(stp) return txn
https://github.com/conda/conda/issues/6628
error: AttributeError("'dict' object has no attribute 'get_pfe'",) command: C:\Program Files\Anaconda3\Scripts\conda install --revision 4 user_agent: conda/4.4.4 requests/2.18.4 CPython/3.5.2 Windows/8.1 Windows/6.3.9600 _messageid: -9223372036843575560 _messagetime: 1514442489595 / 2017-12-28 00:28:09 Traceback (most recent call last): File "C:\Program Files\Anaconda3\lib\site-packages\conda\exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 11, in execute install(args, parser, 'install') File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\install.py", line 232, in install progressive_fetch_extract = unlink_link_transaction.get_pfe() AttributeError: 'dict' object has no attribute 'get_pfe'
AttributeError
def handle_exception(self, exc_val, exc_tb): return_code = getattr(exc_val, "return_code", None) if return_code == 0: return 0 if isinstance(exc_val, CondaError): return self.handle_application_exception(exc_val, exc_tb) if isinstance(exc_val, UnicodeError) and PY2: return self.handle_application_exception(EncodingError(exc_val), exc_tb) if isinstance(exc_val, EnvironmentError): if getattr(exc_val, "errno", None) == ENOSPC: return self.handle_application_exception(NoSpaceLeftError(exc_val), exc_tb) if isinstance(exc_val, MemoryError): return self.handle_application_exception(CondaMemoryError(exc_val), exc_tb) if isinstance(exc_val, KeyboardInterrupt): self._print_conda_exception(CondaError("KeyboardInterrupt"), _format_exc()) return 1 if isinstance(exc_val, SystemExit): return exc_val.code return self.handle_unexpected_exception(exc_val, exc_tb)
def handle_exception(self, exc_val, exc_tb): return_code = getattr(exc_val, "return_code", None) if return_code == 0: return 0 if isinstance(exc_val, CondaError): return self.handle_application_exception(exc_val, exc_tb) if isinstance(exc_val, UnicodeError) and PY2: return self.handle_application_exception(EncodingError(exc_val), exc_tb) if isinstance(exc_val, EnvironmentError): if getattr(exc_val, "errno", None) == ENOSPC: return self.handle_application_exception(NoSpaceLeftError(exc_val), exc_tb) if isinstance(exc_val, KeyboardInterrupt): self._print_conda_exception(CondaError("KeyboardInterrupt"), _format_exc()) return 1 if isinstance(exc_val, SystemExit): return exc_val.code return self.handle_unexpected_exception(exc_val, exc_tb)
https://github.com/conda/conda/issues/6699
error: MemoryError() command: C:\Users\Jason\Anaconda3\Scripts\conda install rise user_agent: conda/4.4.7 requests/2.18.4 CPython/3.6.3 Windows/10 Windows/10.0.16299 _messageid: -9223372036837525402 _messagetime: 1515517517366 / 2018-01-09 11:05:17 MemoryError During handling of the above exception, another exception occurred: MemoryError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\exceptions.py", line 743, in __call__ return func(*args, **kwargs) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 11, in execute install(args, parser, 'install') File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\cli\install.py", line 236, in install force_reinstall=context.force, File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\solve.py", line 437, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\solve.py", line 145, in solve_final_state solution = tuple(Dist(d) for d in prefix_data.iter_records()) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\linked_data.py", line 90, in iter_records return itervalues(self._prefix_records) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\linked_data.py", line 110, in _prefix_records return self.__prefix_records or self.load() or self.__prefix_records File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\linked_data.py", line 48, in load self._load_single_record(meta_file) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\linked_data.py", line 116, in _load_single_record prefix_record = PrefixRecord(**json_data) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 718, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 735, in __init__ setattr(self, key, kwargs[key]) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 427, in __set__ instance.__dict__[self.name] = self.validate(instance, self.box(instance, instance.__class__, val)) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 666, in box return self._type(**val) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 718, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 735, in __init__ setattr(self, key, kwargs[key]) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 427, in __set__ instance.__dict__[self.name] = self.validate(instance, self.box(instance, instance.__class__, val)) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 590, in box return self._type(v if isinstance(v, et) else et(**v) for v in val) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 590, in <genexpr> return self._type(v if isinstance(v, et) else et(**v) for v in val) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 718, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) MemoryError
MemoryError
def __init__(self, shell, arguments=None): self.shell = shell self._raw_arguments = arguments if PY2: self.environ = { ensure_fs_path_encoding(k): ensure_fs_path_encoding(v) for k, v in iteritems(os.environ) } else: self.environ = os.environ.copy() if shell == "posix": self.pathsep_join = ":".join self.path_conversion = native_path_to_unix self.script_extension = ".sh" self.tempfile_extension = ( None # write instructions to stdout rather than a temp file ) self.shift_args = 0 self.command_join = "\n" self.unset_var_tmpl = "unset %s" self.export_var_tmpl = "export %s='%s'" self.set_var_tmpl = "%s='%s'" self.run_script_tmpl = '. "%s"' elif shell == "csh": self.pathsep_join = ":".join self.path_conversion = native_path_to_unix self.script_extension = ".csh" self.tempfile_extension = ( None # write instructions to stdout rather than a temp file ) self.shift_args = 0 self.command_join = ";\n" self.unset_var_tmpl = "unset %s" self.export_var_tmpl = 'setenv %s "%s"' self.set_var_tmpl = "set %s='%s'" self.run_script_tmpl = 'source "%s"' elif shell == "xonsh": self.pathsep_join = ":".join self.path_conversion = native_path_to_unix self.script_extension = ".xsh" self.tempfile_extension = ".xsh" self.shift_args = 0 self.command_join = "\n" self.unset_var_tmpl = "del $%s" self.export_var_tmpl = "$%s = '%s'" self.run_script_tmpl = 'source "%s"' elif shell == "cmd.exe": self.pathsep_join = ";".join self.path_conversion = path_identity self.script_extension = ".bat" self.tempfile_extension = ".bat" self.shift_args = 1 self.command_join = "\n" self.unset_var_tmpl = "@SET %s=" self.export_var_tmpl = '@SET "%s=%s"' self.run_script_tmpl = '@CALL "%s"' elif shell == "fish": self.pathsep_join = '" "'.join self.path_conversion = native_path_to_unix self.script_extension = ".fish" self.tempfile_extension = ( None # write instructions to stdout rather than a temp file ) self.shift_args = 0 self.command_join = ";\n" self.unset_var_tmpl = "set -e %s" self.export_var_tmpl = 'set -gx %s "%s"' self.run_script_tmpl = 'source "%s"' elif shell == "powershell": self.pathsep_join = ";".join self.path_conversion = path_identity self.script_extension = ".ps1" self.tempfile_extension = ( None # write instructions to stdout rather than a temp file ) self.shift_args = 0 self.command_join = "\n" self.unset_var_tmpl = "Remove-Variable %s" self.export_var_tmpl = '$env:%s = "%s"' self.run_script_tmpl = '. "%s"' else: raise NotImplementedError()
def __init__(self, shell, arguments=None): self.shell = shell self._raw_arguments = arguments if shell == "posix": self.pathsep_join = ":".join self.path_conversion = native_path_to_unix self.script_extension = ".sh" self.tempfile_extension = ( None # write instructions to stdout rather than a temp file ) self.shift_args = 0 self.command_join = "\n" self.unset_var_tmpl = "unset %s" self.export_var_tmpl = "export %s='%s'" self.set_var_tmpl = "%s='%s'" self.run_script_tmpl = '. "%s"' elif shell == "csh": self.pathsep_join = ":".join self.path_conversion = native_path_to_unix self.script_extension = ".csh" self.tempfile_extension = ( None # write instructions to stdout rather than a temp file ) self.shift_args = 0 self.command_join = ";\n" self.unset_var_tmpl = "unset %s" self.export_var_tmpl = 'setenv %s "%s"' self.set_var_tmpl = "set %s='%s'" self.run_script_tmpl = 'source "%s"' elif shell == "xonsh": self.pathsep_join = ":".join self.path_conversion = native_path_to_unix self.script_extension = ".xsh" self.tempfile_extension = ".xsh" self.shift_args = 0 self.command_join = "\n" self.unset_var_tmpl = "del $%s" self.export_var_tmpl = "$%s = '%s'" self.run_script_tmpl = 'source "%s"' elif shell == "cmd.exe": self.pathsep_join = ";".join self.path_conversion = path_identity self.script_extension = ".bat" self.tempfile_extension = ".bat" self.shift_args = 1 self.command_join = "\n" self.unset_var_tmpl = "@SET %s=" self.export_var_tmpl = '@SET "%s=%s"' self.run_script_tmpl = '@CALL "%s"' elif shell == "fish": self.pathsep_join = '" "'.join self.path_conversion = native_path_to_unix self.script_extension = ".fish" self.tempfile_extension = ( None # write instructions to stdout rather than a temp file ) self.shift_args = 0 self.command_join = ";\n" self.unset_var_tmpl = "set -e %s" self.export_var_tmpl = 'set -gx %s "%s"' self.run_script_tmpl = 'source "%s"' elif shell == "powershell": self.pathsep_join = ";".join self.path_conversion = path_identity self.script_extension = ".ps1" self.tempfile_extension = ( None # write instructions to stdout rather than a temp file ) self.shift_args = 0 self.command_join = "\n" self.unset_var_tmpl = "Remove-Variable %s" self.export_var_tmpl = '$env:%s = "%s"' self.run_script_tmpl = '. "%s"' else: raise NotImplementedError()
https://github.com/conda/conda/issues/6739
Traceback (most recent call last): File "/anaconda/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/anaconda/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 513 Logged from file exceptions.py, line 724
ValueError
def build_activate(self, env_name_or_prefix): if re.search(r"\\|/", env_name_or_prefix): prefix = expand(env_name_or_prefix) if not isdir(join(prefix, "conda-meta")): from .exceptions import EnvironmentLocationNotFound raise EnvironmentLocationNotFound(prefix) elif env_name_or_prefix in (ROOT_ENV_NAME, "root"): prefix = context.root_prefix else: prefix = locate_prefix_by_name(env_name_or_prefix) prefix = normpath(prefix) # query environment old_conda_shlvl = int(self.environ.get("CONDA_SHLVL", 0)) old_conda_prefix = self.environ.get("CONDA_PREFIX") max_shlvl = context.max_shlvl if old_conda_prefix == prefix: return self.build_reactivate() if self.environ.get("CONDA_PREFIX_%s" % (old_conda_shlvl - 1)) == prefix: # in this case, user is attempting to activate the previous environment, # i.e. step back down return self.build_deactivate() activate_scripts = self._get_activate_scripts(prefix) conda_default_env = self._default_env(prefix) conda_prompt_modifier = self._prompt_modifier(conda_default_env) assert 0 <= old_conda_shlvl <= max_shlvl set_vars = {} if old_conda_shlvl == 0: new_path = self.pathsep_join(self._add_prefix_to_path(prefix)) export_vars = { "CONDA_PYTHON_EXE": self.path_conversion(sys.executable), "PATH": new_path, "CONDA_PREFIX": prefix, "CONDA_SHLVL": old_conda_shlvl + 1, "CONDA_DEFAULT_ENV": conda_default_env, "CONDA_PROMPT_MODIFIER": conda_prompt_modifier, } deactivate_scripts = () elif old_conda_shlvl == max_shlvl: new_path = self.pathsep_join( self._replace_prefix_in_path(old_conda_prefix, prefix) ) export_vars = { "PATH": new_path, "CONDA_PREFIX": prefix, "CONDA_DEFAULT_ENV": conda_default_env, "CONDA_PROMPT_MODIFIER": conda_prompt_modifier, } deactivate_scripts = self._get_deactivate_scripts(old_conda_prefix) else: new_path = self.pathsep_join(self._add_prefix_to_path(prefix)) export_vars = { "PATH": new_path, "CONDA_PREFIX": prefix, "CONDA_PREFIX_%d" % old_conda_shlvl: old_conda_prefix, "CONDA_SHLVL": old_conda_shlvl + 1, "CONDA_DEFAULT_ENV": conda_default_env, "CONDA_PROMPT_MODIFIER": conda_prompt_modifier, } deactivate_scripts = () self._update_prompt(set_vars, conda_prompt_modifier) if on_win and self.shell == "cmd.exe": import ctypes export_vars.update( { "PYTHONIOENCODING": ctypes.cdll.kernel32.GetACP(), } ) return { "unset_vars": (), "set_vars": set_vars, "export_vars": export_vars, "deactivate_scripts": deactivate_scripts, "activate_scripts": activate_scripts, }
def build_activate(self, env_name_or_prefix): if re.search(r"\\|/", env_name_or_prefix): prefix = expand(env_name_or_prefix) if not isdir(join(prefix, "conda-meta")): from .exceptions import EnvironmentLocationNotFound raise EnvironmentLocationNotFound(prefix) elif env_name_or_prefix in (ROOT_ENV_NAME, "root"): prefix = context.root_prefix else: prefix = locate_prefix_by_name(env_name_or_prefix) prefix = normpath(prefix) # query environment old_conda_shlvl = int(os.getenv("CONDA_SHLVL", 0)) old_conda_prefix = os.getenv("CONDA_PREFIX") max_shlvl = context.max_shlvl if old_conda_prefix == prefix: return self.build_reactivate() if os.getenv("CONDA_PREFIX_%s" % (old_conda_shlvl - 1)) == prefix: # in this case, user is attempting to activate the previous environment, # i.e. step back down return self.build_deactivate() activate_scripts = self._get_activate_scripts(prefix) conda_default_env = self._default_env(prefix) conda_prompt_modifier = self._prompt_modifier(conda_default_env) assert 0 <= old_conda_shlvl <= max_shlvl set_vars = {} if old_conda_shlvl == 0: new_path = self.pathsep_join(self._add_prefix_to_path(prefix)) export_vars = { "CONDA_PYTHON_EXE": self.path_conversion(sys.executable), "PATH": new_path, "CONDA_PREFIX": prefix, "CONDA_SHLVL": old_conda_shlvl + 1, "CONDA_DEFAULT_ENV": conda_default_env, "CONDA_PROMPT_MODIFIER": conda_prompt_modifier, } deactivate_scripts = () elif old_conda_shlvl == max_shlvl: new_path = self.pathsep_join( self._replace_prefix_in_path(old_conda_prefix, prefix) ) export_vars = { "PATH": new_path, "CONDA_PREFIX": prefix, "CONDA_DEFAULT_ENV": conda_default_env, "CONDA_PROMPT_MODIFIER": conda_prompt_modifier, } deactivate_scripts = self._get_deactivate_scripts(old_conda_prefix) else: new_path = self.pathsep_join(self._add_prefix_to_path(prefix)) export_vars = { "PATH": new_path, "CONDA_PREFIX": prefix, "CONDA_PREFIX_%d" % old_conda_shlvl: old_conda_prefix, "CONDA_SHLVL": old_conda_shlvl + 1, "CONDA_DEFAULT_ENV": conda_default_env, "CONDA_PROMPT_MODIFIER": conda_prompt_modifier, } deactivate_scripts = () self._update_prompt(set_vars, conda_prompt_modifier) if on_win and self.shell == "cmd.exe": import ctypes export_vars.update( { "PYTHONIOENCODING": ctypes.cdll.kernel32.GetACP(), } ) return { "unset_vars": (), "set_vars": set_vars, "export_vars": export_vars, "deactivate_scripts": deactivate_scripts, "activate_scripts": activate_scripts, }
https://github.com/conda/conda/issues/6739
Traceback (most recent call last): File "/anaconda/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/anaconda/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 513 Logged from file exceptions.py, line 724
ValueError
def build_deactivate(self): # query environment old_conda_shlvl = int(self.environ.get("CONDA_SHLVL", 0)) old_conda_prefix = self.environ.get("CONDA_PREFIX", None) if old_conda_shlvl <= 0 or old_conda_prefix is None: return { "unset_vars": (), "set_vars": {}, "export_vars": {}, "deactivate_scripts": (), "activate_scripts": (), } deactivate_scripts = self._get_deactivate_scripts(old_conda_prefix) new_conda_shlvl = old_conda_shlvl - 1 new_path = self.pathsep_join(self._remove_prefix_from_path(old_conda_prefix)) assert old_conda_shlvl > 0 set_vars = {} if old_conda_shlvl == 1: # TODO: warn conda floor conda_prompt_modifier = "" unset_vars = ( "CONDA_PREFIX", "CONDA_DEFAULT_ENV", "CONDA_PYTHON_EXE", "CONDA_PROMPT_MODIFIER", ) export_vars = { "PATH": new_path, "CONDA_SHLVL": new_conda_shlvl, } activate_scripts = () else: new_prefix = self.environ.get("CONDA_PREFIX_%d" % new_conda_shlvl) conda_default_env = self._default_env(new_prefix) conda_prompt_modifier = self._prompt_modifier(conda_default_env) unset_vars = ("CONDA_PREFIX_%d" % new_conda_shlvl,) export_vars = { "PATH": new_path, "CONDA_SHLVL": new_conda_shlvl, "CONDA_PREFIX": new_prefix, "CONDA_DEFAULT_ENV": conda_default_env, "CONDA_PROMPT_MODIFIER": conda_prompt_modifier, } activate_scripts = self._get_activate_scripts(new_prefix) self._update_prompt(set_vars, conda_prompt_modifier) return { "unset_vars": unset_vars, "set_vars": set_vars, "export_vars": export_vars, "deactivate_scripts": deactivate_scripts, "activate_scripts": activate_scripts, }
def build_deactivate(self): # query environment old_conda_shlvl = int(os.getenv("CONDA_SHLVL", 0)) old_conda_prefix = os.getenv("CONDA_PREFIX", None) if old_conda_shlvl <= 0 or old_conda_prefix is None: return { "unset_vars": (), "set_vars": {}, "export_vars": {}, "deactivate_scripts": (), "activate_scripts": (), } deactivate_scripts = self._get_deactivate_scripts(old_conda_prefix) new_conda_shlvl = old_conda_shlvl - 1 new_path = self.pathsep_join(self._remove_prefix_from_path(old_conda_prefix)) assert old_conda_shlvl > 0 set_vars = {} if old_conda_shlvl == 1: # TODO: warn conda floor conda_prompt_modifier = "" unset_vars = ( "CONDA_PREFIX", "CONDA_DEFAULT_ENV", "CONDA_PYTHON_EXE", "CONDA_PROMPT_MODIFIER", ) export_vars = { "PATH": new_path, "CONDA_SHLVL": new_conda_shlvl, } activate_scripts = () else: new_prefix = os.getenv("CONDA_PREFIX_%d" % new_conda_shlvl) conda_default_env = self._default_env(new_prefix) conda_prompt_modifier = self._prompt_modifier(conda_default_env) unset_vars = ("CONDA_PREFIX_%d" % new_conda_shlvl,) export_vars = { "PATH": new_path, "CONDA_SHLVL": new_conda_shlvl, "CONDA_PREFIX": new_prefix, "CONDA_DEFAULT_ENV": conda_default_env, "CONDA_PROMPT_MODIFIER": conda_prompt_modifier, } activate_scripts = self._get_activate_scripts(new_prefix) self._update_prompt(set_vars, conda_prompt_modifier) return { "unset_vars": unset_vars, "set_vars": set_vars, "export_vars": export_vars, "deactivate_scripts": deactivate_scripts, "activate_scripts": activate_scripts, }
https://github.com/conda/conda/issues/6739
Traceback (most recent call last): File "/anaconda/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/anaconda/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 513 Logged from file exceptions.py, line 724
ValueError
def build_reactivate(self): conda_prefix = self.environ.get("CONDA_PREFIX") conda_shlvl = int(self.environ.get("CONDA_SHLVL", -1)) if not conda_prefix or conda_shlvl < 1: # no active environment, so cannot reactivate; do nothing return { "unset_vars": (), "set_vars": {}, "export_vars": {}, "deactivate_scripts": (), "activate_scripts": (), } conda_default_env = self.environ.get( "CONDA_DEFAULT_ENV", self._default_env(conda_prefix) ) # environment variables are set only to aid transition from conda 4.3 to conda 4.4 return { "unset_vars": (), "set_vars": {}, "export_vars": { "CONDA_SHLVL": conda_shlvl, "CONDA_PROMPT_MODIFIER": self._prompt_modifier(conda_default_env), }, "deactivate_scripts": self._get_deactivate_scripts(conda_prefix), "activate_scripts": self._get_activate_scripts(conda_prefix), }
def build_reactivate(self): conda_prefix = os.environ.get("CONDA_PREFIX") conda_shlvl = int(os.environ.get("CONDA_SHLVL", -1)) if not conda_prefix or conda_shlvl < 1: # no active environment, so cannot reactivate; do nothing return { "unset_vars": (), "set_vars": {}, "export_vars": {}, "deactivate_scripts": (), "activate_scripts": (), } conda_default_env = os.environ.get( "CONDA_DEFAULT_ENV", self._default_env(conda_prefix) ) # environment variables are set only to aid transition from conda 4.3 to conda 4.4 return { "unset_vars": (), "set_vars": {}, "export_vars": { "CONDA_SHLVL": conda_shlvl, "CONDA_PROMPT_MODIFIER": self._prompt_modifier(conda_default_env), }, "deactivate_scripts": self._get_deactivate_scripts(conda_prefix), "activate_scripts": self._get_activate_scripts(conda_prefix), }
https://github.com/conda/conda/issues/6739
Traceback (most recent call last): File "/anaconda/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/anaconda/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 513 Logged from file exceptions.py, line 724
ValueError
def _get_starting_path_list(self): path = self.environ["PATH"] if on_win: # On Windows, the Anaconda Python interpreter prepends sys.prefix\Library\bin on # startup. It's a hack that allows users to avoid using the correct activation # procedure; a hack that needs to go away because it doesn't add all the paths. # See: https://github.com/AnacondaRecipes/python-feedstock/blob/master/recipe/0005-Win32-Ensure-Library-bin-is-in-os.environ-PATH.patch # NOQA # But, we now detect if that has happened because: # 1. In future we would like to remove this hack and require real activation. # 2. We should not assume that the Anaconda Python interpreter is being used. path_split = path.split(os.pathsep) library_bin = r"%s\Library\bin" % (sys.prefix) # ^^^ deliberately the same as: https://github.com/AnacondaRecipes/python-feedstock/blob/8e8aee4e2f4141ecfab082776a00b374c62bb6d6/recipe/0005-Win32-Ensure-Library-bin-is-in-os.environ-PATH.patch#L20 # NOQA if normpath(path_split[0]) == normpath(library_bin): return path_split[1:] else: return path_split else: return path.split(os.pathsep)
def _get_starting_path_list(self): path = os.environ["PATH"] if on_win: # On Windows, the Anaconda Python interpreter prepends sys.prefix\Library\bin on # startup. It's a hack that allows users to avoid using the correct activation # procedure; a hack that needs to go away because it doesn't add all the paths. # See: https://github.com/AnacondaRecipes/python-feedstock/blob/master/recipe/0005-Win32-Ensure-Library-bin-is-in-os.environ-PATH.patch # NOQA # But, we now detect if that has happened because: # 1. In future we would like to remove this hack and require real activation. # 2. We should not assume that the Anaconda Python interpreter is being used. path_split = path.split(os.pathsep) library_bin = r"%s\Library\bin" % (sys.prefix) # ^^^ deliberately the same as: https://github.com/AnacondaRecipes/python-feedstock/blob/8e8aee4e2f4141ecfab082776a00b374c62bb6d6/recipe/0005-Win32-Ensure-Library-bin-is-in-os.environ-PATH.patch#L20 # NOQA if normpath(path_split[0]) == normpath(library_bin): return path_split[1:] else: return path_split else: return path.split(os.pathsep)
https://github.com/conda/conda/issues/6739
Traceback (most recent call last): File "/anaconda/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/anaconda/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 513 Logged from file exceptions.py, line 724
ValueError
def _update_prompt(self, set_vars, conda_prompt_modifier): if not context.changeps1: return if self.shell == "posix": ps1 = self.environ.get("PS1", "") current_prompt_modifier = self.environ.get("CONDA_PROMPT_MODIFIER") if current_prompt_modifier: ps1 = re.sub(re.escape(current_prompt_modifier), r"", ps1) # Because we're using single-quotes to set shell variables, we need to handle the # proper escaping of single quotes that are already part of the string. # Best solution appears to be https://stackoverflow.com/a/1250279 ps1 = ps1.replace("'", "'\"'\"'") set_vars.update( { "PS1": conda_prompt_modifier + ps1, } ) elif self.shell == "csh": prompt = self.environ.get("prompt", "") current_prompt_modifier = self.environ.get("CONDA_PROMPT_MODIFIER") if current_prompt_modifier: prompt = re.sub(re.escape(current_prompt_modifier), r"", prompt) set_vars.update( { "prompt": conda_prompt_modifier + prompt, } )
def _update_prompt(self, set_vars, conda_prompt_modifier): if not context.changeps1: return if self.shell == "posix": ps1 = os.environ.get("PS1", "") current_prompt_modifier = os.environ.get("CONDA_PROMPT_MODIFIER") if current_prompt_modifier: ps1 = re.sub(re.escape(current_prompt_modifier), r"", ps1) # Because we're using single-quotes to set shell variables, we need to handle the # proper escaping of single quotes that are already part of the string. # Best solution appears to be https://stackoverflow.com/a/1250279 ps1 = ps1.replace("'", "'\"'\"'") set_vars.update( { "PS1": conda_prompt_modifier + ps1, } ) elif self.shell == "csh": prompt = os.environ.get("prompt", "") current_prompt_modifier = os.environ.get("CONDA_PROMPT_MODIFIER") if current_prompt_modifier: prompt = re.sub(re.escape(current_prompt_modifier), r"", prompt) set_vars.update( { "prompt": conda_prompt_modifier + prompt, } )
https://github.com/conda/conda/issues/6739
Traceback (most recent call last): File "/anaconda/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/anaconda/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 513 Logged from file exceptions.py, line 724
ValueError
def __get__(self, instance, instance_type): try: return super(ChannelField, self).__get__(instance, instance_type) except AttributeError: url = instance.url return self.unbox(instance, instance_type, Channel(url))
def __get__(self, instance, instance_type): try: return super(ChannelField, self).__get__(instance, instance_type) except AttributeError: try: url = instance.url return self.unbox(instance, instance_type, Channel(url)) except AttributeError: return Channel(None)
https://github.com/conda/conda/issues/6537
conda install /scratch/xxx/anaconda/pkgs/conda-build-3.2.0-py27_0.tar.bz2 An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : linux-64 conda version : 4.3.25 conda is private : False conda-env version : 4.3.25 conda-build version : 3.1.3 python version : 2.7.13.final.0 requests version : 2.14.2 root environment : /scratch/xxx/anaconda (writable) default environment : /scratch/xxx/anaconda envs directories : /scratch/xxx/conda-envs /scratch/xxx/anaconda/envs /home/xxx/.conda/envs package cache : /scratch/xxx/anaconda/pkgs /home/xxx/.conda/pkgs channel URLs : file:///scratch/xxx/conda-bld/linux-64 file:///scratch/xxx/conda-bld/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch https://conda.anaconda.org/conda-forge/linux-64 https://conda.anaconda.org/conda-forge/noarch config file : /home/xxx/.condarc netrc file : None offline mode : False user-agent : conda/4.3.25 requests/2.14.2 CPython/2.7.13 Linux/2.6.18-422.el5 Red Hat Enterprise Linux Server/5.11 glibc/2.5 UID:GID : 7679:107679 `$ /scratch/xxx/anaconda/bin/conda install /scratch/xxx/anaconda/pkgs/conda-build-3.2.0-py27_0.tar.bz2` Traceback (most recent call last): File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 640, in conda_exception_handler return_value = func(*args, **kwargs) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 140, in _main exit_code = args.func(args, p) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 210, in install explicit(args_packages, prefix, verbose=not context.quiet) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/misc.py", line 110, in explicit execute_actions(actions, index, verbose=verbose) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/plan.py", line 830, in execute_actions execute_instructions(plan, index, verbose) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 247, in execute_instructions cmd(state, arg) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 107, in UNLINKLINKTRANSACTION_CMD txn = UnlinkLinkTransaction.create_from_dists(index, prefix, unlink_dists, link_dists) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/core/link.py", line 125, in create_from_dists for dist, pkg_dir in zip(link_dists, pkg_dirs_to_link)) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/core/link.py", line 125, in <genexpr> for dist, pkg_dir in zip(link_dists, pkg_dirs_to_link)) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/gateways/disk/read.py", line 95, in read_package_info paths_data=paths_data, File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 702, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 719, in __init__ setattr(self, key, kwargs[key]) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 831, in __setattr__ super(ImmutableEntity, self).__setattr__(attribute, value) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 424, in __set__ instance.__dict__[self.name] = self.validate(instance, self.box(instance, val)) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 465, in validate raise ValidationError(getattr(self, 'name', 'undefined name'), val) ValidationError: Value for url cannot be None.
ValidationError
def extract_tarball( tarball_full_path, destination_directory=None, progress_update_callback=None ): if destination_directory is None: destination_directory = tarball_full_path[:-8] log.debug("extracting %s\n to %s", tarball_full_path, destination_directory) assert not lexists(destination_directory), destination_directory with tarfile.open(tarball_full_path) as t: members = t.getmembers() num_members = len(members) def members_with_progress(): for q, member in enumerate(members): if progress_update_callback: progress_update_callback(q / num_members) yield member try: t.extractall(path=destination_directory, members=members_with_progress()) except EnvironmentError as e: if e.errno == ELOOP: raise CaseInsensitiveFileSystemError( package_location=tarball_full_path, extract_location=destination_directory, caused_by=e, ) else: raise if sys.platform.startswith("linux") and os.getuid() == 0: # When extracting as root, tarfile will by restore ownership # of extracted files. However, we want root to be the owner # (our implementation of --no-same-owner). for root, dirs, files in os.walk(destination_directory): for fn in files: p = join(root, fn) os.lchown(p, 0, 0)
def extract_tarball( tarball_full_path, destination_directory=None, progress_update_callback=None ): if destination_directory is None: destination_directory = tarball_full_path[:-8] log.debug("extracting %s\n to %s", tarball_full_path, destination_directory) assert not lexists(destination_directory), destination_directory with tarfile.open(tarball_full_path) as t: members = t.getmembers() num_members = len(members) def members_with_progress(): for q, member in enumerate(members): if progress_update_callback: progress_update_callback(q / num_members) yield member t.extractall(path=destination_directory, members=members_with_progress()) if sys.platform.startswith("linux") and os.getuid() == 0: # When extracting as root, tarfile will by restore ownership # of extracted files. However, we want root to be the owner # (our implementation of --no-same-owner). for root, dirs, files in os.walk(destination_directory): for fn in files: p = join(root, fn) os.lchown(p, 0, 0)
https://github.com/conda/conda/issues/6514
Traceback (most recent call last): File "/Users/msarahan/miniconda3/bin/c3i", line 11, in <module> load_entry_point('conda-concourse-ci', 'console_scripts', 'c3i')() File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/cli.py", line 123, in main execute.submit_one_off(**args.__dict__) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/execute.py", line 647, in submit_one_off **kwargs) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/execute.py", line 508, in compute_builds variant_config_files=kw.get('variant_config_files', [])) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/execute.py", line 72, in collect_tasks config=config) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/compute_build_graph.py", line 379, in construct_graph recipes_dir, config=config) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/compute_build_graph.py", line 206, in add_recipe_to_graph rendered = _get_or_render_metadata(recipe_dir, worker, config=config) File "/Users/msarahan/miniconda3/lib/python3.6/site-packages/conda/utils.py", line 38, in __call__ return self.func(*args, **kw) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/compute_build_graph.py", line 199, in _get_or_render_metadata bypass_env_check=True, config=config) File "/Users/msarahan/code/conda-build/conda_build/api.py", line 49, in render permit_undefined_jinja=not finalize): File "/Users/msarahan/code/conda-build/conda_build/metadata.py", line 1781, in get_output_metadata_set permit_unsatisfiable_variants=permit_unsatisfiable_variants) File "/Users/msarahan/code/conda-build/conda_build/metadata.py", line 645, in finalize_outputs_pass fm = finalize_metadata(om, permit_unsatisfiable_variants=permit_unsatisfiable_variants) File "/Users/msarahan/code/conda-build/conda_build/render.py", line 387, in finalize_metadata exclude_pattern) File "/Users/msarahan/code/conda-build/conda_build/render.py", line 306, in add_upstream_pins permit_unsatisfiable_variants, exclude_pattern) File "/Users/msarahan/code/conda-build/conda_build/render.py", line 289, in _read_upstream_pin_files extra_run_specs = get_upstream_pins(m, actions, env) File "/Users/msarahan/code/conda-build/conda_build/render.py", line 251, in get_upstream_pins pfe.execute() File "/Users/msarahan/miniconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 494, in execute self._execute_action(action) File "/Users/msarahan/miniconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 515, in _execute_action raise CondaMultiError(exceptions) conda.CondaMultiError: OSError(62, 'Too many levels of symbolic links') OSError(62, 'Too many levels of symbolic links') OSError(62, 'Too many levels of symbolic links')
conda.CondaMultiError
def execute_config(args, parser): json_warnings = [] json_get = {} if args.show_sources: if context.json: print( json.dumps( context.collect_all(), sort_keys=True, indent=2, separators=(",", ": "), ) ) else: lines = [] for source, reprs in iteritems(context.collect_all()): lines.append("==> %s <==" % source) lines.extend(format_dict(reprs)) lines.append("") print("\n".join(lines)) return if args.show is not None: if args.show: paramater_names = args.show all_names = context.list_parameters() not_params = set(paramater_names) - set(all_names) if not_params: from ..exceptions import ArgumentError from ..resolve import dashlist raise ArgumentError( "Invalid configuration parameters: %s" % dashlist(not_params) ) else: paramater_names = context.list_parameters() from collections import OrderedDict d = OrderedDict((key, getattr(context, key)) for key in paramater_names) if context.json: print( json.dumps( d, sort_keys=True, indent=2, separators=(",", ": "), cls=EntityEncoder, ) ) else: # coerce channels if "custom_channels" in d: d["custom_channels"] = { channel.name: "%s://%s" % (channel.scheme, channel.location) for channel in itervalues(d["custom_channels"]) } # TODO: custom_multichannels needs better formatting if "custom_multichannels" in d: d["custom_multichannels"] = { k: json.dumps([text_type(c) for c in chnls]) for k, chnls in iteritems(d["custom_multichannels"]) } print("\n".join(format_dict(d))) context.validate_configuration() return if args.describe is not None: if args.describe: paramater_names = args.describe all_names = context.list_parameters() not_params = set(paramater_names) - set(all_names) if not_params: from ..exceptions import ArgumentError from ..resolve import dashlist raise ArgumentError( "Invalid configuration parameters: %s" % dashlist(not_params) ) else: paramater_names = context.list_parameters() if context.json: print( json.dumps( [context.describe_parameter(name) for name in paramater_names], sort_keys=True, indent=2, separators=(",", ": "), cls=EntityEncoder, ) ) else: print( "\n".join( concat( parameter_description_builder(name) for name in paramater_names ) ) ) return if args.validate: context.validate_all() return if args.system: rc_path = sys_rc_path elif args.env: if "CONDA_PREFIX" in os.environ: rc_path = join(os.environ["CONDA_PREFIX"], ".condarc") else: rc_path = user_rc_path elif args.file: rc_path = args.file else: rc_path = user_rc_path if args.write_default: if isfile(rc_path): with open(rc_path) as fh: data = fh.read().strip() if data: raise CondaError( "The file '%s' " "already contains configuration information.\n" "Remove the file to proceed.\n" "Use `conda config --describe` to display default configuration." % rc_path ) with open(rc_path, "w") as fh: paramater_names = context.list_parameters() fh.write( "\n".join( concat( parameter_description_builder(name) for name in paramater_names ) ) ) return # read existing condarc if os.path.exists(rc_path): with open(rc_path, "r") as fh: rc_config = yaml_load(fh) or {} else: rc_config = {} grouped_paramaters = groupby( lambda p: context.describe_parameter(p)["parameter_type"], context.list_parameters(), ) primitive_parameters = grouped_paramaters["primitive"] sequence_parameters = grouped_paramaters["sequence"] map_parameters = grouped_paramaters["map"] # Get if args.get is not None: context.validate_all() if args.get == []: args.get = sorted(rc_config.keys()) for key in args.get: if key not in primitive_parameters + sequence_parameters: message = "unknown key %s" % key if not context.json: print(message, file=sys.stderr) else: json_warnings.append(message) continue if key not in rc_config: continue if context.json: json_get[key] = rc_config[key] continue if isinstance(rc_config[key], (bool, string_types)): print("--set", key, rc_config[key]) else: # assume the key is a list-type # Note, since conda config --add prepends, these are printed in # the reverse order so that entering them in this order will # recreate the same file items = rc_config.get(key, []) numitems = len(items) for q, item in enumerate(reversed(items)): # Use repr so that it can be pasted back in to conda config --add if key == "channels" and q in (0, numitems - 1): print( "--add", key, repr(item), " # lowest priority" if q == 0 else " # highest priority", ) else: print("--add", key, repr(item)) if args.stdin: content = timeout(5, sys.stdin.read) if not content: return try: parsed = yaml_load(content) rc_config.update(parsed) except Exception: # pragma: no cover from ..exceptions import ParseError raise ParseError("invalid yaml content:\n%s" % content) # prepend, append, add for arg, prepend in zip((args.prepend, args.append), (True, False)): for key, item in arg: if key == "channels" and key not in rc_config: rc_config[key] = ["defaults"] if key not in sequence_parameters: from ..exceptions import CondaValueError raise CondaValueError( "Key '%s' is not a known sequence parameter." % key ) if not isinstance(rc_config.get(key, []), list): from ..exceptions import CouldntParseError bad = rc_config[key].__class__.__name__ raise CouldntParseError("key %r should be a list, not %s." % (key, bad)) arglist = rc_config.setdefault(key, []) if item in arglist: # Right now, all list keys should not contain duplicates message = "Warning: '%s' already in '%s' list, moving to the %s" % ( item, key, "top" if prepend else "bottom", ) arglist = rc_config[key] = [p for p in arglist if p != item] if not context.json: print(message, file=sys.stderr) else: json_warnings.append(message) arglist.insert(0 if prepend else len(arglist), item) # Set for key, item in args.set: key, subkey = key.split(".", 1) if "." in key else (key, None) if key in primitive_parameters: value = context.typify_parameter(key, item) rc_config[key] = value elif key in map_parameters: argmap = rc_config.setdefault(key, {}) argmap[subkey] = item else: from ..exceptions import CondaValueError raise CondaValueError("Key '%s' is not a known primitive parameter." % key) # Remove for key, item in args.remove: key, subkey = key.split(".", 1) if "." in key else (key, None) if key not in rc_config: if key != "channels": from ..exceptions import CondaKeyError raise CondaKeyError(key, "key %r is not in the config file" % key) rc_config[key] = ["defaults"] if item not in rc_config[key]: from ..exceptions import CondaKeyError raise CondaKeyError( key, "%r is not in the %r key of the config file" % (item, key) ) rc_config[key] = [i for i in rc_config[key] if i != item] # Remove Key for (key,) in args.remove_key: key, subkey = key.split(".", 1) if "." in key else (key, None) if key not in rc_config: from ..exceptions import CondaKeyError raise CondaKeyError(key, "key %r is not in the config file" % key) del rc_config[key] # config.rc_keys if not args.get: # Add representers for enums. # Because a representer cannot be added for the base Enum class (it must be added for # each specific Enum subclass), and because of import rules), I don't know of a better # location to do this. def enum_representer(dumper, data): return dumper.represent_str(str(data)) yaml.representer.RoundTripRepresenter.add_representer( SafetyChecks, enum_representer ) yaml.representer.RoundTripRepresenter.add_representer( PathConflict, enum_representer ) try: with open(rc_path, "w") as rc: rc.write(yaml_dump(rc_config)) except (IOError, OSError) as e: raise CondaError( "Cannot write to condarc file at %s\nCaused by %r" % (rc_path, e) ) if context.json: from .common import stdout_json_success stdout_json_success(rc_path=rc_path, warnings=json_warnings, get=json_get) return
def execute_config(args, parser): json_warnings = [] json_get = {} if args.show_sources: if context.json: print( json.dumps( context.collect_all(), sort_keys=True, indent=2, separators=(",", ": "), ) ) else: lines = [] for source, reprs in iteritems(context.collect_all()): lines.append("==> %s <==" % source) lines.extend(format_dict(reprs)) lines.append("") print("\n".join(lines)) return if args.show is not None: if args.show: paramater_names = args.show all_names = context.list_parameters() not_params = set(paramater_names) - set(all_names) if not_params: from ..exceptions import ArgumentError from ..resolve import dashlist raise ArgumentError( "Invalid configuration parameters: %s" % dashlist(not_params) ) else: paramater_names = context.list_parameters() from collections import OrderedDict d = OrderedDict((key, getattr(context, key)) for key in paramater_names) if context.json: print( json.dumps( d, sort_keys=True, indent=2, separators=(",", ": "), cls=EntityEncoder, ) ) else: # coerce channels if "custom_channels" in d: d["custom_channels"] = { channel.name: "%s://%s" % (channel.scheme, channel.location) for channel in itervalues(d["custom_channels"]) } # TODO: custom_multichannels needs better formatting if "custom_multichannels" in d: d["custom_multichannels"] = { k: json.dumps([text_type(c) for c in chnls]) for k, chnls in iteritems(d["custom_multichannels"]) } print("\n".join(format_dict(d))) context.validate_configuration() return if args.describe is not None: if args.describe: paramater_names = args.describe all_names = context.list_parameters() not_params = set(paramater_names) - set(all_names) if not_params: from ..exceptions import ArgumentError from ..resolve import dashlist raise ArgumentError( "Invalid configuration parameters: %s" % dashlist(not_params) ) else: paramater_names = context.list_parameters() if context.json: print( json.dumps( [context.describe_parameter(name) for name in paramater_names], sort_keys=True, indent=2, separators=(",", ": "), cls=EntityEncoder, ) ) else: print( "\n".join( concat( parameter_description_builder(name) for name in paramater_names ) ) ) return if args.validate: context.validate_all() return if args.system: rc_path = sys_rc_path elif args.env: if "CONDA_PREFIX" in os.environ: rc_path = join(os.environ["CONDA_PREFIX"], ".condarc") else: rc_path = user_rc_path elif args.file: rc_path = args.file else: rc_path = user_rc_path if args.write_default: if isfile(rc_path): with open(rc_path) as fh: data = fh.read().strip() if data: raise CondaError( "The file '%s' " "already contains configuration information.\n" "Remove the file to proceed.\n" "Use `conda config --describe` to display default configuration." % rc_path ) with open(rc_path, "w") as fh: paramater_names = context.list_parameters() fh.write( "\n".join( concat( parameter_description_builder(name) for name in paramater_names ) ) ) return # read existing condarc if os.path.exists(rc_path): with open(rc_path, "r") as fh: rc_config = yaml_load(fh) or {} else: rc_config = {} grouped_paramaters = groupby( lambda p: context.describe_parameter(p)["parameter_type"], context.list_parameters(), ) primitive_parameters = grouped_paramaters["primitive"] sequence_parameters = grouped_paramaters["sequence"] map_parameters = grouped_paramaters["map"] # Get if args.get is not None: context.validate_all() if args.get == []: args.get = sorted(rc_config.keys()) for key in args.get: if key not in primitive_parameters + sequence_parameters: message = "unknown key %s" % key if not context.json: print(message, file=sys.stderr) else: json_warnings.append(message) continue if key not in rc_config: continue if context.json: json_get[key] = rc_config[key] continue if isinstance(rc_config[key], (bool, string_types)): print("--set", key, rc_config[key]) else: # assume the key is a list-type # Note, since conda config --add prepends, these are printed in # the reverse order so that entering them in this order will # recreate the same file items = rc_config.get(key, []) numitems = len(items) for q, item in enumerate(reversed(items)): # Use repr so that it can be pasted back in to conda config --add if key == "channels" and q in (0, numitems - 1): print( "--add", key, repr(item), " # lowest priority" if q == 0 else " # highest priority", ) else: print("--add", key, repr(item)) if args.stdin: content = timeout(5, sys.stdin.read) if not content: return try: parsed = yaml_load(content) rc_config.update(parsed) except Exception: # pragma: no cover from ..exceptions import ParseError raise ParseError("invalid yaml content:\n%s" % content) # prepend, append, add for arg, prepend in zip((args.prepend, args.append), (True, False)): for key, item in arg: if key == "channels" and key not in rc_config: rc_config[key] = ["defaults"] if key not in sequence_parameters: from ..exceptions import CondaValueError raise CondaValueError( "Key '%s' is not a known sequence parameter." % key ) if not isinstance(rc_config.get(key, []), list): from ..exceptions import CouldntParseError bad = rc_config[key].__class__.__name__ raise CouldntParseError("key %r should be a list, not %s." % (key, bad)) arglist = rc_config.setdefault(key, []) if item in arglist: # Right now, all list keys should not contain duplicates message = "Warning: '%s' already in '%s' list, moving to the %s" % ( item, key, "top" if prepend else "bottom", ) arglist = rc_config[key] = [p for p in arglist if p != item] if not context.json: print(message, file=sys.stderr) else: json_warnings.append(message) arglist.insert(0 if prepend else len(arglist), item) # Set for key, item in args.set: key, subkey = key.split(".", 1) if "." in key else (key, None) if key in primitive_parameters: value = context.typify_parameter(key, item) rc_config[key] = value elif key in map_parameters: argmap = rc_config.setdefault(key, {}) argmap[subkey] = item else: from ..exceptions import CondaValueError raise CondaValueError("Key '%s' is not a known primitive parameter." % key) # Remove for key, item in args.remove: key, subkey = key.split(".", 1) if "." in key else (key, None) if key not in rc_config: if key != "channels": from ..exceptions import CondaKeyError raise CondaKeyError(key, "key %r is not in the config file" % key) rc_config[key] = ["defaults"] if item not in rc_config[key]: from ..exceptions import CondaKeyError raise CondaKeyError( key, "%r is not in the %r key of the config file" % (item, key) ) rc_config[key] = [i for i in rc_config[key] if i != item] # Remove Key for (key,) in args.remove_key: key, subkey = key.split(".", 1) if "." in key else (key, None) if key not in rc_config: from ..exceptions import CondaKeyError raise CondaKeyError(key, "key %r is not in the config file" % key) del rc_config[key] # config.rc_keys if not args.get: try: with open(rc_path, "w") as rc: rc.write(yaml_dump(rc_config)) except (IOError, OSError) as e: raise CondaError( "Cannot write to condarc file at %s\nCaused by %r" % (rc_path, e) ) if context.json: from .common import stdout_json_success stdout_json_success(rc_path=rc_path, warnings=json_warnings, get=json_get) return
https://github.com/conda/conda/issues/6618
error: RepresenterError('cannot represent an object: prevent',) command: C:\tools\Anaconda3\Scripts\conda config --set path_conflict prevent user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Windows/10 Windows/10.0.16299 _messageid: -9223372036843225525 _messagetime: 1514570427640 / 2017-12-29 12:00:27 Traceback (most recent call last): File "C:\tools\Anaconda3\lib\site-packages\conda\exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "C:\tools\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\tools\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\tools\Anaconda3\lib\site-packages\conda\cli\main_config.py", line 29, in execute execute_config(args, parser) File "C:\tools\Anaconda3\lib\site-packages\conda\cli\main_config.py", line 312, in execute_config rc.write(yaml_dump(rc_config)) File "C:\tools\Anaconda3\lib\site-packages\conda\common\serialize.py", line 81, in yaml_dump indent=2) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\main.py", line 254, in dump version=version, tags=tags, block_seq_indent=block_seq_indent) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\main.py", line 224, in dump_all dumper.represent(data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 49, in represent node = self.represent_data(data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 83, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 852, in represent_dict return self.represent_mapping(tag, data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 698, in represent_mapping node_value = self.represent_data(item_value) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 93, in represent_data node = self.yaml_representers[None](self, data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 324, in represent_undefined raise RepresenterError("cannot represent an object: %s" % data) ruamel_yaml.representer.RepresenterError: cannot represent an object: prevent
ruamel_yaml.representer.RepresenterError
def _make_single_record(self, package_filename): if not package_filename.endswith(CONDA_TARBALL_EXTENSION): package_filename += CONDA_TARBALL_EXTENSION package_tarball_full_path = join(self.pkgs_dir, package_filename) log.trace("adding to package cache %s", package_tarball_full_path) extracted_package_dir = package_tarball_full_path[: -len(CONDA_TARBALL_EXTENSION)] # try reading info/repodata_record.json try: repodata_record = read_repodata_json(extracted_package_dir) package_cache_record = PackageCacheRecord.from_objects( repodata_record, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) return package_cache_record except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/repodata_record.json doesn't exists # JsonDecodeError if info/repodata_record.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because %r", join(extracted_package_dir, "info", "repodata_record.json"), e, ) # try reading info/index.json try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/index.json doesn't exist # JsonDecodeError if info/index.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because", join(extracted_package_dir, "info", "index.json"), e, ) if isdir(extracted_package_dir) and not isfile(package_tarball_full_path): # We have a directory that looks like a conda package, but without # (1) info/repodata_record.json or info/index.json, and (2) a conda package # tarball, there's not much we can do. We'll just ignore it. return None try: if self.is_writable: if isdir(extracted_package_dir): # We have a partially unpacked conda package directory. Best thing # to do is remove it and try extracting. rm_rf(extracted_package_dir) try: extract_tarball( package_tarball_full_path, extracted_package_dir ) except EnvironmentError as e: if e.errno == ENOENT: # FileNotFoundError(2, 'No such file or directory') # At this point, we can assume the package tarball is bad. # Remove everything and move on. # see https://github.com/conda/conda/issues/6707 rm_rf(package_tarball_full_path) rm_rf(extracted_package_dir) try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError, JSONDecodeError): # At this point, we can assume the package tarball is bad. # Remove everything and move on. rm_rf(package_tarball_full_path) rm_rf(extracted_package_dir) return None else: index_json_record = read_index_json_from_tarball( package_tarball_full_path ) except (EOFError, ReadError) as e: # EOFError: Compressed file ended before the end-of-stream marker was reached # tarfile.ReadError: file could not be opened successfully # We have a corrupted tarball. Remove the tarball so it doesn't affect # anything, and move on. log.debug( "unable to extract info/index.json from %s\n because %r", package_tarball_full_path, e, ) rm_rf(package_tarball_full_path) return None # we were able to read info/index.json, so let's continue if isfile(package_tarball_full_path): md5 = compute_md5sum(package_tarball_full_path) else: md5 = None url = first(self._urls_data, lambda x: basename(x) == package_filename) package_cache_record = PackageCacheRecord.from_objects( index_json_record, url=url, md5=md5, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) # write the info/repodata_record.json file so we can short-circuit this next time if self.is_writable: repodata_record = PackageRecord.from_objects(package_cache_record) repodata_record_path = join( extracted_package_dir, "info", "repodata_record.json" ) try: write_as_json_to_file(repodata_record_path, repodata_record) except (IOError, OSError) as e: if e.errno in (EACCES, EPERM) and isdir(dirname(repodata_record_path)): raise NotWritableError(repodata_record_path, e.errno, caused_by=e) else: raise return package_cache_record
def _make_single_record(self, package_filename): if not package_filename.endswith(CONDA_TARBALL_EXTENSION): package_filename += CONDA_TARBALL_EXTENSION package_tarball_full_path = join(self.pkgs_dir, package_filename) log.trace("adding to package cache %s", package_tarball_full_path) extracted_package_dir = package_tarball_full_path[: -len(CONDA_TARBALL_EXTENSION)] # try reading info/repodata_record.json try: repodata_record = read_repodata_json(extracted_package_dir) package_cache_record = PackageCacheRecord.from_objects( repodata_record, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) return package_cache_record except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/repodata_record.json doesn't exists # JsonDecodeError if info/repodata_record.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because %r", join(extracted_package_dir, "info", "repodata_record.json"), e, ) # try reading info/index.json try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/index.json doesn't exist # JsonDecodeError if info/index.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because", join(extracted_package_dir, "info", "index.json"), e, ) if isdir(extracted_package_dir) and not isfile(package_tarball_full_path): # We have a directory that looks like a conda package, but without # (1) info/repodata_record.json or info/index.json, and (2) a conda package # tarball, there's not much we can do. We'll just ignore it. return None try: if self.is_writable: if isdir(extracted_package_dir): # We have a partially unpacked conda package directory. Best thing # to do is remove it and try extracting. rm_rf(extracted_package_dir) extract_tarball(package_tarball_full_path, extracted_package_dir) try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError, JSONDecodeError): # At this point, we can assume the package tarball is bad. # Remove everything and move on. rm_rf(package_tarball_full_path) rm_rf(extracted_package_dir) return None else: index_json_record = read_index_json_from_tarball( package_tarball_full_path ) except (EOFError, ReadError) as e: # EOFError: Compressed file ended before the end-of-stream marker was reached # tarfile.ReadError: file could not be opened successfully # We have a corrupted tarball. Remove the tarball so it doesn't affect # anything, and move on. log.debug( "unable to extract info/index.json from %s\n because %r", package_tarball_full_path, e, ) rm_rf(package_tarball_full_path) return None # we were able to read info/index.json, so let's continue if isfile(package_tarball_full_path): md5 = compute_md5sum(package_tarball_full_path) else: md5 = None url = first(self._urls_data, lambda x: basename(x) == package_filename) package_cache_record = PackageCacheRecord.from_objects( index_json_record, url=url, md5=md5, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) # write the info/repodata_record.json file so we can short-circuit this next time if self.is_writable: repodata_record = PackageRecord.from_objects(package_cache_record) repodata_record_path = join( extracted_package_dir, "info", "repodata_record.json" ) try: write_as_json_to_file(repodata_record_path, repodata_record) except (IOError, OSError) as e: if e.errno in (EACCES, EPERM) and isdir(dirname(repodata_record_path)): raise NotWritableError(repodata_record_path, e.errno, caused_by=e) else: raise return package_cache_record
https://github.com/conda/conda/issues/6707
error: FileNotFoundError(2, 'No such file or directory') command: C:\Users\Anurag\Anaconda3\Scripts\conda install spyder user_agent: conda/4.4.7 requests/2.13.0 CPython/3.6.2 Windows/10 Windows/10.0.16299 _messageid: -9223372036837325447 _messagetime: 1515540414747 / 2018-01-09 17:26:54 Traceback (most recent call last): File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\package_cache.py", line 270, in _make_single_record repodata_record = read_repodata_json(extracted_package_dir) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\gateways\disk\read.py", line 123, in read_repodata_json with open(join(extracted_package_directory, 'info', 'repodata_record.json')) as fi: File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\common\compat.py", line 120, in open closefd=closefd) FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Anurag\\Anaconda3\\pkgs\\pip-9.0.1-py36_1\\info\\repodata_record.json' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\package_cache.py", line 287, in _make_single_record index_json_record = read_index_json(extracted_package_dir) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\gateways\disk\read.py", line 111, in read_index_json with open(join(extracted_package_directory, 'info', 'index.json')) as fi: File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\common\compat.py", line 120, in open closefd=closefd) FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Anurag\\Anaconda3\\pkgs\\pip-9.0.1-py36_1\\info\\index.json' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\exceptions.py", line 743, in __call__ return func(*args, **kwargs) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 11, in execute install(args, parser, 'install') File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\cli\install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\cli\install.py", line 272, in handle_txn unlink_link_transaction.display_actions(progressive_fetch_extract) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\link.py", line 706, in display_actions legacy_action_groups = self.make_legacy_action_groups(pfe) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\link.py", line 689, in make_legacy_action_groups pfe.prepare() File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\common\io.py", line 415, in decorated return f(*args, **kwds) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\package_cache.py", line 540, in prepare for prec in self.link_precs) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\package_cache.py", line 540, in <genexpr> for prec in self.link_precs) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\package_cache.py", line 434, in make_actions_for_record ), None) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\package_cache.py", line 431, in <genexpr> pcrec for pcrec in concat(PackageCache(pkgs_dir).query(pref_or_spec) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\package_cache.py", line 432, in <genexpr> for pkgs_dir in context.pkgs_dirs) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\package_cache.py", line 118, in query return (pcrec for pcrec in itervalues(self._package_cache_records) if pcrec == param) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\package_cache.py", line 211, in _package_cache_records self.load() File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\package_cache.py", line 90, in load package_cache_record = self._make_single_record(base_name) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\core\package_cache.py", line 308, in _make_single_record extract_tarball(package_tarball_full_path, extracted_package_dir) File "C:\Users\Anurag\Anaconda3\lib\site-packages\conda\gateways\disk\create.py", line 145, in extract_tarball t.extractall(path=destination_directory, members=members_with_progress()) File "C:\Users\Anurag\Anaconda3\lib\tarfile.py", line 2007, in extractall numeric_owner=numeric_owner) File "C:\Users\Anurag\Anaconda3\lib\tarfile.py", line 2049, in extract numeric_owner=numeric_owner) File "C:\Users\Anurag\Anaconda3\lib\tarfile.py", line 2119, in _extract_member self.makefile(tarinfo, targetpath) File "C:\Users\Anurag\Anaconda3\lib\tarfile.py", line 2160, in makefile with bltn_open(targetpath, "wb") as target: FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Anurag\\Anaconda3\\pkgs\\pip-9.0.1-py36_1\\Lib\\site-packages\\pip\\_vendor\\cachecontrol\\__pycache__\\filewrapper.cpython-36.pyc'
FileNotFoundError
def __enter__(self): enabled = os.environ.get("CONDA_INSTRUMENTATION_ENABLED") if enabled and boolify(enabled): self.start_time = time() return self
def __enter__(self): enabled = os.environ.get("CONDA_INSTRUMENTATION_ENABLED") if enabled and boolify(enabled): self.start_time = time()
https://github.com/conda/conda/issues/6624
error: RuntimeError("generator didn't stop after throw()",) command: /home/mholekev/miniconda3/bin/conda install --yes numpy scipy matplotlib jupyter git pandas user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/2.6.32-696.10.3.el6.x86_64 centos/6.7 glibc/2.12 _messageid: -9223372036842075552 _messagetime: 1514766990662 / 2017-12-31 18:36:30 Traceback (most recent call last): File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/common/io.py", line 399, in backdown_thread_pool yield ThreadPoolExecutor(max_workers) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 214, in get_reduced_index new_records = query_all(spec) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in query_all return tuple(concat(future.result() for future in as_completed(futures))) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in <genexpr> return tuple(concat(future.result() for future in as_completed(futures))) File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/_base.py", line 217, in as_completed fs = set(fs) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 186, in <genexpr> futures = (executor.submit(sd.query, spec) for sd in subdir_datas) File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 123, in submit self._adjust_thread_count() File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 142, in _adjust_thread_count t.start() File "/home/mholekev/miniconda3/lib/python3.6/threading.py", line 846, in start _start_new_thread(self._bootstrap, ()) RuntimeError: can't start new thread
RuntimeError
def get_reduced_index(prefix, channels, subdirs, specs): # # this block of code is a "combine" step intended to filter out redundant specs # # causes a problem with py.test tests/core/test_solve.py -k broken_install # specs_map = defaultdict(list) # for spec in specs: # specs_map[spec.name].append(spec) # consolidated_specs = set() # for spec_name, specs_group in iteritems(specs_map): # if len(specs_group) == 1: # consolidated_specs.add(specs_group[0]) # elif spec_name == '*': # consolidated_specs.update(specs_group) # else: # keep_specs = [] # for spec in specs_group: # if len(spec._match_components) > 1 or spec.target or spec.optional: # keep_specs.append(spec) # consolidated_specs.update(keep_specs) with ThreadLimitedThreadPoolExecutor() as executor: channel_urls = all_channel_urls(channels, subdirs=subdirs) check_whitelist(channel_urls) if context.offline: grouped_urls = groupby(lambda url: url.startswith("file://"), channel_urls) ignored_urls = grouped_urls.get(False, ()) if ignored_urls: log.info( "Ignoring the following channel urls because mode is offline.%s", dashlist(ignored_urls), ) channel_urls = IndexedSet(grouped_urls.get(True, ())) subdir_datas = tuple(SubdirData(Channel(url)) for url in channel_urls) records = IndexedSet() collected_names = set() collected_track_features = set() pending_names = set() pending_track_features = set() def query_all(spec): futures = (executor.submit(sd.query, spec) for sd in subdir_datas) return tuple(concat(future.result() for future in as_completed(futures))) def push_spec(spec): name = spec.get_raw_value("name") if name and name not in collected_names: pending_names.add(name) track_features = spec.get_raw_value("track_features") if track_features: for ftr_name in track_features: if ftr_name not in collected_track_features: pending_track_features.add(ftr_name) def push_record(record): for _spec in record.combined_depends: push_spec(_spec) if record.track_features: for ftr_name in record.track_features: push_spec(MatchSpec(track_features=ftr_name)) for spec in specs: push_spec(spec) while pending_names or pending_track_features: while pending_names: name = pending_names.pop() collected_names.add(name) spec = MatchSpec(name) new_records = query_all(spec) for record in new_records: push_record(record) records.update(new_records) while pending_track_features: feature_name = pending_track_features.pop() collected_track_features.add(feature_name) spec = MatchSpec(track_features=feature_name) new_records = query_all(spec) for record in new_records: push_record(record) records.update(new_records) reduced_index = {Dist(rec): rec for rec in records} if prefix is not None: _supplement_index_with_prefix(reduced_index, prefix) if context.offline or ( "unknown" in context._argparse_args and context._argparse_args.unknown ): # This is really messed up right now. Dates all the way back to # https://github.com/conda/conda/commit/f761f65a82b739562a0d997a2570e2b8a0bdc783 # TODO: revisit this later _supplement_index_with_cache(reduced_index) # add feature records for the solver known_features = set() for rec in itervalues(reduced_index): known_features.update(concatv(rec.track_features, rec.features)) known_features.update(context.track_features) for ftr_str in known_features: rec = make_feature_record(ftr_str) reduced_index[Dist(rec)] = rec return reduced_index
def get_reduced_index(prefix, channels, subdirs, specs): # # this block of code is a "combine" step intended to filter out redundant specs # # causes a problem with py.test tests/core/test_solve.py -k broken_install # specs_map = defaultdict(list) # for spec in specs: # specs_map[spec.name].append(spec) # consolidated_specs = set() # for spec_name, specs_group in iteritems(specs_map): # if len(specs_group) == 1: # consolidated_specs.add(specs_group[0]) # elif spec_name == '*': # consolidated_specs.update(specs_group) # else: # keep_specs = [] # for spec in specs_group: # if len(spec._match_components) > 1 or spec.target or spec.optional: # keep_specs.append(spec) # consolidated_specs.update(keep_specs) with backdown_thread_pool() as executor: channel_urls = all_channel_urls(channels, subdirs=subdirs) check_whitelist(channel_urls) if context.offline: grouped_urls = groupby(lambda url: url.startswith("file://"), channel_urls) ignored_urls = grouped_urls.get(False, ()) if ignored_urls: log.info( "Ignoring the following channel urls because mode is offline.%s", dashlist(ignored_urls), ) channel_urls = IndexedSet(grouped_urls.get(True, ())) subdir_datas = tuple(SubdirData(Channel(url)) for url in channel_urls) records = IndexedSet() collected_names = set() collected_track_features = set() pending_names = set() pending_track_features = set() def query_all(spec): futures = (executor.submit(sd.query, spec) for sd in subdir_datas) return tuple(concat(future.result() for future in as_completed(futures))) def push_spec(spec): name = spec.get_raw_value("name") if name and name not in collected_names: pending_names.add(name) track_features = spec.get_raw_value("track_features") if track_features: for ftr_name in track_features: if ftr_name not in collected_track_features: pending_track_features.add(ftr_name) def push_record(record): for _spec in record.combined_depends: push_spec(_spec) if record.track_features: for ftr_name in record.track_features: push_spec(MatchSpec(track_features=ftr_name)) for spec in specs: push_spec(spec) while pending_names or pending_track_features: while pending_names: name = pending_names.pop() collected_names.add(name) spec = MatchSpec(name) new_records = query_all(spec) for record in new_records: push_record(record) records.update(new_records) while pending_track_features: feature_name = pending_track_features.pop() collected_track_features.add(feature_name) spec = MatchSpec(track_features=feature_name) new_records = query_all(spec) for record in new_records: push_record(record) records.update(new_records) reduced_index = {Dist(rec): rec for rec in records} if prefix is not None: _supplement_index_with_prefix(reduced_index, prefix) if context.offline or ( "unknown" in context._argparse_args and context._argparse_args.unknown ): # This is really messed up right now. Dates all the way back to # https://github.com/conda/conda/commit/f761f65a82b739562a0d997a2570e2b8a0bdc783 # TODO: revisit this later _supplement_index_with_cache(reduced_index) # add feature records for the solver known_features = set() for rec in itervalues(reduced_index): known_features.update(concatv(rec.track_features, rec.features)) known_features.update(context.track_features) for ftr_str in known_features: rec = make_feature_record(ftr_str) reduced_index[Dist(rec)] = rec return reduced_index
https://github.com/conda/conda/issues/6624
error: RuntimeError("generator didn't stop after throw()",) command: /home/mholekev/miniconda3/bin/conda install --yes numpy scipy matplotlib jupyter git pandas user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/2.6.32-696.10.3.el6.x86_64 centos/6.7 glibc/2.12 _messageid: -9223372036842075552 _messagetime: 1514766990662 / 2017-12-31 18:36:30 Traceback (most recent call last): File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/common/io.py", line 399, in backdown_thread_pool yield ThreadPoolExecutor(max_workers) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 214, in get_reduced_index new_records = query_all(spec) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in query_all return tuple(concat(future.result() for future in as_completed(futures))) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in <genexpr> return tuple(concat(future.result() for future in as_completed(futures))) File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/_base.py", line 217, in as_completed fs = set(fs) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 186, in <genexpr> futures = (executor.submit(sd.query, spec) for sd in subdir_datas) File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 123, in submit self._adjust_thread_count() File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 142, in _adjust_thread_count t.start() File "/home/mholekev/miniconda3/lib/python3.6/threading.py", line 846, in start _start_new_thread(self._bootstrap, ()) RuntimeError: can't start new thread
RuntimeError
def query_all(channels, subdirs, package_ref_or_match_spec): from .index import check_whitelist # TODO: fix in-line import channel_urls = all_channel_urls(channels, subdirs=subdirs) check_whitelist(channel_urls) with ThreadLimitedThreadPoolExecutor() as executor: futures = ( executor.submit(SubdirData(Channel(url)).query, package_ref_or_match_spec) for url in channel_urls ) return tuple(concat(future.result() for future in as_completed(futures)))
def query_all(channels, subdirs, package_ref_or_match_spec): channel_urls = all_channel_urls(channels, subdirs=subdirs) executor = None try: from concurrent.futures import ThreadPoolExecutor, as_completed executor = ThreadPoolExecutor(10) futures = ( executor.submit(SubdirData(Channel(url)).query, package_ref_or_match_spec) for url in channel_urls ) return tuple(concat(future.result() for future in as_completed(futures))) except RuntimeError as e: # pragma: no cover # concurrent.futures is only available in Python >= 3.2 or if futures is installed # RuntimeError is thrown if number of threads are limited by OS raise finally: if executor: executor.shutdown(wait=True)
https://github.com/conda/conda/issues/6624
error: RuntimeError("generator didn't stop after throw()",) command: /home/mholekev/miniconda3/bin/conda install --yes numpy scipy matplotlib jupyter git pandas user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/2.6.32-696.10.3.el6.x86_64 centos/6.7 glibc/2.12 _messageid: -9223372036842075552 _messagetime: 1514766990662 / 2017-12-31 18:36:30 Traceback (most recent call last): File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/common/io.py", line 399, in backdown_thread_pool yield ThreadPoolExecutor(max_workers) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 214, in get_reduced_index new_records = query_all(spec) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in query_all return tuple(concat(future.result() for future in as_completed(futures))) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in <genexpr> return tuple(concat(future.result() for future in as_completed(futures))) File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/_base.py", line 217, in as_completed fs = set(fs) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 186, in <genexpr> futures = (executor.submit(sd.query, spec) for sd in subdir_datas) File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 123, in submit self._adjust_thread_count() File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 142, in _adjust_thread_count t.start() File "/home/mholekev/miniconda3/lib/python3.6/threading.py", line 846, in start _start_new_thread(self._bootstrap, ()) RuntimeError: can't start new thread
RuntimeError
def backdown_thread_pool(max_workers=10): """Tries to create an executor with max_workers, but will back down ultimately to a single thread of the OS decides you can't have more than one. """ from concurrent.futures import ( _base, ) # These "_" imports are gross, but I don't think there's an alternative # NOQA from concurrent.futures.thread import _WorkItem class CondaThreadPoolExecutor(ThreadPoolExecutor): def submit(self, fn, *args, **kwargs): with self._shutdown_lock: if self._shutdown: raise RuntimeError("cannot schedule new futures after shutdown") f = _base.Future() w = _WorkItem(f, fn, args, kwargs) self._work_queue.put(w) try: self._adjust_thread_count() except RuntimeError: # RuntimeError: can't start new thread # See https://github.com/conda/conda/issues/6624 if len(self._threads) > 0: # It's ok to not be able to start new threads if we already have at least # one thread alive. pass else: raise return f try: yield CondaThreadPoolExecutor(max_workers) except RuntimeError as e: # pragma: no cover # RuntimeError is thrown if number of threads are limited by OS log.debug(repr(e)) try: yield CondaThreadPoolExecutor(floor(max_workers / 2)) except RuntimeError as e: log.debug(repr(e)) yield CondaThreadPoolExecutor(1)
def backdown_thread_pool(max_workers=10): """Tries to create an executor with max_workers, but will back down ultimately to a single thread of the OS decides you can't have more than one. """ try: yield ThreadPoolExecutor(max_workers) except RuntimeError as e: # pragma: no cover # RuntimeError is thrown if number of threads are limited by OS log.debug(repr(e)) try: yield ThreadPoolExecutor(floor(max_workers / 2)) except RuntimeError as e: log.debug(repr(e)) yield ThreadPoolExecutor(1)
https://github.com/conda/conda/issues/6624
error: RuntimeError("generator didn't stop after throw()",) command: /home/mholekev/miniconda3/bin/conda install --yes numpy scipy matplotlib jupyter git pandas user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/2.6.32-696.10.3.el6.x86_64 centos/6.7 glibc/2.12 _messageid: -9223372036842075552 _messagetime: 1514766990662 / 2017-12-31 18:36:30 Traceback (most recent call last): File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/common/io.py", line 399, in backdown_thread_pool yield ThreadPoolExecutor(max_workers) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 214, in get_reduced_index new_records = query_all(spec) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in query_all return tuple(concat(future.result() for future in as_completed(futures))) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in <genexpr> return tuple(concat(future.result() for future in as_completed(futures))) File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/_base.py", line 217, in as_completed fs = set(fs) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 186, in <genexpr> futures = (executor.submit(sd.query, spec) for sd in subdir_datas) File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 123, in submit self._adjust_thread_count() File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 142, in _adjust_thread_count t.start() File "/home/mholekev/miniconda3/lib/python3.6/threading.py", line 846, in start _start_new_thread(self._bootstrap, ()) RuntimeError: can't start new thread
RuntimeError
def _load_single_record(self, prefix_record_json_path): log.trace("loading prefix record %s", prefix_record_json_path) with open(prefix_record_json_path) as fh: try: json_data = json_load(fh.read()) except JSONDecodeError: raise CorruptedEnvironmentError(self.prefix_path, prefix_record_json_path) prefix_record = PrefixRecord(**json_data) self.__prefix_records[prefix_record.name] = prefix_record
def _load_single_record(self, prefix_record_json_path): log.trace("loading prefix record %s", prefix_record_json_path) with open(prefix_record_json_path) as fh: json_data = json_load(fh.read()) prefix_record = PrefixRecord(**json_data) self.__prefix_records[prefix_record.name] = prefix_record
https://github.com/conda/conda/issues/6390
Traceback (most recent call last): File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/exceptions.py", line 640, in conda_exception_handler return_value = func(*args, **kwargs) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main.py", line 140, in _main exit_code = args.func(args, p) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main_list.py", line 242, in execute show_channel_urls=context.show_channel_urls) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main_list.py", line 172, in print_packages installed = linked(prefix) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/core/linked_data.py", line 123, in linked return set(linked_data(prefix, ignore_channels=ignore_channels).keys()) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/core/linked_data.py", line 115, in linked_data load_linked_data(prefix, dist_name, ignore_channels=ignore_channels) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/core/linked_data.py", line 36, in load_linked_data rec = json.load(fi) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/json/__init__.py", line 299, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/json/__init__.py", line 354, in loads return _default_decoder.decode(s) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
json.decoder.JSONDecodeError
def solve_final_state( self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, force_remove=NULL ): """Gives the final, solved state of the environment. Args: deps_modifier (DepsModifier): An optional flag indicating special solver handling for dependencies. The default solver behavior is to be as conservative as possible with dependency updates (in the case the dependency already exists in the environment), while still ensuring all dependencies are satisfied. Options include * NO_DEPS * ONLY_DEPS * UPDATE_DEPS * UPDATE_DEPS_ONLY_DEPS prune (bool): If ``True``, the solution will not contain packages that were previously brought into the environment as dependencies but are no longer required as dependencies and are not user-requested. ignore_pinned (bool): If ``True``, the solution will ignore pinned package configuration for the prefix. force_remove (bool): Forces removal of a package without removing packages that depend on it. Returns: Tuple[PackageRef]: In sorted dependency order from roots to leaves, the package references for the solved state of the environment. """ prune = context.prune if prune is NULL else prune ignore_pinned = context.ignore_pinned if ignore_pinned is NULL else ignore_pinned deps_modifier = context.deps_modifier if deps_modifier is NULL else deps_modifier if isinstance(deps_modifier, string_types): deps_modifier = DepsModifier(deps_modifier.lower()) specs_to_remove = self.specs_to_remove specs_to_add = self.specs_to_add # force_remove is a special case where we return early if specs_to_remove and force_remove: if specs_to_add: raise NotImplementedError() index, r = self._prepare(specs_to_remove) solution = tuple( Dist(rec) for rec in PrefixData(self.prefix).iter_records() if not any(spec.match(rec) for spec in specs_to_remove) ) return IndexedSet( index[d] for d in r.dependency_sort({d.name: d for d in solution}) ) log.debug( "solving prefix %s\n specs_to_remove: %s\n specs_to_add: %s\n prune: %s", self.prefix, specs_to_remove, specs_to_add, prune, ) # declare starting point, the initial state of the environment # `solution` and `specs_map` are mutated throughout this method prefix_data = PrefixData(self.prefix) solution = tuple(Dist(d) for d in prefix_data.iter_records()) specs_from_history_map = History(self.prefix).get_requested_specs_map() if ( prune ): # or deps_modifier == DepsModifier.UPDATE_ALL # pending conda/constructor#138 # Users are struggling with the prune functionality in --update-all, due to # https://github.com/conda/constructor/issues/138. Until that issue is resolved, # and for the foreseeable future, it's best to be more conservative with --update-all. # Start with empty specs map for UPDATE_ALL because we're optimizing the update # only for specs the user has requested; it's ok to remove dependencies. specs_map = odict() # However, because of https://github.com/conda/constructor/issues/138, we need # to hard-code keeping conda, conda-build, and anaconda, if they're already in # the environment. solution_pkg_names = set(d.name for d in solution) ensure_these = ( pkg_name for pkg_name in { "anaconda", "conda", "conda-build", } if pkg_name not in specs_from_history_map and pkg_name in solution_pkg_names ) for pkg_name in ensure_these: specs_from_history_map[pkg_name] = MatchSpec(pkg_name) else: specs_map = odict((d.name, MatchSpec(d.name)) for d in solution) # add in historically-requested specs specs_map.update(specs_from_history_map) # let's pretend for now that this is the right place to build the index prepared_specs = set( concatv( specs_to_remove, specs_to_add, itervalues(specs_from_history_map), ) ) index, r = self._prepare(prepared_specs) if specs_to_remove: # In a previous implementation, we invoked SAT here via `r.remove()` to help with # spec removal, and then later invoking SAT again via `r.solve()`. Rather than invoking # SAT for spec removal determination, we can use the DAG and simple tree traversal # if we're careful about how we handle features. We still invoke sat via `r.solve()` # later. _track_fts_specs = ( spec for spec in specs_to_remove if "track_features" in spec ) feature_names = set( concat(spec.get_raw_value("track_features") for spec in _track_fts_specs) ) dag = PrefixDag((index[dist] for dist in solution), itervalues(specs_map)) removed_records = [] for spec in specs_to_remove: # If the spec was a provides_features spec, then we need to also remove every # package with a requires_feature that matches the provides_feature. The # `dag.remove_spec()` method handles that for us. log.trace("using dag to remove records for %s", spec) removed_records.extend(dag.remove_spec(spec)) for rec in removed_records: # We keep specs (minus the feature part) for the non provides_features packages # if they're in the history specs. Otherwise, we pop them from the specs_map. rec_has_a_feature = set(rec.features or ()) & feature_names if rec_has_a_feature and rec.name in specs_from_history_map: spec = specs_map.get(rec.name, MatchSpec(rec.name)) spec._match_components.pop("features", None) specs_map[spec.name] = spec else: specs_map.pop(rec.name, None) solution = tuple(Dist(rec) for rec in dag.records) if not removed_records and not prune: raise PackagesNotFoundError(tuple(spec.name for spec in specs_to_remove)) # We handle as best as possible environments in inconsistent states. To do this, # we remove now from consideration the set of packages causing inconsistencies, # and then we add them back in following the main SAT call. _, inconsistent_dists = r.bad_installed(solution, ()) add_back_map = {} # name: (dist, spec) if log.isEnabledFor(DEBUG): log.debug( "inconsistent dists: %s", dashlist(inconsistent_dists) if inconsistent_dists else "None", ) if inconsistent_dists: for dist in inconsistent_dists: # pop and save matching spec in specs_map add_back_map[dist.name] = (dist, specs_map.pop(dist.name, None)) solution = tuple(dist for dist in solution if dist not in inconsistent_dists) # For the remaining specs in specs_map, add target to each spec. `target` is a reference # to the package currently existing in the environment. Setting target instructs the # solver to not disturb that package if it's not necessary. # If the spec.name is being modified by inclusion in specs_to_add, we don't set `target`, # since we *want* the solver to modify/update that package. # # TLDR: when working with MatchSpec objects, # - to minimize the version change, set MatchSpec(name=name, target=dist.full_name) # - to freeze the package, set all the components of MatchSpec individually for pkg_name, spec in iteritems(specs_map): matches_for_spec = tuple(dist for dist in solution if spec.match(index[dist])) if matches_for_spec: if len(matches_for_spec) != 1: raise CondaError( dals(""" Conda encountered an error with your environment. Please report an issue at https://github.com/conda/conda/issues/new. In your report, please include the output of 'conda info' and 'conda list' for the active environment, along with the command you invoked that resulted in this error. pkg_name: %s spec: %s matches_for_spec: %s """) % ( pkg_name, spec, dashlist((text_type(s) for s in matches_for_spec), indent=4), ) ) target_dist = matches_for_spec[0] if deps_modifier == DepsModifier.FREEZE_INSTALLED: new_spec = MatchSpec(index[target_dist]) else: target = Dist(target_dist).full_name new_spec = MatchSpec(spec, target=target) specs_map[pkg_name] = new_spec if log.isEnabledFor(TRACE): log.trace("specs_map with targets: %s", specs_map) # If we're in UPDATE_ALL mode, we need to drop all the constraints attached to specs, # so they can all float and the solver can find the most up-to-date solution. In the case # of UPDATE_ALL, `specs_map` wasn't initialized with packages from the current environment, # but *only* historically-requested specs. This lets UPDATE_ALL drop dependencies if # they're no longer needed, and their presence would otherwise prevent the updated solution # the user most likely wants. if deps_modifier == DepsModifier.UPDATE_ALL: specs_map = { pkg_name: MatchSpec(spec.name, optional=spec.optional) for pkg_name, spec in iteritems(specs_map) } # As a business rule, we never want to update python beyond the current minor version, # unless that's requested explicitly by the user (which we actively discourage). if "python" in specs_map: python_prefix_rec = prefix_data.get("python") if python_prefix_rec: python_spec = specs_map["python"] if not python_spec.get("version"): pinned_version = ( get_major_minor_version(python_prefix_rec.version) + ".*" ) specs_map["python"] = MatchSpec(python_spec, version=pinned_version) # For the aggressive_update_packages configuration parameter, we strip any target # that's been set. if not context.offline: for spec in context.aggressive_update_packages: if spec.name in specs_map: old_spec = specs_map[spec.name] specs_map[spec.name] = MatchSpec(old_spec, target=None) if ( context.auto_update_conda and paths_equal(self.prefix, context.root_prefix) and any(dist.name == "conda" for dist in solution) ): specs_map["conda"] = MatchSpec("conda") # add in explicitly requested specs from specs_to_add # this overrides any name-matching spec already in the spec map specs_map.update((s.name, s) for s in specs_to_add) # collect additional specs to add to the solution track_features_specs = pinned_specs = () if context.track_features: track_features_specs = tuple(MatchSpec(x + "@") for x in context.track_features) if not ignore_pinned: pinned_specs = get_pinned_specs(self.prefix) final_environment_specs = IndexedSet( concatv( itervalues(specs_map), track_features_specs, pinned_specs, ) ) # We've previously checked `solution` for consistency (which at that point was the # pre-solve state of the environment). Now we check our compiled set of # `final_environment_specs` for the possibility of a solution. If there are conflicts, # we can often avoid them by neutering specs that have a target (e.g. removing version # constraint) and also making them optional. The result here will be less cases of # `UnsatisfiableError` handed to users, at the cost of more packages being modified # or removed from the environment. conflicting_specs = r.get_conflicting_specs(tuple(final_environment_specs)) if log.isEnabledFor(DEBUG): log.debug("conflicting specs: %s", dashlist(conflicting_specs)) for spec in conflicting_specs: if spec.target: final_environment_specs.remove(spec) neutered_spec = MatchSpec(spec.name, target=spec.target, optional=True) final_environment_specs.add(neutered_spec) # Finally! We get to call SAT. if log.isEnabledFor(DEBUG): log.debug( "final specs to add: %s", dashlist(sorted(text_type(s) for s in final_environment_specs)), ) solution = r.solve(tuple(final_environment_specs)) # return value is List[dist] # add back inconsistent packages to solution if add_back_map: for name, (dist, spec) in iteritems(add_back_map): if not any(d.name == name for d in solution): solution.append(dist) if spec: final_environment_specs.add(spec) # Special case handling for various DepsModifer flags. Maybe this block could be pulled # out into its own non-public helper method? if deps_modifier == DepsModifier.NO_DEPS: # In the NO_DEPS case, we need to start with the original list of packages in the # environment, and then only modify packages that match specs_to_add or # specs_to_remove. _no_deps_solution = IndexedSet(Dist(rec) for rec in prefix_data.iter_records()) only_remove_these = set( dist for spec in specs_to_remove for dist in _no_deps_solution if spec.match(index[dist]) ) _no_deps_solution -= only_remove_these only_add_these = set( dist for spec in specs_to_add for dist in solution if spec.match(index[dist]) ) remove_before_adding_back = set(dist.name for dist in only_add_these) _no_deps_solution = IndexedSet( dist for dist in _no_deps_solution if dist.name not in remove_before_adding_back ) _no_deps_solution |= only_add_these solution = _no_deps_solution elif deps_modifier == DepsModifier.ONLY_DEPS: # Using a special instance of the DAG to remove leaf nodes that match the original # specs_to_add. It's important to only remove leaf nodes, because a typical use # might be `conda install --only-deps python=2 flask`, and in that case we'd want # to keep python. dag = PrefixDag((index[d] for d in solution), specs_to_add) dag.remove_leaf_nodes_with_specs() solution = tuple(Dist(rec) for rec in dag.records) elif deps_modifier in ( DepsModifier.UPDATE_DEPS, DepsModifier.UPDATE_DEPS_ONLY_DEPS, ): # Here we have to SAT solve again :( It's only now that we know the dependency # chain of specs_to_add. specs_to_add_names = set(spec.name for spec in specs_to_add) update_names = set() dag = PrefixDag((index[d] for d in solution), final_environment_specs) for spec in specs_to_add: node = dag.get_node_by_name(spec.name) for ascendant in node.all_ascendants(): ascendant_name = ascendant.record.name if ascendant_name not in specs_to_add_names: update_names.add(ascendant_name) grouped_specs = groupby( lambda s: s.name in update_names, final_environment_specs ) new_final_environment_specs = set(grouped_specs.get(False, ())) update_specs = set( MatchSpec(spec.name, optional=spec.optional) for spec in grouped_specs.get(True, ()) ) final_environment_specs = new_final_environment_specs | update_specs solution = r.solve(final_environment_specs) if deps_modifier == DepsModifier.UPDATE_DEPS_ONLY_DEPS: # duplicated from DepsModifier.ONLY_DEPS dag = PrefixDag((index[d] for d in solution), specs_to_add) dag.remove_leaf_nodes_with_specs() solution = tuple(Dist(rec) for rec in dag.records) if prune: dag = PrefixDag((index[d] for d in solution), final_environment_specs) dag.prune() solution = tuple(Dist(rec) for rec in dag.records) self._check_solution(solution, pinned_specs) solution = IndexedSet(r.dependency_sort({d.name: d for d in solution})) log.debug( "solved prefix %s\n solved_linked_dists:\n %s\n", self.prefix, "\n ".join(text_type(d) for d in solution), ) return IndexedSet(index[d] for d in solution)
def solve_final_state( self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, force_remove=NULL ): """Gives the final, solved state of the environment. Args: deps_modifier (DepsModifier): An optional flag indicating special solver handling for dependencies. The default solver behavior is to be as conservative as possible with dependency updates (in the case the dependency already exists in the environment), while still ensuring all dependencies are satisfied. Options include * NO_DEPS * ONLY_DEPS * UPDATE_DEPS * UPDATE_DEPS_ONLY_DEPS prune (bool): If ``True``, the solution will not contain packages that were previously brought into the environment as dependencies but are no longer required as dependencies and are not user-requested. ignore_pinned (bool): If ``True``, the solution will ignore pinned package configuration for the prefix. force_remove (bool): Forces removal of a package without removing packages that depend on it. Returns: Tuple[PackageRef]: In sorted dependency order from roots to leaves, the package references for the solved state of the environment. """ prune = context.prune if prune is NULL else prune ignore_pinned = context.ignore_pinned if ignore_pinned is NULL else ignore_pinned deps_modifier = context.deps_modifier if deps_modifier is NULL else deps_modifier if isinstance(deps_modifier, string_types): deps_modifier = DepsModifier(deps_modifier.lower()) specs_to_remove = self.specs_to_remove specs_to_add = self.specs_to_add # force_remove is a special case where we return early if specs_to_remove and force_remove: if specs_to_add: raise NotImplementedError() index, r = self._prepare(specs_to_remove) solution = tuple( Dist(rec) for rec in PrefixData(self.prefix).iter_records() if not any(spec.match(rec) for spec in specs_to_remove) ) return IndexedSet( index[d] for d in r.dependency_sort({d.name: d for d in solution}) ) log.debug( "solving prefix %s\n specs_to_remove: %s\n specs_to_add: %s\n prune: %s", self.prefix, specs_to_remove, specs_to_add, prune, ) # declare starting point, the initial state of the environment # `solution` and `specs_map` are mutated throughout this method prefix_data = PrefixData(self.prefix) solution = tuple(Dist(d) for d in prefix_data.iter_records()) specs_from_history_map = History(self.prefix).get_requested_specs_map() if ( prune ): # or deps_modifier == DepsModifier.UPDATE_ALL # pending conda/constructor#138 # Users are struggling with the prune functionality in --update-all, due to # https://github.com/conda/constructor/issues/138. Until that issue is resolved, # and for the foreseeable future, it's best to be more conservative with --update-all. # Start with empty specs map for UPDATE_ALL because we're optimizing the update # only for specs the user has requested; it's ok to remove dependencies. specs_map = odict() # However, because of https://github.com/conda/constructor/issues/138, we need # to hard-code keeping conda, conda-build, and anaconda, if they're already in # the environment. solution_pkg_names = set(d.name for d in solution) ensure_these = ( pkg_name for pkg_name in { "anaconda", "conda", "conda-build", } if pkg_name not in specs_from_history_map and pkg_name in solution_pkg_names ) for pkg_name in ensure_these: specs_from_history_map[pkg_name] = MatchSpec(pkg_name) else: specs_map = odict((d.name, MatchSpec(d.name)) for d in solution) # add in historically-requested specs specs_map.update(specs_from_history_map) # let's pretend for now that this is the right place to build the index prepared_specs = set( concatv( specs_to_remove, specs_to_add, itervalues(specs_from_history_map), ) ) index, r = self._prepare(prepared_specs) if specs_to_remove: # In a previous implementation, we invoked SAT here via `r.remove()` to help with # spec removal, and then later invoking SAT again via `r.solve()`. Rather than invoking # SAT for spec removal determination, we can use the DAG and simple tree traversal # if we're careful about how we handle features. We still invoke sat via `r.solve()` # later. _track_fts_specs = ( spec for spec in specs_to_remove if "track_features" in spec ) feature_names = set( concat(spec.get_raw_value("track_features") for spec in _track_fts_specs) ) dag = PrefixDag((index[dist] for dist in solution), itervalues(specs_map)) removed_records = [] for spec in specs_to_remove: # If the spec was a provides_features spec, then we need to also remove every # package with a requires_feature that matches the provides_feature. The # `dag.remove_spec()` method handles that for us. log.trace("using dag to remove records for %s", spec) removed_records.extend(dag.remove_spec(spec)) for rec in removed_records: # We keep specs (minus the feature part) for the non provides_features packages # if they're in the history specs. Otherwise, we pop them from the specs_map. rec_has_a_feature = set(rec.features or ()) & feature_names if rec_has_a_feature and rec.name in specs_from_history_map: spec = specs_map.get(rec.name, MatchSpec(rec.name)) spec._match_components.pop("features", None) specs_map[spec.name] = spec else: specs_map.pop(rec.name, None) solution = tuple(Dist(rec) for rec in dag.records) if not removed_records and not prune: raise PackagesNotFoundError(tuple(spec.name for spec in specs_to_remove)) # We handle as best as possible environments in inconsistent states. To do this, # we remove now from consideration the set of packages causing inconsistencies, # and then we add them back in following the main SAT call. _, inconsistent_dists = r.bad_installed(solution, ()) add_back_map = {} # name: (dist, spec) if log.isEnabledFor(DEBUG): log.debug( "inconsistent dists: %s", dashlist(inconsistent_dists) if inconsistent_dists else "None", ) if inconsistent_dists: for dist in inconsistent_dists: # pop and save matching spec in specs_map add_back_map[dist.name] = (dist, specs_map.pop(dist.name, None)) solution = tuple(dist for dist in solution if dist not in inconsistent_dists) # For the remaining specs in specs_map, add target to each spec. `target` is a reference # to the package currently existing in the environment. Setting target instructs the # solver to not disturb that package if it's not necessary. # If the spec.name is being modified by inclusion in specs_to_add, we don't set `target`, # since we *want* the solver to modify/update that package. # # TLDR: when working with MatchSpec objects, # - to minimize the version change, set MatchSpec(name=name, target=dist.full_name) # - to freeze the package, set all the components of MatchSpec individually for pkg_name, spec in iteritems(specs_map): matches_for_spec = tuple(dist for dist in solution if spec.match(index[dist])) if matches_for_spec: if len(matches_for_spec) != 1: raise CondaError( dals(""" Conda encountered an error with your environment. Please report an issue at https://github.com/conda/conda/issues/new. In your report, please include the output of 'conda info' and 'conda list' for the active environment, along with the command you invoked that resulted in this error. pkg_name: %s spec: %s matches_for_spec: %s """) % ( pkg_name, spec, dashlist((text_type(s) for s in matches_for_spec), indent=4), ) ) target_dist = matches_for_spec[0] if deps_modifier == DepsModifier.FREEZE_INSTALLED: new_spec = MatchSpec(index[target_dist]) else: target = Dist(target_dist).full_name new_spec = MatchSpec(spec, target=target) specs_map[pkg_name] = new_spec if log.isEnabledFor(TRACE): log.trace("specs_map with targets: %s", specs_map) # If we're in UPDATE_ALL mode, we need to drop all the constraints attached to specs, # so they can all float and the solver can find the most up-to-date solution. In the case # of UPDATE_ALL, `specs_map` wasn't initialized with packages from the current environment, # but *only* historically-requested specs. This lets UPDATE_ALL drop dependencies if # they're no longer needed, and their presence would otherwise prevent the updated solution # the user most likely wants. if deps_modifier == DepsModifier.UPDATE_ALL: specs_map = { pkg_name: MatchSpec(spec.name, optional=spec.optional) for pkg_name, spec in iteritems(specs_map) } # As a business rule, we never want to update python beyond the current minor version, # unless that's requested explicitly by the user (which we actively discourage). if "python" in specs_map: python_prefix_rec = prefix_data.get("python") if python_prefix_rec: python_spec = specs_map["python"] if not python_spec.get("version"): pinned_version = ( get_major_minor_version(python_prefix_rec.version) + ".*" ) specs_map["python"] = MatchSpec(python_spec, version=pinned_version) # For the aggressive_update_packages configuration parameter, we strip any target # that's been set. if not context.offline: for spec in context.aggressive_update_packages: if spec.name in specs_map: old_spec = specs_map[spec.name] specs_map[spec.name] = MatchSpec(old_spec, target=None) if ( context.auto_update_conda and paths_equal(self.prefix, context.root_prefix) and any(dist.name == "conda" for dist in solution) ): specs_map["conda"] = MatchSpec("conda") # add in explicitly requested specs from specs_to_add # this overrides any name-matching spec already in the spec map specs_map.update((s.name, s) for s in specs_to_add) # collect additional specs to add to the solution track_features_specs = pinned_specs = () if context.track_features: track_features_specs = tuple(MatchSpec(x + "@") for x in context.track_features) if not ignore_pinned: pinned_specs = get_pinned_specs(self.prefix) final_environment_specs = IndexedSet( concatv( itervalues(specs_map), track_features_specs, pinned_specs, ) ) # We've previously checked `solution` for consistency (which at that point was the # pre-solve state of the environment). Now we check our compiled set of # `final_environment_specs` for the possibility of a solution. If there are conflicts, # we can often avoid them by neutering specs that have a target (e.g. removing version # constraint) and also making them optional. The result here will be less cases of # `UnsatisfiableError` handed to users, at the cost of more packages being modified # or removed from the environment. conflicting_specs = r.get_conflicting_specs(tuple(final_environment_specs)) if log.isEnabledFor(DEBUG): log.debug("conflicting specs: %s", dashlist(conflicting_specs)) for spec in conflicting_specs: if spec.target: final_environment_specs.remove(spec) neutered_spec = MatchSpec(spec.name, target=spec.target, optional=True) final_environment_specs.add(neutered_spec) # Finally! We get to call SAT. if log.isEnabledFor(DEBUG): log.debug( "final specs to add: %s", dashlist(sorted(text_type(s) for s in final_environment_specs)), ) solution = r.solve(tuple(final_environment_specs)) # return value is List[dist] # add back inconsistent packages to solution if add_back_map: for name, (dist, spec) in iteritems(add_back_map): if not any(d.name == name for d in solution): solution.append(dist) if spec: final_environment_specs.add(spec) # Special case handling for various DepsModifer flags. Maybe this block could be pulled # out into its own non-public helper method? if deps_modifier == DepsModifier.NO_DEPS: # In the NO_DEPS case, we need to start with the original list of packages in the # environment, and then only modify packages that match specs_to_add or # specs_to_remove. _no_deps_solution = IndexedSet(Dist(rec) for rec in prefix_data.iter_records()) only_remove_these = set( dist for spec in specs_to_remove for dist in _no_deps_solution if spec.match(index[dist]) ) _no_deps_solution -= only_remove_these only_add_these = set( dist for spec in specs_to_add for dist in solution if spec.match(index[dist]) ) remove_before_adding_back = set(dist.name for dist in only_add_these) _no_deps_solution = IndexedSet( dist for dist in _no_deps_solution if dist.name not in remove_before_adding_back ) _no_deps_solution |= only_add_these solution = _no_deps_solution elif deps_modifier == DepsModifier.ONLY_DEPS: # Using a special instance of the DAG to remove leaf nodes that match the original # specs_to_add. It's important to only remove leaf nodes, because a typical use # might be `conda install --only-deps python=2 flask`, and in that case we'd want # to keep python. dag = PrefixDag((index[d] for d in solution), specs_to_add) dag.remove_leaf_nodes_with_specs() solution = tuple(Dist(rec) for rec in dag.records) elif deps_modifier in ( DepsModifier.UPDATE_DEPS, DepsModifier.UPDATE_DEPS_ONLY_DEPS, ): # Here we have to SAT solve again :( It's only now that we know the dependency # chain of specs_to_add. specs_to_add_names = set(spec.name for spec in specs_to_add) update_names = set() dag = PrefixDag((index[d] for d in solution), final_environment_specs) for spec in specs_to_add: node = dag.get_node_by_name(spec.name) for ascendant in node.all_ascendants(): ascendant_name = ascendant.record.name if ascendant_name not in specs_to_add_names: update_names.add(ascendant_name) grouped_specs = groupby( lambda s: s.name in update_names, final_environment_specs ) new_final_environment_specs = set(grouped_specs[False]) update_specs = set( MatchSpec(spec.name, optional=spec.optional) for spec in grouped_specs[True] ) final_environment_specs = new_final_environment_specs | update_specs solution = r.solve(final_environment_specs) if deps_modifier == DepsModifier.UPDATE_DEPS_ONLY_DEPS: # duplicated from DepsModifier.ONLY_DEPS dag = PrefixDag((index[d] for d in solution), specs_to_add) dag.remove_leaf_nodes_with_specs() solution = tuple(Dist(rec) for rec in dag.records) if prune: dag = PrefixDag((index[d] for d in solution), final_environment_specs) dag.prune() solution = tuple(Dist(rec) for rec in dag.records) self._check_solution(solution, pinned_specs) solution = IndexedSet(r.dependency_sort({d.name: d for d in solution})) log.debug( "solved prefix %s\n solved_linked_dists:\n %s\n", self.prefix, "\n ".join(text_type(d) for d in solution), ) return IndexedSet(index[d] for d in solution)
https://github.com/conda/conda/issues/6693
error: KeyError(True,) command: /home/jgrnt/miniconda/bin/conda install --update-deps python= numpy nose scipy matplotlib pandas pytest h5py mkl mkl-service user_agent: conda/4.4.7 requests/2.18.4 CPython/3.6.3 Linux/4.14.4-gentoo gentoo/2.4.1 glibc/2.25 _messageid: -9223372036837525416 _messagetime: 1515513689937 / 2018-01-09 10:01:29 Traceback (most recent call last): File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/exceptions.py", line 743, in __call__ return func(*args, **kwargs) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 236, in install force_reinstall=context.force, File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 437, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 385, in solve_final_state for spec in grouped_specs[True]) KeyError: True
KeyError
def _replace_prefix_in_path(self, old_prefix, new_prefix, starting_path_dirs=None): if starting_path_dirs is None: path_list = self._get_starting_path_list() else: path_list = list(starting_path_dirs) if on_win: # pragma: unix no cover if old_prefix is not None: # windows has a nasty habit of adding extra Library\bin directories prefix_dirs = tuple(self._get_path_dirs(old_prefix)) try: first_idx = path_list.index(prefix_dirs[0]) except ValueError: first_idx = 0 else: last_idx = path_list.index(prefix_dirs[-1]) del path_list[first_idx : last_idx + 1] else: first_idx = 0 if new_prefix is not None: path_list[first_idx:first_idx] = list(self._get_path_dirs(new_prefix)) else: if old_prefix is not None: try: idx = path_list.index(join(old_prefix, "bin")) except ValueError: idx = 0 else: del path_list[idx] else: idx = 0 if new_prefix is not None: path_list.insert(idx, join(new_prefix, "bin")) return self.path_conversion(path_list)
def _replace_prefix_in_path(self, old_prefix, new_prefix, starting_path_dirs=None): if starting_path_dirs is None: path_list = self._get_starting_path_list() else: path_list = list(starting_path_dirs) if on_win: # pragma: unix no cover # windows has a nasty habit of adding extra Library\bin directories prefix_dirs = tuple(self._get_path_dirs(old_prefix)) try: first_idx = path_list.index(prefix_dirs[0]) except ValueError: first_idx = 0 else: last_idx = path_list.index(prefix_dirs[-1]) del path_list[first_idx : last_idx + 1] if new_prefix is not None: path_list[first_idx:first_idx] = list(self._get_path_dirs(new_prefix)) else: try: idx = path_list.index(join(old_prefix, "bin")) except ValueError: idx = 0 else: del path_list[idx] if new_prefix is not None: path_list.insert(idx, join(new_prefix, "bin")) return self.path_conversion(path_list)
https://github.com/conda/conda/issues/6627
error: AttributeError("'NoneType' object has no attribute 'endswith'",) command: /home/wang/anaconda2/bin/conda shell.posix activate py2 user_agent: conda/4.4.4 requests/2.18.4 CPython/2.7.13 Linux/3.19.0-42-generic ubuntu/14.04 glibc/2.19 _messageid: -9223372036842325539 _messagetime: 1514696872936 / 2017-12-30 23:07:52 Traceback (most recent call last): File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 111, in main return activator_main() File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 529, in main sys.stdout.write(activator.execute()) File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 149, in execute return getattr(self, self.command)() File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 135, in activate return self._finalize(self._yield_commands(self.build_activate(self.env_name_or_prefix)), File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 247, in build_activate new_path = self.pathsep_join(self._replace_prefix_in_path(old_conda_prefix, prefix)) File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 411, in _replace_prefix_in_path idx = path_list.index(join(old_prefix, 'bin')) File "/home/wang/anaconda2/lib/python2.7/posixpath.py", line 70, in join elif path == '' or path.endswith('/'): AttributeError: 'NoneType' object has no attribute 'endswith'
AttributeError
def from_string(cls, string, channel_override=NULL): string = text_type(string) if is_url(string) and channel_override == NULL: return cls.from_url(string) if string.endswith("@"): return cls( channel="@", name=string, version="", build_string="", build_number=0, dist_name=string, ) REGEX_STR = ( r"(?:([^\s\[\]]+)::)?" # optional channel r"([^\s\[\]]+)" # 3.x dist r"(?:\[([a-zA-Z0-9_-]+)\])?" # with_features_depends ) channel, original_dist, w_f_d = re.search(REGEX_STR, string).groups() if original_dist.endswith(CONDA_TARBALL_EXTENSION): original_dist = original_dist[: -len(CONDA_TARBALL_EXTENSION)] if channel_override != NULL: channel = channel_override if not channel: channel = UNKNOWN_CHANNEL # enforce dist format dist_details = cls.parse_dist_name(original_dist) return cls( channel=channel, name=dist_details.name, version=dist_details.version, build_string=dist_details.build_string, build_number=dist_details.build_number, dist_name=original_dist, )
def from_string(cls, string, channel_override=NULL): string = text_type(string) if is_url(string) and channel_override == NULL: return cls.from_url(string) if string.endswith("@"): return cls( channel="@", name=string, version="", build_string="", build_number=0, dist_name=string, ) REGEX_STR = ( r"(?:([^\s\[\]]+)::)?" # optional channel r"([^\s\[\]]+)" # 3.x dist r"(?:\[([a-zA-Z0-9_-]+)\])?" # with_features_depends ) channel, original_dist, w_f_d = re.search(REGEX_STR, string).groups() if original_dist.endswith(CONDA_TARBALL_EXTENSION): original_dist = original_dist[: -len(CONDA_TARBALL_EXTENSION)] if channel_override != NULL: channel = channel_override if channel is None: channel = UNKNOWN_CHANNEL # enforce dist format dist_details = cls.parse_dist_name(original_dist) return cls( channel=channel, name=dist_details.name, version=dist_details.version, build_string=dist_details.build_string, build_number=dist_details.build_number, dist_name=original_dist, )
https://github.com/conda/conda/issues/6665
Solving environment: failed # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 236, in install force_reinstall=context.force, File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 437, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 407, in solve_final_state return IndexedSet(index[d] for d in solution) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/_vendor/boltons/setutils.py", line 90, in __init__ self.update(other) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/_vendor/boltons/setutils.py", line 304, in update for o in other: File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 407, in <genexpr> return IndexedSet(index[d] for d in solution) KeyError: Dist(channel='<unknown>', dist_name='dask-0.16.0-py36h73d177f_0', name='dask', version='0.16.0', build_string='py36h73d177f_0', build_number=0, base_url=None, platform=None) `$ /mnt/data/home/psommer/miniconda/bin/conda install anaconda-client` environment variables: CIO_TEST=<not set> CONDA_DEFAULT_ENV=root CONDA_PATH_BACKUP=/mnt/data/home/psommer/bin:/mnt/data/home/psommer/.local/bin:/usr/loca l/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lo cal/games:/snap/bin CONDA_PREFIX=/mnt/data/home/psommer/miniconda CONDA_PS1_BACKUP= CONDA_ROOT=/mnt/data/home/psommer/miniconda PATH=/mnt/data/home/psommer/miniconda/bin:/mnt/data/home/psommer/bin:/mnt/d ata/home/psommer/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/ usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> active environment : base active env location : /mnt/data/home/psommer/miniconda user config file : /mnt/data/home/psommer/.condarc populated config files : conda version : 4.4.6 conda-build version : not installed python version : 3.6.3.final.0 base environment : /mnt/data/home/psommer/miniconda (writable) channel URLs : https://repo.continuum.io/pkgs/main/linux-64 https://repo.continuum.io/pkgs/main/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch package cache : /mnt/data/home/psommer/miniconda/pkgs /mnt/data/home/psommer/.conda/pkgs envs directories : /mnt/data/home/psommer/miniconda/envs /mnt/data/home/psommer/.conda/envs platform : linux-64 user-agent : conda/4.4.6 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-104-generic ubuntu/16.04 glibc/2.23 UID:GID : 1042:1025 netrc file : None offline mode : False An unexpected error has occurred. Conda has prepared the above report.
KeyError
def dump(self, instance, instance_type, val): if val: return text_type(val) else: val = instance.channel # call __get__ return text_type(val)
def dump(self, instance, instance_type, val): return val and text_type(val)
https://github.com/conda/conda/issues/6665
Solving environment: failed # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 236, in install force_reinstall=context.force, File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 437, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 407, in solve_final_state return IndexedSet(index[d] for d in solution) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/_vendor/boltons/setutils.py", line 90, in __init__ self.update(other) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/_vendor/boltons/setutils.py", line 304, in update for o in other: File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 407, in <genexpr> return IndexedSet(index[d] for d in solution) KeyError: Dist(channel='<unknown>', dist_name='dask-0.16.0-py36h73d177f_0', name='dask', version='0.16.0', build_string='py36h73d177f_0', build_number=0, base_url=None, platform=None) `$ /mnt/data/home/psommer/miniconda/bin/conda install anaconda-client` environment variables: CIO_TEST=<not set> CONDA_DEFAULT_ENV=root CONDA_PATH_BACKUP=/mnt/data/home/psommer/bin:/mnt/data/home/psommer/.local/bin:/usr/loca l/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lo cal/games:/snap/bin CONDA_PREFIX=/mnt/data/home/psommer/miniconda CONDA_PS1_BACKUP= CONDA_ROOT=/mnt/data/home/psommer/miniconda PATH=/mnt/data/home/psommer/miniconda/bin:/mnt/data/home/psommer/bin:/mnt/d ata/home/psommer/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/ usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> active environment : base active env location : /mnt/data/home/psommer/miniconda user config file : /mnt/data/home/psommer/.condarc populated config files : conda version : 4.4.6 conda-build version : not installed python version : 3.6.3.final.0 base environment : /mnt/data/home/psommer/miniconda (writable) channel URLs : https://repo.continuum.io/pkgs/main/linux-64 https://repo.continuum.io/pkgs/main/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch package cache : /mnt/data/home/psommer/miniconda/pkgs /mnt/data/home/psommer/.conda/pkgs envs directories : /mnt/data/home/psommer/miniconda/envs /mnt/data/home/psommer/.conda/envs platform : linux-64 user-agent : conda/4.4.6 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-104-generic ubuntu/16.04 glibc/2.23 UID:GID : 1042:1025 netrc file : None offline mode : False An unexpected error has occurred. Conda has prepared the above report.
KeyError
def from_string(cls, string, channel_override=NULL): string = text_type(string) if is_url(string) and channel_override == NULL: return cls.from_url(string) if string.endswith("@"): return cls( channel="@", name=string, version="", build_string="", build_number=0, dist_name=string, ) REGEX_STR = ( r"(?:([^\s\[\]]+)::)?" # optional channel r"([^\s\[\]]+)" # 3.x dist r"(?:\[([a-zA-Z0-9_-]+)\])?" # with_features_depends ) channel, original_dist, w_f_d = re.search(REGEX_STR, string).groups() if original_dist.endswith(CONDA_TARBALL_EXTENSION): original_dist = original_dist[: -len(CONDA_TARBALL_EXTENSION)] if channel_override != NULL: channel = channel_override if channel is None: channel = UNKNOWN_CHANNEL # enforce dist format dist_details = cls.parse_dist_name(original_dist) return cls( channel=channel, name=dist_details.name, version=dist_details.version, build_string=dist_details.build_string, build_number=dist_details.build_number, dist_name=original_dist, )
def from_string(cls, string, channel_override=NULL): string = text_type(string) if is_url(string) and channel_override == NULL: return cls.from_url(string) if string.endswith("@"): return cls( channel="@", name=string, version="", build_string="", build_number=0, dist_name=string, ) REGEX_STR = ( r"(?:([^\s\[\]]+)::)?" # optional channel r"([^\s\[\]]+)" # 3.x dist r"(?:\[([a-zA-Z0-9_-]+)\])?" # with_features_depends ) channel, original_dist, w_f_d = re.search(REGEX_STR, string).groups() if original_dist.endswith(CONDA_TARBALL_EXTENSION): original_dist = original_dist[: -len(CONDA_TARBALL_EXTENSION)] if channel_override != NULL: channel = channel_override elif channel is None: channel = UNKNOWN_CHANNEL # enforce dist format dist_details = cls.parse_dist_name(original_dist) return cls( channel=channel, name=dist_details.name, version=dist_details.version, build_string=dist_details.build_string, build_number=dist_details.build_number, dist_name=original_dist, )
https://github.com/conda/conda/issues/6665
Solving environment: failed # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 236, in install force_reinstall=context.force, File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 437, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 407, in solve_final_state return IndexedSet(index[d] for d in solution) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/_vendor/boltons/setutils.py", line 90, in __init__ self.update(other) File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/_vendor/boltons/setutils.py", line 304, in update for o in other: File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 407, in <genexpr> return IndexedSet(index[d] for d in solution) KeyError: Dist(channel='<unknown>', dist_name='dask-0.16.0-py36h73d177f_0', name='dask', version='0.16.0', build_string='py36h73d177f_0', build_number=0, base_url=None, platform=None) `$ /mnt/data/home/psommer/miniconda/bin/conda install anaconda-client` environment variables: CIO_TEST=<not set> CONDA_DEFAULT_ENV=root CONDA_PATH_BACKUP=/mnt/data/home/psommer/bin:/mnt/data/home/psommer/.local/bin:/usr/loca l/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lo cal/games:/snap/bin CONDA_PREFIX=/mnt/data/home/psommer/miniconda CONDA_PS1_BACKUP= CONDA_ROOT=/mnt/data/home/psommer/miniconda PATH=/mnt/data/home/psommer/miniconda/bin:/mnt/data/home/psommer/bin:/mnt/d ata/home/psommer/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/ usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> active environment : base active env location : /mnt/data/home/psommer/miniconda user config file : /mnt/data/home/psommer/.condarc populated config files : conda version : 4.4.6 conda-build version : not installed python version : 3.6.3.final.0 base environment : /mnt/data/home/psommer/miniconda (writable) channel URLs : https://repo.continuum.io/pkgs/main/linux-64 https://repo.continuum.io/pkgs/main/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch package cache : /mnt/data/home/psommer/miniconda/pkgs /mnt/data/home/psommer/.conda/pkgs envs directories : /mnt/data/home/psommer/miniconda/envs /mnt/data/home/psommer/.conda/envs platform : linux-64 user-agent : conda/4.4.6 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-104-generic ubuntu/16.04 glibc/2.23 UID:GID : 1042:1025 netrc file : None offline mode : False An unexpected error has occurred. Conda has prepared the above report.
KeyError
def build_deactivate(self): # query environment old_conda_shlvl = int(os.getenv("CONDA_SHLVL", 0)) old_conda_prefix = os.getenv("CONDA_PREFIX", None) if old_conda_shlvl <= 0 or old_conda_prefix is None: return { "unset_vars": (), "set_vars": {}, "export_vars": {}, "deactivate_scripts": (), "activate_scripts": (), } deactivate_scripts = self._get_deactivate_scripts(old_conda_prefix) new_conda_shlvl = old_conda_shlvl - 1 new_path = self.pathsep_join(self._remove_prefix_from_path(old_conda_prefix)) assert old_conda_shlvl > 0 set_vars = {} if old_conda_shlvl == 1: # TODO: warn conda floor conda_prompt_modifier = "" unset_vars = ( "CONDA_PREFIX", "CONDA_DEFAULT_ENV", "CONDA_PYTHON_EXE", "CONDA_PROMPT_MODIFIER", ) export_vars = { "PATH": new_path, "CONDA_SHLVL": new_conda_shlvl, } activate_scripts = () else: new_prefix = os.getenv("CONDA_PREFIX_%d" % new_conda_shlvl) conda_default_env = self._default_env(new_prefix) conda_prompt_modifier = self._prompt_modifier(conda_default_env) unset_vars = ("CONDA_PREFIX_%d" % new_conda_shlvl,) export_vars = { "PATH": new_path, "CONDA_SHLVL": new_conda_shlvl, "CONDA_PREFIX": new_prefix, "CONDA_DEFAULT_ENV": conda_default_env, "CONDA_PROMPT_MODIFIER": conda_prompt_modifier, } activate_scripts = self._get_activate_scripts(new_prefix) self._update_prompt(set_vars, conda_prompt_modifier) return { "unset_vars": unset_vars, "set_vars": set_vars, "export_vars": export_vars, "deactivate_scripts": deactivate_scripts, "activate_scripts": activate_scripts, }
def build_deactivate(self): # query environment old_conda_shlvl = int(os.getenv("CONDA_SHLVL", 0)) if old_conda_shlvl <= 0: return { "unset_vars": (), "set_vars": {}, "export_vars": {}, "deactivate_scripts": (), "activate_scripts": (), } old_conda_prefix = os.environ["CONDA_PREFIX"] deactivate_scripts = self._get_deactivate_scripts(old_conda_prefix) new_conda_shlvl = old_conda_shlvl - 1 new_path = self.pathsep_join(self._remove_prefix_from_path(old_conda_prefix)) assert old_conda_shlvl > 0 set_vars = {} if old_conda_shlvl == 1: # TODO: warn conda floor conda_prompt_modifier = "" unset_vars = ( "CONDA_PREFIX", "CONDA_DEFAULT_ENV", "CONDA_PYTHON_EXE", "CONDA_PROMPT_MODIFIER", ) export_vars = { "PATH": new_path, "CONDA_SHLVL": new_conda_shlvl, } activate_scripts = () else: new_prefix = os.getenv("CONDA_PREFIX_%d" % new_conda_shlvl) conda_default_env = self._default_env(new_prefix) conda_prompt_modifier = self._prompt_modifier(conda_default_env) unset_vars = ("CONDA_PREFIX_%d" % new_conda_shlvl,) export_vars = { "PATH": new_path, "CONDA_SHLVL": new_conda_shlvl, "CONDA_PREFIX": new_prefix, "CONDA_DEFAULT_ENV": conda_default_env, "CONDA_PROMPT_MODIFIER": conda_prompt_modifier, } activate_scripts = self._get_activate_scripts(new_prefix) self._update_prompt(set_vars, conda_prompt_modifier) return { "unset_vars": unset_vars, "set_vars": set_vars, "export_vars": export_vars, "deactivate_scripts": deactivate_scripts, "activate_scripts": activate_scripts, }
https://github.com/conda/conda/issues/6620
error: KeyError(u'CONDA_PREFIX',) command: D:\Anaconda2\Scripts\conda shell.cmd.exe deactivate deactivate user_agent: conda/4.4.4 requests/2.18.4 CPython/2.7.14 Windows/10 Windows/10.0.16299 _messageid: -9223372036842425555 _messagetime: 1514685063692 / 2017-12-30 19:51:03 Traceback (most recent call last): File "D:\Anaconda2\lib\site-packages\conda\cli\main.py", line 111, in main return activator_main() File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 529, in main sys.stdout.write(activator.execute()) File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 149, in execute return getattr(self, self.command)() File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 139, in deactivate return self._finalize(self._yield_commands(self.build_deactivate()), File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 288, in build_deactivate old_conda_prefix = os.environ['CONDA_PREFIX'] File "D:\Anaconda2\lib\os.py", line 425, in __getitem__ return self.data[key.upper()] KeyError: u'CONDA_PREFIX'
KeyError
def main(argv=None): argv = argv or sys.argv assert len(argv) >= 3 assert argv[1].startswith("shell.") shell = argv[1].replace("shell.", "", 1) activator_args = argv[2:] activator = Activator(shell, activator_args) try: print(activator.execute(), end="") return 0 except Exception as e: from . import CondaError if isinstance(e, CondaError): print(text_type(e), file=sys.stderr) return e.return_code else: raise
def main(argv=None): argv = argv or sys.argv assert len(argv) >= 3 assert argv[1].startswith("shell.") shell = argv[1].replace("shell.", "", 1) activator_args = argv[2:] activator = Activator(shell, activator_args) try: sys.stdout.write(activator.execute()) return 0 except Exception as e: from . import CondaError if isinstance(e, CondaError): sys.stderr.write(text_type(e)) return e.return_code else: raise
https://github.com/conda/conda/issues/6620
error: KeyError(u'CONDA_PREFIX',) command: D:\Anaconda2\Scripts\conda shell.cmd.exe deactivate deactivate user_agent: conda/4.4.4 requests/2.18.4 CPython/2.7.14 Windows/10 Windows/10.0.16299 _messageid: -9223372036842425555 _messagetime: 1514685063692 / 2017-12-30 19:51:03 Traceback (most recent call last): File "D:\Anaconda2\lib\site-packages\conda\cli\main.py", line 111, in main return activator_main() File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 529, in main sys.stdout.write(activator.execute()) File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 149, in execute return getattr(self, self.command)() File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 139, in deactivate return self._finalize(self._yield_commands(self.build_deactivate()), File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 288, in build_deactivate old_conda_prefix = os.environ['CONDA_PREFIX'] File "D:\Anaconda2\lib\os.py", line 425, in __getitem__ return self.data[key.upper()] KeyError: u'CONDA_PREFIX'
KeyError
def determine_target_prefix(ctx, args=None): """Get the prefix to operate in. The prefix may not yet exist. Args: ctx: the context of conda args: the argparse args from the command line Returns: the prefix Raises: CondaEnvironmentNotFoundError if the prefix is invalid """ argparse_args = args or ctx._argparse_args try: prefix_name = argparse_args.name except AttributeError: prefix_name = None try: prefix_path = argparse_args.prefix except AttributeError: prefix_path = None if prefix_name is not None and not prefix_name.strip(): # pragma: no cover from ..exceptions import ArgumentError raise ArgumentError("Argument --name requires a value.") if prefix_path is not None and not prefix_path.strip(): # pragma: no cover from ..exceptions import ArgumentError raise ArgumentError("Argument --prefix requires a value.") if prefix_name is None and prefix_path is None: return ctx.default_prefix elif prefix_path is not None: return expand(prefix_path) else: if "/" in prefix_name: from ..exceptions import CondaValueError raise CondaValueError( "'/' not allowed in environment name: %s" % prefix_name ) if prefix_name in (ROOT_ENV_NAME, "root"): return ctx.root_prefix else: from ..exceptions import EnvironmentNameNotFound try: return locate_prefix_by_name(prefix_name) except EnvironmentNameNotFound: return join(_first_writable_envs_dir(), prefix_name)
def determine_target_prefix(ctx, args=None): """Get the prefix to operate in. The prefix may not yet exist. Args: ctx: the context of conda args: the argparse args from the command line Returns: the prefix Raises: CondaEnvironmentNotFoundError if the prefix is invalid """ argparse_args = args or ctx._argparse_args try: prefix_name = argparse_args.name except AttributeError: prefix_name = None try: prefix_path = argparse_args.prefix except AttributeError: prefix_path = None if prefix_name is None and prefix_path is None: return ctx.default_prefix elif prefix_path is not None: return expand(prefix_path) else: if "/" in prefix_name: from ..exceptions import CondaValueError raise CondaValueError( "'/' not allowed in environment name: %s" % prefix_name ) if prefix_name in (ROOT_ENV_NAME, "root"): return ctx.root_prefix else: from ..exceptions import EnvironmentNameNotFound try: return locate_prefix_by_name(prefix_name) except EnvironmentNameNotFound: return join(_first_writable_envs_dir(), prefix_name)
https://github.com/conda/conda/issues/6629
error: AssertionError() command: /Users/cpthgli/.anyenv/envs/pyenv/versions/default/bin/conda update --name --all --yes user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.4 Darwin/17.3.0 OSX/10.13.2 _messageid: -9223372036843525540 _messagetime: 1514462637935 / 2017-12-28 06:03:57 Traceback (most recent call last): File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main_update.py", line 14, in execute install(args, parser, 'update') File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/install.py", line 140, in install prefix = context.target_prefix File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/base/context.py", line 454, in target_prefix return determine_target_prefix(self) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/base/context.py", line 974, in determine_target_prefix return locate_prefix_by_name(prefix_name) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/base/context.py", line 923, in locate_prefix_by_name assert name AssertionError
AssertionError
def create_cache_dir(): cache_dir = join(PackageCache.first_writable(context.pkgs_dirs).pkgs_dir, "cache") mkdir_p_sudo_safe(cache_dir) return cache_dir
def create_cache_dir(): cache_dir = join(PackageCache.first_writable(context.pkgs_dirs).pkgs_dir, "cache") try: makedirs(cache_dir) except OSError: pass return cache_dir
https://github.com/conda/conda/issues/6630
error: AssertionError() command: /opt/intel/intelpython3/bin/conda update --all -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.9.49-moby debian/9 glibc/2.24 _messageid: -9223372036843625573 _messagetime: 1514424955743 / 2017-12-27 19:35:55 Traceback (most recent call last): File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/core/repodata.py", line 211, in _load mod_etag_headers.get('_mod')) File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/core/repodata.py", line 411, in fetch_repodata_remote_request raise Response304ContentUnchanged() conda.core.repodata.Response304ContentUnchanged During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/cli/main_update.py", line 14, in execute install(args, parser, 'update') File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/cli/install.py", line 236, in install force_reinstall=context.force, File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/core/solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/core/solve.py", line 437, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/core/solve.py", line 178, in solve_final_state index, r = self._prepare(prepared_specs) File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/core/solve.py", line 560, in _prepare self.subdirs, prepared_specs) File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/core/index.py", line 214, in get_reduced_index new_records = query_all(spec) File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/core/index.py", line 187, in query_all return tuple(concat(future.result() for future in as_completed(futures))) File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/core/repodata.py", line 99, in query self.load() File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/core/repodata.py", line 143, in load _internal_state = self._load() File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/core/repodata.py", line 215, in _load touch(self.cache_path_json) File "/opt/intel/intelpython3/lib/python3.6/site-packages/conda/gateways/disk/update.py", line 80, in touch assert isdir(dirname(path)) AssertionError
AssertionError
def _load(self): try: mtime = getmtime(self.cache_path_json) except (IOError, OSError): log.debug( "No local cache found for %s at %s", self.url_w_subdir, self.cache_path_json ) if context.use_index_cache or ( context.offline and not self.url_w_subdir.startswith("file://") ): log.debug( "Using cached data for %s at %s forced. Returning empty repodata.", self.url_w_subdir, self.cache_path_json, ) return { "_package_records": (), "_package_dists": (), "_names_index": defaultdict(list), "_track_features_index": defaultdict(list), } else: mod_etag_headers = {} else: mod_etag_headers = read_mod_and_etag(self.cache_path_json) if context.use_index_cache: log.debug( "Using cached repodata for %s at %s because use_cache=True", self.url_w_subdir, self.cache_path_json, ) _internal_state = self._read_local_repdata( mod_etag_headers.get("_etag"), mod_etag_headers.get("_mod") ) return _internal_state if context.local_repodata_ttl > 1: max_age = context.local_repodata_ttl elif context.local_repodata_ttl == 1: max_age = get_cache_control_max_age( mod_etag_headers.get("_cache_control", "") ) else: max_age = 0 timeout = mtime + max_age - time() if (timeout > 0 or context.offline) and not self.url_w_subdir.startswith( "file://" ): log.debug( "Using cached repodata for %s at %s. Timeout in %d sec", self.url_w_subdir, self.cache_path_json, timeout, ) _internal_state = self._read_local_repdata( mod_etag_headers.get("_etag"), mod_etag_headers.get("_mod") ) return _internal_state log.debug( "Local cache timed out for %s at %s", self.url_w_subdir, self.cache_path_json, ) try: raw_repodata_str = fetch_repodata_remote_request( self.url_w_credentials, mod_etag_headers.get("_etag"), mod_etag_headers.get("_mod"), ) except Response304ContentUnchanged: log.debug( "304 NOT MODIFIED for '%s'. Updating mtime and loading from disk", self.url_w_subdir, ) touch(self.cache_path_json) _internal_state = self._read_local_repdata( mod_etag_headers.get("_etag"), mod_etag_headers.get("_mod") ) return _internal_state else: if not isdir(dirname(self.cache_path_json)): mkdir_p(dirname(self.cache_path_json)) try: with open(self.cache_path_json, "w") as fh: fh.write(raw_repodata_str or "{}") except (IOError, OSError) as e: if e.errno in (EACCES, EPERM): raise NotWritableError(self.cache_path_json, e.errno, caused_by=e) else: raise _internal_state = self._process_raw_repodata_str(raw_repodata_str) self._internal_state = _internal_state self._pickle_me() return _internal_state
def _load(self): try: mtime = getmtime(self.cache_path_json) except (IOError, OSError): log.debug( "No local cache found for %s at %s", self.url_w_subdir, self.cache_path_json ) if context.use_index_cache or ( context.offline and not self.url_w_subdir.startswith("file://") ): log.debug( "Using cached data for %s at %s forced. Returning empty repodata.", self.url_w_subdir, self.cache_path_json, ) return { "_package_records": (), "_package_dists": (), "_names_index": defaultdict(list), "_track_features_index": defaultdict(list), } else: mod_etag_headers = {} else: mod_etag_headers = read_mod_and_etag(self.cache_path_json) if context.use_index_cache: log.debug( "Using cached repodata for %s at %s because use_cache=True", self.url_w_subdir, self.cache_path_json, ) _internal_state = self._read_local_repdata( mod_etag_headers.get("_etag"), mod_etag_headers.get("_mod") ) return _internal_state if context.local_repodata_ttl > 1: max_age = context.local_repodata_ttl elif context.local_repodata_ttl == 1: max_age = get_cache_control_max_age( mod_etag_headers.get("_cache_control", "") ) else: max_age = 0 timeout = mtime + max_age - time() if (timeout > 0 or context.offline) and not self.url_w_subdir.startswith( "file://" ): log.debug( "Using cached repodata for %s at %s. Timeout in %d sec", self.url_w_subdir, self.cache_path_json, timeout, ) _internal_state = self._read_local_repdata( mod_etag_headers.get("_etag"), mod_etag_headers.get("_mod") ) return _internal_state log.debug( "Local cache timed out for %s at %s", self.url_w_subdir, self.cache_path_json, ) try: raw_repodata_str = fetch_repodata_remote_request( self.url_w_credentials, mod_etag_headers.get("_etag"), mod_etag_headers.get("_mod"), ) except Response304ContentUnchanged: log.debug( "304 NOT MODIFIED for '%s'. Updating mtime and loading from disk", self.url_w_subdir, ) touch(self.cache_path_json) _internal_state = self._read_local_repdata( mod_etag_headers.get("_etag"), mod_etag_headers.get("_mod") ) return _internal_state else: if not isdir(dirname(self.cache_path_json)): mkdir_p(dirname(self.cache_path_json)) with open(self.cache_path_json, "w") as fh: fh.write(raw_repodata_str or "{}") _internal_state = self._process_raw_repodata_str(raw_repodata_str) self._internal_state = _internal_state self._pickle_me() return _internal_state
https://github.com/conda/conda/issues/6572
error: PermissionError(13, 'Permission denied') command: /Users/apple/.conda/envs/cafe/bin/conda uninstall protobuf user_agent: conda/4.4.3 requests/2.18.4 CPython/3.6.1 Darwin/16.1.0 OSX/10.12.1 _messageid: -9223372036845375609 _messagetime: 1514148478933 / 2017-12-24 14:47:58 _receipttime: 1514148478933 / 2017-12-24 14:47:58 Traceback (most recent call last): File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/exceptions.py", line 722, in __call__ return func(*args, **kwargs) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/cli/main_remove.py", line 82, in execute txn = solver.solve_for_transaction(force_remove=args.force) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 501, in solve_for_transaction force_remove, force_reinstall) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 434, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 178, in solve_final_state index, r = self._prepare(prepared_specs) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 557, in _prepare self.subdirs, prepared_specs) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 214, in get_reduced_index new_records = query_all(spec) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in query_all return tuple(concat(future.result() for future in as_completed(futures))) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 99, in query self.load() File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 143, in load _internal_state = self._load() File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 222, in _load with open(self.cache_path_json, 'w') as fh: PermissionError: [Errno 13] Permission denied: '/Users/apple/miniconda3/pkgs/cache/809318c1.json'
PermissionError
def get_egg_info_files(sp_dir): for fn in isdir(sp_dir) and os.listdir(sp_dir) or (): if fn.endswith(".egg-link"): with open(join(sp_dir, fn), "r") as reader: for egg in get_egg_info_files(reader.readline().strip()): yield egg if not fn.endswith((".egg", ".egg-info", ".dist-info")): continue path = join(sp_dir, fn) if isfile(path): yield path elif isdir(path): for path2 in [ join(path, "PKG-INFO"), join(path, "EGG-INFO", "PKG-INFO"), join(path, "METADATA"), ]: if isfile(path2): yield path2
def get_egg_info_files(sp_dir): for fn in os.listdir(sp_dir): if fn.endswith(".egg-link"): with open(join(sp_dir, fn), "r") as reader: for egg in get_egg_info_files(reader.readline().strip()): yield egg if not fn.endswith((".egg", ".egg-info", ".dist-info")): continue path = join(sp_dir, fn) if isfile(path): yield path elif isdir(path): for path2 in [ join(path, "PKG-INFO"), join(path, "EGG-INFO", "PKG-INFO"), join(path, "METADATA"), ]: if isfile(path2): yield path2
https://github.com/conda/conda/issues/6557
"command": "/Users/hideki/anaconda/bin/conda list" "user_agent": "conda/4.4.3 requests/2.14.2 CPython/3.5.2 Darwin/16.7.0 OSX/10.12.6" Traceback (most recent call last): File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/exceptions.py\", line 722, in __call__ return func(*args, **kwargs) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/cli/main_list.py\", line 150, in execute show_channel_urls=context.show_channel_urls) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/cli/main_list.py\", line 85, in print_packages other_python = get_egg_info(prefix) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/egg_info.py\", line 86, in get_egg_info for path in get_egg_info_files(join(prefix, sp_dir)): File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/egg_info.py\", line 35, in get_egg_info_files for egg in get_egg_info_files(reader.readline().strip()): File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/egg_info.py\", line 32, in get_egg_info_files for fn in os.listdir(sp_dir): FileNotFoundError: [Errno 2] No such file or directory: '/Users/hideki/darkflow'
FileNotFoundError
def _make_single_record(self, package_filename): if not package_filename.endswith(CONDA_TARBALL_EXTENSION): package_filename += CONDA_TARBALL_EXTENSION package_tarball_full_path = join(self.pkgs_dir, package_filename) log.trace("adding to package cache %s", package_tarball_full_path) extracted_package_dir = package_tarball_full_path[: -len(CONDA_TARBALL_EXTENSION)] # try reading info/repodata_record.json try: repodata_record = read_repodata_json(extracted_package_dir) package_cache_record = PackageCacheRecord.from_objects( repodata_record, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) return package_cache_record except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/repodata_record.json doesn't exists # JsonDecodeError if info/repodata_record.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because %r", join(extracted_package_dir, "info", "repodata_record.json"), e, ) # try reading info/index.json try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/index.json doesn't exist # JsonDecodeError if info/index.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because", join(extracted_package_dir, "info", "index.json"), e, ) if isdir(extracted_package_dir) and not isfile(package_tarball_full_path): # We have a directory that looks like a conda package, but without # (1) info/repodata_record.json or info/index.json, and (2) a conda package # tarball, there's not much we can do. We'll just ignore it. return None try: if self.is_writable: if isdir(extracted_package_dir): # We have a partially unpacked conda package directory. Best thing # to do is remove it and try extracting. rm_rf(extracted_package_dir) extract_tarball(package_tarball_full_path, extracted_package_dir) try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError, JSONDecodeError): # At this point, we can assume the package tarball is bad. # Remove everything and move on. rm_rf(package_tarball_full_path) rm_rf(extracted_package_dir) return None else: index_json_record = read_index_json_from_tarball( package_tarball_full_path ) except (EOFError, ReadError) as e: # EOFError: Compressed file ended before the end-of-stream marker was reached # tarfile.ReadError: file could not be opened successfully # We have a corrupted tarball. Remove the tarball so it doesn't affect # anything, and move on. log.debug( "unable to extract info/index.json from %s\n because %r", package_tarball_full_path, e, ) rm_rf(package_tarball_full_path) return None # we were able to read info/index.json, so let's continue if isfile(package_tarball_full_path): md5 = compute_md5sum(package_tarball_full_path) else: md5 = None url = first(self._urls_data, lambda x: basename(x) == package_filename) package_cache_record = PackageCacheRecord.from_objects( index_json_record, url=url, md5=md5, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) # write the info/repodata_record.json file so we can short-circuit this next time if self.is_writable: repodata_record = PackageRecord.from_objects(package_cache_record) repodata_record_path = join( extracted_package_dir, "info", "repodata_record.json" ) try: write_as_json_to_file(repodata_record_path, repodata_record) except (IOError, OSError) as e: if e.errno in (EACCES, EPERM) and isdir(dirname(repodata_record_path)): raise NotWritableError(repodata_record_path, e.errno, caused_by=e) else: raise return package_cache_record
def _make_single_record(self, package_filename): if not package_filename.endswith(CONDA_TARBALL_EXTENSION): package_filename += CONDA_TARBALL_EXTENSION package_tarball_full_path = join(self.pkgs_dir, package_filename) log.trace("adding to package cache %s", package_tarball_full_path) extracted_package_dir = package_tarball_full_path[: -len(CONDA_TARBALL_EXTENSION)] # try reading info/repodata_record.json try: repodata_record = read_repodata_json(extracted_package_dir) package_cache_record = PackageCacheRecord.from_objects( repodata_record, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) return package_cache_record except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/repodata_record.json doesn't exists # JsonDecodeError if info/repodata_record.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because %r", join(extracted_package_dir, "info", "repodata_record.json"), e, ) # try reading info/index.json try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/index.json doesn't exist # JsonDecodeError if info/index.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because", join(extracted_package_dir, "info", "index.json"), e, ) if isdir(extracted_package_dir) and not isfile(package_tarball_full_path): # We have a directory that looks like a conda package, but without # (1) info/repodata_record.json or info/index.json, and (2) a conda package # tarball, there's not much we can do. We'll just ignore it. return None try: if self.is_writable: if isdir(extracted_package_dir): # We have a partially unpacked conda package directory. Best thing # to do is remove it and try extracting. rm_rf(extracted_package_dir) extract_tarball(package_tarball_full_path, extracted_package_dir) try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError, JSONDecodeError): # At this point, we can assume the package tarball is bad. # Remove everything and move on. rm_rf(package_tarball_full_path) rm_rf(extracted_package_dir) return None else: index_json_record = read_index_json_from_tarball( package_tarball_full_path ) except (EOFError, ReadError) as e: # EOFError: Compressed file ended before the end-of-stream marker was reached # tarfile.ReadError: file could not be opened successfully # We have a corrupted tarball. Remove the tarball so it doesn't affect # anything, and move on. log.debug( "unable to extract info/index.json from %s\n because %r", package_tarball_full_path, e, ) rm_rf(package_tarball_full_path) return None # we were able to read info/index.json, so let's continue if isfile(package_tarball_full_path): md5 = compute_md5sum(package_tarball_full_path) else: md5 = None url = first(self._urls_data, lambda x: basename(x) == package_filename) package_cache_record = PackageCacheRecord.from_objects( index_json_record, url=url, md5=md5, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) # write the info/repodata_record.json file so we can short-circuit this next time if self.is_writable: repodata_record = PackageRecord.from_objects(package_cache_record) repodata_record_path = join( extracted_package_dir, "info", "repodata_record.json" ) write_as_json_to_file(repodata_record_path, repodata_record) return package_cache_record
https://github.com/conda/conda/issues/6562
error: PermissionError(13, 'Permission denied') command: /home/jing/anaconda3/bin/conda upgrade Requests user_agent: conda/4.4.3 requests/2.18.4 CPython/3.6.1 Linux/4.13.0-21-generic ubuntu/17.10 glibc/2.26 _messageid: -9223372036845975622 _messagetime: 1513948198000 / 2017-12-22 07:09:58 _receipttime: 1513993708752 / 2017-12-22 19:48:28 Traceback (most recent call last): File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 268, in _make_single_record repodata_record = read_repodata_json(extracted_package_dir) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/read.py", line 123, in read_repodata_json with open(join(extracted_package_directory, 'info', 'repodata_record.json')) as fi: File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/common/compat.py", line 120, in open closefd=closefd) FileNotFoundError: [Errno 2] No such file or directory: '/home/jing/anaconda3/pkgs/conda-4.3.31-py36_0/info/repodata_record.json' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 722, in __call__ return func(*args, **kwargs) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/main_update.py", line 14, in execute install(args, parser, 'update') File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 256, in handle_txn unlink_link_transaction.display_actions(progressive_fetch_extract) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 706, in display_actions legacy_action_groups = self.make_legacy_action_groups(pfe) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 689, in make_legacy_action_groups pfe.prepare() File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 415, in decorated return f(*args, **kwds) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 525, in prepare for prec in self.link_precs) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 525, in <genexpr> for prec in self.link_precs) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 419, in make_actions_for_record ), None) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 416, in <genexpr> pcrec for pcrec in concat(PackageCache(pkgs_dir).query(pref_or_spec) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 417, in <genexpr> for pkgs_dir in context.pkgs_dirs) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 116, in query return (pcrec for pcrec in itervalues(self._package_cache_records) if pcrec == param) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 209, in _package_cache_records self.load() File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 88, in load package_cache_record = self._make_single_record(base_name) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 339, in _make_single_record write_as_json_to_file(repodata_record_path, repodata_record) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/create.py", line 61, in write_as_json_to_file with open(file_path, str('wb')) as fo: PermissionError: [Errno 13] Permission denied: '/home/jing/anaconda3/pkgs/conda-4.3.31-py36_0/info/repodata_record.json'
FileNotFoundError
def __init__(self, path, errno, **kwargs): kwargs.update( { "path": path, "errno": errno, } ) if on_win: message = dals(""" The current user does not have write permissions to a required path. path: %(path)s """) else: message = dals(""" The current user does not have write permissions to a required path. path: %(path)s uid: %(uid)s gid: %(gid)s If you feel that permissions on this path are set incorrectly, you can manually change them by executing $ sudo chown %(uid)s:%(gid)s %(path)s In general, it's not advisable to use 'sudo conda'. """) import os kwargs.update( { "uid": os.geteuid(), "gid": os.getegid(), } ) super(NotWritableError, self).__init__(message, **kwargs)
def __init__(self, path, errno, **kwargs): kwargs.update( { "path": path, "errno": errno, } ) if on_win: message = dals(""" The current user does not have write permissions to a required path. path: %(path)s """) else: message = dals(""" The current user does not have write permissions to a required path. path: %(path)s uid: %(uid)s gid: %(gid)s If you feel that permissions on this path are set incorrectly, you can manually change them by executing $ sudo chown %(uid)s:%(gid)s %(path)s """) import os kwargs.update( { "uid": os.geteuid(), "gid": os.getegid(), } ) super(NotWritableError, self).__init__(message, **kwargs)
https://github.com/conda/conda/issues/6562
error: PermissionError(13, 'Permission denied') command: /home/jing/anaconda3/bin/conda upgrade Requests user_agent: conda/4.4.3 requests/2.18.4 CPython/3.6.1 Linux/4.13.0-21-generic ubuntu/17.10 glibc/2.26 _messageid: -9223372036845975622 _messagetime: 1513948198000 / 2017-12-22 07:09:58 _receipttime: 1513993708752 / 2017-12-22 19:48:28 Traceback (most recent call last): File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 268, in _make_single_record repodata_record = read_repodata_json(extracted_package_dir) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/read.py", line 123, in read_repodata_json with open(join(extracted_package_directory, 'info', 'repodata_record.json')) as fi: File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/common/compat.py", line 120, in open closefd=closefd) FileNotFoundError: [Errno 2] No such file or directory: '/home/jing/anaconda3/pkgs/conda-4.3.31-py36_0/info/repodata_record.json' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 722, in __call__ return func(*args, **kwargs) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/main_update.py", line 14, in execute install(args, parser, 'update') File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 256, in handle_txn unlink_link_transaction.display_actions(progressive_fetch_extract) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 706, in display_actions legacy_action_groups = self.make_legacy_action_groups(pfe) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 689, in make_legacy_action_groups pfe.prepare() File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 415, in decorated return f(*args, **kwds) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 525, in prepare for prec in self.link_precs) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 525, in <genexpr> for prec in self.link_precs) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 419, in make_actions_for_record ), None) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 416, in <genexpr> pcrec for pcrec in concat(PackageCache(pkgs_dir).query(pref_or_spec) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 417, in <genexpr> for pkgs_dir in context.pkgs_dirs) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 116, in query return (pcrec for pcrec in itervalues(self._package_cache_records) if pcrec == param) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 209, in _package_cache_records self.load() File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 88, in load package_cache_record = self._make_single_record(base_name) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 339, in _make_single_record write_as_json_to_file(repodata_record_path, repodata_record) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/create.py", line 61, in write_as_json_to_file with open(file_path, str('wb')) as fo: PermissionError: [Errno 13] Permission denied: '/home/jing/anaconda3/pkgs/conda-4.3.31-py36_0/info/repodata_record.json'
FileNotFoundError
def _make_single_record(self, package_filename): if not package_filename.endswith(CONDA_TARBALL_EXTENSION): package_filename += CONDA_TARBALL_EXTENSION package_tarball_full_path = join(self.pkgs_dir, package_filename) log.trace("adding to package cache %s", package_tarball_full_path) extracted_package_dir = package_tarball_full_path[: -len(CONDA_TARBALL_EXTENSION)] # try reading info/repodata_record.json try: repodata_record = read_repodata_json(extracted_package_dir) package_cache_record = PackageCacheRecord.from_objects( repodata_record, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) return package_cache_record except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/repodata_record.json doesn't exists # JsonDecodeError if info/repodata_record.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because %r", join(extracted_package_dir, "info", "repodata_record.json"), e, ) # try reading info/index.json try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/index.json doesn't exist # JsonDecodeError if info/index.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because", join(extracted_package_dir, "info", "index.json"), e, ) if isdir(extracted_package_dir) and not isfile(package_tarball_full_path): # We have a directory that looks like a conda package, but without # (1) info/repodata_record.json or info/index.json, and (2) a conda package # tarball, there's not much we can do. We'll just ignore it. return None try: if self.is_writable: if isdir(extracted_package_dir): # We have a partially unpacked conda package directory. Best thing # to do is remove it and try extracting. rm_rf(extracted_package_dir) extract_tarball(package_tarball_full_path, extracted_package_dir) index_json_record = read_index_json(extracted_package_dir) else: index_json_record = read_index_json_from_tarball( package_tarball_full_path ) except (EOFError, ReadError) as e: # EOFError: Compressed file ended before the end-of-stream marker was reached # tarfile.ReadError: file could not be opened successfully # We have a corrupted tarball. Remove the tarball so it doesn't affect # anything, and move on. log.debug( "unable to extract info/index.json from %s\n because %r", package_tarball_full_path, e, ) rm_rf(package_tarball_full_path) return None # we were able to read info/index.json, so let's continue if isfile(package_tarball_full_path): md5 = compute_md5sum(package_tarball_full_path) else: md5 = None url = first(self._urls_data, lambda x: basename(x) == package_filename) package_cache_record = PackageCacheRecord.from_objects( index_json_record, url=url, md5=md5, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) # write the info/repodata_record.json file so we can short-circuit this next time if self.is_writable: repodata_record = PackageRecord.from_objects(package_cache_record) repodata_record_path = join( extracted_package_dir, "info", "repodata_record.json" ) try: write_as_json_to_file(repodata_record_path, repodata_record) except (IOError, OSError) as e: if e.errno in (EACCES, EPERM) and isdir(dirname(repodata_record_path)): raise NotWritableError(repodata_record_path, e.errno, caused_by=e) else: raise return package_cache_record
def _make_single_record(self, package_filename): if not package_filename.endswith(CONDA_TARBALL_EXTENSION): package_filename += CONDA_TARBALL_EXTENSION package_tarball_full_path = join(self.pkgs_dir, package_filename) log.trace("adding to package cache %s", package_tarball_full_path) extracted_package_dir = package_tarball_full_path[: -len(CONDA_TARBALL_EXTENSION)] # try reading info/repodata_record.json try: repodata_record = read_repodata_json(extracted_package_dir) package_cache_record = PackageCacheRecord.from_objects( repodata_record, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) return package_cache_record except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/repodata_record.json doesn't exists # JsonDecodeError if info/repodata_record.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because %r", join(extracted_package_dir, "info", "repodata_record.json"), e, ) # try reading info/index.json try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/index.json doesn't exist # JsonDecodeError if info/index.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because", join(extracted_package_dir, "info", "index.json"), e, ) if isdir(extracted_package_dir) and not isfile(package_tarball_full_path): # We have a directory that looks like a conda package, but without # (1) info/repodata_record.json or info/index.json, and (2) a conda package # tarball, there's not much we can do. We'll just ignore it. return None try: if self.is_writable: if isdir(extracted_package_dir): # We have a partially unpacked conda package directory. Best thing # to do is remove it and try extracting. rm_rf(extracted_package_dir) extract_tarball(package_tarball_full_path, extracted_package_dir) index_json_record = read_index_json(extracted_package_dir) else: index_json_record = read_index_json_from_tarball( package_tarball_full_path ) except (EOFError, ReadError) as e: # EOFError: Compressed file ended before the end-of-stream marker was reached # tarfile.ReadError: file could not be opened successfully # We have a corrupted tarball. Remove the tarball so it doesn't affect # anything, and move on. log.debug( "unable to extract info/index.json from %s\n because %r", package_tarball_full_path, e, ) rm_rf(package_tarball_full_path) return None # we were able to read info/index.json, so let's continue if isfile(package_tarball_full_path): md5 = compute_md5sum(package_tarball_full_path) else: md5 = None url = first(self._urls_data, lambda x: basename(x) == package_filename) package_cache_record = PackageCacheRecord.from_objects( index_json_record, url=url, md5=md5, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) # write the info/repodata_record.json file so we can short-circuit this next time if self.is_writable: repodata_record = PackageRecord.from_objects(package_cache_record) repodata_record_path = join( extracted_package_dir, "info", "repodata_record.json" ) write_as_json_to_file(repodata_record_path, repodata_record) return package_cache_record
https://github.com/conda/conda/issues/6562
error: PermissionError(13, 'Permission denied') command: /home/jing/anaconda3/bin/conda upgrade Requests user_agent: conda/4.4.3 requests/2.18.4 CPython/3.6.1 Linux/4.13.0-21-generic ubuntu/17.10 glibc/2.26 _messageid: -9223372036845975622 _messagetime: 1513948198000 / 2017-12-22 07:09:58 _receipttime: 1513993708752 / 2017-12-22 19:48:28 Traceback (most recent call last): File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 268, in _make_single_record repodata_record = read_repodata_json(extracted_package_dir) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/read.py", line 123, in read_repodata_json with open(join(extracted_package_directory, 'info', 'repodata_record.json')) as fi: File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/common/compat.py", line 120, in open closefd=closefd) FileNotFoundError: [Errno 2] No such file or directory: '/home/jing/anaconda3/pkgs/conda-4.3.31-py36_0/info/repodata_record.json' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 722, in __call__ return func(*args, **kwargs) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/main_update.py", line 14, in execute install(args, parser, 'update') File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 256, in handle_txn unlink_link_transaction.display_actions(progressive_fetch_extract) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 706, in display_actions legacy_action_groups = self.make_legacy_action_groups(pfe) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 689, in make_legacy_action_groups pfe.prepare() File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 415, in decorated return f(*args, **kwds) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 525, in prepare for prec in self.link_precs) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 525, in <genexpr> for prec in self.link_precs) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 419, in make_actions_for_record ), None) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 416, in <genexpr> pcrec for pcrec in concat(PackageCache(pkgs_dir).query(pref_or_spec) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 417, in <genexpr> for pkgs_dir in context.pkgs_dirs) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 116, in query return (pcrec for pcrec in itervalues(self._package_cache_records) if pcrec == param) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 209, in _package_cache_records self.load() File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 88, in load package_cache_record = self._make_single_record(base_name) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 339, in _make_single_record write_as_json_to_file(repodata_record_path, repodata_record) File "/home/jing/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/create.py", line 61, in write_as_json_to_file with open(file_path, str('wb')) as fo: PermissionError: [Errno 13] Permission denied: '/home/jing/anaconda3/pkgs/conda-4.3.31-py36_0/info/repodata_record.json'
FileNotFoundError
def from_yaml(yamlstr, **kwargs): """Load and return a ``Environment`` from a given ``yaml string``""" data = yaml_load_standard(yamlstr) if kwargs is not None: for key, value in kwargs.items(): data[key] = value return Environment(**data)
def from_yaml(yamlstr, **kwargs): """Load and return a ``Environment`` from a given ``yaml string``""" data = yaml_load(yamlstr) if kwargs is not None: for key, value in kwargs.items(): data[key] = value return Environment(**data)
https://github.com/conda/conda/issues/6529
Traceback (most recent call last): File "[conda_dir]/lib/python2.7/site-packages/conda/exceptions.py", line 722, in __call__ return func(*args, **kwargs) File "[conda_dir]/lib/python2.7/site-packages/conda_env/cli/main.py", line 74, in do_call exit_code = getattr(module, func_name)(args, parser) File "[conda_dir]/lib/python2.7/site-packages/conda_env/cli/main_create.py", line 79, in execute directory=os.getcwd()) File "[conda_dir]/lib/python2.7/site-packages/conda_env/specs/__init__.py", line 20, in detect if spec.can_handle(): File "[conda_dir]/lib/python2.7/site-packages/conda_env/specs/yaml_file.py", line 14, in can_handle self._environment = env.from_file(self.filename) File "[conda_dir]/lib/python2.7/site-packages/conda_env/env.py", line 84, in from_file return from_yaml(yamlstr, filename=filename) File "[conda_dir]/lib/python2.7/site-packages/conda_env/env.py", line 72, in from_yaml data = yaml_load(yamlstr) File "[conda_dir]/lib/python2.7/site-packages/conda/common/serialize.py", line 54, in yaml_load return yaml.load(string, Loader=yaml.RoundTripLoader, version="1.2") File "[conda_dir]/lib/python2.7/site-packages/ruamel_yaml/main.py", line 75, in load return loader.get_single_data() File "[conda_dir]/lib/python2.7/site-packages/ruamel_yaml/constructor.py", line 62, in get_single_data return self.construct_document(node) File "[conda_dir]/lib/python2.7/site-packages/ruamel_yaml/constructor.py", line 71, in construct_document for dummy in generator: File "[conda_dir]/lib/python2.7/site-packages/ruamel_yaml/constructor.py", line 1049, in construct_yaml_map self.construct_mapping(node, data) File "[conda_dir]/lib/python2.7/site-packages/ruamel_yaml/constructor.py", line 978, in construct_mapping value = self.construct_object(value_node, deep=deep) File "[conda_dir]/lib/python2.7/site-packages/ruamel_yaml/constructor.py", line 120, in construct_object data = next(generator) File "[conda_dir]/lib/python2.7/site-packages/ruamel_yaml/constructor.py", line 1115, in construct_undefined node.start_mark) ConstructorError: could not determine a constructor for the tag '!!python/unicode' in "<byte string>", line 191, column 9: prefix: !!python/unicode '/home/pair/dev ... ^ environment variables: CIO_TEST=<not set> CONDA_ROOT=[conda_dir] MODULEPATH=/etc/scl/modulefiles:/etc/scl/modulefiles:/etc/scl/modulefiles:/usr/sh are/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/pair/.local/bi n:/home/pair/bin:/home/pair/.local/bin:/home/pair/bin REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> TERMINATOR_DBUS_PATH=/net/tenshu/Terminator2 WINDOWPATH=2 active environment : None user config file : /home/pair/.condarc populated config files : conda version : 4.4.2 conda-build version : not installed python version : 2.7.14.final.0 base environment : [conda_dir] (writable) channel URLs : https://repo.continuum.io/pkgs/main/linux-64 https://repo.continuum.io/pkgs/main/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch package cache : [conda_dir]/pkgs /home/pair/.conda/pkgs envs directories : [conda_dir]/envs /home/pair/.conda/envs platform : linux-64 user-agent : conda/4.4.2 requests/2.18.4 CPython/2.7.14 Linux/4.13.16-100.fc25.x86_64 fedora/25 glibc/2.24 UID:GID : 1000:1000 netrc file : None offline mode : False
ConstructorError
def register_env(location): location = normpath(location) if "placehold_pl" in location: # Don't record envs created by conda-build. return if location in yield_lines(USER_ENVIRONMENTS_TXT_FILE): # Nothing to do. Location is already recorded in a known environments.txt file. return with open(USER_ENVIRONMENTS_TXT_FILE, "a") as fh: fh.write(ensure_text_type(location)) fh.write("\n")
def register_env(location): location = normpath(location) if "placehold_pl" in location: # Don't record envs created by conda-build. return if location in yield_lines(USER_ENVIRONMENTS_TXT_FILE): # Nothing to do. Location is already recorded in a known environments.txt file. return with open(USER_ENVIRONMENTS_TXT_FILE, "a") as fh: fh.write(location) fh.write("\n")
https://github.com/conda/conda/issues/6541
Traceback (most recent call last): File "/Users/kfranz/continuum/conda/conda/core/link.py", line 535, in _execute_actions action.execute() File "/Users/kfranz/continuum/conda/conda/core/path_actions.py", line 876, in execute register_env(self.target_prefix) File "/Users/kfranz/continuum/conda/conda/core/envs_manager.py", line 28, in register_env if location in yield_lines(USER_ENVIRONMENTS_TXT_FILE): File "/Users/kfranz/continuum/conda/conda/gateways/disk/read.py", line 49, in yield_lines if not line or line.startswith('#'): UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 54: ordinal not in range(128)
UnicodeDecodeError
def spinner(message=None, enabled=True, json=False): """ Args: message (str, optional): An optional message to prefix the spinner with. If given, ': ' are automatically added. enabled (bool): If False, usage is a no-op. json (bool): If True, will not output non-json to stdout. """ sp = Spinner(enabled) exception_raised = False try: if message: if json: pass else: sys.stdout.write("%s: " % message) sys.stdout.flush() if not json: sp.start() yield except: exception_raised = True raise finally: if not json: sp.stop() if message: if json: pass else: try: if exception_raised: sys.stdout.write("failed\n") else: sys.stdout.write("done\n") sys.stdout.flush() except (IOError, OSError) as e: # Ignore BrokenPipeError and errors related to stdout or stderr being # closed by a downstream program. if e.errno not in (EPIPE, ESHUTDOWN): raise
def spinner(message=None, enabled=True, json=False): """ Args: message (str, optional): An optional message to prefix the spinner with. If given, ': ' are automatically added. enabled (bool): If False, usage is a no-op. json (bool): If True, will not output non-json to stdout. """ sp = Spinner(enabled) exception_raised = False try: if message: if json: pass else: sys.stdout.write("%s: " % message) sys.stdout.flush() if not json: sp.start() yield except: exception_raised = True raise finally: if not json: sp.stop() if message: if json: pass else: if exception_raised: sys.stdout.write("failed\n") else: sys.stdout.write("done\n") sys.stdout.flush()
https://github.com/conda/conda/issues/6538
Traceback (most recent call last): File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/exceptions.py\", line 722, in __call__ return func(*args, **kwargs) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/main_create.py\", line 11, in execute install(args, parser, 'create') File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/install.py\", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/install.py\", line 265, in handle_txn progressive_fetch_extract.execute() File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py\", line 543, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py\", line 595, in _execute_actions progress_bar.close() File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/common/io.py\", line 376, in close self.pbar.close() File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py\", line 1054, in close self.bar_format, self.postfix, self.unit_divisor)) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py\", line 201, in print_status fp_write('\\r' + s + (' ' * max(last_len[0] - len_s, 0))) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py\", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def close(self): try: if self.json: sys.stdout.write( '{"fetch":"%s","finished":true,"maxval":1,"progress":1}\n\0' % self.description ) sys.stdout.flush() elif self.enabled: self.pbar.close() except (IOError, OSError) as e: # Ignore BrokenPipeError and errors related to stdout or stderr being # closed by a downstream program. if e.errno not in (EPIPE, ESHUTDOWN): raise self.enabled = False
def close(self): if self.json: sys.stdout.write( '{"fetch":"%s","finished":true,"maxval":1,"progress":1}\n\0' % self.description ) sys.stdout.flush() elif self.enabled: self.pbar.close() self.enabled = False
https://github.com/conda/conda/issues/6538
Traceback (most recent call last): File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/exceptions.py\", line 722, in __call__ return func(*args, **kwargs) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/main_create.py\", line 11, in execute install(args, parser, 'create') File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/install.py\", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/install.py\", line 265, in handle_txn progressive_fetch_extract.execute() File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py\", line 543, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py\", line 595, in _execute_actions progress_bar.close() File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/common/io.py\", line 376, in close self.pbar.close() File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py\", line 1054, in close self.bar_format, self.postfix, self.unit_divisor)) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py\", line 201, in print_status fp_write('\\r' + s + (' ' * max(last_len[0] - len_s, 0))) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py\", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError
def _make_single_record(self, package_filename): if not package_filename.endswith(CONDA_TARBALL_EXTENSION): package_filename += CONDA_TARBALL_EXTENSION package_tarball_full_path = join(self.pkgs_dir, package_filename) log.trace("adding to package cache %s", package_tarball_full_path) extracted_package_dir = package_tarball_full_path[: -len(CONDA_TARBALL_EXTENSION)] # try reading info/repodata_record.json try: repodata_record = read_repodata_json(extracted_package_dir) package_cache_record = PackageCacheRecord.from_objects( repodata_record, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) return package_cache_record except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/repodata_record.json doesn't exists # JsonDecodeError if info/repodata_record.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because %r", join(extracted_package_dir, "info", "repodata_record.json"), e, ) # try reading info/index.json try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError, JSONDecodeError) as e: # IOError / OSError if info/index.json doesn't exist # JsonDecodeError if info/index.json is partially extracted or corrupted # python 2.7 raises ValueError instead of JsonDecodeError # ValueError("No JSON object could be decoded") log.debug( "unable to read %s\n because", join(extracted_package_dir, "info", "index.json"), e, ) if isdir(extracted_package_dir) and not isfile(package_tarball_full_path): # We have a directory that looks like a conda package, but without # (1) info/repodata_record.json or info/index.json, and (2) a conda package # tarball, there's not much we can do. We'll just ignore it. return None try: if self.is_writable: if isdir(extracted_package_dir): # We have a partially unpacked conda package directory. Best thing # to do is remove it and try extracting. rm_rf(extracted_package_dir) extract_tarball(package_tarball_full_path, extracted_package_dir) index_json_record = read_index_json(extracted_package_dir) else: index_json_record = read_index_json_from_tarball( package_tarball_full_path ) except (EOFError, ReadError) as e: # EOFError: Compressed file ended before the end-of-stream marker was reached # tarfile.ReadError: file could not be opened successfully # We have a corrupted tarball. Remove the tarball so it doesn't affect # anything, and move on. log.debug( "unable to extract info/index.json from %s\n because %r", package_tarball_full_path, e, ) rm_rf(package_tarball_full_path) return None # we were able to read info/index.json, so let's continue if isfile(package_tarball_full_path): md5 = compute_md5sum(package_tarball_full_path) else: md5 = None url = first(self._urls_data, lambda x: basename(x) == package_filename) package_cache_record = PackageCacheRecord.from_objects( index_json_record, url=url, md5=md5, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) # write the info/repodata_record.json file so we can short-circuit this next time if self.is_writable: repodata_record = PackageRecord.from_objects(package_cache_record) repodata_record_path = join( extracted_package_dir, "info", "repodata_record.json" ) write_as_json_to_file(repodata_record_path, repodata_record) return package_cache_record
def _make_single_record(self, package_filename): if not package_filename.endswith(CONDA_TARBALL_EXTENSION): package_filename += CONDA_TARBALL_EXTENSION package_tarball_full_path = join(self.pkgs_dir, package_filename) log.trace("adding to package cache %s", package_tarball_full_path) extracted_package_dir = package_tarball_full_path[: -len(CONDA_TARBALL_EXTENSION)] # try reading info/repodata_record.json try: repodata_record = read_repodata_json(extracted_package_dir) package_cache_record = PackageCacheRecord.from_objects( repodata_record, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) return package_cache_record except (IOError, OSError): # no info/repodata_record.json exists # try reading info/index.json try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError): # info/index.json doesn't exist either if isdir(extracted_package_dir) and not isfile(package_tarball_full_path): # We have a directory that looks like a conda package, but without # (1) info/repodata_record.json or info/index.json, and (2) a conda package # tarball, there's not much we can do. We'll just ignore it. return None try: if self.is_writable: if isdir(extracted_package_dir): # We have a partially unpacked conda package directory. Best thing # to do is remove it and try extracting. rm_rf(extracted_package_dir) extract_tarball(package_tarball_full_path, extracted_package_dir) index_json_record = read_index_json(extracted_package_dir) else: index_json_record = read_index_json_from_tarball( package_tarball_full_path ) except (EOFError, ReadError): # EOFError: Compressed file ended before the end-of-stream marker was reached # tarfile.ReadError: file could not be opened successfully rm_rf(package_tarball_full_path) return None if isfile(package_tarball_full_path): md5 = compute_md5sum(package_tarball_full_path) else: md5 = None url = first(self._urls_data, lambda x: basename(x) == package_filename) package_cache_record = PackageCacheRecord.from_objects( index_json_record, url=url, md5=md5, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) # write the info/repodata_record.json file so we can short-circuit this next time if self.is_writable: repodata_record = PackageRecord.from_objects(package_cache_record) repodata_record_path = join( extracted_package_dir, "info", "repodata_record.json" ) write_as_json_to_file(repodata_record_path, repodata_record) return package_cache_record
https://github.com/conda/conda/issues/6530
Traceback (most recent call last): File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 722, in __call__ return func(*args, **kwargs) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 256, in handle_txn unlink_link_transaction.display_actions(progressive_fetch_extract) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/core/link.py", line 706, in display_actions legacy_action_groups = self.make_legacy_action_groups(pfe) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/core/link.py", line 689, in make_legacy_action_groups pfe.prepare() File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/common/io.py", line 402, in decorated return f(*args, **kwds) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 508, in prepare for prec in self.link_precs) File "/home/pablo/anaconda/lib/python2.7/_abcoll.py", line 571, in update for key, value in other: File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 508, in <genexpr> for prec in self.link_precs) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 402, in make_actions_for_record ), None) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 399, in <genexpr> pcrec for pcrec in concat(PackageCache(pkgs_dir).query(pref_or_spec) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 400, in <genexpr> for pkgs_dir in context.pkgs_dirs) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 116, in query return (pcrec for pcrec in itervalues(self._package_cache_records) if pcrec == param) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 209, in _package_cache_records self.load() File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 88, in load package_cache_record = self._make_single_record(base_name) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 279, in _make_single_record index_json_record = read_index_json(extracted_package_dir) File "/home/pablo/anaconda/lib/python2.7/site-packages/conda/gateways/disk/read.py", line 112, in read_index_json record = IndexJsonRecord(**json.load(fi)) File "/home/pablo/anaconda/lib/python2.7/json/__init__.py", line 291, in load **kw) File "/home/pablo/anaconda/lib/python2.7/json/__init__.py", line 339, in loads return _default_decoder.decode(s) File "/home/pablo/anaconda/lib/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/pablo/anaconda/lib/python2.7/json/decoder.py", line 382, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded
ValueError
def solve_final_state( self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, force_remove=NULL ): """Gives the final, solved state of the environment. Args: deps_modifier (DepsModifier): An optional flag indicating special solver handling for dependencies. The default solver behavior is to be as conservative as possible with dependency updates (in the case the dependency already exists in the environment), while still ensuring all dependencies are satisfied. Options include * NO_DEPS * ONLY_DEPS * UPDATE_DEPS * UPDATE_DEPS_ONLY_DEPS prune (bool): If ``True``, the solution will not contain packages that were previously brought into the environment as dependencies but are no longer required as dependencies and are not user-requested. ignore_pinned (bool): If ``True``, the solution will ignore pinned package configuration for the prefix. force_remove (bool): Forces removal of a package without removing packages that depend on it. Returns: Tuple[PackageRef]: In sorted dependency order from roots to leaves, the package references for the solved state of the environment. """ prune = context.prune if prune is NULL else prune ignore_pinned = context.ignore_pinned if ignore_pinned is NULL else ignore_pinned deps_modifier = context.deps_modifier if deps_modifier is NULL else deps_modifier if isinstance(deps_modifier, string_types): deps_modifier = DepsModifier(deps_modifier.lower()) specs_to_remove = self.specs_to_remove specs_to_add = self.specs_to_add # force_remove is a special case where we return early if specs_to_remove and force_remove: if specs_to_add: raise NotImplementedError() index, r = self._prepare(specs_to_remove) solution = tuple( Dist(rec) for rec in PrefixData(self.prefix).iter_records() if not any(spec.match(rec) for spec in specs_to_remove) ) return IndexedSet( index[d] for d in r.dependency_sort({d.name: d for d in solution}) ) log.debug( "solving prefix %s\n specs_to_remove: %s\n specs_to_add: %s\n prune: %s", self.prefix, specs_to_remove, specs_to_add, prune, ) # declare starting point, the initial state of the environment # `solution` and `specs_map` are mutated throughout this method prefix_data = PrefixData(self.prefix) solution = tuple(Dist(d) for d in prefix_data.iter_records()) specs_from_history_map = History(self.prefix).get_requested_specs_map() if prune or deps_modifier == DepsModifier.UPDATE_ALL: # Start with empty specs map for UPDATE_ALL because we're optimizing the update # only for specs the user has requested; it's ok to remove dependencies. specs_map = odict() # However, because of https://github.com/conda/constructor/issues/138, we need # to hard-code keeping conda, conda-build, and anaconda, if they're already in # the environment. solution_pkg_names = set(d.name for d in solution) ensure_these = ( pkg_name for pkg_name in { "anaconda", "conda", "conda-build", } if pkg_name not in specs_from_history_map and pkg_name in solution_pkg_names ) for pkg_name in ensure_these: specs_from_history_map[pkg_name] = MatchSpec(pkg_name) else: specs_map = odict((d.name, MatchSpec(d.name)) for d in solution) # add in historically-requested specs specs_map.update(specs_from_history_map) # let's pretend for now that this is the right place to build the index prepared_specs = set( concatv( specs_to_remove, specs_to_add, itervalues(specs_from_history_map), ) ) index, r = self._prepare(prepared_specs) if specs_to_remove: # In a previous implementation, we invoked SAT here via `r.remove()` to help with # spec removal, and then later invoking SAT again via `r.solve()`. Rather than invoking # SAT for spec removal determination, we can use the DAG and simple tree traversal # if we're careful about how we handle features. We still invoke sat via `r.solve()` # later. _track_fts_specs = ( spec for spec in specs_to_remove if "track_features" in spec ) feature_names = set( concat(spec.get_raw_value("track_features") for spec in _track_fts_specs) ) dag = PrefixDag((index[dist] for dist in solution), itervalues(specs_map)) removed_records = [] for spec in specs_to_remove: # If the spec was a provides_features spec, then we need to also remove every # package with a requires_feature that matches the provides_feature. The # `dag.remove_spec()` method handles that for us. log.trace("using dag to remove records for %s", spec) removed_records.extend(dag.remove_spec(spec)) for rec in removed_records: # We keep specs (minus the feature part) for the non provides_features packages # if they're in the history specs. Otherwise, we pop them from the specs_map. rec_has_a_feature = set(rec.features or ()) & feature_names if rec_has_a_feature and rec.name in specs_from_history_map: spec = specs_map.get(rec.name, MatchSpec(rec.name)) spec._match_components.pop("features", None) specs_map[spec.name] = spec else: specs_map.pop(rec.name, None) solution = tuple(Dist(rec) for rec in dag.records) if not removed_records and not prune: raise PackagesNotFoundError(tuple(spec.name for spec in specs_to_remove)) # We handle as best as possible environments in inconsistent states. To do this, # we remove now from consideration the set of packages causing inconsistencies, # and then we add them back in following the main SAT call. _, inconsistent_dists = r.bad_installed(solution, ()) add_back_map = {} # name: (dist, spec) if log.isEnabledFor(DEBUG): log.debug( "inconsistent dists: %s", dashlist(inconsistent_dists) if inconsistent_dists else "None", ) if inconsistent_dists: for dist in inconsistent_dists: # pop and save matching spec in specs_map add_back_map[dist.name] = (dist, specs_map.pop(dist.name, None)) solution = tuple(dist for dist in solution if dist not in inconsistent_dists) # For the remaining specs in specs_map, add target to each spec. `target` is a reference # to the package currently existing in the environment. Setting target instructs the # solver to not disturb that package if it's not necessary. # If the spec.name is being modified by inclusion in specs_to_add, we don't set `target`, # since we *want* the solver to modify/update that package. # # TLDR: when working with MatchSpec objects, # - to minimize the version change, set MatchSpec(name=name, target=dist.full_name) # - to freeze the package, set all the components of MatchSpec individually for pkg_name, spec in iteritems(specs_map): matches_for_spec = tuple(dist for dist in solution if spec.match(index[dist])) if matches_for_spec: if len(matches_for_spec) != 1: raise CondaError( dals(""" Conda encountered an error with your environment. Please report an issue at https://github.com/conda/conda/issues/new. In your report, please include the output of 'conda info' and 'conda list' for the active environment, along with the command you invoked that resulted in this error. matches_for_spec: %s """) % dashlist((text_type(s) for s in matches_for_spec), indent=4) ) target_dist = matches_for_spec[0] if deps_modifier == DepsModifier.FREEZE_INSTALLED: new_spec = MatchSpec(index[target_dist]) else: target = Dist(target_dist).full_name new_spec = MatchSpec(spec, target=target) specs_map[pkg_name] = new_spec if log.isEnabledFor(TRACE): log.trace("specs_map with targets: %s", specs_map) # If we're in UPDATE_ALL mode, we need to drop all the constraints attached to specs, # so they can all float and the solver can find the most up-to-date solution. In the case # of UPDATE_ALL, `specs_map` wasn't initialized with packages from the current environment, # but *only* historically-requested specs. This lets UPDATE_ALL drop dependencies if # they're no longer needed, and their presence would otherwise prevent the updated solution # the user most likely wants. if deps_modifier == DepsModifier.UPDATE_ALL: specs_map = { pkg_name: MatchSpec(spec.name, optional=spec.optional) for pkg_name, spec in iteritems(specs_map) } # The anaconda spec is a special case here, because of the 'custom' version. # Because of https://github.com/conda/conda/issues/6350, and until we implement # something like https://github.com/ContinuumIO/anaconda-issues/issues/4298, I think # this is the best we're going to do. if "anaconda" in specs_map: specs_map["anaconda"] = MatchSpec("anaconda>1") # As a business rule, we never want to update python beyond the current minor version, # unless that's requested explicitly by the user (which we actively discourage). if "python" in specs_map: python_prefix_rec = prefix_data.get("python") if python_prefix_rec: python_spec = specs_map["python"] if not python_spec.get("version"): pinned_version = ( get_major_minor_version(python_prefix_rec.version) + ".*" ) specs_map["python"] = MatchSpec(python_spec, version=pinned_version) # For the aggressive_update_packages configuration parameter, we strip any target # that's been set. if not context.offline: for spec in context.aggressive_update_packages: if spec.name in specs_map: old_spec = specs_map[spec.name] specs_map[spec.name] = MatchSpec(old_spec, target=None) if ( context.auto_update_conda and paths_equal(self.prefix, context.root_prefix) and any(dist.name == "conda" for dist in solution) ): specs_map["conda"] = MatchSpec("conda") # add in explicitly requested specs from specs_to_add # this overrides any name-matching spec already in the spec map specs_map.update((s.name, s) for s in specs_to_add) # collect additional specs to add to the solution track_features_specs = pinned_specs = () if context.track_features: track_features_specs = tuple(MatchSpec(x + "@") for x in context.track_features) if not ignore_pinned: pinned_specs = get_pinned_specs(self.prefix) final_environment_specs = IndexedSet( concatv( itervalues(specs_map), track_features_specs, pinned_specs, ) ) # We've previously checked `solution` for consistency (which at that point was the # pre-solve state of the environment). Now we check our compiled set of # `final_environment_specs` for the possibility of a solution. If there are conflicts, # we can often avoid them by neutering specs that have a target (e.g. removing version # constraint) and also making them optional. The result here will be less cases of # `UnsatisfiableError` handed to users, at the cost of more packages being modified # or removed from the environment. conflicting_specs = r.get_conflicting_specs(tuple(final_environment_specs)) if log.isEnabledFor(DEBUG): log.debug("conflicting specs: %s", dashlist(conflicting_specs)) for spec in conflicting_specs: if spec.target: final_environment_specs.remove(spec) neutered_spec = MatchSpec(spec.name, target=spec.target, optional=True) final_environment_specs.add(neutered_spec) # Finally! We get to call SAT. if log.isEnabledFor(DEBUG): log.debug( "final specs to add: %s", dashlist(sorted(text_type(s) for s in final_environment_specs)), ) solution = r.solve(tuple(final_environment_specs)) # return value is List[dist] # add back inconsistent packages to solution if add_back_map: for name, (dist, spec) in iteritems(add_back_map): if not any(d.name == name for d in solution): solution.append(dist) if spec: final_environment_specs.add(spec) # Special case handling for various DepsModifer flags. Maybe this block could be pulled # out into its own non-public helper method? if deps_modifier == DepsModifier.NO_DEPS: # In the NO_DEPS case, we need to start with the original list of packages in the # environment, and then only modify packages that match specs_to_add or # specs_to_remove. _no_deps_solution = IndexedSet(Dist(rec) for rec in prefix_data.iter_records()) only_remove_these = set( dist for spec in specs_to_remove for dist in _no_deps_solution if spec.match(index[dist]) ) _no_deps_solution -= only_remove_these only_add_these = set( dist for spec in specs_to_add for dist in solution if spec.match(index[dist]) ) remove_before_adding_back = set(dist.name for dist in only_add_these) _no_deps_solution = IndexedSet( dist for dist in _no_deps_solution if dist.name not in remove_before_adding_back ) _no_deps_solution |= only_add_these solution = _no_deps_solution elif deps_modifier == DepsModifier.ONLY_DEPS: # Using a special instance of the DAG to remove leaf nodes that match the original # specs_to_add. It's important to only remove leaf nodes, because a typical use # might be `conda install --only-deps python=2 flask`, and in that case we'd want # to keep python. dag = PrefixDag((index[d] for d in solution), specs_to_add) dag.remove_leaf_nodes_with_specs() solution = tuple(Dist(rec) for rec in dag.records) elif deps_modifier in ( DepsModifier.UPDATE_DEPS, DepsModifier.UPDATE_DEPS_ONLY_DEPS, ): # Here we have to SAT solve again :( It's only now that we know the dependency # chain of specs_to_add. specs_to_add_names = set(spec.name for spec in specs_to_add) update_names = set() dag = PrefixDag((index[d] for d in solution), final_environment_specs) for spec in specs_to_add: node = dag.get_node_by_name(spec.name) for ascendant in node.all_ascendants(): ascendant_name = ascendant.record.name if ascendant_name not in specs_to_add_names: update_names.add(ascendant_name) grouped_specs = groupby( lambda s: s.name in update_names, final_environment_specs ) new_final_environment_specs = set(grouped_specs[False]) update_specs = set( MatchSpec(spec.name, optional=spec.optional) for spec in grouped_specs[True] ) final_environment_specs = new_final_environment_specs | update_specs solution = r.solve(final_environment_specs) if deps_modifier == DepsModifier.UPDATE_DEPS_ONLY_DEPS: # duplicated from DepsModifier.ONLY_DEPS dag = PrefixDag((index[d] for d in solution), specs_to_add) dag.remove_leaf_nodes_with_specs() solution = tuple(Dist(rec) for rec in dag.records) if prune: dag = PrefixDag((index[d] for d in solution), final_environment_specs) dag.prune() solution = tuple(Dist(rec) for rec in dag.records) self._check_solution(solution, pinned_specs) solution = IndexedSet(r.dependency_sort({d.name: d for d in solution})) log.debug( "solved prefix %s\n solved_linked_dists:\n %s\n", self.prefix, "\n ".join(text_type(d) for d in solution), ) return IndexedSet(index[d] for d in solution)
def solve_final_state( self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, force_remove=NULL ): """Gives the final, solved state of the environment. Args: deps_modifier (DepsModifier): An optional flag indicating special solver handling for dependencies. The default solver behavior is to be as conservative as possible with dependency updates (in the case the dependency already exists in the environment), while still ensuring all dependencies are satisfied. Options include * NO_DEPS * ONLY_DEPS * UPDATE_DEPS * UPDATE_DEPS_ONLY_DEPS prune (bool): If ``True``, the solution will not contain packages that were previously brought into the environment as dependencies but are no longer required as dependencies and are not user-requested. ignore_pinned (bool): If ``True``, the solution will ignore pinned package configuration for the prefix. force_remove (bool): Forces removal of a package without removing packages that depend on it. Returns: Tuple[PackageRef]: In sorted dependency order from roots to leaves, the package references for the solved state of the environment. """ prune = context.prune if prune is NULL else prune ignore_pinned = context.ignore_pinned if ignore_pinned is NULL else ignore_pinned deps_modifier = context.deps_modifier if deps_modifier is NULL else deps_modifier if isinstance(deps_modifier, string_types): deps_modifier = DepsModifier(deps_modifier.lower()) specs_to_remove = self.specs_to_remove specs_to_add = self.specs_to_add # force_remove is a special case where we return early if specs_to_remove and force_remove: if specs_to_add: raise NotImplementedError() index, r = self._prepare(specs_to_remove) solution = tuple( Dist(rec) for rec in PrefixData(self.prefix).iter_records() if not any(spec.match(rec) for spec in specs_to_remove) ) return IndexedSet( index[d] for d in r.dependency_sort({d.name: d for d in solution}) ) log.debug( "solving prefix %s\n specs_to_remove: %s\n specs_to_add: %s\n prune: %s", self.prefix, specs_to_remove, specs_to_add, prune, ) # declare starting point, the initial state of the environment # `solution` and `specs_map` are mutated throughout this method prefix_data = PrefixData(self.prefix) solution = tuple(Dist(d) for d in prefix_data.iter_records()) specs_from_history_map = History(self.prefix).get_requested_specs_map() if prune or deps_modifier == DepsModifier.UPDATE_ALL: # Start with empty specs map for UPDATE_ALL because we're optimizing the update # only for specs the user has requested; it's ok to remove dependencies. specs_map = odict() # However, because of https://github.com/conda/constructor/issues/138, we need # to hard-code keeping conda, conda-build, and anaconda, if they're already in # the environment. solution_pkg_names = set(d.name for d in solution) ensure_these = ( pkg_name for pkg_name in { "anaconda", "conda", "conda-build", } if pkg_name not in specs_from_history_map and pkg_name in solution_pkg_names ) for pkg_name in ensure_these: specs_from_history_map[pkg_name] = MatchSpec(pkg_name) else: specs_map = odict((d.name, MatchSpec(d.name)) for d in solution) # add in historically-requested specs specs_map.update(specs_from_history_map) # let's pretend for now that this is the right place to build the index prepared_specs = set( concatv( specs_to_remove, specs_to_add, itervalues(specs_from_history_map), ) ) index, r = self._prepare(prepared_specs) if specs_to_remove: # In a previous implementation, we invoked SAT here via `r.remove()` to help with # spec removal, and then later invoking SAT again via `r.solve()`. Rather than invoking # SAT for spec removal determination, we can use the DAG and simple tree traversal # if we're careful about how we handle features. We still invoke sat via `r.solve()` # later. _track_fts_specs = ( spec for spec in specs_to_remove if "track_features" in spec ) feature_names = set( concat(spec.get_raw_value("track_features") for spec in _track_fts_specs) ) dag = PrefixDag((index[dist] for dist in solution), itervalues(specs_map)) removed_records = [] for spec in specs_to_remove: # If the spec was a provides_features spec, then we need to also remove every # package with a requires_feature that matches the provides_feature. The # `dag.remove_spec()` method handles that for us. log.trace("using dag to remove records for %s", spec) removed_records.extend(dag.remove_spec(spec)) for rec in removed_records: # We keep specs (minus the feature part) for the non provides_features packages # if they're in the history specs. Otherwise, we pop them from the specs_map. rec_has_a_feature = set(rec.features or ()) & feature_names if rec_has_a_feature and rec.name in specs_from_history_map: spec = specs_map.get(rec.name, MatchSpec(rec.name)) spec._match_components.pop("features", None) specs_map[spec.name] = spec else: specs_map.pop(rec.name, None) solution = tuple(Dist(rec) for rec in dag.records) if not removed_records and not prune: raise PackagesNotFoundError(tuple(spec.name for spec in specs_to_remove)) # We handle as best as possible environments in inconsistent states. To do this, # we remove now from consideration the set of packages causing inconsistencies, # and then we add them back in following the main SAT call. _, inconsistent_dists = r.bad_installed(solution, ()) add_back_map = {} # name: (dist, spec) if log.isEnabledFor(DEBUG): log.debug( "inconsistent dists: %s", dashlist(inconsistent_dists) if inconsistent_dists else "None", ) if inconsistent_dists: for dist in inconsistent_dists: # pop and save matching spec in specs_map add_back_map[dist.name] = (dist, specs_map.pop(dist.name, None)) solution = tuple(dist for dist in solution if dist not in inconsistent_dists) # For the remaining specs in specs_map, add target to each spec. `target` is a reference # to the package currently existing in the environment. Setting target instructs the # solver to not disturb that package if it's not necessary. # If the spec.name is being modified by inclusion in specs_to_add, we don't set `target`, # since we *want* the solver to modify/update that package. # # TLDR: when working with MatchSpec objects, # - to minimize the version change, set MatchSpec(name=name, target=dist.full_name) # - to freeze the package, set all the components of MatchSpec individually for pkg_name, spec in iteritems(specs_map): matches_for_spec = tuple(dist for dist in solution if spec.match(index[dist])) if matches_for_spec: if len(matches_for_spec) != 1: raise CondaError( dals(""" Conda encountered an error with your environment. Please report an issue at https://github.com/conda/conda/issues/new. In your report, please include the output of 'conda info' and 'conda list' for the active environment, along with the command you invoked that resulted in this error. matches_for_spec: %s """) % matches_for_spec ) target_dist = matches_for_spec[0] if deps_modifier == DepsModifier.FREEZE_INSTALLED: new_spec = MatchSpec(index[target_dist]) else: target = Dist(target_dist).full_name new_spec = MatchSpec(spec, target=target) specs_map[pkg_name] = new_spec if log.isEnabledFor(TRACE): log.trace("specs_map with targets: %s", specs_map) # If we're in UPDATE_ALL mode, we need to drop all the constraints attached to specs, # so they can all float and the solver can find the most up-to-date solution. In the case # of UPDATE_ALL, `specs_map` wasn't initialized with packages from the current environment, # but *only* historically-requested specs. This lets UPDATE_ALL drop dependencies if # they're no longer needed, and their presence would otherwise prevent the updated solution # the user most likely wants. if deps_modifier == DepsModifier.UPDATE_ALL: specs_map = { pkg_name: MatchSpec(spec.name, optional=spec.optional) for pkg_name, spec in iteritems(specs_map) } # The anaconda spec is a special case here, because of the 'custom' version. # Because of https://github.com/conda/conda/issues/6350, and until we implement # something like https://github.com/ContinuumIO/anaconda-issues/issues/4298, I think # this is the best we're going to do. if "anaconda" in specs_map: specs_map["anaconda"] = MatchSpec("anaconda>1") # As a business rule, we never want to update python beyond the current minor version, # unless that's requested explicitly by the user (which we actively discourage). if "python" in specs_map: python_prefix_rec = prefix_data.get("python") if python_prefix_rec: python_spec = specs_map["python"] if not python_spec.get("version"): pinned_version = ( get_major_minor_version(python_prefix_rec.version) + ".*" ) specs_map["python"] = MatchSpec(python_spec, version=pinned_version) # For the aggressive_update_packages configuration parameter, we strip any target # that's been set. if not context.offline: for spec in context.aggressive_update_packages: if spec.name in specs_map: old_spec = specs_map[spec.name] specs_map[spec.name] = MatchSpec(old_spec, target=None) if ( context.auto_update_conda and paths_equal(self.prefix, context.root_prefix) and any(dist.name == "conda" for dist in solution) ): specs_map["conda"] = MatchSpec("conda") # add in explicitly requested specs from specs_to_add # this overrides any name-matching spec already in the spec map specs_map.update((s.name, s) for s in specs_to_add) # collect additional specs to add to the solution track_features_specs = pinned_specs = () if context.track_features: track_features_specs = tuple(MatchSpec(x + "@") for x in context.track_features) if not ignore_pinned: pinned_specs = get_pinned_specs(self.prefix) final_environment_specs = IndexedSet( concatv( itervalues(specs_map), track_features_specs, pinned_specs, ) ) # We've previously checked `solution` for consistency (which at that point was the # pre-solve state of the environment). Now we check our compiled set of # `final_environment_specs` for the possibility of a solution. If there are conflicts, # we can often avoid them by neutering specs that have a target (e.g. removing version # constraint) and also making them optional. The result here will be less cases of # `UnsatisfiableError` handed to users, at the cost of more packages being modified # or removed from the environment. conflicting_specs = r.get_conflicting_specs(tuple(final_environment_specs)) if log.isEnabledFor(DEBUG): log.debug("conflicting specs: %s", dashlist(conflicting_specs)) for spec in conflicting_specs: if spec.target: final_environment_specs.remove(spec) neutered_spec = MatchSpec(spec.name, target=spec.target, optional=True) final_environment_specs.add(neutered_spec) # Finally! We get to call SAT. if log.isEnabledFor(DEBUG): log.debug( "final specs to add: %s", dashlist(sorted(text_type(s) for s in final_environment_specs)), ) solution = r.solve(tuple(final_environment_specs)) # return value is List[dist] # add back inconsistent packages to solution if add_back_map: for name, (dist, spec) in iteritems(add_back_map): if not any(d.name == name for d in solution): solution.append(dist) if spec: final_environment_specs.add(spec) # Special case handling for various DepsModifer flags. Maybe this block could be pulled # out into its own non-public helper method? if deps_modifier == DepsModifier.NO_DEPS: # In the NO_DEPS case, we need to start with the original list of packages in the # environment, and then only modify packages that match specs_to_add or # specs_to_remove. _no_deps_solution = IndexedSet(Dist(rec) for rec in prefix_data.iter_records()) only_remove_these = set( dist for spec in specs_to_remove for dist in _no_deps_solution if spec.match(index[dist]) ) _no_deps_solution -= only_remove_these only_add_these = set( dist for spec in specs_to_add for dist in solution if spec.match(index[dist]) ) remove_before_adding_back = set(dist.name for dist in only_add_these) _no_deps_solution = IndexedSet( dist for dist in _no_deps_solution if dist.name not in remove_before_adding_back ) _no_deps_solution |= only_add_these solution = _no_deps_solution elif deps_modifier == DepsModifier.ONLY_DEPS: # Using a special instance of the DAG to remove leaf nodes that match the original # specs_to_add. It's important to only remove leaf nodes, because a typical use # might be `conda install --only-deps python=2 flask`, and in that case we'd want # to keep python. dag = PrefixDag((index[d] for d in solution), specs_to_add) dag.remove_leaf_nodes_with_specs() solution = tuple(Dist(rec) for rec in dag.records) elif deps_modifier in ( DepsModifier.UPDATE_DEPS, DepsModifier.UPDATE_DEPS_ONLY_DEPS, ): # Here we have to SAT solve again :( It's only now that we know the dependency # chain of specs_to_add. specs_to_add_names = set(spec.name for spec in specs_to_add) update_names = set() dag = PrefixDag((index[d] for d in solution), final_environment_specs) for spec in specs_to_add: node = dag.get_node_by_name(spec.name) for ascendant in node.all_ascendants(): ascendant_name = ascendant.record.name if ascendant_name not in specs_to_add_names: update_names.add(ascendant_name) grouped_specs = groupby( lambda s: s.name in update_names, final_environment_specs ) new_final_environment_specs = set(grouped_specs[False]) update_specs = set( MatchSpec(spec.name, optional=spec.optional) for spec in grouped_specs[True] ) final_environment_specs = new_final_environment_specs | update_specs solution = r.solve(final_environment_specs) if deps_modifier == DepsModifier.UPDATE_DEPS_ONLY_DEPS: # duplicated from DepsModifier.ONLY_DEPS dag = PrefixDag((index[d] for d in solution), specs_to_add) dag.remove_leaf_nodes_with_specs() solution = tuple(Dist(rec) for rec in dag.records) if prune: dag = PrefixDag((index[d] for d in solution), final_environment_specs) dag.prune() solution = tuple(Dist(rec) for rec in dag.records) self._check_solution(solution, pinned_specs) solution = IndexedSet(r.dependency_sort({d.name: d for d in solution})) log.debug( "solved prefix %s\n solved_linked_dists:\n %s\n", self.prefix, "\n ".join(text_type(d) for d in solution), ) return IndexedSet(index[d] for d in solution)
https://github.com/conda/conda/issues/6522
Traceback (most recent call last): File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\exceptions.py\", line 721, in __call__ return func(*args, **kwargs) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\cli\\main.py\", line 78, in _main exit_code = do_call(args, p) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\cli\\conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\cli\\main_install.py\", line 11, in execute install(args, parser, 'install') File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\cli\\install.py\", line 220, in install force_reinstall=context.force, File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\core\\solve.py\", line 503, in solve_for_transaction force_remove, force_reinstall) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\core\\solve.py\", line 436, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\core\\solve.py\", line 244, in solve_final_state \"\"\") % matches_for_spec) TypeError: not all arguments converted during string formatting
TypeError
def _first_writable_envs_dir(): # Starting in conda 4.3, we use the writability test on '..../pkgs/url.txt' to determine # writability of '..../envs'. from ..core.package_cache import PackageCache for envs_dir in context.envs_dirs: pkgs_dir = join(dirname(envs_dir), "pkgs") if PackageCache(pkgs_dir).is_writable: return envs_dir from ..exceptions import NotWritableError raise NotWritableError(context.envs_dirs[0], None)
def _first_writable_envs_dir(): # Starting in conda 4.3, we use the writability test on '..../pkgs/url.txt' to determine # writability of '..../envs'. from ..core.package_cache import PackageCache for envs_dir in context.envs_dirs: pkgs_dir = join(dirname(envs_dir), "pkgs") if PackageCache(pkgs_dir).is_writable: return envs_dir from ..exceptions import NotWritableError raise NotWritableError(context.envs_dirs[0])
https://github.com/conda/conda/issues/6508
Traceback (most recent call last): File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/exceptions.py\", line 721, in __call__ return func(*args, **kwargs) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/main_install.py\", line 11, in execute install(args, parser, 'install') File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/install.py\", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/install.py\", line 269, in handle_txn unlink_link_transaction.execute() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 220, in execute self.verify() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/common/io.py\", line 402, in decorated return f(*args, **kwds) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 207, in verify exceptions = self._verify(self.prefix_setups, self.prefix_action_groups) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 460, in _verify cls._verify_transaction_level(prefix_setups), File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 455, in <genexpr> exceptions = tuple(exc for exc in concatv( File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 323, in _verify_individual_level error_result = axn.verify() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/path_actions.py\", line 870, in verify touch(USER_ENVIRONMENTS_TXT_FILE, mkdir=True, sudo_safe=True) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/gateways/disk/update.py\", line 89, in touch os.chown(path, uid, gid) PermissionError: [Errno 1] Operation not permitted: '/home/nbcommon/.conda/environments.txt'
PermissionError
def __init__(self, path, errno, **kwargs): kwargs.update( { "path": path, "errno": errno, } ) if on_win: message = dals(""" The current user does not have write permissions to a required path. path: %(path)s """) else: message = dals(""" The current user does not have write permissions to a required path. path: %(path)s uid: %(uid)s gid: %(gid)s If you feel that permissions on this path are set incorrectly, you can manually change them by executing $ sudo chmod %(uid)s:%(gid)s %(path)s """) import os kwargs.update( { "uid": os.geteuid(), "gid": os.getegid(), } ) super(NotWritableError, self).__init__(message, **kwargs)
def __init__(self, path): kwargs = { "path": path, } if on_win: message = dals(""" The current user does not have write permissions to a required path. path: %(path)s """) else: message = dals(""" The current user does not have write permissions to a required path. path: %(path)s uid: %(uid)s gid: %(gid)s If you feel that permissions on this path are set incorrectly, you can manually change them by executing $ sudo chmod %(uid)s:%(gid)s %(path)s """) import os kwargs.update( { "uid": os.geteuid(), "gid": os.getegid(), } ) super(NotWritableError, self).__init__(message, **kwargs)
https://github.com/conda/conda/issues/6508
Traceback (most recent call last): File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/exceptions.py\", line 721, in __call__ return func(*args, **kwargs) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/main_install.py\", line 11, in execute install(args, parser, 'install') File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/install.py\", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/install.py\", line 269, in handle_txn unlink_link_transaction.execute() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 220, in execute self.verify() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/common/io.py\", line 402, in decorated return f(*args, **kwds) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 207, in verify exceptions = self._verify(self.prefix_setups, self.prefix_action_groups) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 460, in _verify cls._verify_transaction_level(prefix_setups), File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 455, in <genexpr> exceptions = tuple(exc for exc in concatv( File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 323, in _verify_individual_level error_result = axn.verify() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/path_actions.py\", line 870, in verify touch(USER_ENVIRONMENTS_TXT_FILE, mkdir=True, sudo_safe=True) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/gateways/disk/update.py\", line 89, in touch os.chown(path, uid, gid) PermissionError: [Errno 1] Operation not permitted: '/home/nbcommon/.conda/environments.txt'
PermissionError
def touch(path, mkdir=False, sudo_safe=False): # sudo_safe: use any time `path` is within the user's home directory # returns: # True if the file did not exist but was created # False if the file already existed # raises: permissions errors such as EPERM and EACCES try: path = expand(path) log.trace("touching path %s", path) if lexists(path): utime(path, None) return True else: dirpath = dirname(path) if not isdir(dirpath) and mkdir: if sudo_safe: mkdir_p_sudo_safe(dirpath) else: mkdir_p(dirpath) else: assert isdir(dirname(path)) try: fh = open(path, "a") except: raise else: fh.close() if sudo_safe and not on_win and os.environ.get("SUDO_UID") is not None: uid = int(os.environ["SUDO_UID"]) gid = int(os.environ.get("SUDO_GID", -1)) log.trace("chowning %s:%s %s", uid, gid, path) os.chown(path, uid, gid) return False except (IOError, OSError) as e: raise NotWritableError(path, e.errno, caused_by=e)
def touch(path, mkdir=False, sudo_safe=False): # sudo_safe: use any time `path` is within the user's home directory # returns: # True if the file did not exist but was created # False if the file already existed # raises: permissions errors such as EPERM and EACCES path = expand(path) log.trace("touching path %s", path) if lexists(path): utime(path, None) return True else: dirpath = dirname(path) if not isdir(dirpath) and mkdir: if sudo_safe: mkdir_p_sudo_safe(dirpath) else: mkdir_p(dirpath) else: assert isdir(dirname(path)) try: fh = open(path, "a") except: raise else: fh.close() if sudo_safe and not on_win and os.environ.get("SUDO_UID") is not None: uid = int(os.environ["SUDO_UID"]) gid = int(os.environ.get("SUDO_GID", -1)) log.trace("chowning %s:%s %s", uid, gid, path) os.chown(path, uid, gid) return False
https://github.com/conda/conda/issues/6508
Traceback (most recent call last): File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/exceptions.py\", line 721, in __call__ return func(*args, **kwargs) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/main_install.py\", line 11, in execute install(args, parser, 'install') File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/install.py\", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/install.py\", line 269, in handle_txn unlink_link_transaction.execute() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 220, in execute self.verify() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/common/io.py\", line 402, in decorated return f(*args, **kwds) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 207, in verify exceptions = self._verify(self.prefix_setups, self.prefix_action_groups) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 460, in _verify cls._verify_transaction_level(prefix_setups), File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 455, in <genexpr> exceptions = tuple(exc for exc in concatv( File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 323, in _verify_individual_level error_result = axn.verify() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/path_actions.py\", line 870, in verify touch(USER_ENVIRONMENTS_TXT_FILE, mkdir=True, sudo_safe=True) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/gateways/disk/update.py\", line 89, in touch os.chown(path, uid, gid) PermissionError: [Errno 1] Operation not permitted: '/home/nbcommon/.conda/environments.txt'
PermissionError
def solve_final_state( self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, force_remove=NULL ): """Gives the final, solved state of the environment. Args: deps_modifier (DepsModifier): An optional flag indicating special solver handling for dependencies. The default solver behavior is to be as conservative as possible with dependency updates (in the case the dependency already exists in the environment), while still ensuring all dependencies are satisfied. Options include * NO_DEPS * ONLY_DEPS * UPDATE_DEPS * UPDATE_DEPS_ONLY_DEPS prune (bool): If ``True``, the solution will not contain packages that were previously brought into the environment as dependencies but are no longer required as dependencies and are not user-requested. ignore_pinned (bool): If ``True``, the solution will ignore pinned package configuration for the prefix. force_remove (bool): Forces removal of a package without removing packages that depend on it. Returns: Tuple[PackageRef]: In sorted dependency order from roots to leaves, the package references for the solved state of the environment. """ prune = context.prune if prune is NULL else prune ignore_pinned = context.ignore_pinned if ignore_pinned is NULL else ignore_pinned deps_modifier = context.deps_modifier if deps_modifier is NULL else deps_modifier if isinstance(deps_modifier, string_types): deps_modifier = DepsModifier(deps_modifier.lower()) specs_to_remove = self.specs_to_remove specs_to_add = self.specs_to_add # force_remove is a special case where we return early if specs_to_remove and force_remove: if specs_to_add: raise NotImplementedError() index, r = self._prepare(specs_to_remove) solution = tuple( Dist(rec) for rec in PrefixData(self.prefix).iter_records() if not any(spec.match(rec) for spec in specs_to_remove) ) return IndexedSet( index[d] for d in r.dependency_sort({d.name: d for d in solution}) ) log.debug( "solving prefix %s\n specs_to_remove: %s\n specs_to_add: %s\n prune: %s", self.prefix, specs_to_remove, specs_to_add, prune, ) # declare starting point, the initial state of the environment # `solution` and `specs_map` are mutated throughout this method prefix_data = PrefixData(self.prefix) solution = tuple(Dist(d) for d in prefix_data.iter_records()) if prune or deps_modifier == DepsModifier.UPDATE_ALL: # start with empty specs map for UPDATE_ALL because we're optimizing the update # only for specs the user has requested; it's ok to remove dependencies specs_map = odict() else: specs_map = odict((d.name, MatchSpec(d.name)) for d in solution) # add in historically-requested specs specs_from_history_map = History(self.prefix).get_requested_specs_map() specs_map.update(specs_from_history_map) # let's pretend for now that this is the right place to build the index prepared_specs = tuple( concatv(specs_to_remove, specs_to_add, itervalues(specs_from_history_map)) ) index, r = self._prepare(prepared_specs) if specs_to_remove: # In a previous implementation, we invoked SAT here via `r.remove()` to help with # spec removal, and then later invoking SAT again via `r.solve()`. Rather than invoking # SAT for spec removal determination, we can use the DAG and simple tree traversal # if we're careful about how we handle features. We still invoke sat via `r.solve()` # later. _track_fts_specs = ( spec for spec in specs_to_remove if "track_features" in spec ) feature_names = set( concat(spec.get_raw_value("track_features") for spec in _track_fts_specs) ) dag = PrefixDag((index[dist] for dist in solution), itervalues(specs_map)) removed_records = [] for spec in specs_to_remove: # If the spec was a provides_features spec, then we need to also remove every # package with a requires_feature that matches the provides_feature. The # `dag.remove_spec()` method handles that for us. log.trace("using dag to remove records for %s", spec) removed_records.extend(dag.remove_spec(spec)) for rec in removed_records: # We keep specs (minus the feature part) for the non provides_features packages # if they're in the history specs. Otherwise, we pop them from the specs_map. rec_has_a_feature = set(rec.features or ()) & feature_names if rec_has_a_feature and rec.name in specs_from_history_map: spec = specs_map.get(rec.name, MatchSpec(rec.name)) spec._match_components.pop("features", None) specs_map[spec.name] = spec else: specs_map.pop(rec.name, None) solution = tuple(Dist(rec) for rec in dag.records) if not removed_records and not prune: raise PackagesNotFoundError(tuple(spec.name for spec in specs_to_remove)) # We handle as best as possible environments in inconsistent states. To do this, # we remove now from consideration the set of packages causing inconsistencies, # and then we add them back in following the main SAT call. _, inconsistent_dists = r.bad_installed(solution, ()) add_back_map = {} # name: (dist, spec) if log.isEnabledFor(DEBUG): log.debug( "inconsistent dists: %s", dashlist(inconsistent_dists) if inconsistent_dists else "None", ) if inconsistent_dists: for dist in inconsistent_dists: # pop and save matching spec in specs_map add_back_map[dist.name] = (dist, specs_map.pop(dist.name, None)) solution = tuple(dist for dist in solution if dist not in inconsistent_dists) # For the remaining specs in specs_map, add target to each spec. `target` is a reference # to the package currently existing in the environment. Setting target instructs the # solver to not disturb that package if it's not necessary. # If the spec.name is being modified by inclusion in specs_to_add, we don't set `target`, # since we *want* the solver to modify/update that package. # # TLDR: when working with MatchSpec objects, # - to minimize the version change, set MatchSpec(name=name, target=dist.full_name) # - to freeze the package, set all the components of MatchSpec individually for pkg_name, spec in iteritems(specs_map): matches_for_spec = tuple(dist for dist in solution if spec.match(index[dist])) if matches_for_spec: if len(matches_for_spec) != 1: raise CondaError( dals(""" Conda encountered an error with your environment. Please report an issue at https://github.com/conda/conda/issues/new. In your report, please include the output of 'conda info' and 'conda list' for the active environment, along with the command you invoked that resulted in this error. matches_for_spec: %s """) % matches_for_spec ) target_dist = matches_for_spec[0] if deps_modifier == DepsModifier.FREEZE_INSTALLED: new_spec = MatchSpec(index[target_dist]) else: target = Dist(target_dist).full_name new_spec = MatchSpec(spec, target=target) specs_map[pkg_name] = new_spec if log.isEnabledFor(TRACE): log.trace("specs_map with targets: %s", specs_map) # If we're in UPDATE_ALL mode, we need to drop all the constraints attached to specs, # so they can all float and the solver can find the most up-to-date solution. In the case # of UPDATE_ALL, `specs_map` wasn't initialized with packages from the current environment, # but *only* historically-requested specs. This lets UPDATE_ALL drop dependencies if # they're no longer needed, and their presence would otherwise prevent the updated solution # the user most likely wants. if deps_modifier == DepsModifier.UPDATE_ALL: specs_map = { pkg_name: MatchSpec(spec.name, optional=spec.optional) for pkg_name, spec in iteritems(specs_map) } # As a business rule, we never want to update python beyond the current minor version, # unless that's requested explicitly by the user (which we actively discourage). if "python" in specs_map: python_prefix_rec = prefix_data.get("python") if python_prefix_rec: python_spec = specs_map["python"] if not python_spec.get("version"): pinned_version = ( get_major_minor_version(python_prefix_rec.version) + ".*" ) specs_map["python"] = MatchSpec(python_spec, version=pinned_version) # For the aggressive_update_packages configuration parameter, we strip any target # that's been set. if not context.offline: for spec in context.aggressive_update_packages: if spec.name in specs_map: old_spec = specs_map[spec.name] specs_map[spec.name] = MatchSpec(old_spec, target=None) if ( context.auto_update_conda and paths_equal(self.prefix, context.root_prefix) and any(dist.name == "conda" for dist in solution) ): specs_map["conda"] = MatchSpec("conda") # add in explicitly requested specs from specs_to_add # this overrides any name-matching spec already in the spec map specs_map.update((s.name, s) for s in specs_to_add) # collect additional specs to add to the solution track_features_specs = pinned_specs = () if context.track_features: track_features_specs = tuple(MatchSpec(x + "@") for x in context.track_features) if not ignore_pinned: pinned_specs = get_pinned_specs(self.prefix) final_environment_specs = IndexedSet( concatv( itervalues(specs_map), track_features_specs, pinned_specs, ) ) # We've previously checked `solution` for consistency (which at that point was the # pre-solve state of the environment). Now we check our compiled set of # `final_environment_specs` for the possibility of a solution. If there are conflicts, # we can often avoid them by neutering specs that have a target (e.g. removing version # constraint) and also making them optional. The result here will be less cases of # `UnsatisfiableError` handed to users, at the cost of more packages being modified # or removed from the environment. conflicting_specs = r.get_conflicting_specs(tuple(final_environment_specs)) if log.isEnabledFor(DEBUG): log.debug("conflicting specs: %s", dashlist(conflicting_specs)) for spec in conflicting_specs: if spec.target: final_environment_specs.remove(spec) neutered_spec = MatchSpec(spec.name, target=spec.target, optional=True) final_environment_specs.add(neutered_spec) # Finally! We get to call SAT. if log.isEnabledFor(DEBUG): log.debug( "final specs to add: %s", dashlist(sorted(text_type(s) for s in final_environment_specs)), ) pre_solution = solution solution = r.solve(tuple(final_environment_specs)) # return value is List[dist] # add back inconsistent packages to solution if add_back_map: for name, (dist, spec) in iteritems(add_back_map): if not any(d.name == name for d in solution): solution.append(dist) if spec: final_environment_specs.add(spec) # Special case handling for various DepsModifer flags. Maybe this block could be pulled # out into its own non-public helper method? if deps_modifier == DepsModifier.NO_DEPS: # In the NO_DEPS case we're just filtering out packages from the solution. dont_add_packages = [] new_packages = set(solution) - set(pre_solution) for dist in new_packages: if not any(spec.match(index[dist]) for spec in specs_to_add): dont_add_packages.append(dist) solution = tuple(rec for rec in solution if rec not in dont_add_packages) elif deps_modifier == DepsModifier.ONLY_DEPS: # Using a special instance of the DAG to remove leaf nodes that match the original # specs_to_add. It's important to only remove leaf nodes, because a typical use # might be `conda install --only-deps python=2 flask`, and in that case we'd want # to keep python. dag = PrefixDag((index[d] for d in solution), specs_to_add) dag.remove_leaf_nodes_with_specs() solution = tuple(Dist(rec) for rec in dag.records) elif deps_modifier in ( DepsModifier.UPDATE_DEPS, DepsModifier.UPDATE_DEPS_ONLY_DEPS, ): # Here we have to SAT solve again :( It's only now that we know the dependency # chain of specs_to_add. specs_to_add_names = set(spec.name for spec in specs_to_add) update_names = set() dag = PrefixDag((index[d] for d in solution), final_environment_specs) for spec in specs_to_add: node = dag.get_node_by_name(spec.name) for ascendant in node.all_ascendants(): ascendant_name = ascendant.record.name if ascendant_name not in specs_to_add_names: update_names.add(ascendant_name) grouped_specs = groupby( lambda s: s.name in update_names, final_environment_specs ) new_final_environment_specs = set(grouped_specs[False]) update_specs = set( MatchSpec(spec.name, optional=spec.optional) for spec in grouped_specs[True] ) final_environment_specs = new_final_environment_specs | update_specs solution = r.solve(final_environment_specs) if deps_modifier == DepsModifier.UPDATE_DEPS_ONLY_DEPS: # duplicated from DepsModifier.ONLY_DEPS dag = PrefixDag((index[d] for d in solution), specs_to_add) dag.remove_leaf_nodes_with_specs() solution = tuple(Dist(rec) for rec in dag.records) if prune: dag = PrefixDag((index[d] for d in solution), final_environment_specs) dag.prune() solution = tuple(Dist(rec) for rec in dag.records) self._check_solution(solution, pinned_specs) solution = IndexedSet(r.dependency_sort({d.name: d for d in solution})) log.debug( "solved prefix %s\n solved_linked_dists:\n %s\n", self.prefix, "\n ".join(text_type(d) for d in solution), ) return IndexedSet(index[d] for d in solution)
def solve_final_state( self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, force_remove=NULL ): """Gives the final, solved state of the environment. Args: deps_modifier (DepsModifier): An optional flag indicating special solver handling for dependencies. The default solver behavior is to be as conservative as possible with dependency updates (in the case the dependency already exists in the environment), while still ensuring all dependencies are satisfied. Options include * NO_DEPS * ONLY_DEPS * UPDATE_DEPS * UPDATE_DEPS_ONLY_DEPS prune (bool): If ``True``, the solution will not contain packages that were previously brought into the environment as dependencies but are no longer required as dependencies and are not user-requested. ignore_pinned (bool): If ``True``, the solution will ignore pinned package configuration for the prefix. force_remove (bool): Forces removal of a package without removing packages that depend on it. Returns: Tuple[PackageRef]: In sorted dependency order from roots to leaves, the package references for the solved state of the environment. """ prune = context.prune if prune is NULL else prune ignore_pinned = context.ignore_pinned if ignore_pinned is NULL else ignore_pinned deps_modifier = context.deps_modifier if deps_modifier is NULL else deps_modifier if isinstance(deps_modifier, string_types): deps_modifier = DepsModifier(deps_modifier.lower()) specs_to_remove = self.specs_to_remove specs_to_add = self.specs_to_add # force_remove is a special case where we return early if specs_to_remove and force_remove: if specs_to_add: raise NotImplementedError() index, r = self._prepare(specs_to_remove) solution = tuple( Dist(rec) for rec in PrefixData(self.prefix).iter_records() if not any(spec.match(rec) for spec in specs_to_remove) ) return IndexedSet( index[d] for d in r.dependency_sort({d.name: d for d in solution}) ) log.debug( "solving prefix %s\n specs_to_remove: %s\n specs_to_add: %s\n prune: %s", self.prefix, specs_to_remove, specs_to_add, prune, ) # declare starting point, the initial state of the environment # `solution` and `specs_map` are mutated throughout this method prefix_data = PrefixData(self.prefix) solution = tuple(Dist(d) for d in prefix_data.iter_records()) if prune or deps_modifier == DepsModifier.UPDATE_ALL: # start with empty specs map for UPDATE_ALL because we're optimizing the update # only for specs the user has requested; it's ok to remove dependencies specs_map = odict() else: specs_map = odict((d.name, MatchSpec(d.name)) for d in solution) # add in historically-requested specs specs_from_history_map = History(self.prefix).get_requested_specs_map() specs_map.update(specs_from_history_map) # let's pretend for now that this is the right place to build the index prepared_specs = tuple( concatv(specs_to_remove, specs_to_add, itervalues(specs_from_history_map)) ) index, r = self._prepare(prepared_specs) if specs_to_remove: # In a previous implementation, we invoked SAT here via `r.remove()` to help with # spec removal, and then later invoking SAT again via `r.solve()`. Rather than invoking # SAT for spec removal determination, we can use the DAG and simple tree traversal # if we're careful about how we handle features. We still invoke sat via `r.solve()` # later. _track_fts_specs = ( spec for spec in specs_to_remove if "track_features" in spec ) feature_names = set( concat(spec.get_raw_value("track_features") for spec in _track_fts_specs) ) dag = PrefixDag((index[dist] for dist in solution), itervalues(specs_map)) removed_records = [] for spec in specs_to_remove: # If the spec was a provides_features spec, then we need to also remove every # package with a requires_feature that matches the provides_feature. The # `dag.remove_spec()` method handles that for us. log.trace("using dag to remove records for %s", spec) removed_records.extend(dag.remove_spec(spec)) for rec in removed_records: # We keep specs (minus the feature part) for the non provides_features packages # if they're in the history specs. Otherwise, we pop them from the specs_map. rec_has_a_feature = set(rec.features or ()) & feature_names if rec_has_a_feature and rec.name in specs_from_history_map: spec = specs_map.get(rec.name, MatchSpec(rec.name)) spec._match_components.pop("features", None) specs_map[spec.name] = spec else: specs_map.pop(rec.name, None) solution = tuple(Dist(rec) for rec in dag.records) if not removed_records and not prune: raise PackagesNotFoundError(tuple(spec.name for spec in specs_to_remove)) # We handle as best as possible environments in inconsistent states. To do this, # we remove now from consideration the set of packages causing inconsistencies, # and then we add them back in following the main SAT call. _, inconsistent_dists = r.bad_installed(solution, ()) add_back_map = {} # name: (dist, spec) if log.isEnabledFor(DEBUG): log.debug( "inconsistent dists: %s", dashlist(inconsistent_dists) if inconsistent_dists else "None", ) if inconsistent_dists: for dist in inconsistent_dists: # pop and save matching spec in specs_map add_back_map[dist.name] = (dist, specs_map.pop(dist.name, None)) solution = tuple(dist for dist in solution if dist not in inconsistent_dists) # For the remaining specs in specs_map, add target to each spec. `target` is a reference # to the package currently existing in the environment. Setting target instructs the # solver to not disturb that package if it's not necessary. # If the spec.name is being modified by inclusion in specs_to_add, we don't set `target`, # since we *want* the solver to modify/update that package. # # TLDR: when working with MatchSpec objects, # - to minimize the version change, set MatchSpec(name=name, target=dist.full_name) # - to freeze the package, set all the components of MatchSpec individually for pkg_name, spec in iteritems(specs_map): matches_for_spec = tuple(dist for dist in solution if spec.match(index[dist])) if matches_for_spec: assert len(matches_for_spec) == 1 target_dist = matches_for_spec[0] if deps_modifier == DepsModifier.FREEZE_INSTALLED: new_spec = MatchSpec(index[target_dist]) else: target = Dist(target_dist).full_name new_spec = MatchSpec(spec, target=target) specs_map[pkg_name] = new_spec if log.isEnabledFor(TRACE): log.trace("specs_map with targets: %s", specs_map) # If we're in UPDATE_ALL mode, we need to drop all the constraints attached to specs, # so they can all float and the solver can find the most up-to-date solution. In the case # of UPDATE_ALL, `specs_map` wasn't initialized with packages from the current environment, # but *only* historically-requested specs. This lets UPDATE_ALL drop dependencies if # they're no longer needed, and their presence would otherwise prevent the updated solution # the user most likely wants. if deps_modifier == DepsModifier.UPDATE_ALL: specs_map = { pkg_name: MatchSpec(spec.name, optional=spec.optional) for pkg_name, spec in iteritems(specs_map) } # As a business rule, we never want to update python beyond the current minor version, # unless that's requested explicitly by the user (which we actively discourage). if "python" in specs_map: python_prefix_rec = prefix_data.get("python") if python_prefix_rec: python_spec = specs_map["python"] if not python_spec.get("version"): pinned_version = ( get_major_minor_version(python_prefix_rec.version) + ".*" ) specs_map["python"] = MatchSpec(python_spec, version=pinned_version) # For the aggressive_update_packages configuration parameter, we strip any target # that's been set. if not context.offline: for spec in context.aggressive_update_packages: if spec.name in specs_map: old_spec = specs_map[spec.name] specs_map[spec.name] = MatchSpec(old_spec, target=None) if ( context.auto_update_conda and paths_equal(self.prefix, context.root_prefix) and any(dist.name == "conda" for dist in solution) ): specs_map["conda"] = MatchSpec("conda") # add in explicitly requested specs from specs_to_add # this overrides any name-matching spec already in the spec map specs_map.update((s.name, s) for s in specs_to_add) # collect additional specs to add to the solution track_features_specs = pinned_specs = () if context.track_features: track_features_specs = tuple(MatchSpec(x + "@") for x in context.track_features) if not ignore_pinned: pinned_specs = get_pinned_specs(self.prefix) final_environment_specs = IndexedSet( concatv( itervalues(specs_map), track_features_specs, pinned_specs, ) ) # We've previously checked `solution` for consistency (which at that point was the # pre-solve state of the environment). Now we check our compiled set of # `final_environment_specs` for the possibility of a solution. If there are conflicts, # we can often avoid them by neutering specs that have a target (e.g. removing version # constraint) and also making them optional. The result here will be less cases of # `UnsatisfiableError` handed to users, at the cost of more packages being modified # or removed from the environment. conflicting_specs = r.get_conflicting_specs(tuple(final_environment_specs)) if log.isEnabledFor(DEBUG): log.debug("conflicting specs: %s", dashlist(conflicting_specs)) for spec in conflicting_specs: if spec.target: final_environment_specs.remove(spec) neutered_spec = MatchSpec(spec.name, target=spec.target, optional=True) final_environment_specs.add(neutered_spec) # Finally! We get to call SAT. if log.isEnabledFor(DEBUG): log.debug( "final specs to add: %s", dashlist(sorted(text_type(s) for s in final_environment_specs)), ) pre_solution = solution solution = r.solve(tuple(final_environment_specs)) # return value is List[dist] # add back inconsistent packages to solution if add_back_map: for name, (dist, spec) in iteritems(add_back_map): if not any(d.name == name for d in solution): solution.append(dist) if spec: final_environment_specs.add(spec) # Special case handling for various DepsModifer flags. Maybe this block could be pulled # out into its own non-public helper method? if deps_modifier == DepsModifier.NO_DEPS: # In the NO_DEPS case we're just filtering out packages from the solution. dont_add_packages = [] new_packages = set(solution) - set(pre_solution) for dist in new_packages: if not any(spec.match(index[dist]) for spec in specs_to_add): dont_add_packages.append(dist) solution = tuple(rec for rec in solution if rec not in dont_add_packages) elif deps_modifier == DepsModifier.ONLY_DEPS: # Using a special instance of the DAG to remove leaf nodes that match the original # specs_to_add. It's important to only remove leaf nodes, because a typical use # might be `conda install --only-deps python=2 flask`, and in that case we'd want # to keep python. dag = PrefixDag((index[d] for d in solution), specs_to_add) dag.remove_leaf_nodes_with_specs() solution = tuple(Dist(rec) for rec in dag.records) elif deps_modifier in ( DepsModifier.UPDATE_DEPS, DepsModifier.UPDATE_DEPS_ONLY_DEPS, ): # Here we have to SAT solve again :( It's only now that we know the dependency # chain of specs_to_add. specs_to_add_names = set(spec.name for spec in specs_to_add) update_names = set() dag = PrefixDag((index[d] for d in solution), final_environment_specs) for spec in specs_to_add: node = dag.get_node_by_name(spec.name) for ascendant in node.all_ascendants(): ascendant_name = ascendant.record.name if ascendant_name not in specs_to_add_names: update_names.add(ascendant_name) grouped_specs = groupby( lambda s: s.name in update_names, final_environment_specs ) new_final_environment_specs = set(grouped_specs[False]) update_specs = set( MatchSpec(spec.name, optional=spec.optional) for spec in grouped_specs[True] ) final_environment_specs = new_final_environment_specs | update_specs solution = r.solve(final_environment_specs) if deps_modifier == DepsModifier.UPDATE_DEPS_ONLY_DEPS: # duplicated from DepsModifier.ONLY_DEPS dag = PrefixDag((index[d] for d in solution), specs_to_add) dag.remove_leaf_nodes_with_specs() solution = tuple(Dist(rec) for rec in dag.records) if prune: dag = PrefixDag((index[d] for d in solution), final_environment_specs) dag.prune() solution = tuple(Dist(rec) for rec in dag.records) self._check_solution(solution, pinned_specs) solution = IndexedSet(r.dependency_sort({d.name: d for d in solution})) log.debug( "solved prefix %s\n solved_linked_dists:\n %s\n", self.prefix, "\n ".join(text_type(d) for d in solution), ) return IndexedSet(index[d] for d in solution)
https://github.com/conda/conda/issues/6430
Traceback (most recent call last): File \"/home/nicolas/miniconda3/lib/python3.6/site-packages/conda/exceptions.py\", line 683, in __call__ return func(*args, **kwargs) File \"/home/nicolas/miniconda3/lib/python3.6/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/nicolas/miniconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/nicolas/miniconda3/lib/python3.6/site-packages/conda/cli/main_update.py\", line 14, in execute install(args, parser, 'update') File \"/home/nicolas/miniconda3/lib/python3.6/site-packages/conda/cli/install.py\", line 222, in install force_reinstall=context.force, File \"/home/nicolas/miniconda3/lib/python3.6/site-packages/conda/core/solve.py\", line 441, in solve_for_transaction force_remove, force_reinstall) File \"/home/nicolas/miniconda3/lib/python3.6/site-packages/conda/core/solve.py\", line 391, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File \"/home/nicolas/miniconda3/lib/python3.6/site-packages/conda/core/solve.py\", line 216, in solve_final_state assert len(matches_for_spec) == 1 AssertionError
AssertionError
def get_egg_info(prefix, all_pkgs=False): """ Return a set of canonical names of all Python packages (in `prefix`), by inspecting the .egg-info files inside site-packages. By default, only untracked (not conda installed) .egg-info files are considered. Setting `all_pkgs` to True changes this. """ installed_pkgs = linked_data(prefix) sp_dir = get_site_packages_dir(installed_pkgs) if sp_dir is None or not isdir(join(prefix, sp_dir)): return set() conda_files = set() for info in itervalues(installed_pkgs): conda_files.update(info.get("files", [])) res = set() for path in get_egg_info_files(join(prefix, sp_dir)): f = rel_path(prefix, path) if all_pkgs or f not in conda_files: try: dist = parse_egg_info(path) except UnicodeDecodeError: dist = None if dist: res.add(Dist(dist)) return res
def get_egg_info(prefix, all_pkgs=False): """ Return a set of canonical names of all Python packages (in `prefix`), by inspecting the .egg-info files inside site-packages. By default, only untracked (not conda installed) .egg-info files are considered. Setting `all_pkgs` to True changes this. """ installed_pkgs = linked_data(prefix) sp_dir = get_site_packages_dir(installed_pkgs) if sp_dir is None: return set() conda_files = set() for info in itervalues(installed_pkgs): conda_files.update(info.get("files", [])) res = set() for path in get_egg_info_files(join(prefix, sp_dir)): f = rel_path(prefix, path) if all_pkgs or f not in conda_files: try: dist = parse_egg_info(path) except UnicodeDecodeError: dist = None if dist: res.add(Dist(dist)) return res
https://github.com/conda/conda/issues/6466
joris@joris-XPS-13-9350:~/scipy$ conda list # packages in environment at /home/joris/miniconda3: # `$ /home/joris/miniconda3/bin/conda list` Traceback (most recent call last): File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/exceptions.py", line 683, in __call__ return func(*args, **kwargs) File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/cli/main_list.py", line 150, in execute show_channel_urls=context.show_channel_urls) File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/cli/main_list.py", line 85, in print_packages other_python = get_egg_info(prefix) File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/egg_info.py", line 86, in get_egg_info for path in get_egg_info_files(join(prefix, sp_dir)): File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/egg_info.py", line 35, in get_egg_info_files for egg in get_egg_info_files(reader.readline().strip()): File "/home/joris/miniconda3/lib/python3.5/site-packages/conda/egg_info.py", line 32, in get_egg_info_files for fn in os.listdir(sp_dir): FileNotFoundError: [Errno 2] No such file or directory: '/home/joris/scipy/dateutil'
FileNotFoundError
def _build_components(**kwargs): def _make(field_name, value): if field_name not in IndexRecord.__fields__: raise CondaValueError("Cannot match on field %s" % (field_name,)) elif isinstance(value, string_types): value = text_type(value) if hasattr(value, "match"): matcher = value elif field_name in _implementors: matcher = _implementors[field_name](value) else: matcher = StrMatch(text_type(value)) return field_name, matcher return frozendict(_make(key, value) for key, value in iteritems(kwargs))
def _build_components(**kwargs): def _make(field_name, value): if field_name not in IndexRecord.__fields__: raise CondaValueError("Cannot match on field %s" % (field_name,)) elif isinstance(value, string_types): value = text_type(value) if hasattr(value, "match"): matcher = value elif field_name in _implementors: matcher = _implementors[field_name](value) elif text_type(value): matcher = StrMatch(value) else: raise NotImplementedError() return field_name, matcher return frozendict(_make(key, value) for key, value in iteritems(kwargs))
https://github.com/conda/conda/issues/6441
Traceback (most recent call last): File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/exceptions.py\", line 683, in __call__ return func(*args, **kwargs) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main_list.py\", line 150, in execute show_channel_urls=context.show_channel_urls) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main_list.py\", line 90, in print_packages show_channel_urls=show_channel_urls) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main_list.py\", line 52, in list_packages info = is_linked(prefix, dist) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/core/linked_data.py\", line 166, in is_linked elif MatchSpec(dist).match(prefix_record): File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 67, in __call__ return super(MatchSpecType, cls).__call__(**parsed) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 178, in __init__ self._match_components = self._build_components(**kwargs) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 359, in _build_components return frozendict(_make(key, value) for key, value in iteritems(kwargs)) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 359, in <genexpr> return frozendict(_make(key, value) for key, value in iteritems(kwargs)) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 355, in _make raise NotImplementedError() NotImplementedError
NotImplementedError
def _make(field_name, value): if field_name not in IndexRecord.__fields__: raise CondaValueError("Cannot match on field %s" % (field_name,)) elif isinstance(value, string_types): value = text_type(value) if hasattr(value, "match"): matcher = value elif field_name in _implementors: matcher = _implementors[field_name](value) else: matcher = StrMatch(text_type(value)) return field_name, matcher
def _make(field_name, value): if field_name not in IndexRecord.__fields__: raise CondaValueError("Cannot match on field %s" % (field_name,)) elif isinstance(value, string_types): value = text_type(value) if hasattr(value, "match"): matcher = value elif field_name in _implementors: matcher = _implementors[field_name](value) elif text_type(value): matcher = StrMatch(value) else: raise NotImplementedError() return field_name, matcher
https://github.com/conda/conda/issues/6441
Traceback (most recent call last): File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/exceptions.py\", line 683, in __call__ return func(*args, **kwargs) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main_list.py\", line 150, in execute show_channel_urls=context.show_channel_urls) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main_list.py\", line 90, in print_packages show_channel_urls=show_channel_urls) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main_list.py\", line 52, in list_packages info = is_linked(prefix, dist) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/core/linked_data.py\", line 166, in is_linked elif MatchSpec(dist).match(prefix_record): File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 67, in __call__ return super(MatchSpecType, cls).__call__(**parsed) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 178, in __init__ self._match_components = self._build_components(**kwargs) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 359, in _build_components return frozendict(_make(key, value) for key, value in iteritems(kwargs)) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 359, in <genexpr> return frozendict(_make(key, value) for key, value in iteritems(kwargs)) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 355, in _make raise NotImplementedError() NotImplementedError
NotImplementedError
def get_info_dict(system=False): try: from ..install import linked_data root_pkgs = linked_data(context.root_prefix) except: # pragma: no cover root_pkgs = {} try: from requests import __version__ as requests_version # These environment variables can influence requests' behavior, along with configuration # in a .netrc file # REQUESTS_CA_BUNDLE # HTTP_PROXY # HTTPS_PROXY except ImportError: # pragma: no cover try: from pip._vendor.requests import __version__ as requests_version except Exception as e: # pragma: no cover requests_version = "Error %r" % e except Exception as e: # pragma: no cover requests_version = "Error %r" % e try: from conda_env import __version__ as conda_env_version except: # pragma: no cover try: cenv = [p for p in itervalues(root_pkgs) if p["name"] == "conda-env"] conda_env_version = cenv[0]["version"] except: conda_env_version = "not installed" try: import conda_build except ImportError: # pragma: no cover conda_build_version = "not installed" except Exception as e: # pragma: no cover conda_build_version = "Error %s" % e else: # pragma: no cover conda_build_version = conda_build.__version__ channels = list(all_channel_urls(context.channels)) if not context.json: channels = [c + ("" if offline_keep(c) else " (offline)") for c in channels] channels = [mask_anaconda_token(c) for c in channels] config_files = tuple( path for path in context.collect_all() if path not in ("envvars", "cmd_line") ) netrc_file = os.environ.get("NETRC") if not netrc_file: user_netrc = expanduser("~/.netrc") if isfile(user_netrc): netrc_file = user_netrc active_prefix_name = env_name(context.active_prefix) info_dict = dict( platform=context.subdir, conda_version=conda_version, conda_env_version=conda_env_version, conda_build_version=conda_build_version, root_prefix=context.root_prefix, conda_prefix=context.conda_prefix, conda_private=conda_in_private_env(), root_writable=context.root_writable, pkgs_dirs=context.pkgs_dirs, envs_dirs=context.envs_dirs, default_prefix=context.default_prefix, active_prefix=context.active_prefix, active_prefix_name=active_prefix_name, conda_shlvl=context.shlvl, channels=channels, user_rc_path=user_rc_path, rc_path=user_rc_path, sys_rc_path=sys_rc_path, # is_foreign=bool(foreign), offline=context.offline, envs=[], python_version=".".join(map(str, sys.version_info)), requests_version=requests_version, user_agent=context.user_agent, conda_location=CONDA_PACKAGE_ROOT, config_files=config_files, netrc_file=netrc_file, ) if on_win: from ..common.platform import is_admin_on_windows info_dict["is_windows_admin"] = is_admin_on_windows() else: info_dict["UID"] = os.geteuid() info_dict["GID"] = os.getegid() evars = { "CIO_TEST", "REQUESTS_CA_BUNDLE", "SSL_CERT_FILE", } # add all relevant env vars, e.g. startswith('CONDA') or endswith('PATH') evars.update(v for v in os.environ if v.upper().startswith("CONDA")) evars.update(v for v in os.environ if v.upper().startswith("PYTHON")) evars.update(v for v in os.environ if v.upper().endswith("PROXY")) evars.update(v for v in os.environ if v.upper().endswith("PATH")) info_dict.update( { "sys.version": sys.version, "sys.prefix": sys.prefix, "sys.executable": sys.executable, "site_dirs": get_user_site(), "env_vars": { ev: os.getenv(ev, os.getenv(ev.lower(), "<not set>")) for ev in evars }, } ) return info_dict
def get_info_dict(system=False): try: from ..install import linked_data root_pkgs = linked_data(context.root_prefix) except: # pragma: no cover root_pkgs = {} try: from requests import __version__ as requests_version # These environment variables can influence requests' behavior, along with configuration # in a .netrc file # REQUESTS_CA_BUNDLE # HTTP_PROXY # HTTPS_PROXY except ImportError: # pragma: no cover try: from pip._vendor.requests import __version__ as requests_version except Exception as e: # pragma: no cover requests_version = "Error %r" % e except Exception as e: # pragma: no cover requests_version = "Error %r" % e try: from conda_env import __version__ as conda_env_version except: # pragma: no cover try: cenv = [p for p in itervalues(root_pkgs) if p["name"] == "conda-env"] conda_env_version = cenv[0]["version"] except: conda_env_version = "not installed" try: import conda_build except ImportError: # pragma: no cover conda_build_version = "not installed" except Exception as e: # pragma: no cover conda_build_version = "Error %s" % e else: # pragma: no cover conda_build_version = conda_build.__version__ channels = list(all_channel_urls(context.channels)) if not context.json: channels = [c + ("" if offline_keep(c) else " (offline)") for c in channels] channels = [mask_anaconda_token(c) for c in channels] config_files = tuple( path for path in context.collect_all() if path not in ("envvars", "cmd_line") ) netrc_file = os.environ.get("NETRC") if not netrc_file: user_netrc = expanduser("~/.netrc") if isfile(user_netrc): netrc_file = user_netrc active_prefix_name = env_name(context.active_prefix) info_dict = dict( platform=context.subdir, conda_version=conda_version, conda_env_version=conda_env_version, conda_build_version=conda_build_version, root_prefix=context.root_prefix, conda_prefix=context.conda_prefix, conda_private=conda_in_private_env(), root_writable=context.root_writable, pkgs_dirs=context.pkgs_dirs, envs_dirs=context.envs_dirs, default_prefix=context.default_prefix, active_prefix=context.active_prefix, active_prefix_name=active_prefix_name, conda_shlvl=context.shlvl, channels=channels, user_rc_path=user_rc_path, rc_path=user_rc_path, sys_rc_path=sys_rc_path, # is_foreign=bool(foreign), offline=context.offline, envs=[], python_version=".".join(map(str, sys.version_info)), requests_version=requests_version, user_agent=context.user_agent, conda_location=CONDA_PACKAGE_ROOT, config_files=config_files, netrc_file=netrc_file, ) if on_win: from ..common.platform import is_admin_on_windows info_dict["is_windows_admin"] = is_admin_on_windows() else: info_dict["UID"] = os.geteuid() info_dict["GID"] = os.getegid() if system: evars = { "CIO_TEST", "CONDA_DEFAULT_ENV", "CONDA_ENVS_PATH", "DYLD_LIBRARY_PATH", "FTP_PROXY", "HTTP_PROXY", "HTTPS_PROXY", "LD_LIBRARY_PATH", "PATH", "PYTHONHOME", "PYTHONPATH", "REQUESTS_CA_BUNDLE", "SSL_CERT_FILE", } evars.update(v for v in os.environ if v.startswith("CONDA_")) evars.update(v for v in os.environ if v.startswith("conda_")) info_dict.update( { "sys.version": sys.version, "sys.prefix": sys.prefix, "sys.executable": sys.executable, "site_dirs": get_user_site(), "env_vars": { ev: os.getenv(ev, os.getenv(ev.lower(), "<not set>")) for ev in evars }, } ) return info_dict
https://github.com/conda/conda/issues/6431
Traceback (most recent call last): File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 265, in _make_single_record repodata_record = read_repodata_json(extracted_package_dir) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/gateways/disk/read.py\", line 123, in read_repodata_json with open(join(extracted_package_directory, 'info', 'repodata_record.json')) as fi: FileNotFoundError: [Errno 2] No such file or directory: '/home/travis/miniconda/pkgs/test_source_files-1-0/info/repodata_record.json' During handling of the above exception, another exception occurred: Traceback (most recent call last): File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 276, in _make_single_record index_json_record = read_index_json(extracted_package_dir) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/gateways/disk/read.py\", line 111, in read_index_json with open(join(extracted_package_directory, 'info', 'index.json')) as fi: FileNotFoundError: [Errno 2] No such file or directory: '/home/travis/miniconda/pkgs/test_source_files-1-0/info/index.json' During handling of the above exception, another exception occurred: Traceback (most recent call last): File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/exceptions.py\", line 683, in __call__ return func(*args, **kwargs) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/cli/main_create.py\", line 11, in execute install(args, parser, 'create') File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/cli/install.py\", line 241, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/cli/install.py\", line 258, in handle_txn unlink_link_transaction.display_actions(progressive_fetch_extract) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/link.py\", line 704, in display_actions legacy_action_groups = self.make_legacy_action_groups(pfe) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/link.py\", line 687, in make_legacy_action_groups pfe.prepare() File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 504, in prepare for prec in self.link_precs) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 504, in <genexpr> for prec in self.link_precs) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 399, in make_actions_for_record ), None) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 396, in <genexpr> pcrec for pcrec in concat(PackageCache(pkgs_dir).query(pref_or_spec) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 397, in <genexpr> for pkgs_dir in context.pkgs_dirs) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 116, in query return (pcrec for pcrec in itervalues(self._package_cache_records) if pcrec == param) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 208, in _package_cache_records return self.__package_cache_records or self.load() or self.__package_cache_records File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 88, in load package_cache_record = self._make_single_record(base_name) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 291, in _make_single_record extract_tarball(package_tarball_full_path, extracted_package_dir) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/gateways/disk/create.py\", line 133, in extract_tarball assert not lexists(destination_directory), destination_directory AssertionError: /home/travis/miniconda/pkgs/test_source_files-1-0
FileNotFoundError
def execute(args, parser): if not (args.all or args.package_names): raise CondaValueError( 'no package names supplied,\n try "conda remove -h" for more details' ) prefix = context.target_prefix check_non_admin() if args.all and prefix == context.default_prefix: msg = "cannot remove current environment. deactivate and run conda remove again" raise CondaEnvironmentError(msg) if args.all and not isdir(prefix): # full environment removal was requested, but environment doesn't exist anyway return 0 if not is_conda_environment(prefix): from ..exceptions import EnvironmentLocationNotFound raise EnvironmentLocationNotFound(prefix) delete_trash() if args.all: if prefix == context.root_prefix: raise CondaEnvironmentError( "cannot remove root environment,\n" " add -n NAME or -p PREFIX option" ) print("\nRemove all packages in environment %s:\n" % prefix, file=sys.stderr) index = linked_data(prefix) index = {dist: info for dist, info in iteritems(index)} actions = defaultdict(list) actions[PREFIX] = prefix for dist in sorted(iterkeys(index)): add_unlink(actions, dist) actions["ACTION"] = "REMOVE_ALL" action_groups = ((actions, index),) if not context.json: confirm_yn() rm_rf(prefix) if context.json: stdout_json( {"success": True, "actions": tuple(x[0] for x in action_groups)} ) return else: specs = specs_from_args(args.package_names) channel_urls = () subdirs = () solver = Solver(prefix, channel_urls, subdirs, specs_to_remove=specs) txn = solver.solve_for_transaction(force_remove=args.force) pfe = txn.get_pfe() handle_txn(pfe, txn, prefix, args, False, True)
def execute(args, parser): if not (args.all or args.package_names or args.features): raise CondaValueError( 'no package names supplied,\n try "conda remove -h" for more details' ) prefix = context.target_prefix check_non_admin() if args.all and prefix == context.default_prefix: msg = "cannot remove current environment. deactivate and run conda remove again" raise CondaEnvironmentError(msg) if args.all and not isdir(prefix): # full environment removal was requested, but environment doesn't exist anyway return 0 if not is_conda_environment(prefix): from ..exceptions import EnvironmentLocationNotFound raise EnvironmentLocationNotFound(prefix) delete_trash() if args.all: if prefix == context.root_prefix: raise CondaEnvironmentError( "cannot remove root environment,\n" " add -n NAME or -p PREFIX option" ) print("\nRemove all packages in environment %s:\n" % prefix, file=sys.stderr) index = linked_data(prefix) index = {dist: info for dist, info in iteritems(index)} actions = defaultdict(list) actions[PREFIX] = prefix for dist in sorted(iterkeys(index)): add_unlink(actions, dist) actions["ACTION"] = "REMOVE_ALL" action_groups = ((actions, index),) if not context.json: confirm_yn() rm_rf(prefix) if context.json: stdout_json( {"success": True, "actions": tuple(x[0] for x in action_groups)} ) return else: specs = specs_from_args(args.package_names) channel_urls = () subdirs = () solver = Solver(prefix, channel_urls, subdirs, specs_to_remove=specs) txn = solver.solve_for_transaction(force_remove=args.force) pfe = txn.get_pfe() handle_txn(pfe, txn, prefix, args, False, True)
https://github.com/conda/conda/issues/6429
AttributeError", "exception_type": "<class 'AttributeError'>", "traceback": "Traceback (most recent call last): File \"/home/matt/anaconda3/lib/python3.6/site-packages/conda/exceptions.py\", line 683, in __call__ return func(*args, **kwargs) File \"/home/matt/anaconda3/lib/python3.6/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/matt/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/matt/anaconda3/lib/python3.6/site-packages/conda/cli/main_remove.py\", line 28, in execute if not (args.all or args.package_names or args.features): AttributeError: 'Namespace' object has no attribute 'features'
AttributeError
def execute(args, parser): from conda.base.context import context name = args.remote_definition or args.name try: spec = specs.detect( name=name, filename=expand(args.file), directory=os.getcwd() ) env = spec.environment # FIXME conda code currently requires args to have a name or prefix # don't overwrite name if it's given. gh-254 if args.prefix is None and args.name is None: args.name = env.name except exceptions.SpecNotFound: raise prefix = get_prefix(args, search=False) if args.force and prefix != context.root_prefix and os.path.exists(prefix): rm_rf(prefix) cli_install.check_prefix(prefix, json=args.json) # TODO, add capability # common.ensure_override_channels_requires_channel(args) # channel_urls = args.channel or () # # special case for empty environment # if not env.dependencies: # from conda.install import symlink_conda # symlink_conda(prefix, context.root_dir) for installer_type, pkg_specs in env.dependencies.items(): try: installer = get_installer(installer_type) installer.install(prefix, pkg_specs, args, env) except InvalidInstaller: sys.stderr.write( textwrap.dedent(""" Unable to install package for {0}. Please double check and ensure your dependencies file has the correct spelling. You might also try installing the conda-env-{0} package to see if provides the required installer. """) .lstrip() .format(installer_type) ) return -1 touch_nonadmin(prefix) cli_install.print_activate(args.name if args.name else prefix)
def execute(args, parser): from conda.base.context import context name = args.remote_definition or args.name try: spec = specs.detect( name=name, filename=expand(args.file), directory=os.getcwd() ) env = spec.environment # FIXME conda code currently requires args to have a name or prefix # don't overwrite name if it's given. gh-254 if args.prefix is None and args.name is None: args.name = env.name except exceptions.SpecNotFound: raise prefix = get_prefix(args, search=False) if args.force and prefix != context.root_prefix and os.path.exists(prefix): rm_rf(prefix) cli_install.check_prefix(prefix, json=args.json) # TODO, add capability # common.ensure_override_channels_requires_channel(args) # channel_urls = args.channel or () # # special case for empty environment # if not env.dependencies: # from conda.install import symlink_conda # symlink_conda(prefix, context.root_dir) for installer_type, pkg_specs in env.dependencies.items(): try: installer = get_installer(installer_type) installer.install(prefix, pkg_specs, args, env) except InvalidInstaller: sys.stderr.write( textwrap.dedent(""" Unable to install package for {0}. Please double check and ensure you dependencies file has the correct spelling. You might also try installing the conda-env-{0} package to see if provides the required installer. """) .lstrip() .format(installer_type) ) return -1 touch_nonadmin(prefix) cli_install.print_activate(args.name if args.name else prefix)
https://github.com/conda/conda/issues/5680
$ cat environment.yml dependencies: - pip: $ conda env create -n recreate --file=environment.yml Fetching package metadata ........... Solving package specifications: An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : linux-64 conda version : 4.3.13 conda is private : False conda-env version : 4.3.13 conda-build version : 2.1.5 python version : 3.5.2.final.0 requests version : 2.13.0 root environment : /opt/ts/services/miniconda.ext_public_miniconda/dist (read only) default environment : /opt/ts/services/miniconda.ext_public_miniconda/dist envs directories : /nas/dft/ire/rhys/envs /opt/ts/services/miniconda.ext_public_miniconda/dist/envs /home/rhys/.conda/envs package cache : /opt/ts/services/miniconda.ext_public_miniconda/dist/pkgs /home/rhys/.conda/pkgs channel URLs : http://python3.app.twosigma.com/conda/twosigma.com/ts/linux-64 http://python3.app.twosigma.com/conda/twosigma.com/ts/noarch http://python3.app.twosigma.com/conda/twosigma.com/ext/linux-64 http://python3.app.twosigma.com/conda/twosigma.com/ext/noarch http://python3.app.twosigma.com/conda/repo.continuum.io/pkgs/free/linux-64 http://python3.app.twosigma.com/conda/repo.continuum.io/pkgs/free/noarch http://python3.app.twosigma.com/conda/repo.continuum.io/pkgs/pro/linux-64 http://python3.app.twosigma.com/conda/repo.continuum.io/pkgs/pro/noarch config file : /home/rhys/.condarc offline mode : False user-agent : conda/4.3.13 requests/2.13.0 CPython/3.5.2 Linux/4.1.35-pv-ts2 debian/7.10 glibc/2.13 UID:GID : 11082:5000 `$ /opt/ts/services/miniconda.ext_public_miniconda/dist/bin/conda-env create -n recreate --file=environment.yml` Traceback (most recent call last): File "/opt/ts/services/miniconda.ext_public_miniconda/dist/lib/python3.5/site-packages/conda/exceptions.py", line 591, in conda_exception_handler return_value = func(*args, **kwargs) File "/opt/ts/services/miniconda.ext_public_miniconda/dist/lib/python3.5/site-packages/conda_env/cli/main_create.py", line 108, in execute installer.install(prefix, pkg_specs, args, env) File "/opt/ts/services/miniconda.ext_public_miniconda/dist/lib/python3.5/site-packages/conda_env/installers/pip.py", line 8, in install pip_cmd = pip_args(prefix) + ['install', ] + specs TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'
TypeError
def parse(self): if not self.raw: return self.update({"conda": []}) for line in self.raw: if isinstance(line, dict): self.update(line) else: self["conda"].append(common.arg2spec(line)) if "pip" in self: if not self["pip"]: del self["pip"] if not any(MatchSpec(s).name == "pip" for s in self["conda"]): self["conda"].append("pip")
def parse(self): if not self.raw: return self.update({"conda": []}) for line in self.raw: if isinstance(line, dict): self.update(line) else: self["conda"].append(common.arg2spec(line))
https://github.com/conda/conda/issues/5680
$ cat environment.yml dependencies: - pip: $ conda env create -n recreate --file=environment.yml Fetching package metadata ........... Solving package specifications: An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : linux-64 conda version : 4.3.13 conda is private : False conda-env version : 4.3.13 conda-build version : 2.1.5 python version : 3.5.2.final.0 requests version : 2.13.0 root environment : /opt/ts/services/miniconda.ext_public_miniconda/dist (read only) default environment : /opt/ts/services/miniconda.ext_public_miniconda/dist envs directories : /nas/dft/ire/rhys/envs /opt/ts/services/miniconda.ext_public_miniconda/dist/envs /home/rhys/.conda/envs package cache : /opt/ts/services/miniconda.ext_public_miniconda/dist/pkgs /home/rhys/.conda/pkgs channel URLs : http://python3.app.twosigma.com/conda/twosigma.com/ts/linux-64 http://python3.app.twosigma.com/conda/twosigma.com/ts/noarch http://python3.app.twosigma.com/conda/twosigma.com/ext/linux-64 http://python3.app.twosigma.com/conda/twosigma.com/ext/noarch http://python3.app.twosigma.com/conda/repo.continuum.io/pkgs/free/linux-64 http://python3.app.twosigma.com/conda/repo.continuum.io/pkgs/free/noarch http://python3.app.twosigma.com/conda/repo.continuum.io/pkgs/pro/linux-64 http://python3.app.twosigma.com/conda/repo.continuum.io/pkgs/pro/noarch config file : /home/rhys/.condarc offline mode : False user-agent : conda/4.3.13 requests/2.13.0 CPython/3.5.2 Linux/4.1.35-pv-ts2 debian/7.10 glibc/2.13 UID:GID : 11082:5000 `$ /opt/ts/services/miniconda.ext_public_miniconda/dist/bin/conda-env create -n recreate --file=environment.yml` Traceback (most recent call last): File "/opt/ts/services/miniconda.ext_public_miniconda/dist/lib/python3.5/site-packages/conda/exceptions.py", line 591, in conda_exception_handler return_value = func(*args, **kwargs) File "/opt/ts/services/miniconda.ext_public_miniconda/dist/lib/python3.5/site-packages/conda_env/cli/main_create.py", line 108, in execute installer.install(prefix, pkg_specs, args, env) File "/opt/ts/services/miniconda.ext_public_miniconda/dist/lib/python3.5/site-packages/conda_env/installers/pip.py", line 8, in install pip_cmd = pip_args(prefix) + ['install', ] + specs TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'
TypeError
def configure_parser(sub_parsers): list_parser = sub_parsers.add_parser( "list", formatter_class=RawDescriptionHelpFormatter, description=description, help=description, epilog=example, ) common.add_parser_json(list_parser) list_parser.set_defaults(func=execute)
def configure_parser(sub_parsers): l = sub_parsers.add_parser( "list", formatter_class=RawDescriptionHelpFormatter, description=description, help=description, epilog=example, ) common.add_parser_json(l) l.set_defaults(func=execute)
https://github.com/conda/conda/issues/6023
Traceback (most recent call last): File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\exceptions.py", line 632, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\cli\main.py", line 137, in _main exit_code = args.func(args, p) File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 80, in execute install(args, parser, 'install') File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\cli\install.py", line 357, in install execute_actions(actions, index, verbose=not context.quiet) File "C:\Users\dbsr7927\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\plan.py", line 830, in execute_actions execute_instructions(plan, index, verbose) File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\instructions.py", line 247, in execute_instructions cmd(state, arg) File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\instructions.py", line 108, in UNLINKLINKTRANSACTION_CMD txn.execute() File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\core\link.py", line 263, in execute self.verify() File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\core\link.py", line 242, in verify self.prepare() File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\core\link.py", line 149, in prepare for pkg_info in self.packages_info_to_link) File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\core\link.py", line 149, in <genexpr> for pkg_info in self.packages_info_to_link) File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\core\link.py", line 54, in determine_link_type if hardlink_supported(source_test_file, target_prefix): File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\_vendor\auxlib\decorators.py", line 56, in _memoized_func result = func(*args, **kwargs) File "C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\gateways\disk\test.py", line 84, in hardlink_supported assert not lexists(test_file), test_file AssertionError: C:\Users\xxxx\AppData\Local\Continuum\Anaconda3\.tmp.index.json
AssertionError
def _make_single_record(self, package_filename): if not package_filename.endswith(CONDA_TARBALL_EXTENSION): package_filename += CONDA_TARBALL_EXTENSION package_tarball_full_path = join(self.pkgs_dir, package_filename) log.trace("adding to package cache %s", package_tarball_full_path) extracted_package_dir = package_tarball_full_path[: -len(CONDA_TARBALL_EXTENSION)] # try reading info/repodata_record.json try: repodata_record = read_repodata_json(extracted_package_dir) package_cache_record = PackageCacheRecord.from_objects( repodata_record, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) return package_cache_record except (IOError, OSError): # no info/repodata_record.json exists # try reading info/index.json try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError): # info/index.json doesn't exist either if isdir(extracted_package_dir) and not isfile(package_tarball_full_path): # We have a directory that looks like a conda package, but without # (1) info/repodata_record.json or info/index.json, and (2) a conda package # tarball, there's not much we can do. We'll just ignore it. return None try: if self.is_writable: if isdir(extracted_package_dir): # We have a partially unpacked conda package directory. Best thing # to do is remove it and try extracting. rm_rf(extracted_package_dir) extract_tarball(package_tarball_full_path, extracted_package_dir) index_json_record = read_index_json(extracted_package_dir) else: index_json_record = read_index_json_from_tarball( package_tarball_full_path ) except (EOFError, ReadError): # EOFError: Compressed file ended before the end-of-stream marker was reached # tarfile.ReadError: file could not be opened successfully rm_rf(package_tarball_full_path) return None if isfile(package_tarball_full_path): md5 = compute_md5sum(package_tarball_full_path) else: md5 = None url = first(self._urls_data, lambda x: basename(x) == package_filename) package_cache_record = PackageCacheRecord.from_objects( index_json_record, url=url, md5=md5, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) # write the info/repodata_record.json file so we can short-circuit this next time if self.is_writable: repodata_record = PackageRecord.from_objects(package_cache_record) repodata_record_path = join( extracted_package_dir, "info", "repodata_record.json" ) write_as_json_to_file(repodata_record_path, repodata_record) return package_cache_record
def _make_single_record(self, package_filename): if not package_filename.endswith(CONDA_TARBALL_EXTENSION): package_filename += CONDA_TARBALL_EXTENSION package_tarball_full_path = join(self.pkgs_dir, package_filename) log.trace("adding to package cache %s", package_tarball_full_path) extracted_package_dir = package_tarball_full_path[: -len(CONDA_TARBALL_EXTENSION)] # try reading info/repodata_record.json try: repodata_record = read_repodata_json(extracted_package_dir) package_cache_record = PackageCacheRecord.from_objects( repodata_record, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) except (IOError, OSError): try: index_json_record = read_index_json(extracted_package_dir) except (IOError, OSError): try: if self.is_writable: extract_tarball(package_tarball_full_path, extracted_package_dir) index_json_record = read_index_json(extracted_package_dir) else: index_json_record = read_index_json_from_tarball( package_tarball_full_path ) except (EOFError, ReadError): # EOFError: Compressed file ended before the end-of-stream marker was reached # tarfile.ReadError: file could not be opened successfully rm_rf(package_tarball_full_path) return None if isfile(package_tarball_full_path): md5 = compute_md5sum(package_tarball_full_path) else: md5 = None url = first(self._urls_data, lambda x: basename(x) == package_filename) package_cache_record = PackageCacheRecord.from_objects( index_json_record, url=url, md5=md5, package_tarball_full_path=package_tarball_full_path, extracted_package_dir=extracted_package_dir, ) return package_cache_record
https://github.com/conda/conda/issues/5808
{ "command":"D:\\Anaconda3\\Scripts\\conda-script.py install -c anaconda pillow", "conda_info":{ "_channels":"https://conda.anaconda.org/anaconda/win-64 https://conda.anaconda.org/anaconda/noarch https://repo.continuum.io/pkgs/free/win-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/win-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/win-64 https://repo.continuum.io/pkgs/pro/noarch https://repo.continuum.io/pkgs/msys2/win-64 https://repo.continuum.io/pkgs/msys2/noarch", "_config_files":"", "_envs_dirs":"D:\\Anaconda3\\envs C:\\Users\\username\\AppData\\Local\\conda\\conda\\envs C:\\Users\\username\\.conda\\envs", "_pkgs_dirs":"D:\\Anaconda3\\pkgs C:\\Users\\username\\AppData\\Local\\conda\\conda\\pkgs", "_rtwro":"writable", "active_prefix":null, "active_prefix_name":null, "channels":[ "https://conda.anaconda.org/anaconda/win-64", "https://conda.anaconda.org/anaconda/noarch", "https://repo.continuum.io/pkgs/free/win-64", "https://repo.continuum.io/pkgs/free/noarch", "https://repo.continuum.io/pkgs/r/win-64", "https://repo.continuum.io/pkgs/r/noarch", "https://repo.continuum.io/pkgs/pro/win-64", "https://repo.continuum.io/pkgs/pro/noarch", "https://repo.continuum.io/pkgs/msys2/win-64", "https://repo.continuum.io/pkgs/msys2/noarch" ], "conda_build_version":"3.0.6", "conda_env_version":"4.4.0rc0", "conda_location":"D:\\Anaconda3\\lib\\site-packages\\conda", "conda_prefix":"D:\\Anaconda3", "conda_private":false, "conda_shlvl":-1, "conda_version":"4.4.0rc0", "config_files":[ ], "default_prefix":"D:\\Anaconda3", "envs":[ ], "envs_dirs":[ "D:\\Anaconda3\\envs", "C:\\Users\\username\\AppData\\Local\\conda\\conda\\envs", "C:\\Users\\username\\.conda\\envs" ], "is_windows_admin":false, "netrc_file":null, "offline":false, "pkgs_dirs":[ "D:\\Anaconda3\\pkgs", "C:\\Users\\username\\AppData\\Local\\conda\\conda\\pkgs" ], "platform":"win-64", "python_version":"3.5.3.final.0", "rc_path":"C:\\Users\\username\\.condarc", "requests_version":"2.14.2", "root_prefix":"D:\\Anaconda3", "root_writable":true, "sys_rc_path":"D:\\Anaconda3\\.condarc", "user_agent":"conda/4.4.0rc0 requests/2.14.2 CPython/3.5.3 Windows/10 Windows/10.0.15063", "user_rc_path":"C:\\Users\\username\\.condarc" }, "error":"AssertionError('D:\\\\Anaconda3\\\\pkgs\\\\numpy-1.10.1-py35_0',)", "exception_name":"AssertionError", "exception_type":"<class 'AssertionError'>", "traceback":"Traceback (most recent call last): File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\package_cache.py\", line 262, in _make_single_record repodata_record = read_repodata_json(extracted_package_dir) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\gateways\\disk\\read.py\", line 123, in read_repodata_json with open(join(extracted_package_directory, 'info', 'repodata_record.json')) as fi: FileNotFoundError: [Errno 2] No such file or directory: 'D:\\\\Anaconda3\\\\pkgs\\\\numpy-1.10.1-py35_0\\\\info\\\\repodata_record.json' During handling of the above exception, another exception occurred: Traceback (most recent call last): File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\package_cache.py\", line 270, in _make_single_record index_json_record = read_index_json(extracted_package_dir) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\gateways\\disk\\read.py\", line 111, in read_index_json with open(join(extracted_package_directory, 'info', 'index.json')) as fi: FileNotFoundError: [Errno 2] No such file or directory: 'D:\\\\Anaconda3\\\\pkgs\\\\numpy-1.10.1-py35_0\\\\info\\\\index.json' During handling of the above exception, another exception occurred: Traceback (most recent call last): File \"D:\\Anaconda3\\lib\\site-packages\\conda\\exceptions.py\", line 653, in __call__ return func(*args, **kwargs) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\cli\\main.py\", line 136, in _main exit_code = args.func(args, p) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\cli\\main_install.py\", line 80, in execute install(args, parser, 'install') File \"D:\\Anaconda3\\lib\\site-packages\\conda\\cli\\install.py\", line 220, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\cli\\install.py\", line 237, in handle_txn unlink_link_transaction.display_actions(progressive_fetch_extract) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\link.py\", line 698, in display_actions legacy_action_groups = self.make_legacy_action_groups(pfe) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\link.py\", line 681, in make_legacy_action_groups pfe.prepare() File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\package_cache.py\", line 479, in prepare for prec in self.link_precs) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\package_cache.py\", line 479, in <genexpr> for prec in self.link_precs) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\package_cache.py\", line 375, in make_actions_for_record ), None) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\package_cache.py\", line 372, in <genexpr> pcrec for pcrec in concat(PackageCache(pkgs_dir).query(pref_or_spec) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\package_cache.py\", line 373, in <genexpr> for pkgs_dir in context.pkgs_dirs) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\package_cache.py\", line 116, in query return (pcrec for pcrec in itervalues(self._package_cache_records) if pcrec == param) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\package_cache.py\", line 208, in _package_cache_records return self.__package_cache_records or self.load() or self.__package_cache_records File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\package_cache.py\", line 88, in load package_cache_record = self._make_single_record(base_name) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\core\\package_cache.py\", line 274, in _make_single_record extract_tarball(package_tarball_full_path, extracted_package_dir) File \"D:\\Anaconda3\\lib\\site-packages\\conda\\gateways\\disk\\create.py\", line 133, in extract_tarball assert not lexists(destination_directory), destination_directory AssertionError: D:\\Anaconda3\\pkgs\\numpy-1.10.1-py35_0 " }
FileNotFoundError
def execute(args, parser): name = args.remote_definition or args.name try: spec = install_specs.detect( name=name, filename=expand(args.file), directory=os.getcwd() ) env = spec.environment except exceptions.SpecNotFound: raise if not (args.name or args.prefix): if not env.name: # Note, this is a hack fofr get_prefix that assumes argparse results # TODO Refactor common.get_prefix name = os.environ.get("CONDA_DEFAULT_ENV", False) if not name: msg = "Unable to determine environment\n\n" msg += textwrap.dedent(""" Please re-run this command with one of the following options: * Provide an environment name via --name or -n * Re-run this command inside an activated conda environment.""").lstrip() # TODO Add json support raise CondaEnvException(msg) # Note: stubbing out the args object as all of the # conda.cli.common code thinks that name will always # be specified. args.name = env.name prefix = get_prefix(args, search=False) # CAN'T Check with this function since it assumes we will create prefix. # cli_install.check_prefix(prefix, json=args.json) # TODO, add capability # common.ensure_override_channels_requires_channel(args) # channel_urls = args.channel or () for installer_type, specs in env.dependencies.items(): try: installer = get_installer(installer_type) installer.install(prefix, specs, args, env) except InvalidInstaller: sys.stderr.write( textwrap.dedent(""" Unable to install package for {0}. Please double check and ensure you dependencies file has the correct spelling. You might also try installing the conda-env-{0} package to see if provides the required installer. """) .lstrip() .format(installer_type) ) return -1 touch_nonadmin(prefix) cli_install.print_activate(args.name if args.name else prefix)
def execute(args, parser): name = args.remote_definition or args.name try: spec = install_specs.detect( name=name, filename=expand(args.file), directory=os.getcwd() ) env = spec.environment except exceptions.SpecNotFound: raise if not (args.name or args.prefix): if not env.name: # Note, this is a hack fofr get_prefix that assumes argparse results # TODO Refactor common.get_prefix name = os.environ.get("CONDA_DEFAULT_ENV", False) if not name: msg = "Unable to determine environment\n\n" msg += textwrap.dedent(""" Please re-run this command with one of the following options: * Provide an environment name via --name or -n * Re-run this command inside an activated conda environment.""").lstrip() # TODO Add json support raise CondaEnvException(msg) # Note: stubbing out the args object as all of the # conda.cli.common code thinks that name will always # be specified. args.name = env.name prefix = get_prefix(args, search=False) # CAN'T Check with this function since it assumes we will create prefix. # cli_install.check_prefix(prefix, json=args.json) # TODO, add capability # common.ensure_override_channels_requires_channel(args) # channel_urls = args.channel or () for installer_type, specs in env.dependencies.items(): try: installer = get_installer(installer_type) installer.install(prefix, specs, args, env, prune=args.prune) except InvalidInstaller: sys.stderr.write( textwrap.dedent(""" Unable to install package for {0}. Please double check and ensure you dependencies file has the correct spelling. You might also try installing the conda-env-{0} package to see if provides the required installer. """) .lstrip() .format(installer_type) ) return -1 touch_nonadmin(prefix) cli_install.print_activate(args.name if args.name else prefix)
https://github.com/conda/conda/issues/5809
{ "command":"/home/travis/miniconda/bin/conda-env update", "conda_info":{ "GID":2000, "UID":2000, "_channels":"https://conda.anaconda.org/conda-canary/linux-64 https://conda.anaconda.org/conda-canary/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch", "_config_files":"/home/travis/.condarc", "_envs_dirs":"/home/travis/miniconda/envs /home/travis/.conda/envs", "_pkgs_dirs":"/home/travis/miniconda/pkgs /home/travis/.conda/pkgs", "_rtwro":"writable", "active_prefix":null, "active_prefix_name":null, "channels":[ "https://conda.anaconda.org/conda-canary/linux-64", "https://conda.anaconda.org/conda-canary/noarch", "https://repo.continuum.io/pkgs/free/linux-64", "https://repo.continuum.io/pkgs/free/noarch", "https://repo.continuum.io/pkgs/r/linux-64", "https://repo.continuum.io/pkgs/r/noarch", "https://repo.continuum.io/pkgs/pro/linux-64", "https://repo.continuum.io/pkgs/pro/noarch" ], "conda_build_version":"not installed", "conda_env_version":"4.4.0rc0", "conda_location":"/home/travis/miniconda/lib/python3.6/site-packages/conda", "conda_prefix":"/home/travis/miniconda", "conda_private":false, "conda_shlvl":-1, "conda_version":"4.4.0rc0", "config_files":[ "/home/travis/.condarc" ], "default_prefix":"/home/travis/miniconda", "envs":[ ], "envs_dirs":[ "/home/travis/miniconda/envs", "/home/travis/.conda/envs" ], "netrc_file":null, "offline":false, "pkgs_dirs":[ "/home/travis/miniconda/pkgs", "/home/travis/.conda/pkgs" ], "platform":"linux-64", "python_version":"3.6.1.final.0", "rc_path":"/home/travis/.condarc", "requests_version":"2.14.2", "root_prefix":"/home/travis/miniconda", "root_writable":true, "sys_rc_path":"/home/travis/miniconda/.condarc", "user_agent":"conda/4.4.0rc0 requests/2.14.2 CPython/3.6.1 Linux/4.4.0-83-generic ubuntu/14.04 glibc/2.19", "user_rc_path":"/home/travis/.condarc" }, "error":"TypeError(\"_pip_install_via_requirements() got an unexpected keyword argument 'prune'\",)", "exception_name":"TypeError", "exception_type":"<class 'TypeError'>", "traceback":"Traceback (most recent call last): File \"/home/travis/miniconda/lib/python3.6/site-packages/conda/exceptions.py\", line 653, in __call__ return func(*args, **kwargs) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda_env/cli/main_update.py\", line 107, in execute installer.install(prefix, specs, args, env, prune=args.prune) TypeError: _pip_install_via_requirements() got an unexpected keyword argument 'prune' " }
TypeError
def install(prefix, specs, args, env, *_, **kwargs): # TODO: support all various ways this happens # Including 'nodefaults' in the channels list disables the defaults new_specs = [] channel_urls = set() for elem in specs: if "::" in elem: channel_urls.add(elem.split("::")[0]) new_specs.append(elem.split("::")[-1]) else: new_specs.append(elem) specs = new_specs channel_urls = list(channel_urls) # TODO: support all various ways this happens # Including 'nodefaults' in the channels list disables the defaults channel_urls = channel_urls + [ chan for chan in env.channels if chan != "nodefaults" ] if "nodefaults" not in env.channels: channel_urls.extend(context.channels) _channel_priority_map = prioritize_channels(channel_urls) channel_names = IndexedSet( Channel(url).canonical_name for url in _channel_priority_map ) channels = IndexedSet(Channel(cn) for cn in channel_names) subdirs = IndexedSet(basename(url) for url in _channel_priority_map) solver = Solver(prefix, channels, subdirs, specs_to_add=specs) unlink_link_transaction = solver.solve_for_transaction( prune=getattr(args, "prune", False) ) pfe = unlink_link_transaction.get_pfe() pfe.execute() unlink_link_transaction.execute()
def install(prefix, specs, args, env, prune=False): # TODO: support all various ways this happens # Including 'nodefaults' in the channels list disables the defaults new_specs = [] channel_urls = set() for elem in specs: if "::" in elem: channel_urls.add(elem.split("::")[0]) new_specs.append(elem.split("::")[-1]) else: new_specs.append(elem) specs = new_specs channel_urls = list(channel_urls) # TODO: support all various ways this happens # Including 'nodefaults' in the channels list disables the defaults channel_urls = channel_urls + [ chan for chan in env.channels if chan != "nodefaults" ] if "nodefaults" not in env.channels: channel_urls.extend(context.channels) _channel_priority_map = prioritize_channels(channel_urls) channel_names = IndexedSet( Channel(url).canonical_name for url in _channel_priority_map ) channels = IndexedSet(Channel(cn) for cn in channel_names) subdirs = IndexedSet(basename(url) for url in _channel_priority_map) solver = Solver(prefix, channels, subdirs, specs_to_add=specs) unlink_link_transaction = solver.solve_for_transaction(prune=prune) pfe = unlink_link_transaction.get_pfe() pfe.execute() unlink_link_transaction.execute()
https://github.com/conda/conda/issues/5809
{ "command":"/home/travis/miniconda/bin/conda-env update", "conda_info":{ "GID":2000, "UID":2000, "_channels":"https://conda.anaconda.org/conda-canary/linux-64 https://conda.anaconda.org/conda-canary/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch", "_config_files":"/home/travis/.condarc", "_envs_dirs":"/home/travis/miniconda/envs /home/travis/.conda/envs", "_pkgs_dirs":"/home/travis/miniconda/pkgs /home/travis/.conda/pkgs", "_rtwro":"writable", "active_prefix":null, "active_prefix_name":null, "channels":[ "https://conda.anaconda.org/conda-canary/linux-64", "https://conda.anaconda.org/conda-canary/noarch", "https://repo.continuum.io/pkgs/free/linux-64", "https://repo.continuum.io/pkgs/free/noarch", "https://repo.continuum.io/pkgs/r/linux-64", "https://repo.continuum.io/pkgs/r/noarch", "https://repo.continuum.io/pkgs/pro/linux-64", "https://repo.continuum.io/pkgs/pro/noarch" ], "conda_build_version":"not installed", "conda_env_version":"4.4.0rc0", "conda_location":"/home/travis/miniconda/lib/python3.6/site-packages/conda", "conda_prefix":"/home/travis/miniconda", "conda_private":false, "conda_shlvl":-1, "conda_version":"4.4.0rc0", "config_files":[ "/home/travis/.condarc" ], "default_prefix":"/home/travis/miniconda", "envs":[ ], "envs_dirs":[ "/home/travis/miniconda/envs", "/home/travis/.conda/envs" ], "netrc_file":null, "offline":false, "pkgs_dirs":[ "/home/travis/miniconda/pkgs", "/home/travis/.conda/pkgs" ], "platform":"linux-64", "python_version":"3.6.1.final.0", "rc_path":"/home/travis/.condarc", "requests_version":"2.14.2", "root_prefix":"/home/travis/miniconda", "root_writable":true, "sys_rc_path":"/home/travis/miniconda/.condarc", "user_agent":"conda/4.4.0rc0 requests/2.14.2 CPython/3.6.1 Linux/4.4.0-83-generic ubuntu/14.04 glibc/2.19", "user_rc_path":"/home/travis/.condarc" }, "error":"TypeError(\"_pip_install_via_requirements() got an unexpected keyword argument 'prune'\",)", "exception_name":"TypeError", "exception_type":"<class 'TypeError'>", "traceback":"Traceback (most recent call last): File \"/home/travis/miniconda/lib/python3.6/site-packages/conda/exceptions.py\", line 653, in __call__ return func(*args, **kwargs) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda_env/cli/main_update.py\", line 107, in execute installer.install(prefix, specs, args, env, prune=args.prune) TypeError: _pip_install_via_requirements() got an unexpected keyword argument 'prune' " }
TypeError
def _pip_install_via_requirements(prefix, specs, args, *_, **kwargs): """ Installs the pip dependencies in specs using a temporary pip requirements file. Args ---- prefix: string The path to the python and pip executables. specs: iterable of strings Each element should be a valid pip dependency. See: https://pip.pypa.io/en/stable/user_guide/#requirements-files https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format """ try: pip_workdir = op.dirname(op.abspath(args.file)) except AttributeError: pip_workdir = None requirements = None try: # Generate the temporary requirements file requirements = tempfile.NamedTemporaryFile( mode="w", prefix="condaenv.", suffix=".requirements.txt", dir=pip_workdir, delete=False, ) requirements.write("\n".join(specs)) requirements.close() # pip command line... pip_cmd = pip_args(prefix) + ["install", "-r", requirements.name] # ...run it process = subprocess.Popen(pip_cmd, cwd=pip_workdir, universal_newlines=True) process.communicate() if process.returncode != 0: raise CondaValueError("pip returned an error") finally: # Win/Appveyor does not like it if we use context manager + delete=True. # So we delete the temporary file in a finally block. if requirements is not None and op.isfile(requirements.name): os.remove(requirements.name)
def _pip_install_via_requirements(prefix, specs, args, *_): """ Installs the pip dependencies in specs using a temporary pip requirements file. Args ---- prefix: string The path to the python and pip executables. specs: iterable of strings Each element should be a valid pip dependency. See: https://pip.pypa.io/en/stable/user_guide/#requirements-files https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format """ try: pip_workdir = op.dirname(op.abspath(args.file)) except AttributeError: pip_workdir = None requirements = None try: # Generate the temporary requirements file requirements = tempfile.NamedTemporaryFile( mode="w", prefix="condaenv.", suffix=".requirements.txt", dir=pip_workdir, delete=False, ) requirements.write("\n".join(specs)) requirements.close() # pip command line... pip_cmd = pip_args(prefix) + ["install", "-r", requirements.name] # ...run it process = subprocess.Popen(pip_cmd, cwd=pip_workdir, universal_newlines=True) process.communicate() if process.returncode != 0: raise CondaValueError("pip returned an error") finally: # Win/Appveyor does not like it if we use context manager + delete=True. # So we delete the temporary file in a finally block. if requirements is not None and op.isfile(requirements.name): os.remove(requirements.name)
https://github.com/conda/conda/issues/5809
{ "command":"/home/travis/miniconda/bin/conda-env update", "conda_info":{ "GID":2000, "UID":2000, "_channels":"https://conda.anaconda.org/conda-canary/linux-64 https://conda.anaconda.org/conda-canary/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch", "_config_files":"/home/travis/.condarc", "_envs_dirs":"/home/travis/miniconda/envs /home/travis/.conda/envs", "_pkgs_dirs":"/home/travis/miniconda/pkgs /home/travis/.conda/pkgs", "_rtwro":"writable", "active_prefix":null, "active_prefix_name":null, "channels":[ "https://conda.anaconda.org/conda-canary/linux-64", "https://conda.anaconda.org/conda-canary/noarch", "https://repo.continuum.io/pkgs/free/linux-64", "https://repo.continuum.io/pkgs/free/noarch", "https://repo.continuum.io/pkgs/r/linux-64", "https://repo.continuum.io/pkgs/r/noarch", "https://repo.continuum.io/pkgs/pro/linux-64", "https://repo.continuum.io/pkgs/pro/noarch" ], "conda_build_version":"not installed", "conda_env_version":"4.4.0rc0", "conda_location":"/home/travis/miniconda/lib/python3.6/site-packages/conda", "conda_prefix":"/home/travis/miniconda", "conda_private":false, "conda_shlvl":-1, "conda_version":"4.4.0rc0", "config_files":[ "/home/travis/.condarc" ], "default_prefix":"/home/travis/miniconda", "envs":[ ], "envs_dirs":[ "/home/travis/miniconda/envs", "/home/travis/.conda/envs" ], "netrc_file":null, "offline":false, "pkgs_dirs":[ "/home/travis/miniconda/pkgs", "/home/travis/.conda/pkgs" ], "platform":"linux-64", "python_version":"3.6.1.final.0", "rc_path":"/home/travis/.condarc", "requests_version":"2.14.2", "root_prefix":"/home/travis/miniconda", "root_writable":true, "sys_rc_path":"/home/travis/miniconda/.condarc", "user_agent":"conda/4.4.0rc0 requests/2.14.2 CPython/3.6.1 Linux/4.4.0-83-generic ubuntu/14.04 glibc/2.19", "user_rc_path":"/home/travis/.condarc" }, "error":"TypeError(\"_pip_install_via_requirements() got an unexpected keyword argument 'prune'\",)", "exception_name":"TypeError", "exception_type":"<class 'TypeError'>", "traceback":"Traceback (most recent call last): File \"/home/travis/miniconda/lib/python3.6/site-packages/conda/exceptions.py\", line 653, in __call__ return func(*args, **kwargs) File \"/home/travis/miniconda/lib/python3.6/site-packages/conda_env/cli/main_update.py\", line 107, in execute installer.install(prefix, specs, args, env, prune=args.prune) TypeError: _pip_install_via_requirements() got an unexpected keyword argument 'prune' " }
TypeError
def symlink_conda_hlp(prefix, root_dir, where, symlink_fn): scripts = ["conda", "activate", "deactivate"] prefix_where = join(prefix, where) if not isdir(prefix_where): os.makedirs(prefix_where) for f in scripts: root_file = join(root_dir, where, f) prefix_file = join(prefix_where, f) try: # try to kill stale links if they exist if os.path.lexists(prefix_file): os.remove(prefix_file) # if they're in use, they won't be killed. Skip making new symlink. if not os.path.lexists(prefix_file): symlink_fn(root_file, prefix_file) except (IOError, OSError) as e: if os.path.lexists(prefix_file) and ( e.errno in (errno.EPERM, errno.EACCES, errno.EROFS, errno.EEXIST) ): log.debug( "Cannot symlink {0} to {1}. Ignoring since link already exists.".format( root_file, prefix_file ) ) else: raise
def symlink_conda_hlp(prefix, root_dir, where, symlink_fn): scripts = ["conda", "activate", "deactivate"] prefix_where = join(prefix, where) if not isdir(prefix_where): os.makedirs(prefix_where) for f in scripts: root_file = join(root_dir, where, f) prefix_file = join(prefix_where, f) try: # try to kill stale links if they exist if os.path.lexists(prefix_file): os.remove(prefix_file) # if they're in use, they won't be killed. Skip making new symlink. if not os.path.lexists(prefix_file): symlink_fn(root_file, prefix_file) except (IOError, OSError) as e: if os.path.lexists(prefix_file) and ( e.errno in (errno.EPERM, errno.EACCES, errno.EROFS) ): log.debug( "Cannot symlink {0} to {1}. Ignoring since link already exists.".format( root_file, prefix_file ) ) else: raise
https://github.com/conda/conda/issues/2837
Traceback (most recent call last): File "/symln_home/anaconda/bin/conda", line 6, in <module> sys.exit(main()) File "/Users/tomflem/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 48, in main activate.main() File "/Users/tomflem/anaconda/lib/python2.7/site-packages/conda/cli/activate.py", line 163, in main conda.install.symlink_conda(prefix, root_dir, shell) File "/Users/tomflem/anaconda/lib/python2.7/site-packages/conda/install.py", line 582, in symlink_conda symlink_conda_hlp(prefix, root_dir, where, symlink_fn) File "/Users/tomflem/anaconda/lib/python2.7/site-packages/conda/install.py", line 599, in symlink_conda_hlp symlink_fn(root_file, prefix_file) OSError: [Errno 17] File exists
OSError
def configure_parser(sub_parsers): p = sub_parsers.add_parser( "update", formatter_class=RawDescriptionHelpFormatter, description=description, help=description, epilog=example, ) common.add_parser_prefix(p) p.add_argument( "-f", "--file", action="store", help="environment definition (default: environment.yml)", default="environment.yml", ) p.add_argument( "--prune", action="store_true", default=False, help="remove installed packages not defined in environment.yml", ) p.add_argument( "-q", "--quiet", action="store_true", default=False, ) p.add_argument( "remote_definition", help="remote environment definition / IPython notebook", action="store", default=None, nargs="?", ) common.add_parser_json(p) p.set_defaults(func=execute)
def configure_parser(sub_parsers): p = sub_parsers.add_parser( "update", formatter_class=RawDescriptionHelpFormatter, description=description, help=description, epilog=example, ) p.add_argument( "-n", "--name", action="store", help="name of environment (in %s)" % os.pathsep.join(config.envs_dirs), default=None, ) p.add_argument( "-f", "--file", action="store", help="environment definition (default: environment.yml)", default="environment.yml", ) p.add_argument( "--prune", action="store_true", default=False, help="remove installed packages not defined in environment.yml", ) p.add_argument( "-q", "--quiet", action="store_true", default=False, ) p.add_argument( "remote_definition", help="remote environment definition / IPython notebook", action="store", default=None, nargs="?", ) common.add_parser_json(p) p.set_defaults(func=execute)
https://github.com/conda/conda/issues/5420
conda env update An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : linux-64 conda version : 4.3.20 conda is private : False conda-env version : 4.3.20 conda-build version : not installed python version : 3.5.2.final.0 requests version : 2.14.2 root environment : /home/travis/miniconda (writable) default environment : /home/travis/miniconda envs directories : /home/travis/miniconda/envs /home/travis/.conda/envs package cache : /home/travis/miniconda/pkgs /home/travis/.conda/pkgs channel URLs : https://conda.anaconda.org/conda-canary/linux-64 https://conda.anaconda.org/conda-canary/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch config file : /home/travis/.condarc netrc file : None offline mode : False user-agent : conda/4.3.20 requests/2.14.2 CPython/3.5.2 Linux/4.4.0-51-generic debian/jessie/sid glibc/2.19 UID:GID : 1000:1000 `$ /home/travis/miniconda/bin/conda-env update` Traceback (most recent call last): File "/home/travis/miniconda/lib/python3.5/site-packages/conda/exceptions.py", line 632, in conda_exception_handler return_value = func(*args, **kwargs) File "/home/travis/miniconda/lib/python3.5/site-packages/conda_env/cli/main_update.py", line 82, in execute if not (args.name or args.prefix): AttributeError: 'Namespace' object has no attribute 'prefix'
AttributeError
def error(self, message): import re import subprocess from .find_commands import find_executable exc = sys.exc_info()[1] if exc: # this is incredibly lame, but argparse stupidly does not expose # reasonable hooks for customizing error handling if hasattr(exc, "argument_name"): argument = self._get_action_from_name(exc.argument_name) else: argument = None if argument and argument.dest == "cmd": m = re.compile(r"invalid choice: u?'([\w\-]+)'").match(exc.message) if m: cmd = m.group(1) executable = find_executable("conda-" + cmd) if not executable: raise CommandNotFoundError(cmd) args = [find_executable("conda-" + cmd)] args.extend(sys.argv[2:]) p = subprocess.Popen(args) try: p.communicate() except KeyboardInterrupt: p.wait() finally: sys.exit(p.returncode) super(ArgumentParser, self).error(message)
def error(self, message): import re import subprocess from .find_commands import find_executable exc = sys.exc_info()[1] if exc: # this is incredibly lame, but argparse stupidly does not expose # reasonable hooks for customizing error handling if hasattr(exc, "argument_name"): argument = self._get_action_from_name(exc.argument_name) else: argument = None if argument and argument.dest == "cmd": m = re.compile(r"invalid choice: '([\w\-]+)'").match(exc.message) if m: cmd = m.group(1) executable = find_executable("conda-" + cmd) if not executable: raise CommandNotFoundError(cmd) args = [find_executable("conda-" + cmd)] args.extend(sys.argv[2:]) p = subprocess.Popen(args) try: p.communicate() except KeyboardInterrupt: p.wait() finally: sys.exit(p.returncode) super(ArgumentParser, self).error(message)
https://github.com/conda/conda/issues/5346
________________________________ test_skeleton_pypi ________________________________ Traceback (most recent call last): File "/home/dev/code/conda-build/tests/test_published_examples.py", line 15, in test_skeleton_pypi check_call_env(cmd.split()) File "/home/dev/code/conda-build/conda_build/utils.py", line 670, in check_call_env return _func_defaulting_env_to_os_environ(subprocess.check_call, *popenargs, **kwargs) File "/home/dev/code/conda-build/conda_build/utils.py", line 666, in _func_defaulting_env_to_os_environ return func(_args, **kwargs) File "/opt/miniconda/lib/python2.7/subprocess.py", line 541, in check_call raise CalledProcessError(retcode, cmd) CalledProcessError: Command '['conda', 'skeleton', 'pypi', 'pyinstrument']' returned non-zero exit status 2 ------------------------------- Captured stderr call ------------------------------- usage: conda [-h] [-V] command ... conda: error: argument command: invalid choice: u'skeleton' (choose from u'info', u'help', u'list', u'search', u'create', u'install', u'update', u'upgrade', u'remove', u'uninstall', u'config', u'clean', u'package')
CalledProcessError
def help(command, shell): # sys.argv[1] will be ..checkenv in activate if an environment is already # activated # get grandparent process name to see which shell we're using if command in ("..activate", "..checkenv"): if shell in ["cmd.exe", "powershell.exe"]: raise CondaSystemExit("""Usage: activate ENV Adds the 'Scripts' and 'Library\\bin' directory of the environment ENV to the front of PATH. ENV may either refer to just the name of the environment, or the full prefix path.""") else: raise CondaSystemExit("""Usage: source activate ENV Adds the 'bin' directory of the environment ENV to the front of PATH. ENV may either refer to just the name of the environment, or the full prefix path.""") elif command == "..deactivate": if shell in ["cmd.exe", "powershell.exe"]: raise CondaSystemExit("""Usage: deactivate Removes the environment prefix, 'Scripts' and 'Library\\bin' directory of the environment ENV from the front of PATH.""") else: raise CondaSystemExit("""Usage: source deactivate Removes the 'bin' directory of the environment activated with 'source activate' from PATH. """) else: raise CondaSystemExit( "No help available for command %s" % ensure_text_type(sys.argv[1]) )
def help(command, shell): # sys.argv[1] will be ..checkenv in activate if an environment is already # activated # get grandparent process name to see which shell we're using if command in ("..activate", "..checkenv"): if shell in ["cmd.exe", "powershell.exe"]: raise CondaSystemExit("""Usage: activate ENV Adds the 'Scripts' and 'Library\\bin' directory of the environment ENV to the front of PATH. ENV may either refer to just the name of the environment, or the full prefix path.""") else: raise CondaSystemExit("""Usage: source activate ENV Adds the 'bin' directory of the environment ENV to the front of PATH. ENV may either refer to just the name of the environment, or the full prefix path.""") elif command == "..deactivate": if shell in ["cmd.exe", "powershell.exe"]: raise CondaSystemExit("""Usage: deactivate Removes the environment prefix, 'Scripts' and 'Library\\bin' directory of the environment ENV from the front of PATH.""") else: raise CondaSystemExit("""Usage: source deactivate Removes the 'bin' directory of the environment activated with 'source activate' from PATH. """) else: raise CondaSystemExit("No help available for command %s" % sys.argv[1])
https://github.com/conda/conda/issues/5329
(root) c:\msys64\home\kfranz\continuum\conda>python -m conda create -n qtcrΞator qt=5.6.2 python=3.6 Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment C:\conda-root\envs\qtcrΞator: The following NEW packages will be INSTALLED: icu: 57.1-vc14_0 [vc14] jpeg: 9b-vc14_0 [vc14] libpng: 1.6.27-vc14_0 [vc14] openssl: 1.0.2k-vc14_0 [vc14] pip: 9.0.1-py36_1 python: 3.6.1-2 qt: 5.6.2-vc14_3 [vc14] setuptools: 27.2.0-py36_1 vs2015_runtime: 14.0.25123-0 wheel: 0.29.0-py36_0 zlib: 1.2.8-vc14_3 [vc14] Proceed ([y]/n)? icu-57.1-vc14_ 100% |###############################| Time: 0:00:03 10.44 MB/s jpeg-9b-vc14_0 100% |###############################| Time: 0:00:00 19.74 MB/s python-3.6.1-2 100% |###############################| Time: 0:00:03 10.96 MB/s zlib-1.2.8-vc1 100% |###############################| Time: 0:00:00 0.00 B/s libpng-1.6.27- 100% |###############################| Time: 0:00:00 10.97 MB/s qt-5.6.2-vc14_ 100% |###############################| Time: 0:00:05 11.55 MB/s An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : win-64 conda version : 4.3.18.post13+e7b1a6bf conda is private : False conda-env version : 4.3.18.post13+e7b1a6bf conda-build version : not installed python version : 3.6.1.final.0 requests version : 2.12.4 root environment : C:\conda-root (writable) default environment : C:\conda-root envs directories : C:\conda-root\envs C:\Users\kfranz\AppData\Local\conda\conda\envs C:\Users\kfranz\.conda\envs package cache : C:\conda-root\pkgs C:\Users\kfranz\AppData\Local\conda\conda\pkgs channel URLs : https://repo.continuum.io/pkgs/free/win-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/win-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/win-64 https://repo.continuum.io/pkgs/pro/noarch https://repo.continuum.io/pkgs/msys2/win-64 https://repo.continuum.io/pkgs/msys2/noarch config file : C:\Users\kfranz\.condarc offline mode : False user-agent : conda/4.3.18.post13+e7b1a6bf requests/2.12.4 CPython/3.6.1 Windows/10 Windows/10.0.14393 administrator : unknown `$ c:\msys64\home\kfranz\continuum\conda\conda\__main__.py create -n qtcrΞator qt=5.6.2 python=3.6` Traceback (most recent call last): File "c:\msys64\home\kfranz\continuum\conda\conda\exceptions.py", line 632, in conda_exception_handler return_value = func(*args, **kwargs) File "c:\msys64\home\kfranz\continuum\conda\conda\cli\main.py", line 134, in _main exit_code = args.func(args, p) File "c:\msys64\home\kfranz\continuum\conda\conda\cli\main_create.py", line 68, in execute install(args, parser, 'create') File "c:\msys64\home\kfranz\continuum\conda\conda\cli\install.py", line 357, in install execute_actions(actions, index, verbose=not context.quiet) File "c:\msys64\home\kfranz\continuum\conda\conda\plan.py", line 830, in execute_actions execute_instructions(plan, index, verbose) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 75, in __exit__ self.update('exit') File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 104, in update self.write_changes(last, curr) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 263, in write_changes write_head(fo) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 27, in write_head fo.write("# cmd: %s\n" % (' '.join(sys.argv))) File "C:\conda-root\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u039e' in position 77: character maps to <undefined>
UnicodeEncodeError
def main(): from ..base.constants import ROOT_ENV_NAME sys_argv = tuple(ensure_text_type(s) for s in sys.argv) if "-h" in sys_argv or "--help" in sys_argv: # all execution paths sys.exit at end. help(sys_argv[1], sys_argv[2]) if len(sys_argv) > 2: shell = sys_argv[2] else: shell = "" if regex.match("^..(?:de|)activate$", sys_argv[1]): arg_num = len(sys_argv) if arg_num != 4: num_expected = 2 if arg_num < 4: raise TooFewArgumentsError( num_expected, arg_num - num_expected, "{} expected exactly two arguments:\ shell and env name".format(sys_argv[1]), ) if arg_num > 4: raise TooManyArgumentsError( num_expected, arg_num - num_expected, sys_argv[2:], "{} expected exactly two arguments:\ shell and env name".format(sys_argv[1]), ) if sys_argv[1] == "..activate": print(get_activate_path(sys_argv[3], shell)) sys.exit(0) elif sys_argv[1] == "..deactivate.path": activation_path = get_activate_path(sys_argv[3], shell) if os.getenv("_CONDA_HOLD"): new_path = regex.sub( r"%s(:?)" % regex.escape(activation_path), r"CONDA_PATH_PLACEHOLDER\1", os.environ[str("PATH")], 1, ) else: new_path = regex.sub( r"%s(:?)" % regex.escape(activation_path), r"", os.environ[str("PATH")], 1, ) print(new_path) sys.exit(0) elif sys_argv[1] == "..checkenv": if len(sys_argv) < 4: raise ArgumentError( "Invalid arguments to checkenv. Need shell and env name/path" ) if len(sys_argv) > 4: raise ArgumentError("did not expect more than one argument.") if sys_argv[3].lower() == ROOT_ENV_NAME.lower(): # no need to check root env and try to install a symlink there sys.exit(0) # raise CondaSystemExit # this should throw an error and exit if the env or path can't be found. try: prefix = prefix_from_arg(sys_argv[3], shell) except ValueError as e: raise CondaValueError(text_type(e)) # Make sure an env always has the conda symlink try: from ..base.context import context from ..install import symlink_conda symlink_conda(prefix, context.root_prefix, shell) except (IOError, OSError) as e: if e.errno == errno.EPERM or e.errno == errno.EACCES: msg = ( "Cannot activate environment {0}.\n" "User does not have write access for conda symlinks.".format( sys_argv[2] ) ) raise CondaEnvironmentError(msg) raise sys.exit(0) # raise CondaSystemExit elif sys_argv[1] == "..changeps1": from ..base.context import context path = int(context.changeps1) else: # This means there is a bug in main.py raise CondaValueError("unexpected command") # This print is actually what sets the PATH or PROMPT variable. The shell # script gets this value, and finishes the job. print(path)
def main(): from ..base.constants import ROOT_ENV_NAME if "-h" in sys.argv or "--help" in sys.argv: # all execution paths sys.exit at end. help(sys.argv[1], sys.argv[2]) if len(sys.argv) > 2: shell = sys.argv[2] else: shell = "" if regex.match("^..(?:de|)activate$", sys.argv[1]): arg_num = len(sys.argv) if arg_num != 4: num_expected = 2 if arg_num < 4: raise TooFewArgumentsError( num_expected, arg_num - num_expected, "{} expected exactly two arguments:\ shell and env name".format(sys.argv[1]), ) if arg_num > 4: raise TooManyArgumentsError( num_expected, arg_num - num_expected, sys.argv[2:], "{} expected exactly two arguments:\ shell and env name".format(sys.argv[1]), ) if sys.argv[1] == "..activate": print(get_activate_path(sys.argv[3], shell)) sys.exit(0) elif sys.argv[1] == "..deactivate.path": activation_path = get_activate_path(sys.argv[3], shell) if os.getenv("_CONDA_HOLD"): new_path = regex.sub( r"%s(:?)" % regex.escape(activation_path), r"CONDA_PATH_PLACEHOLDER\1", os.environ[str("PATH")], 1, ) else: new_path = regex.sub( r"%s(:?)" % regex.escape(activation_path), r"", os.environ[str("PATH")], 1, ) print(new_path) sys.exit(0) elif sys.argv[1] == "..checkenv": if len(sys.argv) < 4: raise ArgumentError( "Invalid arguments to checkenv. Need shell and env name/path" ) if len(sys.argv) > 4: raise ArgumentError("did not expect more than one argument.") if sys.argv[3].lower() == ROOT_ENV_NAME.lower(): # no need to check root env and try to install a symlink there sys.exit(0) # raise CondaSystemExit # this should throw an error and exit if the env or path can't be found. try: prefix = prefix_from_arg(sys.argv[3], shell) except ValueError as e: raise CondaValueError(text_type(e)) # Make sure an env always has the conda symlink try: from ..base.context import context from ..install import symlink_conda symlink_conda(prefix, context.root_prefix, shell) except (IOError, OSError) as e: if e.errno == errno.EPERM or e.errno == errno.EACCES: msg = ( "Cannot activate environment {0}.\n" "User does not have write access for conda symlinks.".format( sys.argv[2] ) ) raise CondaEnvironmentError(msg) raise sys.exit(0) # raise CondaSystemExit elif sys.argv[1] == "..changeps1": from ..base.context import context path = int(context.changeps1) else: # This means there is a bug in main.py raise CondaValueError("unexpected command") # This print is actually what sets the PATH or PROMPT variable. The shell # script gets this value, and finishes the job. print(path)
https://github.com/conda/conda/issues/5329
(root) c:\msys64\home\kfranz\continuum\conda>python -m conda create -n qtcrΞator qt=5.6.2 python=3.6 Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment C:\conda-root\envs\qtcrΞator: The following NEW packages will be INSTALLED: icu: 57.1-vc14_0 [vc14] jpeg: 9b-vc14_0 [vc14] libpng: 1.6.27-vc14_0 [vc14] openssl: 1.0.2k-vc14_0 [vc14] pip: 9.0.1-py36_1 python: 3.6.1-2 qt: 5.6.2-vc14_3 [vc14] setuptools: 27.2.0-py36_1 vs2015_runtime: 14.0.25123-0 wheel: 0.29.0-py36_0 zlib: 1.2.8-vc14_3 [vc14] Proceed ([y]/n)? icu-57.1-vc14_ 100% |###############################| Time: 0:00:03 10.44 MB/s jpeg-9b-vc14_0 100% |###############################| Time: 0:00:00 19.74 MB/s python-3.6.1-2 100% |###############################| Time: 0:00:03 10.96 MB/s zlib-1.2.8-vc1 100% |###############################| Time: 0:00:00 0.00 B/s libpng-1.6.27- 100% |###############################| Time: 0:00:00 10.97 MB/s qt-5.6.2-vc14_ 100% |###############################| Time: 0:00:05 11.55 MB/s An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : win-64 conda version : 4.3.18.post13+e7b1a6bf conda is private : False conda-env version : 4.3.18.post13+e7b1a6bf conda-build version : not installed python version : 3.6.1.final.0 requests version : 2.12.4 root environment : C:\conda-root (writable) default environment : C:\conda-root envs directories : C:\conda-root\envs C:\Users\kfranz\AppData\Local\conda\conda\envs C:\Users\kfranz\.conda\envs package cache : C:\conda-root\pkgs C:\Users\kfranz\AppData\Local\conda\conda\pkgs channel URLs : https://repo.continuum.io/pkgs/free/win-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/win-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/win-64 https://repo.continuum.io/pkgs/pro/noarch https://repo.continuum.io/pkgs/msys2/win-64 https://repo.continuum.io/pkgs/msys2/noarch config file : C:\Users\kfranz\.condarc offline mode : False user-agent : conda/4.3.18.post13+e7b1a6bf requests/2.12.4 CPython/3.6.1 Windows/10 Windows/10.0.14393 administrator : unknown `$ c:\msys64\home\kfranz\continuum\conda\conda\__main__.py create -n qtcrΞator qt=5.6.2 python=3.6` Traceback (most recent call last): File "c:\msys64\home\kfranz\continuum\conda\conda\exceptions.py", line 632, in conda_exception_handler return_value = func(*args, **kwargs) File "c:\msys64\home\kfranz\continuum\conda\conda\cli\main.py", line 134, in _main exit_code = args.func(args, p) File "c:\msys64\home\kfranz\continuum\conda\conda\cli\main_create.py", line 68, in execute install(args, parser, 'create') File "c:\msys64\home\kfranz\continuum\conda\conda\cli\install.py", line 357, in install execute_actions(actions, index, verbose=not context.quiet) File "c:\msys64\home\kfranz\continuum\conda\conda\plan.py", line 830, in execute_actions execute_instructions(plan, index, verbose) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 75, in __exit__ self.update('exit') File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 104, in update self.write_changes(last, curr) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 263, in write_changes write_head(fo) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 27, in write_head fo.write("# cmd: %s\n" % (' '.join(sys.argv))) File "C:\conda-root\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u039e' in position 77: character maps to <undefined>
UnicodeEncodeError
def main(*args): if not args: args = sys.argv args = tuple(_ensure_text_type(s) for s in args) log.debug("conda.cli.main called with %s", args) if len(args) > 1: try: argv1 = args[1].strip() if argv1.startswith(".."): import conda.cli.activate as activate activate.main() return if argv1 in ("activate", "deactivate"): from ..exceptions import CommandNotFoundError raise CommandNotFoundError(argv1) except Exception as e: from ..exceptions import handle_exception return handle_exception(e) from ..exceptions import conda_exception_handler return conda_exception_handler(_main, *args)
def main(*args): if not args: args = sys.argv if not args: args = sys.argv log.debug("conda.cli.main called with %s", args) if len(args) > 1: try: argv1 = args[1].strip() if argv1.startswith(".."): import conda.cli.activate as activate activate.main() return if argv1 in ("activate", "deactivate"): from ..exceptions import CommandNotFoundError raise CommandNotFoundError(argv1) except Exception as e: from ..exceptions import handle_exception return handle_exception(e) from ..exceptions import conda_exception_handler return conda_exception_handler(_main, *args)
https://github.com/conda/conda/issues/5329
(root) c:\msys64\home\kfranz\continuum\conda>python -m conda create -n qtcrΞator qt=5.6.2 python=3.6 Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment C:\conda-root\envs\qtcrΞator: The following NEW packages will be INSTALLED: icu: 57.1-vc14_0 [vc14] jpeg: 9b-vc14_0 [vc14] libpng: 1.6.27-vc14_0 [vc14] openssl: 1.0.2k-vc14_0 [vc14] pip: 9.0.1-py36_1 python: 3.6.1-2 qt: 5.6.2-vc14_3 [vc14] setuptools: 27.2.0-py36_1 vs2015_runtime: 14.0.25123-0 wheel: 0.29.0-py36_0 zlib: 1.2.8-vc14_3 [vc14] Proceed ([y]/n)? icu-57.1-vc14_ 100% |###############################| Time: 0:00:03 10.44 MB/s jpeg-9b-vc14_0 100% |###############################| Time: 0:00:00 19.74 MB/s python-3.6.1-2 100% |###############################| Time: 0:00:03 10.96 MB/s zlib-1.2.8-vc1 100% |###############################| Time: 0:00:00 0.00 B/s libpng-1.6.27- 100% |###############################| Time: 0:00:00 10.97 MB/s qt-5.6.2-vc14_ 100% |###############################| Time: 0:00:05 11.55 MB/s An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : win-64 conda version : 4.3.18.post13+e7b1a6bf conda is private : False conda-env version : 4.3.18.post13+e7b1a6bf conda-build version : not installed python version : 3.6.1.final.0 requests version : 2.12.4 root environment : C:\conda-root (writable) default environment : C:\conda-root envs directories : C:\conda-root\envs C:\Users\kfranz\AppData\Local\conda\conda\envs C:\Users\kfranz\.conda\envs package cache : C:\conda-root\pkgs C:\Users\kfranz\AppData\Local\conda\conda\pkgs channel URLs : https://repo.continuum.io/pkgs/free/win-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/win-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/win-64 https://repo.continuum.io/pkgs/pro/noarch https://repo.continuum.io/pkgs/msys2/win-64 https://repo.continuum.io/pkgs/msys2/noarch config file : C:\Users\kfranz\.condarc offline mode : False user-agent : conda/4.3.18.post13+e7b1a6bf requests/2.12.4 CPython/3.6.1 Windows/10 Windows/10.0.14393 administrator : unknown `$ c:\msys64\home\kfranz\continuum\conda\conda\__main__.py create -n qtcrΞator qt=5.6.2 python=3.6` Traceback (most recent call last): File "c:\msys64\home\kfranz\continuum\conda\conda\exceptions.py", line 632, in conda_exception_handler return_value = func(*args, **kwargs) File "c:\msys64\home\kfranz\continuum\conda\conda\cli\main.py", line 134, in _main exit_code = args.func(args, p) File "c:\msys64\home\kfranz\continuum\conda\conda\cli\main_create.py", line 68, in execute install(args, parser, 'create') File "c:\msys64\home\kfranz\continuum\conda\conda\cli\install.py", line 357, in install execute_actions(actions, index, verbose=not context.quiet) File "c:\msys64\home\kfranz\continuum\conda\conda\plan.py", line 830, in execute_actions execute_instructions(plan, index, verbose) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 75, in __exit__ self.update('exit') File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 104, in update self.write_changes(last, curr) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 263, in write_changes write_head(fo) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 27, in write_head fo.write("# cmd: %s\n" % (' '.join(sys.argv))) File "C:\conda-root\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u039e' in position 77: character maps to <undefined>
UnicodeEncodeError
def __init__(self, message, **kwargs): command = " ".join(ensure_text_type(s) for s in sys.argv) super(CommandArgumentError, self).__init__(message, command=command, **kwargs)
def __init__(self, message, **kwargs): command = " ".join(sys.argv) super(CommandArgumentError, self).__init__(message, command=command, **kwargs)
https://github.com/conda/conda/issues/5329
(root) c:\msys64\home\kfranz\continuum\conda>python -m conda create -n qtcrΞator qt=5.6.2 python=3.6 Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment C:\conda-root\envs\qtcrΞator: The following NEW packages will be INSTALLED: icu: 57.1-vc14_0 [vc14] jpeg: 9b-vc14_0 [vc14] libpng: 1.6.27-vc14_0 [vc14] openssl: 1.0.2k-vc14_0 [vc14] pip: 9.0.1-py36_1 python: 3.6.1-2 qt: 5.6.2-vc14_3 [vc14] setuptools: 27.2.0-py36_1 vs2015_runtime: 14.0.25123-0 wheel: 0.29.0-py36_0 zlib: 1.2.8-vc14_3 [vc14] Proceed ([y]/n)? icu-57.1-vc14_ 100% |###############################| Time: 0:00:03 10.44 MB/s jpeg-9b-vc14_0 100% |###############################| Time: 0:00:00 19.74 MB/s python-3.6.1-2 100% |###############################| Time: 0:00:03 10.96 MB/s zlib-1.2.8-vc1 100% |###############################| Time: 0:00:00 0.00 B/s libpng-1.6.27- 100% |###############################| Time: 0:00:00 10.97 MB/s qt-5.6.2-vc14_ 100% |###############################| Time: 0:00:05 11.55 MB/s An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : win-64 conda version : 4.3.18.post13+e7b1a6bf conda is private : False conda-env version : 4.3.18.post13+e7b1a6bf conda-build version : not installed python version : 3.6.1.final.0 requests version : 2.12.4 root environment : C:\conda-root (writable) default environment : C:\conda-root envs directories : C:\conda-root\envs C:\Users\kfranz\AppData\Local\conda\conda\envs C:\Users\kfranz\.conda\envs package cache : C:\conda-root\pkgs C:\Users\kfranz\AppData\Local\conda\conda\pkgs channel URLs : https://repo.continuum.io/pkgs/free/win-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/win-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/win-64 https://repo.continuum.io/pkgs/pro/noarch https://repo.continuum.io/pkgs/msys2/win-64 https://repo.continuum.io/pkgs/msys2/noarch config file : C:\Users\kfranz\.condarc offline mode : False user-agent : conda/4.3.18.post13+e7b1a6bf requests/2.12.4 CPython/3.6.1 Windows/10 Windows/10.0.14393 administrator : unknown `$ c:\msys64\home\kfranz\continuum\conda\conda\__main__.py create -n qtcrΞator qt=5.6.2 python=3.6` Traceback (most recent call last): File "c:\msys64\home\kfranz\continuum\conda\conda\exceptions.py", line 632, in conda_exception_handler return_value = func(*args, **kwargs) File "c:\msys64\home\kfranz\continuum\conda\conda\cli\main.py", line 134, in _main exit_code = args.func(args, p) File "c:\msys64\home\kfranz\continuum\conda\conda\cli\main_create.py", line 68, in execute install(args, parser, 'create') File "c:\msys64\home\kfranz\continuum\conda\conda\cli\install.py", line 357, in install execute_actions(actions, index, verbose=not context.quiet) File "c:\msys64\home\kfranz\continuum\conda\conda\plan.py", line 830, in execute_actions execute_instructions(plan, index, verbose) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 75, in __exit__ self.update('exit') File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 104, in update self.write_changes(last, curr) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 263, in write_changes write_head(fo) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 27, in write_head fo.write("# cmd: %s\n" % (' '.join(sys.argv))) File "C:\conda-root\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u039e' in position 77: character maps to <undefined>
UnicodeEncodeError
def print_unexpected_error_message(e): # bomb = "\U0001F4A3 " # explosion = "\U0001F4A5 " # fire = "\U0001F525 " # print("%s %s %s" % (3*bomb, 3*explosion, 3*fire)) traceback = format_exc() stderrlogger = getLogger("stderr") from .base.context import context if context.json: from .cli.common import stdout_json stdout_json(dict(error=traceback)) else: message = """\ An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues """ stderrlogger.info(message) command = " ".join(ensure_text_type(s) for s in sys.argv) if " info" not in command: from .cli.main_info import get_info_dict, get_main_info_str stderrlogger.info(get_main_info_str(get_info_dict())) stderrlogger.info("`$ {0}`".format(command)) stderrlogger.info("\n") stderrlogger.info("\n".join(" " + line for line in traceback.splitlines()))
def print_unexpected_error_message(e): # bomb = "\U0001F4A3 " # explosion = "\U0001F4A5 " # fire = "\U0001F525 " # print("%s %s %s" % (3*bomb, 3*explosion, 3*fire)) traceback = format_exc() stderrlogger = getLogger("stderr") from .base.context import context if context.json: from .cli.common import stdout_json stdout_json(dict(error=traceback)) else: message = """\ An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues """ stderrlogger.info(message) command = " ".join(sys.argv) if " info" not in command: from .cli.main_info import get_info_dict, get_main_info_str stderrlogger.info(get_main_info_str(get_info_dict())) stderrlogger.info("`$ {0}`".format(command)) stderrlogger.info("\n") stderrlogger.info("\n".join(" " + line for line in traceback.splitlines()))
https://github.com/conda/conda/issues/5329
(root) c:\msys64\home\kfranz\continuum\conda>python -m conda create -n qtcrΞator qt=5.6.2 python=3.6 Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment C:\conda-root\envs\qtcrΞator: The following NEW packages will be INSTALLED: icu: 57.1-vc14_0 [vc14] jpeg: 9b-vc14_0 [vc14] libpng: 1.6.27-vc14_0 [vc14] openssl: 1.0.2k-vc14_0 [vc14] pip: 9.0.1-py36_1 python: 3.6.1-2 qt: 5.6.2-vc14_3 [vc14] setuptools: 27.2.0-py36_1 vs2015_runtime: 14.0.25123-0 wheel: 0.29.0-py36_0 zlib: 1.2.8-vc14_3 [vc14] Proceed ([y]/n)? icu-57.1-vc14_ 100% |###############################| Time: 0:00:03 10.44 MB/s jpeg-9b-vc14_0 100% |###############################| Time: 0:00:00 19.74 MB/s python-3.6.1-2 100% |###############################| Time: 0:00:03 10.96 MB/s zlib-1.2.8-vc1 100% |###############################| Time: 0:00:00 0.00 B/s libpng-1.6.27- 100% |###############################| Time: 0:00:00 10.97 MB/s qt-5.6.2-vc14_ 100% |###############################| Time: 0:00:05 11.55 MB/s An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : win-64 conda version : 4.3.18.post13+e7b1a6bf conda is private : False conda-env version : 4.3.18.post13+e7b1a6bf conda-build version : not installed python version : 3.6.1.final.0 requests version : 2.12.4 root environment : C:\conda-root (writable) default environment : C:\conda-root envs directories : C:\conda-root\envs C:\Users\kfranz\AppData\Local\conda\conda\envs C:\Users\kfranz\.conda\envs package cache : C:\conda-root\pkgs C:\Users\kfranz\AppData\Local\conda\conda\pkgs channel URLs : https://repo.continuum.io/pkgs/free/win-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/win-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/win-64 https://repo.continuum.io/pkgs/pro/noarch https://repo.continuum.io/pkgs/msys2/win-64 https://repo.continuum.io/pkgs/msys2/noarch config file : C:\Users\kfranz\.condarc offline mode : False user-agent : conda/4.3.18.post13+e7b1a6bf requests/2.12.4 CPython/3.6.1 Windows/10 Windows/10.0.14393 administrator : unknown `$ c:\msys64\home\kfranz\continuum\conda\conda\__main__.py create -n qtcrΞator qt=5.6.2 python=3.6` Traceback (most recent call last): File "c:\msys64\home\kfranz\continuum\conda\conda\exceptions.py", line 632, in conda_exception_handler return_value = func(*args, **kwargs) File "c:\msys64\home\kfranz\continuum\conda\conda\cli\main.py", line 134, in _main exit_code = args.func(args, p) File "c:\msys64\home\kfranz\continuum\conda\conda\cli\main_create.py", line 68, in execute install(args, parser, 'create') File "c:\msys64\home\kfranz\continuum\conda\conda\cli\install.py", line 357, in install execute_actions(actions, index, verbose=not context.quiet) File "c:\msys64\home\kfranz\continuum\conda\conda\plan.py", line 830, in execute_actions execute_instructions(plan, index, verbose) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 75, in __exit__ self.update('exit') File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 104, in update self.write_changes(last, curr) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 263, in write_changes write_head(fo) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 27, in write_head fo.write("# cmd: %s\n" % (' '.join(sys.argv))) File "C:\conda-root\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u039e' in position 77: character maps to <undefined>
UnicodeEncodeError
def write_head(fo): fo.write("==> %s <==\n" % time.strftime("%Y-%m-%d %H:%M:%S")) fo.write("# cmd: %s\n" % (" ".join(ensure_text_type(s) for s in sys.argv)))
def write_head(fo): fo.write("==> %s <==\n" % time.strftime("%Y-%m-%d %H:%M:%S")) fo.write("# cmd: %s\n" % (" ".join(sys.argv)))
https://github.com/conda/conda/issues/5329
(root) c:\msys64\home\kfranz\continuum\conda>python -m conda create -n qtcrΞator qt=5.6.2 python=3.6 Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment C:\conda-root\envs\qtcrΞator: The following NEW packages will be INSTALLED: icu: 57.1-vc14_0 [vc14] jpeg: 9b-vc14_0 [vc14] libpng: 1.6.27-vc14_0 [vc14] openssl: 1.0.2k-vc14_0 [vc14] pip: 9.0.1-py36_1 python: 3.6.1-2 qt: 5.6.2-vc14_3 [vc14] setuptools: 27.2.0-py36_1 vs2015_runtime: 14.0.25123-0 wheel: 0.29.0-py36_0 zlib: 1.2.8-vc14_3 [vc14] Proceed ([y]/n)? icu-57.1-vc14_ 100% |###############################| Time: 0:00:03 10.44 MB/s jpeg-9b-vc14_0 100% |###############################| Time: 0:00:00 19.74 MB/s python-3.6.1-2 100% |###############################| Time: 0:00:03 10.96 MB/s zlib-1.2.8-vc1 100% |###############################| Time: 0:00:00 0.00 B/s libpng-1.6.27- 100% |###############################| Time: 0:00:00 10.97 MB/s qt-5.6.2-vc14_ 100% |###############################| Time: 0:00:05 11.55 MB/s An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : win-64 conda version : 4.3.18.post13+e7b1a6bf conda is private : False conda-env version : 4.3.18.post13+e7b1a6bf conda-build version : not installed python version : 3.6.1.final.0 requests version : 2.12.4 root environment : C:\conda-root (writable) default environment : C:\conda-root envs directories : C:\conda-root\envs C:\Users\kfranz\AppData\Local\conda\conda\envs C:\Users\kfranz\.conda\envs package cache : C:\conda-root\pkgs C:\Users\kfranz\AppData\Local\conda\conda\pkgs channel URLs : https://repo.continuum.io/pkgs/free/win-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/win-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/win-64 https://repo.continuum.io/pkgs/pro/noarch https://repo.continuum.io/pkgs/msys2/win-64 https://repo.continuum.io/pkgs/msys2/noarch config file : C:\Users\kfranz\.condarc offline mode : False user-agent : conda/4.3.18.post13+e7b1a6bf requests/2.12.4 CPython/3.6.1 Windows/10 Windows/10.0.14393 administrator : unknown `$ c:\msys64\home\kfranz\continuum\conda\conda\__main__.py create -n qtcrΞator qt=5.6.2 python=3.6` Traceback (most recent call last): File "c:\msys64\home\kfranz\continuum\conda\conda\exceptions.py", line 632, in conda_exception_handler return_value = func(*args, **kwargs) File "c:\msys64\home\kfranz\continuum\conda\conda\cli\main.py", line 134, in _main exit_code = args.func(args, p) File "c:\msys64\home\kfranz\continuum\conda\conda\cli\main_create.py", line 68, in execute install(args, parser, 'create') File "c:\msys64\home\kfranz\continuum\conda\conda\cli\install.py", line 357, in install execute_actions(actions, index, verbose=not context.quiet) File "c:\msys64\home\kfranz\continuum\conda\conda\plan.py", line 830, in execute_actions execute_instructions(plan, index, verbose) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 75, in __exit__ self.update('exit') File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 104, in update self.write_changes(last, curr) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 263, in write_changes write_head(fo) File "c:\msys64\home\kfranz\continuum\conda\conda\history.py", line 27, in write_head fo.write("# cmd: %s\n" % (' '.join(sys.argv))) File "C:\conda-root\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u039e' in position 77: character maps to <undefined>
UnicodeEncodeError
def build_message(specs): binstar_spec = next((spec for spec in specs if isinstance(spec, BinstarSpec)), None) if binstar_spec: return binstar_spec.msg else: return "\n".join([s.msg for s in specs if s.msg is not None])
def build_message(specs): return "\n".join([s.msg for s in specs if s.msg is not None])
https://github.com/conda/conda/issues/3689
Windows PowerShell Copyright (C) 2009 Microsoft Corporation. All rights reserved. PS C:\Users\tsnyder> which conda C:\Users\tsnyder\Miniconda3\Scripts\conda.EXE PS C:\Users\tsnyder> conda list # packages in environment at C:\Users\tsnyder\Miniconda3: # conda 4.1.11 py35_0 conda-env 2.5.2 py35_0 console_shortcut 0.1.1 py35_1 menuinst 1.4.1 py35_0 pip 8.1.2 py35_0 pycosat 0.6.1 py35_1 pycrypto 2.6.1 py35_4 python 3.5.2 0 pyyaml 3.11 py35_4 requests 2.10.0 py35_0 ruamel_yaml 0.11.14 py35_0 setuptools 23.0.0 py35_0 vs2015_runtime 14.0.25123 0 wheel 0.29.0 py35_0 PS C:\Users\tsnyder> conda update --all Fetching package metadata ......... Solving package specifications: .......... Package plan for installation in environment C:\Users\tsnyder\Miniconda3: The following packages will be downloaded: package | build ---------------------------|----------------- conda-env-2.6.0 | 0 498 B menuinst-1.4.2 | py35_0 107 KB pyyaml-3.12 | py35_0 118 KB requests-2.11.1 | py35_0 665 KB setuptools-27.2.0 | py35_1 761 KB conda-4.2.9 | py35_0 428 KB ------------------------------------------------------------ Total: 2.0 MB The following packages will be UPDATED: conda: 4.1.11-py35_0 --> 4.2.9-py35_0 conda-env: 2.5.2-py35_0 --> 2.6.0-0 menuinst: 1.4.1-py35_0 --> 1.4.2-py35_0 pyyaml: 3.11-py35_4 --> 3.12-py35_0 requests: 2.10.0-py35_0 --> 2.11.1-py35_0 setuptools: 23.0.0-py35_0 --> 27.2.0-py35_1 Proceed ([y]/n)? menuinst-1.4.2 100% |###############################| Time: 0:00:00 456.48 kB/s Fetching packages ... conda-env-2.6. 100% |###############################| Time: 0:00:00 71.13 kB/s pyyaml-3.12-py 100% |###############################| Time: 0:00:00 541.10 kB/s requests-2.11. 100% |###############################| Time: 0:00:00 885.09 kB/s setuptools-27. 100% |###############################| Time: 0:00:00 976.23 kB/s conda-4.2.9-py 100% |###############################| Time: 0:00:00 875.95 kB/s Extracting packages ... [ COMPLETE ]|##################################################| 100% Unlinking packages ... [ COMPLETE ]|##################################################| 100% Linking packages ... [ COMPLETE ]|##################################################| 100% PS C:\Users\tsnyder> conda env create -h usage: conda-env-script.py create [-h] [-f FILE] [-n ENVIRONMENT | -p PATH] [-q] [--force] [--json] [--debug] [--verbose] [remote_definition] Create an environment based on an environment file Options: positional arguments: remote_definition remote environment definition / IPython notebook optional arguments: -h, --help Show this help message and exit. -f FILE, --file FILE environment definition file (default: environment.yml) -n ENVIRONMENT, --name ENVIRONMENT Name of environment (in C:\Users\tsnyder\Miniconda3\envs). -p PATH, --prefix PATH Full path to environment prefix (default: C:\Users\tsnyder\Miniconda3). -q, --quiet --force force creation of environment (removing a previously existing environment of the same name). --json Report all output as json. Suitable for using conda programmatically. --debug Show debug output. --verbose, -v Use once for info, twice for debug. examples: conda env create conda env create -n name conda env create vader/deathstar conda env create -f=/path/to/environment.yml conda env create -f=/path/to/requirements.txt -n deathstar conda env create -f=/path/to/requirements.txt -p /home/user/software/deathstar PS C:\Users\tsnyder> conda env create tsnyder/python_training_2016_10 An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : win-64 conda version : 4.2.9 conda is private : False conda-env version : 4.2.9 conda-build version : not installed python version : 3.5.2.final.0 requests version : 2.11.1 root environment : C:\Users\tsnyder\Miniconda3 (writable) default environment : C:\Users\tsnyder\Miniconda3 envs directories : C:\Users\tsnyder\Miniconda3\envs package cache : C:\Users\tsnyder\Miniconda3\pkgs channel URLs : https://repo.continuum.io/pkgs/free/win-64/ https://repo.continuum.io/pkgs/free/noarch/ https://repo.continuum.io/pkgs/pro/win-64/ https://repo.continuum.io/pkgs/pro/noarch/ https://repo.continuum.io/pkgs/msys2/win-64/ https://repo.continuum.io/pkgs/msys2/noarch/ config file : None offline mode : False `$ C:\Users\tsnyder\Miniconda3\Scripts\conda-env-script.py create tsnyder/python_training_2016_10` Traceback (most recent call last): File "C:\Users\tsnyder\Miniconda3\lib\site-packages\conda\exceptions.py", line 473, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Users\tsnyder\Miniconda3\lib\site-packages\conda_env\cli\main_create.py", line 81, in execute directory=os.getcwd()) File "C:\Users\tsnyder\Miniconda3\lib\site-packages\conda_env\specs\__init__.py", line 23, in detect raise SpecNotFound(build_message(specs)) conda_env.exceptions.SpecNotFound: Runtime error: Please install binstar Please install nbformat: conda install nbformat Conda Env Exception: environment.yml file not found There is no requirements.txt
conda_env.exceptions.SpecNotFound
def can_handle(self): """ Validates loader can process environment definition. :return: True or False """ # TODO: log information about trying to find the package in binstar.org if self.valid_name(): if self.binstar is None: self.msg = ( "Anaconda Client is required to interact with anaconda.org or an " "Anaconda API. Please run `conda install anaconda-client`." ) return False return self.package is not None and self.valid_package() return False
def can_handle(self): """ Validates loader can process environment definition. :return: True or False """ # TODO: log information about trying to find the package in binstar.org if self.valid_name(): if self.binstar is None: self.msg = "Please install binstar" return False return self.package is not None and self.valid_package() return False
https://github.com/conda/conda/issues/3689
Windows PowerShell Copyright (C) 2009 Microsoft Corporation. All rights reserved. PS C:\Users\tsnyder> which conda C:\Users\tsnyder\Miniconda3\Scripts\conda.EXE PS C:\Users\tsnyder> conda list # packages in environment at C:\Users\tsnyder\Miniconda3: # conda 4.1.11 py35_0 conda-env 2.5.2 py35_0 console_shortcut 0.1.1 py35_1 menuinst 1.4.1 py35_0 pip 8.1.2 py35_0 pycosat 0.6.1 py35_1 pycrypto 2.6.1 py35_4 python 3.5.2 0 pyyaml 3.11 py35_4 requests 2.10.0 py35_0 ruamel_yaml 0.11.14 py35_0 setuptools 23.0.0 py35_0 vs2015_runtime 14.0.25123 0 wheel 0.29.0 py35_0 PS C:\Users\tsnyder> conda update --all Fetching package metadata ......... Solving package specifications: .......... Package plan for installation in environment C:\Users\tsnyder\Miniconda3: The following packages will be downloaded: package | build ---------------------------|----------------- conda-env-2.6.0 | 0 498 B menuinst-1.4.2 | py35_0 107 KB pyyaml-3.12 | py35_0 118 KB requests-2.11.1 | py35_0 665 KB setuptools-27.2.0 | py35_1 761 KB conda-4.2.9 | py35_0 428 KB ------------------------------------------------------------ Total: 2.0 MB The following packages will be UPDATED: conda: 4.1.11-py35_0 --> 4.2.9-py35_0 conda-env: 2.5.2-py35_0 --> 2.6.0-0 menuinst: 1.4.1-py35_0 --> 1.4.2-py35_0 pyyaml: 3.11-py35_4 --> 3.12-py35_0 requests: 2.10.0-py35_0 --> 2.11.1-py35_0 setuptools: 23.0.0-py35_0 --> 27.2.0-py35_1 Proceed ([y]/n)? menuinst-1.4.2 100% |###############################| Time: 0:00:00 456.48 kB/s Fetching packages ... conda-env-2.6. 100% |###############################| Time: 0:00:00 71.13 kB/s pyyaml-3.12-py 100% |###############################| Time: 0:00:00 541.10 kB/s requests-2.11. 100% |###############################| Time: 0:00:00 885.09 kB/s setuptools-27. 100% |###############################| Time: 0:00:00 976.23 kB/s conda-4.2.9-py 100% |###############################| Time: 0:00:00 875.95 kB/s Extracting packages ... [ COMPLETE ]|##################################################| 100% Unlinking packages ... [ COMPLETE ]|##################################################| 100% Linking packages ... [ COMPLETE ]|##################################################| 100% PS C:\Users\tsnyder> conda env create -h usage: conda-env-script.py create [-h] [-f FILE] [-n ENVIRONMENT | -p PATH] [-q] [--force] [--json] [--debug] [--verbose] [remote_definition] Create an environment based on an environment file Options: positional arguments: remote_definition remote environment definition / IPython notebook optional arguments: -h, --help Show this help message and exit. -f FILE, --file FILE environment definition file (default: environment.yml) -n ENVIRONMENT, --name ENVIRONMENT Name of environment (in C:\Users\tsnyder\Miniconda3\envs). -p PATH, --prefix PATH Full path to environment prefix (default: C:\Users\tsnyder\Miniconda3). -q, --quiet --force force creation of environment (removing a previously existing environment of the same name). --json Report all output as json. Suitable for using conda programmatically. --debug Show debug output. --verbose, -v Use once for info, twice for debug. examples: conda env create conda env create -n name conda env create vader/deathstar conda env create -f=/path/to/environment.yml conda env create -f=/path/to/requirements.txt -n deathstar conda env create -f=/path/to/requirements.txt -p /home/user/software/deathstar PS C:\Users\tsnyder> conda env create tsnyder/python_training_2016_10 An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : win-64 conda version : 4.2.9 conda is private : False conda-env version : 4.2.9 conda-build version : not installed python version : 3.5.2.final.0 requests version : 2.11.1 root environment : C:\Users\tsnyder\Miniconda3 (writable) default environment : C:\Users\tsnyder\Miniconda3 envs directories : C:\Users\tsnyder\Miniconda3\envs package cache : C:\Users\tsnyder\Miniconda3\pkgs channel URLs : https://repo.continuum.io/pkgs/free/win-64/ https://repo.continuum.io/pkgs/free/noarch/ https://repo.continuum.io/pkgs/pro/win-64/ https://repo.continuum.io/pkgs/pro/noarch/ https://repo.continuum.io/pkgs/msys2/win-64/ https://repo.continuum.io/pkgs/msys2/noarch/ config file : None offline mode : False `$ C:\Users\tsnyder\Miniconda3\Scripts\conda-env-script.py create tsnyder/python_training_2016_10` Traceback (most recent call last): File "C:\Users\tsnyder\Miniconda3\lib\site-packages\conda\exceptions.py", line 473, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Users\tsnyder\Miniconda3\lib\site-packages\conda_env\cli\main_create.py", line 81, in execute directory=os.getcwd()) File "C:\Users\tsnyder\Miniconda3\lib\site-packages\conda_env\specs\__init__.py", line 23, in detect raise SpecNotFound(build_message(specs)) conda_env.exceptions.SpecNotFound: Runtime error: Please install binstar Please install nbformat: conda install nbformat Conda Env Exception: environment.yml file not found There is no requirements.txt
conda_env.exceptions.SpecNotFound
def execute(args, parser): from ..base.context import context from .common import stdout_json prefix = context.prefix_w_legacy_search regex = args.regex if args.full_name: regex = r"^%s$" % regex if args.revisions: from ..history import History h = History(prefix) if isfile(h.path): if not context.json: h.print_log() else: stdout_json(h.object_log()) else: from ..exceptions import FileNotFoundError raise FileNotFoundError(h.path) return if args.explicit: print_explicit(prefix, args.md5) return if args.canonical: format = "canonical" elif args.export: format = "export" else: format = "human" if context.json: format = "canonical" exitcode = print_packages( prefix, regex, format, piplist=args.pip, json=context.json, show_channel_urls=context.show_channel_urls, ) return exitcode
def execute(args, parser): from ..base.context import context from .common import stdout_json prefix = context.prefix_w_legacy_search regex = args.regex if args.full_name: regex = r"^%s$" % regex if args.revisions: from ..history import History h = History(prefix) if isfile(h.path): if not context.json: h.print_log() else: stdout_json(h.object_log()) else: from ..exceptions import CondaFileNotFoundError raise CondaFileNotFoundError(h.path) return if args.explicit: print_explicit(prefix, args.md5) return if args.canonical: format = "canonical" elif args.export: format = "export" else: format = "human" if context.json: format = "canonical" exitcode = print_packages( prefix, regex, format, piplist=args.pip, json=context.json, show_channel_urls=context.show_channel_urls, ) return exitcode
https://github.com/conda/conda/issues/4968
Traceback (most recent call last): File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 502, in _execute_action action.execute() File "/conda/lib/python3.6/site-packages/conda/core/path_actions.py", line 739, in execute source_md5sum = compute_md5sum(source_path) File "/conda/lib/python3.6/site-packages/conda/gateways/disk/read.py", line 59, in compute_md5sum raise CondaFileNotFoundError(file_full_path) conda.exceptions.CondaFileNotFoundError: <unprintable CondaFileNotFoundError object> During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/conda/lib/python3.6/site-packages/conda/exceptions.py", line 592, in conda_exception_handler return_value = func(*args, **kwargs) File "/conda/lib/python3.6/site-packages/conda/cli/main.py", line 134, in _main exit_code = args.func(args, p) File "/conda/lib/python3.6/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/conda/lib/python3.6/site-packages/conda/cli/install.py", line 200, in install explicit(args.packages, prefix, verbose=not context.quiet) File "/conda/lib/python3.6/site-packages/conda/misc.py", line 90, in explicit pfe.execute() File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 491, in execute self._execute_action(action) File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 507, in _execute_action exceptions.append(CondaError(repr(e))) File "/conda/lib/python3.6/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s\n' % (self.__class__.__name__, text_type(self)) File "/conda/lib/python3.6/site-packages/conda/__init__.py", line 48, in __str__ return text_type(self.message % self._kwargs) TypeError: must be real number, not dict
conda.exceptions.CondaFileNotFoundError
def compute_md5sum(file_full_path): if not isfile(file_full_path): raise FileNotFoundError(file_full_path) hash_md5 = hashlib.md5() with open(file_full_path, "rb") as fh: for chunk in iter(partial(fh.read, 8192), b""): hash_md5.update(chunk) return hash_md5.hexdigest()
def compute_md5sum(file_full_path): if not isfile(file_full_path): raise CondaFileNotFoundError(file_full_path) hash_md5 = hashlib.md5() with open(file_full_path, "rb") as fh: for chunk in iter(partial(fh.read, 8192), b""): hash_md5.update(chunk) return hash_md5.hexdigest()
https://github.com/conda/conda/issues/4968
Traceback (most recent call last): File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 502, in _execute_action action.execute() File "/conda/lib/python3.6/site-packages/conda/core/path_actions.py", line 739, in execute source_md5sum = compute_md5sum(source_path) File "/conda/lib/python3.6/site-packages/conda/gateways/disk/read.py", line 59, in compute_md5sum raise CondaFileNotFoundError(file_full_path) conda.exceptions.CondaFileNotFoundError: <unprintable CondaFileNotFoundError object> During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/conda/lib/python3.6/site-packages/conda/exceptions.py", line 592, in conda_exception_handler return_value = func(*args, **kwargs) File "/conda/lib/python3.6/site-packages/conda/cli/main.py", line 134, in _main exit_code = args.func(args, p) File "/conda/lib/python3.6/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/conda/lib/python3.6/site-packages/conda/cli/install.py", line 200, in install explicit(args.packages, prefix, verbose=not context.quiet) File "/conda/lib/python3.6/site-packages/conda/misc.py", line 90, in explicit pfe.execute() File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 491, in execute self._execute_action(action) File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 507, in _execute_action exceptions.append(CondaError(repr(e))) File "/conda/lib/python3.6/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s\n' % (self.__class__.__name__, text_type(self)) File "/conda/lib/python3.6/site-packages/conda/__init__.py", line 48, in __str__ return text_type(self.message % self._kwargs) TypeError: must be real number, not dict
conda.exceptions.CondaFileNotFoundError
def explicit( specs, prefix, verbose=False, force_extract=True, index_args=None, index=None ): actions = defaultdict(list) actions["PREFIX"] = prefix fetch_recs = {} for spec in specs: if spec == "@EXPLICIT": continue if not is_url(spec): spec = unquote(path_to_url(expand(spec))) # parse URL m = url_pat.match(spec) if m is None: raise ParseError("Could not parse explicit URL: %s" % spec) url_p, fn, md5sum = m.group("url_p"), m.group("fn"), m.group("md5") url = join_url(url_p, fn) # url_p is everything but the tarball_basename and the md5sum # If the path points to a file in the package cache, we need to use # the dist name that corresponds to that package. The MD5 may not # match, but we will let PFE below worry about that dist = None if url.startswith("file:/"): path = win_path_ok(url_to_path(url)) if dirname(path) in context.pkgs_dirs: if not exists(path): raise FileNotFoundError(path) pc_entry = PackageCache.tarball_file_in_cache(path) dist = pc_entry.dist url = dist.to_url() or pc_entry.get_urls_txt_value() md5sum = md5sum or pc_entry.md5sum dist = dist or Dist(url) fetch_recs[dist] = {"md5": md5sum, "url": url} # perform any necessary fetches and extractions if verbose: from .console import setup_verbose_handlers setup_verbose_handlers() link_dists = tuple(iterkeys(fetch_recs)) pfe = ProgressiveFetchExtract(fetch_recs, link_dists) pfe.execute() # dists could have been updated with more accurate urls # TODO: I'm stuck here # Now get the index---but the only index we need is the package cache index = {} _supplement_index_with_cache(index, ()) # unlink any installed packages with same package name link_names = {index[d]["name"] for d in link_dists} actions[UNLINK].extend( d for d, r in iteritems(linked_data(prefix)) if r["name"] in link_names ) # need to get the install order right, especially to install python in the prefix # before python noarch packages r = Resolve(index) actions[LINK].extend(link_dists) actions[LINK] = r.dependency_sort( {r.package_name(dist): dist for dist in actions[LINK]} ) actions["ACTION"] = "EXPLICIT" execute_actions(actions, index, verbose=verbose) return actions
def explicit( specs, prefix, verbose=False, force_extract=True, index_args=None, index=None ): actions = defaultdict(list) actions["PREFIX"] = prefix fetch_recs = {} for spec in specs: if spec == "@EXPLICIT": continue if not is_url(spec): spec = unquote(path_to_url(expand(spec))) # parse URL m = url_pat.match(spec) if m is None: raise ParseError("Could not parse explicit URL: %s" % spec) url_p, fn, md5sum = m.group("url_p"), m.group("fn"), m.group("md5") url = join_url(url_p, fn) # url_p is everything but the tarball_basename and the md5sum # If the path points to a file in the package cache, we need to use # the dist name that corresponds to that package. The MD5 may not # match, but we will let PFE below worry about that dist = None if url.startswith("file:/"): path = win_path_ok(url_to_path(url)) if dirname(path) in context.pkgs_dirs: if not exists(path): raise CondaFileNotFoundError(path) pc_entry = PackageCache.tarball_file_in_cache(path) dist = pc_entry.dist url = dist.to_url() or pc_entry.get_urls_txt_value() md5sum = md5sum or pc_entry.md5sum dist = dist or Dist(url) fetch_recs[dist] = {"md5": md5sum, "url": url} # perform any necessary fetches and extractions if verbose: from .console import setup_verbose_handlers setup_verbose_handlers() link_dists = tuple(iterkeys(fetch_recs)) pfe = ProgressiveFetchExtract(fetch_recs, link_dists) pfe.execute() # dists could have been updated with more accurate urls # TODO: I'm stuck here # Now get the index---but the only index we need is the package cache index = {} _supplement_index_with_cache(index, ()) # unlink any installed packages with same package name link_names = {index[d]["name"] for d in link_dists} actions[UNLINK].extend( d for d, r in iteritems(linked_data(prefix)) if r["name"] in link_names ) # need to get the install order right, especially to install python in the prefix # before python noarch packages r = Resolve(index) actions[LINK].extend(link_dists) actions[LINK] = r.dependency_sort( {r.package_name(dist): dist for dist in actions[LINK]} ) actions["ACTION"] = "EXPLICIT" execute_actions(actions, index, verbose=verbose) return actions
https://github.com/conda/conda/issues/4968
Traceback (most recent call last): File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 502, in _execute_action action.execute() File "/conda/lib/python3.6/site-packages/conda/core/path_actions.py", line 739, in execute source_md5sum = compute_md5sum(source_path) File "/conda/lib/python3.6/site-packages/conda/gateways/disk/read.py", line 59, in compute_md5sum raise CondaFileNotFoundError(file_full_path) conda.exceptions.CondaFileNotFoundError: <unprintable CondaFileNotFoundError object> During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/conda/lib/python3.6/site-packages/conda/exceptions.py", line 592, in conda_exception_handler return_value = func(*args, **kwargs) File "/conda/lib/python3.6/site-packages/conda/cli/main.py", line 134, in _main exit_code = args.func(args, p) File "/conda/lib/python3.6/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/conda/lib/python3.6/site-packages/conda/cli/install.py", line 200, in install explicit(args.packages, prefix, verbose=not context.quiet) File "/conda/lib/python3.6/site-packages/conda/misc.py", line 90, in explicit pfe.execute() File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 491, in execute self._execute_action(action) File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 507, in _execute_action exceptions.append(CondaError(repr(e))) File "/conda/lib/python3.6/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s\n' % (self.__class__.__name__, text_type(self)) File "/conda/lib/python3.6/site-packages/conda/__init__.py", line 48, in __str__ return text_type(self.message % self._kwargs) TypeError: must be real number, not dict
conda.exceptions.CondaFileNotFoundError
def create_from_dists(cls, index, target_prefix, unlink_dists, link_dists): # This constructor method helps to patch into the 'plan' framework lnkd_pkg_data = (load_meta(target_prefix, dist) for dist in unlink_dists) # TODO: figure out if this filter shouldn't be an assert not None linked_packages_data_to_unlink = tuple(lpd for lpd in lnkd_pkg_data if lpd) log.debug( "instantiating UnlinkLinkTransaction with\n" " target_prefix: %s\n" " unlink_dists:\n" " %s\n" " link_dists:\n" " %s\n", target_prefix, "\n ".join(text_type(d) for d in unlink_dists), "\n ".join(text_type(d) for d in link_dists), ) pkg_dirs_to_link = tuple( PackageCache.get_entry_to_link(dist).extracted_package_dir for dist in link_dists ) assert all(pkg_dirs_to_link) packages_info_to_link = tuple( read_package_info(index[dist], pkg_dir) for dist, pkg_dir in zip(link_dists, pkg_dirs_to_link) ) return UnlinkLinkTransaction( target_prefix, linked_packages_data_to_unlink, packages_info_to_link )
def create_from_dists(cls, index, target_prefix, unlink_dists, link_dists): # This constructor method helps to patch into the 'plan' framework linked_packages_data_to_unlink = tuple( load_meta(target_prefix, dist) for dist in unlink_dists ) log.debug( "instantiating UnlinkLinkTransaction with\n" " target_prefix: %s\n" " unlink_dists:\n" " %s\n" " link_dists:\n" " %s\n", target_prefix, "\n ".join(text_type(d) for d in unlink_dists), "\n ".join(text_type(d) for d in link_dists), ) pkg_dirs_to_link = tuple( PackageCache.get_entry_to_link(dist).extracted_package_dir for dist in link_dists ) assert all(pkg_dirs_to_link) packages_info_to_link = tuple( read_package_info(index[dist], pkg_dir) for dist, pkg_dir in zip(link_dists, pkg_dirs_to_link) ) return UnlinkLinkTransaction( target_prefix, linked_packages_data_to_unlink, packages_info_to_link )
https://github.com/conda/conda/issues/4974
Traceback (most recent call last): File "/Users/luisaalanizcastillo/anaconda/lib/python3.6/site-packages/conda/exceptions.py", line 591, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/luisaalanizcastillo/anaconda/lib/python3.6/site-packages/conda/cli/main.py", line 134, in _main exit_code = args.func(args, p) File "/Users/luisaalanizcastillo/anaconda/lib/python3.6/site-packages/conda/cli/main_update.py", line 65, in execute install(args, parser, 'update') File "/Users/luisaalanizcastillo/anaconda/lib/python3.6/site-packages/conda/cli/install.py", line 359, in install execute_actions(actions, index, verbose=not context.quiet) File "/Users/luisaalanizcastillo/anaconda/lib/python3.6/site-packages/conda/plan.py", line 800, in execute_actions execute_instructions(plan, index, verbose) File "/Users/luisaalanizcastillo/anaconda/lib/python3.6/site-packages/conda/instructions.py", line 247, in execute_instructions cmd(state, arg) File "/Users/luisaalanizcastillo/anaconda/lib/python3.6/site-packages/conda/instructions.py", line 108, in UNLINKLINKTRANSACTION_CMD txn.execute() File "/Users/luisaalanizcastillo/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 262, in execute self.verify() File "/Users/luisaalanizcastillo/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 241, in verify self.prepare() File "/Users/luisaalanizcastillo/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 163, in prepare for lnkd_pkg_data in self.linked_packages_data_to_unlink) File "/Users/luisaalanizcastillo/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 163, in <genexpr> for lnkd_pkg_data in self.linked_packages_data_to_unlink) File "/Users/luisaalanizcastillo/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 65, in make_unlink_actions for trgt in linked_package_data.files) AttributeError: 'NoneType' object has no attribute 'files'
AttributeError
def execute_config(args, parser): json_warnings = [] json_get = {} if args.show_sources: if context.json: print( json.dumps( context.collect_all(), sort_keys=True, indent=2, separators=(",", ": "), ) ) else: lines = [] for source, reprs in iteritems(context.collect_all()): lines.append("==> %s <==" % source) lines.extend(format_dict(reprs)) lines.append("") print("\n".join(lines)) return if args.show: from collections import OrderedDict d = OrderedDict( (key, getattr(context, key)) for key in context.list_parameters() ) if context.json: print( json.dumps( d, sort_keys=True, indent=2, separators=(",", ": "), cls=EntityEncoder, ) ) else: # coerce channels d["custom_channels"] = { k: text_type(v).replace( k, "" ) # TODO: the replace here isn't quite right # NOQA for k, v in iteritems(d["custom_channels"]) } # TODO: custom_multichannels needs better formatting d["custom_multichannels"] = { k: json.dumps([text_type(c) for c in chnls]) for k, chnls in iteritems(d["custom_multichannels"]) } print("\n".join(format_dict(d))) context.validate_configuration() return if args.describe: paramater_names = context.list_parameters() if context.json: print( json.dumps( [context.describe_parameter(name) for name in paramater_names], sort_keys=True, indent=2, separators=(",", ": "), cls=EntityEncoder, ) ) else: def clean_element_type(element_types): _types = set() for et in element_types: _types.add("str") if isinstance(et, string_types) else _types.add( "%s" % et ) return tuple(sorted(_types)) for name in paramater_names: details = context.describe_parameter(name) aliases = details["aliases"] string_delimiter = details.get("string_delimiter") element_types = details["element_types"] if details["parameter_type"] == "primitive": print( "%s (%s)" % (name, ", ".join(clean_element_type(element_types))) ) else: print( "%s (%s: %s)" % ( name, details["parameter_type"], ", ".join(clean_element_type(element_types)), ) ) def_str = " default: %s" % json.dumps( details["default_value"], indent=2, separators=(",", ": "), cls=EntityEncoder, ) print("\n ".join(def_str.split("\n"))) if aliases: print(" aliases: %s" % ", ".join(aliases)) if string_delimiter: print(" string delimiter: '%s'" % string_delimiter) print("\n ".join(wrap(" " + details["description"], 70))) print() return if args.validate: context.validate_all() return if args.system: rc_path = sys_rc_path elif args.env: if "CONDA_PREFIX" in os.environ: rc_path = join(os.environ["CONDA_PREFIX"], ".condarc") else: rc_path = user_rc_path elif args.file: rc_path = args.file else: rc_path = user_rc_path # read existing condarc if os.path.exists(rc_path): with open(rc_path, "r") as fh: rc_config = yaml_load(fh) or {} else: rc_config = {} # Get if args.get is not None: context.validate_all() if args.get == []: args.get = sorted(rc_config.keys()) for key in args.get: if key not in rc_list_keys + rc_bool_keys + rc_string_keys: if key not in rc_other: message = "unknown key %s" % key if not context.json: print(message, file=sys.stderr) else: json_warnings.append(message) continue if key not in rc_config: continue if context.json: json_get[key] = rc_config[key] continue if isinstance(rc_config[key], (bool, string_types)): print("--set", key, rc_config[key]) else: # assume the key is a list-type # Note, since conda config --add prepends, these are printed in # the reverse order so that entering them in this order will # recreate the same file items = rc_config.get(key, []) numitems = len(items) for q, item in enumerate(reversed(items)): # Use repr so that it can be pasted back in to conda config --add if key == "channels" and q in (0, numitems - 1): print( "--add", key, repr(item), " # lowest priority" if q == 0 else " # highest priority", ) else: print("--add", key, repr(item)) # prepend, append, add for arg, prepend in zip((args.prepend, args.append), (True, False)): sequence_parameters = [ p for p in context.list_parameters() if context.describe_parameter(p)["parameter_type"] == "sequence" ] for key, item in arg: if key == "channels" and key not in rc_config: rc_config[key] = ["defaults"] if key not in sequence_parameters: raise CondaValueError( "Key '%s' is not a known sequence parameter." % key ) if not isinstance(rc_config.get(key, []), list): bad = rc_config[key].__class__.__name__ raise CouldntParseError("key %r should be a list, not %s." % (key, bad)) if key == "default_channels" and rc_path != sys_rc_path: msg = "'default_channels' is only configurable for system installs" raise NotImplementedError(msg) arglist = rc_config.setdefault(key, []) if item in arglist: # Right now, all list keys should not contain duplicates message = "Warning: '%s' already in '%s' list, moving to the %s" % ( item, key, "top" if prepend else "bottom", ) arglist = rc_config[key] = [p for p in arglist if p != item] if not context.json: print(message, file=sys.stderr) else: json_warnings.append(message) arglist.insert(0 if prepend else len(arglist), item) # Set for key, item in args.set: primitive_parameters = [ p for p in context.list_parameters() if context.describe_parameter(p)["parameter_type"] == "primitive" ] if key not in primitive_parameters: raise CondaValueError("Key '%s' is not a known primitive parameter." % key) value = context.typify_parameter(key, item) rc_config[key] = value # Remove for key, item in args.remove: if key not in rc_config: if key != "channels": raise CondaKeyError(key, "key %r is not in the config file" % key) rc_config[key] = ["defaults"] if item not in rc_config[key]: raise CondaKeyError( key, "%r is not in the %r key of the config file" % (item, key) ) rc_config[key] = [i for i in rc_config[key] if i != item] # Remove Key for (key,) in args.remove_key: if key not in rc_config: raise CondaKeyError(key, "key %r is not in the config file" % key) del rc_config[key] # config.rc_keys if not args.get: try: with open(rc_path, "w") as rc: rc.write(yaml_dump(rc_config)) except (IOError, OSError) as e: raise CondaError( "Cannot write to condarc file at %s\nCaused by %r" % (rc_path, e) ) if context.json: stdout_json_success(rc_path=rc_path, warnings=json_warnings, get=json_get) return
def execute_config(args, parser): json_warnings = [] json_get = {} if args.show_sources: if context.json: print( json.dumps( context.collect_all(), sort_keys=True, indent=2, separators=(",", ": "), ) ) else: lines = [] for source, reprs in iteritems(context.collect_all()): lines.append("==> %s <==" % source) lines.extend(format_dict(reprs)) lines.append("") print("\n".join(lines)) return if args.show: from collections import OrderedDict d = OrderedDict( (key, getattr(context, key)) for key in context.list_parameters() ) if context.json: print( json.dumps( d, sort_keys=True, indent=2, separators=(",", ": "), cls=EntityEncoder, ) ) else: # coerce channels d["custom_channels"] = { k: text_type(v).replace( k, "" ) # TODO: the replace here isn't quite right # NOQA for k, v in iteritems(d["custom_channels"]) } # TODO: custom_multichannels needs better formatting d["custom_multichannels"] = { k: json.dumps([text_type(c) for c in chnls]) for k, chnls in iteritems(d["custom_multichannels"]) } print("\n".join(format_dict(d))) context.validate_configuration() return if args.describe: paramater_names = context.list_parameters() if context.json: print( json.dumps( [context.describe_parameter(name) for name in paramater_names], sort_keys=True, indent=2, separators=(",", ": "), cls=EntityEncoder, ) ) else: def clean_element_type(element_types): _types = set() for et in element_types: _types.add("str") if isinstance(et, string_types) else _types.add( "%s" % et ) return tuple(sorted(_types)) for name in paramater_names: details = context.describe_parameter(name) aliases = details["aliases"] string_delimiter = details.get("string_delimiter") element_types = details["element_types"] if details["parameter_type"] == "primitive": print( "%s (%s)" % (name, ", ".join(clean_element_type(element_types))) ) else: print( "%s (%s: %s)" % ( name, details["parameter_type"], ", ".join(clean_element_type(element_types)), ) ) def_str = " default: %s" % json.dumps( details["default_value"], indent=2, separators=(",", ": "), cls=EntityEncoder, ) print("\n ".join(def_str.split("\n"))) if aliases: print(" aliases: %s" % ", ".join(aliases)) if string_delimiter: print(" string delimiter: '%s'" % string_delimiter) print("\n ".join(wrap(" " + details["description"], 70))) print() return if args.validate: context.validate_all() return if args.system: rc_path = sys_rc_path elif args.env: if "CONDA_PREFIX" in os.environ: rc_path = join(os.environ["CONDA_PREFIX"], ".condarc") else: rc_path = user_rc_path elif args.file: rc_path = args.file else: rc_path = user_rc_path # read existing condarc if os.path.exists(rc_path): with open(rc_path, "r") as fh: rc_config = yaml_load(fh) or {} else: rc_config = {} # Get if args.get is not None: context.validate_all() if args.get == []: args.get = sorted(rc_config.keys()) for key in args.get: if key not in rc_list_keys + rc_bool_keys + rc_string_keys: if key not in rc_other: message = "unknown key %s" % key if not context.json: print(message, file=sys.stderr) else: json_warnings.append(message) continue if key not in rc_config: continue if context.json: json_get[key] = rc_config[key] continue if isinstance(rc_config[key], (bool, string_types)): print("--set", key, rc_config[key]) else: # assume the key is a list-type # Note, since conda config --add prepends, these are printed in # the reverse order so that entering them in this order will # recreate the same file items = rc_config.get(key, []) numitems = len(items) for q, item in enumerate(reversed(items)): # Use repr so that it can be pasted back in to conda config --add if key == "channels" and q in (0, numitems - 1): print( "--add", key, repr(item), " # lowest priority" if q == 0 else " # highest priority", ) else: print("--add", key, repr(item)) # prepend, append, add for arg, prepend in zip((args.prepend, args.append), (True, False)): sequence_parameters = [ p for p in context.list_parameters() if context.describe_parameter(p)["parameter_type"] == "sequence" ] for key, item in arg: if key == "channels" and key not in rc_config: rc_config[key] = ["defaults"] if key not in sequence_parameters: raise CondaValueError( "Key '%s' is not a known sequence parameter." % key ) if not isinstance(rc_config.get(key, []), list): bad = rc_config[key].__class__.__name__ raise CouldntParseError("key %r should be a list, not %s." % (key, bad)) if key == "default_channels" and rc_path != sys_rc_path: msg = "'default_channels' is only configurable for system installs" raise NotImplementedError(msg) arglist = rc_config.setdefault(key, []) if item in arglist: # Right now, all list keys should not contain duplicates message = "Warning: '%s' already in '%s' list, moving to the %s" % ( item, key, "top" if prepend else "bottom", ) arglist = rc_config[key] = [p for p in arglist if p != item] if not context.json: print(message, file=sys.stderr) else: json_warnings.append(message) arglist.insert(0 if prepend else len(arglist), item) # Set for key, item in args.set: primitive_parameters = [ p for p in context.list_parameters() if context.describe_parameter(p)["parameter_type"] == "primitive" ] if key not in primitive_parameters: raise CondaValueError("Key '%s' is not a known primitive parameter." % key) value = context.typify_parameter(key, item) rc_config[key] = value # Remove for key, item in args.remove: if key not in rc_config: if key != "channels": raise CondaKeyError(key, "key %r is not in the config file" % key) rc_config[key] = ["defaults"] if item not in rc_config[key]: raise CondaKeyError( key, "%r is not in the %r key of the config file" % (item, key) ) rc_config[key] = [i for i in rc_config[key] if i != item] # Remove Key for (key,) in args.remove_key: if key not in rc_config: raise CondaKeyError(key, "key %r is not in the config file" % key) del rc_config[key] # config.rc_keys if not args.get: with open(rc_path, "w") as rc: rc.write(yaml_dump(rc_config)) if context.json: stdout_json_success(rc_path=rc_path, warnings=json_warnings, get=json_get) return
https://github.com/conda/conda/issues/598
An unexpected error has occurred, please consider sending the following traceback to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Include the output of the command 'conda info' in your report. Traceback (most recent call last): File "/opt/anaconda/bin/conda", line 5, in <module> sys.exit(main()) File "/opt/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 179, in main args.func(args, p) File "/opt/anaconda/lib/python2.7/site-packages/conda/cli/main_config.py", line 339, in execute with open(rc_path, 'w') as rc: IOError: [Errno 13] Permission denied: '/opt/anaconda/.condarc'
IOError
def _merge(self, matches): # get matches up to and including first important_match # but if no important_match, then all matches are important_matches relevant_matches_and_values = tuple( (match, match.value(self)) for match in self._first_important_matches(matches) ) for match, value in relevant_matches_and_values: if not isinstance(value, tuple): raise InvalidTypeError( self.name, value, match.source, value.__class__.__name__, self._type.__name__, ) # get individual lines from important_matches that were marked important # these will be prepended to the final result def get_marked_lines(match, marker, parameter_obj): return ( tuple( line for line, flag in zip( match.value(parameter_obj), match.valueflags(parameter_obj) ) if flag is marker ) if match else () ) top_lines = concat( get_marked_lines(m, ParameterFlag.top, self) for m, _ in relevant_matches_and_values ) # also get lines that were marked as bottom, but reverse the match order so that lines # coming earlier will ultimately be last bottom_lines = concat( get_marked_lines(m, ParameterFlag.bottom, self) for m, _ in reversed(relevant_matches_and_values) ) # now, concat all lines, while reversing the matches # reverse because elements closer to the end of search path take precedence all_lines = concat(v for _, v in reversed(relevant_matches_and_values)) # stack top_lines + all_lines, then de-dupe top_deduped = tuple(unique(concatv(top_lines, all_lines))) # take the top-deduped lines, reverse them, and concat with reversed bottom_lines # this gives us the reverse of the order we want, but almost there # NOTE: for a line value marked both top and bottom, the bottom marker will win out # for the top marker to win out, we'd need one additional de-dupe step bottom_deduped = unique( concatv(reversed(tuple(bottom_lines)), reversed(top_deduped)) ) # just reverse, and we're good to go return tuple(reversed(tuple(bottom_deduped)))
def _merge(self, matches): # get matches up to and including first important_match # but if no important_match, then all matches are important_matches relevant_matches = self._first_important_matches(matches) # get individual lines from important_matches that were marked important # these will be prepended to the final result def get_marked_lines(match, marker, parameter_obj): return ( tuple( line for line, flag in zip( match.value(parameter_obj), match.valueflags(parameter_obj) ) if flag is marker ) if match else () ) top_lines = concat( get_marked_lines(m, ParameterFlag.top, self) for m in relevant_matches ) # also get lines that were marked as bottom, but reverse the match order so that lines # coming earlier will ultimately be last bottom_lines = concat( get_marked_lines(m, ParameterFlag.bottom, self) for m in reversed(relevant_matches) ) # now, concat all lines, while reversing the matches # reverse because elements closer to the end of search path take precedence all_lines = concat(m.value(self) for m in reversed(relevant_matches)) # stack top_lines + all_lines, then de-dupe top_deduped = tuple(unique(concatv(top_lines, all_lines))) # take the top-deduped lines, reverse them, and concat with reversed bottom_lines # this gives us the reverse of the order we want, but almost there # NOTE: for a line value marked both top and bottom, the bottom marker will win out # for the top marker to win out, we'd need one additional de-dupe step bottom_deduped = unique( concatv(reversed(tuple(bottom_lines)), reversed(top_deduped)) ) # just reverse, and we're good to go return tuple(reversed(tuple(bottom_deduped)))
https://github.com/conda/conda/issues/5189
(test) [hulk@ranganork conda]# conda update conda Traceback (most recent call last): File "/root/conda/conda/exceptions.py", line 632, in conda_exception_handler return_value = func(*args, **kwargs) File "/root/conda/conda/cli/main.py", line 134, in _main exit_code = args.func(args, p) File "/root/conda/conda/cli/main_update.py", line 65, in execute install(args, parser, 'update') File "/root/conda/conda/cli/install.py", line 128, in install context.validate_configuration() File "/root/conda/conda/common/configuration.py", line 844, in validate_configuration raise_errors(tuple(chain.from_iterable((errors, post_errors)))) File "/root/conda/conda/common/configuration.py", line 842, in <genexpr> for name in self.parameter_names) File "/root/conda/conda/common/configuration.py", line 835, in _collect_validation_error func(*args, **kwargs) File "/root/conda/conda/common/configuration.py", line 448, in __get__ result = typify_data_structure(self._merge(matches) if matches else self.default, File "/root/conda/conda/common/configuration.py", line 596, in _merge top_deduped = tuple(unique(concatv(top_lines, all_lines))) File "/root/conda/conda/_vendor/toolz/itertoolz.py", line 209, in unique for item in seq: File "/root/conda/conda/common/configuration.py", line 584, in <genexpr> top_lines = concat(get_marked_lines(m, ParameterFlag.top, self) for m in relevant_matches) File "/root/conda/conda/common/configuration.py", line 583, in get_marked_lines if flag is marker) if match else () TypeError: zip argument #2 must support iteration During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/conda/envs/test/bin/conda", line 11, in <module> load_entry_point('conda', 'console_scripts', 'conda')() File "/root/conda/conda/cli/main.py", line 162, in main return conda_exception_handler(_main, *args) File "/root/conda/conda/exceptions.py", line 636, in conda_exception_handler return handle_exception(e) File "/root/conda/conda/exceptions.py", line 626, in handle_exception print_unexpected_error_message(e) File "/root/conda/conda/exceptions.py", line 588, in print_unexpected_error_message stderrlogger.info(get_main_info_str(get_info_dict())) File "/root/conda/conda/cli/main_info.py", line 196, in get_info_dict channels = list(prioritize_channels(context.channels).keys()) File "/root/conda/conda/base/context.py", line 448, in channels return self._channels File "/root/conda/conda/common/configuration.py", line 448, in __get__ result = typify_data_structure(self._merge(matches) if matches else self.default, File "/root/conda/conda/common/configuration.py", line 596, in _merge top_deduped = tuple(unique(concatv(top_lines, all_lines))) File "/root/conda/conda/_vendor/toolz/itertoolz.py", line 209, in unique for item in seq: File "/root/conda/conda/common/configuration.py", line 584, in <genexpr> top_lines = concat(get_marked_lines(m, ParameterFlag.top, self) for m in relevant_matches) File "/root/conda/conda/common/configuration.py", line 583, in get_marked_lines if flag is marker) if match else () TypeError: zip argument #2 must support iteration
TypeError
def __init__( self, parameter_name, parameter_value, source, wrong_type, valid_types, msg=None ): self.wrong_type = wrong_type self.valid_types = valid_types if msg is None: msg = "Parameter %s = %r declared in %s has type %s.\nValid types:\n%s" % ( parameter_name, parameter_value, source, wrong_type, pretty_list(valid_types), ) super(InvalidTypeError, self).__init__( parameter_name, parameter_value, source, msg=msg )
def __init__( self, parameter_name, parameter_value, source, wrong_type, valid_types, msg=None ): self.wrong_type = wrong_type self.valid_types = valid_types if msg is None: msg = "Parameter %s = %r declared in %s has type %s.\nValid types: %s." % ( parameter_name, parameter_value, source, wrong_type, pretty_list(valid_types), ) super(InvalidTypeError, self).__init__( parameter_name, parameter_value, source, msg=msg )
https://github.com/conda/conda/issues/5184
`$ C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Scripts\conda-script.py updat e` Traceback (most recent call last): File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\exceptions.py", line 573, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\cli\main.py", line 134, in _main exit_code = args.func(args, p) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\cli\main_update.py", line 65, in execute install(args, parser, 'update') File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\cli\install.py", line 130, in install context.validate_configuration() File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\configuration.py", line 838, in validate_configuration raise_errors(tuple(chain.from_iterable((errors, post_errors)))) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\configuration.py", line 836, in <genexpr> for name in self.parameter_names) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\configuration.py", line 829, in _collect_validation_error func(*args, **kwargs) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\configuration.py", line 447, in __get__ result = typify_data_structure(self._merge(matches) if matches else self .default, File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\configuration.py", line 664, in _merge for match in relevant_matches) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\configuration.py", line 664, in <genexpr> for match in relevant_matches) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\compat.py", line 71, in iteritems return iter(d.items(**kw)) AttributeError: 'str' object has no attribute 'items'
AttributeError
def _merge(self, matches): # get matches up to and including first important_match # but if no important_match, then all matches are important_matches relevant_matches_and_values = tuple( (match, match.value(self)) for match in self._first_important_matches(matches) ) for match, value in relevant_matches_and_values: if not isinstance(value, Mapping): raise InvalidTypeError( self.name, value, match.source, value.__class__.__name__, self._type.__name__, ) # mapkeys with important matches def key_is_important(match, key): return match.valueflags(self).get(key) is ParameterFlag.final important_maps = tuple( dict((k, v) for k, v in iteritems(match_value) if key_is_important(match, k)) for match, match_value in relevant_matches_and_values ) # dump all matches in a dict # then overwrite with important matches return merge( concatv((v for _, v in relevant_matches_and_values), reversed(important_maps)) )
def _merge(self, matches): # get matches up to and including first important_match # but if no important_match, then all matches are important_matches relevant_matches = self._first_important_matches(matches) # mapkeys with important matches def key_is_important(match, key): return match.valueflags(self).get(key) is ParameterFlag.final important_maps = tuple( dict( (k, v) for k, v in iteritems(match.value(self)) if key_is_important(match, k) ) for match in relevant_matches ) # dump all matches in a dict # then overwrite with important matches return merge( concatv((m.value(self) for m in relevant_matches), reversed(important_maps)) )
https://github.com/conda/conda/issues/5184
`$ C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Scripts\conda-script.py updat e` Traceback (most recent call last): File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\exceptions.py", line 573, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\cli\main.py", line 134, in _main exit_code = args.func(args, p) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\cli\main_update.py", line 65, in execute install(args, parser, 'update') File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\cli\install.py", line 130, in install context.validate_configuration() File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\configuration.py", line 838, in validate_configuration raise_errors(tuple(chain.from_iterable((errors, post_errors)))) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\configuration.py", line 836, in <genexpr> for name in self.parameter_names) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\configuration.py", line 829, in _collect_validation_error func(*args, **kwargs) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\configuration.py", line 447, in __get__ result = typify_data_structure(self._merge(matches) if matches else self .default, File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\configuration.py", line 664, in _merge for match in relevant_matches) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\configuration.py", line 664, in <genexpr> for match in relevant_matches) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\common\compat.py", line 71, in iteritems return iter(d.items(**kw)) AttributeError: 'str' object has no attribute 'items'
AttributeError
def add_username_and_pass_to_url(url, username, passwd): url_parts = parse_url(url)._asdict() url_parts["auth"] = username + ":" + quote(passwd, "") return Url(**url_parts).url
def add_username_and_pass_to_url(url, username, passwd): url_obj = parse_url(url) url_obj.auth = username + ":" + quote(passwd, "") return url_obj.url
https://github.com/conda/conda/issues/3531
C:\>conda search scikit-learn https proxy username: john.doe Password: An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : win-64 conda version : 4.2.7 conda is private : False conda-env version : 4.2.7 conda-build version : not installed python version : 3.5.2.final.0 requests version : 2.11.1 root environment : C:\Miniconda3 (writable) default environment : C:\Miniconda3 envs directories : C:\Miniconda3\envs package cache : C:\Miniconda3\pkgs channel URLs : https://repo.continuum.io/pkgs/free/win-64/ https://repo.continuum.io/pkgs/free/noarch/ https://repo.continuum.io/pkgs/pro/win-64/ https://repo.continuum.io/pkgs/pro/noarch/ https://repo.continuum.io/pkgs/msys2/win-64/ https://repo.continuum.io/pkgs/msys2/noarch/ config file : C:\Users\john.doe\.condarc offline mode : False `$ C:\Miniconda3\Scripts\conda-script.py search scikit-learn` Traceback (most recent call last): File "C:\Miniconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 589, in urlopen self._prepare_proxy(conn) File "C:\Miniconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 797, in _prepare_proxy conn.connect() File "C:\Miniconda3\lib\site-packages\requests\packages\urllib3\connection.py", line 267, in connect self._tunnel() File "C:\Miniconda3\lib\http\client.py", line 832, in _tunnel message.strip())) OSError: Tunnel connection failed: 407 Proxy Authentication Required During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Miniconda3\lib\site-packages\requests\adapters.py", line 423, in send timeout=timeout File "C:\Miniconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 668, in urlopen release_conn=release_conn, **response_kw) File "C:\Miniconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 668, in urlopen release_conn=release_conn, **response_kw) File "C:\Miniconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 668, in urlopen release_conn=release_conn, **response_kw) File "C:\Miniconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 640, in urlopen _stacktrace=sys.exc_info()[2]) File "C:\Miniconda3\lib\site-packages\requests\packages\urllib3\util\retry.py", line 287, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/free/win-64/repodata.json.bz2 (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required',))) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Miniconda3\lib\site-packages\conda\fetch.py", line 112, in fetch_repodata timeout=(3.05, 60)) File "C:\Miniconda3\lib\site-packages\requests\sessions.py", line 488, in get return self.request('GET', url, **kwargs) File "C:\Miniconda3\lib\site-packages\requests\sessions.py", line 475, in request resp = self.send(prep, **send_kwargs) File "C:\Miniconda3\lib\site-packages\requests\sessions.py", line 596, in send r = adapter.send(request, **kwargs) File "C:\Miniconda3\lib\site-packages\requests\adapters.py", line 485, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/free/win-64/repodata.json.bz2 (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required',))) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Miniconda3\lib\site-packages\conda\exceptions.py", line 472, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Miniconda3\lib\site-packages\conda\cli\main.py", line 144, in _main exit_code = args.func(args, p) File "C:\Miniconda3\lib\site-packages\conda\cli\main_search.py", line 126, in execute execute_search(args, parser) File "C:\Miniconda3\lib\site-packages\conda\cli\main_search.py", line 174, in execute_search unknown=args.unknown) File "C:\Miniconda3\lib\site-packages\conda\api.py", line 24, in get_index index = fetch_index(channel_urls, use_cache=use_cache, unknown=unknown) File "C:\Miniconda3\lib\site-packages\conda\fetch.py", line 287, in fetch_index repodatas = [(u, f.result()) for u, f in zip(urls, futures)] File "C:\Miniconda3\lib\site-packages\conda\fetch.py", line 287, in <listcomp> repodatas = [(u, f.result()) for u, f in zip(urls, futures)] File "C:\Miniconda3\lib\concurrent\futures\_base.py", line 405, in result return self.__get_result() File "C:\Miniconda3\lib\concurrent\futures\_base.py", line 357, in __get_result raise self._exception File "C:\Miniconda3\lib\concurrent\futures\thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "C:\Miniconda3\lib\site-packages\conda\fetch.py", line 70, in func res = f(*args, **kwargs) File "C:\Miniconda3\lib\site-packages\conda\fetch.py", line 178, in fetch_repodata handle_proxy_407(url, session) File "C:\Miniconda3\lib\site-packages\conda\fetch.py", line 212, in handle_proxy_407 session.proxies[scheme], username, passwd) File "C:\Miniconda3\lib\site-packages\conda\common\url.py", line 46, in add_username_and_pass_to_url url_obj.auth = username + ':' + quote(passwd, '') AttributeError: can't set attribute C:\>
OSError
def prefix_from_arg(arg, shelldict): from ..base.context import context, locate_prefix_by_name "Returns a platform-native path" # MSYS2 converts Unix paths to Windows paths with unix seps # so we must check for the drive identifier too. if shelldict["sep"] in arg and not re.match("[a-zA-Z]:", arg): # strip is removing " marks, not \ - look carefully native_path = shelldict["path_from"](arg) if isdir(abspath(native_path.strip('"'))): prefix = abspath(native_path.strip('"')) else: raise CondaValueError("Could not find environment: %s" % native_path) else: prefix = locate_prefix_by_name(context, arg.replace("/", os.path.sep)) return prefix
def prefix_from_arg(arg, shelldict): from conda.base.context import context, locate_prefix_by_name "Returns a platform-native path" # MSYS2 converts Unix paths to Windows paths with unix seps # so we must check for the drive identifier too. if shelldict["sep"] in arg and not re.match("[a-zA-Z]:", arg): # strip is removing " marks, not \ - look carefully native_path = shelldict["path_from"](arg) if isdir(abspath(native_path.strip('"'))): prefix = abspath(native_path.strip('"')) else: raise CondaValueError("Could not find environment: %s" % native_path) else: prefix = locate_prefix_by_name(context, arg.replace("/", os.path.sep)) return prefix
https://github.com/conda/conda/issues/5039
$ conda -h An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions
ImportError
def main(): from ..base.constants import ROOT_ENV_NAME from ..utils import shells if "-h" in sys.argv or "--help" in sys.argv: # all execution paths sys.exit at end. help(sys.argv[1], sys.argv[2]) if len(sys.argv) > 2: shell = sys.argv[2] shelldict = shells[shell] else: shelldict = {} if sys.argv[1] == "..activate": print(get_activate_path(shelldict)) sys.exit(0) elif sys.argv[1] == "..deactivate.path": import re activation_path = get_activate_path(shelldict) if os.getenv("_CONDA_HOLD"): new_path = re.sub( r"%s(:?)" % re.escape(activation_path), r"CONDA_PATH_PLACEHOLDER\1", os.environ[str("PATH")], 1, ) else: new_path = re.sub( r"%s(:?)" % re.escape(activation_path), r"", os.environ[str("PATH")], 1 ) print(new_path) sys.exit(0) elif sys.argv[1] == "..checkenv": if len(sys.argv) < 4: raise ArgumentError( "Invalid arguments to checkenv. Need shell and env name/path" ) if len(sys.argv) > 4: raise ArgumentError("did not expect more than one argument.") if sys.argv[3].lower() == ROOT_ENV_NAME.lower(): # no need to check root env and try to install a symlink there sys.exit(0) # raise CondaSystemExit # this should throw an error and exit if the env or path can't be found. try: prefix = prefix_from_arg(sys.argv[3], shelldict=shelldict) except ValueError as e: raise CondaValueError(text_type(e)) # Make sure an env always has the conda symlink try: from ..base.context import context from ..install import symlink_conda symlink_conda(prefix, context.root_prefix, shell) except (IOError, OSError) as e: if e.errno == errno.EPERM or e.errno == errno.EACCES: msg = ( "Cannot activate environment {0}.\n" "User does not have write access for conda symlinks.".format( sys.argv[2] ) ) raise CondaEnvironmentError(msg) raise sys.exit(0) # raise CondaSystemExit elif sys.argv[1] == "..changeps1": from ..base.context import context path = int(context.changeps1) else: # This means there is a bug in main.py raise CondaValueError("unexpected command") # This print is actually what sets the PATH or PROMPT variable. The shell # script gets this value, and finishes the job. print(path)
def main(): from conda.base.constants import ROOT_ENV_NAME from conda.utils import shells if "-h" in sys.argv or "--help" in sys.argv: # all execution paths sys.exit at end. help(sys.argv[1], sys.argv[2]) if len(sys.argv) > 2: shell = sys.argv[2] shelldict = shells[shell] else: shelldict = {} if sys.argv[1] == "..activate": print(get_activate_path(shelldict)) sys.exit(0) elif sys.argv[1] == "..deactivate.path": import re activation_path = get_activate_path(shelldict) if os.getenv("_CONDA_HOLD"): new_path = re.sub( r"%s(:?)" % re.escape(activation_path), r"CONDA_PATH_PLACEHOLDER\1", os.environ[str("PATH")], 1, ) else: new_path = re.sub( r"%s(:?)" % re.escape(activation_path), r"", os.environ[str("PATH")], 1 ) print(new_path) sys.exit(0) elif sys.argv[1] == "..checkenv": if len(sys.argv) < 4: raise ArgumentError( "Invalid arguments to checkenv. Need shell and env name/path" ) if len(sys.argv) > 4: raise ArgumentError("did not expect more than one argument.") if sys.argv[3].lower() == ROOT_ENV_NAME.lower(): # no need to check root env and try to install a symlink there sys.exit(0) # raise CondaSystemExit # this should throw an error and exit if the env or path can't be found. try: prefix = prefix_from_arg(sys.argv[3], shelldict=shelldict) except ValueError as e: raise CondaValueError(text_type(e)) # Make sure an env always has the conda symlink try: from conda.base.context import context import conda.install conda.install.symlink_conda(prefix, context.root_prefix, shell) except (IOError, OSError) as e: if e.errno == errno.EPERM or e.errno == errno.EACCES: msg = ( "Cannot activate environment {0}.\n" "User does not have write access for conda symlinks.".format( sys.argv[2] ) ) raise CondaEnvironmentError(msg) raise sys.exit(0) # raise CondaSystemExit elif sys.argv[1] == "..changeps1": from conda.base.context import context path = int(context.changeps1) else: # This means there is a bug in main.py raise CondaValueError("unexpected command") # This print is actually what sets the PATH or PROMPT variable. The shell # script gets this value, and finishes the job. print(path)
https://github.com/conda/conda/issues/5039
$ conda -h An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions
ImportError
def _get_items(self): # TODO: Include .tar.bz2 files for local installs. from ..core.index import get_index args = self.parsed_args call_dict = dict( channel_urls=args.channel or (), use_cache=True, prepend=not args.override_channels, unknown=args.unknown, ) if hasattr(args, "platform"): # in search call_dict["platform"] = args.platform index = get_index(**call_dict) return [record.name for record in index]
def _get_items(self): # TODO: Include .tar.bz2 files for local installs. from conda.core.index import get_index args = self.parsed_args call_dict = dict( channel_urls=args.channel or (), use_cache=True, prepend=not args.override_channels, unknown=args.unknown, ) if hasattr(args, "platform"): # in search call_dict["platform"] = args.platform index = get_index(**call_dict) return [record.name for record in index]
https://github.com/conda/conda/issues/5039
$ conda -h An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions
ImportError
def _get_items(self): from ..core.linked_data import linked packages = linked(context.prefix_w_legacy_search) return [dist.quad[0] for dist in packages]
def _get_items(self): from conda.core.linked_data import linked packages = linked(context.prefix_w_legacy_search) return [dist.quad[0] for dist in packages]
https://github.com/conda/conda/issues/5039
$ conda -h An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions
ImportError
def get_index_trap(*args, **kwargs): """ Retrieves the package index, but traps exceptions and reports them as JSON if necessary. """ from ..core.index import get_index kwargs.pop("json", None) return get_index(*args, **kwargs)
def get_index_trap(*args, **kwargs): """ Retrieves the package index, but traps exceptions and reports them as JSON if necessary. """ from conda.core.index import get_index kwargs.pop("json", None) return get_index(*args, **kwargs)
https://github.com/conda/conda/issues/5039
$ conda -h An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions
ImportError
def handle_envs_list(acc, output=True): from .. import misc if output: print("# conda environments:") print("#") def disp_env(prefix): fmt = "%-20s %s %s" default = "*" if prefix == context.default_prefix else " " name = ROOT_ENV_NAME if prefix == context.root_prefix else basename(prefix) if output: print(fmt % (name, default, prefix)) for prefix in misc.list_prefixes(): disp_env(prefix) if prefix != context.root_prefix: acc.append(prefix) if output: print()
def handle_envs_list(acc, output=True): from conda import misc if output: print("# conda environments:") print("#") def disp_env(prefix): fmt = "%-20s %s %s" default = "*" if prefix == context.default_prefix else " " name = ROOT_ENV_NAME if prefix == context.root_prefix else basename(prefix) if output: print(fmt % (name, default, prefix)) for prefix in misc.list_prefixes(): disp_env(prefix) if prefix != context.root_prefix: acc.append(prefix) if output: print()
https://github.com/conda/conda/issues/5039
$ conda -h An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions
ImportError
def check_write(command, prefix, json=False): if inroot_notwritable(prefix): from .help import root_read_only root_read_only(command, prefix, json=json)
def check_write(command, prefix, json=False): if inroot_notwritable(prefix): from conda.cli.help import root_read_only root_read_only(command, prefix, json=json)
https://github.com/conda/conda/issues/5039
$ conda -h An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions
ImportError
def _main(*args): from ..base.constants import SEARCH_PATH from ..base.context import context from ..gateways.logging import set_all_logger_level, set_verbosity if len(args) == 1: args = args + ("-h",) p, sub_parsers = generate_parser() main_modules = [ "info", "help", "list", "search", "create", "install", "update", "remove", "config", "clean", "package", ] modules = ["conda.cli.main_" + suffix for suffix in main_modules] for module in modules: imported = importlib.import_module(module) imported.configure_parser(sub_parsers) if "update" in module: imported.configure_parser(sub_parsers, name="upgrade") if "remove" in module: imported.configure_parser(sub_parsers, name="uninstall") from .find_commands import find_commands def completer(prefix, **kwargs): return [ i for i in list(sub_parsers.choices) + find_commands() if i.startswith(prefix) ] # when using sys.argv, first argument is generally conda or __main__.py. Ignore it. if any( sname in args[0] for sname in ("conda", "conda.exe", "__main__.py", "conda-script.py") ) and ( args[1] in list(sub_parsers.choices.keys()) + find_commands() or args[1].startswith("-") ): log.debug("Ignoring first argument (%s), as it is not a subcommand", args[0]) args = args[1:] sub_parsers.completer = completer args = p.parse_args(args) context.__init__(SEARCH_PATH, "conda", args) if getattr(args, "json", False): # Silence logging info to avoid interfering with JSON output for logger in ("print", "dotupdate", "stdoutlog", "stderrlog"): getLogger(logger).setLevel(CRITICAL + 1) if context.debug: set_all_logger_level(DEBUG) elif context.verbosity: set_verbosity(context.verbosity) log.debug("verbosity set to %s", context.verbosity) exit_code = args.func(args, p) if isinstance(exit_code, int): return exit_code
def _main(*args): from ..base.constants import SEARCH_PATH from ..base.context import context from ..gateways.logging import set_all_logger_level, set_verbosity if len(args) == 1: args = args + ("-h",) p, sub_parsers = generate_parser() main_modules = [ "info", "help", "list", "search", "create", "install", "update", "remove", "config", "clean", "package", ] modules = ["conda.cli.main_" + suffix for suffix in main_modules] for module in modules: imported = importlib.import_module(module) imported.configure_parser(sub_parsers) if "update" in module: imported.configure_parser(sub_parsers, name="upgrade") if "remove" in module: imported.configure_parser(sub_parsers, name="uninstall") from conda.cli.find_commands import find_commands def completer(prefix, **kwargs): return [ i for i in list(sub_parsers.choices) + find_commands() if i.startswith(prefix) ] # when using sys.argv, first argument is generally conda or __main__.py. Ignore it. if any( sname in args[0] for sname in ("conda", "conda.exe", "__main__.py", "conda-script.py") ) and ( args[1] in list(sub_parsers.choices.keys()) + find_commands() or args[1].startswith("-") ): log.debug("Ignoring first argument (%s), as it is not a subcommand", args[0]) args = args[1:] sub_parsers.completer = completer args = p.parse_args(args) context.__init__(SEARCH_PATH, "conda", args) if getattr(args, "json", False): # Silence logging info to avoid interfering with JSON output for logger in ("print", "dotupdate", "stdoutlog", "stderrlog"): getLogger(logger).setLevel(CRITICAL + 1) if context.debug: set_all_logger_level(DEBUG) elif context.verbosity: set_verbosity(context.verbosity) log.debug("verbosity set to %s", context.verbosity) exit_code = args.func(args, p) if isinstance(exit_code, int): return exit_code
https://github.com/conda/conda/issues/5039
$ conda -h An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions
ImportError
def get_user_site(): site_dirs = [] try: if not on_win: if exists(expanduser("~/.local/lib")): python_re = re.compile("python\d\.\d") for path in listdir(expanduser("~/.local/lib/")): if python_re.match(path): site_dirs.append("~/.local/lib/%s" % path) else: if "APPDATA" not in os.environ: return site_dirs APPDATA = os.environ[str("APPDATA")] if exists(join(APPDATA, "Python")): site_dirs = [ join(APPDATA, "Python", i) for i in listdir(join(APPDATA, "PYTHON")) ] except (IOError, OSError) as e: log.debug("Error accessing user site directory.\n%r", e) return site_dirs
def get_user_site(): site_dirs = [] try: if not on_win: if exists(expanduser("~/.local/lib")): for path in listdir(expanduser("~/.local/lib/")): if python_re.match(path): site_dirs.append("~/.local/lib/%s" % path) else: if "APPDATA" not in os.environ: return site_dirs APPDATA = os.environ[str("APPDATA")] if exists(join(APPDATA, "Python")): site_dirs = [ join(APPDATA, "Python", i) for i in listdir(join(APPDATA, "PYTHON")) ] except (IOError, OSError) as e: log.debug("Error accessing user site directory.\n%r", e) return site_dirs
https://github.com/conda/conda/issues/5039
$ conda -h An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions
ImportError
def pretty_package(dist, pkg): from ..utils import human_bytes pkg = dump_record(pkg) d = OrderedDict( [ ("file name", dist.to_filename()), ("name", pkg["name"]), ("version", pkg["version"]), ("build string", pkg["build"]), ("build number", pkg["build_number"]), ("channel", dist.channel), ("size", human_bytes(pkg["size"])), ] ) for key in sorted(set(pkg.keys()) - SKIP_FIELDS): d[key] = pkg[key] print() header = "%s %s %s" % (d["name"], d["version"], d["build string"]) print(header) print("-" * len(header)) for key in d: print("%-12s: %s" % (key, d[key])) print("dependencies:") for dep in pkg["depends"]: print(" %s" % dep)
def pretty_package(dist, pkg): from conda.utils import human_bytes pkg = dump_record(pkg) d = OrderedDict( [ ("file name", dist.to_filename()), ("name", pkg["name"]), ("version", pkg["version"]), ("build string", pkg["build"]), ("build number", pkg["build_number"]), ("channel", dist.channel), ("size", human_bytes(pkg["size"])), ] ) for key in sorted(set(pkg.keys()) - SKIP_FIELDS): d[key] = pkg[key] print() header = "%s %s %s" % (d["name"], d["version"], d["build string"]) print(header) print("-" * len(header)) for key in d: print("%-12s: %s" % (key, d[key])) print("dependencies:") for dep in pkg["depends"]: print(" %s" % dep)
https://github.com/conda/conda/issues/5039
$ conda -h An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions
ImportError
def execute(args, parser): from ..base.context import context if args.root: if context.json: stdout_json({"root_prefix": context.root_prefix}) else: print(context.root_prefix) return if args.packages: print_package_info(args.packages) return if args.unsafe_channels: if not context.json: print("\n".join(context.channels)) else: print(json.dumps({"channels": context.channels})) return 0 options = "envs", "system", "license" if args.all or context.json: for option in options: setattr(args, option, True) info_dict = get_info_dict(args.system) if ( args.all or all(not getattr(args, opt) for opt in options) ) and not context.json: print(get_main_info_str(info_dict)) if args.envs: handle_envs_list(info_dict["envs"], not context.json) if args.system: if not context.json: from .find_commands import find_commands, find_executable print("sys.version: %s..." % (sys.version[:40])) print("sys.prefix: %s" % sys.prefix) print("sys.executable: %s" % sys.executable) print("conda location: %s" % info_dict["conda_location"]) for cmd in sorted(set(find_commands() + ["build"])): print("conda-%s: %s" % (cmd, find_executable("conda-" + cmd))) print("user site dirs: ", end="") site_dirs = get_user_site() if site_dirs: print(site_dirs[0]) else: print() for site_dir in site_dirs[1:]: print(" %s" % site_dir) print() for name, value in sorted(iteritems(info_dict["env_vars"])): print("%s: %s" % (name, value)) print() if args.license and not context.json: try: from _license import show_info show_info() except ImportError: print("""\ WARNING: could not import _license.show_info # try: # $ conda install -n root _license""") if context.json: stdout_json(info_dict)
def execute(args, parser): import os from os.path import dirname import conda from conda.base.context import context from conda.models.channel import offline_keep from conda.resolve import Resolve from conda.api import get_index from conda.connection import user_agent if args.root: if context.json: stdout_json({"root_prefix": context.root_prefix}) else: print(context.root_prefix) return if args.packages: index = get_index() r = Resolve(index) if context.json: stdout_json( { package: [ dump_record(r.index[d]) for d in r.get_dists_for_spec(arg2spec(package)) ] for package in args.packages } ) else: for package in args.packages: for dist in r.get_dists_for_spec(arg2spec(package)): pretty_package(dist, r.index[dist]) return options = "envs", "system", "license" try: from conda.install import linked_data root_pkgs = linked_data(context.root_prefix) except: root_pkgs = None try: import requests requests_version = requests.__version__ except ImportError: requests_version = "could not import" except Exception as e: requests_version = "Error %s" % e try: import conda_env conda_env_version = conda_env.__version__ except: try: cenv = [p for p in itervalues(root_pkgs) if p["name"] == "conda-env"] conda_env_version = cenv[0]["version"] except: conda_env_version = "not installed" try: import conda_build except ImportError: conda_build_version = "not installed" except Exception as e: conda_build_version = "Error %s" % e else: conda_build_version = conda_build.__version__ channels = context.channels if args.unsafe_channels: if not context.json: print("\n".join(channels)) else: print(json.dumps({"channels": channels})) return 0 channels = list(prioritize_channels(channels).keys()) if not context.json: channels = [c + ("" if offline_keep(c) else " (offline)") for c in channels] channels = [mask_anaconda_token(c) for c in channels] info_dict = dict( platform=context.subdir, conda_version=conda.__version__, conda_env_version=conda_env_version, conda_build_version=conda_build_version, root_prefix=context.root_prefix, conda_prefix=context.conda_prefix, conda_private=context.conda_private, root_writable=context.root_writable, pkgs_dirs=context.pkgs_dirs, envs_dirs=context.envs_dirs, default_prefix=context.default_prefix, channels=channels, rc_path=rc_path, user_rc_path=user_rc_path, sys_rc_path=sys_rc_path, # is_foreign=bool(foreign), offline=context.offline, envs=[], python_version=".".join(map(str, sys.version_info)), requests_version=requests_version, user_agent=user_agent, ) if not on_win: info_dict["UID"] = os.geteuid() info_dict["GID"] = os.getegid() if args.all or context.json: for option in options: setattr(args, option, True) if ( args.all or all(not getattr(args, opt) for opt in options) ) and not context.json: for key in "pkgs_dirs", "envs_dirs", "channels": info_dict["_" + key] = ("\n" + 26 * " ").join(info_dict[key]) info_dict["_rtwro"] = "writable" if info_dict["root_writable"] else "read only" print( """\ Current conda install: platform : %(platform)s conda version : %(conda_version)s conda is private : %(conda_private)s conda-env version : %(conda_env_version)s conda-build version : %(conda_build_version)s python version : %(python_version)s requests version : %(requests_version)s root environment : %(root_prefix)s (%(_rtwro)s) default environment : %(default_prefix)s envs directories : %(_envs_dirs)s package cache : %(_pkgs_dirs)s channel URLs : %(_channels)s config file : %(rc_path)s offline mode : %(offline)s user-agent : %(user_agent)s\ """ % info_dict ) if not on_win: print( """\ UID:GID : %(UID)s:%(GID)s """ % info_dict ) else: print() if args.envs: handle_envs_list(info_dict["envs"], not context.json) if args.system: from conda.cli.find_commands import find_commands, find_executable site_dirs = get_user_site() evars = [ "PATH", "PYTHONPATH", "PYTHONHOME", "CONDA_DEFAULT_ENV", "CIO_TEST", "CONDA_ENVS_PATH", ] if context.platform == "linux": evars.append("LD_LIBRARY_PATH") elif context.platform == "osx": evars.append("DYLD_LIBRARY_PATH") if context.json: info_dict["sys.version"] = sys.version info_dict["sys.prefix"] = sys.prefix info_dict["sys.executable"] = sys.executable info_dict["site_dirs"] = get_user_site() info_dict["env_vars"] = {ev: os.getenv(ev, "<not set>") for ev in evars} else: print("sys.version: %s..." % (sys.version[:40])) print("sys.prefix: %s" % sys.prefix) print("sys.executable: %s" % sys.executable) print("conda location: %s" % dirname(conda.__file__)) for cmd in sorted(set(find_commands() + ["build"])): print("conda-%s: %s" % (cmd, find_executable("conda-" + cmd))) print("user site dirs: ", end="") if site_dirs: print(site_dirs[0]) else: print() for site_dir in site_dirs[1:]: print(" %s" % site_dir) print() for ev in sorted(evars): print("%s: %s" % (ev, os.getenv(ev, "<not set>"))) print() if args.license and not context.json: try: from _license import show_info show_info() except ImportError: print("""\ WARNING: could not import _license.show_info # try: # $ conda install -n root _license""") if context.json: stdout_json(info_dict)
https://github.com/conda/conda/issues/5039
$ conda -h An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions
ImportError