repo
stringclasses
856 values
pull_number
int64
3
127k
instance_id
stringlengths
12
58
issue_numbers
sequencelengths
1
5
base_commit
stringlengths
40
40
patch
stringlengths
67
1.54M
test_patch
stringlengths
0
107M
problem_statement
stringlengths
3
307k
hints_text
stringlengths
0
908k
created_at
timestamp[s]
conda/conda
4,325
conda__conda-4325
[ "4322" ]
291b3a7304c5c60fe290272455ad182d09828485
diff --git a/conda/common/compat.py b/conda/common/compat.py --- a/conda/common/compat.py +++ b/conda/common/compat.py @@ -155,6 +155,10 @@ def ensure_text_type(value): return value.decode('utf-8') if hasattr(value, 'decode') else value +def ensure_unicode(value): + return value.decode('unicode_escape') if hasattr(value, 'decode') else value + + # TODO: move this somewhere else # work-around for python bug on Windows prior to python 3.2 # https://bugs.python.org/issue10027 diff --git a/conda/core/index.py b/conda/core/index.py --- a/conda/core/index.py +++ b/conda/core/index.py @@ -11,13 +11,12 @@ from os import makedirs from os.path import getmtime, join import re +from requests.exceptions import ConnectionError, HTTPError, SSLError +from requests.packages.urllib3.exceptions import InsecureRequestWarning from textwrap import dedent from time import time import warnings -from requests.exceptions import ConnectionError, HTTPError, SSLError -from requests.packages.urllib3.exceptions import InsecureRequestWarning - from .linked_data import linked_data from .package_cache import PackageCache from .._vendor.auxlib.entity import EntityEncoder @@ -25,7 +24,7 @@ from .._vendor.auxlib.logz import stringify from ..base.constants import (CONDA_HOMEPAGE_URL, MAX_CHANNEL_PRIORITY) from ..base.context import context -from ..common.compat import ensure_text_type, iteritems, iterkeys, itervalues +from ..common.compat import ensure_text_type, ensure_unicode, iteritems, iterkeys, itervalues from ..common.url import join_url from ..connection import CondaSession from ..exceptions import CondaHTTPError, CondaRuntimeError @@ -149,7 +148,7 @@ def read_mod_and_etag(path): try: with closing(mmap(f.fileno(), 0, access=ACCESS_READ)) as m: match_objects = take(3, re.finditer(REPODATA_HEADER_RE, m)) - result = dict(map(ensure_text_type, mo.groups()) for mo in match_objects) + result = dict(map(ensure_unicode, mo.groups()) for mo in match_objects) return result except ValueError: # ValueError: cannot mmap an empty file
conda sends bad HTTP headers when querying noarch repos ``conda 4.3`` requires package repositories to provide the ``noarch`` platform directory. After adding ``noarch`` to my custom repository served by Microsoft ``IIS 7.5``, conda started failing after a few runs of ``conda install``: ``` $ conda install conda Fetching package metadata .... CondaHTTPError: HTTP 400 BAD REQUEST for url <http://myrepo/packages/noarch/repodata.json> An HTTP error occurred when trying to retrieve this URL. HTTPError(u'400 Client Error: Bad Request for url: http://myrepo/packages/noarch/repodata.json',) ``` Inspecting the HTTP headers sent by conda, it seems that the ETag ``If-None-Match`` contains bad characters: ``` $ conda install conda --debug DEBUG conda.core.index:fetch_repodata(368): Locally invalidating cached repodata for http://myrepo/packages/noarch at C:\Anaconda2\pkgs\cache\8beb19b1.json DEBUG requests.packages.urllib3.connectionpool:_make_request(400): http://dproxy:8080 "GET http://myrepo/packages/noarch/repodata.json HTTP/1.1" 400 311 DEBUG conda.core.index:fetch_repodata_remote_request(193): >>GET /packages/noarch/repodata.json HTTP > User-Agent: conda/4.3.4 requests/2.12.4 CPython/2.7.13 Windows/7 Windows/6.1.7601 > Accept: */* > Accept-Encoding: gzip, deflate, compress, identity > Connection: keep-alive > Content-Type: application/json > If-Modified-Since: Mon, 16 Jan 2017 15:27:55 GMT > If-None-Match: \"b7eece1bd70d21:0\" <<HTTP 400 Bad Request < Content-Type: text/html; charset=us-ascii < Date: Mon, 16 Jan 2017 15:30:47 GMT < Proxy-Connection: Keep-Alive < Server: Microsoft-HTTPAPI/2.0 < Content-Length: 311 < Elapsed: 00:00.006000 ``` As you can see, the value of ``If-None-Match`` contains extra ``\"``, which IIS interprets as invalid. Stripping out these characters makes the request go through the server without any problems. Note that this happens only when conda queries the ``noarch`` subdirectory. All other platform subdirs work fine. Also note that this does not happen immediately; it takes a few retries until conda starts sending the malformed header.
Thanks for the report. I've tracked down the problem. Working on the solution now.
2017-01-16T19:17:58
conda/conda
4,326
conda__conda-4326
[ "4299" ]
cb4bbbdbef1f5b90f53768d780ed297f5f584813
diff --git a/conda/gateways/download.py b/conda/gateways/download.py --- a/conda/gateways/download.py +++ b/conda/gateways/download.py @@ -73,7 +73,9 @@ def download(url, target_full_path, md5sum): with open(target_full_path, 'wb') as fh: streamed_bytes = 0 for chunk in resp.iter_content(2 ** 14): - streamed_bytes += len(chunk) + # chunk could be the decompressed form of the real data + # but we want the exact number of bytes read till now + streamed_bytes = resp.raw.tell() try: fh.write(chunk) except IOError as e: @@ -95,10 +97,9 @@ def download(url, target_full_path, md5sum): Content-Length: %(content_length)d downloaded bytes: %(downloaded_bytes)d """) - # raise CondaError(message, url=url, target_path=target_full_path, - # content_length=content_length, - # downloaded_bytes=streamed_bytes) - log.info(message) + raise CondaError(message, url=url, target_path=target_full_path, + content_length=content_length, + downloaded_bytes=streamed_bytes) except (IOError, OSError) as e: if e.errno == 104:
Conda 4.3.4 seems to be broken ``` bag@bag ~ % conda --version conda 4.3.4 bag@bag ~ % conda install -y --file https://raw.githubusercontent.com/bioconda/bioconda-utils/master/bioconda_utils/bioconda_utils-requirements.txt CondaError: Downloaded bytes did not match Content-Length url: https://raw.githubusercontent.com/bioconda/bioconda-utils/master/bioconda_utils/bioconda_utils-requirements.txt target_path: /tmp/tmpUp36pQ/bioconda_utils-requirements.txt Content-Length: 195 downloaded bytes: 310 bag@bag ~ % ```
Seems like https://github.com/conda/conda/commit/24ad4709#diff-e524c3264718c66b34ea0dadbfc2559fR88 introduced the bug. The request header sent by `requests.session` in this case has: ```bash 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*' ``` AFAIK, the `Content-Length` header holds the raw length of the HTTP body. So, in this case, it will show 195 bytes, which is the size of the compressed 310 bytes. If you do: `print(len(resp.raw.data))` you will see 195. Sort of relevant discussion at: https://github.com/kennethreitz/requests/issues/2155
2017-01-16T20:00:14
conda/conda
4,327
conda__conda-4327
[ "4323" ]
291b3a7304c5c60fe290272455ad182d09828485
diff --git a/conda/__init__.py b/conda/__init__.py --- a/conda/__init__.py +++ b/conda/__init__.py @@ -6,7 +6,9 @@ """OS-agnostic, system-level binary package manager.""" from __future__ import absolute_import, division, print_function, unicode_literals +import os from os.path import dirname +import sys from ._vendor.auxlib.packaging import get_version from .common.compat import iteritems, text_type @@ -25,6 +27,10 @@ __summary__ = __doc__ __url__ = "https://github.com/conda/conda" + +if os.getenv('CONDA_ROOT') is None: + os.environ['CONDA_ROOT'] = sys.prefix + CONDA_PACKAGE_ROOT = dirname(__file__)
Channels in centrally installed .condarc file are being ignored in conda 4.3.4 Hi, I am testing a centrally installed Anaconda setup with Anaconda installed under `C:\Program Files\Anaconda3`. I have a condarc file under `C:\Program Files\Anaconda3\.condarc`. When I run `conda info` it tells me that my config file is under the correct location. config file : C:\Program Files\Anaconda3\.condarc I have configured a few custom channels in this `.condarc` file, e.g.: channels: - http://some.internal/url I can also use `conda config --system --add channels http://some.internal/url` to set this value and conda tells me that channels already contains this value. But when I run `conda config --system --show`, the list of channels is always set to: channels: - defaults It seems that the list of channels in the central `.condarc` file is completely ignored and always replaced by `defaults`. I have also tried to set the list of `default_channels` in the central `.condarc` file but without success. Using conda 4.3.4 on win-64.
Definitely a problem. Thanks for the report. I'll investigate.
2017-01-16T21:07:55
conda/conda
4,329
conda__conda-4329
[ "4316" ]
291b3a7304c5c60fe290272455ad182d09828485
diff --git a/conda/cli/activate.py b/conda/cli/activate.py --- a/conda/cli/activate.py +++ b/conda/cli/activate.py @@ -94,8 +94,26 @@ def pathlist_to_str(paths, escape_backslashes=True): return path +def get_activate_path(shelldict): + arg_num = len(sys.argv) + if arg_num != 4: + num_expected = 2 + if arg_num < 4: + raise TooFewArgumentsError(num_expected, arg_num - num_expected, + "..activate expected exactly two arguments:\ + shell and env name") + if arg_num > 4: + raise TooManyArgumentsError(num_expected, arg_num - num_expected, sys.argv[2:], + "..activate expected exactly two arguments:\ + shell and env name") + binpath = binpath_from_arg(sys.argv[3], shelldict=shelldict) + + # prepend our new entries onto the existing path and make sure that the separator is native + path = shelldict['pathsep'].join(binpath) + return path + + def main(): - from conda.base.context import context from conda.base.constants import ROOT_ENV_NAME from conda.utils import shells if '-h' in sys.argv or '--help' in sys.argv: @@ -105,25 +123,26 @@ def main(): if len(sys.argv) > 2: shell = sys.argv[2] shelldict = shells[shell] + else: + shelldict = {} + if sys.argv[1] == '..activate': - arg_num = len(sys.argv) - if arg_num != 4: - num_expected = 2 - if arg_num < 4: - raise TooFewArgumentsError(num_expected, arg_num - num_expected, - "..activate expected exactly two arguments:\ - shell and env name") - if arg_num > 4: - raise TooManyArgumentsError(num_expected, arg_num - num_expected, sys.argv[2:], - "..activate expected exactly two arguments:\ - shell and env name") - binpath = binpath_from_arg(sys.argv[3], shelldict=shelldict) - - # prepend our new entries onto the existing path and make sure that the separator is native - path = shelldict['pathsep'].join(binpath) - - # deactivation is handled completely in shell scripts - it restores backups of env variables. - # It is done in shell scripts because they handle state much better than we can here. + 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['PATH'], 1) + else: + new_path = re.sub(r'%s(:?)' % re.escape(activation_path), r'', os.environ['PATH'], 1) + + print(new_path) + sys.exit(0) elif sys.argv[1] == '..checkenv': if len(sys.argv) < 4: @@ -143,6 +162,7 @@ def main(): # 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_dir, shell) except (IOError, OSError) as e: diff --git a/conda/cli/main.py b/conda/cli/main.py --- a/conda/cli/main.py +++ b/conda/cli/main.py @@ -83,29 +83,8 @@ def generate_parser(): def _main(*args): from ..base.constants import SEARCH_PATH from ..base.context import context - from ..common.compat import on_win - from ..gateways.logging import set_all_logger_level, set_verbosity - from ..exceptions import CommandNotFoundError - 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: - argv1 = args[1].strip() - if argv1 in ('..activate', '..deactivate', '..checkenv', '..changeps1'): - import conda.cli.activate as activate - activate.main() - return - if argv1 in ('activate', 'deactivate'): - - message = "'%s' is not a conda command.\n" % argv1 - if not on_win: - message += ' Did you mean "source %s" ?\n' % ' '.join(args[1:]) - raise CommandNotFoundError(argv1, message) + from ..gateways.logging import set_all_logger_level, set_verbosity if len(args) == 1: args.append('-h') @@ -161,6 +140,29 @@ def completer(prefix, **kwargs): 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: + argv1 = args[1].strip() + if argv1.startswith('..'): + import conda.cli.activate as activate + activate.main() + return + if argv1 in ('activate', 'deactivate'): + + message = "'%s' is not a conda command.\n" % argv1 + from ..common.compat import on_win + if not on_win: + message += ' Did you mean "source %s" ?\n' % ' '.join(args[1:]) + + from ..exceptions import CommandNotFoundError + raise CommandNotFoundError(argv1, message) + from ..exceptions import conda_exception_handler return conda_exception_handler(_main, *args) diff --git a/conda/cli/main_info.py b/conda/cli/main_info.py --- a/conda/cli/main_info.py +++ b/conda/cli/main_info.py @@ -245,7 +245,7 @@ def execute(args, parser): for option in options: setattr(args, option, True) - if args.all or all(not getattr(args, opt) for opt in options): + 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
deactivate bug @kevinzzz007 your issue reported in #4275 is different than what #4275 is reporting. I've created a new issue here. > I have a similar problem, I created an env with a name that does not start with an underscore, first I can successfully activate this env, but when I type source deactivate when inside the env, I get an error as the following /Users/MyName/anaconda3/envs/EnvName/bin/deactivate:81: no such file or directory: /Users/MyName/anaconda3/envs/EnvName/bin/python, I looked at the /Users/MyName/anaconda3/envs/EnvName/bin directory and there is no python file in this directory, and after I typed the source deactivate command, my command prompt seems to be back to normal, but then the command prompt can't recognize simple commands like ls... > my conda version is 4.3.4
This logic has changed recently, and it's also in the latest release of 4.2. I'll try to fix this tomorrow. @kalefranz thank you so much!
2017-01-16T23:21:15
conda/conda
4,361
conda__conda-4361
[ "4324" ]
801252baac3b5cd229a90e035b302d5dfaef3c48
diff --git a/conda/plan.py b/conda/plan.py --- a/conda/plan.py +++ b/conda/plan.py @@ -773,7 +773,7 @@ def remove_actions(prefix, specs, index, force=False, pinned=True): name = r.package_name(old_dist) if old_dist == nlinked.get(name): continue - if pinned and any(r.match(ms, old_dist.to_filename()) for ms in pinned_specs): + if pinned and any(r.match(ms, old_dist) for ms in pinned_specs): msg = "Cannot remove %s because it is pinned. Use --no-pin to override." raise CondaRuntimeError(msg % old_dist.to_filename()) if context.conda_in_root and name == 'conda' and name not in nlinked and not context.force:
KeyError when removing package We see the following KeyError when trying to remove a conda package, we've just upgraded from using conda 4.1.3 to 4.3.4. The last version that seems to work is 4.1.12, however 4.2.x may work as well for this issue, but it cannot get into this point due to unrelated (http, condahttp, etc) errors. Full details are in the following travis log: https://travis-ci.org/astropy/package-template/jobs/192393894 Test runs for checking which one is the latest working version are here: https://travis-ci.org/bsipocz/package-template/builds/192422476 ``` Current conda install: platform : linux-64 conda version : 4.3.4 conda is private : False conda-env version : 4.3.4 conda-build version : not installed python version : 2.7.13.final.0 requests version : 2.12.4 root environment : /home/travis/miniconda (writable) default environment : /home/travis/miniconda/envs/test envs directories : /home/travis/miniconda/envs package cache : /home/travis/miniconda/pkgs channel URLs : https://conda.anaconda.org/astropy-ci-extras astropy/linux-64 https://conda.anaconda.org/astropy-ci-extras astropy/noarch https://conda.anaconda.org/astropy/linux-64 https://conda.anaconda.org/astropy/noarch https://conda.anaconda.org/astropy-ci-extras/linux-64 https://conda.anaconda.org/astropy-ci-extras/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 offline mode : False user-agent : conda/4.3.4 requests/2.12.4 CPython/2.7.13 Linux/4.8.12-040812-generic debian/wheezy/sid glibc/2.15 UID:GID : 1000:1000 `$ /home/travis/miniconda/envs/test/bin/conda remove astropy --force` Traceback (most recent call last): File "/home/travis/miniconda/lib/python2.7/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/home/travis/miniconda/lib/python2.7/site-packages/conda/cli/main.py", line 158, in _main exit_code = args.func(args, p) File "/home/travis/miniconda/lib/python2.7/site-packages/conda/cli/main_remove.py", line 164, in execute pinned=args.pinned)) File "/home/travis/miniconda/lib/python2.7/site-packages/conda/plan.py", line 776, in remove_actions if pinned and any(r.match(ms, old_dist.to_filename()) for ms in pinned_specs): File "/home/travis/miniconda/lib/python2.7/site-packages/conda/plan.py", line 776, in <genexpr> if pinned and any(r.match(ms, old_dist.to_filename()) for ms in pinned_specs): File "/home/travis/miniconda/lib/python2.7/site-packages/conda/resolve.py", line 474, in match rec = self.index[fkey] KeyError: u'astropy-1.0.3-np19py33_0.tar.bz2' ``` cc @astrofrog
Thanks for the report. Digging in soon. @kalefranz - I wonder why did you close this, is it already fixed in master? I still see this Keyerror with version 4.3.5 https://travis-ci.org/bsipocz/package-template/jobs/193123449 I didn't know I did!!!! It wasn't intentional. Unless I thought it was fixed. Looking again...
2017-01-18T18:32:52
conda/conda
4,370
conda__conda-4370
[ "4351", "4351" ]
1d9f6da81f3ba64f6184f703f4ba7515969b17c0
diff --git a/conda/resolve.py b/conda/resolve.py --- a/conda/resolve.py +++ b/conda/resolve.py @@ -263,7 +263,10 @@ def invalid_chains(self, spec, filter): A generator of tuples, empty if the MatchSpec is valid. """ def chains_(spec, names): - if self.valid(spec, filter) or spec.name in names: + if spec.name in names: + return + names.add(spec.name) + if self.valid(spec, filter): return dists = self.find_matches(spec) if isinstance(spec, MatchSpec) else [Dist(spec)] found = False
Jupyter install on 3.6 env crashes conda with infinite recursion This is a fairly fresh py3.6 env. Error trace follows (I snipped the hundreds of redundant frames in the middle of the recursion for readability, all non-redundant info kept): ``` (py36) denali[~]> conda install jupyter 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 : osx-64 conda version : 4.3.4 conda is private : False conda-env version : 4.3.4 conda-build version : not installed python version : 3.5.2.final.0 requests version : 2.12.4 root environment : /Users/fperez/usr/conda (writable) default environment : /Users/fperez/usr/conda/envs/py36 envs directories : /Users/fperez/usr/conda/envs package cache : /Users/fperez/usr/conda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : /Users/fperez/.condarc offline mode : False user-agent : conda/4.3.4 requests/2.12.4 CPython/3.5.2 Darwin/15.6.0 OSX/10.11.6 UID:GID : 33212:20665 `$ /Users/fperez/usr/conda/envs/py36/bin/conda install jupyter` Traceback (most recent call last): File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/cli/main.py", line 158, in _main exit_code = args.func(args, p) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/cli/install.py", line 240, in install channel_priority_map=_channel_priority_map, is_update=isupdate) File "/Users/fperez/usr/conda/lib/python3.5/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/cli/common.py", line 591, in json_progress_bars yield File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/cli/install.py", line 240, in install channel_priority_map=_channel_priority_map, is_update=isupdate) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/plan.py", line 516, in install_actions_list for dists_by_prefix in required_solves] File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/plan.py", line 516, in <listcomp> for dists_by_prefix in required_solves] File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/plan.py", line 662, in get_actions_for_dists pkgs = r.install(specs, installed, update_deps=update_deps) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 814, in install pkgs = self.solve(specs, returnall=returnall) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 868, in solve self.find_conflicts(specs) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 364, in find_conflicts ndeps = set(self.invalid_chains(ms, filter)) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 273, in chains_ for x in chains_(m2, names): File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 273, in chains_ for x in chains_(m2, names): File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 273, in chains_ [ snip intermediate frames, all like these ones. Tail of the traceback follows: ] File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 273, in chains_ for x in chains_(m2, names): File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 266, in chains_ if self.valid(spec, filter) or spec.name in names: File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 245, in valid result = v_(spec_or_dist) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 232, in v_ return v_ms_(spec) if isinstance(spec, MatchSpec) else v_fkey_(spec) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 235, in v_ms_ return ms.optional or any(v_fkey_(fkey) for fkey in self.find_matches(ms)) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 235, in <genexpr> return ms.optional or any(v_fkey_(fkey) for fkey in self.find_matches(ms)) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 239, in v_fkey_ val = filter.get(dist) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/models/dist.py", line 243, in __hash__ return hash(self.__key__()) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/models/dist.py", line 224, in __key__ return self.channel, self.dist_name, self.with_features_depends File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/_vendor/auxlib/entity.py", line 414, in __get__ if val is None and not self.nullable: File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/_vendor/auxlib/entity.py", line 485, in nullable return self.is_nullable RecursionError: maximum recursion depth exceeded ``` Jupyter install on 3.6 env crashes conda with infinite recursion This is a fairly fresh py3.6 env. Error trace follows (I snipped the hundreds of redundant frames in the middle of the recursion for readability, all non-redundant info kept): ``` (py36) denali[~]> conda install jupyter 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 : osx-64 conda version : 4.3.4 conda is private : False conda-env version : 4.3.4 conda-build version : not installed python version : 3.5.2.final.0 requests version : 2.12.4 root environment : /Users/fperez/usr/conda (writable) default environment : /Users/fperez/usr/conda/envs/py36 envs directories : /Users/fperez/usr/conda/envs package cache : /Users/fperez/usr/conda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : /Users/fperez/.condarc offline mode : False user-agent : conda/4.3.4 requests/2.12.4 CPython/3.5.2 Darwin/15.6.0 OSX/10.11.6 UID:GID : 33212:20665 `$ /Users/fperez/usr/conda/envs/py36/bin/conda install jupyter` Traceback (most recent call last): File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/cli/main.py", line 158, in _main exit_code = args.func(args, p) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/cli/install.py", line 240, in install channel_priority_map=_channel_priority_map, is_update=isupdate) File "/Users/fperez/usr/conda/lib/python3.5/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/cli/common.py", line 591, in json_progress_bars yield File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/cli/install.py", line 240, in install channel_priority_map=_channel_priority_map, is_update=isupdate) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/plan.py", line 516, in install_actions_list for dists_by_prefix in required_solves] File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/plan.py", line 516, in <listcomp> for dists_by_prefix in required_solves] File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/plan.py", line 662, in get_actions_for_dists pkgs = r.install(specs, installed, update_deps=update_deps) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 814, in install pkgs = self.solve(specs, returnall=returnall) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 868, in solve self.find_conflicts(specs) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 364, in find_conflicts ndeps = set(self.invalid_chains(ms, filter)) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 273, in chains_ for x in chains_(m2, names): File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 273, in chains_ for x in chains_(m2, names): File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 273, in chains_ [ snip intermediate frames, all like these ones. Tail of the traceback follows: ] File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 273, in chains_ for x in chains_(m2, names): File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 266, in chains_ if self.valid(spec, filter) or spec.name in names: File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 245, in valid result = v_(spec_or_dist) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 232, in v_ return v_ms_(spec) if isinstance(spec, MatchSpec) else v_fkey_(spec) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 235, in v_ms_ return ms.optional or any(v_fkey_(fkey) for fkey in self.find_matches(ms)) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 235, in <genexpr> return ms.optional or any(v_fkey_(fkey) for fkey in self.find_matches(ms)) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 239, in v_fkey_ val = filter.get(dist) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/models/dist.py", line 243, in __hash__ return hash(self.__key__()) File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/models/dist.py", line 224, in __key__ return self.channel, self.dist_name, self.with_features_depends File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/_vendor/auxlib/entity.py", line 414, in __get__ if val is None and not self.nullable: File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/_vendor/auxlib/entity.py", line 485, in nullable return self.is_nullable RecursionError: maximum recursion depth exceeded ```
@fperez Thanks for the report. @mcg1969 I know the stack trace ends in auxlib/entity, but it looks like the recursion is happening at File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 273, in chains_ for x in chains_(m2, names): when the stack blows. Is there anything obvious that you see? If not, I'll dig in. Actually, I believe I hit that recursion error in my supersedes branch. Take a look at the second commit there. (Which of course I can do myself when I get to my desk.) Cool. We should pull that recursion fix out and aim it at 4.3.x. @fperez Thanks for the report. @mcg1969 I know the stack trace ends in auxlib/entity, but it looks like the recursion is happening at File "/Users/fperez/usr/conda/lib/python3.5/site-packages/conda/resolve.py", line 273, in chains_ for x in chains_(m2, names): when the stack blows. Is there anything obvious that you see? If not, I'll dig in. Actually, I believe I hit that recursion error in my supersedes branch. Take a look at the second commit there. (Which of course I can do myself when I get to my desk.) Cool. We should pull that recursion fix out and aim it at 4.3.x.
2017-01-18T21:12:59
conda/conda
4,392
conda__conda-4392
[ "4309", "4309" ]
cebd69e01d1cf7bb02aebb66e2f4d75c760eccb4
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -2,6 +2,7 @@ from __future__ import absolute_import, division, print_function, unicode_literals from abc import ABCMeta, abstractmethod, abstractproperty +from errno import EXDEV import json from logging import getLogger from os.path import dirname, join @@ -793,7 +794,18 @@ def execute(self): if lexists(self.hold_path): rm_rf(self.hold_path) if lexists(self.target_full_path): - backoff_rename(self.target_full_path, self.hold_path) + try: + backoff_rename(self.target_full_path, self.hold_path) + except (IOError, OSError) as e: + if e.errno == EXDEV: + # OSError(18, 'Invalid cross-device link') + # https://github.com/docker/docker/issues/25409 + # ignore, but we won't be able to roll back + log.debug("Invalid cross-device link on rename %s => %s", + self.target_full_path, self.hold_path) + rm_rf(self.target_full_path) + else: + raise extract_tarball(self.source_full_path, self.target_full_path) target_package_cache = PackageCache(self.target_pkgs_dir)
Conda exits with: Invalid cross-device link While building a docker image with docker-1.2.6 on ubuntu-16.0.4 I error: OSError(18, 'Invalid cross-device link') Here is the debug output: `An unexpected error has occurred. | Time: 0:00:00 803.99 kB/s 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.4 conda is private : False conda-env version : 4.3.4 conda-build version : not installed python version : 3.5.2.final.0 requests version : 2.12.4 root environment : /root/miniconda3 (writable) default environment : /root/miniconda3 envs directories : /root/miniconda3/envs package cache : /root/miniconda3/pkgs channel URLs : 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 : None offline mode : False user-agent : conda/4.3.4 requests/2.12.4 CPython/3.5.2 Linux/4.4.0-59-generic debian/stretch/sid glibc/2.23 UID:GID : 0:0 $ /root/miniconda3/bin/conda-env create -f=environment.yml --name carnd-term1 --debug -v -v Traceback (most recent call last): File "/root/miniconda3/lib/python3.5/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/root/miniconda3/lib/python3.5/site-packages/conda_env/cli/main_create.py", line 112, in execute installer.install(prefix, pkg_specs, args, env) File "/root/miniconda3/lib/python3.5/site-packages/conda_env/installers/conda.py", line 37, in install plan.execute_actions(actions, index, verbose=not args.quiet) File "/root/miniconda3/lib/python3.5/site-packages/conda/plan.py", line 837, in execute_actions execute_instructions(plan, index, verbose) File "/root/miniconda3/lib/python3.5/site-packages/conda/instructions.py", line 258, in execute_instructions cmd(state, arg) File "/root/miniconda3/lib/python3.5/site-packages/conda/instructions.py", line 111, in PROGRESSIVEFETCHEXTRACT_CMD progressive_fetch_extract.execute() File "/root/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 467, in execute self._execute_action(action) File "/root/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 489, in _execute_action raise CondaMultiError(exceptions) conda.CondaMultiError: OSError(18, 'Invalid cross-device link') OSError(18, 'Invalid cross-device link') OSError(18, 'Invalid cross-device link') ` Conda exits with: Invalid cross-device link While building a docker image with docker-1.2.6 on ubuntu-16.0.4 I error: OSError(18, 'Invalid cross-device link') Here is the debug output: `An unexpected error has occurred. | Time: 0:00:00 803.99 kB/s 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.4 conda is private : False conda-env version : 4.3.4 conda-build version : not installed python version : 3.5.2.final.0 requests version : 2.12.4 root environment : /root/miniconda3 (writable) default environment : /root/miniconda3 envs directories : /root/miniconda3/envs package cache : /root/miniconda3/pkgs channel URLs : 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 : None offline mode : False user-agent : conda/4.3.4 requests/2.12.4 CPython/3.5.2 Linux/4.4.0-59-generic debian/stretch/sid glibc/2.23 UID:GID : 0:0 $ /root/miniconda3/bin/conda-env create -f=environment.yml --name carnd-term1 --debug -v -v Traceback (most recent call last): File "/root/miniconda3/lib/python3.5/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/root/miniconda3/lib/python3.5/site-packages/conda_env/cli/main_create.py", line 112, in execute installer.install(prefix, pkg_specs, args, env) File "/root/miniconda3/lib/python3.5/site-packages/conda_env/installers/conda.py", line 37, in install plan.execute_actions(actions, index, verbose=not args.quiet) File "/root/miniconda3/lib/python3.5/site-packages/conda/plan.py", line 837, in execute_actions execute_instructions(plan, index, verbose) File "/root/miniconda3/lib/python3.5/site-packages/conda/instructions.py", line 258, in execute_instructions cmd(state, arg) File "/root/miniconda3/lib/python3.5/site-packages/conda/instructions.py", line 111, in PROGRESSIVEFETCHEXTRACT_CMD progressive_fetch_extract.execute() File "/root/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 467, in execute self._execute_action(action) File "/root/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 489, in _execute_action raise CondaMultiError(exceptions) conda.CondaMultiError: OSError(18, 'Invalid cross-device link') OSError(18, 'Invalid cross-device link') OSError(18, 'Invalid cross-device link') `
Thanks for the report. I'm not sure this is a new problem in 4.3, but it might be. Without more debug output (and I'm not sure conda-env can even give more), my guess is that conda is trying to hard-link across two different devices. Changing your command to CONDA_ALWAYS_COPY=true /root/miniconda3/bin/conda-env create -f=environment.yml --name carnd-term1 --debug -v -v should fix your immediate problem. It's possible that conda 4.2 did this better. Can you confirm that this is something new in conda 4.3? Hi, I just got the same error on OSX El Capitan. Reverting to 4.2.12 fixes it. /Rasmus Oops, sorry I forgot that I was working in a Docker container. Debian 8, not OSX :) @rasmusagren Does setting the `CONDA_ALWAYS_COPY=true` environment variable help at all? I will test the workaround tonight. Here is the fragment of my dicker script. It was working last week: ADD https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh tmp/Miniconda3-latest-Linux-x86_64.sh RUN bash tmp/Miniconda3-latest-Linux-x86_64.sh -b ENV PATH $PATH:/root/miniconda3/bin/ COPY environment.yml . RUN conda install --yes pyyaml RUN conda env create -f=environment.yml --name carnd-term1 I am not sure which of the dependencies changed lately. If either of you can reproduce your error without using a `conda env` command (probably just `conda create` or `conda install`), it would be a huge help to add `-vvv` and share the output. It'll be extremely verbose, but it will help me pinpoint what's going on. CONDA_ALWAYS_COPY=true didn't help in my case, but going back to 4.2.12 (debian jessie in Docker 1.12), too (like for rasmusagren) Actually, if you're using a conda-env command that's fine. Just set an environment variable `CONDA_VERBOSE=3`, and then remove the other `--debug` and `-v` flags. @troussan Could you change the line RUN conda env create -f=environment.yml --name carnd-term1 in your docker file to RUN CONDA_VERBOSE=3 conda env create -f=environment.yml --name carnd-term1 and then give me the full output? @kalefranz This produced exactly the same output as the one posted above. Downgrading to 4.2.13 resolves the issue. I'm seeing the same error all of a sudden. Docker version 1.12.3, have tried with Miniconda2-4.2.12-Linux-x86_64.sh and Miniconda2-latest-Linux-x86_64.sh , so at least what I'm seeing isn't a 4.3 issue. Error occurs if I run my docker build from the Dockerfile, but if I use an interactive session & run the install commands one by one it works fine. This is on my list of bugs to quash today. I need to set up a docker environment on my machine first though. There's not yet enough information in this ticket for me to understand that root cause. I had the problem inside a Dockerfile build yesterday and had this error. However, I came past it when downgrading to 4.2.12, also during the Dockerfile built. I think you have to be very careful that conda doesn't manage to upgrade to 4.3 again. Oh nice catch! I had a `conda update conda` in there I'd forgotten about :) I just came across this github issue while trying to debug a problem that started recently with a complicated docker build process. I've got as far boiling my problem down to the following (not yet minimal) example: ``` $ cat Dockerfile FROM continuumio/anaconda3:4.2.0 RUN conda install -y pandas RUN conda install -y -c conda-forge jupyter_contrib_nbextensions $ docker build . --no-cache Sending build context to Docker daemon 568.3 kB Step 1 : FROM continuumio/anaconda3:4.2.0 ---> f44b5cac90c5 Step 2 : RUN conda install -y pandas ---> Running in a129a8f484c5 Fetching package metadata ....... Solving package specifications: .......... Package plan for installation in environment /opt/conda: The following packages will be downloaded: package | build ---------------------------|----------------- conda-env-2.6.0 | 0 502 B requests-2.12.4 | py35_0 800 KB pandas-0.19.2 | np111py35_1 16.7 MB pyopenssl-16.2.0 | py35_0 70 KB conda-4.3.4 | py35_0 487 KB ------------------------------------------------------------ Total: 18.1 MB The following NEW packages will be INSTALLED: conda-env: 2.6.0-0 The following packages will be UPDATED: conda: 4.2.9-py35_0 --> 4.3.4-py35_0 pandas: 0.18.1-np111py35_0 --> 0.19.2-np111py35_1 pyopenssl: 16.0.0-py35_0 --> 16.2.0-py35_0 requests: 2.11.1-py35_0 --> 2.12.4-py35_0 Fetching packages ... conda-env-2.6. 100% |###############################| Time: 0:00:00 377.34 kB/s requests-2.12. 100% |###############################| Time: 0:00:00 1.79 MB/s pandas-0.19.2- 100% |###############################| Time: 0:00:04 4.18 MB/s pyopenssl-16.2 100% |###############################| Time: 0:00:00 951.86 kB/s conda-4.3.4-py 100% |###############################| Time: 0:00:00 2.17 MB/s Extracting packages ... [ COMPLETE ]|##################################################| 100% Unlinking packages ... [ COMPLETE ]|##################################################| 100% Linking packages ... [ COMPLETE ]|##################################################| 100% ---> c82a1ab1c82e Removing intermediate container a129a8f484c5 Step 3 : RUN conda install -y -c conda-forge jupyter_contrib_nbextensions ---> Running in f2d59f035524 Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment /opt/conda: The following NEW packages will be INSTALLED: jupyter_contrib_core: 0.3.0-py35_1 conda-forge jupyter_contrib_nbextensions: 0.2.3-py35_0 conda-forge jupyter_highlight_selected_word: 0.0.7-py35_0 conda-forge jupyter_latex_envs: 1.3.6-py35_0 conda-forge jupyter_nbextensions_configurator: 0.2.3-py35_0 conda-forge The following packages will be SUPERCEDED by a higher-priority channel: conda: 4.3.4-py35_0 --> 4.2.13-py35_0 conda-forge conda-env: 2.6.0-0 --> 2.6.0-0 conda-forge conda-env-2.6. 100% |###############################| Time: 0:00:00 840.02 kB/s conda-4.2.13-p 100% |###############################| Time: 0:00:00 612.71 kB/s jupyter_contri 100% |###############################| Time: 0:00:00 1.10 MB/s jupyter_highli 100% |###############################| Time: 0:00:00 1.05 MB/s jupyter_latex_ 100% |###############################| Time: 0:00:00 1.43 MB/s jupyter_nbexte 100% |###############################| Time: 0:00:00 2.10 MB/s jupyter_contri 88% |########################### | Time: 0:00:02 5.38 MB/s CondaError: OSError(18, 'Invalid cross-device link') CondaError: OSError(18, 'Invalid cross-device link') CondaError: OSError(18, 'Invalid cross-device link') jupyter_contri 100% |###############################| Time: 0:00:02 5.82 MB/s The command '/bin/sh -c conda install -y -c conda-forge jupyter_contrib_nbextensions' returned a non-zero code: 1 ``` I've attached a longer version with verbose output from conda: [verbose.txt](https://github.com/conda/conda/files/712290/verbose.txt) I'm still investigating but wanted to post now because it sounds like @kalefranz might be trying to reproduce the problem at the moment, and maybe this example helps. [EDIT: I cut down the example slightly] To work around this problem for now, I have ``RUN conda config --set auto_update_conda False`` in my Dockerfile before installing any other packages. This did not work for me. Not sure what changed, but all builds with anaconda fail from today with this error. Tried the auto_update_conda work around, the always copy work around, and forced conda to the latest known good version (4.3.4). But everything still fails. After reverting to conda 4.2.x it works again. (Not sure where the passed builds with conda 4.3.4 came from). I'm also hitting this in both Ubuntu and Alpine based Docker containers, and have got a combination of the above to work. @pvanderlinden `conda config --set auto_update_conda False` might not exist in your version of miniconda or whatever you are using to install conda- I got this workaround to work by using Miniconda 3.9.1 to install conda version 4.2.13 and then set no update (otherwise any further installs in the root conda env will try and update conda too). ```RUN cd /tmp && \ mkdir -p $CONDA_DIR && \ wget --quiet https://repo.continuum.io/miniconda/Miniconda3-3.9.1-Linux-x86_64.sh && \ echo "6c6b44acdd0bc4229377ee10d52c8ac6160c336d9cdd669db7371aa9344e1ac3 *Miniconda3-3.9.1-Linux-x86_64.sh" | sha256sum -c - && \ /bin/bash Miniconda3-3.9.1-Linux-x86_64.sh -f -b -p $CONDA_DIR && \ rm Miniconda3-3.9.1-Linux-x86_64.sh && \ $CONDA_DIR/bin/conda install --yes conda=4.2.13 && \ conda config --set auto_update_conda False``` Just adding that I'm encountering the same issue on building a simple debian docker container. Dockerfile and terminal output attached. [dockerfile.txt](https://github.com/conda/conda/files/718699/dockerfile.txt) > >>> >docker build -t webportal . Sending build context to Docker daemon 688.6 kB Step 1 : FROM debian@sha256:32a225e412babcd54c0ea777846183c61003d125278882873fb2bc97f9057c51 ---> bb5d89f9b6cb Step 2 : MAINTAINER Joshua Barber "[email protected]" ---> Using cache ---> d7e4ed8df082 Step 3 : USER root ---> Using cache ---> 44c581a995a0 Step 4 : RUN apt-get update && apt-get install -y python3-pip python-dev build-essential wget & & rm /bin/sh && ln -s /bin/bash /bin/sh ---> Using cache ---> d543e8b94bad Step 5 : ENV APP_ACTIVATE "python ./dashboard.py" ---> Using cache ---> 6a2d47160dd3 Step 6 : ENV ENV_NAME "app-env" ---> Using cache ---> ae7475dfad71 Step 7 : ENV CONDA_DIR /opt/conda ---> Using cache ---> 595847dba965 Step 8 : ENV STARTSCRIPT /code/start.sh ---> Using cache ---> 90e5e94733fb Step 9 : ENV PATH /$CONDA_DIR/bin:${PATH} ---> Using cache ---> b54f6a1666be Step 10 : RUN cd /tmp && mkdir -p $CONDA_DIR && wget --quiet http://repo.continuum.io/miniconda/ Miniconda3-latest-Linux-x86_64.sh && /bin/bash Miniconda3-latest-Linux-x86_64.sh -f -b -p $CONDA_DIR && rm Miniconda3-latest-Linux-x86_64.sh && conda update -y conda && conda clean -tip sy ---> Using cache ---> 4f7b9d129bee Step 11 : COPY . /code ---> b3a42b33dbb6 Removing intermediate container 2719dc0dd065 Step 12 : WORKDIR /code ---> Running in 25fec38bd680 ---> 76c82c34fadf Removing intermediate container 25fec38bd680 Step 13 : RUN conda env create -f environment.yml -n $ENV_NAME ---> Running in d94ecbe505f0 Fetching package metadata ......... Solving package specifications: . libpq-9.5.4-0. 100% |###############################| Time: 0:00:01 65.94 kB/s openssl-1.0.2j 100% |###############################| Time: 0:00:30 108.16 kB/s readline-6.2-2 100% |###############################| Time: 0:00:02 209.19 kB/s sqlite-3.13.0- 100% |###############################| Time: 0:00:18 225.25 kB/s tk-8.5.18-0.ta 100% |###############################| Time: 0:00:12 152.99 kB/s xz-5.2.2-1.tar 100% |###############################| Time: 0:00:07 94.97 kB/s zlib-1.2.8-3.t 100% |###############################| Time: 0:00:01 52.40 kB/s python-3.5.2-0 100% |###############################| Time: 0:01:03 284.78 kB/s click-6.7-py35 100% |###############################| Time: 0:00:01 74.13 kB/s itsdangerous-0 100% |###############################| Time: 0:00:00 250.31 kB/s markupsafe-0.2 100% |###############################| Time: 0:00:00 53.70 kB/s psycopg2-2.6.2 100% |###############################| Time: 0:00:01 223.49 kB/s setuptools-27. 100% |###############################| Time: 0:01:16 7.05 kB/s sqlalchemy-1.0 100% |###############################| Time: 0:00:02 544.09 kB/s werkzeug-0.11. 100% |###############################| Time: 0:00:00 528.79 kB/s wheel-0.29.0-p 100% |###############################| Time: 0:00:00 789.20 kB/s jinja2-2.9.4-p 100% |###############################| Time: 0:00:00 681.72 kB/s pip-9.0.1-py35 33% |########## | Time: 0:00:01 338.21 kB/s > CondaError: OSError(18, 'Invalid cross-device link') > > CondaError: OSError(18, 'Invalid cross-device link') > > CondaError: OSError(18, 'Invalid cross-device link') > > > > pip-9.0.1-py35 100% |###############################| Time: 0:00:04 389.24 kB/s > flask-0.11.1-p 100% |###############################| Time: 0:00:00 526.69 kB/s > The command '/bin/sh -c conda env create -f environment.yml -n $ENV_NAME' returned a non-zero code: 1 @elsmorian Thanks. I'm not disabling the upgrading at the moment, as it is not needed. All my scripts install all python requirements in 2: make sure conda is up to date (or in this occasion force it to the latest 4.2.x), install all conda & pip requirements in one command. This means after this conda installs might fail due to this bug, but should be good enough as a work around. Thanks for the report. I'm not sure this is a new problem in 4.3, but it might be. Without more debug output (and I'm not sure conda-env can even give more), my guess is that conda is trying to hard-link across two different devices. Changing your command to CONDA_ALWAYS_COPY=true /root/miniconda3/bin/conda-env create -f=environment.yml --name carnd-term1 --debug -v -v should fix your immediate problem. It's possible that conda 4.2 did this better. Can you confirm that this is something new in conda 4.3? Hi, I just got the same error on OSX El Capitan. Reverting to 4.2.12 fixes it. /Rasmus Oops, sorry I forgot that I was working in a Docker container. Debian 8, not OSX :) @rasmusagren Does setting the `CONDA_ALWAYS_COPY=true` environment variable help at all? I will test the workaround tonight. Here is the fragment of my dicker script. It was working last week: ADD https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh tmp/Miniconda3-latest-Linux-x86_64.sh RUN bash tmp/Miniconda3-latest-Linux-x86_64.sh -b ENV PATH $PATH:/root/miniconda3/bin/ COPY environment.yml . RUN conda install --yes pyyaml RUN conda env create -f=environment.yml --name carnd-term1 I am not sure which of the dependencies changed lately. If either of you can reproduce your error without using a `conda env` command (probably just `conda create` or `conda install`), it would be a huge help to add `-vvv` and share the output. It'll be extremely verbose, but it will help me pinpoint what's going on. CONDA_ALWAYS_COPY=true didn't help in my case, but going back to 4.2.12 (debian jessie in Docker 1.12), too (like for rasmusagren) Actually, if you're using a conda-env command that's fine. Just set an environment variable `CONDA_VERBOSE=3`, and then remove the other `--debug` and `-v` flags. @troussan Could you change the line RUN conda env create -f=environment.yml --name carnd-term1 in your docker file to RUN CONDA_VERBOSE=3 conda env create -f=environment.yml --name carnd-term1 and then give me the full output? @kalefranz This produced exactly the same output as the one posted above. Downgrading to 4.2.13 resolves the issue. I'm seeing the same error all of a sudden. Docker version 1.12.3, have tried with Miniconda2-4.2.12-Linux-x86_64.sh and Miniconda2-latest-Linux-x86_64.sh , so at least what I'm seeing isn't a 4.3 issue. Error occurs if I run my docker build from the Dockerfile, but if I use an interactive session & run the install commands one by one it works fine. This is on my list of bugs to quash today. I need to set up a docker environment on my machine first though. There's not yet enough information in this ticket for me to understand that root cause. I had the problem inside a Dockerfile build yesterday and had this error. However, I came past it when downgrading to 4.2.12, also during the Dockerfile built. I think you have to be very careful that conda doesn't manage to upgrade to 4.3 again. Oh nice catch! I had a `conda update conda` in there I'd forgotten about :) I just came across this github issue while trying to debug a problem that started recently with a complicated docker build process. I've got as far boiling my problem down to the following (not yet minimal) example: ``` $ cat Dockerfile FROM continuumio/anaconda3:4.2.0 RUN conda install -y pandas RUN conda install -y -c conda-forge jupyter_contrib_nbextensions $ docker build . --no-cache Sending build context to Docker daemon 568.3 kB Step 1 : FROM continuumio/anaconda3:4.2.0 ---> f44b5cac90c5 Step 2 : RUN conda install -y pandas ---> Running in a129a8f484c5 Fetching package metadata ....... Solving package specifications: .......... Package plan for installation in environment /opt/conda: The following packages will be downloaded: package | build ---------------------------|----------------- conda-env-2.6.0 | 0 502 B requests-2.12.4 | py35_0 800 KB pandas-0.19.2 | np111py35_1 16.7 MB pyopenssl-16.2.0 | py35_0 70 KB conda-4.3.4 | py35_0 487 KB ------------------------------------------------------------ Total: 18.1 MB The following NEW packages will be INSTALLED: conda-env: 2.6.0-0 The following packages will be UPDATED: conda: 4.2.9-py35_0 --> 4.3.4-py35_0 pandas: 0.18.1-np111py35_0 --> 0.19.2-np111py35_1 pyopenssl: 16.0.0-py35_0 --> 16.2.0-py35_0 requests: 2.11.1-py35_0 --> 2.12.4-py35_0 Fetching packages ... conda-env-2.6. 100% |###############################| Time: 0:00:00 377.34 kB/s requests-2.12. 100% |###############################| Time: 0:00:00 1.79 MB/s pandas-0.19.2- 100% |###############################| Time: 0:00:04 4.18 MB/s pyopenssl-16.2 100% |###############################| Time: 0:00:00 951.86 kB/s conda-4.3.4-py 100% |###############################| Time: 0:00:00 2.17 MB/s Extracting packages ... [ COMPLETE ]|##################################################| 100% Unlinking packages ... [ COMPLETE ]|##################################################| 100% Linking packages ... [ COMPLETE ]|##################################################| 100% ---> c82a1ab1c82e Removing intermediate container a129a8f484c5 Step 3 : RUN conda install -y -c conda-forge jupyter_contrib_nbextensions ---> Running in f2d59f035524 Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment /opt/conda: The following NEW packages will be INSTALLED: jupyter_contrib_core: 0.3.0-py35_1 conda-forge jupyter_contrib_nbextensions: 0.2.3-py35_0 conda-forge jupyter_highlight_selected_word: 0.0.7-py35_0 conda-forge jupyter_latex_envs: 1.3.6-py35_0 conda-forge jupyter_nbextensions_configurator: 0.2.3-py35_0 conda-forge The following packages will be SUPERCEDED by a higher-priority channel: conda: 4.3.4-py35_0 --> 4.2.13-py35_0 conda-forge conda-env: 2.6.0-0 --> 2.6.0-0 conda-forge conda-env-2.6. 100% |###############################| Time: 0:00:00 840.02 kB/s conda-4.2.13-p 100% |###############################| Time: 0:00:00 612.71 kB/s jupyter_contri 100% |###############################| Time: 0:00:00 1.10 MB/s jupyter_highli 100% |###############################| Time: 0:00:00 1.05 MB/s jupyter_latex_ 100% |###############################| Time: 0:00:00 1.43 MB/s jupyter_nbexte 100% |###############################| Time: 0:00:00 2.10 MB/s jupyter_contri 88% |########################### | Time: 0:00:02 5.38 MB/s CondaError: OSError(18, 'Invalid cross-device link') CondaError: OSError(18, 'Invalid cross-device link') CondaError: OSError(18, 'Invalid cross-device link') jupyter_contri 100% |###############################| Time: 0:00:02 5.82 MB/s The command '/bin/sh -c conda install -y -c conda-forge jupyter_contrib_nbextensions' returned a non-zero code: 1 ``` I've attached a longer version with verbose output from conda: [verbose.txt](https://github.com/conda/conda/files/712290/verbose.txt) I'm still investigating but wanted to post now because it sounds like @kalefranz might be trying to reproduce the problem at the moment, and maybe this example helps. [EDIT: I cut down the example slightly] To work around this problem for now, I have ``RUN conda config --set auto_update_conda False`` in my Dockerfile before installing any other packages. This did not work for me. Not sure what changed, but all builds with anaconda fail from today with this error. Tried the auto_update_conda work around, the always copy work around, and forced conda to the latest known good version (4.3.4). But everything still fails. After reverting to conda 4.2.x it works again. (Not sure where the passed builds with conda 4.3.4 came from). I'm also hitting this in both Ubuntu and Alpine based Docker containers, and have got a combination of the above to work. @pvanderlinden `conda config --set auto_update_conda False` might not exist in your version of miniconda or whatever you are using to install conda- I got this workaround to work by using Miniconda 3.9.1 to install conda version 4.2.13 and then set no update (otherwise any further installs in the root conda env will try and update conda too). ```RUN cd /tmp && \ mkdir -p $CONDA_DIR && \ wget --quiet https://repo.continuum.io/miniconda/Miniconda3-3.9.1-Linux-x86_64.sh && \ echo "6c6b44acdd0bc4229377ee10d52c8ac6160c336d9cdd669db7371aa9344e1ac3 *Miniconda3-3.9.1-Linux-x86_64.sh" | sha256sum -c - && \ /bin/bash Miniconda3-3.9.1-Linux-x86_64.sh -f -b -p $CONDA_DIR && \ rm Miniconda3-3.9.1-Linux-x86_64.sh && \ $CONDA_DIR/bin/conda install --yes conda=4.2.13 && \ conda config --set auto_update_conda False``` Just adding that I'm encountering the same issue on building a simple debian docker container. Dockerfile and terminal output attached. [dockerfile.txt](https://github.com/conda/conda/files/718699/dockerfile.txt) > >>> >docker build -t webportal . Sending build context to Docker daemon 688.6 kB Step 1 : FROM debian@sha256:32a225e412babcd54c0ea777846183c61003d125278882873fb2bc97f9057c51 ---> bb5d89f9b6cb Step 2 : MAINTAINER Joshua Barber "[email protected]" ---> Using cache ---> d7e4ed8df082 Step 3 : USER root ---> Using cache ---> 44c581a995a0 Step 4 : RUN apt-get update && apt-get install -y python3-pip python-dev build-essential wget & & rm /bin/sh && ln -s /bin/bash /bin/sh ---> Using cache ---> d543e8b94bad Step 5 : ENV APP_ACTIVATE "python ./dashboard.py" ---> Using cache ---> 6a2d47160dd3 Step 6 : ENV ENV_NAME "app-env" ---> Using cache ---> ae7475dfad71 Step 7 : ENV CONDA_DIR /opt/conda ---> Using cache ---> 595847dba965 Step 8 : ENV STARTSCRIPT /code/start.sh ---> Using cache ---> 90e5e94733fb Step 9 : ENV PATH /$CONDA_DIR/bin:${PATH} ---> Using cache ---> b54f6a1666be Step 10 : RUN cd /tmp && mkdir -p $CONDA_DIR && wget --quiet http://repo.continuum.io/miniconda/ Miniconda3-latest-Linux-x86_64.sh && /bin/bash Miniconda3-latest-Linux-x86_64.sh -f -b -p $CONDA_DIR && rm Miniconda3-latest-Linux-x86_64.sh && conda update -y conda && conda clean -tip sy ---> Using cache ---> 4f7b9d129bee Step 11 : COPY . /code ---> b3a42b33dbb6 Removing intermediate container 2719dc0dd065 Step 12 : WORKDIR /code ---> Running in 25fec38bd680 ---> 76c82c34fadf Removing intermediate container 25fec38bd680 Step 13 : RUN conda env create -f environment.yml -n $ENV_NAME ---> Running in d94ecbe505f0 Fetching package metadata ......... Solving package specifications: . libpq-9.5.4-0. 100% |###############################| Time: 0:00:01 65.94 kB/s openssl-1.0.2j 100% |###############################| Time: 0:00:30 108.16 kB/s readline-6.2-2 100% |###############################| Time: 0:00:02 209.19 kB/s sqlite-3.13.0- 100% |###############################| Time: 0:00:18 225.25 kB/s tk-8.5.18-0.ta 100% |###############################| Time: 0:00:12 152.99 kB/s xz-5.2.2-1.tar 100% |###############################| Time: 0:00:07 94.97 kB/s zlib-1.2.8-3.t 100% |###############################| Time: 0:00:01 52.40 kB/s python-3.5.2-0 100% |###############################| Time: 0:01:03 284.78 kB/s click-6.7-py35 100% |###############################| Time: 0:00:01 74.13 kB/s itsdangerous-0 100% |###############################| Time: 0:00:00 250.31 kB/s markupsafe-0.2 100% |###############################| Time: 0:00:00 53.70 kB/s psycopg2-2.6.2 100% |###############################| Time: 0:00:01 223.49 kB/s setuptools-27. 100% |###############################| Time: 0:01:16 7.05 kB/s sqlalchemy-1.0 100% |###############################| Time: 0:00:02 544.09 kB/s werkzeug-0.11. 100% |###############################| Time: 0:00:00 528.79 kB/s wheel-0.29.0-p 100% |###############################| Time: 0:00:00 789.20 kB/s jinja2-2.9.4-p 100% |###############################| Time: 0:00:00 681.72 kB/s pip-9.0.1-py35 33% |########## | Time: 0:00:01 338.21 kB/s > CondaError: OSError(18, 'Invalid cross-device link') > > CondaError: OSError(18, 'Invalid cross-device link') > > CondaError: OSError(18, 'Invalid cross-device link') > > > > pip-9.0.1-py35 100% |###############################| Time: 0:00:04 389.24 kB/s > flask-0.11.1-p 100% |###############################| Time: 0:00:00 526.69 kB/s > The command '/bin/sh -c conda env create -f environment.yml -n $ENV_NAME' returned a non-zero code: 1 @elsmorian Thanks. I'm not disabling the upgrading at the moment, as it is not needed. All my scripts install all python requirements in 2: make sure conda is up to date (or in this occasion force it to the latest 4.2.x), install all conda & pip requirements in one command. This means after this conda installs might fail due to this bug, but should be good enough as a work around.
2017-01-20T22:41:25
conda/conda
4,397
conda__conda-4397
[ "4393" ]
500cbff008b37136ee66e7b213ee23d5f1ea7514
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -601,12 +601,12 @@ def __init__(self, transaction_context, linked_package_data, target_prefix, targ def execute(self): if self.link_type != LinkType.directory: log.trace("renaming %s => %s", self.target_short_path, self.holding_short_path) - backoff_rename(self.target_full_path, self.holding_full_path) + backoff_rename(self.target_full_path, self.holding_full_path, force=True) def reverse(self): if self.link_type != LinkType.directory and lexists(self.holding_full_path): log.trace("reversing rename %s => %s", self.holding_short_path, self.target_short_path) - backoff_rename(self.holding_full_path, self.target_full_path) + backoff_rename(self.holding_full_path, self.target_full_path, force=True) def cleanup(self): if self.link_type == LinkType.directory: @@ -718,7 +718,7 @@ def execute(self): # the source and destination are the same file, so we're done return else: - backoff_rename(self.target_full_path, self.hold_path) + backoff_rename(self.target_full_path, self.hold_path, force=True) if self.url.startswith('file:/'): source_path = url_to_path(self.url) @@ -760,8 +760,7 @@ def execute(self): def reverse(self): if lexists(self.hold_path): log.trace("moving %s => %s", self.hold_path, self.target_full_path) - rm_rf(self.target_full_path) - backoff_rename(self.hold_path, self.target_full_path) + backoff_rename(self.hold_path, self.target_full_path, force=True) def cleanup(self): rm_rf(self.hold_path) diff --git a/conda/gateways/disk/update.py b/conda/gateways/disk/update.py --- a/conda/gateways/disk/update.py +++ b/conda/gateways/disk/update.py @@ -2,19 +2,17 @@ from __future__ import absolute_import, division, print_function, unicode_literals from logging import getLogger -from os import rename, utime +from os import rename as os_rename, utime from os.path import lexists import re from conda._vendor.auxlib.path import expand +from conda.gateways.disk.delete import rm_rf from . import exp_backoff_fn log = getLogger(__name__) -# in the rest of conda's code, os.rename is preferably imported from here -rename = rename - SHEBANG_REGEX = re.compile(br'^(#!((?:\\ |[^ \n\r])+)(.*))') @@ -42,13 +40,18 @@ def update_file_in_place_as_binary(file_full_path, callback): fh.close() -def backoff_rename(source_path, destination_path): +def rename(source_path, destination_path, force=False): + if lexists(destination_path) and force: + rm_rf(destination_path) if lexists(source_path): log.trace("renaming %s => %s", source_path, destination_path) - exp_backoff_fn(rename, source_path, destination_path) + os_rename(source_path, destination_path) else: log.trace("cannot rename; source path does not exist '%s'", source_path) - return + + +def backoff_rename(source_path, destination_path, force=False): + exp_backoff_fn(rename, source_path, destination_path, force) def touch(path):
diff --git a/conda/gateways/disk/test.py b/conda/gateways/disk/test.py --- a/conda/gateways/disk/test.py +++ b/conda/gateways/disk/test.py @@ -53,15 +53,20 @@ def hardlink_supported(source_file, dest_dir): # file system configuration, a symbolic link may be created # instead. If a symbolic link is created instead of a hard link, # return False. - log.trace("checking hard link capability for %s => %s", source_file, dest_dir) test_file = join(dest_dir, '.tmp.' + basename(source_file)) assert isfile(source_file), source_file assert isdir(dest_dir), dest_dir assert not lexists(test_file), test_file try: create_link(source_file, test_file, LinkType.hardlink, force=True) - return not islink(test_file) + is_supported = not islink(test_file) + if is_supported: + log.trace("hard link supported for %s => %s", source_file, dest_dir) + else: + log.trace("hard link IS NOT supported for %s => %s", source_file, dest_dir) + return is_supported except (IOError, OSError): + log.trace("hard link IS NOT supported for %s => %s", source_file, dest_dir) return False finally: rm_rf(test_file)
conda 4.3.6 broken - Uncaught backoff with errno EEXIST 17 Trying to update all broke with a *file already exists* error when trying to install the packages: ``` C:\dev\code\sandbox> conda update --all Fetching package metadata ................. Solving package specifications: . Package plan for installation in environment C:\bin\Anaconda: The following packages will be UPDATED: <SNIP> ipywidgets-5.2 100% |###############################| Time: 0:00:00 8.57 MB/s pymc3-3.0-py35 100% |###############################| Time: 0:00:01 152.30 kB/s WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 ERROR conda.core.link:_execute_actions(318): An error occurred while uninstalling package 'conda-forge::jupyterlab-0.12. 1-py35_0'. FileExistsError(17, 'Cannot create a file when that file already exists') Attempting to roll back. WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') ``` Trying again results in the same error (with a different package this time) leaving me unable to update my environment ``` C:\dev\code\sandbox> conda update --all Fetching package metadata ................. Solving package specifications: . Package plan for installation in environment C:\bin\Anaconda: The following packages will be UPDATED: <SNIP> Proceed ([y]/n)? y icu-58.1-vc14_ 100% |###############################| Time: 0:00:15 782.64 kB/s libxml2-2.9.3- 100% |###############################| Time: 0:00:04 754.62 kB/s qt-4.8.7-vc14_ 100% |###############################| Time: 0:00:34 1.51 MB/s pyqt-4.11.4-py 100% |###############################| Time: 0:00:00 9.97 MB/s matplotlib-2.0 100% |###############################| Time: 0:00:06 1.06 MB/s anaconda-navig 100% |###############################| Time: 0:00:02 1.51 MB/s qtconsole-4.2. 100% |###############################| Time: 0:00:00 14.07 MB/s WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 ERROR conda.core.link:_execute_actions(318): An error occurred while uninstalling package 'conda-forge::flask-cors-3.0.2-py35_0'. FileExistsError(17, 'Cannot create a file when that file already exists') Attempting to roll back. WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno EEXIST 17 FileExistsError(17, 'Cannot create a file when that file already exists') FileExistsError(17, 'Cannot create a file when that file already exists') ```
Using conda 4.3.6 on py35 / win64. Downgrading to conda 4.2.15 allowed me to complete the update. I'd love to know where this error came from and fix it, but I need more information. Can you still reproduce it? If so, can you give me the output with the addition of `-v -v -v`? @kalefranz - I reverted to the previous revision, reinstalled 4.3.6 and re-ran conda update with `-v -v -v` which appeared to fail with the same error. Log available at - https://gist.github.com/dhirschfeld/2fa4c615e09c33d03f86f9d95deefcbf NB: 4.3.7 also has the same problem for me
2017-01-22T08:51:51
conda/conda
4,406
conda__conda-4406
[ "5116" ]
9591b0e7a49ba3ee99fc6fba5c470330f149ec14
diff --git a/conda/cli/activate.py b/conda/cli/activate.py --- a/conda/cli/activate.py +++ b/conda/cli/activate.py @@ -1,14 +1,15 @@ -from __future__ import print_function, division, absolute_import, unicode_literals +from __future__ import absolute_import, division, print_function, unicode_literals import errno import os -import re +from os.path import abspath, isdir +import re as regex import sys -from os.path import isdir, abspath -from ..common.compat import text_type, on_win -from ..exceptions import (CondaSystemExit, ArgumentError, CondaValueError, CondaEnvironmentError, - TooManyArgumentsError, TooFewArgumentsError) +from ..common.compat import on_win, text_type +from ..exceptions import (ArgumentError, CondaEnvironmentError, CondaSystemExit, CondaValueError, + TooFewArgumentsError, TooManyArgumentsError) +from ..utils import shells def help(command, shell): @@ -44,12 +45,13 @@ def help(command, shell): raise CondaSystemExit("No help available for command %s" % sys.argv[1]) -def prefix_from_arg(arg, shelldict): +def prefix_from_arg(arg, shell): + shelldict = shells[shell] if shell else {} 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): + if shelldict['sep'] in arg and not regex.match('[a-zA-Z]:', arg): # strip is removing " marks, not \ - look carefully native_path = shelldict['path_from'](arg) if isdir(abspath(native_path.strip("\""))): @@ -61,23 +63,23 @@ def prefix_from_arg(arg, shelldict): return prefix -def binpath_from_arg(arg, shelldict): - # prefix comes back as platform-native path - prefix = prefix_from_arg(arg, shelldict=shelldict) +def _get_prefix_paths(prefix): if on_win: - paths = [ - prefix.rstrip("\\"), - os.path.join(prefix, 'Library', 'mingw-w64', 'bin'), - os.path.join(prefix, 'Library', 'usr', 'bin'), - os.path.join(prefix, 'Library', 'bin'), - os.path.join(prefix, 'Scripts'), - ] + yield prefix.rstrip("\\") + yield os.path.join(prefix, 'Library', 'mingw-w64', 'bin') + yield os.path.join(prefix, 'Library', 'usr', 'bin') + yield os.path.join(prefix, 'Library', 'bin') + yield os.path.join(prefix, 'Scripts') else: - paths = [ - os.path.join(prefix, 'bin'), - ] + yield os.path.join(prefix, 'bin') + + +def binpath_from_arg(arg, shell): + shelldict = shells[shell] if shell else {} + # prefix comes back as platform-native path + prefix = prefix_from_arg(arg, shell) # convert paths to shell-native paths - return [shelldict['path_to'](path) for path in paths] + return [shelldict['path_to'](path) for path in _get_prefix_paths(prefix)] def pathlist_to_str(paths, escape_backslashes=True): @@ -88,25 +90,15 @@ def pathlist_to_str(paths, escape_backslashes=True): path = ' and '.join(paths) if on_win and escape_backslashes: # escape for printing to console - ends up as single \ - path = re.sub(r'(?<!\\)\\(?!\\)', r'\\\\', path) + path = regex.sub(r'(?<!\\)\\(?!\\)', r'\\\\', path) else: path = path.replace("\\\\", "\\") return path -def get_activate_path(shelldict): - arg_num = len(sys.argv) - if arg_num != 4: - num_expected = 2 - if arg_num < 4: - raise TooFewArgumentsError(num_expected, arg_num - num_expected, - "..activate expected exactly two arguments:\ - shell and env name") - if arg_num > 4: - raise TooManyArgumentsError(num_expected, arg_num - num_expected, sys.argv[2:], - "..activate expected exactly two arguments:\ - shell and env name") - binpath = binpath_from_arg(sys.argv[3], shelldict=shelldict) +def get_activate_path(prefix, shell): + shelldict = shells[shell] if shell else {} + binpath = binpath_from_arg(prefix, shell) # prepend our new entries onto the existing path and make sure that the separator is native path = shelldict['pathsep'].join(binpath) @@ -115,32 +107,42 @@ def get_activate_path(shelldict): 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 = {} + 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(shelldict)) + print(get_activate_path(sys.argv[3], shell)) sys.exit(0) elif sys.argv[1] == '..deactivate.path': - import re - activation_path = get_activate_path(shelldict) + activation_path = get_activate_path(sys.argv[3], shell) 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) + new_path = regex.sub(r'%s(:?)' % regex.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) + new_path = regex.sub(r'%s(:?)' % regex.escape(activation_path), r'', + os.environ[str('PATH')], 1) print(new_path) sys.exit(0) @@ -157,7 +159,7 @@ def main(): # 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) + prefix = prefix_from_arg(sys.argv[3], shell) except ValueError as e: raise CondaValueError(text_type(e))
diff --git a/tests/test_activate.py b/tests/test_activate.py --- a/tests/test_activate.py +++ b/tests/test_activate.py @@ -1,26 +1,24 @@ # -*- coding: utf-8 -*- -from __future__ import print_function, absolute_import, unicode_literals - -import subprocess -import tempfile +from __future__ import absolute_import, print_function, unicode_literals +from datetime import datetime import os from os.path import dirname import stat +import subprocess import sys +import tempfile -from datetime import datetime import pytest -from conda.compat import TemporaryDirectory, PY2 -from conda.config import root_dir, platform +from conda.base.context import context +from conda.cli.activate import _get_prefix_paths, binpath_from_arg +from conda.compat import TemporaryDirectory +from conda.config import platform, root_dir from conda.install import symlink_conda -from conda.utils import path_identity, shells, on_win, translate_stream -from conda.cli.activate import binpath_from_arg - +from conda.utils import on_win, shells, translate_stream from tests.helpers import assert_equals, assert_in, assert_not_in - # ENVS_PREFIX = "envs" if PY2 else "envsßôç" ENVS_PREFIX = "envs" @@ -38,22 +36,20 @@ def gen_test_env_paths(envs, shell, num_test_folders=5): paths = [converter(path) for path in paths] return paths -def _envpaths(env_root, env_name="", shelldict={}): +def _envpaths(env_root, env_name="", shell=None): """Supply the appropriate platform executable folders. rstrip on root removes trailing slash if env_name is empty (the default) Assumes that any prefix used here exists. Will not work on prefixes that don't. """ - sep = shelldict['sep'] - return binpath_from_arg(sep.join([env_root, env_name]), shelldict=shelldict) + sep = shells[shell]['sep'] + return binpath_from_arg(sep.join([env_root, env_name]), shell) PYTHONPATH = os.path.dirname(os.path.dirname(__file__)) # Make sure the subprocess activate calls this python -syspath = os.pathsep.join(_envpaths(root_dir, shelldict={"path_to": path_identity, - "path_from": path_identity, - "sep": os.sep})) +syspath = os.pathsep.join(_get_prefix_paths(context.root_prefix)) def print_ps1(env_dirs, raw_ps, number): return (u"({}) ".format(env_dirs[number]) + raw_ps) @@ -144,7 +140,7 @@ def test_activate_test1(shell): """).format(envs=envs, env_dirs=gen_test_env_paths(envs, shell), **shell_vars) stdout, stderr = run_in(commands, shell) - assert_in(shells[shell]['pathsep'].join(_envpaths(envs, 'test 1', shelldict=shells[shell])), + assert_in(shells[shell]['pathsep'].join(_envpaths(envs, 'test 1', shell)), stdout, shell) @@ -159,7 +155,7 @@ def test_activate_env_from_env_with_root_activate(shell): """).format(envs=envs, env_dirs=gen_test_env_paths(envs, shell), **shell_vars) stdout, stderr = run_in(commands, shell) - assert_in(shells[shell]['pathsep'].join(_envpaths(envs, 'test 2', shelldict=shells[shell])), stdout) + assert_in(shells[shell]['pathsep'].join(_envpaths(envs, 'test 2', shell)), stdout) @pytest.mark.installed @@ -190,7 +186,7 @@ def test_activate_bad_env_keeps_existing_good_env(shell): """).format(envs=envs, env_dirs=gen_test_env_paths(envs, shell), **shell_vars) stdout, stderr = run_in(commands, shell) - assert_in(shells[shell]['pathsep'].join(_envpaths(envs, 'test 1', shelldict=shells[shell])),stdout) + assert_in(shells[shell]['pathsep'].join(_envpaths(envs, 'test 1', shell)),stdout) @pytest.mark.installed @@ -222,7 +218,7 @@ def test_activate_root_simple(shell): """).format(envs=envs, **shell_vars) stdout, stderr = run_in(commands, shell) - assert_in(shells[shell]['pathsep'].join(_envpaths(root_dir, shelldict=shells[shell])), stdout, stderr) + assert_in(shells[shell]['pathsep'].join(_envpaths(root_dir, shell=shell)), stdout, stderr) commands = (shell_vars['command_setup'] + """ {source} "{syspath}{binpath}activate" root @@ -246,9 +242,9 @@ def test_activate_root_env_from_other_env(shell): """).format(envs=envs, env_dirs=gen_test_env_paths(envs, shell), **shell_vars) stdout, stderr = run_in(commands, shell) - assert_in(shells[shell]['pathsep'].join(_envpaths(root_dir, shelldict=shells[shell])), + assert_in(shells[shell]['pathsep'].join(_envpaths(root_dir, shell=shell)), stdout) - assert_not_in(shells[shell]['pathsep'].join(_envpaths(envs, 'test 1', shelldict=shells[shell])), stdout) + assert_not_in(shells[shell]['pathsep'].join(_envpaths(envs, 'test 1', shell)), stdout) @pytest.mark.installed
refactor conda/cli/activate.py to help menuinst Let menuinst not have to work about shellsdict in conda 4.3.
2017-01-23T19:24:46
conda/conda
4,409
conda__conda-4409
[ "4398" ]
f5db11ff49e5fe600f049ccc4ae8c6d828538706
diff --git a/conda/models/index_record.py b/conda/models/index_record.py --- a/conda/models/index_record.py +++ b/conda/models/index_record.py @@ -12,6 +12,10 @@ class LinkTypeField(EnumField): def box(self, instance, val): if isinstance(val, string_types): val = val.replace('-', '').replace('_', '').lower() + if val == 'hard': + val = LinkType.hardlink + elif val == 'soft': + val = LinkType.softlink return super(LinkTypeField, self).box(instance, val)
conda install error 'ValidationError: hard is not a valid LinkType' This command: conda install numpy causes this error: ``` 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 : osx-64 conda version : 4.3.6 conda is private : False conda-env version : 4.3.6 conda-build version : 1.21.5 python version : 2.7.13.final.0 requests version : 2.12.4 root environment : /Users/mike/anaconda (writable) default environment : /Users/mike/anaconda envs directories : /Users/mike/anaconda/envs package cache : /Users/mike/anaconda/pkgs channel URLs : https://conda.anaconda.org/hydrocomputing/osx-64 https://conda.anaconda.org/hydrocomputing/noarch https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch https://conda.anaconda.org/conda-forge/osx-64 https://conda.anaconda.org/conda-forge/noarch https://conda.anaconda.org/Esri/osx-64 https://conda.anaconda.org/Esri/noarch config file : /Users/mike/.condarc offline mode : False user-agent : conda/4.3.6 requests/2.12.4 CPython/2.7.13 Darwin/15.6.0 OSX/10.11.6 UID:GID : 501:20 `$ /Users/mike/anaconda/bin/conda install numpy` Traceback (most recent call last): File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 137, in _main exit_code = args.func(args, p) File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 136, in install linked_dists = install_linked(prefix) File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 121, in linked return set(linked_data(prefix, ignore_channels=ignore_channels).keys()) File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 113, in linked_data load_linked_data(prefix, dist_name, ignore_channels=ignore_channels) File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 66, in load_linked_data linked_data_[prefix][dist] = rec = IndexRecord(**rec) File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 702, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 719, in __init__ setattr(self, key, kwargs[key]) File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 831, in __setattr__ super(ImmutableEntity, self).__setattr__(attribute, value) File "/Users/mike/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 "/Users/mike/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 658, in box return val if isinstance(val, self._type) else self._type(**val) File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 702, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 719, in __init__ setattr(self, key, kwargs[key]) File "/Users/mike/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 "/Users/mike/anaconda/lib/python2.7/site-packages/conda/models/index_record.py", line 15, in box return super(LinkTypeField, self).box(instance, val) File "/Users/mike/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 557, in box raise ValidationError(val, msg=e1) ValidationError: hard is not a valid LinkType ``` It worked for several years. I am using many environments for different Python version. One of the last updates must have broken it. I cannot tell exactly which one.
This is my clunky fix in `Users/mike/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py` starting at line 545, changing `hard` into `hardlink`: def box(self, instance, val): if val is None: # let the required/nullable logic handle validation for this case return None try: # try to box using val as an Enum name return val if isinstance(val, self._type) else self._type(val) except ValueError as e1: try: if val == 'hard': val = 'hardlink' # try to box using val as an Enum value return self._type[val] except KeyError: raise ValidationError(val, msg=e1) Can you run again with `-v -v -v` (and without your fix)? I'd like to figure out where the bad package is.
2017-01-23T21:52:33
conda/conda
4,433
conda__conda-4433
[ "4425", "4425" ]
9a65c479c45bed12b2a9fc3b8df65078a3da1e5e
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -510,15 +510,11 @@ def __init__(self, transaction_context, package_info, target_prefix, target_shor None, None, target_prefix, target_short_path) self.linked_package_record = linked_package_record - self._record_written_to_disk = False self._linked_data_loaded = False def execute(self): log.trace("creating linked package record %s", self.target_full_path) - write_linked_package_record(self.target_prefix, self.linked_package_record) - self._record_written_to_disk = True - load_linked_data(self.target_prefix, Dist(self.package_info.repodata_record).dist_name, self.linked_package_record) self._linked_data_loaded = True @@ -528,10 +524,7 @@ def reverse(self): if self._linked_data_loaded: delete_linked_data(self.target_prefix, Dist(self.package_info.repodata_record), delete=False) - if self._record_written_to_disk: - rm_rf(self.target_full_path) - else: - log.trace("record was not created %s", self.target_full_path) + rm_rf(self.target_full_path) class CreatePrivateEnvMetaAction(CreateInPrefixPathAction): diff --git a/conda/gateways/disk/create.py b/conda/gateways/disk/create.py --- a/conda/gateways/disk/create.py +++ b/conda/gateways/disk/create.py @@ -22,7 +22,7 @@ from ..._vendor.auxlib.entity import EntityEncoder from ..._vendor.auxlib.ish import dals from ...base.context import context -from ...common.compat import on_win +from ...common.compat import on_win, ensure_binary from ...common.path import win_path_ok from ...exceptions import BasicClobberError, CondaOSError, maybe_raise from ...models.dist import Dist @@ -49,6 +49,14 @@ """) +def write_as_json_to_file(file_path, obj): + log.trace("writing json to file %s", file_path) + with open(file_path, str('wb')) as fo: + json_str = json.dumps(obj, indent=2, sort_keys=True, separators=(',', ': '), + cls=EntityEncoder) + fo.write(ensure_binary(json_str)) + + def create_unix_python_entry_point(target_full_path, python_full_path, module, func): if lexists(target_full_path): maybe_raise(BasicClobberError( @@ -58,7 +66,7 @@ def create_unix_python_entry_point(target_full_path, python_full_path, module, f ), context) pyscript = python_entry_point_template % {'module': module, 'func': func} - with open(target_full_path, 'w') as fo: + with open(target_full_path, str('w')) as fo: fo.write('#!%s\n' % python_full_path) fo.write(pyscript) make_executable(target_full_path) @@ -75,7 +83,7 @@ def create_windows_python_entry_point(target_full_path, module, func): ), context) pyscript = python_entry_point_template % {'module': module, 'func': func} - with open(target_full_path, 'w') as fo: + with open(target_full_path, str('w')) as fo: fo.write(pyscript) return target_full_path @@ -113,11 +121,7 @@ def write_linked_package_record(prefix, record): target_path=conda_meta_full_path, context=context, ), context) - with open(conda_meta_full_path, 'w') as fo: - json_str = json.dumps(record, indent=2, sort_keys=True, cls=EntityEncoder) - if hasattr(json_str, 'decode'): - json_str = json_str.decode('utf-8') - fo.write(json_str) + write_as_json_to_file(conda_meta_full_path, record) def make_menu(prefix, file_path, remove=False): @@ -287,8 +291,7 @@ def create_private_envs_meta(pkg, root_prefix, private_env_prefix): private_envs_json = get_json_content(context.private_envs_json_path) private_envs_json[pkg] = private_env_prefix - with open(context.private_envs_json_path, "w") as f: - json.dump(private_envs_json, f) + write_as_json_to_file(context.private_envs_json_path, private_envs_json) def create_private_pkg_entry_point(source_full_path, target_full_path, python_full_path): @@ -300,7 +303,7 @@ def create_private_pkg_entry_point(source_full_path, target_full_path, python_fu ), context) entry_point = application_entry_point_template % {"source_full_path": source_full_path} - with open(target_full_path, "w") as fo: + with open(target_full_path, str("w")) as fo: fo.write('#!%s\n' % python_full_path) fo.write(entry_point) make_executable(target_full_path)
Cannot upgrade pandas or other packages My anaconda suddenly cannot upgrade pandas or other packages. As I type "conda upgrade pandas", it will return: 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 : osx-64 conda version : 4.3.8 conda is private : False conda-env version : 4.3.8 conda-build version : 2.0.2 python version : 2.7.12.final.0 requests version : 2.12.4 root environment : /Users/Jianhua/anaconda (writable) default environment : /Users/Jianhua/anaconda envs directories : /Users/Jianhua/anaconda/envs package cache : /Users/Jianhua/anaconda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : None offline mode : False user-agent : conda/4.3.8 requests/2.12.4 CPython/2.7.12 Darwin/16.4.0 OSX/10.12.3 UID:GID : 501:20 `$ /Users/Jianhua/anaconda/bin/conda upgrade pandas` Traceback (most recent call last): File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 137, in _main exit_code = args.func(args, p) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/main_update.py", line 65, in execute install(args, parser, 'update') File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 136, in install linked_dists = install_linked(prefix) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 121, in linked return set(linked_data(prefix, ignore_channels=ignore_channels).keys()) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 113, in linked_data load_linked_data(prefix, dist_name, ignore_channels=ignore_channels) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 34, in load_linked_data rec = json.load(fi) File "/Users/Jianhua/anaconda/lib/python2.7/json/__init__.py", line 291, in load **kw) File "/Users/Jianhua/anaconda/lib/python2.7/json/__init__.py", line 339, in loads return _default_decoder.decode(s) File "/Users/Jianhua/anaconda/lib/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/Jianhua/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 Can someone tell me what is going on? Thank you so much! Cannot upgrade pandas or other packages My anaconda suddenly cannot upgrade pandas or other packages. As I type "conda upgrade pandas", it will return: 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 : osx-64 conda version : 4.3.8 conda is private : False conda-env version : 4.3.8 conda-build version : 2.0.2 python version : 2.7.12.final.0 requests version : 2.12.4 root environment : /Users/Jianhua/anaconda (writable) default environment : /Users/Jianhua/anaconda envs directories : /Users/Jianhua/anaconda/envs package cache : /Users/Jianhua/anaconda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : None offline mode : False user-agent : conda/4.3.8 requests/2.12.4 CPython/2.7.12 Darwin/16.4.0 OSX/10.12.3 UID:GID : 501:20 `$ /Users/Jianhua/anaconda/bin/conda upgrade pandas` Traceback (most recent call last): File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 137, in _main exit_code = args.func(args, p) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/main_update.py", line 65, in execute install(args, parser, 'update') File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 136, in install linked_dists = install_linked(prefix) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 121, in linked return set(linked_data(prefix, ignore_channels=ignore_channels).keys()) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 113, in linked_data load_linked_data(prefix, dist_name, ignore_channels=ignore_channels) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 34, in load_linked_data rec = json.load(fi) File "/Users/Jianhua/anaconda/lib/python2.7/json/__init__.py", line 291, in load **kw) File "/Users/Jianhua/anaconda/lib/python2.7/json/__init__.py", line 339, in loads return _default_decoder.decode(s) File "/Users/Jianhua/anaconda/lib/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/Jianhua/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 Can someone tell me what is going on? Thank you so much!
Open python, then run this: ``` from glob import glob from json import loads for path in glob('/Users/Jianhua/anaconda/conda-meta/*.json'): try: with open(path) as fh: data = fh.read() _ = loads(data) except: print(path) print(data) raise ``` What output does that give? Hi, Kalefranz Thank you for your response first. By your code, I got the output: /Users/Jianhua/anaconda/conda-meta/mkl-2017.0.1-0.json Well that's sure interesting. CC @msarahan. I wonder if this is related to some other recent issues... I can't see exactly how just yet though... This blank conda-meta file... it's possible I have an off-by-one index error somewhere in the rollback code that could lead to this maybe... @xfsm1912 Let's try this... rm /Users/Jianhua/anaconda/conda-meta/mkl-2017.0.1-0.json Then run that python code again. Make sure it comes back without printing anything. I mean, make sure nothing happens when you run that code snippet now. Then conda install --no-deps mkl=2017 Let me know how that goes... after delete the mkl-2017.0.1-0.json, nothing is output as running the previous code. But running install code, I got: [Jianhua@d-172-26-7-254~]$ conda install --no-deps mkl=2017 Fetching package metadata ......... Solving package specifications: . Package plan for installation in environment /Users/Jianhua/anaconda: The following packages will be UPDATED: mkl: 11.3.3-0 --> 2017.0.1-0 Proceed ([y]/n)? y ERROR conda.core.link:_execute_actions(318): An error occurred while installing package 'defaults::mkl-2017.0.1-0'. LookupError('unknown encoding: ',) Attempting to roll back. LookupError('unknown encoding: ',) Now I'm even more confused. But I think we're making progress... How about conda install --no-deps mkl=2017 -v -v -v ? It might be a LOT of output. That's ok. Too much is better than not enough. [Jianhua@d-172-26-7-254~]$ conda install --no-deps mkl=2017 -v -v -v DEBUG conda.cli.main:_main(135): verbosity set to 3 An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues INFO conda.common.io:captured(59): overtaking stderr and stdout INFO conda.common.io:captured(65): stderr and stdout yielding back Current conda install: platform : osx-64 conda version : 4.3.8 conda is private : False conda-env version : 4.3.8 conda-build version : 2.0.2 python version : 2.7.12.final.0 requests version : 2.12.4 root environment : /Users/Jianhua/anaconda (writable) default environment : /Users/Jianhua/anaconda envs directories : /Users/Jianhua/anaconda/envs package cache : /Users/Jianhua/anaconda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : None offline mode : False user-agent : conda/4.3.8 requests/2.12.4 CPython/2.7.12 Darwin/16.4.0 OSX/10.12.3 UID:GID : 501:20 `$ /Users/Jianhua/anaconda/bin/conda install --no-deps mkl=2017 -v -v -v` Traceback (most recent call last): File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 137, in _main exit_code = args.func(args, p) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 136, in install linked_dists = install_linked(prefix) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 121, in linked return set(linked_data(prefix, ignore_channels=ignore_channels).keys()) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 113, in linked_data load_linked_data(prefix, dist_name, ignore_channels=ignore_channels) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 34, in load_linked_data rec = json.load(fi) File "/Users/Jianhua/anaconda/lib/python2.7/json/__init__.py", line 291, in load **kw) File "/Users/Jianhua/anaconda/lib/python2.7/json/__init__.py", line 339, in loads return _default_decoder.decode(s) File "/Users/Jianhua/anaconda/lib/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/Jianhua/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 No JSON again Oh even better! One more time rm /Users/Jianhua/anaconda/conda-meta/mkl-2017.0.1-0.json and then now conda install --no-deps mkl=2017 -v -v -v As I type conda install --no-deps mkl=2017 -v -v -v, output is a lot, but finally: An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues INFO conda.common.io:captured(59): overtaking stderr and stdout INFO conda.common.io:captured(65): stderr and stdout yielding back Current conda install: platform : osx-64 conda version : 4.3.8 conda is private : False conda-env version : 4.3.8 conda-build version : 2.0.2 python version : 2.7.12.final.0 requests version : 2.12.4 root environment : /Users/Jianhua/anaconda (writable) default environment : /Users/Jianhua/anaconda envs directories : /Users/Jianhua/anaconda/envs package cache : /Users/Jianhua/anaconda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : None offline mode : False user-agent : conda/4.3.8 requests/2.12.4 CPython/2.7.12 Darwin/16.4.0 OSX/10.12.3 UID:GID : 501:20 `$ /Users/Jianhua/anaconda/bin/conda install --no-deps mkl=2017 -v -v -v` Traceback (most recent call last): File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 137, in _main exit_code = args.func(args, p) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 347, in install execute_actions(actions, index, verbose=not context.quiet) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/plan.py", line 837, in execute_actions execute_instructions(plan, index, verbose) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 258, in execute_instructions cmd(state, arg) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 119, in UNLINKLINKTRANSACTION_CMD txn.execute() File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/link.py", line 277, in execute rollback_excs, CondaMultiError: unknown encoding: Unfortunately that doesn't quite help. I actually need the full output. You can email it to me in a file if you'd like. [email protected] Open python, then run this: ``` from glob import glob from json import loads for path in glob('/Users/Jianhua/anaconda/conda-meta/*.json'): try: with open(path) as fh: data = fh.read() _ = loads(data) except: print(path) print(data) raise ``` What output does that give? Hi, Kalefranz Thank you for your response first. By your code, I got the output: /Users/Jianhua/anaconda/conda-meta/mkl-2017.0.1-0.json Well that's sure interesting. CC @msarahan. I wonder if this is related to some other recent issues... I can't see exactly how just yet though... This blank conda-meta file... it's possible I have an off-by-one index error somewhere in the rollback code that could lead to this maybe... @xfsm1912 Let's try this... rm /Users/Jianhua/anaconda/conda-meta/mkl-2017.0.1-0.json Then run that python code again. Make sure it comes back without printing anything. I mean, make sure nothing happens when you run that code snippet now. Then conda install --no-deps mkl=2017 Let me know how that goes... after delete the mkl-2017.0.1-0.json, nothing is output as running the previous code. But running install code, I got: [Jianhua@d-172-26-7-254~]$ conda install --no-deps mkl=2017 Fetching package metadata ......... Solving package specifications: . Package plan for installation in environment /Users/Jianhua/anaconda: The following packages will be UPDATED: mkl: 11.3.3-0 --> 2017.0.1-0 Proceed ([y]/n)? y ERROR conda.core.link:_execute_actions(318): An error occurred while installing package 'defaults::mkl-2017.0.1-0'. LookupError('unknown encoding: ',) Attempting to roll back. LookupError('unknown encoding: ',) Now I'm even more confused. But I think we're making progress... How about conda install --no-deps mkl=2017 -v -v -v ? It might be a LOT of output. That's ok. Too much is better than not enough. [Jianhua@d-172-26-7-254~]$ conda install --no-deps mkl=2017 -v -v -v DEBUG conda.cli.main:_main(135): verbosity set to 3 An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues INFO conda.common.io:captured(59): overtaking stderr and stdout INFO conda.common.io:captured(65): stderr and stdout yielding back Current conda install: platform : osx-64 conda version : 4.3.8 conda is private : False conda-env version : 4.3.8 conda-build version : 2.0.2 python version : 2.7.12.final.0 requests version : 2.12.4 root environment : /Users/Jianhua/anaconda (writable) default environment : /Users/Jianhua/anaconda envs directories : /Users/Jianhua/anaconda/envs package cache : /Users/Jianhua/anaconda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : None offline mode : False user-agent : conda/4.3.8 requests/2.12.4 CPython/2.7.12 Darwin/16.4.0 OSX/10.12.3 UID:GID : 501:20 `$ /Users/Jianhua/anaconda/bin/conda install --no-deps mkl=2017 -v -v -v` Traceback (most recent call last): File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 137, in _main exit_code = args.func(args, p) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 136, in install linked_dists = install_linked(prefix) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 121, in linked return set(linked_data(prefix, ignore_channels=ignore_channels).keys()) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 113, in linked_data load_linked_data(prefix, dist_name, ignore_channels=ignore_channels) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/linked_data.py", line 34, in load_linked_data rec = json.load(fi) File "/Users/Jianhua/anaconda/lib/python2.7/json/__init__.py", line 291, in load **kw) File "/Users/Jianhua/anaconda/lib/python2.7/json/__init__.py", line 339, in loads return _default_decoder.decode(s) File "/Users/Jianhua/anaconda/lib/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/Jianhua/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 No JSON again Oh even better! One more time rm /Users/Jianhua/anaconda/conda-meta/mkl-2017.0.1-0.json and then now conda install --no-deps mkl=2017 -v -v -v As I type conda install --no-deps mkl=2017 -v -v -v, output is a lot, but finally: An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues INFO conda.common.io:captured(59): overtaking stderr and stdout INFO conda.common.io:captured(65): stderr and stdout yielding back Current conda install: platform : osx-64 conda version : 4.3.8 conda is private : False conda-env version : 4.3.8 conda-build version : 2.0.2 python version : 2.7.12.final.0 requests version : 2.12.4 root environment : /Users/Jianhua/anaconda (writable) default environment : /Users/Jianhua/anaconda envs directories : /Users/Jianhua/anaconda/envs package cache : /Users/Jianhua/anaconda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : None offline mode : False user-agent : conda/4.3.8 requests/2.12.4 CPython/2.7.12 Darwin/16.4.0 OSX/10.12.3 UID:GID : 501:20 `$ /Users/Jianhua/anaconda/bin/conda install --no-deps mkl=2017 -v -v -v` Traceback (most recent call last): File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 137, in _main exit_code = args.func(args, p) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 347, in install execute_actions(actions, index, verbose=not context.quiet) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/plan.py", line 837, in execute_actions execute_instructions(plan, index, verbose) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 258, in execute_instructions cmd(state, arg) File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 119, in UNLINKLINKTRANSACTION_CMD txn.execute() File "/Users/Jianhua/anaconda/lib/python2.7/site-packages/conda/core/link.py", line 277, in execute rollback_excs, CondaMultiError: unknown encoding: Unfortunately that doesn't quite help. I actually need the full output. You can email it to me in a file if you'd like. [email protected]
2017-01-26T01:03:48
conda/conda
4,518
conda__conda-4518
[ "4513" ]
f71c08a765ee5714980206b30115b74886813fec
diff --git a/conda/core/index.py b/conda/core/index.py --- a/conda/core/index.py +++ b/conda/core/index.py @@ -9,7 +9,7 @@ from logging import DEBUG, getLogger from mmap import ACCESS_READ, mmap from os import makedirs -from os.path import getmtime, isfile, join, split as path_split +from os.path import getmtime, isfile, join, split as path_split, dirname import pickle import re from textwrap import dedent @@ -234,12 +234,13 @@ def maybe_decompress(filename, resp_content): $ mkdir noarch $ echo '{}' > noarch/repodata.json $ bzip2 -k noarch/repodata.json - """ % url) + """) % dirname(url) stderrlog.warn(help_message) return None else: help_message = dals(""" - The remote server could not find the channel you requested. + The remote server could not find the noarch directory for the + requested channel with url: %s As of conda 4.3, a valid channel must contain a `noarch/repodata.json` and associated `noarch/repodata.json.bz2` file, even if `noarch/repodata.json` is @@ -252,7 +253,7 @@ def maybe_decompress(filename, resp_content): You will need to adjust your conda configuration to proceed. Use `conda config --show` to view your configuration's current state. Further configuration help can be found at <%s>. - """ % join_url(CONDA_HOMEPAGE_URL, 'docs/config.html')) + """) % (dirname(url), join_url(CONDA_HOMEPAGE_URL, 'docs/config.html')) elif status_code == 403: if not url.endswith('/noarch'): @@ -272,12 +273,13 @@ def maybe_decompress(filename, resp_content): $ mkdir noarch $ echo '{}' > noarch/repodata.json $ bzip2 -k noarch/repodata.json - """ % url) + """) % dirname(url) stderrlog.warn(help_message) return None else: help_message = dals(""" - The channel you requested is not available on the remote server. + The remote server could not find the noarch directory for the + requested channel with url: %s As of conda 4.3, a valid channel must contain a `noarch/repodata.json` and associated `noarch/repodata.json.bz2` file, even if `noarch/repodata.json` is @@ -290,7 +292,7 @@ def maybe_decompress(filename, resp_content): You will need to adjust your conda configuration to proceed. Use `conda config --show` to view your configuration's current state. Further configuration help can be found at <%s>. - """ % join_url(CONDA_HOMEPAGE_URL, 'docs/config.html')) + """) % (dirname(url), join_url(CONDA_HOMEPAGE_URL, 'docs/config.html')) elif status_code == 401: channel = Channel(url) @@ -491,9 +493,12 @@ def fetch_repodata(url, schannel, priority, touch(cache_path) return read_local_repodata(cache_path, url, schannel, priority, mod_etag_headers.get('_etag'), mod_etag_headers.get('_mod')) + if repodata is None: + return None with open(cache_path, 'w') as fo: json.dump(repodata, fo, indent=2, sort_keys=True, cls=EntityEncoder) + process_repodata(repodata, url, schannel, priority) write_pickled_repodata(cache_path, repodata) return repodata @@ -548,7 +553,7 @@ def fetch_index(channel_urls, use_cache=False, index=None): # this is sorta a lie; actually more primitve types if index is None: - index = dict() + index = {} for _, repodata in repodatas: if repodata: index.update(repodata.get('packages', {}))
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -191,6 +191,12 @@ def test_install_python2(self): assert exists(join(prefix, PYTHON_BINARY)) assert_package_is_installed(prefix, 'python-2') + # regression test for #4513 + run_command(Commands.CONFIG, prefix, "--add channels https://repo.continuum.io/pkgs/not-a-channel") + stdout, stderr = run_command(Commands.SEARCH, prefix, "python --json") + packages = json.loads(stdout) + assert len(packages) > 1 + @pytest.mark.timeout(900) def test_create_install_update_remove(self): with make_temp_env("python=3.5") as prefix:
Conda breaks if it can't find the noarch channel If the `noarch` URL of some custom channel doesn't exist, conda becomes completely broken. The error is: ``` Fetching package metadata ...... WARNING: The remote server could not find the noarch directory for the requested channel with url: https://zigzah.com/static/conda-pkgs/noarch It is possible you have given conda an invalid channel. Please double-check your conda configuration using `conda config --show`. If the requested url is in fact a valid conda channel, please request that the channel administrator create `noarch/repodata.json` and associated `noarch/repodata.json.bz2` files, even if `noarch/repodata.json` is empty. 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.9 conda is private : False conda-env version : 4.3.9 conda-build version : 2.0.12 python version : 3.5.3.final.0 requests version : 2.13.0 root environment : /home/zah/anaconda3 (writable) default environment : /home/zah/anaconda3 envs directories : /home/zah/anaconda3/envs package cache : /home/zah/anaconda3/pkgs channel URLs : https://zigzah.com/static/conda-pkgs/linux-64 https://zigzah.com/static/conda-pkgs/noarch https://conda.anaconda.org/conda-forge/linux-64 https://conda.anaconda.org/conda-forge/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/r/linux-64 https://conda.anaconda.org/r/noarch config file : /home/zah/.condarc offline mode : False user-agent : conda/4.3.9 requests/2.13.0 CPython/3.5.3 Linux/4.8.0-32-generic debian/stretch/sid glibc/2.23 UID:GID : 1000:1000 `$ /home/zah/anaconda3/bin/conda install validphys` Traceback (most recent call last): File "/home/zah/anaconda3/lib/python3.5/site-packages/conda/exceptions.py", line 616, in conda_exception_handler return_value = func(*args, **kwargs) File "/home/zah/anaconda3/lib/python3.5/site-packages/conda/cli/main.py", line 137, in _main exit_code = args.func(args, p) File "/home/zah/anaconda3/lib/python3.5/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/home/zah/anaconda3/lib/python3.5/site-packages/conda/cli/install.py", line 222, in install unknown=index_args['unknown'], prefix=prefix) File "/home/zah/anaconda3/lib/python3.5/site-packages/conda/core/index.py", line 124, in get_index index = fetch_index(channel_priority_map, use_cache=use_cache) File "/home/zah/anaconda3/lib/python3.5/site-packages/conda/core/index.py", line 532, in fetch_index repodatas = _collect_repodatas(use_cache, tasks) File "/home/zah/anaconda3/lib/python3.5/site-packages/conda/core/index.py", line 521, in _collect_repodatas repodatas = _collect_repodatas_serial(use_cache, tasks) File "/home/zah/anaconda3/lib/python3.5/site-packages/conda/core/index.py", line 494, in _collect_repodatas_serial for url, schan, pri in tasks] File "/home/zah/anaconda3/lib/python3.5/site-packages/conda/core/index.py", line 494, in <listcomp> for url, schan, pri in tasks] File "/home/zah/anaconda3/lib/python3.5/site-packages/conda/core/index.py", line 143, in func res = f(*args, **kwargs) File "/home/zah/anaconda3/lib/python3.5/site-packages/conda/core/index.py", line 483, in fetch_repodata process_repodata(repodata, url, schannel, priority) File "/home/zah/anaconda3/lib/python3.5/site-packages/conda/core/index.py", line 410, in process_repodata opackages = repodata.setdefault('packages', {}) AttributeError: 'NoneType' object has no attribute 'setdefault' ```
2017-02-03T18:37:45
conda/conda
4,548
conda__conda-4548
[ "4546" ]
81d2f6e2d383bb056d19ead27819675a6d48a06e
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -385,14 +385,14 @@ def this_triplet(entry_point_def): if noarch is not None and noarch.type == NoarchType.python: actions = tuple(cls(transaction_context, package_info, target_prefix, *this_triplet(ep_def)) - for ep_def in noarch.entry_points) + for ep_def in noarch.entry_points or ()) if on_win: actions += tuple( LinkPathAction.create_python_entry_point_windows_exe_action( transaction_context, package_info, target_prefix, requested_link_type, ep_def - ) for ep_def in noarch.entry_points + ) for ep_def in noarch.entry_points or () ) return actions diff --git a/conda/models/package_info.py b/conda/models/package_info.py --- a/conda/models/package_info.py +++ b/conda/models/package_info.py @@ -20,12 +20,12 @@ def box(self, instance, val): class Noarch(Entity): type = NoarchField(NoarchType) - entry_points = ListField(string_types, required=False) + entry_points = ListField(string_types, required=False, nullable=True) class PreferredEnv(Entity): name = StringField() - executable_paths = ListField(string_types, required=False) + executable_paths = ListField(string_types, required=False, nullable=True) class PackageMetadata(Entity):
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -231,7 +231,7 @@ def test_create_install_update_remove(self): self.assertRaises(CondaError, run_command, Commands.INSTALL, prefix, 'constructor=1.0') assert not package_is_installed(prefix, 'constructor') - def test_noarch_python_package(self): + def test_noarch_python_package_with_entry_points(self): with make_temp_env("-c conda-test flask") as prefix: py_ver = get_python_version_for_prefix(prefix) sp_dir = get_python_site_packages_short_path(py_ver) @@ -250,6 +250,21 @@ def test_noarch_python_package(self): assert not isfile(join(prefix, pyc_file)) assert not isfile(exe_path) + def test_noarch_python_package_without_entry_points(self): + # regression test for #4546 + with make_temp_env("-c conda-test itsdangerous") as prefix: + py_ver = get_python_version_for_prefix(prefix) + sp_dir = get_python_site_packages_short_path(py_ver) + py_file = sp_dir + "/itsdangerous.py" + pyc_file = pyc_path(py_file, py_ver) + assert isfile(join(prefix, py_file)) + assert isfile(join(prefix, pyc_file)) + + run_command(Commands.REMOVE, prefix, "itsdangerous") + + assert not isfile(join(prefix, py_file)) + assert not isfile(join(prefix, pyc_file)) + def test_noarch_generic_package(self): with make_temp_env("-c conda-test font-ttf-inconsolata") as prefix: assert isfile(join(prefix, 'fonts', 'Inconsolata-Regular.ttf'))
Unable to install noarch: python package without entry points I've been playing with the `noarch: python` feature in conda 4.3 and enjoying it, really great addition! One issue that I've found is that conda seems unable to install noarch python packages that do not have entry points. Building and installing `noarch: python` packages which have entry points works fine. For example, trying to build a package for the following recipe: ``` yaml package: name: imagesize version: 0.7.1 source: fn: imagesize-0.7.1.tar.gz url: https://pypi.io/packages/source/i/imagesize/imagesize-0.7.1.tar.gz sha256: 0ab2c62b87987e3252f89d30b7cedbec12a01af9274af9ffa48108f2c13c6062 build: number: 70 noarch: python script: python setup.py install --single-version-externally-managed --record record.txt requirements: build: - python - setuptools run: - python test: imports: - imagesize ``` The build fails when trying to install the package into the test environment: ``` $ conda build . BUILD START: imagesize-0.7.1-py_70 ... TEST START: imagesize-0.7.1-py_70 Deleting work directory, /home/jhelmus/anaconda/conda-bld/imagesize_1486396885045/work/imagesize-0.7.1 updating index in: /home/jhelmus/anaconda/conda-bld/linux-64 updating index in: /home/jhelmus/anaconda/conda-bld/noarch The following NEW packages will be INSTALLED: imagesize: 0.7.1-py_70 local openssl: 1.0.2k-0 defaults python: 3.5.2-0 defaults readline: 6.2-2 defaults sqlite: 3.13.0-0 defaults tk: 8.5.18-0 defaults xz: 5.2.2-1 defaults zlib: 1.2.8-3 defaults Traceback (most recent call last): File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda/_vendor/auxlib/entity.py", line 403, in __get__ val = instance.__dict__[self.name] KeyError: 'entry_points' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/jhelmus/anaconda/bin/conda-build", line 6, in <module> sys.exit(conda_build.cli.main_build.main()) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda_build/cli/main_build.py", line 322, in main execute(sys.argv[1:]) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda_build/cli/main_build.py", line 313, in execute noverify=args.no_verify) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda_build/api.py", line 97, in build need_source_download=need_source_download, config=config) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda_build/build.py", line 1486, in build_tree test(pkg, config=config) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda_build/build.py", line 1304, in test create_env(config.test_prefix, specs, config=config) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda_build/build.py", line 684, in create_env plan.execute_actions(actions, index, verbose=config.debug) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda/plan.py", line 837, in execute_actions execute_instructions(plan, index, verbose) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda/instructions.py", line 258, in execute_instructions cmd(state, arg) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda/instructions.py", line 119, in UNLINKLINKTRANSACTION_CMD txn.execute() File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda/core/link.py", line 256, in execute self.verify() File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda/core/link.py", line 239, in verify self.prepare() File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda/core/link.py", line 170, in prepare concatv(unlink_actions, link_actions)) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda/core/link.py", line 169, in <genexpr> self.all_actions = tuple(per_pkg_actions for per_pkg_actions in File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda/core/link.py", line 166, in <genexpr> for pkg_info, lt in zip(self.packages_info_to_link, link_types) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda/core/link.py", line 395, in make_link_actions python_entry_point_actions = CreatePythonEntryPointAction.create_actions(*required_quad) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda/core/path_actions.py", line 388, in create_actions for ep_def in noarch.entry_points) File "/home/jhelmus/anaconda/lib/python3.5/site-packages/conda/_vendor/auxlib/entity.py", line 413, in __get__ raise AttributeError("A value for {0} has not been set".format(self.name)) AttributeError: A value for entry_points has not been set ``` The package can be build using the `--no-test` flag but the same error is given when attempting to install the package into a environment. I've uploaded this package to the [jjhelmus_testing channel](https://anaconda.org/jjhelmus_testing/imagesize/files) in case it is helpful for testing. The behavior can be replicated using the command: `conda create -n imagesize_27 -c jjhelmus_testing python=2.7 imagesize=0.7.1=py_70`. --- conda info for the build/install environment if it helps: ``` $ conda info Current conda install: platform : linux-64 conda version : 4.3.9 conda is private : False conda-env version : 4.3.9 conda-build version : 2.1.3 python version : 3.5.2.final.0 requests version : 2.12.4 root environment : /home/jhelmus/anaconda (writable) default environment : /home/jhelmus/anaconda envs directories : /home/jhelmus/anaconda/envs package cache : /home/jhelmus/anaconda/pkgs channel URLs : 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/jhelmus/.condarc offline mode : False user-agent : conda/4.3.9 requests/2.12.4 CPython/3.5.2 Linux/4.4.0-59-generic debian/stretch/sid glibc/2.23 UID:GID : 5001:1004 ```
Thanks for the bug report. I'll get a fix in the next patch release.
2017-02-06T19:30:19
conda/conda
4,585
conda__conda-4585
[ "4567" ]
112f0549e6dfa7dd4770a5a1836adbe594e55203
diff --git a/conda/common/compat.py b/conda/common/compat.py --- a/conda/common/compat.py +++ b/conda/common/compat.py @@ -152,7 +152,15 @@ def ensure_binary(value): def ensure_text_type(value): - return value.decode('utf-8') if hasattr(value, 'decode') else value + if hasattr(value, 'decode'): + try: + return value.decode('utf-8') + except UnicodeDecodeError: + from requests.packages.chardet import detect + encoding = detect(value).get('encoding') or 'utf-8' + return value.decode(encoding) + else: + return value def ensure_unicode(value):
ERROR conda.core.link:_execute_actions(319): An error occurred while installing package 'defaults::qt-5.6.2-vc9_3' ``` Current conda install: platform : win-64 conda version : 4.3.9 conda is private : False conda-env version : 4.3.9 conda-build version : 2.1.3 python version : 2.7.13.final.0 requests version : 2.12.4 root environment : C:\Users\joelkim\Anaconda2 (writable) default environment : C:\Users\joelkim\Anaconda2 envs directories : C:\Users\joelkim\Anaconda2\envs package cache : C:\Users\joelkim\Anaconda2\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 : None offline mode : False user-agent : conda/4.3.9 requests/2.12.4 CPython/2.7.13 Windows/10 Windows/10.0.14393 ``` I got this error when I tried to install qt: ``` > conda create -n test qt Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment C:\Users\joelkim\Anaconda2\envs\test: The following NEW packages will be INSTALLED: icu: 57.1-vc9_0 [vc9] jpeg: 9b-vc9_0 [vc9] libpng: 1.6.27-vc9_0 [vc9] openssl: 1.0.2k-vc9_0 [vc9] pip: 9.0.1-py27_1 python: 2.7.13-0 qt: 5.6.2-vc9_3 [vc9] setuptools: 27.2.0-py27_1 vs2008_runtime: 9.00.30729.5054-0 wheel: 0.29.0-py27_0 zlib: 1.2.8-vc9_3 [vc9] Proceed ([y]/n)? ERROR conda.core.link:_execute_actions(319): An error occurred while installing package 'defaults::qt-5.6.2-vc9_3'. ```
If this problem is reproducible for you, can you give me the output of conda create -n test qt -vvv It'll be a lot of output. Feel free to email it to me if you want. [email protected] I have the similar error too. I found the reason. It is because OS message is not encoded in utf-8 (in my case, CP949) On installation, ``subprocess_call`` function is called: https://github.com/conda/conda/blob/33303158f070c0eda1ce0bbcb7807ddc7a4972d6/conda/gateways/subprocess.py#L62 Inside, this function calls ``ensure_text_type`` to validate standard output: https://github.com/conda/conda/blob/7005e366a2a7dcd19430114c4a3d30f2eb735995/conda/common/compat.py#L154 ``ensure_text_type`` raises a Unicode error because subprocess' standard output includes not-encoded-in-utf-8 string. But, I have no idea why there was no problem when I installed qt in root environment. Temporarily, I fixed this problem by modifying ``ensure_text_type`` like this: ``` import chardet def ensure_text_type(value): if isinstance(value, text_type): encoding = 'utf-8' else: encoding = chardet.detect(value).get('encoding') or 'utf-8' return value.decode(encoding) if hasattr(value, 'decode') else value ```
2017-02-09T16:27:11
conda/conda
4,627
conda__conda-4627
[ "4608" ]
02ba2cec99e166719085f46cbe96a95a36a8d460
diff --git a/conda/core/index.py b/conda/core/index.py --- a/conda/core/index.py +++ b/conda/core/index.py @@ -345,7 +345,11 @@ def maybe_decompress(filename, resp_content): """) else: - help_message = "An HTTP error occurred when trying to retrieve this URL.\n%r" % e + help_message = dals(""" + An HTTP error occurred when trying to retrieve this URL. + HTTP errors are often intermittent, and a simple retry will get you on your way. + %r + """) % e raise CondaHTTPError(help_message, getattr(e.response, 'url', None), diff --git a/conda/gateways/download.py b/conda/gateways/download.py --- a/conda/gateways/download.py +++ b/conda/gateways/download.py @@ -115,8 +115,11 @@ def download(url, target_full_path, md5sum): % (url, digest_builder.hexdigest(), md5sum)) except (ConnectionError, HTTPError, SSLError) as e: - # status_code might not exist on SSLError - help_message = "An HTTP error occurred when trying to retrieve this URL.\n%r" % e + help_message = dals(""" + An HTTP error occurred when trying to retrieve this URL. + HTTP errors are often intermittent, and a simple retry will get you on your way. + %r + """) % e raise CondaHTTPError(help_message, getattr(e.response, 'url', None), getattr(e.response, 'status_code', None),
error msg instructions: "Please consider posting the following information to the conda GitHub issue tracker at:" https://github.com/conda/conda/issues # brief description * error when running `conda install -c r r-essentials` at `Could not connect to https://repo.continuum.io/pkgs/free/linux-64/pango-1.40.3-1.tar.bz2` # solution * actually worked after just trying again # final considerations * the error message instructed me to post here, therefore I believe the system was unable to self-diagnose, so maybe this report will be useful so developers can prevent greater issues that this undiagnosed cause might eventually bring up # complete terminal log segtovichisv@segtovichisv-lubuntu1604-vb-scicomp:~$ conda install -c r r-essentials Fetching package metadata ......... Solving package specifications: .......... Package plan for installation in environment /home/segtovichisv/anaconda3: The following packages will be downloaded: package | build ---------------------------|----------------- bzip2-1.0.6 | 3 83 KB conda-env-2.6.0 | 0 502 B libiconv-1.14 | 0 2.0 MB ncurses-5.9 | 10 904 KB pixman-0.34.0 | 0 3.8 MB gsl-2.2.1 | 0 7.7 MB libpng-1.6.27 | 0 219 KB pcre-8.39 | 1 656 KB glib-2.50.2 | 1 5.6 MB requests-2.12.4 | py35_0 800 KB fontconfig-2.12.1 | 3 429 KB cairo-1.14.8 | 0 609 KB pyopenssl-16.2.0 | py35_0 70 KB qt-5.6.2 | 2 44.2 MB conda-4.3.11 | py35_0 497 KB pango-1.40.3 | 1 938 KB pyqt-5.6.0 | py35_2 5.4 MB r-base-3.3.2 | 0 21.7 MB r r-assertthat-0.1 | r3.3.2_4 47 KB r r-backports-1.0.4 | r3.3.2_0 27 KB r r-base64enc-0.1_3 | r3.3.2_0 27 KB r r-bh-1.62.0_1 | r3.3.2_0 8.9 MB r r-bitops-1.0_6 | r3.3.2_2 25 KB r r-boot-1.3_18 | r3.3.2_0 583 KB r r-cluster-2.0.5 | r3.3.2_0 481 KB r r-codetools-0.2_15 | r3.3.2_0 48 KB r r-colorspace-1.3_1 | r3.3.2_0 412 KB r r-crayon-1.3.2 | r3.3.2_0 699 KB r r-curl-2.3 | r3.3.2_0 400 KB r r-data.table-1.10.0 | r3.3.2_0 1.1 MB r r-dbi-0.5_1 | r3.3.2_0 364 KB r r-dichromat-2.0_0 | r3.3.2_2 149 KB r r-digest-0.6.10 | r3.3.2_0 115 KB r r-foreign-0.8_67 | r3.3.2_0 224 KB r r-formatr-1.4 | r3.3.2_0 48 KB r r-gtable-0.2.0 | r3.3.2_0 60 KB r r-highr-0.6 | r3.3.2_0 33 KB r r-hms-0.3 | r3.3.2_0 23 KB r r-iterators-1.0.8 | r3.3.2_0 308 KB r r-jsonlite-1.1 | r3.3.2_0 1.0 MB r r-kernsmooth-2.23_15 | r3.3.2_0 87 KB r r-labeling-0.3 | r3.3.2_2 43 KB r r-lattice-0.20_34 | r3.3.2_0 705 KB r r-lazyeval-0.2.0 | r3.3.2_0 120 KB r r-magrittr-1.5 | r3.3.2_2 159 KB r r-maps-3.1.1 | r3.3.2_0 3.4 MB r r-mass-7.3_45 | r3.3.2_0 1.0 MB r r-mime-0.5 | r3.3.2_0 29 KB r r-mnormt-1.5_5 | r3.3.2_0 67 KB r r-nloptr-1.0.4 | r3.3.2_2 961 KB r r-nnet-7.3_12 | r3.3.2_0 102 KB r r-openssl-0.9.5 | r3.3.2_0 1.2 MB r r-r6-2.2.0 | r3.3.2_0 138 KB r r-randomforest-4.6_12 | r3.3.2_0 144 KB r r-rcolorbrewer-1.1_2 | r3.3.2_3 28 KB r r-rcpp-0.12.8 | r3.3.2_0 2.3 MB r r-repr-0.10 | r3.3.2_0 62 KB r r-rpart-4.1_10 | r3.3.2_0 868 KB r r-sourcetools-0.1.5 | r3.3.2_0 66 KB r r-sparsem-1.74 | r3.3.2_0 874 KB r r-spatial-7.3_11 | r3.3.2_0 128 KB r r-stringi-1.1.2 | r3.3.2_0 699 KB r r-uuid-0.1_2 | r3.3.2_0 20 KB r r-xtable-1.8_2 | r3.3.2_0 692 KB r r-yaml-2.1.14 | r3.3.2_0 84 KB r r-catools-1.17.1 | r3.3.2_2 161 KB r r-class-7.3_14 | r3.3.2_0 85 KB r r-foreach-1.4.3 | r3.3.2_0 372 KB r r-hexbin-1.27.1 | r3.3.2_0 739 KB r r-htmltools-0.3.5 | r3.3.2_0 133 KB r r-httpuv-1.3.3 | r3.3.2_0 337 KB r r-httr-1.2.1 | r3.3.2_0 270 KB r r-irdisplay-0.4.4 | r3.3.2_0 26 KB r r-markdown-0.7.7 | r3.3.2_2 109 KB r r-matrix-1.2_7.1 | r3.3.2_0 2.3 MB r r-minqa-1.2.4 | r3.3.2_2 108 KB r r-modelmetrics-1.1.0 | r3.3.2_0 103 KB r r-munsell-0.4.3 | r3.3.2_0 133 KB r r-nlme-3.1_128 | r3.3.2_0 2.0 MB r r-pbdzmq-0.2_4 | r3.3.2_0 357 KB r r-plyr-1.8.4 | r3.3.2_0 752 KB r r-psych-1.6.9 | r3.3.2_0 3.3 MB r r-readxl-0.1.1 | r3.3.2_0 266 KB r r-rprojroot-1.1 | r3.3.2_0 48 KB r r-stringr-1.1.0 | r3.3.2_0 117 KB r r-tibble-1.2 | r3.3.2_0 155 KB r r-xml2-1.0.0 | r3.3.2_0 238 KB r r-zoo-1.7_13 | r3.3.2_0 867 KB r r-dplyr-0.5.0 | r3.3.2_0 1.7 MB r r-evaluate-0.10 | r3.3.2_0 49 KB r r-forcats-0.1.1 | r3.3.2_0 155 KB r r-glmnet-2.0_5 | r3.3.2_0 1.6 MB r r-htmlwidgets-0.8 | r3.3.2_0 731 KB r r-lubridate-1.6.0 | r3.3.2_0 657 KB r r-matrixmodels-0.4_1 | r3.3.2_0 215 KB r r-mgcv-1.8_16 | r3.3.2_0 2.0 MB r r-pryr-0.1.2 | r3.3.2_0 200 KB r r-rcppeigen-0.3.2.9.0 | r3.3.2_0 1.6 MB r r-readr-1.0.0 | r3.3.2_0 568 KB r r-reshape2-1.4.2 | r3.3.2_0 107 KB r r-scales-0.4.1 | r3.3.2_0 218 KB r r-selectr-0.3_0 | r3.3.2_0 163 KB r r-shiny-0.14.2 | r3.3.2_0 2.4 MB r r-survival-2.40_1 | r3.3.2_0 4.8 MB r r-xts-0.9_7 | r3.3.2_2 611 KB r r-ggplot2-2.2.0 | r3.3.2_0 2.7 MB r r-haven-1.0.0 | r3.3.2_0 255 KB r r-irkernel-0.7.1 | r3.3.2_0 112 KB r r-knitr-1.15.1 | r3.3.2_0 835 KB r r-lme4-1.1_12 | r3.3.2_0 4.4 MB r r-purrr-0.2.2 | r3.3.2_0 364 KB r r-quantreg-5.29 | r3.3.2_0 1.8 MB r r-recommended-3.3.2 | r3.3.2_0 2 KB r r-rvest-0.3.2 | r3.3.2_0 837 KB r r-tidyr-0.6.0 | r3.3.2_0 370 KB r r-ttr-0.23_1 | r3.3.2_0 419 KB r r-broom-0.4.1 | r3.3.2_0 1.6 MB r r-pbkrtest-0.4_6 | r3.3.2_0 215 KB r r-quantmod-0.4_7 | r3.3.2_0 483 KB r r-rmarkdown-1.2 | r3.3.2_0 1.8 MB r r-car-2.1_4 | r3.3.2_0 1.4 MB r r-gistr-0.3.6 | r3.3.2_0 1.8 MB r r-modelr-0.1.0 | r3.3.2_0 132 KB r r-caret-6.0_73 | r3.3.2_0 4.7 MB r r-rbokeh-0.5.0 | r3.3.2_0 1.2 MB r r-tidyverse-1.0.0 | r3.3.2_0 23 KB r r-essentials-1.5.1 | 0 2 KB r ------------------------------------------------------------ Total: 180.1 MB The following NEW packages will be INSTALLED: bzip2: 1.0.6-3 gsl: 2.2.1-0 libiconv: 1.14-0 ncurses: 5.9-10 pango: 1.40.3-1 pcre: 8.39-1 r-assertthat: 0.1-r3.3.2_4 r r-backports: 1.0.4-r3.3.2_0 r r-base: 3.3.2-0 r r-base64enc: 0.1_3-r3.3.2_0 r r-bh: 1.62.0_1-r3.3.2_0 r r-bitops: 1.0_6-r3.3.2_2 r r-boot: 1.3_18-r3.3.2_0 r r-broom: 0.4.1-r3.3.2_0 r r-car: 2.1_4-r3.3.2_0 r r-caret: 6.0_73-r3.3.2_0 r r-catools: 1.17.1-r3.3.2_2 r r-class: 7.3_14-r3.3.2_0 r r-cluster: 2.0.5-r3.3.2_0 r r-codetools: 0.2_15-r3.3.2_0 r r-colorspace: 1.3_1-r3.3.2_0 r r-crayon: 1.3.2-r3.3.2_0 r r-curl: 2.3-r3.3.2_0 r r-data.table: 1.10.0-r3.3.2_0 r r-dbi: 0.5_1-r3.3.2_0 r r-dichromat: 2.0_0-r3.3.2_2 r r-digest: 0.6.10-r3.3.2_0 r r-dplyr: 0.5.0-r3.3.2_0 r r-essentials: 1.5.1-0 r r-evaluate: 0.10-r3.3.2_0 r r-forcats: 0.1.1-r3.3.2_0 r r-foreach: 1.4.3-r3.3.2_0 r r-foreign: 0.8_67-r3.3.2_0 r r-formatr: 1.4-r3.3.2_0 r r-ggplot2: 2.2.0-r3.3.2_0 r r-gistr: 0.3.6-r3.3.2_0 r r-glmnet: 2.0_5-r3.3.2_0 r r-gtable: 0.2.0-r3.3.2_0 r r-haven: 1.0.0-r3.3.2_0 r r-hexbin: 1.27.1-r3.3.2_0 r r-highr: 0.6-r3.3.2_0 r r-hms: 0.3-r3.3.2_0 r r-htmltools: 0.3.5-r3.3.2_0 r r-htmlwidgets: 0.8-r3.3.2_0 r r-httpuv: 1.3.3-r3.3.2_0 r r-httr: 1.2.1-r3.3.2_0 r r-irdisplay: 0.4.4-r3.3.2_0 r r-irkernel: 0.7.1-r3.3.2_0 r r-iterators: 1.0.8-r3.3.2_0 r r-jsonlite: 1.1-r3.3.2_0 r r-kernsmooth: 2.23_15-r3.3.2_0 r r-knitr: 1.15.1-r3.3.2_0 r r-labeling: 0.3-r3.3.2_2 r r-lattice: 0.20_34-r3.3.2_0 r r-lazyeval: 0.2.0-r3.3.2_0 r r-lme4: 1.1_12-r3.3.2_0 r r-lubridate: 1.6.0-r3.3.2_0 r r-magrittr: 1.5-r3.3.2_2 r r-maps: 3.1.1-r3.3.2_0 r r-markdown: 0.7.7-r3.3.2_2 r r-mass: 7.3_45-r3.3.2_0 r r-matrix: 1.2_7.1-r3.3.2_0 r r-matrixmodels: 0.4_1-r3.3.2_0 r r-mgcv: 1.8_16-r3.3.2_0 r r-mime: 0.5-r3.3.2_0 r r-minqa: 1.2.4-r3.3.2_2 r r-mnormt: 1.5_5-r3.3.2_0 r r-modelmetrics: 1.1.0-r3.3.2_0 r r-modelr: 0.1.0-r3.3.2_0 r r-munsell: 0.4.3-r3.3.2_0 r r-nlme: 3.1_128-r3.3.2_0 r r-nloptr: 1.0.4-r3.3.2_2 r r-nnet: 7.3_12-r3.3.2_0 r r-openssl: 0.9.5-r3.3.2_0 r r-pbdzmq: 0.2_4-r3.3.2_0 r r-pbkrtest: 0.4_6-r3.3.2_0 r r-plyr: 1.8.4-r3.3.2_0 r r-pryr: 0.1.2-r3.3.2_0 r r-psych: 1.6.9-r3.3.2_0 r r-purrr: 0.2.2-r3.3.2_0 r r-quantmod: 0.4_7-r3.3.2_0 r r-quantreg: 5.29-r3.3.2_0 r r-r6: 2.2.0-r3.3.2_0 r r-randomforest: 4.6_12-r3.3.2_0 r r-rbokeh: 0.5.0-r3.3.2_0 r r-rcolorbrewer: 1.1_2-r3.3.2_3 r r-rcpp: 0.12.8-r3.3.2_0 r r-rcppeigen: 0.3.2.9.0-r3.3.2_0 r r-readr: 1.0.0-r3.3.2_0 r r-readxl: 0.1.1-r3.3.2_0 r r-recommended: 3.3.2-r3.3.2_0 r r-repr: 0.10-r3.3.2_0 r r-reshape2: 1.4.2-r3.3.2_0 r r-rmarkdown: 1.2-r3.3.2_0 r r-rpart: 4.1_10-r3.3.2_0 r r-rprojroot: 1.1-r3.3.2_0 r r-rvest: 0.3.2-r3.3.2_0 r r-scales: 0.4.1-r3.3.2_0 r r-selectr: 0.3_0-r3.3.2_0 r r-shiny: 0.14.2-r3.3.2_0 r r-sourcetools: 0.1.5-r3.3.2_0 r r-sparsem: 1.74-r3.3.2_0 r r-spatial: 7.3_11-r3.3.2_0 r r-stringi: 1.1.2-r3.3.2_0 r r-stringr: 1.1.0-r3.3.2_0 r r-survival: 2.40_1-r3.3.2_0 r r-tibble: 1.2-r3.3.2_0 r r-tidyr: 0.6.0-r3.3.2_0 r r-tidyverse: 1.0.0-r3.3.2_0 r r-ttr: 0.23_1-r3.3.2_0 r r-uuid: 0.1_2-r3.3.2_0 r r-xml2: 1.0.0-r3.3.2_0 r r-xtable: 1.8_2-r3.3.2_0 r r-xts: 0.9_7-r3.3.2_2 r r-yaml: 2.1.14-r3.3.2_0 r r-zoo: 1.7_13-r3.3.2_0 r The following packages will be UPDATED: cairo: 1.12.18-6 --> 1.14.8-0 conda: 4.2.12-py35_0 anaconda --> 4.3.11-py35_0 fontconfig: 2.11.1-6 --> 2.12.1-3 glib: 2.43.0-1 --> 2.50.2-1 libpng: 1.6.22-0 --> 1.6.27-0 pixman: 0.32.6-0 --> 0.34.0-0 pyopenssl: 16.0.0-py35_0 --> 16.2.0-py35_0 pyqt: 5.6.0-py35_0 --> 5.6.0-py35_2 qt: 5.6.0-0 --> 5.6.2-2 requests: 2.11.1-py35_0 --> 2.12.4-py35_0 The following packages will be SUPERCEDED by a higher-priority channel: conda-env: 2.6.0-0 anaconda --> 2.6.0-0 Proceed ([y]/n)? y Pruning fetched packages from the cache ... Fetching packages ... bzip2-1.0.6-3. 100% |################################| Time: 0:00:00 402.22 kB/s conda-env-2.6. 100% |################################| Time: 0:00:00 357.66 kB/s libiconv-1.14- 100% |################################| Time: 0:00:05 405.53 kB/s ncurses-5.9-10 100% |################################| Time: 0:00:02 324.94 kB/s pixman-0.34.0- 100% |################################| Time: 0:00:13 305.75 kB/s gsl-2.2.1-0.ta 100% |################################| Time: 0:00:25 322.50 kB/s libpng-1.6.27- 100% |################################| Time: 0:00:01 205.81 kB/s pcre-8.39-1.ta 100% |################################| Time: 0:00:02 246.67 kB/s glib-2.50.2-1. 100% |################################| Time: 0:00:17 333.89 kB/s requests-2.12. 100% |################################| Time: 0:00:01 636.73 kB/s fontconfig-2.1 100% |################################| Time: 0:00:00 1.26 MB/s cairo-1.14.8-0 100% |################################| Time: 0:00:00 751.88 kB/s pyopenssl-16.2 100% |################################| Time: 0:00:00 852.96 kB/s qt-5.6.2-2.tar 100% |################################| Time: 0:02:31 307.16 kB/s conda-4.3.11-p 100% |################################| Time: 0:00:06 73.85 kB/s Could not connect to https://repo.continuum.io/pkgs/free/linux-64/pango-1.40.3-1.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.2.12 conda is private : False conda-env version : 4.2.12 conda-build version : 2.0.2 python version : 3.5.2.final.0 requests version : 2.11.1 root environment : /home/segtovichisv/anaconda3 (writable) default environment : /home/segtovichisv/anaconda3 envs directories : /home/segtovichisv/anaconda3/envs package cache : /home/segtovichisv/anaconda3/pkgs channel URLs : https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch config file : None offline mode : False `$ /home/segtovichisv/anaconda3/bin/conda install -c r r-essentials` Traceback (most recent call last): File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 352, in _make_request self._validate_conn(conn) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 831, in _validate_conn conn.connect() File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 289, in connect ssl_version=resolved_ssl_version) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/util/ssl_.py", line 308, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "/home/segtovichisv/anaconda3/lib/python3.5/ssl.py", line 377, in wrap_socket _context=self) File "/home/segtovichisv/anaconda3/lib/python3.5/ssl.py", line 752, in __init__ self.do_handshake() File "/home/segtovichisv/anaconda3/lib/python3.5/ssl.py", line 988, in do_handshake self._sslobj.do_handshake() File "/home/segtovichisv/anaconda3/lib/python3.5/ssl.py", line 633, in do_handshake self._sslobj.do_handshake() socket.timeout: _ssl.c:629: The handshake operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 595, in urlopen chunked=chunked) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 355, in _make_request self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 315, in _raise_timeout raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value) requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='repo.continuum.io', port=443): Read timed out. (read timeout=3.05) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 423, in send timeout=timeout File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 668, in urlopen release_conn=release_conn, **response_kw) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 668, in urlopen release_conn=release_conn, **response_kw) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 668, in urlopen release_conn=release_conn, **response_kw) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 640, in urlopen _stacktrace=sys.exc_info()[2]) File "/home/segtovichisv/anaconda3/lib/python3.5/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/linux-64/pango-1.40.3-1.tar.bz2 (Caused by ReadTimeoutError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Read timed out. (read timeout=3.05)",)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 404, in download resp = session.get(url, stream=True, proxies=session.proxies, timeout=(3.05, 27)) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 488, in get return self.request('GET', url, **kwargs) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 475, in request resp = self.send(prep, **send_kwargs) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 596, in send r = adapter.send(request, **kwargs) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 487, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/free/linux-64/pango-1.40.3-1.tar.bz2 (Caused by ReadTimeoutError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Read timed out. (read timeout=3.05)",)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/cli/install.py", line 405, in install execute_actions(actions, index, verbose=not context.quiet) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/plan.py", line 643, in execute_actions inst.execute_instructions(plan, index, verbose) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/instructions.py", line 134, in execute_instructions cmd(state, arg) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/instructions.py", line 47, in FETCH_CMD fetch_pkg(state['index'][arg + '.tar.bz2']) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 363, in fetch_pkg download(url, path, session=session, md5=info['md5'], urlstxt=True) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 415, in download raise CondaRuntimeError(msg) conda.exceptions.CondaRuntimeError: Runtime error: Connection error: HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/free/linux-64/pango-1.40.3-1.tar.bz2 (Caused by ReadTimeoutError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Read timed out. (read timeout=3.05)",)): https://repo.continuum.io/pkgs/free/linux-64/pango-1.40.3-1.tar.bz2 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/exceptions.py", line 479, in conda_exception_handler return_value = func(*args, **kwargs) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/cli/main.py", line 145, in _main exit_code = args.func(args, p) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/cli/install.py", line 422, in install raise CondaSystemExit('Exiting', e) File "/home/segtovichisv/anaconda3/lib/python3.5/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/cli/common.py", line 573, in json_progress_bars yield File "/home/segtovichisv/anaconda3/lib/python3.5/site-packages/conda/cli/install.py", line 420, in install raise CondaRuntimeError('RuntimeError: %s' % e) conda.exceptions.CondaRuntimeError: Runtime error: RuntimeError: Runtime error: Connection error: HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/free/linux-64/pango-1.40.3-1.tar.bz2 (Caused by ReadTimeoutError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Read timed out. (read timeout=3.05)",)): https://repo.continuum.io/pkgs/free/linux-64/pango-1.40.3-1.tar.bz2 segtovichisv@segtovichisv-lubuntu1604-vb-scicomp:~$
2017-02-14T06:15:21
conda/conda
4,628
conda__conda-4628
[ "4592", "4592" ]
7f5570e4afb9ae9ddf0a900a54115144f2fe2a38
diff --git a/conda/core/index.py b/conda/core/index.py --- a/conda/core/index.py +++ b/conda/core/index.py @@ -154,7 +154,9 @@ def read_mod_and_etag(path): match_objects = take(3, re.finditer(REPODATA_HEADER_RE, m)) result = dict(map(ensure_unicode, mo.groups()) for mo in match_objects) return result - except ValueError: + except (BufferError, ValueError): + # BufferError: cannot close exported pointers exist + # https://github.com/conda/conda/issues/4592 # ValueError: cannot mmap an empty file return {}
BufferError when trying to update conda I get the following error when running the `conda update conda` command. The error message does not seem to provide any hint of what may be wrong. Anyone has a guess of what might be the problem? ``` PS C:\> conda update conda Fetching package metadata ...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.7 conda is private : False conda-env version : 4.3.7 conda-build version : 1.21.6 python version : 3.4.0.final.0 requests version : 2.12.4 root environment : C:\Anaconda3 (writable) default environment : C:\Anaconda3 envs directories : C:\Anaconda3\envs package cache : C:\Anaconda3\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 : None offline mode : False user-agent : conda/4.3.7 requests/2.12.4 CPython/3.4.0 Windows/7 Windows/6.1.7601 `$ C:\Anaconda3\Scripts\conda-script.py update conda` Traceback (most recent call last): File "C:\Anaconda3\lib\site-packages\conda\exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Anaconda3\lib\site-packages\conda\cli\main.py", line 137, in _main exit_code = args.func(args, p) File "C:\Anaconda3\lib\site-packages\conda\cli\main_update.py", line 65, in execute install(args, parser, 'update') File "C:\Anaconda3\lib\site-packages\conda\cli\install.py", line 210, in install unknown=index_args['unknown'], prefix=prefix) File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 120, in get_index index = fetch_index(channel_priority_map, use_cache=use_cache) File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 445, in fetch_index repodatas = _collect_repodatas(use_cache, urls) File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 433, in _collect_repodatas repodatas = _collect_repodatas_serial(use_cache, urls) File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 401, in _collect_repodatas_serial for url in urls] File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 401, in <listcomp> for url in urls] File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 141, in func res = f(*args, **kwargs) File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 364, in fetch_repodata mod_etag_headers = read_mod_and_etag(cache_path) File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 153, in read_mod_and_etag return result File "C:\Anaconda3\lib\contextlib.py", line 152, in __exit__ self.thing.close() BufferError: cannot close exported pointers exist PS C:\> ``` BufferError when trying to update conda I get the following error when running the `conda update conda` command. The error message does not seem to provide any hint of what may be wrong. Anyone has a guess of what might be the problem? ``` PS C:\> conda update conda Fetching package metadata ...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.7 conda is private : False conda-env version : 4.3.7 conda-build version : 1.21.6 python version : 3.4.0.final.0 requests version : 2.12.4 root environment : C:\Anaconda3 (writable) default environment : C:\Anaconda3 envs directories : C:\Anaconda3\envs package cache : C:\Anaconda3\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 : None offline mode : False user-agent : conda/4.3.7 requests/2.12.4 CPython/3.4.0 Windows/7 Windows/6.1.7601 `$ C:\Anaconda3\Scripts\conda-script.py update conda` Traceback (most recent call last): File "C:\Anaconda3\lib\site-packages\conda\exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Anaconda3\lib\site-packages\conda\cli\main.py", line 137, in _main exit_code = args.func(args, p) File "C:\Anaconda3\lib\site-packages\conda\cli\main_update.py", line 65, in execute install(args, parser, 'update') File "C:\Anaconda3\lib\site-packages\conda\cli\install.py", line 210, in install unknown=index_args['unknown'], prefix=prefix) File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 120, in get_index index = fetch_index(channel_priority_map, use_cache=use_cache) File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 445, in fetch_index repodatas = _collect_repodatas(use_cache, urls) File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 433, in _collect_repodatas repodatas = _collect_repodatas_serial(use_cache, urls) File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 401, in _collect_repodatas_serial for url in urls] File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 401, in <listcomp> for url in urls] File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 141, in func res = f(*args, **kwargs) File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 364, in fetch_repodata mod_etag_headers = read_mod_and_etag(cache_path) File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 153, in read_mod_and_etag return result File "C:\Anaconda3\lib\contextlib.py", line 152, in __exit__ self.thing.close() BufferError: cannot close exported pointers exist PS C:\> ```
Thanks for the report. Definitely one I haven't seen before. Easy fix though. Thanks for the report. Definitely one I haven't seen before. Easy fix though.
2017-02-14T06:28:29
conda/conda
4,637
conda__conda-4637
[ "4636", "4636" ]
9501f4fde15aad95c7905331a1c48e650ff9824a
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -282,7 +282,7 @@ def envs_dirs(self): @property def pkgs_dirs(self): if self._pkgs_dirs: - return tuple(IndexedSet(self._pkgs_dirs)) + return tuple(IndexedSet(expand(p) for p in self._pkgs_dirs)) else: cache_dir_name = 'pkgs32' if context.force_32bit else 'pkgs' return tuple(IndexedSet(expand(join(p, cache_dir_name)) for p in (
Condarc `pkgs_dirs` setting does not understand environment variables Tested with Conda 4.3.11 on ubuntu 16.04 and centos 7 The existing `envs_dirs` setting will interpret environment variables (very useful feature). This behavior does not seem to have carried over to the new `pkgs_dirs` option and instead, the environment variable is treated as a verbatim directory name. A possible workaround is to use the `CONDA_PKGS_DIRS` environment variable. Example `.condarc`: ``` envs_dirs: - $CONDA_WORKING_DIR/envs pkgs_dirs: - $CONDA_WORKING_DIR/pkgs ``` Then: ``` $ export CONDA_WORKING_DIR=/home/tim/Anaconda $ conda info Current conda install: platform : linux-64 conda version : 4.3.11 conda is private : False conda-env version : 4.3.11 conda-build version : not installed python version : 2.7.13.final.0 requests version : 2.12.4 root environment : /home/tim/miniconda2 (writable) default environment : /home/tim/miniconda2 envs directories : /home/tim/Anaconda/envs /home/tim/miniconda2/envs /home/tim/.conda/envs package cache : $CONDA_WORKING_DIR/pkgs channel URLs : 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/tim/.condarc offline mode : False user-agent : conda/4.3.11 requests/2.12.4 CPython/2.7.13 Linux/4.4.0-59-generic debian/stretch/sid glibc/2.23 UID:GID : 1000:1000 ``` Condarc `pkgs_dirs` setting does not understand environment variables Tested with Conda 4.3.11 on ubuntu 16.04 and centos 7 The existing `envs_dirs` setting will interpret environment variables (very useful feature). This behavior does not seem to have carried over to the new `pkgs_dirs` option and instead, the environment variable is treated as a verbatim directory name. A possible workaround is to use the `CONDA_PKGS_DIRS` environment variable. Example `.condarc`: ``` envs_dirs: - $CONDA_WORKING_DIR/envs pkgs_dirs: - $CONDA_WORKING_DIR/pkgs ``` Then: ``` $ export CONDA_WORKING_DIR=/home/tim/Anaconda $ conda info Current conda install: platform : linux-64 conda version : 4.3.11 conda is private : False conda-env version : 4.3.11 conda-build version : not installed python version : 2.7.13.final.0 requests version : 2.12.4 root environment : /home/tim/miniconda2 (writable) default environment : /home/tim/miniconda2 envs directories : /home/tim/Anaconda/envs /home/tim/miniconda2/envs /home/tim/.conda/envs package cache : $CONDA_WORKING_DIR/pkgs channel URLs : 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/tim/.condarc offline mode : False user-agent : conda/4.3.11 requests/2.12.4 CPython/2.7.13 Linux/4.4.0-59-generic debian/stretch/sid glibc/2.23 UID:GID : 1000:1000 ```
2017-02-14T22:23:49
conda/conda
4,647
conda__conda-4647
[ "2384" ]
d5a69ae91e5e2b8e4391cbcaa48e2bf9e52f3c9b
diff --git a/conda/resolve.py b/conda/resolve.py --- a/conda/resolve.py +++ b/conda/resolve.py @@ -875,11 +875,10 @@ def mysat(specs, add_if=False): solution, obj7 = C.minimize(eq_optional_c, solution) log.debug('Package removal metric: %d', obj7) - # Requested packages: maximize versions, then builds + # Requested packages: maximize versions eq_req_v, eq_req_b = r2.generate_version_metrics(C, specr) solution, obj3 = C.minimize(eq_req_v, solution) - solution, obj4 = C.minimize(eq_req_b, solution) - log.debug('Initial package version/build metrics: %d/%d', obj3, obj4) + log.debug('Initial package version metric: %d', obj3) # Track features: minimize feature count eq_feature_count = r2.generate_feature_count(C) @@ -892,7 +891,11 @@ def mysat(specs, add_if=False): obj2 = ftotal - obj2 log.debug('Package feature count: %d', obj2) - # Dependencies: minimize the number that need upgrading + # Requested packages: maximize builds + solution, obj4 = C.minimize(eq_req_b, solution) + log.debug('Initial package build metric: %d', obj4) + + # Dependencies: minimize the number of packages that need upgrading eq_u = r2.generate_update_count(C, speca) solution, obj50 = C.minimize(eq_u, solution) log.debug('Dependency update count: %d', obj50)
Conda is installing unrequested feature This seems to be a regression in `conda` 4.0. I have created two test packages just to check this. They are empty and have just the `meta.yaml`: test-release: ``` yaml package: name: test version: "1.0" build: number: 0 features: ``` test-debug: ``` yaml package: name: test version: "1.0" build: number: 1 features: - debug requirements: run: - debug ``` (`debug` is the anaconda metapackage that only tracks the `debug` feature.) Now, when creating a new environment with only the `test` package, it tries to install the `debug` version: ``` sh $ conda create -n test-pkg test=1.0 Fetching package metadata: ...... Solving package specifications: ......... Package plan for installation in environment D:\Miniconda\envs\test-pkg: The following NEW packages will be INSTALLED: debug: 1.0-0 test: 1.0-debug_1 [debug] Proceed ([y]/n)? ```
What happens if you use the same build number for both? Then it won't try to install `debug`. It only happens when the build number of the package with the feature is higher. Quick question: you say 4.0, but are you using the latest version (4.0.5), or truly just 4.0? Sorry, it is 4.0.5. I just assumed the regression was on the change from 3 to 4, since it seems the dependency solving was overhauled. Any news on this? We are having to work on a "brittle" version of conda here --'. Thanks! I think that this might be related to #4624. Regarding this one, I think I now understand what's going on. When performing the command `conda create -n test-pkg test=1.0`, conda's _first_ priority is to obtain the latest version and build of the packages specified on the command line. In this case, that means it is going to favor `test-1.0-1`. Since the only version of the package with this version and build number is the debug version, it _must_ install that one. The bug here is that features are never supposed to be pulled in involuntarily. So conda shouldn't be allowed to select the feature in that case. Now, if you give both packages the _same_ build number, `conda create -n test-pkg test=1.0` now has a choice. There are two packages with the same version and build number, one with the `debug` feature, and one without. In this case, conda _always_ picks the one with the fewest features. So the non-debug version wins. Again, that's correct behavior. If you want to force the debug feature in that second case, you must do `conda create -n test-pkg test=1.0 debug`. That will guarantee that the `debug` version of the package is installed. So the lesson here is that for now, if you want to avoid strange behavior, the build numbers need to line up. However, I can understand why that would be confusing. Frankly, features _are_ confusing, and brittle, and I would prefer we not use them, and find other ways to implement our requirements. Agreed, @SylvainCorlay, this may indeed be related. Do you use the exact same build numbers for your `cling` builds? Yes I did! Thanks for looking into this. On Feb 14, 2017 8:49 PM, "Michael C. Grant" <[email protected]> wrote: > Agreed, @SylvainCorlay <https://github.com/SylvainCorlay>, this may > indeed be related. Do you use the exact same build numbers for your cling > builds? > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <https://github.com/conda/conda/issues/2384#issuecomment-279815579>, or mute > the thread > <https://github.com/notifications/unsubscribe-auth/ACSXFkV6G3JPcv5Vvls7-1MzAGqXnLATks5rcgU1gaJpZM4IL-YC> > . > Looks like we have a resolution and understanding at least if this particular issue. Well, if @SylvainCorlay is using the same build numbers there's still something else going on. I'm not sure that either this issue or his other issue should be closed, because neither has really been solved.
2017-02-15T15:45:44
conda/conda
4,651
conda__conda-4651
[ "4649", "4649" ]
b583c5534879cb07575bbcc384291d239452b37d
diff --git a/conda/core/index.py b/conda/core/index.py --- a/conda/core/index.py +++ b/conda/core/index.py @@ -591,8 +591,6 @@ def add_http_value_to_dict(resp, http_key, d, dict_key): def create_cache_dir(): - pkgs_dir = PackageCache.first_writable(context.pkgs_dirs).pkgs_dir - assert pkgs_dir == context.pkgs_dirs[0], (pkgs_dir, context.pkgs_dirs) cache_dir = join(PackageCache.first_writable(context.pkgs_dirs).pkgs_dir, 'cache') try: makedirs(cache_dir)
Package cache error with conda 4.3.12 on win64 Following error occurs when I try to create a new environment with conda 4.3.12 on win64: `$ C:\Program Files\Anaconda3\Scripts\conda-script.py create -p C:\hub\temp\venv python=3.5` Traceback (most recent call last): File "C:\Program Files\Anaconda3\lib\site-packages\conda\exceptions.py", line 616, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main.py", line 137, in _main exit_code = args.func(args, p) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main_create.py", line 68, in execute install(args, parser, 'create') File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\install.py", line 222, in install unknown=index_args['unknown'], prefix=prefix) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 125, in get_index index = fetch_index(channel_priority_map, use_cache=use_cache) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 558, in fetch_index repodatas = _collect_repodatas(use_cache, tasks) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 547, in _collect_repodatas repodatas = _collect_repodatas_serial(use_cache, tasks) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 520, in _collect_repodatas_serial for url, schan, pri in tasks] File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 520, in <listcomp> for url, schan, pri in tasks] File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 144, in func res = f(*args, **kwargs) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 464, in fetch_repodata cache_path = join(cache_dir or create_cache_dir(), cache_fn_url(url)) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 596, in create_cache_dir assert pkgs_dir == context.pkgs_dirs[0], (pkgs_dir, context.pkgs_dirs) AssertionError: ('C:\\Users\\xxx\\AppData\\Local\\conda\\conda\\pkgs', ('C:\\Program Files\\Anaconda3\\pkgs', 'C:\\Users\\xxx\\AppData\\Local\\conda\\conda\\pkgs')) Conda info is: platform : win-64 conda version : 4.3.12 conda is private : False conda-env version : 4.3.12 conda-build version : 2.1.4 python version : 3.6.0.final.0 requests version : 2.12.4 root environment : C:\Program Files\Anaconda3 (read only) default environment : C:\Program Files\Anaconda3 envs directories : C:\Program Files\Anaconda3\envs C:\Users\xxx\AppData\Local\conda\conda\envs C:\Users\xxx\.conda\envs package cache : C:\Program Files\Anaconda3\pkgs C:\Users\xxx\AppData\Local\conda\conda\pkgs channel URLs : [...] config file : C:\Program Files\Anaconda3\.condarc offline mode : False user-agent : conda/4.3.12 requests/2.12.4 CPython/3.6.0 Windows/10 Windows/10.0.10240 Somehow the program files cache dir is prioritized even if it is not writable. Works with 4.3.9, throws a different error with 4.3.11 (part of the stack trace below) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 494, in fetch_repodata touch(cache_path) File "C:\Program Files\Anaconda3\lib\site-packages\conda\gateways\disk\update.py", line 64, in touch utime(path, None) PermissionError: [WinError 5] Access is denied: 'C:\\Program Files\\Anaconda3\\pkgs\\cache\\3e904a53.json' Package cache error with conda 4.3.12 on win64 Following error occurs when I try to create a new environment with conda 4.3.12 on win64: `$ C:\Program Files\Anaconda3\Scripts\conda-script.py create -p C:\hub\temp\venv python=3.5` Traceback (most recent call last): File "C:\Program Files\Anaconda3\lib\site-packages\conda\exceptions.py", line 616, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main.py", line 137, in _main exit_code = args.func(args, p) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main_create.py", line 68, in execute install(args, parser, 'create') File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\install.py", line 222, in install unknown=index_args['unknown'], prefix=prefix) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 125, in get_index index = fetch_index(channel_priority_map, use_cache=use_cache) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 558, in fetch_index repodatas = _collect_repodatas(use_cache, tasks) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 547, in _collect_repodatas repodatas = _collect_repodatas_serial(use_cache, tasks) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 520, in _collect_repodatas_serial for url, schan, pri in tasks] File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 520, in <listcomp> for url, schan, pri in tasks] File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 144, in func res = f(*args, **kwargs) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 464, in fetch_repodata cache_path = join(cache_dir or create_cache_dir(), cache_fn_url(url)) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 596, in create_cache_dir assert pkgs_dir == context.pkgs_dirs[0], (pkgs_dir, context.pkgs_dirs) AssertionError: ('C:\\Users\\xxx\\AppData\\Local\\conda\\conda\\pkgs', ('C:\\Program Files\\Anaconda3\\pkgs', 'C:\\Users\\xxx\\AppData\\Local\\conda\\conda\\pkgs')) Conda info is: platform : win-64 conda version : 4.3.12 conda is private : False conda-env version : 4.3.12 conda-build version : 2.1.4 python version : 3.6.0.final.0 requests version : 2.12.4 root environment : C:\Program Files\Anaconda3 (read only) default environment : C:\Program Files\Anaconda3 envs directories : C:\Program Files\Anaconda3\envs C:\Users\xxx\AppData\Local\conda\conda\envs C:\Users\xxx\.conda\envs package cache : C:\Program Files\Anaconda3\pkgs C:\Users\xxx\AppData\Local\conda\conda\pkgs channel URLs : [...] config file : C:\Program Files\Anaconda3\.condarc offline mode : False user-agent : conda/4.3.12 requests/2.12.4 CPython/3.6.0 Windows/10 Windows/10.0.10240 Somehow the program files cache dir is prioritized even if it is not writable. Works with 4.3.9, throws a different error with 4.3.11 (part of the stack trace below) File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py", line 494, in fetch_repodata touch(cache_path) File "C:\Program Files\Anaconda3\lib\site-packages\conda\gateways\disk\update.py", line 64, in touch utime(path, None) PermissionError: [WinError 5] Access is denied: 'C:\\Program Files\\Anaconda3\\pkgs\\cache\\3e904a53.json'
@wulmer Thanks for the report. That `assert` is incorrect, and it was a mistake that it got left in. Can you do me a favor and edit your file C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py by removing the `assert` on line `596`? See if that fixes your issue... Thanks for using canary btw :) > Somehow the program files cache dir is prioritized even if it is not writable It's being correctly recognized now as a read-only cache. The "first writable cache" is `C:\Users\xxx\AppData\Local\conda\conda\pkgs`, which is why that assert statement is incorrect. @wulmer Thanks for the report. That `assert` is incorrect, and it was a mistake that it got left in. Can you do me a favor and edit your file C:\Program Files\Anaconda3\lib\site-packages\conda\core\index.py by removing the `assert` on line `596`? See if that fixes your issue... Thanks for using canary btw :) > Somehow the program files cache dir is prioritized even if it is not writable It's being correctly recognized now as a read-only cache. The "first writable cache" is `C:\Users\xxx\AppData\Local\conda\conda\pkgs`, which is why that assert statement is incorrect.
2017-02-15T19:10:02
conda/conda
4,709
conda__conda-4709
[ "4703" ]
49408ea466a2f632c391521a4991d3bfe3cdf46f
diff --git a/conda/gateways/disk/create.py b/conda/gateways/disk/create.py --- a/conda/gateways/disk/create.py +++ b/conda/gateways/disk/create.py @@ -138,8 +138,8 @@ def make_menu(prefix, file_path, remove=False): log.warn("Environment name starts with underscore '_'. Skipping menu installation.") return - import menuinst try: + import menuinst menuinst.install(join(prefix, win_path_ok(file_path)), remove, prefix) except: stdoutlog.error("menuinst Exception:")
Error installing ipython When trying to `conda install anaconda` on a Windows NanoServer container I continually get the below error when it tries to install ipython: ``` ERROR conda.core.link:_execute_actions(330): An error occurred while installing package 'defaults::ipython-5.1.0-py36_0'. PathNotFoundException() Attempting to roll back. PathNotFoundException() ``` This error causes the build of the container to fail (anaconda doesn't get installed). Is there anyway to debug the problem? `conda 4.3.13 py36_0`
add `-v -v -v` to your commandline. Yeah I'm not seeing `PathNotFoundException` anywhere in conda code. `-vvv` should help Sorry, should have thought of that myself - I just wanted to post the exception in case it rang a bell. The output from trying to install ipython is available at: https://gist.github.com/dhirschfeld/b50c2a3640ae4b3fd10511acbaecf8eb NB: I've seen menuinst errors before with ipython. Usually to do with not being admin, but I think the docker build runs as the container admin - will have to check. Either way the error seems to prevent the install from happening :/ Ah NanoServer doesn't have these folders I don't think. Does it even have a Start Menu? (or GUI?) @mingwandroid - that's right, NanoServer doesn't have any GUI or desktop so wouldn't have a Start Menu. This means you can't remote desktop into it as you usually would on Windows but instead manage it via powershell. I guess that explains the error. I'm wondering how to work around it short of rebuilding the ipython package without the menuinst component?
2017-02-23T02:52:44
conda/conda
4,711
conda__conda-4711
[ "4694" ]
49408ea466a2f632c391521a4991d3bfe3cdf46f
diff --git a/conda/models/channel.py b/conda/models/channel.py --- a/conda/models/channel.py +++ b/conda/models/channel.py @@ -3,15 +3,14 @@ from itertools import chain from logging import getLogger -from requests.packages.urllib3.util import Url from ..base.constants import (DEFAULTS_CHANNEL_NAME, DEFAULT_CHANNELS_UNIX, DEFAULT_CHANNELS_WIN, MAX_CHANNEL_PRIORITY, UNKNOWN_CHANNEL) from ..base.context import context from ..common.compat import ensure_text_type, iteritems, odict, with_metaclass from ..common.path import is_path, win_path_backout -from ..common.url import (has_scheme, is_url, join_url, path_to_url, split_conda_url_easy_parts, - split_scheme_auth_token, urlparse) +from ..common.url import (Url, has_scheme, is_url, join_url, path_to_url, + split_conda_url_easy_parts, split_scheme_auth_token, urlparse) try: from cytoolz.functoolz import excepts
conda navigator install Install attempt on a Windows 10 machine From the command prompt: ``` C:\Users\rbaer>conda install anaconda-navigator 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 "C:\Anaconda\lib\site-packages\requests\packages\__init__.py", line 27, in <module> from . import urllib3 File "C:\Anaconda\lib\site-packages\requests\packages\urllib3\__init__.py", line 8, in <module> from .connectionpool import ( File "C:\Anaconda\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 28, in <module> from .packages.six.moves.queue import LifoQueue, Empty, Full File "C:\Anaconda\lib\site-packages\requests\packages\urllib3\packages\six.py", line 203, in load_module mod = mod._resolve() File "C:\Anaconda\lib\site-packages\requests\packages\urllib3\packages\six.py", line 115, in _resolve return _import_module(self.mod) File "C:\Anaconda\lib\site-packages\requests\packages\urllib3\packages\six.py", line 82, in _import_module __import__(name) File "C:\MHPY3-GIT\makehuman\lib\queue.py", line 40, in <module> from PyQt4 import QtCore ModuleNotFoundError: No module named 'PyQt4' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Anaconda\lib\site-packages\conda\exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Anaconda\lib\site-packages\conda\cli\main.py", line 92, in _main p, sub_parsers = generate_parser() File "C:\Anaconda\lib\site-packages\conda\cli\main.py", line 51, in generate_parser from ..cli import conda_argparse File "C:\Anaconda\lib\site-packages\conda\cli\conda_argparse.py", line 15, in <module> from .common import add_parser_help File "C:\Anaconda\lib\site-packages\conda\cli\common.py", line 19, in <module> from ..core.linked_data import linked_data File "C:\Anaconda\lib\site-packages\conda\core\linked_data.py", line 11, in <module> from ..gateways.disk.delete import rm_rf File "C:\Anaconda\lib\site-packages\conda\gateways\disk\delete.py", line 14, in <module> from .read import get_json_content File "C:\Anaconda\lib\site-packages\conda\gateways\disk\read.py", line 20, in <module> from ...models.channel import Channel File "C:\Anaconda\lib\site-packages\conda\models\channel.py", line 6, in <module> from requests.packages.urllib3.util import Url File "C:\Anaconda\lib\site-packages\requests\__init__.py", line 63, in <module> from . import utils File "C:\Anaconda\lib\site-packages\requests\utils.py", line 24, in <module> from ._internal_utils import to_native_string File "C:\Anaconda\lib\site-packages\requests\_internal_utils.py", line 11, in <module> from .compat import is_py2, builtin_str, str File "C:\Anaconda\lib\site-packages\requests\compat.py", line 11, in <module> from .packages import chardet File "C:\Anaconda\lib\site-packages\requests\packages\__init__.py", line 29, in <module> import urllib3 ModuleNotFoundError: No module named 'urllib3' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Anaconda\lib\site-packages\requests\packages\__init__.py", line 27, in <module> from . import urllib3 File "C:\Anaconda\lib\site-packages\requests\packages\urllib3\__init__.py", line 8, in <module> from .connectionpool import ( File "C:\Anaconda\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 28, in <module> from .packages.six.moves.queue import LifoQueue, Empty, Full File "C:\Anaconda\lib\site-packages\requests\packages\urllib3\packages\six.py", line 203, in load_module mod = mod._resolve() File "C:\Anaconda\lib\site-packages\requests\packages\urllib3\packages\six.py", line 115, in _resolve return _import_module(self.mod) File "C:\Anaconda\lib\site-packages\requests\packages\urllib3\packages\six.py", line 82, in _import_module __import__(name) File "C:\MHPY3-GIT\makehuman\lib\queue.py", line 40, in <module> from PyQt4 import QtCore ModuleNotFoundError: No module named 'PyQt4' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Anaconda\Scripts\conda-script.py", line 5, in <module> sys.exit(conda.cli.main()) File "C:\Anaconda\lib\site-packages\conda\cli\main.py", line 167, in main return conda_exception_handler(_main, *args) File "C:\Anaconda\lib\site-packages\conda\exceptions.py", line 633, in conda_exception_handler print_unexpected_error_message(e) File "C:\Anaconda\lib\site-packages\conda\exceptions.py", line 560, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "C:\Anaconda\lib\site-packages\conda\exceptions.py", line 519, in get_info from conda.cli import conda_argparse File "C:\Anaconda\lib\site-packages\conda\cli\conda_argparse.py", line 15, in <module> from .common import add_parser_help File "C:\Anaconda\lib\site-packages\conda\cli\common.py", line 19, in <module> from ..core.linked_data import linked_data File "C:\Anaconda\lib\site-packages\conda\core\linked_data.py", line 11, in <module> from ..gateways.disk.delete import rm_rf File "C:\Anaconda\lib\site-packages\conda\gateways\disk\delete.py", line 14, in <module> from .read import get_json_content File "C:\Anaconda\lib\site-packages\conda\gateways\disk\read.py", line 20, in <module> from ...models.channel import Channel File "C:\Anaconda\lib\site-packages\conda\models\channel.py", line 6, in <module> from requests.packages.urllib3.util import Url File "C:\Anaconda\lib\site-packages\requests\__init__.py", line 63, in <module> from . import utils File "C:\Anaconda\lib\site-packages\requests\utils.py", line 24, in <module> from ._internal_utils import to_native_string File "C:\Anaconda\lib\site-packages\requests\_internal_utils.py", line 11, in <module> from .compat import is_py2, builtin_str, str File "C:\Anaconda\lib\site-packages\requests\compat.py", line 11, in <module> from .packages import chardet File "C:\Anaconda\lib\site-packages\requests\packages\__init__.py", line 29, in <module> import urllib3 ModuleNotFoundError: No module named 'urllib3' C:\Users\rbaer> ```
This may or may not help: ``` C:\Users\rbaer>anaconda-navigator Traceback (most recent call last): File "C:\Anaconda\Scripts\anaconda-navigator-script.py", line 5, in <module> sys.exit(anaconda_navigator.app.main.main()) File "C:\Anaconda\lib\site-packages\anaconda_navigator\app\main.py", line 47, in main from anaconda_navigator.utils.logs import clean_logs File "C:\Anaconda\lib\site-packages\anaconda_navigator\utils\logs.py", line 14, in <module> import logging.handlers File "C:\Anaconda\lib\logging\handlers.py", line 28, in <module> import queue File "C:\MHPY3-GIT\makehuman\lib\queue.py", line 40, in <module> from PyQt4 import QtCore ModuleNotFoundError: No module named 'PyQt4' ``` It appears that the requests package somehow got removed from your Anaconda install. Without requests, conda is pretty much crippled. You can try to recover with conda install --no-deps requests --offline but if that fails because not enough information is cached on your system, you'll have to install Miniconda over your current `c:\Anaconda` install to help recover.
2017-02-23T04:20:06
conda/conda
4,729
conda__conda-4729
[ "4247" ]
ddd12b987a7c4745b7eed27c00082021fb0d53a3
diff --git a/conda/exports.py b/conda/exports.py --- a/conda/exports.py +++ b/conda/exports.py @@ -125,3 +125,6 @@ from .gateways.subprocess import ACTIVE_SUBPROCESSES, subprocess_call # NOQA ACTIVE_SUBPROCESSES, subprocess_call = ACTIVE_SUBPROCESSES, subprocess_call + +from .core.repodata import cache_fn_url # NOQA +cache_fn_url = cache_fn_url
cannot import conda.fetch.cache_fn_url I'm using conda 4.3.2, and the function `conda.fetch.cache_fn_url` does not exist anymore. What to do?
`conda.core.index.cache_fn_url` > On Jan 9, 2017, at 6:11 PM, Ilan Schnell <[email protected]> wrote: > > I'm using conda 4.3.2, and the function conda.fetch.cache_fn_url does not exist anymore. What to do? > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub, or mute the thread. > Thanks. Nevertheless, this is yet another example of something I've been relying on for years is suddenly changing underneath me, and which is also I mostly rely on the "never to be changed" `libconda` package :-) None of us is exempt from the admonition against relying on conda's private APIs. That's true @mcg1969. I have actually been the person always saying not to use conda as a library, but I did it myself for convenience because I was very familiar with what I wrote. I'm not complaining, this change is not hard for me to make, but there are other people (in particular the maintainers of `conda-build` and `anaconda-navigator`), which rely intensely on the private API, for historical reasons. The location changed again. In 4.3.13 it is `conda.core.repodata.cache_fn_url()`. Why do these things get moved around?
2017-02-25T02:34:47
conda/conda
4,774
conda__conda-4774
[ "4757" ]
14dd0efb8e2116ed07d6cca01b8f63f3ac04cb66
diff --git a/conda/common/configuration.py b/conda/common/configuration.py --- a/conda/common/configuration.py +++ b/conda/common/configuration.py @@ -17,7 +17,7 @@ from __future__ import absolute_import, division, print_function, unicode_literals from abc import ABCMeta, abstractmethod -from collections import Mapping, defaultdict +from collections import Mapping, Sequence, defaultdict from glob import glob from itertools import chain from logging import getLogger @@ -35,7 +35,7 @@ from .._vendor.auxlib.collection import AttrDict, first, frozendict, last, make_immutable from .._vendor.auxlib.exceptions import ThisShouldNeverHappenError from .._vendor.auxlib.path import expand -from .._vendor.auxlib.type_coercion import TypeCoercionError, typify_data_structure +from .._vendor.auxlib.type_coercion import TypeCoercionError, typify, typify_data_structure try: from cytoolz.dicttoolz import merge @@ -561,7 +561,6 @@ def __init__(self, element_type, default=(), aliases=(), validation=None, def collect_errors(self, instance, value, source="<<merged>>"): errors = super(SequenceParameter, self).collect_errors(instance, value) - element_type = self._element_type for idx, element in enumerate(value): if not isinstance(element, element_type): @@ -616,9 +615,10 @@ def repr_raw(self, raw_parameter): def _get_all_matches(self, instance): # this is necessary to handle argparse `action="append"`, which can't be set to a # default value of NULL - matches, multikey_exceptions = super(SequenceParameter, self)._get_all_matches(instance) + # it also config settings like `channels: ~` + matches, exceptions = super(SequenceParameter, self)._get_all_matches(instance) matches = tuple(m for m in matches if m._raw_value is not None) - return matches, multikey_exceptions + return matches, exceptions class MapParameter(Parameter): @@ -647,6 +647,7 @@ def collect_errors(self, instance, value, source="<<merged>>"): errors.extend(InvalidElementTypeError(self.name, val, source, type(val), element_type, key) for key, val in iteritems(value) if not isinstance(val, element_type)) + return errors def _merge(self, matches): @@ -676,6 +677,12 @@ def repr_raw(self, raw_parameter): self._str_format_flag(valueflag))) return '\n'.join(lines) + def _get_all_matches(self, instance): + # it also config settings like `proxy_servers: ~` + matches, exceptions = super(MapParameter, self)._get_all_matches(instance) + matches = tuple(m for m in matches if m._raw_value is not None) + return matches, exceptions + class ConfigurationType(type): """metaclass for Configuration"""
diff --git a/tests/common/test_configuration.py b/tests/common/test_configuration.py --- a/tests/common/test_configuration.py +++ b/tests/common/test_configuration.py @@ -7,7 +7,8 @@ from conda.common.compat import odict, string_types from conda.common.configuration import (Configuration, MapParameter, ParameterFlag, PrimitiveParameter, SequenceParameter, YamlRawParameter, - load_file_configs, MultiValidationError, InvalidTypeError) + load_file_configs, MultiValidationError, InvalidTypeError, + CustomValidationError) from conda.common.yaml import yaml_load from conda.common.configuration import ValidationError from os import environ, mkdir @@ -125,6 +126,8 @@ an_int: 2 a_float: 1.2 a_complex: 1+2j + proxy_servers: + channels: """), } @@ -389,7 +392,15 @@ def test_validate_all(self): config.validate_configuration() config = SampleConfiguration()._set_raw_data(load_from_string_data('bad_boolean_map')) - raises(ValidationError, config.validate_configuration) + try: + config.validate_configuration() + except ValidationError as e: + # the `proxy_servers: ~` part of 'bad_boolean_map' is a regression test for #4757 + # in the future, the below should probably be a MultiValidationError + # with TypeValidationError for 'proxy_servers' and 'channels' + assert isinstance(e, CustomValidationError) + else: + assert False def test_cross_parameter_validation(self): pass @@ -411,3 +422,9 @@ def test_config_resets(self): with env_var("MYAPP_CHANGEPS1", "false"): config.__init__(app_name=appname) assert config.changeps1 is False + + def test_empty_map_parameter(self): + + config = SampleConfiguration()._set_raw_data(load_from_string_data('bad_boolean_map')) + config.check_source('bad_boolean_map') +
Error when installing r-essential on windows 7 When I try to install the r-essentials, I get the following error: $ C:\ProgramData\Anaconda3\Scripts\conda-script.py install -c r r-essentials=1.5.2 Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 137, in _main exit_code = args.func(args, p) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 80, in execute install(args, parser, 'install') File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\install.py", line 118, in install context.validate_configuration() File "C:\ProgramData\Anaconda3\lib\site-packages\conda\common\configuration.py", line 830, in validate_configuration raise_errors(tuple(chain.from_iterable((errors, post_errors)))) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\common\configuration.py", line 828, in for name in self.parameter_names) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\common\configuration.py", line 821, in _collect_validation_error func(*args, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\common\configuration.py", line 446, in get result = typify_data_structure(self._merge(matches) if matches else self.default, File "C:\ProgramData\Anaconda3\lib\site-packages\conda\common\configuration.py", line 662, in _merge for match in relevant_matches) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\common\configuration.py", line 662, in for match in relevant_matches) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\common\compat.py", line 72, in iteritems return iter(d.items(**kw)) AttributeError: 'NoneType' object has no attribute 'items' Current conda install: platform : win-64 conda version : 4.3.8 conda is private : False conda-env version : 4.3.8 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : C:\ProgramData\Anaconda3 (writable) default environment : C:\ProgramData\Anaconda3 envs directories : C:\ProgramData\Anaconda3\envs package cache : C:\ProgramData\Anaconda3\pkgs channel URLs : https://conda.anaconda.org/r/win-64 https://conda.anaconda.org/r/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 file : C:\Users\xxx.condarc offline mode : False user-agent : conda/4.3.8 requests/2.12.4 CPython/3.6.0 Windows/7 Windows/6.1.7601 If somebody could help me with this, that would be great. Thanks
Latest conda version is 4.3.13. `conda update conda` Thanks. I had an error in the .condarc file. It seems, that the above error occurs when another error message is going to be created. Oh yeah. Syntax errors in yaml configuration files don't go through conda's normal error handler because it hasn't been initialized yet. Can you give me what you actually had as contents for the bad condarc file? I'll write a regression test for it...
2017-03-01T15:28:01
conda/conda
4,776
conda__conda-4776
[ "4745" ]
efdd81ae9146cbb36c4db6fc18e3db55e6837b95
diff --git a/conda/core/package_cache.py b/conda/core/package_cache.py --- a/conda/core/package_cache.py +++ b/conda/core/package_cache.py @@ -92,7 +92,8 @@ def is_fetched(self): @property def is_extracted(self): - return isdir(self.extracted_package_dir) + epd = self.extracted_package_dir + return isdir(epd) and isfile(join(epd, 'info', 'index.json')) @property def tarball_basename(self):
Conda error while creating anaconda with python2.7 I've Anaconda 3 already installed, now I'm trying to create anaconda with python 2.7 version. But I'm getting below error. Windows 8 `$ C:\Users\Karthick\Anaconda3\Scripts\conda-script.py create -n py27 python=2.7 anaconda` Traceback (most recent call last): File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\exceptions.py", line 591, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\cli\main.py", li ne 134, in _main exit_code = args.func(args, p) File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\cli\main_create. py", line 68, in execute install(args, parser, 'create') File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\cli\install.py", line 359, in install execute_actions(actions, index, verbose=not context.quiet) File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\plan.py", line 8 23, in execute_actions execute_instructions(plan, index, verbose) File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\instructions.py" , line 247, in execute_instructions cmd(state, arg) File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\instructions.py" , line 107, in UNLINKLINKTRANSACTION_CMD txn = UnlinkLinkTransaction.create_from_dists(index, prefix, unlink_dist s, link_dists) File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\core\link.py", l ine 123, in create_from_dists for dist, pkg_dir in zip(link_dists, pkg_dirs_to_link)) File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\core\link.py", l ine 123, in <genexpr> for dist, pkg_dir in zip(link_dists, pkg_dirs_to_link)) File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\gateways\disk\re ad.py", line 86, in read_package_info index_json_record = read_index_json(extracted_package_directory) File "C:\Users\Karthick\Anaconda3\lib\site-packages\conda\gateways\disk\re ad.py", line 105, in read_index_json with open(join(extracted_package_directory, 'info', 'index.json')) as fi : FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Karthick \\Anaconda3\\pkgs\\babel-2.3.4-py27_0\\info\\index.json'
`conda clean --packages` should fix your issue. I'm working on a PR to prevent this from happening in general.
2017-03-01T16:45:39
conda/conda
4,789
conda__conda-4789
[ "4788" ]
1ba6d4544529b28f80677b870539d522c095e269
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -811,6 +811,7 @@ def execute(self): target_package_cache[package_cache_entry.dist] = package_cache_entry def reverse(self): + rm_rf(self.target_full_path) if lexists(self.hold_path): log.trace("moving %s => %s", self.hold_path, self.target_full_path) rm_rf(self.target_full_path)
CondaError resulting from incorrect path I ran `conda update --all` and got: ``` jessime@jessime-Q502LA:~$ conda update --all Fetching package metadata ......... Solving package specifications: . Package plan for installation in environment /home/jessime/anaconda2: The following NEW packages will be INSTALLED: bleach: 1.5.0-py27_0 html5lib: 0.999-py27_0 olefile: 0.44-py27_0 pandocfilters: 1.4.1-py27_0 testpath: 0.3-py27_0 The following packages will be UPDATED: alabaster: 0.7.9-py27_0 --> 0.7.10-py27_0 anaconda-client: 1.6.1-py27_0 --> 1.6.2-py27_0 astropy: 1.3-np111py27_0 --> 1.3-np112py27_0 biopython: 1.68-np111py27_0 --> 1.68-np112py27_0 bottleneck: 1.2.0-np111py27_0 --> 1.2.0-np112py27_0 conda-build: 2.1.3-py27_0 --> 2.1.5-py27_0 dask: 0.13.0-py27_0 --> 0.14.0-py27_0 entrypoints: 0.2.2-py27_0 --> 0.2.2-py27_1 fontconfig: 2.12.1-2 --> 2.12.1-3 greenlet: 0.4.11-py27_0 --> 0.4.12-py27_0 h5py: 2.6.0-np111py27_2 --> 2.6.0-np112py27_2 ipython: 5.1.0-py27_0 --> 5.3.0-py27_0 jinja2: 2.9.4-py27_0 --> 2.9.5-py27_0 jupyter_client: 4.4.0-py27_0 --> 5.0.0-py27_0 jupyter_console: 5.0.0-py27_0 --> 5.1.0-py27_0 jupyter_core: 4.2.1-py27_0 --> 4.3.0-py27_0 llvmlite: 0.15.0-py27_0 --> 0.16.0-py27_0 lxml: 3.7.2-py27_0 --> 3.7.3-py27_0 matplotlib: 2.0.0-np111py27_0 --> 2.0.0-np112py27_0 nbconvert: 4.2.0-py27_0 --> 5.1.1-py27_0 nbformat: 4.2.0-py27_0 --> 4.3.0-py27_0 numba: 0.30.1-np111py27_0 --> 0.31.0-np112py27_0 numexpr: 2.6.1-np111py27_2 --> 2.6.2-np112py27_0 numpy: 1.11.3-py27_0 --> 1.12.0-py27_0 openssl: 1.0.2k-0 --> 1.0.2k-1 pandas: 0.19.2-np111py27_1 --> 0.19.2-np112py27_1 path.py: 10.0-py27_0 --> 10.1-py27_0 pillow: 4.0.0-py27_0 --> 4.0.0-py27_1 psutil: 5.1.2-py27_0 --> 5.1.3-py27_0 pygments: 2.1.3-py27_0 --> 2.2.0-py27_0 pytables: 3.3.0-np111py27_0 --> 3.3.0-np112py27_0 qtawesome: 0.4.3-py27_0 --> 0.4.4-py27_0 requests: 2.12.4-py27_0 --> 2.13.0-py27_0 scandir: 1.4-py27_0 --> 1.5-py27_0 scikit-image: 0.12.3-np111py27_1 --> 0.12.3-np112py27_1 scikit-learn: 0.18.1-np111py27_1 --> 0.18.1-np112py27_1 scipy: 0.18.1-np111py27_1 --> 0.18.1-np112py27_1 spyder: 3.1.2-py27_0 --> 3.1.3-py27_0 sqlalchemy: 1.1.5-py27_0 --> 1.1.6-py27_0 statsmodels: 0.6.1-np111py27_1 --> 0.8.0-np112py27_0 tqdm: 4.8.4-py27_0 conda-forge --> 4.11.2-py27_0 traitlets: 4.3.1-py27_0 --> 4.3.2-py27_0 Proceed ([y]/n)? y openssl-1.0.2k 100% |#####################################################| Time: 0:00:00 5.70 MB/s alabaster-0.7. 100% |#####################################################| Time: 0:00:00 24.07 MB/s greenlet-0.4.1 100% |#####################################################| Time: 0:00:00 15.63 MB/s olefile-0.44-p 100% |#####################################################| Time: 0:00:00 14.73 MB/s pandocfilters- 100% |#####################################################| Time: 0:00:00 15.13 MB/s path.py-10.1-p 100% |#####################################################| Time: 0:00:00 16.08 MB/s psutil-5.1.3-p 100% |#####################################################| Time: 0:00:00 12.26 MB/s pygments-2.2.0 100% |#####################################################| Time: 0:00:00 5.22 MB/s requests-2.13. 100% |#####################################################| Time: 0:00:00 4.69 MB/s scandir-1.5-py 100% |#####################################################| Time: 0:00:00 8.98 MB/s sqlalchemy-1.1 100% |#####################################################| Time: 0:00:00 4.51 MB/s tqdm-4.11.2-py 100% |#####################################################| Time: 0:00:00 2.76 MB/s astropy-1.3-np 100% |#####################################################| Time: 0:00:02 4.37 MB/s biopython-1.68 100% |#####################################################| Time: 0:00:00 3.22 MB/s bottleneck-1.2 100% |#####################################################| Time: 0:00:00 3.85 MB/s fontconfig-2.1 100% |#####################################################| Time: 0:00:00 4.01 MB/s h5py-2.6.0-np1 100% |#####################################################| Time: 0:00:00 3.81 MB/s html5lib-0.999 100% |#####################################################| Time: 0:00:00 4.58 MB/s llvmlite-0.16. 100% |#####################################################| Time: 0:00:01 4.47 MB/s lxml-3.7.3-py2 100% |#####################################################| Time: 0:00:00 5.22 MB/s numexpr-2.6.2- 100% |#####################################################| Time: 0:00:00 6.08 MB/s pillow-4.0.0-p 100% |#####################################################| Time: 0:00:00 5.65 MB/s qtawesome-0.4. 100% |#####################################################| Time: 0:00:00 6.72 MB/s scipy-0.18.1-n 100% |#####################################################| Time: 0:00:04 6.62 MB/s traitlets-4.3. 100% |#####################################################| Time: 0:00:00 10.95 MB/s anaconda-clien 100% |#####################################################| Time: 0:00:00 10.60 MB/s bleach-1.5.0-p 100% |#####################################################| Time: 0:00:00 27.33 MB/s entrypoints-0. 100% |#####################################################| Time: 0:00:00 15.58 MB/s jupyter_core-4 100% |#####################################################| Time: 0:00:00 10.89 MB/s numba-0.31.0-n 100% |#####################################################| Time: 0:00:00 8.07 MB/s pytables-3.3.0 100% |#####################################################| Time: 0:00:00 7.82 MB/s scikit-learn-0 100% |#####################################################| Time: 0:00:01 8.76 MB/s testpath-0.3-p 100% |#####################################################| Time: 0:00:00 15.62 MB/s ipython-5.3.0- 100% |#####################################################| Time: 0:00:00 10.36 MB/s jupyter_client 100% |#####################################################| Time: 0:00:00 18.74 MB/s nbformat-4.3.0 100% |#####################################################| Time: 0:00:00 11.99 MB/s statsmodels-0. 100% |#####################################################| Time: 0:00:00 10.61 MB/s dask-0.14.0-py 100% |#####################################################| Time: 0:00:00 12.87 MB/s nbconvert-5.1. 100% |#####################################################| Time: 0:00:00 14.44 MB/s conda-build-2. 100% |#####################################################| Time: 0:00:00 14.75 MB/s jupyter_consol 100% |#####################################################| Time: 0:00:00 22.82 MB/s matplotlib-2.0 100% |#####################################################| Time: 0:00:00 11.65 MB/s scikit-image-0 100% |#####################################################| Time: 0:00:02 10.01 MB/s spyder-3.1.3-p 100% |#####################################################| Time: 0:00:00 12.48 MB/s cp: cannot stat '/home/jessime/anaconda2:/lib/libcrypto.so.1.0.0': No such file or directory mv: cannot stat '/home/jessime/anaconda2/lib/libcrypto.so.1.0.0-tmp': No such file or directory ERROR conda.core.link:_execute_actions(318): An error occurred while installing package 'defaults::pandas-0.19.2-np112py27_1'. CondaError: Cannot link a source that does not exist. /home/jessime/anaconda2/pkgs/pandas-0.19.2-np112py27_1/lib/python2.7/site-packages/pandas/_version.py Attempting to roll back. CondaError: Cannot link a source that does not exist. /home/jessime/anaconda2/pkgs/pandas-0.19.2-np112py27_1/lib/python2.7/site-packages/pandas/_version.py ``` It looks like all of the downstream issues come from the line: ``` cp: cannot stat '/home/jessime/anaconda2:/lib/libcrypto.so.1.0.0': No such file or directory ``` Notice the ":" following "anaconda2". I can manually follow the correct path to `libcrypto.so.1.0.0` and verify that it exists. So basically, something is causing a colon to be inserted into the path name. I run `conda update --all` about once a month, including a month ago, and this is the first time this issue has come up.
Try `conda clean --packages`, and then try again. Or just rm -rf /home/jessime/anaconda2/pkgs/pandas-0.19.2-np112py27_1 We've got some UI issues where conda looks to stall and users hit ctrl-c to break out, but conda is really just in the middle of doing real work. Several fixes for this coming... > We've got some UI issues where conda looks to stall and users hit ctrl-c to break out Unless I was just totally not paying attention and hit the keys by accident, I'm fairly confident that I didn't `ctrl+c`. But `conda clean --packages` worked perfectly! Everything is updated and ready to go. Thanks for the quick response. There could have been another failure too. You might not have hit ctrl-c. `conda clean --packages` is a easy fix, but it's definitely on our list to prevent this from happening in the first place.
2017-03-03T15:35:02
conda/conda
4,843
conda__conda-4843
[ "4840", "4840" ]
f54e37f97d37cebdbf64304b78bc85356f2fcbe7
diff --git a/conda/core/package_cache.py b/conda/core/package_cache.py --- a/conda/core/package_cache.py +++ b/conda/core/package_cache.py @@ -272,6 +272,9 @@ def _add_entry(__packages_map, pkgs_dir, package_filename): def dedupe_pkgs_dir_contents(pkgs_dir_contents): # if both 'six-1.10.0-py35_0/' and 'six-1.10.0-py35_0.tar.bz2' are in pkgs_dir, # only 'six-1.10.0-py35_0.tar.bz2' will be in the return contents + if not pkgs_dir_contents: + return [] + contents = [] def _process(x, y):
Conda 4.3.14 crashes on update or install Any attempt to install or update a package, or create an environment causes crash after updating conda to 4.3.14. I used an attempt to downgrade conda to the pervious version that worked to illustrate the crash: ``` $ conda install conda=4.3.13 Fetching package metadata ......... Solving package specifications: . Package plan for installation in environment /localdisk/work/tmtomash/miniconda3: The following packages will be DOWNGRADED due to dependency conflicts: conda: 4.3.14-py35_0 --> 4.3.13-py35_0 Proceed ([y]/n)? y 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.14 conda is private : False conda-env version : 4.3.14 conda-build version : 2.1.5 python version : 3.5.2.final.0 requests version : 2.12.4 root environment : /localdisk/work/tmtomash/miniconda3 (writable) default environment : /localdisk/work/tmtomash/miniconda3 envs directories : /localdisk/work/tmtomash/miniconda3/envs /nfs/site/home/tmtomash/.conda/envs package cache : /localdisk/work/tmtomash/miniconda3/pkgs /nfs/site/home/tmtomash/.conda/pkgs channel URLs : 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 : /nfs/site/home/tmtomash/.condarc offline mode : False user-agent : conda/4.3.14 requests/2.12.4 CPython/3.5.2 Linux/4.4.0-59-generic debian/stretch/sid glibc/2.23 UID:GID : 11573498:22002 `$ /localdisk/work/tmtomash/miniconda3/bin/conda install conda=4.3.13` Traceback (most recent call last): File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/exceptions.py", line 573, in conda_exception_handler return_value = func(*args, **kwargs) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/cli/main.py", line 134, in _main exit_code = args.func(args, p) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/cli/install.py", line 359, in install execute_actions(actions, index, verbose=not context.quiet) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/plan.py", line 798, in execute_actions plan = plan_from_actions(actions, index) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/plan.py", line 338, in plan_from_actions plan = inject_UNLINKLINKTRANSACTION(plan, index, prefix) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/plan.py", line 302, in inject_UNLINKLINKTRANSACTION pfe.prepare() File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 465, in prepare for dist in self.link_dists) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 465, in <genexpr> for dist in self.link_dists) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 388, in make_actions_for_dist key=lambda pce: pce and pce.is_extracted and pce.tarball_matches_md5_if(md5) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/_vendor/auxlib/collection.py", line 88, in first return next((apply(x) for x in seq if key(x)), default() if callable(default) else default) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/_vendor/auxlib/collection.py", line 88, in <genexpr> return next((apply(x) for x in seq if key(x)), default() if callable(default) else default) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 387, in <genexpr> (PackageCache(pkgs_dir).get(dist) for pkgs_dir in context.pkgs_dirs), File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 347, in get return self._packages_map.get(dist, default) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 251, in _packages_map return self.__packages_map or self._init_packages_map() File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 287, in _init_packages_map pkgs_dir_contents = dedupe_pkgs_dir_contents(listdir(pkgs_dir)) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 283, in dedupe_pkgs_dir_contents last = reduce(_process, sorted(pkgs_dir_contents)) TypeError: reduce() of empty sequence with no initial value ``` ------------------ The following patch fixes the crash, but the problem may be with the empty list, not when trying to use it: ``` --- package_cache_orig.py 2017-03-09 12:00:58.803996459 -0600 +++ package_cache.py 2017-03-09 12:01:29.467509263 -0600 @@ -279,8 +279,9 @@ contents.append(x) return y - last = reduce(_process, sorted(pkgs_dir_contents)) - _process(last, contents and contents[-1] or '') + if len(pkgs_dir_contents) > 0: + last = reduce(_process, sorted(pkgs_dir_contents)) + _process(last, contents and contents[-1] or '') return contents pkgs_dir_contents = dedupe_pkgs_dir_contents(listdir(pkgs_dir)) ``` Conda 4.3.14 crashes on update or install Any attempt to install or update a package, or create an environment causes crash after updating conda to 4.3.14. I used an attempt to downgrade conda to the pervious version that worked to illustrate the crash: ``` $ conda install conda=4.3.13 Fetching package metadata ......... Solving package specifications: . Package plan for installation in environment /localdisk/work/tmtomash/miniconda3: The following packages will be DOWNGRADED due to dependency conflicts: conda: 4.3.14-py35_0 --> 4.3.13-py35_0 Proceed ([y]/n)? y 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.14 conda is private : False conda-env version : 4.3.14 conda-build version : 2.1.5 python version : 3.5.2.final.0 requests version : 2.12.4 root environment : /localdisk/work/tmtomash/miniconda3 (writable) default environment : /localdisk/work/tmtomash/miniconda3 envs directories : /localdisk/work/tmtomash/miniconda3/envs /nfs/site/home/tmtomash/.conda/envs package cache : /localdisk/work/tmtomash/miniconda3/pkgs /nfs/site/home/tmtomash/.conda/pkgs channel URLs : 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 : /nfs/site/home/tmtomash/.condarc offline mode : False user-agent : conda/4.3.14 requests/2.12.4 CPython/3.5.2 Linux/4.4.0-59-generic debian/stretch/sid glibc/2.23 UID:GID : 11573498:22002 `$ /localdisk/work/tmtomash/miniconda3/bin/conda install conda=4.3.13` Traceback (most recent call last): File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/exceptions.py", line 573, in conda_exception_handler return_value = func(*args, **kwargs) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/cli/main.py", line 134, in _main exit_code = args.func(args, p) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/cli/install.py", line 359, in install execute_actions(actions, index, verbose=not context.quiet) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/plan.py", line 798, in execute_actions plan = plan_from_actions(actions, index) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/plan.py", line 338, in plan_from_actions plan = inject_UNLINKLINKTRANSACTION(plan, index, prefix) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/plan.py", line 302, in inject_UNLINKLINKTRANSACTION pfe.prepare() File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 465, in prepare for dist in self.link_dists) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 465, in <genexpr> for dist in self.link_dists) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 388, in make_actions_for_dist key=lambda pce: pce and pce.is_extracted and pce.tarball_matches_md5_if(md5) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/_vendor/auxlib/collection.py", line 88, in first return next((apply(x) for x in seq if key(x)), default() if callable(default) else default) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/_vendor/auxlib/collection.py", line 88, in <genexpr> return next((apply(x) for x in seq if key(x)), default() if callable(default) else default) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 387, in <genexpr> (PackageCache(pkgs_dir).get(dist) for pkgs_dir in context.pkgs_dirs), File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 347, in get return self._packages_map.get(dist, default) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 251, in _packages_map return self.__packages_map or self._init_packages_map() File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 287, in _init_packages_map pkgs_dir_contents = dedupe_pkgs_dir_contents(listdir(pkgs_dir)) File "/localdisk/work/tmtomash/miniconda3/lib/python3.5/site-packages/conda/core/package_cache.py", line 283, in dedupe_pkgs_dir_contents last = reduce(_process, sorted(pkgs_dir_contents)) TypeError: reduce() of empty sequence with no initial value ``` ------------------ The following patch fixes the crash, but the problem may be with the empty list, not when trying to use it: ``` --- package_cache_orig.py 2017-03-09 12:00:58.803996459 -0600 +++ package_cache.py 2017-03-09 12:01:29.467509263 -0600 @@ -279,8 +279,9 @@ contents.append(x) return y - last = reduce(_process, sorted(pkgs_dir_contents)) - _process(last, contents and contents[-1] or '') + if len(pkgs_dir_contents) > 0: + last = reduce(_process, sorted(pkgs_dir_contents)) + _process(last, contents and contents[-1] or '') return contents pkgs_dir_contents = dedupe_pkgs_dir_contents(listdir(pkgs_dir)) ```
F&(% F&(%
2017-03-09T19:15:01
conda/conda
4,922
conda__conda-4922
[ "4914" ]
57dd56712c0c21f3958951be5e9e5dd1d96e03d0
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -96,7 +96,10 @@ def __init__(self, transaction_context, target_prefix, target_short_path): @property def target_full_path(self): trgt, shrt_pth = self.target_prefix, self.target_short_path - return join(trgt, win_path_ok(shrt_pth)) if trgt and shrt_pth else None + if trgt is not None and shrt_pth is not None: + return join(trgt, win_path_ok(shrt_pth)) + else: + return None # ###################################################### diff --git a/conda/gateways/disk/create.py b/conda/gateways/disk/create.py --- a/conda/gateways/disk/create.py +++ b/conda/gateways/disk/create.py @@ -218,6 +218,11 @@ def create_link(src, dst, link_type=LinkType.hardlink, force=False): if link_type == LinkType.directory: # A directory is technically not a link. So link_type is a misnomer. # Naming is hard. + if lexists(dst) and not isdir(dst): + if not force: + maybe_raise(BasicClobberError(src, dst, context), context) + log.info("file exists, but clobbering for directory: %r" % dst) + rm_rf(dst) mkdir_p(dst) return
Installing rstudio 1.0.44 on root, errors ``` $ conda install rstudio=1.0.44 --json ERROR conda.core.link:_execute_actions(335): An error occurred while installing package 'defaults::rstudio-1.0.44-0'. FileExistsError(17, 'File exists') Attempting to roll back. Traceback (most recent call last): File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 324, in _execute_actions action.execute() File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/core/path_actions.py", line 225, in execute force=context.force) File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/gateways/disk/create.py", line 214, in create_link mkdir_p(dst) File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/gateways/disk/create.py", line 153, in mkdir_p makedirs(path) File "/Users/gpena-castellanos/anaconda/lib/python3.6/os.py", line 220, in makedirs mkdir(name, mode) FileExistsError: [Errno 17] File exists: '/Users/gpena-castellanos/anaconda/bin/pandoc' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 279, in execute pkg_data, actions) File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 342, in _execute_actions reverse_excs, conda.CondaMultiError: [Errno 17] File exists: '/Users/gpena-castellanos/anaconda/bin/pandoc' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/exceptions.py", line 573, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/cli/main.py", line 134, in _main exit_code = args.func(args, p) File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/cli/install.py", line 359, in install execute_actions(actions, index, verbose=not context.quiet) File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/plan.py", line 800, in execute_actions execute_instructions(plan, index, verbose) File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/instructions.py", line 247, in execute_instructions cmd(state, arg) File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/instructions.py", line 108, in UNLINKLINKTRANSACTION_CMD txn.execute() File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 295, in execute rollback_excs, conda.CondaMultiError: [Errno 17] File exists: '/Users/gpena-castellanos/anaconda/bin/pandoc' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/gpena-castellanos/anaconda/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/exceptions.py", line 586, in conda_exception_handler print_conda_exception(e) File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/exceptions.py", line 496, in print_conda_exception stdoutlogger.info(json.dumps(exception.dump_map(), indent=2, sort_keys=True, File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/__init__.py", line 74, in dump_map errors=tuple(error.dump_map() for error in self.errors), File "/Users/gpena-castellanos/anaconda/lib/python3.6/site-packages/conda/__init__.py", line 74, in <genexpr> errors=tuple(error.dump_map() for error in self.errors), AttributeError: 'FileExistsError' object has no attribute 'dump_map' 0316-gpena-castellanos:~ gpena-castellanos$
@kalefranz any ideas about this? The new rstudio splits pandoc into a separate package while the old one had it bundled. I thought the clobber stuff was turned off now? It is. This is different than clobber. What appears to be happening is that conda for some reason thinks it needs to create a 'bin/pandoc' *directory* after something in the transaction has already created a 'bin/pandoc' file. This is definitely odd. > On Mar 22, 2017, at 2:12 PM, Ray Donnelly <[email protected]> wrote: > > Assigned #4914 to @kalefranz. > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub, or mute the thread. > That actually makes sense. The old rstudio had bin/pandoc/pandoc executable but the new pandoc package has a bin/pandoc executable instead. This should be allowed to happen though when clobbering is allowed. Yeah I think we can do that. > On Mar 22, 2017, at 7:11 PM, Ray Donnelly <[email protected]> wrote: > > That actually makes sense. The old rstudio had bin/pandoc/pandoc.exe, but the new pandoc package has bin/pandoc. > > This should be allowed to happen though when clobbering is allowed. > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub, or mute the thread. >
2017-03-23T00:22:31
conda/conda
4,963
conda__conda-4963
[ "4944", "4944" ]
eb2687e7164437421058d592705f37d40bc86b45
diff --git a/conda/cli/conda_argparse.py b/conda/cli/conda_argparse.py --- a/conda/cli/conda_argparse.py +++ b/conda/cli/conda_argparse.py @@ -10,14 +10,11 @@ import os import subprocess import sys -from difflib import get_close_matches from .common import add_parser_help from .find_commands import find_commands, find_executable from ..exceptions import CommandNotFoundError -build_commands = {'build', 'index', 'skeleton', 'package', 'metapackage', - 'pipbuild', 'develop', 'convert'} _ARGCOMPLETE_DEBUG = False def debug_argcomplete(msg): @@ -129,21 +126,7 @@ def error(self, message): cmd = m.group(1) executable = find_executable('conda-' + cmd) if not executable: - if cmd in build_commands: - raise CommandNotFoundError(cmd, ''' -Error: You need to install conda-build in order to -use the "conda %s" command.''' % cmd) - else: - message = "Error: Could not locate 'conda-%s'" % cmd - possibilities = (set(argument.choices.keys()) | - build_commands | - set(find_commands())) - close = get_close_matches(cmd, possibilities) - if close: - message += '\n\nDid you mean one of these?\n' - for s in close: - message += ' %s' % s - raise CommandNotFoundError(cmd, message) + raise CommandNotFoundError(cmd) args = [find_executable('conda-' + cmd)] args.extend(sys.argv[2:]) diff --git a/conda/cli/main.py b/conda/cli/main.py --- a/conda/cli/main.py +++ b/conda/cli/main.py @@ -152,14 +152,8 @@ def main(*args): activate.main() return if argv1 in ('activate', 'deactivate'): - - message = "'%s' is not a conda command.\n" % argv1 - from ..common.compat import on_win - if not on_win: - message += ' Did you mean "source %s" ?\n' % ' '.join(args[1:]) - from ..exceptions import CommandNotFoundError - raise CommandNotFoundError(argv1, message) + raise CommandNotFoundError(argv1) except Exception as e: from ..exceptions import handle_exception return handle_exception(e) diff --git a/conda/exceptions.py b/conda/exceptions.py --- a/conda/exceptions.py +++ b/conda/exceptions.py @@ -11,7 +11,7 @@ from ._vendor.auxlib.entity import EntityEncoder from ._vendor.auxlib.ish import dals from .base.constants import PathConflict -from .common.compat import iteritems, iterkeys, string_types +from .common.compat import iteritems, iterkeys, on_win, string_types from .common.signals import get_signal_name from .common.url import maybe_unquote @@ -159,7 +159,32 @@ def __init__(self, target_path, incompatible_package_dists, context): class CommandNotFoundError(CondaError): def __init__(self, command): - message = "Conda could not find the command: '%(command)s'" + build_commands = { + 'build', + 'convert', + 'develop', + 'index', + 'inspect', + 'metapackage', + 'render', + 'skeleton', + } + needs_source = { + 'activate', + 'deactivate' + } + if command in build_commands: + message = dals(""" + You need to install conda-build in order to + use the 'conda %(command)s' command. + """) + elif command in needs_source and not on_win: + message = dals(""" + '%(command)s is not a conda command. + Did you mean 'source %(command)s'? + """) + else: + message = "Conda could not find the command: '%(command)s'" super(CommandNotFoundError, self).__init__(message, command=command)
diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -1,6 +1,8 @@ import json from unittest import TestCase +from conda.common.compat import on_win + from conda import text_type from conda._vendor.auxlib.ish import dals from conda.base.context import reset_context, context @@ -310,7 +312,7 @@ def test_CondaHTTPError(self): Groot """).strip() - def test_CommandNotFoundError(self): + def test_CommandNotFoundError_simple(self): cmd = "instate" exc = CommandNotFoundError(cmd) @@ -330,3 +332,52 @@ def test_CommandNotFoundError(self): assert not c.stdout assert c.stderr.strip() == "CommandNotFoundError: Conda could not find the command: 'instate'" + + def test_CommandNotFoundError_conda_build(self): + cmd = "build" + exc = CommandNotFoundError(cmd) + + with env_var("CONDA_JSON", "yes", reset_context): + with captured() as c, replace_log_streams(): + conda_exception_handler(_raise_helper, exc) + + json_obj = json.loads(c.stdout) + assert not c.stderr + assert json_obj['exception_type'] == "<class 'conda.exceptions.CommandNotFoundError'>" + assert json_obj['message'] == text_type(exc) + assert json_obj['error'] == repr(exc) + + with env_var("CONDA_JSON", "no", reset_context): + with captured() as c, replace_log_streams(): + conda_exception_handler(_raise_helper, exc) + + assert not c.stdout + assert c.stderr.strip() == ("CommandNotFoundError: You need to install conda-build in order to\n" \ + "use the 'conda build' command.") + + def test_CommandNotFoundError_activate(self): + cmd = "activate" + exc = CommandNotFoundError(cmd) + + with env_var("CONDA_JSON", "yes", reset_context): + with captured() as c, replace_log_streams(): + conda_exception_handler(_raise_helper, exc) + + json_obj = json.loads(c.stdout) + assert not c.stderr + assert json_obj['exception_type'] == "<class 'conda.exceptions.CommandNotFoundError'>" + assert json_obj['message'] == text_type(exc) + assert json_obj['error'] == repr(exc) + + with env_var("CONDA_JSON", "no", reset_context): + with captured() as c, replace_log_streams(): + conda_exception_handler(_raise_helper, exc) + + assert not c.stdout + + if on_win: + message = "CommandNotFoundError: Conda could not find the command: 'activate'" + else: + message = ("CommandNotFoundError: 'activate is not a conda command.\n" + "Did you mean 'source activate'?") + assert c.stderr.strip() == message
Error in CommandNotFoundError Commit 809532b7cc5ec1ea18f1aa565025d7c5599185b3 has broken the class CommandNotFoundError. Examples to trigger both code paths calling CommandNotFoundError(): ``` (root) [root@d4cb01a1b5b6 ~]# conda activate Traceback (most recent call last): File "/conda/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/conda/lib/python2.7/site-packages/conda/cli/main.py", line 161, in main raise CommandNotFoundError(argv1, message) TypeError: __init__() takes exactly 2 arguments (3 given) ``` ``` (root) [root@d4cb01a1b5b6 ~]# conda -unknown unknown 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.14 conda is private : False conda-env version : 4.3.14 conda-build version : not installed python version : 2.7.13.final.0 requests version : 2.12.4 root environment : /conda (writable) default environment : /conda envs directories : /conda/envs /root/.conda/envs package cache : /conda/pkgs /root/.conda/pkgs channel URLs : 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 : /root/.condarc offline mode : False user-agent : conda/4.3.14 requests/2.12.4 CPython/2.7.13 Linux/4.8.6-300.fc25.x86_64 CentOS/6.8 glibc/2.12 UID:GID : 0:0 `$ /conda/bin/conda -unknown unknown` Traceback (most recent call last): File "/conda/lib/python2.7/site-packages/conda/exceptions.py", line 573, in conda_exception_handler return_value = func(*args, **kwargs) File "/conda/lib/python2.7/site-packages/conda/cli/main.py", line 119, in _main args = p.parse_args(args) File "/conda/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 173, in parse_args return super(ArgumentParser, self).parse_args(*args, **kwargs) File "/conda/lib/python2.7/argparse.py", line 1701, in parse_args args, argv = self.parse_known_args(args, namespace) File "/conda/lib/python2.7/argparse.py", line 1740, in parse_known_args self.error(str(err)) File "/conda/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 146, in error raise CommandNotFoundError(cmd, message) TypeError: __init__() takes exactly 2 arguments (3 given) ``` Error in CommandNotFoundError Commit 809532b7cc5ec1ea18f1aa565025d7c5599185b3 has broken the class CommandNotFoundError. Examples to trigger both code paths calling CommandNotFoundError(): ``` (root) [root@d4cb01a1b5b6 ~]# conda activate Traceback (most recent call last): File "/conda/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/conda/lib/python2.7/site-packages/conda/cli/main.py", line 161, in main raise CommandNotFoundError(argv1, message) TypeError: __init__() takes exactly 2 arguments (3 given) ``` ``` (root) [root@d4cb01a1b5b6 ~]# conda -unknown unknown 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.14 conda is private : False conda-env version : 4.3.14 conda-build version : not installed python version : 2.7.13.final.0 requests version : 2.12.4 root environment : /conda (writable) default environment : /conda envs directories : /conda/envs /root/.conda/envs package cache : /conda/pkgs /root/.conda/pkgs channel URLs : 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 : /root/.condarc offline mode : False user-agent : conda/4.3.14 requests/2.12.4 CPython/2.7.13 Linux/4.8.6-300.fc25.x86_64 CentOS/6.8 glibc/2.12 UID:GID : 0:0 `$ /conda/bin/conda -unknown unknown` Traceback (most recent call last): File "/conda/lib/python2.7/site-packages/conda/exceptions.py", line 573, in conda_exception_handler return_value = func(*args, **kwargs) File "/conda/lib/python2.7/site-packages/conda/cli/main.py", line 119, in _main args = p.parse_args(args) File "/conda/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 173, in parse_args return super(ArgumentParser, self).parse_args(*args, **kwargs) File "/conda/lib/python2.7/argparse.py", line 1701, in parse_args args, argv = self.parse_known_args(args, namespace) File "/conda/lib/python2.7/argparse.py", line 1740, in parse_known_args self.error(str(err)) File "/conda/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 146, in error raise CommandNotFoundError(cmd, message) TypeError: __init__() takes exactly 2 arguments (3 given) ```
@nehaljwani thanks I will work on this one I have the exact same problem. ---------------------------------------------------------------------------------------------------- In [24]: conda -unknown unknown 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.14 conda is private : False conda-env version : 4.3.14 conda-build version : 2.0.2 python version : 2.7.13.final.0 requests version : 2.12.4 root environment : C:\Program Files\Anaconda2 (writable) default environment : C:\Program Files\Anaconda2 envs directories : C:\Program Files\Anaconda2\envs C:\Users\dparaskevopoulos\AppData\Local\conda\conda\envs C:\Users\dparaskevopoulos\.conda\envs package cache : C:\Program Files\Anaconda2\pkgs C:\Users\dparaskevopoulos\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 : None offline mode : False user-agent : conda/4.3.14 requests/2.12.4 CPython/2.7.13 Windows/7 Windows/6.1.7601 `$ C:\Program Files\Anaconda2\Scripts\conda-script.py -unknown unknown` Traceback (most recent call last): File "C:\Program Files\Anaconda2\lib\site-packages\conda\exceptions.py", line 573, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Program Files\Anaconda2\lib\site-packages\conda\cli\main.py", line 119, in _main args = p.parse_args(args) File "C:\Program Files\Anaconda2\lib\site-packages\conda\cli\conda_argparse.py", line 173, in parse_args return super(ArgumentParser, self).parse_args(*args, **kwargs) File "C:\Program Files\Anaconda2\lib\argparse.py", line 1701, in parse_args args, argv = self.parse_known_args(args, namespace) File "C:\Program Files\Anaconda2\lib\argparse.py", line 1740, in parse_known_args self.error(str(err)) File "C:\Program Files\Anaconda2\lib\site-packages\conda\cli\conda_argparse.py", line 146, in error raise CommandNotFoundError(cmd, message) TypeError: __init__() takes exactly 2 arguments (3 given) @nehaljwani thanks I will work on this one I have the exact same problem. ---------------------------------------------------------------------------------------------------- In [24]: conda -unknown unknown 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.14 conda is private : False conda-env version : 4.3.14 conda-build version : 2.0.2 python version : 2.7.13.final.0 requests version : 2.12.4 root environment : C:\Program Files\Anaconda2 (writable) default environment : C:\Program Files\Anaconda2 envs directories : C:\Program Files\Anaconda2\envs C:\Users\dparaskevopoulos\AppData\Local\conda\conda\envs C:\Users\dparaskevopoulos\.conda\envs package cache : C:\Program Files\Anaconda2\pkgs C:\Users\dparaskevopoulos\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 : None offline mode : False user-agent : conda/4.3.14 requests/2.12.4 CPython/2.7.13 Windows/7 Windows/6.1.7601 `$ C:\Program Files\Anaconda2\Scripts\conda-script.py -unknown unknown` Traceback (most recent call last): File "C:\Program Files\Anaconda2\lib\site-packages\conda\exceptions.py", line 573, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\Program Files\Anaconda2\lib\site-packages\conda\cli\main.py", line 119, in _main args = p.parse_args(args) File "C:\Program Files\Anaconda2\lib\site-packages\conda\cli\conda_argparse.py", line 173, in parse_args return super(ArgumentParser, self).parse_args(*args, **kwargs) File "C:\Program Files\Anaconda2\lib\argparse.py", line 1701, in parse_args args, argv = self.parse_known_args(args, namespace) File "C:\Program Files\Anaconda2\lib\argparse.py", line 1740, in parse_known_args self.error(str(err)) File "C:\Program Files\Anaconda2\lib\site-packages\conda\cli\conda_argparse.py", line 146, in error raise CommandNotFoundError(cmd, message) TypeError: __init__() takes exactly 2 arguments (3 given)
2017-03-29T14:00:49
conda/conda
4,990
conda__conda-4990
[ "4969" ]
19b5182e4bbd587a241e6177470290b4fd804aac
diff --git a/conda/cli/install.py b/conda/cli/install.py --- a/conda/cli/install.py +++ b/conda/cli/install.py @@ -54,7 +54,7 @@ def clone(src_arg, dst_prefix, json=False, quiet=False, index_args=None): if os.sep in src_arg: src_prefix = abspath(src_arg) if not isdir(src_prefix): - raise DirectoryNotFoundError(src_arg, 'no such directory: %s' % src_arg, json) + raise DirectoryNotFoundError(src_arg) else: src_prefix = context.clone_src
Error in DirectoryNotFoundError Commit 1f430607 has broken the class DirectoryNotFoundError. Example to trigger the code path calling DirectoryNotFoundError(): (root) [root@833f44c1b4d6 ~]# conda create -n starlord --clone /path/to/vanishing/point Current conda install: platform : linux-64 conda version : 4.3.15 conda is private : False conda-env version : 4.3.15 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : /conda (writable) default environment : /conda envs directories : /conda/envs /root/.conda/envs package cache : /conda/pkgs /root/.conda/pkgs channel URLs : 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 : /root/.condarc offline mode : False user-agent : conda/4.3.15 requests/2.12.4 CPython/3.6.0 Linux/4.8.6-300.fc25.x86_64 CentOS/6.8 glibc/2.12 UID:GID : 0:0 `$ /conda/bin/conda create -n starlord --clone /path/to/vanishing/point` Traceback (most recent call last): File "/conda/lib/python3.6/site-packages/conda/exceptions.py", line 591, 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_create.py", line 68, in execute install(args, parser, 'create') File "/conda/lib/python3.6/site-packages/conda/cli/install.py", line 212, in install clone(args.clone, prefix, json=context.json, quiet=context.quiet, index_args=index_args) File "/conda/lib/python3.6/site-packages/conda/cli/install.py", line 57, in clone raise DirectoryNotFoundError(src_arg, 'no such directory: %s' % src_arg, json) TypeError: __init__() takes 2 positional arguments but 4 were given
Thanks Nehal. @tyler-thetyrant Can you take this one? @kalefranz Yup. Looking into it.
2017-04-03T20:36:41
conda/conda
5,009
conda__conda-5009
[ "5006" ]
df18f9fa4b95c31435f2751a0a5de365cb20c5d3
diff --git a/conda/cli/help.py b/conda/cli/help.py --- a/conda/cli/help.py +++ b/conda/cli/help.py @@ -35,7 +35,7 @@ def root_read_only(command, prefix, json=False): # then make changes to it. # This may be done using the command: # -# $ conda create -n my_${name} --clone=${prefix} +# $ conda create -n my_${name} --clone="${prefix}" """ msg = msg.replace('${root_dir}', context.root_prefix) msg = msg.replace('${prefix}', prefix)
When lacking permissions to write, clone message should quote prefix. When trying to install a new package into a location that the user lacks write permissions (read-only root), conda helpfully suggests cloning the environment into a new location: ``` CondaIOError: IO error: Missing write permissions in: C:\Program Files\Anaconda # # You don't appear to have the necessary permissions to install packages # into the install area 'C:\Program Files\Anaconda'. # However you can clone this environment into your home directory and # then make changes to it. # This may be done using the command: # # $ conda create -n my_deathstar --clone=C:\Program Files\Anaconda\envs\deathstar ``` As shown in the example above, this clone path may include spaces. This will be particularly common on Windows, where a global install will result in files written to Program Files, which a non-administrator user will not be able to write to, and contains spaces. Because the command presents a prefix, it should be quoted to guard against this case.
2017-04-06T04:48:42
conda/conda
5,010
conda__conda-5010
[ "5001" ]
0d33c605c75d53346055ba40fcda024d3172494e
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -22,8 +22,7 @@ from ..exceptions import CondaUpgradeError, CondaVerificationError, PaddingError from ..gateways.disk.create import (compile_pyc, create_hard_link_or_copy, create_link, create_private_envs_meta, create_private_pkg_entry_point, - create_unix_python_entry_point, - create_windows_python_entry_point, extract_tarball, + create_python_entry_point, extract_tarball, make_menu, write_linked_package_record) from ..gateways.disk.delete import remove_private_envs_meta, rm_rf, try_rmdir_all_empty from ..gateways.disk.read import compute_md5sum, isfile, islink, lexists @@ -418,13 +417,14 @@ def __init__(self, transaction_context, package_info, target_prefix, target_shor def execute(self): log.trace("creating python entry point %s", self.target_full_path) if on_win: - create_windows_python_entry_point(self.target_full_path, self.module, self.func) + python_full_path = None else: target_python_version = self.transaction_context['target_python_version'] python_short_path = get_python_short_path(target_python_version) python_full_path = join(self.target_prefix, win_path_ok(python_short_path)) - create_unix_python_entry_point(self.target_full_path, python_full_path, - self.module, self.func) + + create_python_entry_point(self.target_full_path, python_full_path, + self.module, self.func) self._execute_successful = True def reverse(self): diff --git a/conda/gateways/disk/create.py b/conda/gateways/disk/create.py --- a/conda/gateways/disk/create.py +++ b/conda/gateways/disk/create.py @@ -36,10 +36,14 @@ python_entry_point_template = dals(""" # -*- coding: utf-8 -*- +import re +import sys + +from %(module)s import %(import_name)s + if __name__ == '__main__': - from sys import exit - from %(module)s import %(func)s - exit(%(func)s()) + sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) + sys.exit(%(func)s()) """) application_entry_point_template = dals(""" @@ -59,7 +63,7 @@ def write_as_json_to_file(file_path, obj): fo.write(ensure_binary(json_str)) -def create_unix_python_entry_point(target_full_path, python_full_path, module, func): +def create_python_entry_point(target_full_path, python_full_path, module, func): if lexists(target_full_path): maybe_raise(BasicClobberError( source_path=None, @@ -67,33 +71,31 @@ def create_unix_python_entry_point(target_full_path, python_full_path, module, f context=context, ), context) - pyscript = python_entry_point_template % {'module': module, 'func': func} - with open(target_full_path, str('w')) as fo: + import_name = func.split('.')[0] + pyscript = python_entry_point_template % { + 'module': module, + 'func': func, + 'import_name': import_name, + } + + if python_full_path is not None: shebang = '#!%s\n' % python_full_path if hasattr(shebang, 'encode'): shebang = shebang.encode() shebang = replace_long_shebang(FileMode.text, shebang) if hasattr(shebang, 'decode'): shebang = shebang.decode() - fo.write(shebang) - fo.write(pyscript) - make_executable(target_full_path) - - return target_full_path - - -def create_windows_python_entry_point(target_full_path, module, func): - if lexists(target_full_path): - maybe_raise(BasicClobberError( - source_path=None, - target_path=target_full_path, - context=context, - ), context) + else: + shebang = None - pyscript = python_entry_point_template % {'module': module, 'func': func} with open(target_full_path, str('w')) as fo: + if shebang is not None: + fo.write(shebang) fo.write(pyscript) + if shebang is not None: + make_executable(target_full_path) + return target_full_path
noarch python entry points created by conda differ than those created by conda-build The entry point scripts which are created by conda for `noarch: python` packages differ slightly from those created for standard packages by conda-build. The templates for the scripts are: [conda](https://github.com/conda/conda/blob/master/conda/gateways/disk/create.py#L37-L43): ``` python python_entry_point_template = dals(""" # -*- coding: utf-8 -*- if __name__ == '__main__': from sys import exit from %(module)s import %(func)s exit(%(func)s()) """) ``` [conda-build](https://github.com/conda/conda-build/blob/master/conda_build/utils.py#L61-L67): ``` python PY_TMPL = """\ if __name__ == '__main__': import sys import %(module)s sys.exit(%(module)s.%(func)s()) """ ``` I've found at least one example where the template used by conda produces a script which does not work but when used with the conda-build template the script run fine.
pip seems to use the following [template](https://github.com/pypa/pip/blob/9.0.1/pip/wheel.py#L414-L423) for entry points (at least when installing wheels): ``` python maker.script_template = """# -*- coding: utf-8 -*- import re import sys from %(module)s import %(import_name)s if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(%(func)s()) """ ``` I would suggest that both conda and conda-build use this template as it seems the most general. I will put together PRs implementing this in both projects.
2017-04-06T11:16:36
conda/conda
5,011
conda__conda-5011
[ "4998" ]
fa0393fd6821fb0b2246bb29a82a7333e752c097
diff --git a/conda/cli/install.py b/conda/cli/install.py --- a/conda/cli/install.py +++ b/conda/cli/install.py @@ -300,7 +300,7 @@ def install(args, parser, command='install'): if pinned_specs: path = join(prefix, 'conda-meta', 'pinned') error_message.append("\n\nNote that you have pinned specs in %s:" % path) - error_message.append("\n\n %r" % pinned_specs) + error_message.append("\n\n %r" % (pinned_specs,)) error_message = ''.join(error_message) raise PackageNotFoundError(error_message)
`conda install` on missing packages tracebacks if multiline pinned file exists If you attempt to install a non-existent package into an environment with a pinned file containing more than one entry, conda will traceback. Here's an example `pinned` file: ``` pip ==9.0.1 requests ==2.13.0 ``` Subsequently, `conda install foobar` will produce this traceback: ``` `$ F:\miniconda3_4.3.16_x64\Scripts\conda-script.py install foobar` Traceback (most recent call last): File "F:\miniconda3_4.3.16_x64\lib\site-packages\conda\cli\install.py", line 251, in install channel_priority_map=_channel_priority_map, is_update=isupdate) File "F:\miniconda3_4.3.16_x64\lib\site-packages\conda\plan.py", line 474, in install_actions_ list dists_for_envs = determine_all_envs(r, specs, channel_priority_map=channel_priority_map) File "F:\miniconda3_4.3.16_x64\lib\site-packages\conda\plan.py", line 539, in determine_all_en vs spec_for_envs = tuple(SpecForEnv(env=p.preferred_env, spec=p.name) for p in best_pkgs) File "F:\miniconda3_4.3.16_x64\lib\site-packages\conda\plan.py", line 539, in <genexpr> spec_for_envs = tuple(SpecForEnv(env=p.preferred_env, spec=p.name) for p in best_pkgs) File "F:\miniconda3_4.3.16_x64\lib\site-packages\conda\plan.py", line 538, in <genexpr> best_pkgs = (r.index[r.get_dists_for_spec(s, emptyok=False)[-1]] for s in specs) File "F:\miniconda3_4.3.16_x64\lib\site-packages\conda\resolve.py", line 564, in get_dists_for _spec raise NoPackagesFoundError([(ms,)]) conda.exceptions.NoPackagesFoundError: Package missing in current win-64 channels: - foobar During handling of the above exception, another exception occurred: Traceback (most recent call last): File "F:\miniconda3_4.3.16_x64\lib\site-packages\conda\exceptions.py", line 626, in conda_exce ption_handler return_value = func(*args, **kwargs) File "F:\miniconda3_4.3.16_x64\lib\site-packages\conda\cli\main.py", line 134, in _main exit_code = args.func(args, p) File "F:\miniconda3_4.3.16_x64\lib\site-packages\conda\cli\main_install.py", line 80, in execu te install(args, parser, 'install') File "F:\miniconda3_4.3.16_x64\lib\site-packages\conda\cli\install.py", line 303, in install error_message.append("\n\n %r" % pinned_specs) TypeError: not all arguments converted during string formatting ``` Fix for this issue in #4993.
2017-04-06T11:34:29
conda/conda
5,018
conda__conda-5018
[ "5017" ]
1fb7c3b49b005463f56eaeff8c9970e42fa8d576
diff --git a/conda/models/index_record.py b/conda/models/index_record.py --- a/conda/models/index_record.py +++ b/conda/models/index_record.py @@ -99,6 +99,7 @@ class IndexRecord(DictSafeMixin, Entity): requires = ListField(string_types, required=False) size = IntegerField(required=False) subdir = StringField(required=False) + timestamp = IntegerField(required=False) track_features = StringField(required=False) version = StringField() diff --git a/conda/resolve.py b/conda/resolve.py --- a/conda/resolve.py +++ b/conda/resolve.py @@ -532,8 +532,9 @@ def version_key(self, dist, vtype=None): ver = normalized_version(rec.get('version', '')) bld = rec.get('build_number', 0) bs = rec.get('build_string') - return ((valid, -cpri, ver, bld, bs) if context.channel_priority else - (valid, ver, -cpri, bld, bs)) + ts = rec.get('timestamp', 0) + return ((valid, -cpri, ver, bld, bs, ts) if context.channel_priority else + (valid, ver, -cpri, bld, bs, ts)) def features(self, dist): return set(self.index[dist].get('features', '').split()) @@ -654,16 +655,24 @@ def generate_version_metrics(self, C, specs, include0=False): for name, targets in iteritems(sdict): pkgs = [(self.version_key(p), p) for p in self.groups.get(name, [])] pkey = None + # keep in mind that pkgs is already sorted according to version_key (a tuple, + # so composite sort key). Later entries in the list are, by definition, + # greater in some way, so simply comparing with != suffices. for version_key, dist in pkgs: if targets and any(dist == t for t in targets): continue if pkey is None: iv = ib = 0 + # any version number mismatch (each character compared one by one) elif any(pk != vk for pk, vk in zip(pkey[:3], version_key[:3])): iv += 1 ib = 0 + # build number elif pkey[3] != version_key[3]: ib += 1 + # last field is timestamp. Use it as differentiator when build numbers are similar + elif pkey[5] != version_key[5]: + ib += 1 if iv or include0: eqv[dist.full_name] = iv
add timestamp metadata for tiebreaking conda-build 3 hashed packages
2017-04-06T18:34:35
conda/conda
5,030
conda__conda-5030
[ "5034" ]
7f96c658ab06a49d55ee7042d5d30e06fdcd3bc6
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -93,6 +93,7 @@ class Context(Configuration): string_delimiter=os.pathsep) _pkgs_dirs = SequenceParameter(string_types, aliases=('pkgs_dirs',)) _subdir = PrimitiveParameter('', aliases=('subdir',)) + _subdirs = SequenceParameter(string_types, aliases=('subdirs',)) local_repodata_ttl = PrimitiveParameter(1, element_type=(bool, int)) # number of seconds to cache repodata locally @@ -241,6 +242,10 @@ def subdir(self): else: return '%s-%d' % (self.platform, self.bits) + @property + def subdirs(self): + return self._subdirs if self._subdirs else (self.subdir, 'noarch') + @property def bits(self): if self.force_32bit: @@ -456,6 +461,7 @@ def list_parameters(self): 'root_dir', 'skip_safety_checks', 'subdir', + 'subdirs', # https://conda.io/docs/config.html#disable-updating-of-dependencies-update-dependencies # NOQA # I don't think this documentation is correct any longer. # NOQA 'update_dependencies', diff --git a/conda/core/index.py b/conda/core/index.py --- a/conda/core/index.py +++ b/conda/core/index.py @@ -88,7 +88,8 @@ def get_index(channel_urls=(), prepend=True, platform=None, if context.offline and unknown is None: unknown = True - channel_priority_map = prioritize_channels(channel_urls, platform=platform) + subdirs = (platform, 'noarch') if platform is not None else context.subdirs + channel_priority_map = prioritize_channels(channel_urls, subdirs=subdirs) index = fetch_index(channel_priority_map, use_cache=use_cache) if prefix or unknown: @@ -114,7 +115,7 @@ def fetch_index(channel_urls, use_cache=False, index=None): if index is None: index = {} - for _, repodata in repodatas: + for _, repodata in reversed(repodatas): if repodata: index.update(repodata.get('packages', {})) diff --git a/conda/models/channel.py b/conda/models/channel.py --- a/conda/models/channel.py +++ b/conda/models/channel.py @@ -7,7 +7,7 @@ from ..base.constants import (DEFAULTS_CHANNEL_NAME, DEFAULT_CHANNELS_UNIX, DEFAULT_CHANNELS_WIN, MAX_CHANNEL_PRIORITY, UNKNOWN_CHANNEL) from ..base.context import context -from ..common.compat import ensure_text_type, iteritems, odict, with_metaclass +from ..common.compat import ensure_text_type, isiterable, iteritems, odict, with_metaclass from ..common.path import is_path, win_path_backout from ..common.url import (Url, has_scheme, is_url, join_url, path_to_url, split_conda_url_easy_parts, split_scheme_auth_token, urlparse) @@ -268,9 +268,14 @@ def canonical_name(self): else: return join_url(self.location, self.name).lstrip('/') - def urls(self, with_credentials=False, platform=None): + def urls(self, with_credentials=False, subdirs=None): + if subdirs is None: + subdirs = context.subdirs + + assert isiterable(subdirs), subdirs # subdirs must be a non-string iterable + if self.canonical_name == UNKNOWN_CHANNEL: - return Channel(DEFAULTS_CHANNEL_NAME).urls(with_credentials, platform) + return Channel(DEFAULTS_CHANNEL_NAME).urls(with_credentials, subdirs) base = [self.location] if with_credentials and self.token: @@ -279,8 +284,14 @@ def urls(self, with_credentials=False, platform=None): base = join_url(*base) def _platforms(): - p = platform or self.platform or context.subdir - return (p, 'noarch') if p != 'noarch' else ('noarch',) + if self.platform: + yield self.platform + if self.platform != 'noarch': + yield 'noarch' + else: + for subdir in subdirs: + yield subdir + bases = (join_url(base, p) for p in _platforms()) if with_credentials and self.auth: @@ -301,7 +312,8 @@ def url(self, with_credentials=False): if self.package_filename: base.append(self.package_filename) else: - base.append(context.subdir) + first_non_noarch = next((s for s in context.subdirs if s != 'noarch'), 'noarch') + base.append(first_non_noarch) base = join_url(*base) @@ -373,15 +385,16 @@ def channel_location(self): def canonical_name(self): return self.name - def urls(self, with_credentials=False, platform=None): - if platform and platform != context.subdir and self.name == 'defaults': - # necessary shenanigan because different platforms have different default channels - urls = DEFAULT_CHANNELS_WIN if 'win' in platform else DEFAULT_CHANNELS_UNIX - ca = context.channel_alias - _channels = tuple(Channel.make_simple_channel(ca, v) for v in urls) - else: - _channels = self._channels - return list(chain.from_iterable(c.urls(with_credentials, platform) for c in _channels)) + def urls(self, with_credentials=False, subdirs=None): + _channels = self._channels + if self.name == 'defaults': + platform = next((s for s in reversed(subdirs or context.subdirs) if s != 'noarch'), '') + if platform != context.subdir: + # necessary shenanigan because different platforms have different default channels + urls = DEFAULT_CHANNELS_WIN if 'win' in platform else DEFAULT_CHANNELS_UNIX + ca = context.channel_alias + _channels = tuple(Channel.make_simple_channel(ca, v) for v in urls) + return list(chain.from_iterable(c.urls(with_credentials, subdirs) for c in _channels)) @property def base_url(self): @@ -391,17 +404,19 @@ def url(self, with_credentials=False): return None -def prioritize_channels(channels, with_credentials=True, platform=None): +def prioritize_channels(channels, with_credentials=True, subdirs=None): # prioritize_channels returns and OrderedDict with platform-specific channel # urls as the key, and a tuple of canonical channel name and channel priority # number as the value # ('https://conda.anaconda.org/conda-forge/osx-64/', ('conda-forge', 1)) result = odict() - for q, chn in enumerate(channels): + q = -1 # channel priority counter + for chn in channels: channel = Channel(chn) - for url in channel.urls(with_credentials, platform): + for url in channel.urls(with_credentials, subdirs): if url in result: continue + q += 1 result[url] = channel.canonical_name, min(q, MAX_CHANNEL_PRIORITY - 1) return result
diff --git a/tests/base/test_context.py b/tests/base/test_context.py --- a/tests/base/test_context.py +++ b/tests/base/test_context.py @@ -24,7 +24,7 @@ from unittest import TestCase -class ContextTests(TestCase): +class ContextCustomRcTests(TestCase): def setUp(self): string = dals(""" @@ -171,3 +171,13 @@ def test_describe_all(self): from pprint import pprint for name in paramter_names: pprint(context.describe_parameter(name)) + + +class ContextDefaultRcTests(TestCase): + + def test_subdirs(self): + assert context.subdirs == (context.subdir, 'noarch') + + subdirs = ('linux-highest', 'linux-64', 'noarch') + with env_var('CONDA_SUBDIRS', ','.join(subdirs), reset_context): + assert context.subdirs == subdirs diff --git a/tests/models/test_channel.py b/tests/models/test_channel.py --- a/tests/models/test_channel.py +++ b/tests/models/test_channel.py @@ -5,7 +5,7 @@ import os from tempfile import gettempdir -from conda.base.constants import APP_NAME +from conda.base.constants import APP_NAME, DEFAULT_CHANNELS, DEFAULT_CHANNELS_UNIX from conda.common.io import env_var from conda._vendor.auxlib.ish import dals @@ -789,11 +789,46 @@ def test_env_var_file_urls(self): prioritized = prioritize_channels(new_context.channels) assert prioritized == OrderedDict(( ("file://network_share/shared_folder/path/conda/%s" % context.subdir, ("file://network_share/shared_folder/path/conda", 0)), - ("file://network_share/shared_folder/path/conda/noarch", ("file://network_share/shared_folder/path/conda", 0)), - ("https://some.url/ch_name/%s" % context.subdir, ("https://some.url/ch_name", 1)), - ("https://some.url/ch_name/noarch", ("https://some.url/ch_name", 1)), - ("file:///some/place/on/my/machine/%s" % context.subdir, ("file:///some/place/on/my/machine", 2)), - ("file:///some/place/on/my/machine/noarch", ("file:///some/place/on/my/machine", 2)), + ("file://network_share/shared_folder/path/conda/noarch", ("file://network_share/shared_folder/path/conda", 1)), + ("https://some.url/ch_name/%s" % context.subdir, ("https://some.url/ch_name", 2)), + ("https://some.url/ch_name/noarch", ("https://some.url/ch_name", 3)), + ("file:///some/place/on/my/machine/%s" % context.subdir, ("file:///some/place/on/my/machine", 4)), + ("file:///some/place/on/my/machine/noarch", ("file:///some/place/on/my/machine", 5)), + )) + + def test_subdirs(self): + subdirs = ('linux-highest', 'linux-64', 'noarch') + + def _channel_urls(channels=None): + for channel in channels or DEFAULT_CHANNELS_UNIX: + channel = Channel(channel) + for subdir in subdirs: + yield join_url(channel.base_url, subdir) + + with env_var('CONDA_SUBDIRS', ','.join(subdirs), reset_context): + c = Channel('defaults') + assert c.urls() == list(_channel_urls()) + + c = Channel('conda-forge') + assert c.urls() == list(_channel_urls(('conda-forge',))) + + channels = ('bioconda', 'conda-forge') + prioritized = prioritize_channels(channels) + assert prioritized == OrderedDict(( + ("https://conda.anaconda.org/bioconda/linux-highest", ("bioconda", 0)), + ("https://conda.anaconda.org/bioconda/linux-64", ("bioconda", 1)), + ("https://conda.anaconda.org/bioconda/noarch", ("bioconda", 2)), + ("https://conda.anaconda.org/conda-forge/linux-highest", ("conda-forge", 3)), + ("https://conda.anaconda.org/conda-forge/linux-64", ("conda-forge", 4)), + ("https://conda.anaconda.org/conda-forge/noarch", ("conda-forge", 5)), + )) + + prioritized = prioritize_channels(channels, subdirs=('linux-again', 'noarch')) + assert prioritized == OrderedDict(( + ("https://conda.anaconda.org/bioconda/linux-again", ("bioconda", 0)), + ("https://conda.anaconda.org/bioconda/noarch", ("bioconda", 1)), + ("https://conda.anaconda.org/conda-forge/linux-again", ("conda-forge", 2)), + ("https://conda.anaconda.org/conda-forge/noarch", ("conda-forge", 3)), ))
add subdirs configuration parameter As a beta and undocumented feature for future use, add a configurable subdirs parameter.
2017-04-10T17:06:10
conda/conda
5,091
conda__conda-5091
[ "5055" ]
ec9c9999ea57d3351d5c5c688baacc982c3daee2
diff --git a/conda/core/repodata.py b/conda/core/repodata.py --- a/conda/core/repodata.py +++ b/conda/core/repodata.py @@ -265,7 +265,8 @@ def maybe_decompress(filename, resp_content): If the remote site is anaconda.org or follows the Anaconda Server API, you will need to - (a) login to the site with `anaconda login`, or + (a) remove the invalid token from your system with `anaconda logout`, optionally + followed by collecting a new token with `anaconda login`, or (b) provide conda with a valid token directly. Further configuration help can be found at <%s>.
Unable to install package from anaconda.org Despite successfully logging in, I am unable to install a package from anaconda.org. Why do I need to be "authorized" to install from a public repo? Here's a session: > (anaconda) src% conda install -c pydanny cookiecutter > Fetching package metadata ... > > CondaHTTPError: HTTP 401 UNAUTHORIZED for url <https://conda.anaconda.org/pydanny/linux-64/repodata.json> > Elapsed: 00:00.186933 > CF-RAY: 34f70e302ebd099a-ORD > > The remote server has indicated you are using invalid credentials for this channel. > > If the remote site is anaconda.org or follows the Anaconda Server API, you > will need to > (a) login to the site with `anaconda login`, or > (b) provide conda with a valid token directly. > > Further configuration help can be found at <https://conda.io/docs/config.html>. > > > > (anaconda) src% anaconda login > Using Anaconda API: https://api.anaconda.org > Username: smontanaro > smontanaro's Password: > login successful > (anaconda) src% conda install -c pydanny cookiecutter > Fetching package metadata ... > > CondaHTTPError: HTTP 401 UNAUTHORIZED for url <https://conda.anaconda.org/t/sm-1bb26830-27a7-4652-a4df-f47d9426aaf1/pydanny/linux-64/repodata.json> > Elapsed: 00:00.189228 > CF-RAY: 34f7135bfaa52597-ORD > > The remote server has indicated you are using invalid credentials for this channel. > > If the remote site is anaconda.org or follows the Anaconda Server API, you > will need to > (a) login to the site with `anaconda login`, or > (b) provide conda with a valid token directly. > > Further configuration help can be found at <https://conda.io/docs/config.html>.
Here's some verbose output. > (anaconda) src% conda install --verbose -c pydanny cookiecutter > Fetching package metadata ...An unexpected error has occurred. > Please consider posting the following information to the > conda GitHub issue tracker at: > > https://github.com/conda/conda/issues > > > > overtaking stderr and stdout > > stderr and stdout yielding back > > 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.6.0.final.0 > requests version : 2.12.4 > root environment : /home/skip/anaconda3 (writable) > default environment : /home/skip/anaconda3/envs/anaconda > envs directories : /home/skip/anaconda3/envs > /home/skip/.conda/envs > package cache : /home/skip/anaconda3/pkgs > /home/skip/.conda/pkgs > channel URLs : https://conda.anaconda.org/pydanny/linux-64 > https://conda.anaconda.org/pydanny/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 : None > offline mode : False > user-agent : conda/4.3.13 requests/2.12.4 CPython/3.6.0 Linux/4.8.0-46-generic debian/stretch/sid glibc/2.24 > UID:GID : 1001:1001 > > > > `$ /home/skip/anaconda3/envs/anaconda/bin/conda install --verbose -c pydanny cookiecutter` > > > > > Traceback (most recent call last): > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 137, in fetch_repodata_remote_request > resp.raise_for_status() > File "/home/skip/anaconda3/lib/python3.6/site-packages/requests/models.py", line 893, in raise_for_status > raise HTTPError(http_error_msg, response=self) > requests.exceptions.HTTPError: 401 Client Error: UNAUTHORIZED for url: https://conda.anaconda.org/t/<TOKEN>/pydanny/linux-64/repodata.json > > During handling of the above exception, another exception occurred: > > Traceback (most recent call last): > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 591, in conda_exception_handler > return_value = func(*args, **kwargs) > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 134, in _main > exit_code = args.func(args, p) > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 80, in execute > install(args, parser, 'install') > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 222, in install > unknown=index_args['unknown'], prefix=prefix) > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/core/index.py", line 92, in get_index > index = fetch_index(channel_priority_map, use_cache=use_cache) > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/core/index.py", line 111, in fetch_index > repodatas = collect_all_repodata(use_cache, tasks) > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 70, in collect_all_repodata > repodatas = _collect_repodatas_serial(use_cache, tasks) > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 459, in _collect_repodatas_serial > for url, schan, pri in tasks] > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 459, in <listcomp> > for url, schan, pri in tasks] > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 105, in func > res = f(*args, **kwargs) > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 436, in fetch_repodata > mod_etag_headers.get('_mod')) > File "/home/skip/anaconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 299, in fetch_repodata_remote_request > e.response) > conda.exceptions.CondaHTTPError: HTTP 401 UNAUTHORIZED for url <https://conda.anaconda.org/t/<TOKEN>/pydanny/linux-64/repodata.json> > Elapsed: 00:00.216415 > CF-RAY: 34f7600708092525-ORD > > The remote server has indicated you are using invalid credentials for this channel. > > If the remote site is anaconda.org or follows the Anaconda Server API, you > will need to > (a) login to the site with `anaconda login`, or > (b) provide conda with a valid token directly. > > Further configuration help can be found at <https://conda.io/docs/config.html>. > Fails when trying to install from conda-forge as well. I specifically listed public packages for linux-64: > https://anaconda.org/search?q=access%3Apublic+platform%3Alinux-64+cookiecutter but it still demands some authorization which I can't provide. > (anaconda) ~% conda install -c conda-forge cookiecutter > Fetching package metadata ... > > CondaHTTPError: HTTP 401 UNAUTHORIZED for url <https://conda.anaconda.org/t/sm-1bb26830-27a7-4652-a4df-f47d9426aaf1/conda-forge/linux-64/repodata.json> > Elapsed: 00:00.205895 > CF-RAY: 34f76f284a710994-ORD > > The remote server has indicated you are using invalid credentials for this channel. > > If the remote site is anaconda.org or follows the Anaconda Server API, you > will need to > (a) login to the site with `anaconda login`, or > (b) provide conda with a valid token directly. > > Further configuration help can be found at <https://conda.io/docs/config.html>. > I just discovered this issue: https://github.com/conda/conda/issues/3399 Previous searching hadn't found it. (This ticket can likely be merged with that.) Nothing which was suggested there worked for me. In fact, after executing > (anaconda) ~% conda config --add channels conda-forge even conda search commands failed. I had to --remove it before basic searches would work. Specifying any "non-standard" channel seems to fail. If you have an expired token, anaconda.org will always return a 401. `anaconda logout` is the quick fix to get rid of the expired token. I guess we could add this extra information to that error message.
2017-04-21T05:43:19
conda/conda
5,092
conda__conda-5092
[ "5033" ]
ec9c9999ea57d3351d5c5c688baacc982c3daee2
diff --git a/conda/common/signals.py b/conda/common/signals.py --- a/conda/common/signals.py +++ b/conda/common/signals.py @@ -43,6 +43,8 @@ def signal_handler(handler): try: yield finally: + standard_handlers = signal.SIG_IGN, signal.SIG_DFL for sig, previous_handler in previous_handlers: - log.debug("de-registering handler for %s", signame) - signal.signal(sig, previous_handler) + if callable(previous_handler) or previous_handler in standard_handlers: + log.debug("de-registering handler for %s", signame) + signal.signal(sig, previous_handler)
conda.common.signals.signal_handler throwing exceptions on travis The conda.common.signals.signal_handler context manager [introduced in 4.3.14](https://github.com/conda/conda/compare/4.3.13...4.3.14#diff-1ce3aba0f5b5277dc9830e6671cab0f1R35) is causing my travis conda build to fail in the midst of a `conda build` command, throwing `TypeError`s - see [this travis build](https://travis-ci.org/ipython-contrib/jupyter_contrib_nbextensions/jobs/220349775#L633-L662) for a failed example, and then [this build using 4.3.13](https://travis-ci.org/ipython-contrib/jupyter_contrib_nbextensions/jobs/220359572) which does exactly the same with the earlier version which still works. These builds still work fine for me locally (Ubuntu 16.04), so I assume this is something related to Travis (currenlty apparently using Ubuntu 12.04 or 14.04) somehow, although I'm not sure what...
Stacktrace from CI is ``` Traceback (most recent call last): File "/home/travis/miniconda/bin/conda-build", line 6, in <module> sys.exit(conda_build.cli.main_build.main()) File "/home/travis/miniconda/lib/python3.6/site-packages/conda_build/cli/main_build.py", line 334, in main execute(sys.argv[1:]) File "/home/travis/miniconda/lib/python3.6/site-packages/conda_build/cli/main_build.py", line 325, in execute noverify=args.no_verify) File "/home/travis/miniconda/lib/python3.6/site-packages/conda_build/api.py", line 97, in build need_source_download=need_source_download, config=config) File "/home/travis/miniconda/lib/python3.6/site-packages/conda_build/build.py", line 1503, in build_tree config=config) File "/home/travis/miniconda/lib/python3.6/site-packages/conda_build/build.py", line 1019, in build create_env(config.build_prefix, specs, config=config) File "/home/travis/miniconda/lib/python3.6/site-packages/conda_build/build.py", line 688, in create_env execute_actions(actions, index, verbose=config.debug) File "/home/travis/miniconda/lib/python3.6/site-packages/conda/plan.py", line 809, in execute_actions execute_instructions(plan, index, verbose) File "/home/travis/miniconda/lib/python3.6/site-packages/conda/instructions.py", line 247, in execute_instructions cmd(state, arg) File "/home/travis/miniconda/lib/python3.6/site-packages/conda/instructions.py", line 100, in PROGRESSIVEFETCHEXTRACT_CMD progressive_fetch_extract.execute() File "/home/travis/miniconda/lib/python3.6/site-packages/conda/core/package_cache.py", line 491, in execute self._execute_action(action) File "/home/travis/miniconda/lib/python3.6/contextlib.py", line 89, in __exit__ next(self.gen) File "/home/travis/miniconda/lib/python3.6/site-packages/conda/common/signals.py", line 48, in signal_handler signal.signal(sig, previous_handler) File "/home/travis/miniconda/lib/python3.6/signal.py", line 47, in signal handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler)) TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object ```
2017-04-21T05:55:24
conda/conda
5,093
conda__conda-5093
[ "5028" ]
ec9c9999ea57d3351d5c5c688baacc982c3daee2
diff --git a/conda/cli/main_list.py b/conda/cli/main_list.py --- a/conda/cli/main_list.py +++ b/conda/cli/main_list.py @@ -11,15 +11,6 @@ from os.path import isdir, isfile import re -from .common import (add_parser_help, add_parser_json, add_parser_prefix, - add_parser_show_channel_urls, disp_features, stdout_json) -from ..base.constants import DEFAULTS_CHANNEL_NAME, UNKNOWN_CHANNEL -from ..base.context import context -from ..common.compat import text_type -from ..core.linked_data import is_linked, linked, linked_data -from ..egg_info import get_egg_info -from ..exceptions import CondaEnvironmentNotFoundError, CondaFileNotFoundError - descr = "List linked packages in a conda environment." # Note, the formatting of this is designed to work well with help2man @@ -46,6 +37,9 @@ log = logging.getLogger(__name__) def configure_parser(sub_parsers): + from .common import (add_parser_help, add_parser_json, add_parser_prefix, + add_parser_show_channel_urls) + p = sub_parsers.add_parser( 'list', description=descr, @@ -105,10 +99,10 @@ def configure_parser(sub_parsers): p.set_defaults(func=execute) -def print_export_header(): +def print_export_header(subdir): print('# This file may be used to create an environment using:') print('# $ conda create --name <env> --file <this file>') - print('# platform: %s' % context.subdir) + print('# platform: %s' % subdir) def get_packages(installed, regex): @@ -122,7 +116,11 @@ def get_packages(installed, regex): def list_packages(prefix, installed, regex=None, format='human', - show_channel_urls=context.show_channel_urls): + show_channel_urls=None): + from .common import disp_features + from ..base.constants import DEFAULTS_CHANNEL_NAME + from ..base.context import context + from ..core.linked_data import is_linked res = 0 result = [] for dist in get_packages(installed, regex): @@ -140,6 +138,7 @@ def list_packages(prefix, installed, regex=None, format='human', disp = '%(name)-25s %(version)-15s %(build)15s' % info disp += ' %s' % disp_features(features) schannel = info.get('schannel') + show_channel_urls = show_channel_urls or context.show_channel_urls if (show_channel_urls or show_channel_urls is None and schannel != DEFAULTS_CHANNEL_NAME): disp += ' %s' % schannel @@ -152,8 +151,15 @@ def list_packages(prefix, installed, regex=None, format='human', def print_packages(prefix, regex=None, format='human', piplist=False, - json=False, show_channel_urls=context.show_channel_urls): + json=False, show_channel_urls=None): + from .common import stdout_json + from ..base.context import context + from ..common.compat import text_type + from ..core.linked_data import linked + from ..egg_info import get_egg_info + if not isdir(prefix): + from ..exceptions import CondaEnvironmentNotFoundError raise CondaEnvironmentNotFoundError(prefix) if not json: @@ -161,7 +167,7 @@ def print_packages(prefix, regex=None, format='human', piplist=False, print('# packages in environment at %s:' % prefix) print('#') if format == 'export': - print_export_header() + print_export_header(context.subdir) installed = linked(prefix) log.debug("installed conda packages:\n%s", installed) @@ -180,9 +186,13 @@ def print_packages(prefix, regex=None, format='human', piplist=False, def print_explicit(prefix, add_md5=False): + from ..base.constants import UNKNOWN_CHANNEL + from ..base.context import context + from ..core.linked_data import linked_data if not isdir(prefix): + from ..exceptions import CondaEnvironmentNotFoundError raise CondaEnvironmentNotFoundError(prefix) - print_export_header() + print_export_header(context.subdir) print("@EXPLICIT") for meta in sorted(linked_data(prefix).values(), key=lambda x: x['name']): url = meta.get('url') @@ -194,6 +204,8 @@ def print_explicit(prefix, add_md5=False): 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: @@ -208,6 +220,7 @@ def execute(args, parser): else: stdout_json(h.object_log()) else: + from ..exceptions import CondaFileNotFoundError raise CondaFileNotFoundError(h.path) return
unexpected issue Uncaught Exception: Error: Conda command "info" failed: command: conda info,--json output: An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues `$ /Users/tasalta/anaconda/bin/conda info --json` Traceback (most recent call last): File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 573, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 98, in _main imported = importlib.import_module(module) File "/Users/tasalta/anaconda/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/cli/main_list.py", line 20, in <module> from ..egg_info import get_egg_info File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/egg_info.py", line 15, in <module> from .misc import rel_path File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/misc.py", line 19, in <module> from .core.index import get_index, _supplement_index_with_cache File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: cannot import name InsecureRequestWarning at throwCondaError (/Applications/GraphLab Create Launcher.app/Contents/Resources/app.asar/utils/conda.js:117:9) at runConda (/Applications/GraphLab Create Launcher.app/Contents/Resources/app.asar/utils/conda.js:146:5) at Object.info (/Applications/GraphLab Create Launcher.app/Contents/Resources/app.asar/utils/conda.js:395:10) at Object.isGLCLauncherReady (/Applications/GraphLab Create Launcher.app/Contents/Resources/app.asar/utils/systemState.js:207:27) at [object Object].onWindowOpen [as _onTimeout] (/Applications/GraphLab Create Launcher.app/Contents/Resources/app.asar/main.js:144:57) at Timer.listOnTimeout (timers.js:89:15)
2017-04-21T06:28:28
conda/conda
5,096
conda__conda-5096
[ "5073" ]
1ac0dab62399c71aa38d1d7db0576af14e4e1079
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -103,8 +103,10 @@ class Context(Configuration): # remote connection details ssl_verify = PrimitiveParameter(True, element_type=string_types + (bool,), validation=ssl_verify_validation) - client_ssl_cert = PrimitiveParameter('', aliases=('client_cert',)) - client_ssl_cert_key = PrimitiveParameter('', aliases=('client_cert_key',)) + client_ssl_cert = PrimitiveParameter(None, aliases=('client_cert',), + element_type=string_types + (NoneType,)) + client_ssl_cert_key = PrimitiveParameter(None, aliases=('client_cert_key',), + element_type=string_types + (NoneType,)) proxy_servers = MapParameter(string_types) remote_connect_timeout_secs = PrimitiveParameter(9.15) remote_read_timeout_secs = PrimitiveParameter(60.)
OpenSSL.SSL.Error while creating new environment Hi, I am trying to create a new conda environment but getting the following error: `$ /opt/external/conda/bin/conda env create -n aaa -vvv Fetching package metadata ...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.16 conda is private : False conda-env version : 4.3.16 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : /opt/external/conda (read only) default environment : /opt/external/conda envs directories : /opt/apps/adm-pbak /home/adm-pbak/.conda/envs /opt/external/conda/envs package cache : /opt/external/conda/pkgs /opt/apps/adm-pbak/.conda/pkgs channel URLs : 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/adm-pbak/.condarc offline mode : False user-agent : conda/4.3.16 requests/2.12.4 CPython/3.6.0 Linux/2.6.32-642.13.1.el6.x86_64 Red Hat Enterprise Linux Server/6.8 glibc/2.12 UID:GID : 34002:34000 `$ /opt/external/conda/bin/conda-env create -n aaa -vvv` Traceback (most recent call last): File "/opt/external/conda/lib/python3.6/site-packages/conda/exceptions.py", line 626, in conda_exception_handler return_value = func(*args, **kwargs) File "/opt/external/conda/lib/python3.6/site-packages/conda_env/cli/main_create.py", line 108, in execute installer.install(prefix, pkg_specs, args, env) File "/opt/external/conda/lib/python3.6/site-packages/conda_env/installers/conda.py", line 29, in install prefix=prefix) File "/opt/external/conda/lib/python3.6/site-packages/conda/core/index.py", line 92, in get_index index = fetch_index(channel_priority_map, use_cache=use_cache) File "/opt/external/conda/lib/python3.6/site-packages/conda/core/index.py", line 111, in fetch_index repodatas = collect_all_repodata(use_cache, tasks) File "/opt/external/conda/lib/python3.6/site-packages/conda/core/repodata.py", line 74, in collect_all_repodata repodatas = _collect_repodatas_serial(use_cache, tasks) File "/opt/external/conda/lib/python3.6/site-packages/conda/core/repodata.py", line 463, in _collect_repodatas_serial for url, schan, pri in tasks] File "/opt/external/conda/lib/python3.6/site-packages/conda/core/repodata.py", line 463, in <listcomp> for url, schan, pri in tasks] File "/opt/external/conda/lib/python3.6/site-packages/conda/core/repodata.py", line 109, in func res = f(*args, **kwargs) File "/opt/external/conda/lib/python3.6/site-packages/conda/core/repodata.py", line 442, in fetch_repodata mod_etag_headers.get('_mod')) File "/opt/external/conda/lib/python3.6/site-packages/conda/core/repodata.py", line 138, in fetch_repodata_remote_request timeout=timeout) File "/opt/external/conda/lib/python3.6/site-packages/requests/sessions.py", line 501, in get return self.request('GET', url, **kwargs) File "/opt/external/conda/lib/python3.6/site-packages/requests/sessions.py", line 488, in request resp = self.send(prep, **send_kwargs) File "/opt/external/conda/lib/python3.6/site-packages/requests/sessions.py", line 609, in send r = adapter.send(request, **kwargs) File "/opt/external/conda/lib/python3.6/site-packages/requests/adapters.py", line 423, in send timeout=timeout File "/opt/external/conda/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 588, in urlopen self._prepare_proxy(conn) File "/opt/external/conda/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 801, in _prepare_proxy conn.connect() File "/opt/external/conda/lib/python3.6/site-packages/requests/packages/urllib3/connection.py", line 323, in connect ssl_context=context) File "/opt/external/conda/lib/python3.6/site-packages/requests/packages/urllib3/util/ssl_.py", line 322, in ssl_wrap_socket context.load_cert_chain(certfile, keyfile) File "/opt/external/conda/lib/python3.6/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 397, in load_cert_chain self._ctx.use_certificate_file(certfile) File "/opt/external/conda/lib/python3.6/site-packages/OpenSSL/SSL.py", line 596, in use_certificate_file _raise_current_error() File "/opt/external/conda/lib/python3.6/site-packages/OpenSSL/_util.py", line 48, in exception_from_error_queue raise exception_type(errors) OpenSSL.SSL.Error: [('system library', 'fopen', 'No such file or directory'), ('BIO routines', 'FILE_CTRL', 'system lib'), ('SSL routines', 'SSL_CTX_use_certificate_file', 'system lib')] ` And this is my .condarc file: `add_anaconda_token: True add_pip_as_python_dependency: True allow_non_channel_urls: True allow_softlinks: True always_copy: False always_softlink: False always_yes: False anaconda_upload: None auto_update_conda: True changeps1: True channel_alias: https://conda.anaconda.org channel_priority: True channels: - defaults client_ssl_cert: client_ssl_cert_key: clobber: False create_default_packages: [] custom_channels: pkgs/free: https://repo.continuum.io/ pkgs/r: https://repo.continuum.io/ pkgs/pro: https://repo.continuum.io/ custom_multichannels: defaults: ["https://repo.continuum.io/pkgs/free", "https://repo.continuum.io/pkgs/r", "https://repo.continuum.io/pkgs/pro"] local: [] default_channels: - https://repo.continuum.io/pkgs/free - https://repo.continuum.io/pkgs/r - https://repo.continuum.io/pkgs/pro disallow: [] envs_dirs: - /opt/apps/adm-pbak - /home/adm-pbak/.conda/envs - /opt/external/conda/envs force: False json: False local_repodata_ttl: 1 migrated_channel_aliases: [] offline: False path_conflict: clobber pinned_packages: [] pkgs_dirs: - /opt/external/conda/pkgs - /opt/apps/adm-pbak/.conda/pkgs proxy_servers: {} quiet: False remote_connect_timeout_secs: 9.15 remote_max_retries: 3 remote_read_timeout_secs: 60.0 rollback_enabled: True shortcuts: True show_channel_urls: None ssl_verify: False track_features: [] use_pip: True verbosity: 0 `
@przemolb Do you have the environment variable `REQUESTS_CA_BUNDLE` set? What is the output for: ``` env | grep -i CA_BUNDLE ``` If it is set, make sure that the file which is present in the value, exists, and is up to date, otherwise unset this environment variable by typing: ``` unset REQUESTS_CA_BUNDLE ``` And then try creating a conda environment. I don't have it set: ` [adm-pbak@dsvuk3lifm001 ~]$ env | grep -i CA_BUNDLE [adm-pbak@dsvuk3lifm001 ~]$ unset REQUESTS_CA_BUNDLE [adm-pbak@dsvuk3lifm001 ~]$ /opt/external/conda/bin/conda env create -f environment.yml -p /opt/apps/adm-pbak/ Fetching package metadata ...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.16 conda is private : False conda-env version : 4.3.16 conda-build version : not installed python version : 3.6.1.final.0 requests version : 2.13.0 root environment : /opt/external/conda (read only) default environment : /opt/external/conda envs directories : /opt/apps/adm-pbak /home/adm-pbak/.conda/envs /opt/external/conda/envs package cache : /opt/apps/adm-pbak /opt/external/conda/pkgs /opt/apps/adm-pbak/.conda/pkgs channel URLs : 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/adm-pbak/.condarc offline mode : False user-agent : conda/4.3.16 requests/2.13.0 CPython/3.6.1 Linux/2.6.32-642.13.1.el6.x86_64 Red Hat Enterprise Linux Server/6.8 glibc/2.12 UID:GID : 34002:34000 `$ /opt/external/conda/bin/conda-env create -f environment.yml -p /opt/apps/adm-pbak/` Traceback (most recent call last): File "/opt/external/conda/lib/python3.6/site-packages/conda/exceptions.py", line 626, in conda_exception_handler return_value = func(*args, **kwargs) File "/opt/external/conda/lib/python3.6/site-packages/conda_env/cli/main_create.py", line 108, in execute installer.install(prefix, pkg_specs, args, env) File "/opt/external/conda/lib/python3.6/site-packages/conda_env/installers/conda.py", line 29, in install prefix=prefix) File "/opt/external/conda/lib/python3.6/site-packages/conda/core/index.py", line 92, in get_index index = fetch_index(channel_priority_map, use_cache=use_cache) File "/opt/external/conda/lib/python3.6/site-packages/conda/core/index.py", line 111, in fetch_index repodatas = collect_all_repodata(use_cache, tasks) File "/opt/external/conda/lib/python3.6/site-packages/conda/core/repodata.py", line 74, in collect_all_repodata repodatas = _collect_repodatas_serial(use_cache, tasks) File "/opt/external/conda/lib/python3.6/site-packages/conda/core/repodata.py", line 463, in _collect_repodatas_serial for url, schan, pri in tasks] File "/opt/external/conda/lib/python3.6/site-packages/conda/core/repodata.py", line 463, in <listcomp> for url, schan, pri in tasks] File "/opt/external/conda/lib/python3.6/site-packages/conda/core/repodata.py", line 109, in func res = f(*args, **kwargs) File "/opt/external/conda/lib/python3.6/site-packages/conda/core/repodata.py", line 442, in fetch_repodata mod_etag_headers.get('_mod')) File "/opt/external/conda/lib/python3.6/site-packages/conda/core/repodata.py", line 138, in fetch_repodata_remote_request timeout=timeout) File "/opt/external/conda/lib/python3.6/site-packages/requests/sessions.py", line 501, in get return self.request('GET', url, **kwargs) File "/opt/external/conda/lib/python3.6/site-packages/requests/sessions.py", line 488, in request resp = self.send(prep, **send_kwargs) File "/opt/external/conda/lib/python3.6/site-packages/requests/sessions.py", line 609, in send r = adapter.send(request, **kwargs) File "/opt/external/conda/lib/python3.6/site-packages/requests/adapters.py", line 423, in send timeout=timeout File "/opt/external/conda/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen self._prepare_proxy(conn) File "/opt/external/conda/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 810, in _prepare_proxy conn.connect() File "/opt/external/conda/lib/python3.6/site-packages/requests/packages/urllib3/connection.py", line 326, in connect ssl_context=context) File "/opt/external/conda/lib/python3.6/site-packages/requests/packages/urllib3/util/ssl_.py", line 322, in ssl_wrap_socket context.load_cert_chain(certfile, keyfile) File "/opt/external/conda/lib/python3.6/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 416, in load_cert_chain self._ctx.use_certificate_file(certfile) File "/opt/external/conda/lib/python3.6/site-packages/OpenSSL/SSL.py", line 596, in use_certificate_file _raise_current_error() File "/opt/external/conda/lib/python3.6/site-packages/OpenSSL/_util.py", line 48, in exception_from_error_queue raise exception_type(errors) OpenSSL.SSL.Error: [('system library', 'fopen', 'No such file or directory'), ('BIO routines', 'FILE_CTRL', 'system lib'), ('SSL routines', 'SSL_CTX_use_certificate_file', 'system lib')] ` @przemolb Could you please share the output for the command: ```bash conda config --show | grep client_ssl_cert ``` If it is set to some file location, could you please check whether the file exists? It appears as if this is some sort of centralized conda installation with some pre-configured settings for proxy and ssl certificates. Could you also please share the output for: ``` find /opt/external/conda/ -name .condarc ``` [adm-pbak@dsvuk3lifm001 ~]$ /opt/external/conda/bin/conda config --show | grep client_ssl_cert client_ssl_cert: None client_ssl_cert_key: None ` [adm-pbak@dsvuk3lifm001 ~]$ find /opt/external/conda/ -name .condarc [adm-pbak@dsvuk3lifm001 ~]$ ls -la .condarc* -rw-r--r-- 1 adm-pbak adm-sysadmin 1392 Apr 19 10:19 .condarc [adm-pbak@dsvuk3lifm001 ~]$ cat .condarc add_anaconda_token: True add_pip_as_python_dependency: True allow_non_channel_urls: True allow_softlinks: True always_copy: False always_softlink: False always_yes: False anaconda_upload: None auto_update_conda: True changeps1: True channel_alias: https://conda.anaconda.org channel_priority: True channels: - defaults client_ssl_cert: client_ssl_cert_key: clobber: False create_default_packages: [] custom_channels: pkgs/free: https://repo.continuum.io/ pkgs/r: https://repo.continuum.io/ pkgs/pro: https://repo.continuum.io/ custom_multichannels: defaults: ["https://repo.continuum.io/pkgs/free", "https://repo.continuum.io/pkgs/r", "https://repo.continuum.io/pkgs/pro"] local: [] default_channels: - https://repo.continuum.io/pkgs/free - https://repo.continuum.io/pkgs/r - https://repo.continuum.io/pkgs/pro disallow: [] envs_dirs: - /opt/apps/adm-pbak - /home/adm-pbak/.conda/envs - /opt/external/conda/envs force: False json: False local_repodata_ttl: 1 migrated_channel_aliases: [] offline: False path_conflict: clobber pinned_packages: [] pkgs_dirs: - /opt/external/conda/pkgs - /opt/apps/adm-pbak/.conda/pkgs proxy_servers: {} quiet: False remote_connect_timeout_secs: 9.15 remote_max_retries: 3 remote_read_timeout_secs: 60.0 rollback_enabled: True shortcuts: True show_channel_urls: None ssl_verify: False track_features: [] use_pip: True verbosity: 0 ` @przemolb Ah, I think now I am able to reproduce your scenario. Could you please try the following? Edit the file `/home/adm-pbak/.condarc` and remove the following two lines: ``` client_ssl_cert: client_ssl_cert_key: ``` FYI, `conda config --show-sources` could have also been helpful in diagnosing :) `conda config --show` and `conda config --show-sources` are slightly different, and both are useful @kalefranz I am not sure if this is the right solution, but the following patch fixes this issue for me: ```patch diff --git a/conda/base/context.py b/conda/base/context.py index 78033d6..46e9138 100644 --- a/conda/base/context.py +++ b/conda/base/context.py @@ -103,8 +102,10 @@ class Context(Configuration): # remote connection details ssl_verify = PrimitiveParameter(True, element_type=string_types + (bool,), validation=ssl_verify_validation) - client_ssl_cert = PrimitiveParameter('', aliases=('client_cert',)) - client_ssl_cert_key = PrimitiveParameter('', aliases=('client_cert_key',)) + client_ssl_cert = PrimitiveParameter(None, aliases=('client_cert',), + element_type=string_types + (NoneType,)) + client_ssl_cert_key = PrimitiveParameter(None, aliases=('client_cert_key',), + element_type=string_types + (NoneType,)) ``` As requested: ` [adm-pbak@dsvuk3lifm001 ~]$ /opt/external/conda/bin/conda config --show-sources ==> /home/adm-pbak/.condarc <== add_pip_as_python_dependency: True allow_softlinks: True auto_update_conda: True clobber: False changeps1: True create_default_packages: [] disallow: [] path_conflict: clobber pinned_packages: [] rollback_enabled: True track_features: [] use_pip: True envs_dirs: - /opt/apps/adm-pbak - /home/adm-pbak/.conda/envs - /opt/external/conda/envs pkgs_dirs: - /opt/external/conda/pkgs - /opt/apps/adm-pbak/.conda/pkgs local_repodata_ttl: 1 ssl_verify: False client_ssl_cert: None client_ssl_cert_key: None proxy_servers: {} remote_connect_timeout_secs: 9.15 remote_read_timeout_secs: 60.0 remote_max_retries: 3 add_anaconda_token: True channel_alias: https://conda.anaconda.org allow_non_channel_urls: True channels: - defaults migrated_channel_aliases: [] default_channels: - https://repo.continuum.io/pkgs/free - https://repo.continuum.io/pkgs/r - https://repo.continuum.io/pkgs/pro custom_channels: pkgs/free: https://repo.continuum.io/ pkgs/r: https://repo.continuum.io/ pkgs/pro: https://repo.continuum.io/ custom_multichannels: defaults: ['https://repo.continuum.io/pkgs/free', 'https://repo.continuum.io/pkgs/r', 'https://repo.continuum.io/pkgs/pro'] local: [] always_softlink: False always_copy: False always_yes: False channel_priority: True force: False json: False offline: False quiet: False shortcuts: True show_channel_urls: None verbosity: 0 anaconda_upload: None ==> envvars <== envs_path: - /opt/apps/adm-pbak/ pkgs_dirs: - /opt/apps/adm-pbak/ ` @przemolb The problem is that: ``` client_ssl_cert: None client_ssl_cert_key: None ``` Is literally making `client_ssl_cert` equal to the string `None`, whereas it should be interpreted as 'this is not set', hence I asked you to remove both of these strings from `~/.condarc` and try to run the `conda-env create ...` command ` [adm-pbak@dsvuk3lifm001 ~]$ vim .condarc # removed client_ssl_cert and client_ssl_cert_key from the config [adm-pbak@dsvuk3lifm001 ~]$ /opt/external/conda/bin/conda env create -f environment.yml -p /opt/apps/adm-pbak/ Fetching package metadata ......... Solving package specifications: . readline-6.2-2 100% |#############################################################################################################################################################################################| Time: 0:00:00 12.21 MB/s sqlite-3.13.0- 100% |#############################################################################################################################################################################################| Time: 0:00:00 31.13 MB/s tk-8.5.18-0.ta 100% |#############################################################################################################################################################################################| Time: 0:00:00 36.14 MB/s xz-5.2.2-1.tar 100% |#############################################################################################################################################################################################| Time: 0:00:00 28.18 MB/s zlib-1.2.8-3.t 100% |#############################################################################################################################################################################################| Time: 0:00:00 26.52 MB/s setuptools-27. 100% |#############################################################################################################################################################################################| Time: 0:00:00 31.03 MB/s wheel-0.29.0-p 100% |#############################################################################################################################################################################################| Time: 0:00:00 24.61 MB/s pip-9.0.1-py36 100% |#############################################################################################################################################################################################| Time: 0:00:00 31.76 MB/s # # To activate this environment, use: # > source activate /opt/apps/adm-pbak # # To deactivate this environment, use: # > source deactivate /opt/apps/adm-pbak # ` So now it is working fine :-) When we can expect the patch to be released ? Wow it certainly could be. Makes sense to me. Want to submit a PR targeted at 4.3.x? I'm getting ready to tag 4.3.17 in the next day or two. Could easily get it in. Right now we don't have proxy servers and such to integration test a lot of these http connection issues. We need them. It's on the TODO list. I'll perform some tests locally and send a PR targeting 4.3.x
2017-04-21T15:36:21
conda/conda
5,098
conda__conda-5098
[ "4671" ]
daf34a6925dadf0a091f38a834780731db26ccdd
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -6,14 +6,16 @@ import json from logging import getLogger from os.path import dirname, join +from random import random import re +from time import sleep from .linked_data import delete_linked_data, get_python_version_for_prefix, load_linked_data from .portability import _PaddingError, update_prefix from .._vendor.auxlib.compat import with_metaclass from .._vendor.auxlib.ish import dals from ..base.context import context -from ..common.compat import iteritems, on_win +from ..common.compat import iteritems, on_win, range from ..common.path import (get_bin_directory_short_path, get_leaf_directories, get_python_noarch_target_path, get_python_short_path, parse_entry_point_def, preferred_env_to_prefix, pyc_path, url_to_path, @@ -133,6 +135,7 @@ def source_full_path(self): class LinkPathAction(CreateInPrefixPathAction): + _verify_max_backoff_reached = False @classmethod def create_file_link_actions(cls, transaction_context, package_info, target_prefix, @@ -213,13 +216,28 @@ def __init__(self, transaction_context, package_info, def verify(self): # TODO: consider checking hashsums if self.link_type != LinkType.directory and not lexists(self.source_full_path): - return CondaVerificationError(dals(""" - The package for %s located at %s - appears to be corrupted. The path '%s' - specified in the package manifest cannot be found. - """ % (self.package_info.index_json_record.name, - self.package_info.extracted_package_dir, - self.source_short_path))) + # This backoff loop is added because of some weird race condition conda-build + # experiences. Would be nice at some point to get to the bottom of why it happens. + + # with max_retries = 2, max total time ~= 0.4 sec + # with max_retries = 6, max total time ~= 6.5 sec + max_retries = 2 if LinkPathAction._verify_max_backoff_reached else 6 + for n in range(max_retries): + sleep_time = ((2 ** n) + random()) * 0.1 + log.trace("retrying lexists(%s) in %g sec", self.source_full_path, sleep_time) + sleep(sleep_time) + if lexists(self.source_full_path): + break + else: + # only run the 6.5 second backoff time once + LinkPathAction._verify_max_backoff_reached = True + return CondaVerificationError(dals(""" + The package for %s located at %s + appears to be corrupted. The path '%s' + specified in the package manifest cannot be found. + """ % (self.package_info.index_json_record.name, + self.package_info.extracted_package_dir, + self.source_short_path))) self._verified = True def execute(self):
Conflict with package, which just has been built @marscher commented on [Fri Feb 17 2017](https://github.com/conda/conda-build/issues/1748) The build phase succeeded, but when the test phase tries to create the environment a conflict is raised containing only the actual package, which just has been built. I've checked manually, that all dependencies are available for Python 3.6 and the desired Numpy version (1.11), so it is pretty unclear to me, why this is happening. * conda-build is 2.1.4. * The recipe can be found here: https://github.com/omnia-md/conda-recipes/tree/master/pyemma * conda build log attached (debug level): [build_debug_log.txt](https://github.com/conda/conda-build/files/783354/build_debug_log.txt) cc omnia-md/conda-recipes/issues/702 --- @msarahan commented on [Fri Feb 17 2017](https://github.com/conda/conda-build/issues/1748#issuecomment-280668089) Are all dependencies actually installable for py 36? If I try to create an environment with this command (just taken from your meta.yaml), it shows that bhmm is not available: ``` [dev@e9f4c54fd4ff downloads]$ conda create -n pyemma -c omnia bhmm=0.6.1 decorator=4 funcsigs joblib=0.9.4 matplotlib mdtraj=1.8 mock msmtools=1.2 numpy=1.11 progress_reporter=1.3.1 psutil=3.1.1 python=3.6 pyyaml scipy setuptools six thermotools=0.2.3 Fetching package metadata ......... Solving package specifications: .... UnsatisfiableError: The following specifications were found to be in conflict: - bhmm 0.6* - python 3.6* Use "conda info <package>" to see the dependencies for each package. ``` Conda search shows that it is, though: ``` [dev@e9f4c54fd4ff downloads]$ conda search -c omnia bhmm Fetching package metadata ......... bhmm 0.2.0 py27_0 omnia 0.3.0 np18py27_0 omnia 0.3.0 np19py27_0 omnia 0.4.2 np18py27_0 omnia 0.4.2 np19py27_0 omnia 0.5.0 np18py27_0 omnia 0.5.0 np19py27_0 omnia 0.5.1 np110py27_0 omnia 0.5.1 np110py34_0 omnia 0.5.1 np110py35_0 omnia 0.5.1 np18py27_0 omnia 0.5.1 np18py33_0 omnia 0.5.1 np18py34_0 omnia 0.5.1 np19py27_0 omnia 0.5.1 np19py33_0 omnia 0.5.1 np19py34_0 omnia 0.5.2 np110py27_0 omnia 0.5.2 np110py34_0 omnia 0.5.2 np110py35_0 omnia 0.5.2 np19py27_0 omnia 0.5.2 np19py34_0 omnia 0.5.2 np19py35_0 omnia 0.6.1 np110py27_0 omnia 0.6.1 np110py34_0 omnia 0.6.1 np110py35_0 omnia 0.6.1 np111py27_0 omnia 0.6.1 np111py34_0 omnia 0.6.1 np111py35_0 omnia 0.6.1 np111py36_0 omnia 0.6.1 np19py27_0 omnia 0.6.1 np19py34_0 omnia 0.6.1 np19py35_0 omnia ``` This means that one of bhmm's dependencies (or even further up the chain) is not installable for python 3.6. However, creating an env with just bhmm works: ``` [dev@e9f4c54fd4ff downloads]$ conda create -n bhmm bhmm=0.6.1 numpy=1.11 python=3.6 -c omnia Fetching package metadata ......... Solving package specifications: .......... Package plan for installation in environment /opt/miniconda/envs/bhmm: The following packages will be downloaded: package | build ---------------------------|----------------- python-3.6.0 | 0 16.3 MB cython-0.25.2 | py36_0 6.5 MB decorator-4.0.11 | py36_0 15 KB numpy-1.11.3 | py36_0 6.7 MB setuptools-27.2.0 | py36_0 523 KB six-1.10.0 | py36_0 19 KB wheel-0.29.0 | py36_0 88 KB pip-9.0.1 | py36_1 1.7 MB scipy-0.18.1 | np111py36_1 31.2 MB msmtools-1.2 | np111py36_0 1.2 MB omnia bhmm-0.6.1 | np111py36_0 481 KB omnia ------------------------------------------------------------ Total: 64.7 MB The following NEW packages will be INSTALLED: bhmm: 0.6.1-np111py36_0 omnia cython: 0.25.2-py36_0 decorator: 4.0.11-py36_0 libgfortran: 3.0.0-1 mkl: 2017.0.1-0 msmtools: 1.2-np111py36_0 omnia numpy: 1.11.3-py36_0 openssl: 1.0.2k-0 pip: 9.0.1-py36_1 python: 3.6.0-0 readline: 6.2-2 scipy: 0.18.1-np111py36_1 setuptools: 27.2.0-py36_0 six: 1.10.0-py36_0 sqlite: 3.13.0-0 tk: 8.5.18-0 wheel: 0.29.0-py36_0 xz: 5.2.2-1 zlib: 1.2.8-3 Proceed ([y]/n)? n ``` This is some deeper conflict between dependencies, and conda's hints are just not helping much here. I'm moving this issue to the conda repo to see if they can help you figure out a way to debug this. Note: I have used conda 4.3.11 for this. It has better hints than earlier versions, but apparently still confusing sometimes.
cc @mcg1969 - any tips on getting better hints here? I'm afraid we just need to keep working on improving the conflict hints. I'm not sure I have any short-term advice. It's really an extended R&D struggle. I know that there has been some effort before to create better hints: https://github.com/rmcgibbo/conda-hint But as far as I remember it requires at least Python 3.5 to run. I see that funcsigs is the conflicting package. Note that "py36" is not yet a valid selector. Is there any sane way to select this package only for python version smaller than 3.6 with the selector feature? ```[py<36]``` should work? On 02/17/2017 04:20 PM, Mike Sarahan wrote: > |[py>35]| should work? yes, thanks you! Just a question, why does conda-build not use the logic of conda(-env) to create the test env in the first place in order to get the same behaviour (hint generation)? Speed and spec format. Conda build allows specs according to https://conda.io/docs/spec.html#package-match-specifications The command line interface and the newer conda API, which is just a tiny bit lower level than the CLI, do not support those match specs. Part of the reason is that characters like > and < get misinterpreted by the terminal. Even if you put them on quotes, though, the CLI still doesn't support them. Speed is also drastically slower, because conda build is able to control caching more intelligently. I'm surprised that the hints are different, but it probably comes down to the input specs being different. I had to alter them in order to make them valid CLI input. Ultimately conda's solver is being called similarly in both conda build and conda. We're working on a conda API that will unify behavior while maintaining the speed advantages.
2017-04-21T16:19:20
conda/conda
5,103
conda__conda-5103
[ "4849", "4849" ]
58b12f4949fb50c1890a810942660982153af440
diff --git a/conda/plan.py b/conda/plan.py --- a/conda/plan.py +++ b/conda/plan.py @@ -467,7 +467,6 @@ def install_actions_list(prefix, index, specs, force=False, only_names=None, alw channel_priority_map=None, is_update=False): # type: (str, Dict[Dist, Record], List[str], bool, Option[List[str]], bool, bool, bool, # bool, bool, bool, Dict[str, Sequence[str, int]]) -> List[Dict[weird]] - str_specs = specs specs = [MatchSpec(spec) for spec in specs] r = get_resolve_object(index.copy(), prefix) @@ -483,11 +482,11 @@ def install_actions_list(prefix, index, specs, force=False, only_names=None, alw # Replace SpecsForPrefix specs with specs that were passed in in order to retain # version information - required_solves = match_to_original_specs(str_specs, grouped_specs) + required_solves = match_to_original_specs(specs, grouped_specs) - actions = [get_actions_for_dists(dists_by_prefix, only_names, index, force, + actions = [get_actions_for_dists(specs_by_prefix, only_names, index, force, always_copy, prune, update_deps, pinned) - for dists_by_prefix in required_solves] + for specs_by_prefix in required_solves] # Need to add unlink actions if updating a private env from root if is_update and prefix == context.root_prefix: @@ -601,8 +600,8 @@ def get_r(preferred_env): return prefix_with_dists_no_deps_has_resolve -def match_to_original_specs(str_specs, specs_for_prefix): - matches_any_spec = lambda dst: next(spc for spc in str_specs if spc.startswith(dst)) +def match_to_original_specs(specs, specs_for_prefix): + matches_any_spec = lambda dst: next(spc for spc in specs if spc.name == dst) matched_specs_for_prefix = [] for prefix_with_dists in specs_for_prefix: linked = linked_data(prefix_with_dists.prefix) @@ -618,13 +617,12 @@ def match_to_original_specs(str_specs, specs_for_prefix): return matched_specs_for_prefix -def get_actions_for_dists(dists_for_prefix, only_names, index, force, always_copy, prune, +def get_actions_for_dists(specs_by_prefix, only_names, index, force, always_copy, prune, update_deps, pinned): root_only = ('conda', 'conda-env') - prefix = dists_for_prefix.prefix - dists = dists_for_prefix.specs - r = dists_for_prefix.r - specs = [MatchSpec(dist) for dist in dists] + prefix = specs_by_prefix.prefix + r = specs_by_prefix.r + specs = [MatchSpec(s) for s in specs_by_prefix.specs] specs = augment_specs(prefix, specs, pinned) linked = linked_data(prefix)
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -925,13 +925,16 @@ def test_install_mkdir(self): try: prefix = make_temp_prefix() assert isdir(prefix) - run_command(Commands.INSTALL, prefix, "python=3.5", "--mkdir") - assert_package_is_installed(prefix, "python-3.5") + run_command(Commands.INSTALL, prefix, "python=3.5.2", "--mkdir") + assert_package_is_installed(prefix, "python-3.5.2") rm_rf(prefix) assert not isdir(prefix) - run_command(Commands.INSTALL, prefix, "python=3.5", "--mkdir") - assert_package_is_installed(prefix, "python-3.5") + + # this part also a regression test for #4849 + run_command(Commands.INSTALL, prefix, "python-dateutil=2.6.0", "python=3.5.2", "--mkdir") + assert_package_is_installed(prefix, "python-3.5.2") + assert_package_is_installed(prefix, "python-dateutil-2.6.0") finally: rmtree(prefix, ignore_errors=True) diff --git a/tests/test_plan.py b/tests/test_plan.py --- a/tests/test_plan.py +++ b/tests/test_plan.py @@ -1062,13 +1062,14 @@ def test_match_to_original_specs(self): specs=IndexedSet(("test",))), plan.SpecsForPrefix(prefix="some/prefix", r=self.res, specs=IndexedSet(("test-spec", "test-spec2")))] - matched = plan.match_to_original_specs(str_specs, grouped_specs) + matched = plan.match_to_original_specs(tuple(MatchSpec(s) for s in str_specs), + grouped_specs) expected_output = [ plan.SpecsForPrefix(prefix="some/prefix/envs/_ranenv_", r=test_r, - specs=["test 1.2.0"]), + specs=[MatchSpec("test 1.2.0")]), plan.SpecsForPrefix(prefix="some/prefix", r=self.res, - specs=["test-spec 1.1*", "test-spec2 <4.3"])] + specs=[MatchSpec("test-spec 1.1*"), MatchSpec("test-spec2 <4.3")])] assert len(matched) == len(expected_output) assert matched == expected_output
Version constraint ignored depending on order of args to `conda create` (4.3.13) All of these command lines should resolve `python=2.7.12` I think but some choose `python=2.7.13`. To reproduce I have to use both a certain package (python-dateutil) along with python, and put the packages in a certain order (python-dateutil first breaks, python-dateutil second works). `six` instead of `python-dateutil` never seems to break. If I actually create the environment and it chooses 2.7.13, I am able to subsequently `conda install python=2.7.12=0`, so there doesn't seem to be a hard version constraint preventing that. ``` $ echo n | conda create --prefix=/tmp/blahblahboo "python-dateutil=2.6.0=py27_0" "python=2.7.12=0" | grep 'python:' Exiting python: 2.7.13-0 $ echo n | conda create --prefix=/tmp/blahblahboo "python=2.7.12=0" "python-dateutil=2.6.0=py27_0" | grep 'python:' Exiting python: 2.7.12-0 $ echo n | conda create --prefix=/tmp/blahblahboo "python=2.7.12=0" "six=1.10.0=py27_0" | grep 'python:' Exiting python: 2.7.12-0 $ echo n | conda create --prefix=/tmp/blahblahboo "six=1.10.0=py27_0" "python=2.7.12=0" | grep 'python:' Exiting python: 2.7.12-0 $ echo n | conda create --prefix=/tmp/blahblahboo "six=1.10.0=py27_0" "python-dateutil=2.6.0=py27_0" "python=2.7.12=0" | grep 'python:' Exiting python: 2.7.13-0 $ echo n | conda create --prefix=/tmp/blahblahboo "six=1.10.0=py27_0" "python=2.7.12=0" "python-dateutil=2.6.0=py27_0" | grep 'python:' Exiting python: 2.7.12-0 ``` conda info ``` $ conda info -a 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.0.2 python version : 2.7.12.final.0 requests version : 2.13.0 root environment : /home/hp/bin/anaconda2 (writable) default environment : /home/hp/bin/anaconda2/envs/kapsel envs directories : /home/hp/bin/anaconda2/envs /home/hp/.conda/envs package cache : /home/hp/bin/anaconda2/pkgs /home/hp/.conda/pkgs channel URLs : 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/t/<TOKEN>/binstar/linux-64 https://conda.anaconda.org/t/<TOKEN>/binstar/noarch config file : /home/hp/.condarc offline mode : False user-agent : conda/4.3.13 requests/2.13.0 CPython/2.7.12 Linux/4.9.12-100.fc24.x86_64 Fedora/24 glibc/2.23 UID:GID : 1000:1000 # conda environments: # anaconda-platform /home/hp/bin/anaconda2/envs/anaconda-platform kapsel * /home/hp/bin/anaconda2/envs/kapsel kapsel-canary /home/hp/bin/anaconda2/envs/kapsel-canary py2 /home/hp/bin/anaconda2/envs/py2 testing /home/hp/bin/anaconda2/envs/testing root /home/hp/bin/anaconda2 sys.version: 2.7.12 |Anaconda 4.2.0 (64-bit)| (defaul... sys.prefix: /home/hp/bin/anaconda2 sys.executable: /home/hp/bin/anaconda2/bin/python conda location: /home/hp/bin/anaconda2/lib/python2.7/site-packages/conda conda-build: /home/hp/bin/anaconda2/bin/conda-build conda-convert: /home/hp/bin/anaconda2/bin/conda-convert conda-develop: /home/hp/bin/anaconda2/bin/conda-develop conda-env: /home/hp/bin/anaconda2/bin/conda-env conda-index: /home/hp/bin/anaconda2/bin/conda-index conda-inspect: /home/hp/bin/anaconda2/bin/conda-inspect conda-kapsel: /home/hp/bin/anaconda2/envs/kapsel/bin/conda-kapsel conda-metapackage: /home/hp/bin/anaconda2/bin/conda-metapackage conda-render: /home/hp/bin/anaconda2/bin/conda-render conda-server: /home/hp/bin/anaconda2/envs/kapsel/bin/conda-server conda-sign: /home/hp/bin/anaconda2/bin/conda-sign conda-skeleton: /home/hp/bin/anaconda2/bin/conda-skeleton user site dirs: CIO_TEST: <not set> CONDA_DEFAULT_ENV: kapsel CONDA_ENVS_PATH: <not set> LD_LIBRARY_PATH: <not set> PATH: /home/hp/bin/anaconda2/envs/kapsel/bin:/home/hp/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin PYTHONHOME: <not set> PYTHONPATH: <not set> License directories: /home/hp/.continuum /home/hp/bin/anaconda2/licenses License files (license*.txt): /home/hp/.continuum/license_anaconda_repo_20161003210957.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160804160500.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160727174434.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160728092403.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160830123618.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160803091557.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160830104354.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo.txt Reading license file : 6 Signature valid : 6 Vendor match : 3 product : u'mkl-optimizations' packages : u'mkl' end_date : u'2017-05-24' type : u'Trial' product : u'iopro' packages : u'iopro' end_date : u'2017-05-24' type : u'Trial' product : u'accelerate' packages : u'numbapro mkl' end_date : u'2017-05-24' type : u'Trial' /home/hp/.continuum/license_anaconda_repo_20160823133054.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160927143648.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160803113033.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160728095857.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160728094900.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160830104619.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160728093131.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20161003210908.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160728094321.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 Package/feature end dates: An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues `$ /home/hp/bin/anaconda2/envs/kapsel/bin/conda info -a` Traceback (most recent call last): File "/home/hp/bin/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 591, in conda_exception_handler return_value = func(*args, **kwargs) File "/home/hp/bin/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 134, in _main exit_code = args.func(args, p) File "/home/hp/bin/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 324, in execute show_info() File "_license.pyx", line 363, in _license.show_info (_license.c:10610) File "_license.pyx", line 310, in _license.get_end_dates (_license.c:9015) File "_license.pyx", line 166, in _license.filter_vendor (_license.c:6214) KeyError: 'vendor' $ conda --version conda 4.3.13 ``` Version constraint ignored depending on order of args to `conda create` (4.3.13) All of these command lines should resolve `python=2.7.12` I think but some choose `python=2.7.13`. To reproduce I have to use both a certain package (python-dateutil) along with python, and put the packages in a certain order (python-dateutil first breaks, python-dateutil second works). `six` instead of `python-dateutil` never seems to break. If I actually create the environment and it chooses 2.7.13, I am able to subsequently `conda install python=2.7.12=0`, so there doesn't seem to be a hard version constraint preventing that. ``` $ echo n | conda create --prefix=/tmp/blahblahboo "python-dateutil=2.6.0=py27_0" "python=2.7.12=0" | grep 'python:' Exiting python: 2.7.13-0 $ echo n | conda create --prefix=/tmp/blahblahboo "python=2.7.12=0" "python-dateutil=2.6.0=py27_0" | grep 'python:' Exiting python: 2.7.12-0 $ echo n | conda create --prefix=/tmp/blahblahboo "python=2.7.12=0" "six=1.10.0=py27_0" | grep 'python:' Exiting python: 2.7.12-0 $ echo n | conda create --prefix=/tmp/blahblahboo "six=1.10.0=py27_0" "python=2.7.12=0" | grep 'python:' Exiting python: 2.7.12-0 $ echo n | conda create --prefix=/tmp/blahblahboo "six=1.10.0=py27_0" "python-dateutil=2.6.0=py27_0" "python=2.7.12=0" | grep 'python:' Exiting python: 2.7.13-0 $ echo n | conda create --prefix=/tmp/blahblahboo "six=1.10.0=py27_0" "python=2.7.12=0" "python-dateutil=2.6.0=py27_0" | grep 'python:' Exiting python: 2.7.12-0 ``` conda info ``` $ conda info -a 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.0.2 python version : 2.7.12.final.0 requests version : 2.13.0 root environment : /home/hp/bin/anaconda2 (writable) default environment : /home/hp/bin/anaconda2/envs/kapsel envs directories : /home/hp/bin/anaconda2/envs /home/hp/.conda/envs package cache : /home/hp/bin/anaconda2/pkgs /home/hp/.conda/pkgs channel URLs : 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/t/<TOKEN>/binstar/linux-64 https://conda.anaconda.org/t/<TOKEN>/binstar/noarch config file : /home/hp/.condarc offline mode : False user-agent : conda/4.3.13 requests/2.13.0 CPython/2.7.12 Linux/4.9.12-100.fc24.x86_64 Fedora/24 glibc/2.23 UID:GID : 1000:1000 # conda environments: # anaconda-platform /home/hp/bin/anaconda2/envs/anaconda-platform kapsel * /home/hp/bin/anaconda2/envs/kapsel kapsel-canary /home/hp/bin/anaconda2/envs/kapsel-canary py2 /home/hp/bin/anaconda2/envs/py2 testing /home/hp/bin/anaconda2/envs/testing root /home/hp/bin/anaconda2 sys.version: 2.7.12 |Anaconda 4.2.0 (64-bit)| (defaul... sys.prefix: /home/hp/bin/anaconda2 sys.executable: /home/hp/bin/anaconda2/bin/python conda location: /home/hp/bin/anaconda2/lib/python2.7/site-packages/conda conda-build: /home/hp/bin/anaconda2/bin/conda-build conda-convert: /home/hp/bin/anaconda2/bin/conda-convert conda-develop: /home/hp/bin/anaconda2/bin/conda-develop conda-env: /home/hp/bin/anaconda2/bin/conda-env conda-index: /home/hp/bin/anaconda2/bin/conda-index conda-inspect: /home/hp/bin/anaconda2/bin/conda-inspect conda-kapsel: /home/hp/bin/anaconda2/envs/kapsel/bin/conda-kapsel conda-metapackage: /home/hp/bin/anaconda2/bin/conda-metapackage conda-render: /home/hp/bin/anaconda2/bin/conda-render conda-server: /home/hp/bin/anaconda2/envs/kapsel/bin/conda-server conda-sign: /home/hp/bin/anaconda2/bin/conda-sign conda-skeleton: /home/hp/bin/anaconda2/bin/conda-skeleton user site dirs: CIO_TEST: <not set> CONDA_DEFAULT_ENV: kapsel CONDA_ENVS_PATH: <not set> LD_LIBRARY_PATH: <not set> PATH: /home/hp/bin/anaconda2/envs/kapsel/bin:/home/hp/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin PYTHONHOME: <not set> PYTHONPATH: <not set> License directories: /home/hp/.continuum /home/hp/bin/anaconda2/licenses License files (license*.txt): /home/hp/.continuum/license_anaconda_repo_20161003210957.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160804160500.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160727174434.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160728092403.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160830123618.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160803091557.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160830104354.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo.txt Reading license file : 6 Signature valid : 6 Vendor match : 3 product : u'mkl-optimizations' packages : u'mkl' end_date : u'2017-05-24' type : u'Trial' product : u'iopro' packages : u'iopro' end_date : u'2017-05-24' type : u'Trial' product : u'accelerate' packages : u'numbapro mkl' end_date : u'2017-05-24' type : u'Trial' /home/hp/.continuum/license_anaconda_repo_20160823133054.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160927143648.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160803113033.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160728095857.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160728094900.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160830104619.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160728093131.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20161003210908.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 /home/hp/.continuum/license_anaconda_repo_20160728094321.txt Reading license file : 1 Error: no signature in license: {u'license': u'test'} Signature valid : 0 Vendor match : 0 Package/feature end dates: An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues `$ /home/hp/bin/anaconda2/envs/kapsel/bin/conda info -a` Traceback (most recent call last): File "/home/hp/bin/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 591, in conda_exception_handler return_value = func(*args, **kwargs) File "/home/hp/bin/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 134, in _main exit_code = args.func(args, p) File "/home/hp/bin/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 324, in execute show_info() File "_license.pyx", line 363, in _license.show_info (_license.c:10610) File "_license.pyx", line 310, in _license.get_end_dates (_license.c:9015) File "_license.pyx", line 166, in _license.filter_vendor (_license.c:6214) KeyError: 'vendor' $ conda --version conda 4.3.13 ```
2017-04-21T20:12:25
conda/conda
5,107
conda__conda-5107
[ "5102", "5102" ]
1985160dac27c4c05d079015e65a8b63141b87aa
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -107,7 +107,7 @@ class Context(Configuration): element_type=string_types + (NoneType,)) client_ssl_cert_key = PrimitiveParameter(None, aliases=('client_cert_key',), element_type=string_types + (NoneType,)) - proxy_servers = MapParameter(string_types) + proxy_servers = MapParameter(string_types + (NoneType,)) remote_connect_timeout_secs = PrimitiveParameter(9.15) remote_read_timeout_secs = PrimitiveParameter(60.) remote_max_retries = PrimitiveParameter(3)
diff --git a/tests/base/test_context.py b/tests/base/test_context.py --- a/tests/base/test_context.py +++ b/tests/base/test_context.py @@ -45,6 +45,13 @@ def setUp(self): channel_alias: ftp://new.url:8082 conda-build: root-dir: /some/test/path + proxy_servers: + http: http://user:[email protected]:8080 + https: none + ftp: + sftp: '' + ftps: false + rsync: 'false' """) reset_context() rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string))) @@ -157,6 +164,14 @@ def test_custom_multichannels(self): Channel('learn_from_every_thing'), ) + def test_proxy_servers(self): + assert context.proxy_servers['http'] == 'http://user:[email protected]:8080' + assert context.proxy_servers['https'] is None + assert context.proxy_servers['ftp'] is None + assert context.proxy_servers['sftp'] == '' + assert context.proxy_servers['ftps'] == 'False' + assert context.proxy_servers['rsync'] == 'False' + def test_conda_build_root_dir(self): assert context.conda_build['root-dir'] == "/some/test/path" from conda.config import rc
Bad interpreation of null in proxy_servers section in .condarc since ver. 4.2.13 Upon upgrade to conda to version 4.2.13 the following settings in .condarc, which were meant to unset any http_proxy or https_proxy variables no longer work; result in HTTP error. ``` proxy_servers: # Unset proxies so we can define internal channels shouldn't go outside anyway http: https: ``` Error received upon conda install: ``` An HTTP error occurred when trying to retrieve this URL. ConnectionError(MaxRetryError("HTTPConnectionPool(host=u'None', port=80): Max retries exceeded with url: http://sfp-inf.jpmchase.net:9000/conda/mrad/channel/dev/linux-64/repodata.json (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f197d701610>: Failed to establish a new connection: [Errno -2] Name or service not known',)))",),) ``` The reason is wrongly reinterpreting null values as 'None' string and subsequently trying to connect to hostname 'None'. For those of you need a workaround now, change your .condarc as follows: ``` proxy_servers: # Unset proxies so we can define internal channels shouldn't go outside anyway http: "" https: "" ``` Bad interpreation of null in proxy_servers section in .condarc since ver. 4.2.13 Upon upgrade to conda to version 4.2.13 the following settings in .condarc, which were meant to unset any http_proxy or https_proxy variables no longer work; result in HTTP error. ``` proxy_servers: # Unset proxies so we can define internal channels shouldn't go outside anyway http: https: ``` Error received upon conda install: ``` An HTTP error occurred when trying to retrieve this URL. ConnectionError(MaxRetryError("HTTPConnectionPool(host=u'None', port=80): Max retries exceeded with url: http://sfp-inf.jpmchase.net:9000/conda/mrad/channel/dev/linux-64/repodata.json (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f197d701610>: Failed to establish a new connection: [Errno -2] Name or service not known',)))",),) ``` The reason is wrongly reinterpreting null values as 'None' string and subsequently trying to connect to hostname 'None'. For those of you need a workaround now, change your .condarc as follows: ``` proxy_servers: # Unset proxies so we can define internal channels shouldn't go outside anyway http: "" https: "" ```
Sounds similar to what @nehaljwani fixed in https://github.com/conda/conda/pull/5096 Sounds similar to what @nehaljwani fixed in https://github.com/conda/conda/pull/5096
2017-04-22T03:42:45
conda/conda
5,112
conda__conda-5112
[ "5111", "5111" ]
c6f06c91f984b6b0dea4839b93f613aa821d9488
diff --git a/conda/_vendor/auxlib/type_coercion.py b/conda/_vendor/auxlib/type_coercion.py --- a/conda/_vendor/auxlib/type_coercion.py +++ b/conda/_vendor/auxlib/type_coercion.py @@ -231,8 +231,8 @@ def typify(value, type_hint=None): elif not (type_hint - (STRING_TYPES_SET | {bool})): return boolify(value, return_string=True) elif not (type_hint - (STRING_TYPES_SET | {NoneType})): - value = typify_str_no_hint(text_type(value)) - return None if value is None else text_type(value) + value = text_type(value) + return None if value.lower() == 'none' else value elif not (type_hint - {bool, int}): return typify_str_no_hint(text_type(value)) else:
diff --git a/tests/base/test_context.py b/tests/base/test_context.py --- a/tests/base/test_context.py +++ b/tests/base/test_context.py @@ -170,7 +170,7 @@ def test_proxy_servers(self): assert context.proxy_servers['ftp'] is None assert context.proxy_servers['sftp'] == '' assert context.proxy_servers['ftps'] == 'False' - assert context.proxy_servers['rsync'] == 'False' + assert context.proxy_servers['rsync'] == 'false' def test_conda_build_root_dir(self): assert context.conda_build['root-dir'] == "/some/test/path"
typify for str + NoneType is wrong https://github.com/conda/conda/pull/5107#issuecomment-296356913 It still seems to me as if `typify()` is doing something wrong: ```python >>> from conda._vendor.auxlib.configuration import typify >>> typify('false', str) 'false' >>> typify('false', (str, type(None))) 'False' ``` Why should addition of type `None` introduce such a change? The code flow is: ```python elif not (type_hint - (STRING_TYPES_SET | {NoneType})): value = typify_str_no_hint(text_type(value)) return None if value is None else text_type(value) ``` I wonder why not just return `text_type(value)`? Why call `typify_str_no_hint`? typify for str + NoneType is wrong https://github.com/conda/conda/pull/5107#issuecomment-296356913 It still seems to me as if `typify()` is doing something wrong: ```python >>> from conda._vendor.auxlib.configuration import typify >>> typify('false', str) 'false' >>> typify('false', (str, type(None))) 'False' ``` Why should addition of type `None` introduce such a change? The code flow is: ```python elif not (type_hint - (STRING_TYPES_SET | {NoneType})): value = typify_str_no_hint(text_type(value)) return None if value is None else text_type(value) ``` I wonder why not just return `text_type(value)`? Why call `typify_str_no_hint`?
2017-04-22T09:13:49
conda/conda
5,122
conda__conda-5122
[ "4671" ]
e060ffcacba7481bfd8ce2b0a865669977178d2b
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -172,7 +172,6 @@ def source_full_path(self): class LinkPathAction(CreateInPrefixPathAction): - _verify_max_backoff_reached = False @classmethod def create_file_link_actions(cls, transaction_context, package_info, target_prefix, @@ -269,7 +268,8 @@ def verify(self): # with max_retries = 2, max total time ~= 0.4 sec # with max_retries = 6, max total time ~= 6.5 sec - max_retries = 2 if LinkPathAction._verify_max_backoff_reached else 6 + count = self.transaction_context.get('_verify_backoff_count', 0) + max_retries = 2 if count < 2 else 6 for n in range(max_retries): sleep_time = ((2 ** n) + random()) * 0.1 log.trace("retrying lexists(%s) in %g sec", self.source_full_path, sleep_time) @@ -278,7 +278,7 @@ def verify(self): break else: # only run the 6.5 second backoff time once - LinkPathAction._verify_max_backoff_reached = True + self.transaction_context['_verify_backoff_count'] = count + 1 return CondaVerificationError(dals(""" The package for %s located at %s appears to be corrupted. The path '%s'
Conflict with package, which just has been built @marscher commented on [Fri Feb 17 2017](https://github.com/conda/conda-build/issues/1748) The build phase succeeded, but when the test phase tries to create the environment a conflict is raised containing only the actual package, which just has been built. I've checked manually, that all dependencies are available for Python 3.6 and the desired Numpy version (1.11), so it is pretty unclear to me, why this is happening. * conda-build is 2.1.4. * The recipe can be found here: https://github.com/omnia-md/conda-recipes/tree/master/pyemma * conda build log attached (debug level): [build_debug_log.txt](https://github.com/conda/conda-build/files/783354/build_debug_log.txt) cc omnia-md/conda-recipes/issues/702 --- @msarahan commented on [Fri Feb 17 2017](https://github.com/conda/conda-build/issues/1748#issuecomment-280668089) Are all dependencies actually installable for py 36? If I try to create an environment with this command (just taken from your meta.yaml), it shows that bhmm is not available: ``` [dev@e9f4c54fd4ff downloads]$ conda create -n pyemma -c omnia bhmm=0.6.1 decorator=4 funcsigs joblib=0.9.4 matplotlib mdtraj=1.8 mock msmtools=1.2 numpy=1.11 progress_reporter=1.3.1 psutil=3.1.1 python=3.6 pyyaml scipy setuptools six thermotools=0.2.3 Fetching package metadata ......... Solving package specifications: .... UnsatisfiableError: The following specifications were found to be in conflict: - bhmm 0.6* - python 3.6* Use "conda info <package>" to see the dependencies for each package. ``` Conda search shows that it is, though: ``` [dev@e9f4c54fd4ff downloads]$ conda search -c omnia bhmm Fetching package metadata ......... bhmm 0.2.0 py27_0 omnia 0.3.0 np18py27_0 omnia 0.3.0 np19py27_0 omnia 0.4.2 np18py27_0 omnia 0.4.2 np19py27_0 omnia 0.5.0 np18py27_0 omnia 0.5.0 np19py27_0 omnia 0.5.1 np110py27_0 omnia 0.5.1 np110py34_0 omnia 0.5.1 np110py35_0 omnia 0.5.1 np18py27_0 omnia 0.5.1 np18py33_0 omnia 0.5.1 np18py34_0 omnia 0.5.1 np19py27_0 omnia 0.5.1 np19py33_0 omnia 0.5.1 np19py34_0 omnia 0.5.2 np110py27_0 omnia 0.5.2 np110py34_0 omnia 0.5.2 np110py35_0 omnia 0.5.2 np19py27_0 omnia 0.5.2 np19py34_0 omnia 0.5.2 np19py35_0 omnia 0.6.1 np110py27_0 omnia 0.6.1 np110py34_0 omnia 0.6.1 np110py35_0 omnia 0.6.1 np111py27_0 omnia 0.6.1 np111py34_0 omnia 0.6.1 np111py35_0 omnia 0.6.1 np111py36_0 omnia 0.6.1 np19py27_0 omnia 0.6.1 np19py34_0 omnia 0.6.1 np19py35_0 omnia ``` This means that one of bhmm's dependencies (or even further up the chain) is not installable for python 3.6. However, creating an env with just bhmm works: ``` [dev@e9f4c54fd4ff downloads]$ conda create -n bhmm bhmm=0.6.1 numpy=1.11 python=3.6 -c omnia Fetching package metadata ......... Solving package specifications: .......... Package plan for installation in environment /opt/miniconda/envs/bhmm: The following packages will be downloaded: package | build ---------------------------|----------------- python-3.6.0 | 0 16.3 MB cython-0.25.2 | py36_0 6.5 MB decorator-4.0.11 | py36_0 15 KB numpy-1.11.3 | py36_0 6.7 MB setuptools-27.2.0 | py36_0 523 KB six-1.10.0 | py36_0 19 KB wheel-0.29.0 | py36_0 88 KB pip-9.0.1 | py36_1 1.7 MB scipy-0.18.1 | np111py36_1 31.2 MB msmtools-1.2 | np111py36_0 1.2 MB omnia bhmm-0.6.1 | np111py36_0 481 KB omnia ------------------------------------------------------------ Total: 64.7 MB The following NEW packages will be INSTALLED: bhmm: 0.6.1-np111py36_0 omnia cython: 0.25.2-py36_0 decorator: 4.0.11-py36_0 libgfortran: 3.0.0-1 mkl: 2017.0.1-0 msmtools: 1.2-np111py36_0 omnia numpy: 1.11.3-py36_0 openssl: 1.0.2k-0 pip: 9.0.1-py36_1 python: 3.6.0-0 readline: 6.2-2 scipy: 0.18.1-np111py36_1 setuptools: 27.2.0-py36_0 six: 1.10.0-py36_0 sqlite: 3.13.0-0 tk: 8.5.18-0 wheel: 0.29.0-py36_0 xz: 5.2.2-1 zlib: 1.2.8-3 Proceed ([y]/n)? n ``` This is some deeper conflict between dependencies, and conda's hints are just not helping much here. I'm moving this issue to the conda repo to see if they can help you figure out a way to debug this. Note: I have used conda 4.3.11 for this. It has better hints than earlier versions, but apparently still confusing sometimes.
cc @mcg1969 - any tips on getting better hints here? I'm afraid we just need to keep working on improving the conflict hints. I'm not sure I have any short-term advice. It's really an extended R&D struggle. I know that there has been some effort before to create better hints: https://github.com/rmcgibbo/conda-hint But as far as I remember it requires at least Python 3.5 to run. I see that funcsigs is the conflicting package. Note that "py36" is not yet a valid selector. Is there any sane way to select this package only for python version smaller than 3.6 with the selector feature? ```[py<36]``` should work? On 02/17/2017 04:20 PM, Mike Sarahan wrote: > |[py>35]| should work? yes, thanks you! Just a question, why does conda-build not use the logic of conda(-env) to create the test env in the first place in order to get the same behaviour (hint generation)? Speed and spec format. Conda build allows specs according to https://conda.io/docs/spec.html#package-match-specifications The command line interface and the newer conda API, which is just a tiny bit lower level than the CLI, do not support those match specs. Part of the reason is that characters like > and < get misinterpreted by the terminal. Even if you put them on quotes, though, the CLI still doesn't support them. Speed is also drastically slower, because conda build is able to control caching more intelligently. I'm surprised that the hints are different, but it probably comes down to the input specs being different. I had to alter them in order to make them valid CLI input. Ultimately conda's solver is being called similarly in both conda build and conda. We're working on a conda API that will unify behavior while maintaining the speed advantages.
2017-04-23T01:05:09
conda/conda
5,124
conda__conda-5124
[ "5123", "5123" ]
e50cdeeb33ff93a946e3be6d4a7a60d6939c891a
diff --git a/conda/exports.py b/conda/exports.py --- a/conda/exports.py +++ b/conda/exports.py @@ -30,6 +30,9 @@ from .gateways.connection import CondaSession # NOQA CondaSession = CondaSession +from .common.toposort import _toposort +_toposort = _toposort + from .gateways.disk.link import lchmod # NOQA lchmod = lchmod
export toposort for conda-build export toposort for conda-build
2017-04-23T03:23:17
conda/conda
5,133
conda__conda-5133
[ "5132", "5132" ]
1f519f31581aa570f911805c1d8121d6b3857fe2
diff --git a/conda/common/signals.py b/conda/common/signals.py --- a/conda/common/signals.py +++ b/conda/common/signals.py @@ -4,6 +4,7 @@ from contextlib import contextmanager from logging import getLogger import signal +import threading from .compat import iteritems @@ -17,7 +18,6 @@ 'SIGBREAK', ) - def get_signal_name(signum): """ Examples: @@ -33,18 +33,23 @@ def get_signal_name(signum): @contextmanager def signal_handler(handler): - previous_handlers = [] + _thread_local = threading.local() + _thread_local.previous_handlers = [] for signame in INTERRUPT_SIGNALS: sig = getattr(signal, signame, None) if sig: log.debug("registering handler for %s", signame) - prev_handler = signal.signal(sig, handler) - previous_handlers.append((sig, prev_handler)) + try: + prev_handler = signal.signal(sig, handler) + _thread_local.previous_handlers.append((sig, prev_handler)) + except ValueError as e: + # ValueError: signal only works in main thread + log.debug('%r', e) try: yield finally: standard_handlers = signal.SIG_IGN, signal.SIG_DFL - for sig, previous_handler in previous_handlers: + for sig, previous_handler in _thread_local.previous_handlers: if callable(previous_handler) or previous_handler in standard_handlers: log.debug("de-registering handler for %s", sig) signal.signal(sig, previous_handler) diff --git a/conda/exports.py b/conda/exports.py --- a/conda/exports.py +++ b/conda/exports.py @@ -30,7 +30,7 @@ from .gateways.connection import CondaSession # NOQA CondaSession = CondaSession -from .common.toposort import _toposort +from .common.toposort import _toposort # NOQA _toposort = _toposort from .gateways.disk.link import lchmod # NOQA
signal handler can only be used in main thread Often get these with conda-build tests https://travis-ci.org/conda/conda/jobs/225296134#L1380 ``` Traceback (most recent call last): File "/home/travis/build/conda/conda/conda-build/conda_build/build.py", line 688, in create_env execute_actions(actions, index, verbose=config.debug) File "/home/travis/build/conda/conda/conda/plan.py", line 612, in execute_actions execute_instructions(plan, index, verbose) File "/home/travis/build/conda/conda/conda/instructions.py", line 243, in execute_instructions cmd(state, arg) File "/home/travis/build/conda/conda/conda/instructions.py", line 98, in PROGRESSIVEFETCHEXTRACT_CMD progressive_fetch_extract.execute() File "/home/travis/build/conda/conda/conda/core/package_cache.py", line 491, in execute with signal_handler(conda_signal_handler): File "/home/travis/miniconda/lib/python3.6/contextlib.py", line 82, in __enter__ return next(self.gen) File "/home/travis/build/conda/conda/conda/common/signals.py", line 41, in signal_handler prev_handler = signal.signal(sig, handler) File "/home/travis/miniconda/lib/python3.6/signal.py", line 47, in signal handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler)) ValueError: signal only works in main thread ``` signal handler can only be used in main thread Often get these with conda-build tests https://travis-ci.org/conda/conda/jobs/225296134#L1380 ``` Traceback (most recent call last): File "/home/travis/build/conda/conda/conda-build/conda_build/build.py", line 688, in create_env execute_actions(actions, index, verbose=config.debug) File "/home/travis/build/conda/conda/conda/plan.py", line 612, in execute_actions execute_instructions(plan, index, verbose) File "/home/travis/build/conda/conda/conda/instructions.py", line 243, in execute_instructions cmd(state, arg) File "/home/travis/build/conda/conda/conda/instructions.py", line 98, in PROGRESSIVEFETCHEXTRACT_CMD progressive_fetch_extract.execute() File "/home/travis/build/conda/conda/conda/core/package_cache.py", line 491, in execute with signal_handler(conda_signal_handler): File "/home/travis/miniconda/lib/python3.6/contextlib.py", line 82, in __enter__ return next(self.gen) File "/home/travis/build/conda/conda/conda/common/signals.py", line 41, in signal_handler prev_handler = signal.signal(sig, handler) File "/home/travis/miniconda/lib/python3.6/signal.py", line 47, in signal handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler)) ValueError: signal only works in main thread ```
2017-04-24T18:56:37
conda/conda
5,148
conda__conda-5148
[ "5078" ]
26321390415b8d87aa2f2a356a9b717bbef04276
diff --git a/conda/core/package_cache.py b/conda/core/package_cache.py --- a/conda/core/package_cache.py +++ b/conda/core/package_cache.py @@ -410,6 +410,7 @@ def make_actions_for_dist(dist, record): source_full_path=pc_entry_writable_cache.package_tarball_full_path, target_pkgs_dir=pc_entry_writable_cache.pkgs_dir, target_extracted_dirname=pc_entry_writable_cache.dist.dist_name, + record=record, ) return None, extract_axn @@ -431,6 +432,7 @@ def make_actions_for_dist(dist, record): source_full_path=cache_axn.target_full_path, target_pkgs_dir=first_writable_cache.pkgs_dir, target_extracted_dirname=dist.dist_name, + record=record, ) return cache_axn, extract_axn @@ -446,6 +448,7 @@ def make_actions_for_dist(dist, record): source_full_path=cache_axn.target_full_path, target_pkgs_dir=first_writable_cache.pkgs_dir, target_extracted_dirname=dist.dist_name, + record=record, ) return cache_axn, extract_axn diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -26,7 +26,7 @@ from ..gateways.disk.create import (compile_pyc, copy, create_application_entry_point, create_fake_executable_softlink, create_hard_link_or_copy, create_link, create_python_entry_point, extract_tarball, - make_menu, write_linked_package_record) + make_menu, write_linked_package_record, write_as_json_to_file) from ..gateways.disk.delete import rm_rf, try_rmdir_all_empty from ..gateways.disk.link import symlink from ..gateways.disk.read import compute_md5sum, isfile, islink, lexists @@ -1092,11 +1092,13 @@ def __str__(self): class ExtractPackageAction(PathAction): - def __init__(self, source_full_path, target_pkgs_dir, target_extracted_dirname): + def __init__(self, source_full_path, target_pkgs_dir, target_extracted_dirname, + record): self.source_full_path = source_full_path self.target_pkgs_dir = target_pkgs_dir self.target_extracted_dirname = target_extracted_dirname self.hold_path = self.target_full_path + '.c~' + self.record = record def verify(self): self._verified = True @@ -1123,6 +1125,8 @@ def execute(self): else: raise extract_tarball(self.source_full_path, self.target_full_path) + meta = join(self.target_full_path, 'info', 'repodata_record.json') + write_as_json_to_file(meta, self.record) target_package_cache = PackageCache(self.target_pkgs_dir)
Add repodata information to extracted package directory Immediately following the extraction of a package tarball, add the repodata information for the package to the `info` directory within the extracted package directory. Put this information in a new file `info/external.json`. Or maybe `info/post_extract.json`. Or come up with a better name. The information included should be all the information for the package under the `packages` key in repodata. For example $ curl -sS https://repo.continuum.io/pkgs/free/linux-64/repodata.json | jq .packages | jq '.["cryptography-1.5.3-py27_0.tar.bz2"]' { "build": "py27_0", "build_number": 0, "date": "2016-11-07", "depends": [ "cffi >=1.4.1", "enum34", "idna >=2.0", "ipaddress", "openssl 1.0.2*", "pyasn1 >=0.1.8", "python 2.7*", "setuptools", "six >=1.4.1" ], "license": "Apache", "md5": "af03c1cde0584396f9422324701f6136", "name": "cryptography", "size": 829309, "version": "1.5.3" } It should also include * `fn` (which is the filename of the tarball) * `url` (the exact, original url from where the tarball was downloaded) * `arch` (which comes from the root-level `info` key in repodata) * `platform` (which comes from the root-level `info` key in repodata) * `priority` (the channel priority number at the time the package was downloaded) * `channel` (which is right now equivalent to `Channel(full_url).base_url` * `schannel` (equivalent to `Channel(full_url).canonical_name`) I've probably missed some information, so feel free to add to the list. The correct way to do this is probably to create a new PathAction in `conda/core/path_actions.py`, and then incorporate that action into the `ProgressiveFetchExtract.make_actions_for_dist` method in `conda/core/package_cache.py`.
Out of curiosity, is this required for making `conda info $package` faster? I don't think it'll affect `conda info package`. That requires downloading repodata, and the round trip http time there, even for 304 responses, is noticeable and what slows things down. At some point we need to make those repodata fetch calls async. The reason for this ticket is because the ONLY time we know this information 100% for sure is when we download and extract the tarball. It'll come in handy in a lot of places where we sort of end up guessing at information. It'll also come in very handy for `--offline` stuff. The logic in the source code suggests that downloading the tarball and extracting it are distinct actions. Furthermore, it may be possible for a tarball to already be downloaded (to the package cache) without being extracted. In that case, how can I obtain all the required information ("the exact, original url from where the tarball was downloaded") ? It seems the information would need to be stored in the same transaction that does the downloading, no ? Yes, they are separate actions. At some point, we actually need to combine the actions at an individual package level (not for the full fetch/extract operation), and then make individual transactions out of them. We also can then parallelize them. I think the best approach here for this immediate PR is to change the return value of `make_actions_for_dist` from a two-value tuple to a three-value tuple, where the third value is a new PathAction. And then, I think the only place where the new action is actually used is in that last return value, where we're actually downloading packages ``` # if we got here, we couldn't find a matching package in the caches # we'll have to download one; fetch and extract cache_axn = CacheUrlAction( url=record.get('url') or dist.to_url(), target_pkgs_dir=first_writable_cache.pkgs_dir, target_package_basename=dist.to_filename(), md5sum=md5, ) extract_axn = ExtractPackageAction( source_full_path=cache_axn.target_full_path, target_pkgs_dir=first_writable_cache.pkgs_dir, target_extracted_dirname=dist.dist_name, ) return cache_axn, extract_axn, new_axn ``` For the rest of the return values, that third position is just `None`. Right, you are describing almost precisely what I have done already :-) I'm right now merely wondering where to get the content from to fill the new json file. You indicated earlier that there was information that was available only during the download, which triggered my follow-up question, since at the point where the new action is placed in the pipeline that information may already be lost (unless we change the download action itself). Ah. All of the information we have right now available is in `record` from the function siganture. def make_actions_for_dist(dist, record): I think that's an `IndexRecord` object right now. It should have all of those fields listed above.
2017-04-25T21:57:38
conda/conda
5,157
conda__conda-5157
[ "5160" ]
ca57ef2a1ac70355d1aeb58ddc2da78f655c4fbc
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -6,6 +6,7 @@ from os.path import abspath, basename, dirname, expanduser, expandvars, isdir, join import re import sys +from tempfile import NamedTemporaryFile try: from cytoolz.itertoolz import concatv @@ -38,11 +39,13 @@ class Activator(object): def __init__(self, shell): from .base.context import context self.context = context + self.shell = shell if shell == 'posix': self.pathsep_join = ':'.join self.path_conversion = native_path_to_unix self.script_extension = '.sh' + self.finalizer_extension = None # don't write to file self.unset_var_tmpl = 'unset %s' self.set_var_tmpl = 'export %s="%s"' @@ -52,15 +55,17 @@ def __init__(self, shell): self.pathsep_join = ':'.join self.path_conversion = native_path_to_unix self.script_extension = '.csh' + self.finalizer_extension = None # don't write to file self.unset_var_tmpl = 'unset %s' self.set_var_tmpl = 'setenv %s "%s"' self.run_script_tmpl = 'source "%s"' elif shell == 'xonsh': - self.pathsep_join = lambda x: "['%s']" % "', '".join(x) - self.path_conversion = lambda x: x # not sure if you want unix paths on windows or not + self.pathsep_join = ':'.join + self.path_conversion = native_path_to_unix self.script_extension = '.xsh' + self.finalizer_extension = '.xsh' self.unset_var_tmpl = 'del $%s' self.set_var_tmpl = '$%s = "%s"' @@ -69,20 +74,34 @@ def __init__(self, shell): else: raise NotImplementedError() + def _finalize(self, commands, ext): + if ext is None: + return '\n'.join(commands) + elif ext: + with NamedTemporaryFile(suffix=ext, delete=False) as tf: + tf.write(ensure_binary('\n'.join(commands))) + tf.write(ensure_binary('\n')) + return tf.name + else: + raise NotImplementedError() + def activate(self, name_or_prefix): - return '\n'.join(self._make_commands(self.build_activate(name_or_prefix))) + return self._finalize(self._yield_commands(self.build_activate(name_or_prefix)), + self.finalizer_extension) def deactivate(self): - return '\n'.join(self._make_commands(self.build_deactivate())) + return self._finalize(self._yield_commands(self.build_deactivate()), + self.finalizer_extension) def reactivate(self): - return '\n'.join(self._make_commands(self.build_reactivate())) + return self._finalize(self._yield_commands(self.build_reactivate()), + self.finalizer_extension) - def _make_commands(self, cmds_dict): - for key in cmds_dict.get('unset_vars', ()): + def _yield_commands(self, cmds_dict): + for key in sorted(cmds_dict.get('unset_vars', ())): yield self.unset_var_tmpl % key - for key, value in iteritems(cmds_dict.get('set_vars', {})): + for key, value in sorted(iteritems(cmds_dict.get('set_vars', {}))): yield self.set_var_tmpl % (key, value) for script in cmds_dict.get('deactivate_scripts', ()): @@ -231,7 +250,7 @@ def _get_starting_path_list(self): return path.split(os.pathsep) def _get_path_dirs(self, prefix): - if on_win: + if on_win: # pragma: unix no cover yield prefix.rstrip("\\") yield join(prefix, 'Library', 'mingw-w64', 'bin') yield join(prefix, 'Library', 'usr', 'bin') @@ -256,7 +275,7 @@ def _replace_prefix_in_path(self, old_prefix, new_prefix, starting_path_dirs=Non path_list = self._get_starting_path_list() else: path_list = list(starting_path_dirs) - if on_win: + 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: @@ -302,17 +321,24 @@ def expand(path): return abspath(expanduser(expandvars(path))) -def native_path_to_unix(*paths): +def ensure_binary(value): + try: + return value.encode('utf-8') + except AttributeError: # pragma: no cover + # AttributeError: '<>' object has no attribute 'encode' + # In this case assume already binary type and do nothing + return value + + +def native_path_to_unix(*paths): # pragma: unix no cover # on windows, uses cygpath to convert windows native paths to posix paths if not on_win: return paths[0] if len(paths) == 1 else paths from subprocess import PIPE, Popen from shlex import split - command = 'cygpath.exe --path -f -' + command = 'cygpath --path -f -' p = Popen(split(command), stdin=PIPE, stdout=PIPE, stderr=PIPE) - joined = ("%s" % os.pathsep).join(paths) - if hasattr(joined, 'encode'): - joined = joined.encode('utf-8') + joined = ensure_binary(("%s" % os.pathsep).join(paths)) stdout, stderr = p.communicate(input=joined) rc = p.returncode if rc != 0 or stderr: @@ -366,4 +392,4 @@ def main(): if __name__ == '__main__': - main() + sys.exit(main()) diff --git a/conda/cli/main.py b/conda/cli/main.py --- a/conda/cli/main.py +++ b/conda/cli/main.py @@ -161,4 +161,4 @@ def main(*args): if __name__ == '__main__': - main() + sys.exit(main())
diff --git a/tests/test_activate.py b/tests/test_activate.py --- a/tests/test_activate.py +++ b/tests/test_activate.py @@ -3,10 +3,13 @@ from logging import getLogger import os -from os.path import join +from os.path import join, isdir import sys +from tempfile import gettempdir from unittest import TestCase +from uuid import uuid4 +from conda._vendor.auxlib.ish import dals import pytest from conda.activate import Activator @@ -15,6 +18,7 @@ from conda.common.io import env_var from conda.exceptions import EnvironmentLocationNotFound, EnvironmentNameNotFound from conda.gateways.disk.create import mkdir_p +from conda.gateways.disk.delete import rm_rf from conda.gateways.disk.update import touch from tests.helpers import tempdir @@ -320,6 +324,93 @@ def test_build_deactivate_shlvl_1(self): assert builder['deactivate_scripts'] == [deactivate_d_1] +class ShellWrapperUnitTests(TestCase): + + def setUp(self): + tempdirdir = gettempdir() + + prefix_dirname = str(uuid4())[:4] + ' ' + str(uuid4())[:4] + self.prefix = join(tempdirdir, prefix_dirname) + mkdir_p(join(self.prefix, 'conda-meta')) + assert isdir(self.prefix) + touch(join(self.prefix, 'conda-meta', 'history')) + + def tearDown(self): + rm_rf(self.prefix) + + def make_dot_d_files(self, extension): + mkdir_p(join(self.prefix, 'etc', 'conda', 'activate.d')) + mkdir_p(join(self.prefix, 'etc', 'conda', 'deactivate.d')) + + touch(join(self.prefix, 'etc', 'conda', 'activate.d', 'ignore.txt')) + touch(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'ignore.txt')) + + touch(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1' + extension)) + touch(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1' + extension)) + + @pytest.mark.xfail(on_win, strict=True, reason="native_path_to_unix is broken on appveyor; " + "will fix in future PR") + def test_xonsh_basic(self): + activator = Activator('xonsh') + self.make_dot_d_files(activator.script_extension) + + activate_result = activator.activate(self.prefix) + with open(activate_result) as fh: + activate_data = fh.read() + rm_rf(activate_result) + + new_path = activator.pathsep_join(activator._add_prefix_to_path(self.prefix)) + assert activate_data == dals(""" + $CONDA_DEFAULT_ENV = "%(prefix)s" + $CONDA_PREFIX = "%(prefix)s" + $CONDA_PROMPT_MODIFIER = "(%(prefix)s) " + $CONDA_PYTHON_EXE = "%(sys_executable)s" + $CONDA_SHLVL = "1" + $PATH = "%(new_path)s" + source "%(activate1)s" + """) % { + 'prefix': self.prefix, + 'new_path': new_path, + 'sys_executable': sys.executable, + 'activate1': join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.xsh') + } + + with env_var('CONDA_PREFIX', self.prefix): + with env_var('CONDA_SHLVL', '1'): + with env_var('PATH', new_path): + reactivate_result = activator.reactivate() + with open(reactivate_result) as fh: + reactivate_data = fh.read() + rm_rf(reactivate_result) + + assert reactivate_data == dals(""" + source "%(deactivate1)s" + source "%(activate1)s" + """) % { + 'activate1': join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.xsh'), + 'deactivate1': join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.xsh'), + } + + deactivate_result = activator.deactivate() + with open(deactivate_result) as fh: + deactivate_data = fh.read() + rm_rf(deactivate_result) + + new_path = activator.pathsep_join(activator._remove_prefix_from_path(self.prefix)) + assert deactivate_data == dals(""" + del $CONDA_DEFAULT_ENV + del $CONDA_PREFIX + del $CONDA_PROMPT_MODIFIER + del $CONDA_PYTHON_EXE + $CONDA_SHLVL = "0" + $PATH = "%(new_path)s" + source "%(deactivate1)s" + """) % { + 'new_path': new_path, + 'deactivate1': join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.xsh'), + } + + @pytest.mark.integration class ActivatorIntegrationTests(TestCase):
conda xontrib xonsh wrapper Make a wrapper for xonsh.
2017-04-27T01:31:36
conda/conda
5,159
conda__conda-5159
[ "3580" ]
ca57ef2a1ac70355d1aeb58ddc2da78f655c4fbc
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -110,10 +110,13 @@ def build_activate(self, name_or_prefix): # query environment old_conda_shlvl = int(os.getenv('CONDA_SHLVL', 0)) old_conda_prefix = os.getenv('CONDA_PREFIX') + max_shlvl = self.context.max_shlvl if old_conda_prefix == prefix: return self.build_reactivate() - elif old_conda_shlvl == 2 and os.getenv('CONDA_PREFIX_1') == prefix: + elif os.getenv('CONDA_PREFIX_%s' % (old_conda_shlvl-1)) == prefix: + # in this case, user is attenmpting to activate the previous environment, + # i.e. step back down return self.build_deactivate() activate_scripts = glob(join( @@ -122,6 +125,7 @@ def build_activate(self, name_or_prefix): conda_default_env = self._default_env(prefix) conda_prompt_modifier = self._prompt_modifier(conda_default_env) + assert 0 <= old_conda_shlvl <= max_shlvl if old_conda_shlvl == 0: new_path = self.pathsep_join(self._add_prefix_to_path(prefix)) set_vars = { @@ -133,30 +137,28 @@ def build_activate(self, name_or_prefix): 'CONDA_PROMPT_MODIFIER': conda_prompt_modifier, } deactivate_scripts = () - elif old_conda_shlvl == 1: - new_path = self.pathsep_join(self._add_prefix_to_path(prefix)) + elif old_conda_shlvl == max_shlvl: + new_path = self.pathsep_join(self._replace_prefix_in_path(old_conda_prefix, prefix)) set_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 = () - elif old_conda_shlvl == 2: - new_path = self.pathsep_join(self._replace_prefix_in_path(old_conda_prefix, prefix)) + deactivate_scripts = glob(join( + old_conda_prefix, 'etc', 'conda', 'deactivate.d', '*' + self.script_extension + )) + else: + new_path = self.pathsep_join(self._add_prefix_to_path(prefix)) set_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 = glob(join( - old_conda_prefix, 'etc', 'conda', 'deactivate.d', '*' + self.script_extension - )) - else: - raise NotImplementedError() + deactivate_scripts = () return { 'unset_vars': (), @@ -174,6 +176,7 @@ def build_deactivate(self): 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 if old_conda_shlvl == 1: # TODO: warn conda floor unset_vars = ( @@ -187,7 +190,7 @@ def build_deactivate(self): 'CONDA_SHLVL': new_conda_shlvl, } activate_scripts = () - elif old_conda_shlvl == 2: + 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) @@ -203,8 +206,6 @@ def build_deactivate(self): 'CONDA_PROMPT_MODIFIER': conda_prompt_modifier, } activate_scripts = self._get_activate_scripts(new_prefix) - else: - raise NotImplementedError() return { 'unset_vars': unset_vars, diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -91,8 +91,9 @@ class Context(Configuration): default_python = PrimitiveParameter('%d.%d' % sys.version_info[:2], element_type=string_types + (NoneType,)) disallow = SequenceParameter(string_types) - force_32bit = PrimitiveParameter(False) enable_private_envs = PrimitiveParameter(False) + force_32bit = PrimitiveParameter(False) + max_shlvl = PrimitiveParameter(2) path_conflict = PrimitiveParameter(PathConflict.clobber) pinned_packages = SequenceParameter(string_types, string_delimiter='/') # TODO: consider a different string delimiter # NOQA rollback_enabled = PrimitiveParameter(True) @@ -471,6 +472,7 @@ def list_parameters(self): 'default_python', 'enable_private_envs', 'force_32bit', + 'max_shlvl', 'migrated_custom_channels', 'prune', 'respect_pinned',
Allow activating multiple environments Hi, I'm trying to configure conda to use it on a computing cluster with command line access for multiple users (~300 accounts). The idea is that we will provide to users some preinstalled conda environments that they can use as they need. Some people will want to activate several of these environments to perform their compute task. The problem is that the `activate` script calls `deactivate` before doing the activation job, so users can only have 1 environment loaded. I know that activating multiple environments could be a problem as some incompatibility could arise depending on the packages installed in each env. But in our case, in many situations, it would work perfectly well (and if it's not, users would be able to take care of it). So I'm wondering if you think this feature could be added to conda somehow? Maybe with a special option for the activate script, and a modification to deactivate to allow it to deactivate _all_ the loaded env. I can work on a PR if you are ok with the idea. The other option would be to force them to adopt the proper conda way (they create their own environments), but it would make the transition too hard for most of them...
So, if I understand correctly, you're proposing that it be possible to activate more than one environment at a time by removing the deactivate step from the activate script. Then you would add an option to deactivate that would allow it to deactivate all the previously activated environments. Is that right? Activating an environment prepends that environment's directories to PATH. Thus activating two environments at the same time in the same terminal session is somewhat ambigous. Which environment should have precedence? Since we can't be ambigous about what environment is active, one environment can be active in a session at a time. Each user should be able to activate a conda environment for each terminal session they have open. Each terminal session has its own shell environment. For example, on my linux system, if I want to activate two conda environments, I need to open two terminal sessions. Since each terminal session has its own shell environment, I can activate a different conda environment in each session without any problems. There are no conda environments the need to be deactivated. When using preinstalled environments, it might be a good idea to ensure somehow that users don't change the preinstalled conda environment. One problem that can arise is when a user upgrades packages that breaks another users's code. This is one of the several problems that conda environments solve very well. I would, of course, highly encourage you to educate your users about conda environments. Environments are pretty powerful and a little knowledge goes a long way. If I've misunderstood your post, please let me know. I think the above information should help you. This issue relates to #2502, and I'd encourage you to weigh in there. @pzwang has proposed the ability to "stack" envs, pretty much as you've described. I consider #2502 a first step toward that. Also, implementing #2502 would resolve https://github.com/conda/conda/issues/3411, which often happens in cluster environments. > So, if I understand correctly, you're proposing that it be possible to activate more than one environment at a time by removing the deactivate step from the activate script. Then you would add an option to deactivate that would allow it to deactivate all the previously activated environments. Is that right? Yep, that's it > Activating an environment prepends that environment's directories to PATH. Thus activating two environments at the same time in the same terminal session is somewhat ambigous. Which environment should have precedence? Since we can't be ambigous about what environment is active, one environment can be active in a session at a time. Precedence would depend on the order or activation, ie each new env gets its path prepended to PATH. That's how it works currently on our cluster with simple bash scripts, and it works not so bad for most of the softs we use. > Each user should be able to activate a conda environment for each terminal session they have open. Each terminal session has its own shell environment. For example, on my linux system, if I want to activate two conda environments, I need to open two terminal sessions. Since each terminal session has its own shell environment, I can activate a different conda environment in each session without any problems. There are no conda environments the need to be deactivated. Hum, yes, no problem in having multiple shells with specific activated env. Our use case is that user want to run as a job a big pipeline that uses many different software, that are womewhat unrelated. A script like this: ``` #!/bin/bash source activate softA source activate softB source activate softC source activate softD my_huge_pipeline.sh|py|pl|... --that uses --internally the -4 softs ``` > When using preinstalled environments, it might be a good idea to ensure somehow that users don't change the preinstalled conda environment. One problem that can arise is when a user upgrades packages that breaks another users's code. This is one of the several problems that conda environments solve very well. I _think_ it's not a big problem if we don't give write permissions to users for the system-wide conda, and let them create their own environments (if they need to) in their /home: ``` conda create -p /home/my_env softA softB source activate /home/my_env ``` > I would, of course, highly encourage you to educate your users about conda environments. Environments are pretty powerful and a little knowledge goes a long way. Yes, I agree, but that will take a looong time I think... Most of our users are not power users. @kalefranz right, #2502 looks like a good first step, but still a little bit different as here I'd like to stack multiple envs. @abretaud I think I understand your use case a little better now. AFAIK, what you are proposing should technically work. My opinion is: Having a few envs for certain specific purposes is fine. Those purposes are: ``` 1. To store only conda in order to simplify conda's code. 2. To store the root/Administrator installed, read only packages that everyone can use. 3. To store the user's customizations of that env. ``` Making this arbitrarily cascadable would be really confusing and difficult to manage and communicate. We'd also run out of PATH on Windows quite quickly. Actually, a change like this would start morphing Conda into something more akin to lmod. An interesting concept with potential. I would personally want a solution like this to have a broader understanding of what kinds of environments are being activated. That way if say the first/base environment activated is Python 3.5, any subsequent activations will ensure that the Python versions match (to an extent). This should eliminate the most obvious dangers. In conjunction with the suggested boolean variable `stack_envs` from #2502, I would suggest something like a boolean variable `deactivate_on_activate`. I'm sure these variables are self explanatory in the scope of this discussion. Basically, in peoples mind, there are 3 types of environments: - the main python environment - additional packages environment - additional binary/lib environment So each environment can be treated as source for python, source for packages (using site packages environment), source for bin/libs. Let's assume we have - EnvA - binA - PythonA - PkgA1 - PkgA2 - EnvB - binB - EnvC - binC - PythonC - PkgC1 - PkgC2 So I would suggest extending the activation logic to something like this: ``` bash activate EnvA activate -p EnvB activate -b EnvC ``` Would setup something like this: - Env - binC:binA - PythonA - PkgA1 - PkgA2 In contrast: ``` bash activate EnvA activate -b EnvB activate -p EnvC ``` Would setup something like this: - Env - binB:binA - PythonA - PkgA1 - PkgA2 - PkgC1 - PkgC2 Or even weird as: ``` bash activate EnvC activate -b EnvA activate -b EnvC ``` Would setup something like this (to make sure that the order of search for packages would be preserved as needed): - Env - binC:binA:binC - PythonC - PkgC1 - PkgC2 Regarding deactivate - by default it will deactivate the last activate. There will be also additional switch to make a specific deactivation of some environment. And additionally a way to deactivate all environments. This will allow to write strange scripts like this one: ``` bash activate EnvA do_only for_A activate -b EnvB do_for_A_and_B deactivate activate -p EnvC do_for_A_and_C deactivate -all do_something_else ``` I'm just thinking that without decent definition of atomic operations within activate - there is no way to stack the environments properly. I contend there's little value to this. Conda envs are cheap to create and destroy and we shouldn't complicate things with this stuff. I stand by my 3 and 3 only. Again, just like @njalerikson said [here](https://github.com/conda/conda/issues/3580#issuecomment-252082291): introducing stacking might move activate/deactivate closer to lmod behavior and, who knows, may be there is a need to think about integration some of the conda stuff with lmod... @mingwandroid is right in my opinion. Conda environments, in almost all cases, are incredibly cheap in terms of overhead and weight. The size limit on PATH is also another factor. Having separate environments means now you have to maintain many more conda environments. Packages in every environment now have to be maintained and updated. Environments are sure to overlap and shadow each other. You now need to track binaries and libraries in each environment. On top of that, order of activation would be incredibly important. Not only would you have to understand environments, but you would have to understand how environments interact with each other. I've had to read about `lmod` just now, and I don't think being like `lmod` is a design goal for `conda` nor do I think `lmod` has the same constraints as `conda`. Something that hasn't been addressed (if it has I missed it). Why can't you just install all the packages you need into a single environment? Installing the same package into multiple environments is extremely cheap, since conda uses hard linking. I agree, creating environments is cheap and is the _right_ way. But we have _many_ users, and some software already available in the described way (and not enough time to port them to conda in a reasonable time frame). So if we begin to use conda the default way, people will have to deal with 2 logics: some softs can be stacked, others not... I expect a deluge of support requests if we do this (and we're thinking about using conda to save us time, so...). On the other hand, currently we use the described behavior with our local tools, and we get very few user requests of people having problems. Again I perfectly understand that this should not be the default behavior, and that it should only be activated by people who are ready to assume the consequences (ie, teach impacted users how to create their own env). I don't know if you have all seen it: I opened the #3924 PR for this, your feedback is welcome! What do you mean by "some softs can be stacked, others not"?
2017-04-27T02:42:43
conda/conda
5,166
conda__conda-5166
[ "5152" ]
340600b231abae4060f946dfaaa84fffa71013d4
diff --git a/conda/cli/main_info.py b/conda/cli/main_info.py --- a/conda/cli/main_info.py +++ b/conda/cli/main_info.py @@ -248,12 +248,14 @@ def get_info_dict(system=False): def get_main_info_str(info_dict): + from .._vendor.auxlib.ish import dals + 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') builder = [] - builder.append("""\ + builder.append(dals(""" Current conda install: platform : %(platform)s @@ -271,12 +273,10 @@ def get_main_info_str(info_dict): config file : %(rc_path)s offline mode : %(offline)s user-agent : %(user_agent)s\ - """ % info_dict) + """) % info_dict) if not on_win: - builder.append("""\ - UID:GID : %(UID)s:%(GID)s - """ % info_dict) + builder.append(" UID:GID : %(UID)s:%(GID)s" % info_dict) else: builder.append("")
conda info in 4.3.17 has a spacing offset problem ``` $ ❯ /conda4/bin/conda info Current conda install: platform : osx-64 conda version : 4.3.17 conda is private : False conda-env version : 4.3.17 conda-build version : 2.1.9 python version : 2.7.13.final.0 requests version : 2.12.4 root environment : /conda4 (writable) default environment : /conda4 envs directories : /conda4/envs /Users/kfranz/.conda/envs package cache : /conda4/pkgs /Users/kfranz/.conda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : /Users/kfranz/.condarc offline mode : False user-agent : conda/4.3.17 requests/2.12.4 CPython/2.7.13 Darwin/16.5.0 OSX/10.12.4 UID:GID : 502:20 ```
2017-04-27T16:56:42
conda/conda
5,186
conda__conda-5186
[ "5184", "5184" ]
2e97c19d63b0ec3c075ed5d706032b891222ec2d
diff --git a/conda/common/configuration.py b/conda/common/configuration.py --- a/conda/common/configuration.py +++ b/conda/common/configuration.py @@ -105,7 +105,7 @@ def __init__(self, parameter_name, parameter_value, source, wrong_type, valid_ty self.valid_types = valid_types if msg is None: msg = ("Parameter %s = %r declared in %s has type %s.\n" - "Valid types: %s." % (parameter_name, parameter_value, + "Valid 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) @@ -654,18 +654,23 @@ def collect_errors(self, instance, value, source="<<merged>>"): 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) + 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(self)) + for k, v in iteritems(match_value) if key_is_important(match, k)) - for match in relevant_matches) + for match, match_value in relevant_matches_and_values) # dump all matches in a dict # then overwrite with important matches - return merge(concatv((m.value(self) for m in relevant_matches), + return merge(concatv((v for _, v in relevant_matches_and_values), reversed(important_maps))) def repr_raw(self, raw_parameter):
diff --git a/tests/common/test_configuration.py b/tests/common/test_configuration.py --- a/tests/common/test_configuration.py +++ b/tests/common/test_configuration.py @@ -424,7 +424,11 @@ def test_config_resets(self): assert config.changeps1 is False def test_empty_map_parameter(self): - config = SampleConfiguration()._set_raw_data(load_from_string_data('bad_boolean_map')) config.check_source('bad_boolean_map') + def test_invalid_map_parameter(self): + data = odict(s1=YamlRawParameter.make_raw_parameters('s1', {'proxy_servers': 'blah'})) + config = SampleConfiguration()._set_raw_data(data) + with raises(InvalidTypeError): + config.proxy_servers
"conda" install or update throwing AttributeError: 'str' object has no attribute items I've installed the last version of Anaconda3 with Python 3.6, which has the "conda" command version 4.3.14 on a Windows 7 without administrator rights to my account, but I could successfully install Anaconda in my <user>\appdata\local Windows folder. When I try to install or update any package, I've got the following error: ``` `$ 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' ``` Any hints? "conda" install or update throwing AttributeError: 'str' object has no attribute items I've installed the last version of Anaconda3 with Python 3.6, which has the "conda" command version 4.3.14 on a Windows 7 without administrator rights to my account, but I could successfully install Anaconda in my <user>\appdata\local Windows folder. When I try to install or update any package, I've got the following error: ``` `$ 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' ``` Any hints?
@srodriguex Could you please share the output for `conda info -a`? @nehaljwani Here you go: ``` C:\Users\<username>>conda info -a Current conda install: platform : win-64 conda version : 4.3.14 conda is private : False conda-env version : 4.3.14 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : C:\Users\<username>\AppData\Local\Continuum\Anaconda3 (wri able) default environment : C:\Users\<username>\AppData\Local\Continuum\Anaconda3 envs directories : C:\Users\<username>\AppData\Local\Continuum\Anaconda3\envs C:\Users\<username>\AppData\Local\conda\conda\envs C:\Users\<username>\.conda\envs package cache : C:\Users\<username>\AppData\Local\Continuum\Anaconda3\pkgs C:\Users\<username>\AppData\Local\conda\conda\pkgs channel URLs : https://conda.anaconda.org/anaconda-fusion/win-64 https://conda.anaconda.org/anaconda-fusion/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 file : C:\Users\<username>\.condarc offline mode : False user-agent : conda/4.3.14 requests/2.12.4 CPython/3.6.0 Windows/7 indows/6.1.7601 # conda environments: # root * C:\Users\<username>\AppData\Local\Continuum\Anaconda3 sys.version: 3.6.0 |Anaconda 4.3.1 (64-bit)| (default... sys.prefix: C:\Users\<username>\AppData\Local\Continuum\Anaconda3 sys.executable: C:\Users\<username>\AppData\Local\Continuum\Anaconda3\python.exe conda location: C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packag s\conda conda-build: None conda-env: C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Scripts\conda-env.ex conda-server: C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Scripts\conda-ser er.exe user site dirs: CIO_TEST: <not set> CONDA_DEFAULT_ENV: <not set> CONDA_ENVS_PATH: <not set> PATH: C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Library\bin;C:\oracle\pro uct\11.2.0\client_1\bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32 C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\ C:\Program Files (x86)\IXOS\bin;C:\Users\<username>\AppData\Local\Continuum\Anaconda3 C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Scripts;C:\Users\<username>\AppData\L cal\Continuum\Anaconda3\Library\bin;c:\users\<username>\bin PYTHONHOME: <not set> PYTHONPATH: <not set> License directories: C:\Users\<username>\.continuum C:\Users\<username>\AppData\Local\Continuum\Anaconda3\licenses C:\Users\<username>\AppData\Roaming\Continuum License files (license*.txt): Package/feature end dates: ``` @srodriguex Could you also share output for: `conda config --show` @nehaljwani Right away sir: ``` C:\Users\<username>>conda config --show 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.14 conda is private : False conda-env version : 4.3.14 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : C:\Users\<username>\AppData\Local\Continuum\Anaconda3 (writ able) default environment : C:\Users\<username>\AppData\Local\Continuum\Anaconda3 envs directories : C:\Users\<username>\AppData\Local\Continuum\Anaconda3\envs C:\Users\<username>\AppData\Local\conda\conda\envs C:\Users\<username>\.conda\envs package cache : C:\Users\<username>\AppData\Local\Continuum\Anaconda3\pkgs C:\Users\<username>\AppData\Local\conda\conda\pkgs channel URLs : https://conda.anaconda.org/anaconda-fusion/win-64 https://conda.anaconda.org/anaconda-fusion/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 file : C:\Users\<username>\.condarc offline mode : False user-agent : conda/4.3.14 requests/2.12.4 CPython/3.6.0 Windows/7 W indows/6.1.7601 `$ C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Scripts\conda-script.py confi g --show` 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_config.py", line 234, in execute execute_config(args, parser) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\cli\main_config.py", line 308, in execute_config 'verbosity', File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\cli\main_config.py", line 279, in <genexpr> for key in sorted(('add_anaconda_token', 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' ``` Does `conda config --show-sources` also error? And also `conda config --validate`? I am able to reproduce the exact same error when, for any of of the config parameters , I pass a string instead of the expected list or key pair value. Example, if I have: ``` proxy_servers: http://blah.com:3128 ``` Instead of: ``` proxy_servers: http: http://blah.com:3128 ``` In the above scenario, `conda config --show-sources` throws the exception (expected): ``` InvalidTypeError: Parameter proxy_servers = 'http://blah.com:3128' declared in <<merged>> has type <class 'str'>. Valid types: - <class 'dict'>. ``` But `conda config --show` throws a traceback instead of exception. @kalefranz Here are your answers: ```` C:\Users\<username>>conda config --show-sources InvalidTypeError: Parameter proxy_servers = 'http:127.0.0.1:53128' declared in < <merged>> has type <class 'str'>. Valid types: - <class 'dict'>. ```` and ```` C:\Users\cmsi>conda --validate usage: conda-script.py [-h] [-V] command ... conda-script.py: error: the following arguments are required: command ```` Here you have my .condarc file, I'm behind a proxy so I'm using a CNTLM proxy wrapper: ```` proxy_servers: http:127.0.0.1:53128 channels: - anaconda-fusion - defaults ssl_verify: true ```` @srodriguex Replace... ``` proxy_servers: http:127.0.0.1:53128 ``` ...with: ``` proxy_servers: http: http://127.0.0.1:53128 https: http://127.0.0.1:53128 ``` @nehaljwani The substitution works setting the "ssl_verify" to "false". So the problem was in the .condarc file... I was almost pretty sure I followed the [documentation for proxy configuration](https://conda.io/docs/config.html#configure-conda-for-use-behind-a-proxy-server-proxy-servers), but I have forgotten enclosing with the (') character. Labelled this issue as a bug. PR coming for a better error message. @srodriguex Could you please share the output for `conda info -a`? @nehaljwani Here you go: ``` C:\Users\<username>>conda info -a Current conda install: platform : win-64 conda version : 4.3.14 conda is private : False conda-env version : 4.3.14 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : C:\Users\<username>\AppData\Local\Continuum\Anaconda3 (wri able) default environment : C:\Users\<username>\AppData\Local\Continuum\Anaconda3 envs directories : C:\Users\<username>\AppData\Local\Continuum\Anaconda3\envs C:\Users\<username>\AppData\Local\conda\conda\envs C:\Users\<username>\.conda\envs package cache : C:\Users\<username>\AppData\Local\Continuum\Anaconda3\pkgs C:\Users\<username>\AppData\Local\conda\conda\pkgs channel URLs : https://conda.anaconda.org/anaconda-fusion/win-64 https://conda.anaconda.org/anaconda-fusion/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 file : C:\Users\<username>\.condarc offline mode : False user-agent : conda/4.3.14 requests/2.12.4 CPython/3.6.0 Windows/7 indows/6.1.7601 # conda environments: # root * C:\Users\<username>\AppData\Local\Continuum\Anaconda3 sys.version: 3.6.0 |Anaconda 4.3.1 (64-bit)| (default... sys.prefix: C:\Users\<username>\AppData\Local\Continuum\Anaconda3 sys.executable: C:\Users\<username>\AppData\Local\Continuum\Anaconda3\python.exe conda location: C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packag s\conda conda-build: None conda-env: C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Scripts\conda-env.ex conda-server: C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Scripts\conda-ser er.exe user site dirs: CIO_TEST: <not set> CONDA_DEFAULT_ENV: <not set> CONDA_ENVS_PATH: <not set> PATH: C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Library\bin;C:\oracle\pro uct\11.2.0\client_1\bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32 C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\ C:\Program Files (x86)\IXOS\bin;C:\Users\<username>\AppData\Local\Continuum\Anaconda3 C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Scripts;C:\Users\<username>\AppData\L cal\Continuum\Anaconda3\Library\bin;c:\users\<username>\bin PYTHONHOME: <not set> PYTHONPATH: <not set> License directories: C:\Users\<username>\.continuum C:\Users\<username>\AppData\Local\Continuum\Anaconda3\licenses C:\Users\<username>\AppData\Roaming\Continuum License files (license*.txt): Package/feature end dates: ``` @srodriguex Could you also share output for: `conda config --show` @nehaljwani Right away sir: ``` C:\Users\<username>>conda config --show 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.14 conda is private : False conda-env version : 4.3.14 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : C:\Users\<username>\AppData\Local\Continuum\Anaconda3 (writ able) default environment : C:\Users\<username>\AppData\Local\Continuum\Anaconda3 envs directories : C:\Users\<username>\AppData\Local\Continuum\Anaconda3\envs C:\Users\<username>\AppData\Local\conda\conda\envs C:\Users\<username>\.conda\envs package cache : C:\Users\<username>\AppData\Local\Continuum\Anaconda3\pkgs C:\Users\<username>\AppData\Local\conda\conda\pkgs channel URLs : https://conda.anaconda.org/anaconda-fusion/win-64 https://conda.anaconda.org/anaconda-fusion/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 file : C:\Users\<username>\.condarc offline mode : False user-agent : conda/4.3.14 requests/2.12.4 CPython/3.6.0 Windows/7 W indows/6.1.7601 `$ C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Scripts\conda-script.py confi g --show` 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_config.py", line 234, in execute execute_config(args, parser) File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\cli\main_config.py", line 308, in execute_config 'verbosity', File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co nda\cli\main_config.py", line 279, in <genexpr> for key in sorted(('add_anaconda_token', 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' ``` Does `conda config --show-sources` also error? And also `conda config --validate`? I am able to reproduce the exact same error when, for any of of the config parameters , I pass a string instead of the expected list or key pair value. Example, if I have: ``` proxy_servers: http://blah.com:3128 ``` Instead of: ``` proxy_servers: http: http://blah.com:3128 ``` In the above scenario, `conda config --show-sources` throws the exception (expected): ``` InvalidTypeError: Parameter proxy_servers = 'http://blah.com:3128' declared in <<merged>> has type <class 'str'>. Valid types: - <class 'dict'>. ``` But `conda config --show` throws a traceback instead of exception. @kalefranz Here are your answers: ```` C:\Users\<username>>conda config --show-sources InvalidTypeError: Parameter proxy_servers = 'http:127.0.0.1:53128' declared in < <merged>> has type <class 'str'>. Valid types: - <class 'dict'>. ```` and ```` C:\Users\cmsi>conda --validate usage: conda-script.py [-h] [-V] command ... conda-script.py: error: the following arguments are required: command ```` Here you have my .condarc file, I'm behind a proxy so I'm using a CNTLM proxy wrapper: ```` proxy_servers: http:127.0.0.1:53128 channels: - anaconda-fusion - defaults ssl_verify: true ```` @srodriguex Replace... ``` proxy_servers: http:127.0.0.1:53128 ``` ...with: ``` proxy_servers: http: http://127.0.0.1:53128 https: http://127.0.0.1:53128 ``` @nehaljwani The substitution works setting the "ssl_verify" to "false". So the problem was in the .condarc file... I was almost pretty sure I followed the [documentation for proxy configuration](https://conda.io/docs/config.html#configure-conda-for-use-behind-a-proxy-server-proxy-servers), but I have forgotten enclosing with the (') character. Labelled this issue as a bug. PR coming for a better error message.
2017-04-28T20:40:21
conda/conda
5,190
conda__conda-5190
[ "5125" ]
2e97c19d63b0ec3c075ed5d706032b891222ec2d
diff --git a/conda/base/constants.py b/conda/base/constants.py --- a/conda/base/constants.py +++ b/conda/base/constants.py @@ -52,6 +52,7 @@ "linux-ppc64le", "linux-armv6l", "linux-armv7l", + "linux-aarch64", "zos-z", "noarch", ) diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -46,6 +46,7 @@ non_x86_linux_machines = { 'armv6l', 'armv7l', + 'aarch64', 'ppc64le', } _arch_names = { diff --git a/conda/models/enums.py b/conda/models/enums.py --- a/conda/models/enums.py +++ b/conda/models/enums.py @@ -17,6 +17,7 @@ class Arch(Enum): x86_64 = 'x86_64' armv6l = 'armv6l' armv7l = 'armv7l' + aarch64 = 'aarch64' ppc64le = 'ppc64le' z = 'z'
Incorrectly detected arch on aarch64 As per the title, conda currently only knows about the usual x86, x86_64 and armv7l architectures. Since aarch64 systems are compatible with armhf binaries, conda just needs to alias 'aarch64' to 'armv7l'. The only hitch involved in approaching the problem via such an alias is that the armhf linker (ld-linux-armhf) may not be installed - its a rare situation currently, since most ARM systems opt for a 64bit kernel/32 bit userspace due to the rarity of 64 bit ARM binaries. The user (with sudo privileges) would need to install the linker in such a situation. See [PR 4809](https://github.com/conda/conda/pull/4809) for implementation.
2017-04-28T21:19:32
conda/conda
5,192
conda__conda-5192
[ "5189", "5189" ]
b4aae214af25845ac0f68da8e40f1d33c1dcd5ad
diff --git a/conda/common/configuration.py b/conda/common/configuration.py --- a/conda/common/configuration.py +++ b/conda/common/configuration.py @@ -572,7 +572,12 @@ def collect_errors(self, instance, value, source="<<merged>>"): 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) + 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 @@ -581,16 +586,17 @@ def get_marked_lines(match, marker, parameter_obj): 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) + 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)) + 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(m.value(self) for m in reversed(relevant_matches)) + 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)))
diff --git a/tests/common/test_configuration.py b/tests/common/test_configuration.py --- a/tests/common/test_configuration.py +++ b/tests/common/test_configuration.py @@ -432,3 +432,9 @@ def test_invalid_map_parameter(self): config = SampleConfiguration()._set_raw_data(data) with raises(InvalidTypeError): config.proxy_servers + + def test_invalid_seq_parameter(self): + data = odict(s1=YamlRawParameter.make_raw_parameters('s1', {'channels': 'y_u_no_tuple'})) + config = SampleConfiguration()._set_raw_data(data) + with raises(InvalidTypeError): + config.channels
Improve error message on invalid SequenceParameter For a malformed configuration parameter of type sequence: ``` (test) [hulk@ranganork conda]# cat ~/.condarc channels: defaults ``` The following shows the expected error: ``` (test) [hulk@ranganork conda]# conda config --validate InvalidTypeError: Parameter _channels = 'defaults' declared in <<merged>> has type <class 'str'>. Valid types: - <class 'tuple'> ``` But the following throws an exception: ``` (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 ``` Improve error message on invalid SequenceParameter For a malformed configuration parameter of type sequence: ``` (test) [hulk@ranganork conda]# cat ~/.condarc channels: defaults ``` The following shows the expected error: ``` (test) [hulk@ranganork conda]# conda config --validate InvalidTypeError: Parameter _channels = 'defaults' declared in <<merged>> has type <class 'str'>. Valid types: - <class 'tuple'> ``` But the following throws an exception: ``` (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 ```
Similar to #5184 Do you want to tackle this one @nehaljwani? Similar to #5184 Do you want to tackle this one @nehaljwani?
2017-04-29T05:42:46
conda/conda
5,200
conda__conda-5200
[ "3470", "3470" ]
3beff3b3cb8c6ca3661a3364e77c614d1ec623e0
diff --git a/conda/__init__.py b/conda/__init__.py --- a/conda/__init__.py +++ b/conda/__init__.py @@ -41,7 +41,7 @@ def __init__(self, message, caused_by=None, **kwargs): super(CondaError, self).__init__(message) def __repr__(self): - return '%s: %s\n' % (self.__class__.__name__, text_type(self)) + return '%s: %s' % (self.__class__.__name__, text_type(self)) def __str__(self): return text_type(self.message % self._kwargs) diff --git a/conda/exceptions.py b/conda/exceptions.py --- a/conda/exceptions.py +++ b/conda/exceptions.py @@ -556,7 +556,7 @@ def print_conda_exception(exception): stdoutlogger.info(json.dumps(exception.dump_map(), indent=2, sort_keys=True, cls=EntityEncoder)) else: - stderrlogger.info("\n\n%r", exception) + stderrlogger.info("\n%r", exception) def print_unexpected_error_message(e):
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -1104,7 +1104,7 @@ def test_remove_spellcheck(self): run_command(Commands.REMOVE, prefix, 'numpi') exc_string = '%r' % exc.value - assert exc_string == "PackageNotFoundError: No packages named 'numpi' found to remove from environment.\n" + assert exc_string == "PackageNotFoundError: No packages named 'numpi' found to remove from environment." assert_package_is_installed(prefix, 'numpy')
Whitespace in error messages I started creating an environment then cancelled it. The error messages for the later commands have some extra vertical whitespace. Also, the "CondaValueError" part and "Value Error" parts seem like they shouldn't be included in the terminal output. ``` $conda create -n dot2tex python=2.7 CondaValueError: Value error: prefix already exists: /Users/aaronmeurer/anaconda/envs/dot2tex $conda remove -n dot2tex --all Remove all packages in environment /Users/aaronmeurer/anaconda/envs/dot2tex: $conda create -n dot2tex python=2.7 ... ``` Whitespace in error messages I started creating an environment then cancelled it. The error messages for the later commands have some extra vertical whitespace. Also, the "CondaValueError" part and "Value Error" parts seem like they shouldn't be included in the terminal output. ``` $conda create -n dot2tex python=2.7 CondaValueError: Value error: prefix already exists: /Users/aaronmeurer/anaconda/envs/dot2tex $conda remove -n dot2tex --all Remove all packages in environment /Users/aaronmeurer/anaconda/envs/dot2tex: $conda create -n dot2tex python=2.7 ... ```
Another error message issue (should be printed not as an exception): ``` ncurses-5.9-9. 100% |##############################################################################################################| Time: 0:00:10 94.92 kB/s An unexpected error has occurred.########################################### | Time: 0:01:14 82.96 kB/s Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : osx-64 conda version : 4.2.7 conda is private : False conda-env version : 4.2.7 conda-build version : 2.0.0 python version : 3.5.2.final.0 requests version : 2.10.0 root environment : /Users/aaronmeurer/anaconda (writable) default environment : /Users/aaronmeurer/anaconda envs directories : /Users/aaronmeurer/anaconda/envs package cache : /Users/aaronmeurer/anaconda/pkgs channel URLs : https://conda.anaconda.org/conda-forge/osx-64/ https://conda.anaconda.org/conda-forge/noarch/ https://repo.continuum.io/pkgs/free/osx-64/ https://repo.continuum.io/pkgs/free/noarch/ https://repo.continuum.io/pkgs/pro/osx-64/ https://repo.continuum.io/pkgs/pro/noarch/ https://conda.anaconda.org/asmeurer/osx-64/ https://conda.anaconda.org/asmeurer/noarch/ https://conda.anaconda.org/r/osx-64/ https://conda.anaconda.org/r/noarch/ https://conda.anaconda.org/pyne/osx-64/ https://conda.anaconda.org/pyne/noarch/ config file : /Users/aaronmeurer/.condarc offline mode : False `$ /Users/aaronmeurer/anaconda3/bin/conda create -n dot2tex python=2.7` Traceback (most recent call last): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 228, in _error_catcher yield File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 310, in read data = self._fp.read(amt) File "/Users/aaronmeurer/anaconda/lib/python3.5/http/client.py", line 448, in read n = self.readinto(b) File "/Users/aaronmeurer/anaconda/lib/python3.5/http/client.py", line 488, in readinto n = self.fp.readinto(b) File "/Users/aaronmeurer/anaconda/lib/python3.5/socket.py", line 575, in readinto return self._sock.recv_into(b) File "/Users/aaronmeurer/anaconda/lib/python3.5/ssl.py", line 929, in recv_into return self.read(nbytes, buffer) File "/Users/aaronmeurer/anaconda/lib/python3.5/ssl.py", line 791, in read return self._sslobj.read(len, buffer) File "/Users/aaronmeurer/anaconda/lib/python3.5/ssl.py", line 575, in read v = self._sslobj.read(len, buffer) socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/models.py", line 664, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 353, in stream data = self.read(amt=amt, decode_content=decode_content) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 320, in read flush_decoder = True File "/Users/aaronmeurer/anaconda/lib/python3.5/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 233, in _error_catcher raise ReadTimeoutError(self._pool, None, 'Read timed out.') requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='binstar-cio-packages-prod.s3.amazonaws.com', port=443): Read timed out. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/fetch.py", line 419, in download for chunk in resp.iter_content(2**14): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/models.py", line 671, in generate raise ConnectionError(e) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='binstar-cio-packages-prod.s3.amazonaws.com', port=443): Read timed out. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/cli/install.py", line 405, in install execute_actions(actions, index, verbose=not context.quiet) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/plan.py", line 643, in execute_actions inst.execute_instructions(plan, index, verbose) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/instructions.py", line 134, in execute_instructions cmd(state, arg) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/instructions.py", line 47, in FETCH_CMD fetch_pkg(state['index'][arg + '.tar.bz2']) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/fetch.py", line 336, in fetch_pkg download(url, path, session=session, md5=info['md5'], urlstxt=True) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/fetch.py", line 438, in download raise CondaRuntimeError("Could not open %r for writing (%s)." % (pp, e)) conda.exceptions.CondaRuntimeError: Runtime error: Could not open '/Users/aaronmeurer/anaconda/pkgs/python-2.7.12-1.tar.bz2.part' for writing (HTTPSConnectionPool(host='binstar-cio-packages-prod.s3.amazonaws.com', port=443): Read timed out.). During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/exceptions.py", line 472, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/cli/main.py", line 144, in _main exit_code = args.func(args, p) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/cli/main_create.py", line 68, in execute install(args, parser, 'create') File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/cli/install.py", line 422, in install raise CondaSystemExit('Exiting', e) File "/Users/aaronmeurer/anaconda/lib/python3.5/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/cli/common.py", line 573, in json_progress_bars yield File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/cli/install.py", line 420, in install raise CondaRuntimeError('RuntimeError: %s' % e) conda.exceptions.CondaRuntimeError: Runtime error: RuntimeError: Runtime error: Could not open '/Users/aaronmeurer/anaconda/pkgs/python-2.7.12-1.tar.bz2.part' for writing (HTTPSConnectionPool(host='binstar-cio-packages-prod.s3.amazonaws.com', port=443): Read timed out.). ``` So was this fixed? I guess you can't ever *fix* "Read timed out." I've closed over 100 issues today reporting intermittent HTTP errors. There wasn't one report coming from conda 4.3, where we've dramatically improved the messaging for HTTP errors. See https://github.com/conda/conda/blob/4.3.17/conda/core/repodata.py#L168-L306 for example. The bugs here are: - Too much whitespace in the error messages - An exception that was printed with a traceback, instead of just the error message I agree the error itself isn't a bug in conda. I'm mostly curious if the extra whitespace was fixed, as I find that quite annoying. Another error message issue (should be printed not as an exception): ``` ncurses-5.9-9. 100% |##############################################################################################################| Time: 0:00:10 94.92 kB/s An unexpected error has occurred.########################################### | Time: 0:01:14 82.96 kB/s Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : osx-64 conda version : 4.2.7 conda is private : False conda-env version : 4.2.7 conda-build version : 2.0.0 python version : 3.5.2.final.0 requests version : 2.10.0 root environment : /Users/aaronmeurer/anaconda (writable) default environment : /Users/aaronmeurer/anaconda envs directories : /Users/aaronmeurer/anaconda/envs package cache : /Users/aaronmeurer/anaconda/pkgs channel URLs : https://conda.anaconda.org/conda-forge/osx-64/ https://conda.anaconda.org/conda-forge/noarch/ https://repo.continuum.io/pkgs/free/osx-64/ https://repo.continuum.io/pkgs/free/noarch/ https://repo.continuum.io/pkgs/pro/osx-64/ https://repo.continuum.io/pkgs/pro/noarch/ https://conda.anaconda.org/asmeurer/osx-64/ https://conda.anaconda.org/asmeurer/noarch/ https://conda.anaconda.org/r/osx-64/ https://conda.anaconda.org/r/noarch/ https://conda.anaconda.org/pyne/osx-64/ https://conda.anaconda.org/pyne/noarch/ config file : /Users/aaronmeurer/.condarc offline mode : False `$ /Users/aaronmeurer/anaconda3/bin/conda create -n dot2tex python=2.7` Traceback (most recent call last): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 228, in _error_catcher yield File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 310, in read data = self._fp.read(amt) File "/Users/aaronmeurer/anaconda/lib/python3.5/http/client.py", line 448, in read n = self.readinto(b) File "/Users/aaronmeurer/anaconda/lib/python3.5/http/client.py", line 488, in readinto n = self.fp.readinto(b) File "/Users/aaronmeurer/anaconda/lib/python3.5/socket.py", line 575, in readinto return self._sock.recv_into(b) File "/Users/aaronmeurer/anaconda/lib/python3.5/ssl.py", line 929, in recv_into return self.read(nbytes, buffer) File "/Users/aaronmeurer/anaconda/lib/python3.5/ssl.py", line 791, in read return self._sslobj.read(len, buffer) File "/Users/aaronmeurer/anaconda/lib/python3.5/ssl.py", line 575, in read v = self._sslobj.read(len, buffer) socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/models.py", line 664, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 353, in stream data = self.read(amt=amt, decode_content=decode_content) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 320, in read flush_decoder = True File "/Users/aaronmeurer/anaconda/lib/python3.5/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 233, in _error_catcher raise ReadTimeoutError(self._pool, None, 'Read timed out.') requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='binstar-cio-packages-prod.s3.amazonaws.com', port=443): Read timed out. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/fetch.py", line 419, in download for chunk in resp.iter_content(2**14): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/requests/models.py", line 671, in generate raise ConnectionError(e) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='binstar-cio-packages-prod.s3.amazonaws.com', port=443): Read timed out. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/cli/install.py", line 405, in install execute_actions(actions, index, verbose=not context.quiet) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/plan.py", line 643, in execute_actions inst.execute_instructions(plan, index, verbose) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/instructions.py", line 134, in execute_instructions cmd(state, arg) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/instructions.py", line 47, in FETCH_CMD fetch_pkg(state['index'][arg + '.tar.bz2']) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/fetch.py", line 336, in fetch_pkg download(url, path, session=session, md5=info['md5'], urlstxt=True) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/fetch.py", line 438, in download raise CondaRuntimeError("Could not open %r for writing (%s)." % (pp, e)) conda.exceptions.CondaRuntimeError: Runtime error: Could not open '/Users/aaronmeurer/anaconda/pkgs/python-2.7.12-1.tar.bz2.part' for writing (HTTPSConnectionPool(host='binstar-cio-packages-prod.s3.amazonaws.com', port=443): Read timed out.). During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/exceptions.py", line 472, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/cli/main.py", line 144, in _main exit_code = args.func(args, p) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/cli/main_create.py", line 68, in execute install(args, parser, 'create') File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/cli/install.py", line 422, in install raise CondaSystemExit('Exiting', e) File "/Users/aaronmeurer/anaconda/lib/python3.5/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/cli/common.py", line 573, in json_progress_bars yield File "/Users/aaronmeurer/anaconda/lib/python3.5/site-packages/conda/cli/install.py", line 420, in install raise CondaRuntimeError('RuntimeError: %s' % e) conda.exceptions.CondaRuntimeError: Runtime error: RuntimeError: Runtime error: Could not open '/Users/aaronmeurer/anaconda/pkgs/python-2.7.12-1.tar.bz2.part' for writing (HTTPSConnectionPool(host='binstar-cio-packages-prod.s3.amazonaws.com', port=443): Read timed out.). ``` So was this fixed? I guess you can't ever *fix* "Read timed out." I've closed over 100 issues today reporting intermittent HTTP errors. There wasn't one report coming from conda 4.3, where we've dramatically improved the messaging for HTTP errors. See https://github.com/conda/conda/blob/4.3.17/conda/core/repodata.py#L168-L306 for example. The bugs here are: - Too much whitespace in the error messages - An exception that was printed with a traceback, instead of just the error message I agree the error itself isn't a bug in conda. I'm mostly curious if the extra whitespace was fixed, as I find that quite annoying.
2017-05-01T22:15:36
conda/conda
5,201
conda__conda-5201
[ "1597", "1597" ]
568c5397eaa1b25f552a5c8ca8bcade93e5da309
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -136,6 +136,7 @@ class Context(Configuration): always_yes = PrimitiveParameter(False, aliases=('yes',)) channel_priority = PrimitiveParameter(True) debug = PrimitiveParameter(False) + dry_run = PrimitiveParameter(False) force = PrimitiveParameter(False) json = PrimitiveParameter(False) offline = PrimitiveParameter(False) @@ -459,6 +460,7 @@ def list_parameters(self): 'croot', 'debug', 'default_python', + 'dry_run', 'force_32bit', 'migrated_custom_channels', 'root_dir', diff --git a/conda/core/link.py b/conda/core/link.py --- a/conda/core/link.py +++ b/conda/core/link.py @@ -261,6 +261,7 @@ def execute(self): if not self._verified: self.verify() + assert not context.dry_run # make sure prefix directory exists if not isdir(self.target_prefix): try: diff --git a/conda/core/package_cache.py b/conda/core/package_cache.py --- a/conda/core/package_cache.py +++ b/conda/core/package_cache.py @@ -486,6 +486,7 @@ def execute(self): if not self._prepared: self.prepare() + assert not context.dry_run with signal_handler(conda_signal_handler): for action in concatv(self.cache_actions, self.extract_actions): self._execute_action(action)
conda install --dry-run with certain options will really install I just executed: ``` bash sudo -u wakari /opt/wakari/anaconda/bin/conda install --no-deps --offline -p /opt/wakari/anaconda --dry-run `cat ~/.py27_packages.txt` ``` And this command then went and installed the packages. This might be related to #1317 conda install --dry-run with certain options will really install I just executed: ``` bash sudo -u wakari /opt/wakari/anaconda/bin/conda install --no-deps --offline -p /opt/wakari/anaconda --dry-run `cat ~/.py27_packages.txt` ``` And this command then went and installed the packages. This might be related to #1317
I just tested this out and with conda 4.3.16 this issue is resolved: ``` $ conda install --no-deps --offline -p /tmp/test --dry-run `cat test.txt` Fetching package metadata ............... Solving package specifications: . Package plan for installation in environment /tmp/test: The following NEW packages will be INSTALLED: bokeh: 0.12.5-py27_0 anaconda matplotlib: 2.0.0-np112py27_0 anaconda mkl: 2017.0.1-0 anaconda numpy: 1.12.1-py27_0 anaconda pandas: 0.19.2-np112py27_1 anaconda scikit-learn: 0.18.1-np112py27_1 anaconda scipy: 0.19.0-np112py27_0 anaconda $ ``` I just tested this out and with conda 4.3.16 this issue is resolved: ``` $ conda install --no-deps --offline -p /tmp/test --dry-run `cat test.txt` Fetching package metadata ............... Solving package specifications: . Package plan for installation in environment /tmp/test: The following NEW packages will be INSTALLED: bokeh: 0.12.5-py27_0 anaconda matplotlib: 2.0.0-np112py27_0 anaconda mkl: 2017.0.1-0 anaconda numpy: 1.12.1-py27_0 anaconda pandas: 0.19.2-np112py27_1 anaconda scikit-learn: 0.18.1-np112py27_1 anaconda scipy: 0.19.0-np112py27_0 anaconda $ ```
2017-05-01T22:52:04
conda/conda
5,206
conda__conda-5206
[ "4468" ]
e865d1fffed1e3e5076a7419d7fbb88d44359894
diff --git a/conda/cli/main_info.py b/conda/cli/main_info.py --- a/conda/cli/main_info.py +++ b/conda/cli/main_info.py @@ -350,6 +350,8 @@ def execute(args, parser): WARNING: could not import _license.show_info # try: # $ conda install -n root _license""") + except Exception as e: + log.warn('%r', e) if context.json: stdout_json(info_dict)
"conda info -a" returns an exception, possibly during license file parsing I don't know what to make of this but I have a pretty conventional Anaconda + Conda setup. I have an "almost" virigin Anaconda 4.2 installation (just installed a few days ago), and I've updated Conda to the latest version. And I get an exception when I execute `conda info -a` as you can see below. ``` $ conda info -a Current conda install: platform : osx-64 conda version : 4.3.8 conda is private : False conda-env version : 4.3.8 conda-build version : 2.1.2 python version : 3.5.2.final.0 requests version : 2.12.4 root environment : /Users/ijstokes/anaconda (writable) default environment : /Users/ijstokes/anaconda envs directories : /Users/ijstokes/anaconda/envs package cache : /Users/ijstokes/anaconda/pkgs channel URLs : https://conda.anaconda.org/anaconda-fusion/osx-64 https://conda.anaconda.org/anaconda-fusion/noarch https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : /Users/ijstokes/.condarc offline mode : False user-agent : conda/4.3.8 requests/2.12.4 CPython/3.5.2 Darwin/16.4.0 OSX/10.12.3 UID:GID : 502:20 # conda environments: # dspyr /Users/ijstokes/anaconda/envs/dspyr root * /Users/ijstokes/anaconda sys.version: 3.5.2 |Anaconda custom (x86_64)| (defaul... sys.prefix: /Users/ijstokes/anaconda sys.executable: /Users/ijstokes/anaconda/bin/python conda location: /Users/ijstokes/anaconda/lib/python3.5/site-packages/conda conda-build: /Users/ijstokes/anaconda/bin/conda-build conda-convert: /Users/ijstokes/anaconda/bin/conda-convert conda-develop: /Users/ijstokes/anaconda/bin/conda-develop conda-env: /Users/ijstokes/anaconda/bin/conda-env conda-index: /Users/ijstokes/anaconda/bin/conda-index conda-inspect: /Users/ijstokes/anaconda/bin/conda-inspect conda-metapackage: /Users/ijstokes/anaconda/bin/conda-metapackage conda-render: /Users/ijstokes/anaconda/bin/conda-render conda-server: /Users/ijstokes/anaconda/bin/conda-server conda-sign: /Users/ijstokes/anaconda/bin/conda-sign conda-skeleton: /Users/ijstokes/anaconda/bin/conda-skeleton conda-verify: /Users/ijstokes/anaconda/bin/conda-verify user site dirs: CIO_TEST: <not set> CONDA_DEFAULT_ENV: <not set> CONDA_ENVS_PATH: <not set> DYLD_LIBRARY_PATH: <not set> PATH: /Users/ijstokes/anaconda/bin:/Users/ijstokes/anaconda/bin:/Users/ijstokes/anconda3new/anaconda/bin:/Users/ijstokes/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin PYTHONHOME: <not set> PYTHONPATH: <not set> License directories: /Users/ijstokes/.continuum /Users/ijstokes/Library/Application Support/Anaconda /Users/ijstokes/anaconda/licenses License files (license*.txt): /Users/ijstokes/.continuum/license_bundle_trial.txt Reading license file : 4 Signature valid : 4 An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues `$ /Users/ijstokes/anaconda/bin/conda info -a` Traceback (most recent call last): File "/Users/ijstokes/anaconda/lib/python3.5/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/ijstokes/anaconda/lib/python3.5/site-packages/conda/cli/main.py", line 137, in _main exit_code = args.func(args, p) File "/Users/ijstokes/anaconda/lib/python3.5/site-packages/conda/cli/main_info.py", line 324, in execute show_info() File "_license.pyx", line 360, in _license.show_info (_license.c:10552) File "_license.pyx", line 339, in _license.is_license_valid (_license.c:9936) File "_license.pyx", line 166, in _license.filter_vendor (_license.c:6216) AttributeError: 'NoneType' object has no attribute 'lower' ```
2017-05-02T06:09:03
conda/conda
5,216
conda__conda-5216
[ "5214", "5214" ]
36e23ad6ce450ed4df587d5b29957f6e91683e64
diff --git a/conda/cli/install.py b/conda/cli/install.py --- a/conda/cli/install.py +++ b/conda/cli/install.py @@ -311,20 +311,20 @@ def install(args, parser, command='install'): raise CondaImportError(text_type(e)) raise - if not context.json: - if any(nothing_to_do(actions) for actions in action_set) and not newenv: + if any(nothing_to_do(actions) for actions in action_set) and not newenv: + if not context.json: from .main_list import print_packages - if not context.json: - spec_regex = r'^(%s)$' % re.escape('|'.join(s.split()[0] for s in ospecs)) - print('\n# All requested packages already installed.') - for action in action_set: - print_packages(action["PREFIX"], spec_regex) - else: - common.stdout_json_success( - message='All requested packages already installed.') - return + spec_regex = r'^(%s)$' % '|'.join(re.escape(s.split()[0]) for s in ospecs) + print('\n# All requested packages already installed.') + for action in action_set: + print_packages(action["PREFIX"], spec_regex) + else: + common.stdout_json_success( + message='All requested packages already installed.') + return + if not context.json: for actions in action_set: print() print("Package plan for installation in environment %s:" % actions["PREFIX"])
conda install with multiple (more than one) packages fails to list packages Observe: ``` >conda install pyqt Fetching package metadata ........... Solving package specifications: . # All requested packages already installed. # packages in environment at C:\Users\heath.raftery\AppData\Local\Continuum\Anaconda3: # pyqt 5.6.0 py36_2 >conda install qtpy Fetching package metadata ........... Solving package specifications: . # All requested packages already installed. # packages in environment at C:\Users\heath.raftery\AppData\Local\Continuum\Anaconda3: # qtpy 1.2.1 py36_0 >conda install pyqt qtpy Fetching package metadata ........... Solving package specifications: . # All requested packages already installed. # packages in environment at C:\Users\heath.raftery\AppData\Local\Continuum\Anaconda3: # ``` When calling `conda install` with one package, the package version is listed. When calling with multiple packages, the list is missing. As well as being confusing, this makes writing instructions for installation difficult, since the output cannot be verified if combining individual `conda install` commands. conda install with multiple (more than one) packages fails to list packages Observe: ``` >conda install pyqt Fetching package metadata ........... Solving package specifications: . # All requested packages already installed. # packages in environment at C:\Users\heath.raftery\AppData\Local\Continuum\Anaconda3: # pyqt 5.6.0 py36_2 >conda install qtpy Fetching package metadata ........... Solving package specifications: . # All requested packages already installed. # packages in environment at C:\Users\heath.raftery\AppData\Local\Continuum\Anaconda3: # qtpy 1.2.1 py36_0 >conda install pyqt qtpy Fetching package metadata ........... Solving package specifications: . # All requested packages already installed. # packages in environment at C:\Users\heath.raftery\AppData\Local\Continuum\Anaconda3: # ``` When calling `conda install` with one package, the package version is listed. When calling with multiple packages, the list is missing. As well as being confusing, this makes writing instructions for installation difficult, since the output cannot be verified if combining individual `conda install` commands.
What version of Conda are you using? This does not happen in the recent versions of conda. `conda update conda` will update your conda to most recent version. ``` conda install nltk qtpy Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment /Users/tkim/miniconda3: The following NEW packages will be INSTALLED: qtpy: 1.2.1-py27_0 The following packages will be SUPERSEDED by a higher-priority channel: nltk: 3.2.2-py27_0 conda-forge --> 3.2.2-py27_0 Proceed ([y]/n)? n ``` `conda 4.3.17 py36_0` I only ran `conda update conda` moments before producing the bug report so I suspect it's up to date. Your results revealed a clarification though: the issue only occurs for packages **already installed and up to date**. Observe: ``` >conda install nltk Fetching package metadata ........... Solving package specifications: . # All requested packages already installed. # packages in environment at C:\Users\heath.raftery\AppData\Local\Continuum\Anaconda3: # nltk 3.2.2 py36_0 >conda install nltk qtpy Fetching package metadata ........... Solving package specifications: . # All requested packages already installed. # packages in environment at C:\Users\heath.raftery\AppData\Local\Continuum\Anaconda3: # >conda install nltk affine alabaster Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment C:\Users\heath.raftery\AppData\Local\Continuum\Anaconda3: The following NEW packages will be INSTALLED: affine: 2.0.0-py36_0 The following packages will be UPDATED: alabaster: 0.7.9-py36_0 --> 0.7.10-py36_0 Proceed ([y]/n)? n Exiting ``` What version of Conda are you using? This does not happen in the recent versions of conda. `conda update conda` will update your conda to most recent version. ``` conda install nltk qtpy Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment /Users/tkim/miniconda3: The following NEW packages will be INSTALLED: qtpy: 1.2.1-py27_0 The following packages will be SUPERSEDED by a higher-priority channel: nltk: 3.2.2-py27_0 conda-forge --> 3.2.2-py27_0 Proceed ([y]/n)? n ``` `conda 4.3.17 py36_0` I only ran `conda update conda` moments before producing the bug report so I suspect it's up to date. Your results revealed a clarification though: the issue only occurs for packages **already installed and up to date**. Observe: ``` >conda install nltk Fetching package metadata ........... Solving package specifications: . # All requested packages already installed. # packages in environment at C:\Users\heath.raftery\AppData\Local\Continuum\Anaconda3: # nltk 3.2.2 py36_0 >conda install nltk qtpy Fetching package metadata ........... Solving package specifications: . # All requested packages already installed. # packages in environment at C:\Users\heath.raftery\AppData\Local\Continuum\Anaconda3: # >conda install nltk affine alabaster Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment C:\Users\heath.raftery\AppData\Local\Continuum\Anaconda3: The following NEW packages will be INSTALLED: affine: 2.0.0-py36_0 The following packages will be UPDATED: alabaster: 0.7.9-py36_0 --> 0.7.10-py36_0 Proceed ([y]/n)? n Exiting ```
2017-05-04T04:49:55
conda/conda
5,221
conda__conda-5221
[ "5207" ]
052a5e7355297db55e49b39957b5f7e4114ce223
diff --git a/conda/models/channel.py b/conda/models/channel.py --- a/conda/models/channel.py +++ b/conda/models/channel.py @@ -410,14 +410,12 @@ def prioritize_channels(channels, with_credentials=True, subdirs=None): # number as the value # ('https://conda.anaconda.org/conda-forge/osx-64/', ('conda-forge', 1)) result = odict() - q = -1 # channel priority counter - for chn in channels: + for channel_priority, chn in enumerate(channels): channel = Channel(chn) for url in channel.urls(with_credentials, subdirs): if url in result: continue - q += 1 - result[url] = channel.canonical_name, min(q, MAX_CHANNEL_PRIORITY - 1) + result[url] = channel.canonical_name, min(channel_priority, MAX_CHANNEL_PRIORITY - 1) return result
diff --git a/tests/models/test_channel.py b/tests/models/test_channel.py --- a/tests/models/test_channel.py +++ b/tests/models/test_channel.py @@ -789,11 +789,11 @@ def test_env_var_file_urls(self): prioritized = prioritize_channels(new_context.channels) assert prioritized == OrderedDict(( ("file://network_share/shared_folder/path/conda/%s" % context.subdir, ("file://network_share/shared_folder/path/conda", 0)), - ("file://network_share/shared_folder/path/conda/noarch", ("file://network_share/shared_folder/path/conda", 1)), - ("https://some.url/ch_name/%s" % context.subdir, ("https://some.url/ch_name", 2)), - ("https://some.url/ch_name/noarch", ("https://some.url/ch_name", 3)), - ("file:///some/place/on/my/machine/%s" % context.subdir, ("file:///some/place/on/my/machine", 4)), - ("file:///some/place/on/my/machine/noarch", ("file:///some/place/on/my/machine", 5)), + ("file://network_share/shared_folder/path/conda/noarch", ("file://network_share/shared_folder/path/conda", 0)), + ("https://some.url/ch_name/%s" % context.subdir, ("https://some.url/ch_name", 1)), + ("https://some.url/ch_name/noarch", ("https://some.url/ch_name", 1)), + ("file:///some/place/on/my/machine/%s" % context.subdir, ("file:///some/place/on/my/machine", 2)), + ("file:///some/place/on/my/machine/noarch", ("file:///some/place/on/my/machine", 2)), )) def test_subdirs(self): @@ -816,19 +816,19 @@ def _channel_urls(channels=None): prioritized = prioritize_channels(channels) assert prioritized == OrderedDict(( ("https://conda.anaconda.org/bioconda/linux-highest", ("bioconda", 0)), - ("https://conda.anaconda.org/bioconda/linux-64", ("bioconda", 1)), - ("https://conda.anaconda.org/bioconda/noarch", ("bioconda", 2)), - ("https://conda.anaconda.org/conda-forge/linux-highest", ("conda-forge", 3)), - ("https://conda.anaconda.org/conda-forge/linux-64", ("conda-forge", 4)), - ("https://conda.anaconda.org/conda-forge/noarch", ("conda-forge", 5)), + ("https://conda.anaconda.org/bioconda/linux-64", ("bioconda", 0)), + ("https://conda.anaconda.org/bioconda/noarch", ("bioconda", 0)), + ("https://conda.anaconda.org/conda-forge/linux-highest", ("conda-forge", 1)), + ("https://conda.anaconda.org/conda-forge/linux-64", ("conda-forge", 1)), + ("https://conda.anaconda.org/conda-forge/noarch", ("conda-forge", 1)), )) prioritized = prioritize_channels(channels, subdirs=('linux-again', 'noarch')) assert prioritized == OrderedDict(( ("https://conda.anaconda.org/bioconda/linux-again", ("bioconda", 0)), - ("https://conda.anaconda.org/bioconda/noarch", ("bioconda", 1)), - ("https://conda.anaconda.org/conda-forge/linux-again", ("conda-forge", 2)), - ("https://conda.anaconda.org/conda-forge/noarch", ("conda-forge", 3)), + ("https://conda.anaconda.org/bioconda/noarch", ("bioconda", 0)), + ("https://conda.anaconda.org/conda-forge/linux-again", ("conda-forge", 1)), + ("https://conda.anaconda.org/conda-forge/noarch", ("conda-forge", 1)), ))
Lower version platform pkgs preferred to newer noarch. 4.3.17 regression With `conda 4.3.17` the solver prefers ~~Windows~~ platform-specific packages over `noarch` even if the `noarch` version has a higher version number. This ~~is not observable on a Linux and also~~ works fine ~~on Windows~~ for `conda 4.3.16`. See the following: ```batch (C:\home\maba\conda\miniconda-win64) C:\home\maba\conda\miniconda-win64\maba>conda create --dry-run -n tmp -c genomeinformatics amplikyzer2 Fetching package metadata ............... Solving package specifications: . Package plan for installation in environment C:\home\maba\conda\miniconda-win64\envs\tmp: The following NEW packages will be INSTALLED: amplikyzer2: 1.2.0-0 genomeinformatics cycler: 0.10.0-py36_0 icu: 57.1-vc14_0 [vc14] jpeg: 9b-vc14_0 [vc14] libpng: 1.6.27-vc14_0 [vc14] llvmlite: 0.17.0-py36_0 matplotlib: 2.0.0-np112py36_0 mkl: 2017.0.1-0 numba: 0.32.0-np112py36_0 numpy: 1.12.1-py36_0 openssl: 1.0.2k-vc14_0 [vc14] pip: 9.0.1-py36_1 pyparsing: 2.1.4-py36_0 pyqt: 5.6.0-py36_2 python: 3.6.1-0 python-dateutil: 2.6.0-py36_0 pytz: 2017.2-py36_0 qt: 5.6.2-vc14_3 [vc14] setuptools: 27.2.0-py36_1 sip: 4.18-py36_0 six: 1.10.0-py36_0 tk: 8.5.18-vc14_0 [vc14] vs2015_runtime: 14.0.25123-0 wheel: 0.29.0-py36_0 zlib: 1.2.8-vc14_3 [vc14] (C:\home\maba\conda\miniconda-win64) C:\home\maba\conda\miniconda-win64\maba>conda --version conda 4.3.16 ``` `amplikyzer2 1.2.0` is the most recent version and uses `noarch: python`. After updating to `conda 4.3.17`, an outdated version is selected: ```batch (C:\home\maba\conda\miniconda-win64) C:\home\maba\conda\miniconda-win64\maba>conda update conda Fetching package metadata ............... Solving package specifications: . Package plan for installation in environment C:\home\maba\conda\miniconda-win64: The following packages will be UPDATED: conda: 4.3.16-py35_0 --> 4.3.17-py35_0 Proceed ([y]/n)? conda-4.3.17-p 100% |###############################| Time: 0:00:00 2.42 MB/s (C:\home\maba\conda\miniconda-win64) C:\home\maba\conda\miniconda-win64\maba>conda create --dry-run -n tmp -c genomeinformatics amplikyzer2 Fetching package metadata ............... Solving package specifications: . Package plan for installation in environment C:\home\maba\conda\miniconda-win64\envs\tmp: The following NEW packages will be INSTALLED: amplikyzer2: 1.1.2-0 genomeinformatics cycler: 0.10.0-py36_0 icu: 57.1-vc14_0 [vc14] jpeg: 9b-vc14_0 [vc14] libpng: 1.6.27-vc14_0 [vc14] llvmlite: 0.17.0-py36_0 matplotlib: 2.0.0-np112py36_0 mkl: 2017.0.1-0 numba: 0.32.0-np112py36_0 numpy: 1.12.1-py36_0 openssl: 1.0.2k-vc14_0 [vc14] pip: 9.0.1-py36_1 pyparsing: 2.1.4-py36_0 pyqt: 5.6.0-py36_2 python: 3.6.1-0 python-dateutil: 2.6.0-py36_0 pytz: 2017.2-py36_0 qt: 5.6.2-vc14_3 [vc14] setuptools: 27.2.0-py36_1 sip: 4.18-py36_0 six: 1.10.0-py36_0 tk: 8.5.18-vc14_0 [vc14] vs2015_runtime: 14.0.25123-0 wheel: 0.29.0-py36_0 zlib: 1.2.8-vc14_3 [vc14] ``` `amplikyzer2 1.1.2-0` is the last platform-specific Windows build, but of course is superseded by `1.2.0`. The same also happens for `conda install amplikyzer2` and `conda update amplikyzer2`. If the version is explicitly given, e.g., `conda install amplikyzer2=1.2.0`, the newest version is correctly installed. Running `conda update amplikyzer2` afterwards will try to downgrade to `1.1.2-0` again.
Scratch that about being Windows-specific -- I accidentally didn't really update to `conda 4.3.17` on Linux. Now with properly updated to `4.3.17` the same behavior is shown on Linux too. I see #5030 introduced this. As I understand this, after #5030 the platform-specific and `noarch` directory in effect get treated as separate channels with `noarch` always having a lower priority. Thus adding `--no-channel-priority` shows the expected result: ```bash $ conda --version conda 4.3.17 ``` ```bash $ conda create --dry-run -n tmp -c genomeinformatics amplikyzer2 Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment /home/maba/miniconda3/envs/tmp: The following NEW packages will be INSTALLED: amplikyzer2: 1.1.5-py36_8 genomeinformatics ... ``` ```bash $ conda create --dry-run -n tmp -c genomeinformatics amplikyzer2 --no-channel-priority Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment /home/maba/miniconda3/envs/tmp: The following NEW packages will be INSTALLED: amplikyzer2: 1.2.0-0 genomeinformatics ... ``` I strongly feel this is undesirable behavior and that *inside a single channel*, the package version must have the highest priority. Only on a version number tie should the platform-dependent build be preferred.
2017-05-04T15:53:58
conda/conda
5,226
conda__conda-5226
[ "4224" ]
534824e1083df9a7df2fc2b84464965991c44caf
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -221,7 +221,7 @@ def verify(self): # with max_retries = 2, max total time ~= 0.4 sec # with max_retries = 6, max total time ~= 6.5 sec count = self.transaction_context.get('_verify_backoff_count', 0) - max_retries = 6 if count < 2 else 2 + max_retries = 6 if count < 4 else 3 for n in range(max_retries): sleep_time = ((2 ** n) + random()) * 0.1 log.trace("retrying lexists(%s) in %g sec", self.source_full_path, sleep_time) diff --git a/conda/core/repodata.py b/conda/core/repodata.py --- a/conda/core/repodata.py +++ b/conda/core/repodata.py @@ -17,7 +17,7 @@ import warnings from requests import ConnectionError, HTTPError -from requests.exceptions import SSLError +from requests.exceptions import InvalidSchema, SSLError from requests.packages.urllib3.exceptions import InsecureRequestWarning from .. import CondaError, iteritems @@ -26,11 +26,11 @@ from .._vendor.auxlib.logz import stringify from ..base.constants import CONDA_HOMEPAGE_URL from ..base.context import context -from ..common.compat import ensure_binary, ensure_text_type, ensure_unicode +from ..common.compat import ensure_binary, ensure_text_type, ensure_unicode, text_type from ..common.url import join_url, maybe_unquote from ..connection import CondaSession from ..core.package_cache import PackageCache -from ..exceptions import CondaHTTPError, CondaIndexError +from ..exceptions import CondaDependencyError, CondaHTTPError, CondaIndexError from ..gateways.disk.delete import rm_rf from ..gateways.disk.update import touch from ..models.channel import Channel @@ -154,9 +154,17 @@ def maybe_decompress(filename, resp_content): add_http_value_to_dict(resp, 'Last-Modified', fetched_repodata, '_mod') add_http_value_to_dict(resp, 'Cache-Control', fetched_repodata, '_cache_control') return fetched_repodata - - except ValueError as e: - raise CondaIndexError("Invalid index file: {0}: {1}".format(join_url(url, filename), e)) + except InvalidSchema as e: + if 'SOCKS' in text_type(e): + message = dals(""" + Requests has identified that your current working environment is configured + to use a SOCKS proxy, but pysocks is not installed. To proceed, remove your + proxy configuration, run `conda install pysocks`, and then you can re-enable + your proxy configuration. + """) + raise CondaDependencyError(message) + else: + raise except (ConnectionError, HTTPError, SSLError) as e: # status_code might not exist on SSLError @@ -305,6 +313,9 @@ def maybe_decompress(filename, resp_content): getattr(e.response, 'elapsed', None), e.response) + except ValueError as e: + raise CondaIndexError("Invalid index file: {0}: {1}".format(join_url(url, filename), e)) + def write_pickled_repodata(cache_path, repodata): # Don't bother to pickle empty channels diff --git a/conda/gateways/download.py b/conda/gateways/download.py --- a/conda/gateways/download.py +++ b/conda/gateways/download.py @@ -7,14 +7,16 @@ from threading import Lock import warnings -from requests.exceptions import ConnectionError, HTTPError, SSLError +from requests.exceptions import ConnectionError, HTTPError, InvalidSchema, SSLError from .. import CondaError from .._vendor.auxlib.ish import dals from .._vendor.auxlib.logz import stringify from ..base.context import context +from ..common.compat import text_type from ..connection import CondaSession -from ..exceptions import BasicClobberError, CondaHTTPError, MD5MismatchError, maybe_raise +from ..exceptions import (BasicClobberError, CondaDependencyError, CondaHTTPError, + MD5MismatchError, maybe_raise) log = getLogger(__name__) @@ -116,6 +118,18 @@ def download(url, target_full_path, md5sum): "trying again" % (url, digest_builder.hexdigest(), md5sum)) raise MD5MismatchError(url, target_full_path, md5sum, actual_md5sum) + except InvalidSchema as e: + if 'SOCKS' in text_type(e): + message = dals(""" + Requests has identified that your current working environment is configured + to use a SOCKS proxy, but pysocks is not installed. To proceed, remove your + proxy configuration, run `conda install pysocks`, and then you can re-enable + your proxy configuration. + """) + raise CondaDependencyError(message) + else: + raise + except (ConnectionError, HTTPError, SSLError) as e: help_message = dals(""" An HTTP error occurred when trying to retrieve this URL.
Can not create a new conda environment/clean conda I have just installed anaconda 4.2.0 on my system Ubuntu 16.04. As the default version of python is 3.5.2, i tried to create a new environment for Python 2.7 but it was impossible. I then tried to clean conda but this issue occured: Current conda install: platform : linux-64 conda version : 4.2.9 conda is private : False conda-env version : 4.2.9 conda-build version : 2.0.2 python version : 3.5.2.final.0 requests version : 2.11.1 root environment : /home/huy/anaconda3 (writable) default environment : /home/huy/anaconda3 envs directories : /home/huy/anaconda3/envs package cache : /home/huy/anaconda3/pkgs channel URLs : https://repo.continuum.io/pkgs/free/linux-64/ https://repo.continuum.io/pkgs/free/noarch/ https://repo.continuum.io/pkgs/pro/linux-64/ https://repo.continuum.io/pkgs/pro/noarch/ config file : None offline mode : False `$ /home/huy/anaconda3/bin/conda install anaconda-clean` Traceback (most recent call last): File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 112, in fetch_repodata timeout=(3.05, 60)) File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 488, in get return self.request('GET', url, **kwargs) File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 475, in request resp = self.send(prep, **send_kwargs) File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 596, in send r = adapter.send(request, **kwargs) File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 390, in send conn = self.get_connection(request.url, proxies) File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 290, in get_connection proxy_manager = self.proxy_manager_for(proxy) File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 184, in proxy_manager_for **proxy_kwargs File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 43, in SOCKSProxyManager raise InvalidSchema("Missing dependencies for SOCKS support.") requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 287, in fetch_index repodatas = [(u, f.result()) for u, f in zip(urls, futures)] File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 287, in <listcomp> repodatas = [(u, f.result()) for u, f in zip(urls, futures)] File "/home/huy/anaconda3/lib/python3.5/concurrent/futures/_base.py", line 405, in result return self.__get_result() File "/home/huy/anaconda3/lib/python3.5/concurrent/futures/_base.py", line 357, in __get_result raise self._exception File "/home/huy/anaconda3/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 70, in func res = f(*args, **kwargs) File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 137, in fetch_repodata .format(url, filename, e)) conda.exceptions.CondaRuntimeError: Runtime error: Invalid index file: https://repo.continuum.io/pkgs/free/linux-64/repodata.json.bz2: Missing dependencies for SOCKS support. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 112, in fetch_repodata timeout=(3.05, 60)) File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 488, in get return self.request('GET', url, **kwargs) File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 475, in request resp = self.send(prep, **send_kwargs) File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 596, in send r = adapter.send(request, **kwargs) File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 390, in send conn = self.get_connection(request.url, proxies) File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 290, in get_connection proxy_manager = self.proxy_manager_for(proxy) File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 184, in proxy_manager_for **proxy_kwargs File "/home/huy/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 43, in SOCKSProxyManager raise InvalidSchema("Missing dependencies for SOCKS support.") requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/exceptions.py", line 473, in conda_exception_handler return_value = func(*args, **kwargs) File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/cli/main.py", line 144, in _main exit_code = args.func(args, p) File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/cli/install.py", line 238, in install prefix=prefix) File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/api.py", line 24, in get_index index = fetch_index(channel_urls, use_cache=use_cache, unknown=unknown) File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 293, in fetch_index for url in urls] File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 293, in <listcomp> for url in urls] File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 70, in func res = f(*args, **kwargs) File "/home/huy/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 137, in fetch_repodata .format(url, filename, e)) conda.exceptions.CondaRuntimeError: Runtime error: Invalid index file: https://repo.continuum.io/pkgs/free/linux-64/repodata.json.bz2: Missing dependencies for SOCKS support. What can I do to repair it?
@vovanhuy Could you please share the output for: `env | grep -i proxy` I suspect that you are behind a (corporate?) http(s?)-proxy, but you have accidentally also added it as a socks proxy in the network configuration in Ubuntu, which also creates the environment variable: SOCKS_PROXY Yes, you are right. I added proxy for both http(s) and socks. However, when I tried to delete anaconda 4.2.0 and use 4.1.1, everything is ok. Perhaps conda should provide a better error message/resolution. I had mentioned a fix/workaround for this in https://github.com/conda/conda/issues/3838. Conda doesn't mention whether it officially supports SOCKS proxy at http://conda.pydata.org/docs/config.html#configure-conda-for-use-behind-a-proxy-server-proxy-servers . Perhaps the docs should explicitly mention that? Or, if it does support, then perhaps mention the order in which different types of proxies are checked. conda install pysocks requests will use pysocks if it's available. If you have environment configuration (either a .netrc file or environment variables) that instruct requests to use a socks proxy, then requests will complain if it's not installed.
2017-05-04T20:51:27
conda/conda
5,228
conda__conda-5228
[ "4987", "4987" ]
194d2ee2251dc07a7d4b71c5ea26f6a0e9215dc0
diff --git a/conda/cli/install.py b/conda/cli/install.py --- a/conda/cli/install.py +++ b/conda/cli/install.py @@ -10,7 +10,6 @@ import logging import os from os.path import abspath, basename, exists, isdir, join -import re from . import common from .._vendor.auxlib.ish import dals @@ -321,10 +320,7 @@ def install(args, parser, command='install'): if context.json: common.stdout_json_success(message='All requested packages already installed.') else: - from .main_list import print_packages - spec_regex = r'^(%s)$' % '|'.join(re.escape(s.split()[0]) for s in ospecs) - print('\n# All requested packages already installed.') - print_packages(prefix, spec_regex) + print('\n# All requested packages already installed.\n') return if not context.json:
change results from conda update --all I run my conda update commands in a script and have to wade through the entire list of installed packages to see results. Is it possible to default the results from the update command to `# All requested packages already installed.` without the list? Thanks change results from conda update --all I run my conda update commands in a script and have to wade through the entire list of installed packages to see results. Is it possible to default the results from the update command to `# All requested packages already installed.` without the list? Thanks
2017-05-05T00:17:06
conda/conda
5,231
conda__conda-5231
[ "3489" ]
194d2ee2251dc07a7d4b71c5ea26f6a0e9215dc0
diff --git a/conda/cli/main_remove.py b/conda/cli/main_remove.py --- a/conda/cli/main_remove.py +++ b/conda/cli/main_remove.py @@ -9,7 +9,7 @@ from argparse import RawDescriptionHelpFormatter from collections import defaultdict import logging -from os.path import abspath, join +from os.path import abspath, join, isdir import sys from .conda_argparse import (add_parser_channels, add_parser_help, add_parser_json, @@ -130,6 +130,10 @@ def execute(args, parser): 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 + ensure_use_local(args) ensure_override_channels_requires_channel(args) if not args.features and args.all:
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -1126,6 +1126,9 @@ def test_force_remove(self): stdout, stderr = run_command(Commands.REMOVE, prefix, "flask") assert not package_is_installed(prefix, "flask-") + # regression test for #3489 + # don't raise for remove --all if environment doesn't exist + run_command(Commands.REMOVE, prefix, "--all") def test_transactional_rollback_simple(self): from conda.core.path_actions import CreateLinkedPackageRecordAction
conda remove --all behavior changed in 4.2.7 `conda remove --all` used to remove an environment if it existed, and quietly succeed if it was already gone. Now this command fails when the environment does not exist. This makes something formerly easy to do in an automated way now difficult especially in a cross-platform way on Windows. ``` C:\>conda remove --all -n nonenv CondaEnvironmentNotFoundError: Could not find environment: nonenv . You can list all discoverable environments with `conda info --envs`. C:\>echo %ERRORLEVEL% 1 ``` Just suppressing the error is not appealing, because there are many error modes different from the environment not existing that should trigger a failure.
Still exists in conda 4.3.x ``` kfranz@0283:~/continuum/conda *4.3.x ❯ python -m conda remove --all -n flub CondaEnvironmentNotFoundError: Could not find environment: flub . You can list all discoverable environments with `conda info --envs`. ``` I hate that we didn't get to this sooner. At this point, I don't know if we should change it in the 4.3.x branch. I'm happy to revert the behavior in 4.4 though.
2017-05-05T01:05:19
conda/conda
5,232
conda__conda-5232
[ "598" ]
0eddaa3089822cec0394b69b3c6a9ac294afafef
diff --git a/conda/cli/main_config.py b/conda/cli/main_config.py --- a/conda/cli/main_config.py +++ b/conda/cli/main_config.py @@ -423,8 +423,12 @@ def clean_element_type(element_types): # config.rc_keys if not args.get: - with open(rc_path, 'w') as rc: - rc.write(yaml_dump(rc_config)) + 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\n' + 'Caused by %r' % (rc_path, e)) if context.json: stdout_json_success(
conda config stack trace when can't write config file This situation should be handled nicer. `conda config` doesn't have permission to write the config file. Thanks. ``` 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' ``` <!--- @huboard:{"order":9.781875224740546e-29,"custom_state":""} -->
2017-05-05T02:31:42
conda/conda
5,236
conda__conda-5236
[ "4960" ]
8807d9c06470d6262d986f330b10f610f4d95e12
diff --git a/conda/__init__.py b/conda/__init__.py --- a/conda/__init__.py +++ b/conda/__init__.py @@ -44,7 +44,19 @@ def __repr__(self): return '%s: %s' % (self.__class__.__name__, text_type(self)) def __str__(self): - return text_type(self.message % self._kwargs) + try: + return text_type(self.message % self._kwargs) + except TypeError: + # TypeError: not enough arguments for format string + debug_message = "\n".join(( + "class: " + self.__class__.__name__, + "message:", + self.message, + "kwargs:", + text_type(self._kwargs), + )) + sys.stderr.write(debug_message) + raise def dump_map(self): result = dict((k, v) for k, v in iteritems(vars(self)) if not k.startswith('_'))
An unexpected error has occurred. Current conda install: platform : win-64 conda version : 4.3.11 conda is private : False conda-env version : 4.3.11 conda-build version : 2.0.2 python version : 2.7.12.final.0 requests version : 2.13.0 root environment : I:\Program Files\Anaconda2 (writable) default environment : I:\Program Files\Anaconda2 envs directories : I:\Program Files\Anaconda2\envs C:\Users\topnet\AppData\Local\conda\conda\envs C:\Users\topnet\.conda\envs package cache : I:\Program Files\Anaconda2\pkgs C:\Users\topnet\AppData\Local\conda\conda\pkgs channel URLs : https://conda.anaconda.org/conda-forge/win-64 https://conda.anaconda.org/conda-forge/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/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 file : C:\Users\topnet\.condarc offline mode : False user-agent : conda/4.3.11 requests/2.13.0 CPython/2.7.12 Windows/10 Windows/10.0.14393 `$ I:\Program Files\Anaconda2\Scripts\conda-script.py install numpy` Traceback (most recent call last): File "I:\Program Files\Anaconda2\lib\site-packages\conda\exceptions.py", line 616, in conda_exception_handler return_value = func(*args, **kwargs) File "I:\Program Files\Anaconda2\lib\site-packages\conda\cli\main.py", line 137, in _main exit_code = args.func(args, p) File "I:\Program Files\Anaconda2\lib\site-packages\conda\cli\main_install.py", line 80, in execute install(args, parser, 'install') File "I:\Program Files\Anaconda2\lib\site-packages\conda\cli\install.py", line 359, in install execute_actions(actions, index, verbose=not context.quiet) File "I:\Program Files\Anaconda2\lib\site-packages\conda\plan.py", line 825, in execute_actions execute_instructions(plan, index, verbose) File "I:\Program Files\Anaconda2\lib\site-packages\conda\instructions.py", line 258, in execute_instructions cmd(state, arg) File "I:\Program Files\Anaconda2\lib\site-packages\conda\instructions.py", line 111, in PROGRESSIVEFETCHEXTRACT_CMD progressive_fetch_extract.execute() File "I:\Program Files\Anaconda2\lib\site-packages\conda\core\package_cache.py", line 470, in execute self._execute_action(action) File "I:\Program Files\Anaconda2\lib\site-packages\conda\core\package_cache.py", line 486, in _execute_action exceptions.append(CondaError(repr(e))) File "I:\Program Files\Anaconda2\lib\site-packages\conda\__init__.py", line 43, in __repr__ return '%s: %s\n' % (self.__class__.__name__, text_type(self)) File "I:\Program Files\Anaconda2\lib\site-packages\conda\__init__.py", line 46, in __str__ return text_type(self.message % self._kwargs) TypeError: not enough arguments for format string thanks!
Do you face the same error with Conda v4.3.14? Could you please attach output for: ``` I:\Program Files\Anaconda2\Scripts\conda-script.py install numpy -vvv ```
2017-05-05T15:30:58
conda/conda
5,239
conda__conda-5239
[ "4974" ]
8807d9c06470d6262d986f330b10f610f4d95e12
diff --git a/conda/core/link.py b/conda/core/link.py --- a/conda/core/link.py +++ b/conda/core/link.py @@ -104,8 +104,9 @@ class UnlinkLinkTransaction(object): @classmethod 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) + 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"
condo update --all Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : osx-64 conda version : 4.3.15 conda is private : False conda-env version : 4.3.15 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : /Users/luisaalanizcastillo/anaconda (writable) default environment : /Users/luisaalanizcastillo/anaconda envs directories : /Users/luisaalanizcastillo/anaconda/envs /Users/luisaalanizcastillo/.conda/envs package cache : /Users/luisaalanizcastillo/anaconda/pkgs /Users/luisaalanizcastillo/.conda/pkgs channel URLs : https://conda.anaconda.org/anaconda-fusion/osx-64 https://conda.anaconda.org/anaconda-fusion/noarch https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : /Users/luisaalanizcastillo/.condarc offline mode : False user-agent : conda/4.3.15 requests/2.12.4 CPython/3.6.0 Darwin/16.5.0 OSX/10.12.4 UID:GID : 501:20 `$ /Users/luisaalanizcastillo/anaconda/bin/conda update --all` 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'
Can someone tell me what happened above that I couldn't update all packages with conda update --all Hi @laacdm could you run the command in verbose mode and attach a .txt file with the whole output? `$ /Users/luisaalanizcastillo/anaconda/bin/conda update --all -v -v -v`
2017-05-05T16:13:48
conda/conda
5,241
conda__conda-5241
[ "4151" ]
c2136f17e0fdd693e73d035c08742ad995654ab2
diff --git a/conda/cli/main_info.py b/conda/cli/main_info.py --- a/conda/cli/main_info.py +++ b/conda/cli/main_info.py @@ -223,7 +223,10 @@ def get_info_dict(system=False): user_agent=user_agent, conda_location=CONDA_PACKAGE_ROOT, ) - if not on_win: + 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() @@ -275,10 +278,10 @@ def get_main_info_str(info_dict): user-agent : %(user_agent)s\ """) % info_dict) - if not on_win: - builder.append(" UID:GID : %(UID)s:%(GID)s" % info_dict) + if on_win: + builder.append(" administrator : %(is_windows_admin)s" % info_dict) else: - builder.append("") + builder.append(" UID:GID : %(UID)s:%(GID)s" % info_dict) return '\n'.join(builder) diff --git a/conda/common/platform.py b/conda/common/platform.py --- a/conda/common/platform.py +++ b/conda/common/platform.py @@ -7,12 +7,26 @@ from logging import getLogger import sys +from .compat import iteritems, on_win from .._vendor.auxlib.decorators import memoize -from .compat import iteritems log = getLogger(__name__) +def is_admin_on_windows(): # pragma: unix no cover + # http://stackoverflow.com/a/1026626/2127762 + if not on_win: # pragma: no cover + return False + try: + from ctypes.windll.shell32 import IsUserAnAdmin + return IsUserAnAdmin() != 0 + except ImportError: + return 'unknown' + except Exception as e: + log.warn(repr(e)) + return 'unknown' + + @memoize def linux_get_libc_version(): """
conda info to show a bit more about operating system There is some general architecture and bit-width information in the `conda info` output but it would be really handy for debugging if we provided a few more hints that would allow someone looking at the output to make a good guess as to: * Windows version (7, 8, 10, etc) * Linux variant and version (CentOS, RHEL, SUSE, etc.) * Special privileges of user running `conda` command (root, Administrator) * Variations in ownership between "root" Conda environment and user executing `conda info`
4.3.x conda info OSX ``` kfranz@0283:~/continuum/conda *4.3.x ❯ python -m conda info Current conda install: platform : osx-64 conda version : 4.3.17.post60+8807d9c06 conda is private : False conda-env version : 4.3.17.post60+8807d9c06 conda-build version : 2.1.10+6.g99aaa148 python version : 3.5.2.final.0 requests version : 2.10.0 root environment : /usr/local/bin/../Cellar/python3/3.5.2_1/bin/../Frameworks/Python.framework/Versions/3.5 (writable) default environment : /usr/local/bin/../Cellar/python3/3.5.2_1/bin/../Frameworks/Python.framework/Versions/3.5 envs directories : /usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/envs /Users/kfranz/.conda/envs package cache : /usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/pkgs /Users/kfranz/.conda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : /Users/kfranz/.condarc offline mode : False user-agent : conda/4.3.17.post60+8807d9c06 requests/2.10.0 CPython/3.5.2 Darwin/16.5.0 OSX/10.12.4 UID:GID : 502:20 ``` windows ``` Current conda install: platform : win-64 conda version : 4.3.11 conda is private : False conda-env version : 4.3.11 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : C:\Python36_64 (writable) default environment : C:\Python36_64 envs directories : C:\Python36_64\envs C:\Users\appveyor\AppData\Local\conda\conda\envs C:\Users\appveyor\.conda\envs package cache : C:\Python36_64\pkgs C:\Users\appveyor\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 : None offline mode : False user-agent : conda/4.3.11 requests/2.12.4 CPython/3.6.0 Windows/2012ServerR2 Windows/6.3.9600 ``` linux ``` Current conda install: platform : linux-64 conda version : 4.3.17.post61+81fba00d conda is private : False conda-env version : 4.3.17.post61+81fba00d conda-build version : not installed python version : 3.6.1.final.0 requests version : 2.13.0 root environment : /home/ubuntu/miniconda (writable) default environment : /home/ubuntu/miniconda envs directories : /home/ubuntu/miniconda/envs /home/ubuntu/.conda/envs package cache : /home/ubuntu/miniconda/pkgs /home/ubuntu/.conda/pkgs channel URLs : 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/ubuntu/.condarc offline mode : False user-agent : conda/4.3.17.post61+81fba00d requests/2.13.0 CPython/3.6.1 Linux/3.13.0-117-generic debian/jessie/sid glibc/2.19 UID:GID : 1000:1000 ``` user-agent and UID:GID get us almost all the way there I think. UID:GID isn't applicable on windows. > Windows version (7, 8, 10, etc) Done. `Windows/2012ServerR2 Windows/6.3.9600` > Linux variant and version (CentOS, RHEL, SUSE, etc.) Done. `Linux/3.13.0-117-generic debian/jessie/sid glibc/2.19` > Special privileges of user running conda command (root, Administrator) UID:GID provides this on unix. We should probably figure out how to add something on Windows to answer "is this user running in Admin mode." > Variations in ownership between "root" Conda environment and user executing conda info Done. `root environment : /home/ubuntu/miniconda (writable)` vs `root environment : /usr/local (read only)` from the test at https://travis-ci.org/conda/conda/jobs/228998961#L988 Note UID:GID are actually "effective" uid and gid. This is the information we actually want in this case I think.
2017-05-05T17:31:23
conda/conda
5,249
conda__conda-5249
[ "4516" ]
6fc7a5fbe41d36103b8d7d0bb8df3162d7a9e45a
diff --git a/conda/core/package_cache.py b/conda/core/package_cache.py --- a/conda/core/package_cache.py +++ b/conda/core/package_cache.py @@ -262,6 +262,8 @@ def _add_entry(__packages_map, pkgs_dir, package_filename): if not package_filename.endswith(CONDA_TARBALL_EXTENSION): package_filename += CONDA_TARBALL_EXTENSION + log.trace("adding to package cache %s", join(pkgs_dir, package_filename)) + dist = first(self.urls_data, lambda x: basename(x) == package_filename, apply=Dist) if not dist:
Conda package update error Hi, I am having this error while trying to upgrade scikit-learn package: ``` $ conda update scikit-learn Fetching package metadata ......... Solving package specifications: . Package plan for installation in environment /Users/ivan/anaconda: The following packages will be UPDATED: conda: 4.3.4-py27_0 --> 4.3.9-py27_0 mkl: 11.3.3-0 --> 2017.0.1-0 numexpr: 2.5.2-np110py27_1 --> 2.6.1-np111py27_2 numpy: 1.10.4-py27_2 --> 1.11.3-py27_0 scikit-learn: 0.17.1-np110py27_2 --> 0.18.1-np111py27_1 scipy: 0.17.1-np110py27_1 --> 0.18.1-np111py27_1 Proceed ([y]/n)? y CondaError: dist_name is not a valid conda package: rfoo ```
By the way I have a similar error anytime I invoke conda: ``` [ivan@mbp ~]$ conda upgrade conda Fetching package metadata ......... Solving package specifications: . Package plan for installation in environment /Users/ivan/anaconda: The following packages will be UPDATED: conda: 4.3.4-py27_0 --> 4.3.16-py27_0 Proceed ([y]/n)? y CondaError: dist_name is not a valid conda package: rfoo ``` Any idea? There's something corrupted in your environment. Can you attach the file created from conda update -y conda -vvv | tee output.txt Hi, there is a problem with the command you provided: only the first part before it ask for confirmation goes to output.txt, the remaining goes to the console. I've also tried `conda update -y conda -vvv > output.txt` same problem. Here is the output: [output.txt](https://github.com/conda/conda/files/979110/output.txt) Oh right my mistake conda update -y conda -vvv 2>&1 | tee output.txt Try that, then post the file. Thanks (I am not bash-fluent...), here it is. [output.txt](https://github.com/conda/conda/files/980979/output.txt) Try conda clean --packages --tarballs Current `conda info` is ``` Current conda install: platform : osx-64 conda version : 4.3.4 conda is private : False conda-env version : 4.3.4 conda-build version : 2.0.1 python version : 2.7.12.final.0 requests version : 2.12.4 root environment : /Users/ivan/anaconda (writable) default environment : /Users/ivan/anaconda envs directories : /Users/ivan/anaconda/envs package cache : /Users/ivan/anaconda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : None offline mode : False user-agent : conda/4.3.4 requests/2.12.4 CPython/2.7.12 Darwin/16.5.0 OSX/10.12.4 UID:GID : 501:20 ```
2017-05-08T14:28:20
conda/conda
5,250
conda__conda-5250
[ "5242" ]
6fc7a5fbe41d36103b8d7d0bb8df3162d7a9e45a
diff --git a/conda/gateways/disk/create.py b/conda/gateways/disk/create.py --- a/conda/gateways/disk/create.py +++ b/conda/gateways/disk/create.py @@ -200,6 +200,7 @@ def _do_softlink(src, dst): # A future optimization will be to copy code from @mingwandroid's virtualenv patch. _do_copy(src, dst) else: + log.trace("soft linking %s => %s", src, dst) symlink(src, dst) @@ -209,8 +210,10 @@ def _do_copy(src, dst): src_points_to = readlink(src) if not src_points_to.startswith('/'): # copy relative symlinks as symlinks + log.trace("soft linking %s => %s", src, dst) symlink(src_points_to, dst) return + log.trace("copying %s => %s", src, dst) shutil.copy2(src, dst) @@ -239,6 +242,7 @@ def create_link(src, dst, link_type=LinkType.hardlink, force=False): if isdir(src): raise CondaError("Cannot hard link a directory. %s" % src) try: + log.trace("hard linking %s => %s", src, dst) link(src, dst) except (IOError, OSError) as e: log.debug("hard-link failed. falling back to copy\n"
Argument `--copy` seems to be ignoring when create environment Hello! For several month ago when I created new environment, for example ``` conda create -p E:\JN\dist\pyenv36-win64 --copy python=3 ``` I got a list of packages to be installed and see `(copy)` and the end of each line: ``` The following NEW packages will be INSTALLED: pip: 9.0.1-py36_1 (copy) python: 3.6.1-0 (copy) setuptools: 27.2.0-py36_1 (copy) vs2015_runtime: 14.0.25123-0 (copy) wheel: 0.29.0-py36_0 (copy) Proceed ([y]/n)? y ``` Now I don't see `(copy)` and it seems for me that `--copy` argument is ignoring by conda now. Full log for `conda create -p E:\JN\dist\pyenv36-win64 --copy --debug python=3.6` is below: ``` $ conda create -p E:\JN\dist\pyenv36-win64 --copy --debug python=3.6 DEBUG conda.core.index:fetch_index(106): channel_urls=OrderedDict([('https://conda.anaconda.org/conda-canary/win-64', ('conda-canary', 0)), ('https://conda.anaconda.org/conda-canary/noarch', ('conda-canary', 1)), ('https://repo.continuum.io/pkgs/free/win-64', ('defaults', 2)), ('https://repo.continuum.io/pkgs/free/noarch', ('defaults', 3)), ('https://repo.continuum.io/pkgs/r/win-64', ('defaults', 4)), ('https://repo.continuum.io/pkgs/r/noarch', ('defaults', 5)), ('https://repo.continuum.io/pkgs/pro/win-64', ('defaults', 6)), ('https://repo.continuum.io/pkgs/pro/noarch', ('defaults', 7)), ('https://repo.continuum.io/pkgs/msys2/win-64', ('defaults', 8)), ('https://repo.continuum.io/pkgs/msys2/noarch', ('defaults', 9))]) Fetching package metadata ...DEBUG requests.packages.urllib3.util.retry:from_int(191): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None) DEBUG conda.core.package_cache:is_writable(315): package cache directory 'C:\Users\Andrewin\AppData\Local\conda\conda\pkgs' does not exist DEBUG conda.core.repodata:fetch_repodata(433): Using cached repodata for https://conda.anaconda.org/conda-canary/win-64 at C:\Miniconda3\pkgs\cache\b8f863c0.json. Timeout in 42852 sec DEBUG conda.core.repodata:read_pickled_repodata(328): found pickle file C:\Miniconda3\pkgs\cache\b8f863c0.q .DEBUG conda.core.repodata:fetch_repodata(437): Locally invalidating cached repodata for https://conda.anaconda.org/conda-canary/noarch at C:\Miniconda3\pkgs\cache\3462a2c2.json DEBUG requests.packages.urllib3.connectionpool:_new_conn(809): Starting new HTTPS connection (1): conda.anaconda.org DEBUG requests.packages.urllib3.connectionpool:_make_request(400): https://conda.anaconda.org:443 "GET /conda-canary/noarch/repodata.json HTTP/1.1" 304 0 DEBUG conda.core.repodata:fetch_repodata_remote_request(140): >>GET /conda-canary/noarch/repodata.json HTTPS > User-Agent: conda/4.3.17 requests/2.12.4 CPython/3.6.0 Windows/8.1 Windows/6.3.9600 > Accept: */* > Accept-Encoding: gzip, deflate, compress, identity > Connection: keep-alive > Content-Type: application/json > If-Modified-Since: Wed, 26 Apr 2017 15:44:45 GMT <<HTTPS 304 NOT MODIFIED < CF-RAY: 35aa8c0629db75fa-ARN < Date: Sat, 06 May 2017 08:25:06 GMT < Server: cloudflare-nginx < Set-Cookie: __cfduid=d9d5d0d6a1d9e0eb2da1e2ec9af4bd22d1494059106; expires=Sun, 06-May-18 08:25:06 GMT; path=/; domain=.anaconda.org; HttpOnly < Strict-Transport-Security: max-age=31536000 < Connection: keep-alive < Elapsed: 00:00.822499 DEBUG conda.core.repodata:fetch_repodata(445): 304 NOT MODIFIED for 'https://conda.anaconda.org/conda-canary/noarch'. Updating mtime and loading from disk .DEBUG conda.core.repodata:fetch_repodata(437): Locally invalidating cached repodata for https://repo.continuum.io/pkgs/free/win-64 at C:\Miniconda3\pkgs\cache\2116b818.json DEBUG requests.packages.urllib3.connectionpool:_new_conn(809): Starting new HTTPS connection (1): repo.continuum.io DEBUG requests.packages.urllib3.connectionpool:_make_request(400): https://repo.continuum.io:443 "GET /pkgs/free/win-64/repodata.json.bz2 HTTP/1.1" 304 0 DEBUG conda.core.repodata:fetch_repodata_remote_request(140): >>GET /pkgs/free/win-64/repodata.json.bz2 HTTPS > User-Agent: conda/4.3.17 requests/2.12.4 CPython/3.6.0 Windows/8.1 Windows/6.3.9600 > Accept: */* > Accept-Encoding: identity > Connection: keep-alive > If-Modified-Since: Thu, 04 May 2017 20:27:05 GMT > If-None-Match: "e3950abe838e574867a9352636f33e6a" <<HTTPS 304 Not Modified < Cache-Control: public, max-age=30 < CF-Cache-Status: HIT < CF-RAY: 35aa8c0b6e467642-ARN < Date: Sat, 06 May 2017 08:25:07 GMT < ETag: "e3950abe838e574867a9352636f33e6a" < Expires: Sat, 06 May 2017 08:25:37 GMT < Last-Modified: Thu, 04 May 2017 20:27:05 GMT < Server: cloudflare-nginx < Set-Cookie: __cfduid=d57c5e9ebd048b54082d66851a16bd2291494059107; expires=Sun, 06-May-18 08:25:07 GMT; path=/; domain=.continuum.io; HttpOnly < Vary: Accept-Encoding < x-amz-id-2: t8m0xwaAHqUcQw3TBS8MYQw1ymvNFJJu4VhIM2HgW5U49Dm3H6VXH/c/f91VBNQEqGTNV/qpktY= < x-amz-request-id: 7B0BEC2CEF076457 < x-amz-version-id: fRHuf9paJztvuJSzFTBYK8qKwqG.Wygk < Connection: keep-alive < Elapsed: 00:00.360399 DEBUG conda.core.repodata:fetch_repodata(445): 304 NOT MODIFIED for 'https://repo.continuum.io/pkgs/free/win-64'. Updating mtime and loading from disk DEBUG conda.core.repodata:read_pickled_repodata(328): found pickle file C:\Miniconda3\pkgs\cache\2116b818.q DEBUG conda.core.repodata:read_pickled_repodata(349): setting priority for https://repo.continuum.io/pkgs/free/win-64 to '2' .DEBUG conda.core.repodata:fetch_repodata(437): Locally invalidating cached repodata for https://repo.continuum.io/pkgs/free/noarch at C:\Miniconda3\pkgs\cache\9ca791dd.json DEBUG requests.packages.urllib3.connectionpool:_make_request(400): https://repo.continuum.io:443 "GET /pkgs/free/noarch/repodata.json.bz2 HTTP/1.1" 304 0 DEBUG conda.core.repodata:fetch_repodata_remote_request(140): >>GET /pkgs/free/noarch/repodata.json.bz2 HTTPS > User-Agent: conda/4.3.17 requests/2.12.4 CPython/3.6.0 Windows/8.1 Windows/6.3.9600 > Accept: */* > Accept-Encoding: identity > Connection: keep-alive > Cookie: __cfduid=d57c5e9ebd048b54082d66851a16bd2291494059107 > If-Modified-Since: Thu, 04 May 2017 12:56:45 GMT > If-None-Match: "a6904a831b6eccb5bdc942dc1279eebd" <<HTTPS 304 Not Modified < Cache-Control: public, max-age=30 < CF-Cache-Status: HIT < CF-RAY: 35aa8c0d4fc17642-ARN < Date: Sat, 06 May 2017 08:25:07 GMT < ETag: "a6904a831b6eccb5bdc942dc1279eebd" < Expires: Sat, 06 May 2017 08:25:37 GMT < Last-Modified: Thu, 04 May 2017 12:56:45 GMT < Server: cloudflare-nginx < Vary: Accept-Encoding < x-amz-id-2: tyULh1eItAt9yTYiGBQv+rM82WKMj1+0TkHbF0MfUuea4w3WsepIy5+C4HDzWMv/BZ7FnDanxxQ= < x-amz-request-id: 7F6DF7594915EFB2 < x-amz-version-id: F23BVu3PDZHWtygp_K85M1TDNTtS5OxS < Connection: keep-alive < Elapsed: 00:00.062590 DEBUG conda.core.repodata:fetch_repodata(445): 304 NOT MODIFIED for 'https://repo.continuum.io/pkgs/free/noarch'. Updating mtime and loading from disk DEBUG conda.core.repodata:read_pickled_repodata(328): found pickle file C:\Miniconda3\pkgs\cache\9ca791dd.q DEBUG conda.core.repodata:read_pickled_repodata(349): setting priority for https://repo.continuum.io/pkgs/free/noarch to '3' .DEBUG conda.core.repodata:fetch_repodata(437): Locally invalidating cached repodata for https://repo.continuum.io/pkgs/r/win-64 at C:\Miniconda3\pkgs\cache\bf91db7e.json DEBUG requests.packages.urllib3.connectionpool:_make_request(400): https://repo.continuum.io:443 "GET /pkgs/r/win-64/repodata.json.bz2 HTTP/1.1" 304 0 DEBUG conda.core.repodata:fetch_repodata_remote_request(140): >>GET /pkgs/r/win-64/repodata.json.bz2 HTTPS > User-Agent: conda/4.3.17 requests/2.12.4 CPython/3.6.0 Windows/8.1 Windows/6.3.9600 > Accept: */* > Accept-Encoding: identity > Connection: keep-alive > Cookie: __cfduid=d57c5e9ebd048b54082d66851a16bd2291494059107 > If-Modified-Since: Thu, 04 May 2017 12:58:13 GMT > If-None-Match: "aefbab58fa92f36d20ff751f63c79fdf" <<HTTPS 304 Not Modified < Cache-Control: public, max-age=30 < CF-Cache-Status: HIT < CF-RAY: 35aa8c0dc8177642-ARN < Date: Sat, 06 May 2017 08:25:07 GMT < ETag: "aefbab58fa92f36d20ff751f63c79fdf" < Expires: Sat, 06 May 2017 08:25:37 GMT < Last-Modified: Thu, 04 May 2017 12:58:13 GMT < Server: cloudflare-nginx < Vary: Accept-Encoding < x-amz-id-2: miVa8sNWW+x0NCcSMPrDuYX4EbzhMexgrJoaRvVlcOHfXbhDm7ILU7l3LBeY/bmYI8bdHOCbIHk= < x-amz-request-id: EACCF79283C1394C < x-amz-version-id: G4DWkhTiSPq_tOAHAx.FIxGOr.NzUCmO < Connection: keep-alive < Elapsed: 00:00.061681 DEBUG conda.core.repodata:fetch_repodata(445): 304 NOT MODIFIED for 'https://repo.continuum.io/pkgs/r/win-64'. Updating mtime and loading from disk DEBUG conda.core.repodata:read_pickled_repodata(328): found pickle file C:\Miniconda3\pkgs\cache\bf91db7e.q DEBUG conda.core.repodata:read_pickled_repodata(349): setting priority for https://repo.continuum.io/pkgs/r/win-64 to '4' .DEBUG conda.core.repodata:fetch_repodata(437): Locally invalidating cached repodata for https://repo.continuum.io/pkgs/r/noarch at C:\Miniconda3\pkgs\cache\716b88c0.json DEBUG requests.packages.urllib3.connectionpool:_make_request(400): https://repo.continuum.io:443 "GET /pkgs/r/noarch/repodata.json.bz2 HTTP/1.1" 304 0 DEBUG conda.core.repodata:fetch_repodata_remote_request(140): >>GET /pkgs/r/noarch/repodata.json.bz2 HTTPS > User-Agent: conda/4.3.17 requests/2.12.4 CPython/3.6.0 Windows/8.1 Windows/6.3.9600 > Accept: */* > Accept-Encoding: identity > Connection: keep-alive > Cookie: __cfduid=d57c5e9ebd048b54082d66851a16bd2291494059107 > If-Modified-Since: Tue, 31 Jan 2017 05:50:11 GMT > If-None-Match: "e8c60de6ccbc390c49c0a91035a53c64" <<HTTPS 304 Not Modified < Cache-Control: public, max-age=30 < CF-Cache-Status: HIT < CF-RAY: 35aa8c0ec9087642-ARN < Date: Sat, 06 May 2017 08:25:07 GMT < ETag: "e8c60de6ccbc390c49c0a91035a53c64" < Expires: Sat, 06 May 2017 08:25:37 GMT < Last-Modified: Tue, 31 Jan 2017 05:50:11 GMT < Server: cloudflare-nginx < Vary: Accept-Encoding < x-amz-id-2: 2piU+0bNenkX56uNPNWYCAkk0lUEmj6qnBYMrUny+nO2DuQMSpwXo0lr7G8RMZTJ9ub8wjaRpwc= < x-amz-request-id: 25D8CC0944A4B616 < x-amz-version-id: q9tvk8Y4cFZ5bm2fRh8sN6opdl7qs.78 < Connection: keep-alive < Elapsed: 00:00.066219 DEBUG conda.core.repodata:fetch_repodata(445): 304 NOT MODIFIED for 'https://repo.continuum.io/pkgs/r/noarch'. Updating mtime and loading from disk .DEBUG conda.core.repodata:fetch_repodata(437): Locally invalidating cached repodata for https://repo.continuum.io/pkgs/pro/win-64 at C:\Miniconda3\pkgs\cache\709bdc73.json DEBUG requests.packages.urllib3.connectionpool:_make_request(400): https://repo.continuum.io:443 "GET /pkgs/pro/win-64/repodata.json.bz2 HTTP/1.1" 304 0 DEBUG conda.core.repodata:fetch_repodata_remote_request(140): >>GET /pkgs/pro/win-64/repodata.json.bz2 HTTPS > User-Agent: conda/4.3.17 requests/2.12.4 CPython/3.6.0 Windows/8.1 Windows/6.3.9600 > Accept: */* > Accept-Encoding: identity > Connection: keep-alive > Cookie: __cfduid=d57c5e9ebd048b54082d66851a16bd2291494059107 > If-Modified-Since: Thu, 04 May 2017 20:27:21 GMT > If-None-Match: "c68afe619d27593ab614e4cd83ba5ef5" <<HTTPS 304 Not Modified < Cache-Control: public, max-age=30 < CF-Cache-Status: HIT < CF-RAY: 35aa8c0f49807642-ARN < Date: Sat, 06 May 2017 08:25:07 GMT < ETag: "c68afe619d27593ab614e4cd83ba5ef5" < Expires: Sat, 06 May 2017 08:25:37 GMT < Last-Modified: Thu, 04 May 2017 20:27:21 GMT < Server: cloudflare-nginx < Vary: Accept-Encoding < x-amz-id-2: aYvT+2QaHDC9bPN21KLxJ5lAlJY6rTShnfi46yMbHKTGBw+9sMZF2+4Tdw14WDVfc6AOugVOnS8= < x-amz-request-id: 93A76C1A9C4EB243 < x-amz-version-id: ci37NChttrcVhccxxONTeZJXLdlRyDYk < Connection: keep-alive < Elapsed: 00:00.062029 DEBUG conda.core.repodata:fetch_repodata(445): 304 NOT MODIFIED for 'https://repo.continuum.io/pkgs/pro/win-64'. Updating mtime and loading from disk DEBUG conda.core.repodata:read_pickled_repodata(328): found pickle file C:\Miniconda3\pkgs\cache\709bdc73.q DEBUG conda.core.repodata:read_pickled_repodata(349): setting priority for https://repo.continuum.io/pkgs/pro/win-64 to '6' .DEBUG conda.core.repodata:fetch_repodata(437): Locally invalidating cached repodata for https://repo.continuum.io/pkgs/pro/noarch at C:\Miniconda3\pkgs\cache\08159f17.json DEBUG requests.packages.urllib3.connectionpool:_make_request(400): https://repo.continuum.io:443 "GET /pkgs/pro/noarch/repodata.json.bz2 HTTP/1.1" 304 0 DEBUG conda.core.repodata:fetch_repodata_remote_request(140): >>GET /pkgs/pro/noarch/repodata.json.bz2 HTTPS > User-Agent: conda/4.3.17 requests/2.12.4 CPython/3.6.0 Windows/8.1 Windows/6.3.9600 > Accept: */* > Accept-Encoding: identity > Connection: keep-alive > Cookie: __cfduid=d57c5e9ebd048b54082d66851a16bd2291494059107 > If-Modified-Since: Thu, 04 May 2017 12:57:55 GMT > If-None-Match: "a03a8ce02144dee86add4a372c6c86b7" <<HTTPS 304 Not Modified < Cache-Control: public, max-age=30 < CF-Cache-Status: HIT < CF-RAY: 35aa8c0fea037642-ARN < Date: Sat, 06 May 2017 08:25:07 GMT < ETag: "a03a8ce02144dee86add4a372c6c86b7" < Expires: Sat, 06 May 2017 08:25:37 GMT < Last-Modified: Thu, 04 May 2017 12:57:55 GMT < Server: cloudflare-nginx < Vary: Accept-Encoding < x-amz-id-2: YNPe7Ee5Bl8+dRmmyxqb0T78HDtCONF7/GctajkXKrvnuywbJICIXqYlv244lFcxXmU5Mb2h8Po= < x-amz-request-id: 84CE1D48A04DF7CB < x-amz-version-id: fIQptEZh5.P7vyXpOCrwSv8utA58y5aE < Connection: keep-alive < Elapsed: 00:00.063534 DEBUG conda.core.repodata:fetch_repodata(445): 304 NOT MODIFIED for 'https://repo.continuum.io/pkgs/pro/noarch'. Updating mtime and loading from disk .DEBUG conda.core.repodata:fetch_repodata(437): Locally invalidating cached repodata for https://repo.continuum.io/pkgs/msys2/win-64 at C:\Miniconda3\pkgs\cache\9767c1d0.json DEBUG requests.packages.urllib3.connectionpool:_make_request(400): https://repo.continuum.io:443 "GET /pkgs/msys2/win-64/repodata.json.bz2 HTTP/1.1" 304 0 DEBUG conda.core.repodata:fetch_repodata_remote_request(140): >>GET /pkgs/msys2/win-64/repodata.json.bz2 HTTPS > User-Agent: conda/4.3.17 requests/2.12.4 CPython/3.6.0 Windows/8.1 Windows/6.3.9600 > Accept: */* > Accept-Encoding: identity > Connection: keep-alive > Cookie: __cfduid=d57c5e9ebd048b54082d66851a16bd2291494059107 > If-Modified-Since: Thu, 04 May 2017 12:57:51 GMT > If-None-Match: "b356c90713bb9ca38a19fc0a01a5a289" <<HTTPS 304 Not Modified < Cache-Control: public, max-age=30 < CF-Cache-Status: HIT < CF-RAY: 35aa8c106a587642-ARN < Date: Sat, 06 May 2017 08:25:07 GMT < ETag: "b356c90713bb9ca38a19fc0a01a5a289" < Expires: Sat, 06 May 2017 08:25:37 GMT < Last-Modified: Thu, 04 May 2017 12:57:51 GMT < Server: cloudflare-nginx < Vary: Accept-Encoding < x-amz-id-2: D41IbH1PaIVnmFDQ5ZAwQC9z1GazuLx+YUgiqeWnKJj4mpSv73zw0uVhfOgCgvTOSmhUZEvAUVo= < x-amz-request-id: 947F0D1B174A5D95 < x-amz-version-id: CaDHMYgWsI6VO1BihcrLF.hbnHy4xOHA < Connection: keep-alive < Elapsed: 00:00.063930 DEBUG conda.core.repodata:fetch_repodata(445): 304 NOT MODIFIED for 'https://repo.continuum.io/pkgs/msys2/win-64'. Updating mtime and loading from disk DEBUG conda.core.repodata:read_pickled_repodata(328): found pickle file C:\Miniconda3\pkgs\cache\9767c1d0.q DEBUG conda.core.repodata:read_pickled_repodata(349): setting priority for https://repo.continuum.io/pkgs/msys2/win-64 to '8' .DEBUG conda.core.repodata:fetch_repodata(437): Locally invalidating cached repodata for https://repo.continuum.io/pkgs/msys2/noarch at C:\Miniconda3\pkgs\cache\814cd719.json DEBUG requests.packages.urllib3.connectionpool:_make_request(400): https://repo.continuum.io:443 "GET /pkgs/msys2/noarch/repodata.json.bz2 HTTP/1.1" 304 0 DEBUG conda.core.repodata:fetch_repodata_remote_request(140): >>GET /pkgs/msys2/noarch/repodata.json.bz2 HTTPS > User-Agent: conda/4.3.17 requests/2.12.4 CPython/3.6.0 Windows/8.1 Windows/6.3.9600 > Accept: */* > Accept-Encoding: identity > Connection: keep-alive > Cookie: __cfduid=d57c5e9ebd048b54082d66851a16bd2291494059107 > If-Modified-Since: Tue, 31 Jan 2017 05:26:20 GMT > If-None-Match: "e8c60de6ccbc390c49c0a91035a53c64" <<HTTPS 304 Not Modified < Cache-Control: public, max-age=30 < CF-Cache-Status: HIT < CF-RAY: 35aa8c10facb7642-ARN < Date: Sat, 06 May 2017 08:25:08 GMT < ETag: "e8c60de6ccbc390c49c0a91035a53c64" < Expires: Sat, 06 May 2017 08:25:38 GMT < Last-Modified: Tue, 31 Jan 2017 05:26:20 GMT < Server: cloudflare-nginx < Vary: Accept-Encoding < x-amz-id-2: dDuvl/YutZ/8nb34JwGd/Y7b5rkjvcVKkkQZeO5Xf+aPe64ntIxgHVBEPDyYKqeK94qHKKQmK54= < x-amz-request-id: 79408D5235736634 < x-amz-version-id: W7sdnQTgXQRU3fCR3mXOwpYlxRUwRfGL < Connection: keep-alive < Elapsed: 00:00.060698 DEBUG conda.core.repodata:fetch_repodata(445): 304 NOT MODIFIED for 'https://repo.continuum.io/pkgs/msys2/noarch'. Updating mtime and loading from disk . DEBUG conda.plan:add_defaults_to_specs(371): H0 specs=[MatchSpec('python 3.6*')] DEBUG conda.plan:add_defaults_to_specs(381): H1 python DEBUG conda.plan:add_defaults_to_specs(386): H2 lua False DEBUG conda.plan:add_defaults_to_specs(391): H2A lua DEBUG conda.plan:add_defaults_to_specs(417): HF specs=[MatchSpec('python 3.6*')] DEBUG conda.plan:augment_specs(714): Pinned specs=() DEBUG conda.resolve:install_specs(790): Checking satisfiability of current install DEBUG conda.resolve:bad_installed(740): Checking if the current environment is consistent Solving package specifications: DEBUG conda.resolve:solve(845): Solving for [MatchSpec('python 3.6*')] DEBUG conda.resolve:get_reduced_index(374): Retrieving packages for: [MatchSpec('python 3.6*')] DEBUG conda.resolve:filter_group(399): python: pruned from 72 -> 2 DEBUG conda.resolve:filter_group(399): pip: pruned from 102 -> 1 DEBUG conda.resolve:filter_group(399): setuptools: pruned from 196 -> 1 DEBUG conda.resolve:filter_group(399): wheel: pruned from 16 -> 1 .DEBUG conda.logic:minimize(485): Empty objective, trivial solution DEBUG conda.resolve:solve(885): Package removal metric: 0 DEBUG conda.logic:minimize(557): Final sum objective: 0 DEBUG conda.resolve:solve(890): Initial package version metric: 0 DEBUG conda.logic:minimize(479): Clauses added, recomputing solution DEBUG conda.logic:minimize(557): Final sum objective: 1 DEBUG conda.logic:minimize(569): New peak objective: 1 DEBUG conda.resolve:solve(895): Track feature count: 1 DEBUG conda.logic:minimize(485): Empty objective, trivial solution DEBUG conda.resolve:solve(901): Package feature count: 0 DEBUG conda.logic:minimize(485): Empty objective, trivial solution DEBUG conda.resolve:solve(905): Initial package build metric: 0 DEBUG conda.logic:minimize(485): Empty objective, trivial solution DEBUG conda.resolve:solve(910): Dependency update count: 0 DEBUG conda.logic:minimize(557): Final sum objective: 0 DEBUG conda.logic:minimize(485): Empty objective, trivial solution DEBUG conda.resolve:solve(916): Additional package version/build metrics: 0/0 DEBUG conda.logic:minimize(557): Final sum objective: 4 DEBUG conda.logic:minimize(569): New peak objective: 1 DEBUG conda.resolve:solve(921): Weak dependency count: 4 DEBUG conda.resolve:solve(926): Looking for alternate solutions Package plan for installation in environment E:\JN\dist\pyenv36-win64: The following NEW packages will be INSTALLED: pip: 9.0.1-py36_1 python: 3.6.1-0 setuptools: 27.2.0-py36_1 vs2015_runtime: 14.0.25123-0 wheel: 0.29.0-py36_0 Proceed ([y]/n)? y DEBUG conda.plan:plan_from_actions(320): Adding plans for operations: ('CHECK_FETCH', 'RM_FETCHED', 'FETCH', 'CHECK_EXTRACT', 'RM_EXTRACTED', 'EXTRACT', 'UNLINK', 'LINK', 'SYMLINK_CONDA') DEBUG conda.plan:plan_from_actions(335): appending value defaults::vs2015_runtime-14.0.25123-0 for action LINK DEBUG conda.plan:plan_from_actions(335): appending value defaults::python-3.6.1-0 for action LINK DEBUG conda.plan:plan_from_actions(335): appending value defaults::setuptools-27.2.0-py36_1 for action LINK DEBUG conda.plan:plan_from_actions(335): appending value defaults::wheel-0.29.0-py36_0 for action LINK DEBUG conda.plan:plan_from_actions(335): appending value defaults::pip-9.0.1-py36_1 for action LINK DEBUG conda.plan:plan_from_actions(335): appending value C:\Miniconda3 for action SYMLINK_CONDA DEBUG conda.core.package_cache:__init__(455): instantiating ProgressiveFetchExtract with defaults::vs2015_runtime-14.0.25123-0 defaults::python-3.6.1-0 defaults::setuptools-27.2.0-py36_1 defaults::wheel-0.29.0-py36_0 defaults::pip-9.0.1-py36_1 DEBUG conda.core.package_cache:prepare(481): prepared package cache actions: cache_actions: CacheUrlAction<url='https://repo.continuum.io/pkgs/free/win-64/python-3.6.1-0.tar.bz2', target_full_path='C:\\Miniconda3\\pkgs\\python-3.6.1-0.tar.bz2'> extract_actions: ExtractPackageAction<source_full_path='C:\\Miniconda3\\pkgs\\vs2015_runtime-14.0.25123-0.tar.bz2', target_full_path='C:\\Miniconda3\\pkgs\\vs2015_runtime-14.0.25123-0'> ExtractPackageAction<source_full_path='C:\\Miniconda3\\pkgs\\python-3.6.1-0.tar.bz2', target_full_path='C:\\Miniconda3\\pkgs\\python-3.6.1-0'> ExtractPackageAction<source_full_path='C:\\Miniconda3\\pkgs\\setuptools-27.2.0-py36_1.tar.bz2', target_full_path='C:\\Miniconda3\\pkgs\\setuptools-27.2.0-py36_1'> ExtractPackageAction<source_full_path='C:\\Miniconda3\\pkgs\\wheel-0.29.0-py36_0.tar.bz2', target_full_path='C:\\Miniconda3\\pkgs\\wheel-0.29.0-py36_0'> ExtractPackageAction<source_full_path='C:\\Miniconda3\\pkgs\\pip-9.0.1-py36_1.tar.bz2', target_full_path='C:\\Miniconda3\\pkgs\\pip-9.0.1-py36_1'> DEBUG conda.instructions:execute_instructions(232): executing plan [('PREFIX', 'E:\\JN\\dist\\pyenv36-win64'), ('PRINT', 'Linking packages ...'), ('PROGRESSIVEFETCHEXTRACT', <conda.core.package_cache.ProgressiveFetchExtract object at 0x0000006CF91A80F0>), ('UNLINKLINKTRANSACTION', ((), (Dist(_Dist__initd=True, channel='defaults', dist_name='vs2015_runtime-14.0.25123-0', name='vs2015_runtime', version='14.0.25123', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='python-3.6.1-0', name='python', version='3.6.1', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='setuptools-27.2.0-py36_1', name='setuptools', version='27.2.0', build_string='py36_1', build_number=1, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='wheel-0.29.0-py36_0', name='wheel', version='0.29.0', build_string='py36_0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='pip-9.0.1-py36_1', name='pip', version='9.0.1', build_string='py36_1', build_number=1, with_features_depends=None, base_url=None, platform=None)))), ('LINK', Dist(_Dist__initd=True, channel='defaults', dist_name='vs2015_runtime-14.0.25123-0', name='vs2015_runtime', version='14.0.25123', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None)), ('LINK', Dist(_Dist__initd=True, channel='defaults', dist_name='python-3.6.1-0', name='python', version='3.6.1', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None)), ('LINK', Dist(_Dist__initd=True, channel='defaults', dist_name='setuptools-27.2.0-py36_1', name='setuptools', version='27.2.0', build_string='py36_1', build_number=1, with_features_depends=None, base_url=None, platform=None)), ('LINK', Dist(_Dist__initd=True, channel='defaults', dist_name='wheel-0.29.0-py36_0', name='wheel', version='0.29.0', build_string='py36_0', build_number=0, with_features_depends=None, base_url=None, platform=None)), ('LINK', Dist(_Dist__initd=True, channel='defaults', dist_name='pip-9.0.1-py36_1', name='pip', version='9.0.1', build_string='py36_1', build_number=1, with_features_depends=None, base_url=None, platform=None)), ('SYMLINK_CONDA', 'C:\\Miniconda3')] DEBUG conda.instructions:execute_instructions(238): PREFIX('E:\\JN\\dist\\pyenv36-win64') DEBUG conda.instructions:execute_instructions(238): PRINT('Linking packages ...') DEBUG conda.instructions:execute_instructions(238): PROGRESSIVEFETCHEXTRACT(<conda.core.package_cache.ProgressiveFetchExtract object at 0x0000006CF91A80F0>) DEBUG conda.common.signals:signal_handler(40): registering handler for SIGABRT DEBUG conda.common.signals:signal_handler(40): registering handler for SIGINT DEBUG conda.common.signals:signal_handler(40): registering handler for SIGTERM DEBUG conda.common.signals:signal_handler(40): registering handler for SIGBREAK DEBUG requests.packages.urllib3.util.retry:from_int(191): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None) DEBUG requests.packages.urllib3.connectionpool:_new_conn(809): Starting new HTTPS connection (1): repo.continuum.io DEBUG requests.packages.urllib3.connectionpool:_make_request(400): https://repo.continuum.io:443 "GET /pkgs/free/win-64/python-3.6.1-0.tar.bz2 HTTP/1.1" 200 33001222 DEBUG conda.gateways.download:download(66): >>GET /pkgs/free/win-64/python-3.6.1-0.tar.bz2 HTTPS > User-Agent: conda/4.3.17 requests/2.12.4 CPython/3.6.0 Windows/8.1 Windows/6.3.9600 > Accept: */* > Accept-Encoding: gzip, deflate > Connection: keep-alive <<HTTPS 200 OK < Cache-Control: public, max-age=30 < CF-Cache-Status: HIT < CF-RAY: 35aa8edf0a9a7696-ARN < Content-Type: application/x-tar < Date: Sat, 06 May 2017 08:27:02 GMT < ETag: "c576df205fe54787af9a2c93695f20df-4" < Expires: Sat, 06 May 2017 08:27:32 GMT < Last-Modified: Thu, 23 Mar 2017 01:35:43 GMT < Server: cloudflare-nginx < Set-Cookie: __cfduid=d5fc961ca3bf9de90900befdcf73516381494059222; expires=Sun, 06-May-18 08:27:02 GMT; path=/; domain=.continuum.io; HttpOnly < Vary: Accept-Encoding < x-amz-id-2: wzPapNxu6Iy890vEhrhBthe+hFBvkPs63m6E2o1nJK0CYqPLkdF4xlU5t0sRZE8cf6BTVGSaEYc= < x-amz-request-id: 3E4066A47E4BED7B < x-amz-version-id: PMlmIBzRFh30DCdJQzvo6GWGQa9uEpyN < Content-Length: 33001222 < Connection: keep-alive < Elapsed: 00:00.293591 python-3.6.1-0 100% |###############################| Time: 0:00:20 1.62 MB/s DEBUG conda.gateways.disk.create:extract_tarball(103): extracting C:\Miniconda3\pkgs\vs2015_runtime-14.0.25123-0.tar.bz2 to C:\Miniconda3\pkgs\vs2015_runtime-14.0.25123-0 DEBUG conda.gateways.disk.create:extract_tarball(103): extracting C:\Miniconda3\pkgs\python-3.6.1-0.tar.bz2 to C:\Miniconda3\pkgs\python-3.6.1-0 DEBUG conda.gateways.disk.create:extract_tarball(103): extracting C:\Miniconda3\pkgs\setuptools-27.2.0-py36_1.tar.bz2 to C:\Miniconda3\pkgs\setuptools-27.2.0-py36_1 DEBUG conda.gateways.disk.create:extract_tarball(103): extracting C:\Miniconda3\pkgs\wheel-0.29.0-py36_0.tar.bz2 to C:\Miniconda3\pkgs\wheel-0.29.0-py36_0 DEBUG conda.gateways.disk.create:extract_tarball(103): extracting C:\Miniconda3\pkgs\pip-9.0.1-py36_1.tar.bz2 to C:\Miniconda3\pkgs\pip-9.0.1-py36_1 DEBUG conda.common.signals:signal_handler(49): de-registering handler for SIGBREAK DEBUG conda.common.signals:signal_handler(49): de-registering handler for SIGBREAK DEBUG conda.common.signals:signal_handler(49): de-registering handler for SIGBREAK DEBUG conda.common.signals:signal_handler(49): de-registering handler for SIGBREAK DEBUG conda.instructions:execute_instructions(238): UNLINKLINKTRANSACTION(((), (Dist(_Dist__initd=True, channel='defaults', dist_name='vs2015_runtime-14.0.25123-0', name='vs2015_runtime', version='14.0.25123', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='python-3.6.1-0', name='python', version='3.6.1', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='setuptools-27.2.0-py36_1', name='setuptools', version='27.2.0', build_string='py36_1', build_number=1, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='wheel-0.29.0-py36_0', name='wheel', version='0.29.0', build_string='py36_0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='pip-9.0.1-py36_1', name='pip', version='9.0.1', build_string='py36_1', build_number=1, with_features_depends=None, base_url=None, platform=None)))) DEBUG conda.core.link:create_from_dists(118): instantiating UnlinkLinkTransaction with target_prefix: E:\JN\dist\pyenv36-win64 unlink_dists: link_dists: defaults::vs2015_runtime-14.0.25123-0 defaults::python-3.6.1-0 defaults::setuptools-27.2.0-py36_1 defaults::wheel-0.29.0-py36_0 defaults::pip-9.0.1-py36_1 INFO conda.core.link:verify(256): () DEBUG conda.common.signals:signal_handler(40): registering handler for SIGABRT DEBUG conda.common.signals:signal_handler(40): registering handler for SIGINT DEBUG conda.common.signals:signal_handler(40): registering handler for SIGTERM DEBUG conda.common.signals:signal_handler(40): registering handler for SIGBREAK INFO conda.core.link:_execute_actions(317): ===> LINKING PACKAGE: defaults::vs2015_runtime-14.0.25123-0 <=== prefix=E:\JN\dist\pyenv36-win64 source=C:\Miniconda3\pkgs\vs2015_runtime-14.0.25123-0 INFO conda.core.link:_execute_actions(317): ===> LINKING PACKAGE: defaults::python-3.6.1-0 <=== prefix=E:\JN\dist\pyenv36-win64 source=C:\Miniconda3\pkgs\python-3.6.1-0 INFO conda.core.link:_execute_actions(317): ===> LINKING PACKAGE: defaults::setuptools-27.2.0-py36_1 <=== prefix=E:\JN\dist\pyenv36-win64 source=C:\Miniconda3\pkgs\setuptools-27.2.0-py36_1 INFO conda.core.link:_execute_actions(317): ===> LINKING PACKAGE: defaults::wheel-0.29.0-py36_0 <=== prefix=E:\JN\dist\pyenv36-win64 source=C:\Miniconda3\pkgs\wheel-0.29.0-py36_0 INFO conda.core.link:_execute_actions(317): ===> LINKING PACKAGE: defaults::pip-9.0.1-py36_1 <=== prefix=E:\JN\dist\pyenv36-win64 source=C:\Miniconda3\pkgs\pip-9.0.1-py36_1 DEBUG conda.common.signals:signal_handler(49): de-registering handler for SIGBREAK DEBUG conda.common.signals:signal_handler(49): de-registering handler for SIGBREAK DEBUG conda.common.signals:signal_handler(49): de-registering handler for SIGBREAK DEBUG conda.common.signals:signal_handler(49): de-registering handler for SIGBREAK DEBUG conda.instructions:execute_instructions(238): LINK(Dist(_Dist__initd=True, channel='defaults', dist_name='vs2015_runtime-14.0.25123-0', name='vs2015_runtime', version='14.0.25123', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None)) DEBUG conda.instructions:execute_instructions(238): LINK(Dist(_Dist__initd=True, channel='defaults', dist_name='python-3.6.1-0', name='python', version='3.6.1', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None)) DEBUG conda.instructions:execute_instructions(238): LINK(Dist(_Dist__initd=True, channel='defaults', dist_name='setuptools-27.2.0-py36_1', name='setuptools', version='27.2.0', build_string='py36_1', build_number=1, with_features_depends=None, base_url=None, platform=None)) DEBUG conda.instructions:execute_instructions(238): LINK(Dist(_Dist__initd=True, channel='defaults', dist_name='wheel-0.29.0-py36_0', name='wheel', version='0.29.0', build_string='py36_0', build_number=0, with_features_depends=None, base_url=None, platform=None)) DEBUG conda.instructions:execute_instructions(238): LINK(Dist(_Dist__initd=True, channel='defaults', dist_name='pip-9.0.1-py36_1', name='pip', version='9.0.1', build_string='py36_1', build_number=1, with_features_depends=None, base_url=None, platform=None)) DEBUG conda.instructions:execute_instructions(238): SYMLINK_CONDA('C:\\Miniconda3') # # To activate this environment, use: # > activate E:\JN\dist\pyenv36-win64 # # To deactivate this environment, use: # > deactivate E:\JN\dist\pyenv36-win64 # # * for power-users using bash, you must source # ``` According this log symlinks created even when `--copy` argument is passed to `conda create`. As result some packeages in my virtual environment stopped to work after I deinstalled miniconda.
I use conda 4.3.17 from canary channel. ``` $ conda info Current conda install: platform : win-64 conda version : 4.3.17 conda is private : False conda-env version : 4.3.17 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : C:\Miniconda3 (writable) default environment : C:\Miniconda3 envs directories : C:\Miniconda3\envs C:\Users\Andrewin\AppData\Local\conda\conda\envs C:\Users\Andrewin\.conda\envs package cache : C:\Miniconda3\pkgs C:\Users\Andrewin\AppData\Local\conda\conda\pkgs channel URLs : https://conda.anaconda.org/conda-canary/win-64 https://conda.anaconda.org/conda-canary/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 file : C:\Users\Andrewin\.condarc offline mode : False user-agent : conda/4.3.17 requests/2.12.4 CPython/3.6.0 Windows/8.1 Windows/6.3.9600 ``` According to [documentation](https://conda.io/docs/commands/conda-create.html): >--copy Install all packages using copies instead of hard- or soft-linking. But in fact conda use linking even `--copy` argument passed to `conda create`. I installed [Link Shell Extension](http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html). When I use `--copy`, it seems for me that all files in created virtual environment aren't hard links. This is strange for me because I've seen that conda created some llinks... Also conda doesn't show progress bar when installing package. Only when downloading ones.
2017-05-08T14:42:30
conda/conda
5,252
conda__conda-5252
[ "1509" ]
d2743a31026824c0b53c225941560936bd886970
diff --git a/conda/core/link.py b/conda/core/link.py --- a/conda/core/link.py +++ b/conda/core/link.py @@ -691,7 +691,7 @@ def run_script(prefix, dist, action='post-link', env_prefix=None): log.info("failed to run %s for %s due to COMSPEC KeyError", action, dist) return False else: - shell_path = '/bin/sh' if 'bsd' in sys.platform else '/bin/bash' + shell_path = 'sh' if 'bsd' in sys.platform else 'bash' command_args = [shell_path, "-x", path] env['ROOT_PREFIX'] = context.root_prefix
Replace /bin/bash with /usr/bin/env bash Currently `conda` hardcodes `#!/bin/bash`. If instead `#!/usr/bin/env bash` would be used, then the version of the current environment would be used. I'm attempting to package `conda` at the moment for an OS where `#!/bin/bash` is unavailable, but `#!/usr/bin/env bash` does work. The same by the way applies to some of the packages offered via `conda`. Edit: I can understand if such change wouldn't be made since there might be distributions where exactly that option isn't available.
What exactly do you mean when say "`conda` hardcodes `#!/bin/bash`? Do you mean the Miniconda installer? Installing packages on a system where `#!/bin/bash` isn't available but `#!/usr/bin/env bash` is doesn't work because of: https://github.com/conda/conda/blob/master/conda/install.py#L339 The same applies for many of the packages offered by Anaconda as well as many of the recipes at https://github.com/conda/conda-recipes/search?utf8=%E2%9C%93&q=bash https://github.com/conda/conda/blob/master/conda/install.py#L339 is only concerning the pre/post link scripts, which are not often used. I've never come across a Unix system, which does not have `/bin/bash` installed. I think it is safer to assume that `/bin/bash` exists than `/usr/bin/env`. What system are you having this problem with? And where is `bash` installed? The easiest fix would be to create a link in `/bin/bash` to the location where bash is located on that system, I would say. Do you have similar problems with other software of this system? I was using NixOS which puts all software in a store on a not so standard place. When packaging software for Nix it is common to replace direct calls to /bin/bash since it doesn't exist on this system. `/usr/bin/env` is however available and is more portable.
2017-05-08T16:29:12
conda/conda
5,259
conda__conda-5259
[ "5258" ]
bd628e251e024b9574dd2634b6ce47fba5bdcc95
diff --git a/conda/cli/main_config.py b/conda/cli/main_config.py --- a/conda/cli/main_config.py +++ b/conda/cli/main_config.py @@ -279,22 +279,16 @@ def execute_config(args, parser): 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)))) + print("%s (%s)" % (name, ', '.join(sorted(set(et for et in element_types))))) else: print("%s (%s: %s)" % (name, details['parameter_type'], - ', '.join(clean_element_type(element_types)))) + ', '.join(sorted(set(et for et in element_types))))) def_str = ' default: %s' % json.dumps(details['default_value'], indent=2, separators=(',', ': '), cls=EntityEncoder)
conda config --describe reports elements types as str for everything
2017-05-09T07:41:00
conda/conda
5,261
conda__conda-5261
[ "4911", "4911" ]
01996fe9e596e2ad5e9d75474d092104b90b6993
diff --git a/conda/gateways/disk/create.py b/conda/gateways/disk/create.py --- a/conda/gateways/disk/create.py +++ b/conda/gateways/disk/create.py @@ -8,7 +8,7 @@ import os from os import X_OK, access, makedirs from os.path import basename, isdir, isfile, join, lexists -import shutil +from shutil import copy as shutil_copy, copystat import sys import tarfile import traceback @@ -25,10 +25,10 @@ from ...base.context import context from ...common.compat import ensure_binary, on_win from ...common.path import win_path_ok +from ...core.portability import replace_long_shebang from ...exceptions import BasicClobberError, CondaOSError, maybe_raise from ...models.dist import Dist -from ...models.enums import LinkType, FileMode -from ...core.portability import replace_long_shebang +from ...models.enums import FileMode, LinkType log = getLogger(__name__) stdoutlog = getLogger('stdoutlog') @@ -182,7 +182,7 @@ def create_hard_link_or_copy(src, dst): link(src, dst) except (IOError, OSError): log.info('hard link failed, so copying %s => %s', src, dst) - shutil.copy2(src, dst) + _do_copy(src, dst) def _is_unix_executable_using_ORIGIN(path): @@ -198,13 +198,13 @@ def _do_softlink(src, dst): # We only need to do this copy for executables which have an RPATH containing $ORIGIN # on Linux, so `is_executable()` is currently overly aggressive. # A future optimization will be to copy code from @mingwandroid's virtualenv patch. - _do_copy(src, dst) + copy(src, dst) else: log.trace("soft linking %s => %s", src, dst) symlink(src, dst) -def _do_copy(src, dst): +def copy(src, dst): # on unix, make sure relative symlinks stay symlinks if not on_win and islink(src): src_points_to = readlink(src) @@ -213,8 +213,18 @@ def _do_copy(src, dst): log.trace("soft linking %s => %s", src, dst) symlink(src_points_to, dst) return + _do_copy(src, dst) + + +def _do_copy(src, dst): log.trace("copying %s => %s", src, dst) - shutil.copy2(src, dst) + shutil_copy(src, dst) + try: + copystat(src, dst) + except (IOError, OSError) as e: # pragma: no cover + # shutil.copystat gives a permission denied when using the os.setxattr function + # on the security.selinux property. + log.debug('%r', e) def create_link(src, dst, link_type=LinkType.hardlink, force=False): @@ -249,11 +259,11 @@ def create_link(src, dst, link_type=LinkType.hardlink, force=False): " error: %r\n" " src: %s\n" " dst: %s", e, src, dst) - _do_copy(src, dst) + copy(src, dst) elif link_type == LinkType.softlink: _do_softlink(src, dst) elif link_type == LinkType.copy: - _do_copy(src, dst) + copy(src, dst) else: raise CondaError("Did not expect linktype=%r" % link_type)
Permission denied for c_rehash in multi-user config Tried 4.3.14 and 4.3.8. Also tried adding the `conda-canary` channel, but no luck. This seems to have coincided with an upgrade from 4.3.8 -> 4.3.14. Here's the trace: ``` INFO conda.common.io:captured(59): overtaking stderr and stdout INFO conda.common.io:captured(65): stderr and stdout yielding back Current conda install: platform : linux-64 conda version : 4.3.8 conda is private : False conda-env version : 4.3.8 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : /usr/local/python3/anaconda3 (read only) default environment : /usr/local/python3/anaconda3 envs directories : /home/fido/.conda/envs /usr/local/python3/anaconda3/envs package cache : /home/fido/.conda/envs/.pkgs /usr/local/python3/anaconda3/pkgs channel URLs : 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 : None offline mode : False user-agent : conda/4.3.8 requests/2.12.4 CPython/3.6.0 Linux/2.6.32-642.6.2.el6.x86_64 CentOS/6.8 glibc/2.12 UID:GID : 30100:36014 `$ /usr/local/python3/anaconda3/bin/conda create -n bar0 python=3.5 -y -vv` Traceback (most recent call last): File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 307, in _execute_actions action.execute() File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/path_actions.py", line 272, in execute super(PrefixReplaceLinkAction, self).execute() File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/path_actions.py", line 227, in execute force=context.force) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/create.py", line 241, in create_link shutil.copy2(src, dst) File "/usr/local/python3/anaconda3/lib/python3.6/shutil.py", line 252, in copy2 copystat(src, dst, follow_symlinks=follow_symlinks) File "/usr/local/python3/anaconda3/lib/python3.6/shutil.py", line 219, in copystat _copyxattr(src, dst, follow_symlinks=follow) File "/usr/local/python3/anaconda3/lib/python3.6/shutil.py", line 159, in _copyxattr os.setxattr(dst, name, value, follow_symlinks=follow_symlinks) PermissionError: [Errno 13] Permission denied: '/home/fido/.conda/envs/bar0/bin/c_rehash' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 261, in execute pkg_data, actions) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 325, in _execute_actions reverse_excs, conda.CondaMultiError: [Errno 13] Permission denied: '/home/fido/.conda/envs/bar0/bin/c_rehash' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 137, in _main exit_code = args.func(args, p) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/cli/main_create.py", line 68, in execute install(args, parser, 'create') File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 347, in install execute_actions(actions, index, verbose=not context.quiet) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/plan.py", line 837, in execute_actions execute_instructions(plan, index, verbose) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/instructions.py", line 258, in execute_instructions cmd(state, arg) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/instructions.py", line 119, in UNLINKLINKTRANSACTION_CMD txn.execute() File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 277, in execute rollback_excs, conda.CondaMultiError: [Errno 13] Permission denied: '/home/fido/.conda/envs/bar0/bin/c_rehash' ``` Permission denied for c_rehash in multi-user config Tried 4.3.14 and 4.3.8. Also tried adding the `conda-canary` channel, but no luck. This seems to have coincided with an upgrade from 4.3.8 -> 4.3.14. Here's the trace: ``` INFO conda.common.io:captured(59): overtaking stderr and stdout INFO conda.common.io:captured(65): stderr and stdout yielding back Current conda install: platform : linux-64 conda version : 4.3.8 conda is private : False conda-env version : 4.3.8 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : /usr/local/python3/anaconda3 (read only) default environment : /usr/local/python3/anaconda3 envs directories : /home/fido/.conda/envs /usr/local/python3/anaconda3/envs package cache : /home/fido/.conda/envs/.pkgs /usr/local/python3/anaconda3/pkgs channel URLs : 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 : None offline mode : False user-agent : conda/4.3.8 requests/2.12.4 CPython/3.6.0 Linux/2.6.32-642.6.2.el6.x86_64 CentOS/6.8 glibc/2.12 UID:GID : 30100:36014 `$ /usr/local/python3/anaconda3/bin/conda create -n bar0 python=3.5 -y -vv` Traceback (most recent call last): File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 307, in _execute_actions action.execute() File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/path_actions.py", line 272, in execute super(PrefixReplaceLinkAction, self).execute() File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/path_actions.py", line 227, in execute force=context.force) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/create.py", line 241, in create_link shutil.copy2(src, dst) File "/usr/local/python3/anaconda3/lib/python3.6/shutil.py", line 252, in copy2 copystat(src, dst, follow_symlinks=follow_symlinks) File "/usr/local/python3/anaconda3/lib/python3.6/shutil.py", line 219, in copystat _copyxattr(src, dst, follow_symlinks=follow) File "/usr/local/python3/anaconda3/lib/python3.6/shutil.py", line 159, in _copyxattr os.setxattr(dst, name, value, follow_symlinks=follow_symlinks) PermissionError: [Errno 13] Permission denied: '/home/fido/.conda/envs/bar0/bin/c_rehash' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 261, in execute pkg_data, actions) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 325, in _execute_actions reverse_excs, conda.CondaMultiError: [Errno 13] Permission denied: '/home/fido/.conda/envs/bar0/bin/c_rehash' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 617, in conda_exception_handler return_value = func(*args, **kwargs) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 137, in _main exit_code = args.func(args, p) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/cli/main_create.py", line 68, in execute install(args, parser, 'create') File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 347, in install execute_actions(actions, index, verbose=not context.quiet) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/plan.py", line 837, in execute_actions execute_instructions(plan, index, verbose) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/instructions.py", line 258, in execute_instructions cmd(state, arg) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/instructions.py", line 119, in UNLINKLINKTRANSACTION_CMD txn.execute() File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 277, in execute rollback_excs, conda.CondaMultiError: [Errno 13] Permission denied: '/home/fido/.conda/envs/bar0/bin/c_rehash' ```
What do you get for ls -al /home/fido/.conda/envs/bar0/bin/c_rehash Please update to 4.3.13 or later. And add here the new stack trace if you still have problems. Hi, Sorry I opened a new ticket. Forgot I had this one open. ``` -rwxrwxr-x. 1 fido accre 5144 Mar 3 10:28 /home/fido/.conda/envs/baz/bin/c_rehash ``` As per #5251, I can confirm that creating the environment works on a local drive. Unfortunately, there's nothing jumping out at me here. You're going to have to provide more context I think. More information about the operating environments where this works and where this doesn't, since you say it works locally. What's "not local"? You might end up having to do your own forensics here and help us figure out where we have a bug, if indeed we do have a bug. Sure thing. Sorry if I was being ambiguous. We're running CentOS 6.8 on a cluster. Installing to `/tmp/bar` works and is on a local disk, i.e. not network mounted. However, on our system, `/home` is a GPFS-mounted drive. Anaconda is also installed on a GPFS-mounted drive with `root` as owner. If the problem is due to how GPFS is implemented, then I can start down that path, but I thought it might have cropped up before. I updated to 4.3.17 and tried again to no avail: ``` DEBUG conda.gateways.disk.test:prefix_is_writable(64): testing write access for prefix '/usr/local/python3/anaconda3' using path '/usr/local/python3/anaconda3/conda-meta/history' DEBUG conda.gateways.disk.test:file_path_is_writable(29): [Errno 13] Permission denied: '/usr/local/python3/anaconda3/conda-meta/history' DEBUG conda.gateways.disk.test:prefix_is_writable(64): testing write access for prefix '/usr/local/python3/anaconda3' using path '/usr/local/python3/anaconda3/conda-meta/history' DEBUG conda.gateways.disk.test:file_path_is_writable(29): [Errno 13] Permission denied: '/usr/local/python3/anaconda3/conda-meta/history' Current conda install: platform : linux-64 conda version : 4.3.17 conda is private : False conda-env version : 4.3.17 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : /usr/local/python3/anaconda3 (read only) default environment : /usr/local/python3/anaconda3 envs directories : /home/fido/.conda/envs /usr/local/python3/anaconda3/envs package cache : /usr/local/python3/anaconda3/pkgs /home/fido/.conda/pkgs channel URLs : 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 : None offline mode : False user-agent : conda/4.3.17 requests/2.12.4 CPython/3.6.0 Linux/2.6.32-642.6.2.el6.x86_64 CentOS/6.8 glibc/2.12 UID:GID : 30100:36014 `$ /usr/local/python3/anaconda3/bin/conda create --debug -n bar python=3.6` Traceback (most recent call last): File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 324, in _execute_actions action.execute() File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/path_actions.py", line 291, in execute super(PrefixReplaceLinkAction, self).execute() File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/path_actions.py", line 246, in execute force=context.force) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/create.py", line 252, in create_link _do_copy(src, dst) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/create.py", line 214, in _do_copy shutil.copy2(src, dst) File "/usr/local/python3/anaconda3/lib/python3.6/shutil.py", line 252, in copy2 copystat(src, dst, follow_symlinks=follow_symlinks) File "/usr/local/python3/anaconda3/lib/python3.6/shutil.py", line 219, in copystat _copyxattr(src, dst, follow_symlinks=follow) File "/usr/local/python3/anaconda3/lib/python3.6/shutil.py", line 159, in _copyxattr os.setxattr(dst, name, value, follow_symlinks=follow_symlinks) PermissionError: [Errno 13] Permission denied: '/home/fido/.conda/envs/bar/bin/c_rehash' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 279, in execute pkg_data, actions) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 342, in _execute_actions reverse_excs, conda.CondaMultiError: [Errno 13] Permission denied: '/home/fido/.conda/envs/bar/bin/c_rehash' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 632, in conda_exception_handler return_value = func(*args, **kwargs) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 134, in _main exit_code = args.func(args, p) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/cli/main_create.py", line 68, in execute install(args, parser, 'create') File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 357, in install execute_actions(actions, index, verbose=not context.quiet) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/plan.py", line 830, in execute_actions execute_instructions(plan, index, verbose) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/instructions.py", line 247, in execute_instructions cmd(state, arg) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/instructions.py", line 108, in UNLINKLINKTRANSACTION_CMD txn.execute() File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 295, in execute rollback_excs, conda.CondaMultiError: [Errno 13] Permission denied: '/home/fido/.conda/envs/bar/bin/c_rehash' ``` Thanks! One very import point that I failed to mention is that installing to my `/home` directory *does work* for Anaconda2 v. 4.3.14. Anaconda3 worked as recently as 4.3.8, I believe. Right now, the evidence points to this issue being caused by GPFS and not conda, as I've run into other permission denied errors using `pip` alone. This may be related to an error that I have related to selinux security and shutil.copy2. conda uses shutil.copy2 when link fails (e.g., when overwriting an existing link). shutil.copy2 is a wrapper to shutil.copy and shutil.copystat. The shutil.copy works fine, but the shutil.copystat gives a permission denied when using the os.setxattr function on the security.selinux property. So, in my case this is a system configuration peculiarity coupled with an intolerant copy method. It is also easily fixable. If conda were to, instead of using copy2, use copy and then copystat with a try except wrapper it fixes the problem for me. In conda/gateways/disk/create.py replace both instances of ``` shutil.copy2(src, dst) ``` with ``` shutil.copy(src, dst) try: shutil.copystat(src, dst) except PermissionError as e: print(str(e)) pass ``` lines circa 178 and 207 BTW - I believe that this is a reasonable method. The permission error did not occur on the copy, so obviously the user has sufficient permissions for the task at hand. The one problem is that we rely on copystat maintaining its order of operation (i.e., setting xattrs last). That seems pretty easy. I'll see what it looks like getting that into the 4.3.x branch today. And if it looks good, will go in 4.3.18. Am ready to tag and release to conda-canary 4.3.18 today or tomorrow. What do you get for ls -al /home/fido/.conda/envs/bar0/bin/c_rehash Please update to 4.3.13 or later. And add here the new stack trace if you still have problems. Hi, Sorry I opened a new ticket. Forgot I had this one open. ``` -rwxrwxr-x. 1 fido accre 5144 Mar 3 10:28 /home/fido/.conda/envs/baz/bin/c_rehash ``` As per #5251, I can confirm that creating the environment works on a local drive. Unfortunately, there's nothing jumping out at me here. You're going to have to provide more context I think. More information about the operating environments where this works and where this doesn't, since you say it works locally. What's "not local"? You might end up having to do your own forensics here and help us figure out where we have a bug, if indeed we do have a bug. Sure thing. Sorry if I was being ambiguous. We're running CentOS 6.8 on a cluster. Installing to `/tmp/bar` works and is on a local disk, i.e. not network mounted. However, on our system, `/home` is a GPFS-mounted drive. Anaconda is also installed on a GPFS-mounted drive with `root` as owner. If the problem is due to how GPFS is implemented, then I can start down that path, but I thought it might have cropped up before. I updated to 4.3.17 and tried again to no avail: ``` DEBUG conda.gateways.disk.test:prefix_is_writable(64): testing write access for prefix '/usr/local/python3/anaconda3' using path '/usr/local/python3/anaconda3/conda-meta/history' DEBUG conda.gateways.disk.test:file_path_is_writable(29): [Errno 13] Permission denied: '/usr/local/python3/anaconda3/conda-meta/history' DEBUG conda.gateways.disk.test:prefix_is_writable(64): testing write access for prefix '/usr/local/python3/anaconda3' using path '/usr/local/python3/anaconda3/conda-meta/history' DEBUG conda.gateways.disk.test:file_path_is_writable(29): [Errno 13] Permission denied: '/usr/local/python3/anaconda3/conda-meta/history' Current conda install: platform : linux-64 conda version : 4.3.17 conda is private : False conda-env version : 4.3.17 conda-build version : not installed python version : 3.6.0.final.0 requests version : 2.12.4 root environment : /usr/local/python3/anaconda3 (read only) default environment : /usr/local/python3/anaconda3 envs directories : /home/fido/.conda/envs /usr/local/python3/anaconda3/envs package cache : /usr/local/python3/anaconda3/pkgs /home/fido/.conda/pkgs channel URLs : 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 : None offline mode : False user-agent : conda/4.3.17 requests/2.12.4 CPython/3.6.0 Linux/2.6.32-642.6.2.el6.x86_64 CentOS/6.8 glibc/2.12 UID:GID : 30100:36014 `$ /usr/local/python3/anaconda3/bin/conda create --debug -n bar python=3.6` Traceback (most recent call last): File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 324, in _execute_actions action.execute() File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/path_actions.py", line 291, in execute super(PrefixReplaceLinkAction, self).execute() File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/path_actions.py", line 246, in execute force=context.force) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/create.py", line 252, in create_link _do_copy(src, dst) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/create.py", line 214, in _do_copy shutil.copy2(src, dst) File "/usr/local/python3/anaconda3/lib/python3.6/shutil.py", line 252, in copy2 copystat(src, dst, follow_symlinks=follow_symlinks) File "/usr/local/python3/anaconda3/lib/python3.6/shutil.py", line 219, in copystat _copyxattr(src, dst, follow_symlinks=follow) File "/usr/local/python3/anaconda3/lib/python3.6/shutil.py", line 159, in _copyxattr os.setxattr(dst, name, value, follow_symlinks=follow_symlinks) PermissionError: [Errno 13] Permission denied: '/home/fido/.conda/envs/bar/bin/c_rehash' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 279, in execute pkg_data, actions) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 342, in _execute_actions reverse_excs, conda.CondaMultiError: [Errno 13] Permission denied: '/home/fido/.conda/envs/bar/bin/c_rehash' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 632, in conda_exception_handler return_value = func(*args, **kwargs) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 134, in _main exit_code = args.func(args, p) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/cli/main_create.py", line 68, in execute install(args, parser, 'create') File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 357, in install execute_actions(actions, index, verbose=not context.quiet) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/plan.py", line 830, in execute_actions execute_instructions(plan, index, verbose) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/instructions.py", line 247, in execute_instructions cmd(state, arg) File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/instructions.py", line 108, in UNLINKLINKTRANSACTION_CMD txn.execute() File "/usr/local/python3/anaconda3/lib/python3.6/site-packages/conda/core/link.py", line 295, in execute rollback_excs, conda.CondaMultiError: [Errno 13] Permission denied: '/home/fido/.conda/envs/bar/bin/c_rehash' ``` Thanks! One very import point that I failed to mention is that installing to my `/home` directory *does work* for Anaconda2 v. 4.3.14. Anaconda3 worked as recently as 4.3.8, I believe. Right now, the evidence points to this issue being caused by GPFS and not conda, as I've run into other permission denied errors using `pip` alone. This may be related to an error that I have related to selinux security and shutil.copy2. conda uses shutil.copy2 when link fails (e.g., when overwriting an existing link). shutil.copy2 is a wrapper to shutil.copy and shutil.copystat. The shutil.copy works fine, but the shutil.copystat gives a permission denied when using the os.setxattr function on the security.selinux property. So, in my case this is a system configuration peculiarity coupled with an intolerant copy method. It is also easily fixable. If conda were to, instead of using copy2, use copy and then copystat with a try except wrapper it fixes the problem for me. In conda/gateways/disk/create.py replace both instances of ``` shutil.copy2(src, dst) ``` with ``` shutil.copy(src, dst) try: shutil.copystat(src, dst) except PermissionError as e: print(str(e)) pass ``` lines circa 178 and 207 BTW - I believe that this is a reasonable method. The permission error did not occur on the copy, so obviously the user has sufficient permissions for the task at hand. The one problem is that we rely on copystat maintaining its order of operation (i.e., setting xattrs last). That seems pretty easy. I'll see what it looks like getting that into the 4.3.x branch today. And if it looks good, will go in 4.3.18. Am ready to tag and release to conda-canary 4.3.18 today or tomorrow.
2017-05-09T16:22:32
conda/conda
5,265
conda__conda-5265
[ "1543" ]
94b1f760c82d178fa884f216b8aeaaf65714aa6d
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -155,7 +155,9 @@ class Context(Configuration): dry_run = PrimitiveParameter(False) force = PrimitiveParameter(False) json = PrimitiveParameter(False) + no_dependencies = PrimitiveParameter(False, aliases=('no_deps',)) offline = PrimitiveParameter(False) + only_dependencies = PrimitiveParameter(False, aliases=('only_deps',)) quiet = PrimitiveParameter(False) prune = PrimitiveParameter(False) respect_pinned = PrimitiveParameter(True) @@ -473,6 +475,8 @@ def list_parameters(self): 'force_32bit', 'max_shlvl', 'migrated_custom_channels', + 'no_dependencies', + 'only_dependencies', 'prune', 'respect_pinned', 'root_prefix', diff --git a/conda/cli/conda_argparse.py b/conda/cli/conda_argparse.py --- a/conda/cli/conda_argparse.py +++ b/conda/cli/conda_argparse.py @@ -125,6 +125,11 @@ def add_parser_create_install_update(p): action="store_true", help="Do not install dependencies.", ) + p.add_argument( + "--only-deps", + action="store_true", + help="Only install dependencies.", + ) p.add_argument( '-m', "--mkdir", action="store_true", diff --git a/conda/core/solve.py b/conda/core/solve.py --- a/conda/core/solve.py +++ b/conda/core/solve.py @@ -129,9 +129,43 @@ def solve_for_actions(prefix, r, specs_to_remove=(), specs_to_add=(), prune=Fals # this is not for force-removing packages, which doesn't invoke the solver solved_dists, _specs_to_add = solve_prefix(prefix, r, specs_to_remove, specs_to_add, prune) + # TODO: this _specs_to_add part should be refactored when we can better pin package channel origin # NOQA dists_for_unlinking, dists_for_linking = sort_unlink_link_from_solve(prefix, solved_dists, _specs_to_add) - # TODO: this _specs_to_add part should be refactored when we can better pin package channel origin # NOQA + + def remove_non_matching_dists(dists_set, specs_to_match): + _dists_set = IndexedSet(dists_set) + for dist in dists_set: + for spec in specs_to_match: + if spec.match(dist): + break + else: # executed if the loop ended normally (no break) + _dists_set.remove(dist) + return _dists_set + + if context.no_dependencies: + # for `conda create --no-deps python=3 flask`, do we install python? yes + # the only dists we touch are the ones that match a specs_to_add + dists_for_linking = remove_non_matching_dists(dists_for_linking, specs_to_add) + dists_for_unlinking = remove_non_matching_dists(dists_for_unlinking, specs_to_add) + elif context.only_dependencies: + # for `conda create --only-deps python=3 flask`, do we install python? yes + # remove all dists that match a specs_to_add, as long as that dist isn't a dependency + # of other specs_to_add + _index = r.index + _match_any = lambda spec, dists: next((dist for dist in dists if spec.match(_index[dist])), + None) + _is_dependency = lambda spec, dist: any(r.depends_on(s, dist.name) + for s in specs_to_add if s != spec) + for spec in specs_to_add: + link_matching_dist = _match_any(spec, dists_for_linking) + if link_matching_dist: + if not _is_dependency(spec, link_matching_dist): + # as long as that dist isn't a dependency of other specs_to_add + dists_for_linking.remove(link_matching_dist) + unlink_matching_dist = _match_any(spec, dists_for_unlinking) + if unlink_matching_dist: + dists_for_unlinking.remove(unlink_matching_dist) if context.force: dists_for_unlinking, dists_for_linking = forced_reinstall_specs(prefix, solved_dists,
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -531,6 +531,21 @@ def test_install_prune(self): assert package_is_installed(prefix, 'pytz') assert package_is_installed(prefix, 'python-3') + def test_no_deps_flag(self): + with make_temp_env("python=2 flask --no-deps") as prefix: + assert package_is_installed(prefix, 'flask') + assert package_is_installed(prefix, 'python-2') + assert not package_is_installed(prefix, 'openssl') + assert not package_is_installed(prefix, 'itsdangerous') + + def test_only_deps_flag(self): + with make_temp_env("python=2 flask --only-deps") as prefix: + assert not package_is_installed(prefix, 'flask') + assert package_is_installed(prefix, 'python') + if not on_win: + # python on windows doesn't actually have real dependencies + assert package_is_installed(prefix, 'openssl') + assert package_is_installed(prefix, 'itsdangerous') @pytest.mark.skipif(on_win, reason="mkl package not available on Windows") def test_install_features(self):
--dependencies-only flag for development It'd be nice to have a `conda install -dependencies-only` flag. This would install all of the dependencies of the required package, but not the package itself. This would be useful when developing a package - it would allow you to install all of the required packages in one fell swoop.
I agree. It would be basically the opposite of `--no-deps`. Even so, it's pretty easy to achieve the same thing with `conda install package; conda remove package`. easy but feels like hacky.... +1 - this is a common scenario when wanting to automate unit tests prior to creating a package. Don't want to go through the whole conda build unnecessarily (and could fail, but I want my unit tests to fail). @benbovy Is there progress on this? It seems that #3500 works already but no decision has been made whether this feature will become part of conda. I would like to use it to setup the development environment easily and for testing as well. I'm still waiting for some feedback or review on this. It does work, although currently a (major) limitation is that we can't set specific versions for the dependencies, which is I actually need to easily create multiple dev/test envs for a given package. > It does work, although currently a (major) limitation is that we can't set specific versions for the dependencies, which is I actually need to easily create multiple dev/test envs for a given package. maybe then you need to change the option to be ``` --add-dependencies-from-package [packagename] ``` which will circumvent the whole installation process and only add the requirements to the install string. This way you can just add more constraints and be more flexible in building envs. Say your package `foo` requires `xyz>=1.0` and you want to test with later versions you run ``` conda install --add-dependencies-from-package foo xyz=1.1 ``` which should act something like ``` conda install xyz>=1.0 xyz=1.1 ``` (not that this syntax works but that is what I think would be nice) This would also be useful if you want to update all dependencies when developing. In my case -- just setting up an environment for testing -- it would be nice to have some option in conda-build instead that creates a suitable environment to execute, test or develop in. Conda-build used to not clean up its testing enviroment `_test` which I used to run nose tests a while ago. Having only this step as a single option with a name of the environment would be useful. I imagine the case where the test branch needs additional packages then installing from an existing build is not enough. Probably the origin why it _feels_ hacky. ``` conda build --only-create-test-environment mytest path-to-recipe ``` I think the use case might fit better with conda-build's already-built capabilities too. @benbovy if we implemented something like what @jhprinz suggests in conda-build, would that cover your use case? CC @msarahan @kalefranz although I rarely use conda-build and I've not used it so far for setting up development environments, to me it feels a bit hacky to use a "tool for _building_ conda packages" to actually just _install_ packages in a new development environment. In my case -- create and submit PRs -- I don't need a recipe to build a conda package. Using `conda install package; conda remove package` would be easier than downloading or writing a recipe. I actually like @jhprinz's suggestion of having a `--add-dependencies-from-package PACKAGE` option (maybe with a more succinct name like `--deps-from PACKAGE` ?). I can update #3500 to implement that option if needed. If meta.yaml is involved, then conda build is the right way. If only run time deps are involved, I agree with Benoit. All this said, I do wonder if the conda develop command (part of conda build) is what is needed here. On Oct 24, 2016 6:32 AM, "Benoit Bovy" [email protected] wrote: > @kalefranz https://github.com/kalefranz although I rarely use > conda-build and I've not used it so far for setting up development > environments, to me it feels a bit hacky to use a "tool for _building_ > conda packages" to actually just _install_ packages in a new development > environment. In my case -- create and submit PRs -- I don't need a recipe > to build a conda package. Using conda install package; conda remove > package would be easier than downloading or writing a recipe. > > I actually like @jhprinz https://github.com/jhprinz's suggestion of > having a --add-dependencies-from-package PACKAGE option (maybe with a > more succinct name like --deps-from PACKAGE ?). I can update #3500 > https://github.com/conda/conda/pull/3500 to implement that option if > needed. > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > https://github.com/conda/conda/issues/1543#issuecomment-255716085, or mute > the thread > https://github.com/notifications/unsubscribe-auth/AACV-axaiBKR0sXX_kWMYA8fqn1I7F1jks5q3JdkgaJpZM4Fvz9C > . @msarahan Yes, the following would be nice in my case: ``` $ conda create -n devenv --deps-from package $ conda develop -n devenv ./package_repo ``` I guess what I meant was it would be neat if conda develop could (optionally) create new envs for you - and that the way to get development environments would be to use conda-build's conda develop command, and cut the conda create step entirely. I don't think that this is the way it is right now, but it seems like the right way to do things eventually. ``` conda develop -n devenv ./package_repo ``` would create the environment if it didn't already exist - otherwise, it would ensure that the dependencies were up to date, potentially adding new ones or even removing ones removed from the package. The removal is of course contentious, but might be the best way to ensure that you have a good, known-working recipe, since previously installed packages would allow things to run, even if they were no longer listed in the recipe. Opinions? Indeed, it would be nice to run conda develop only. However, I don't kown how we can get from `./package_repo` all the information needed to setup the environment (i.e., dependencies, channels) when no meta.yml is involved. A possible solution is to set it explicitly (as well as additional constraints on the versions of the packages to install) as new options of conda develop, but then it would probably end up adding a lot of conda create/install features to conda develop. Maybe I miss easier solutions (as my knowledge of conda and conda-build logic is quite limited)? > @msarahan it would be neat if conda develop could (optionally) create new envs for you I think I expected `conda develop` to work in the way you want it to: Install and/or update packages so that you can _develop_ on your package. If that is not the case it would definitely be a good option. I will not cover my two usecases though: 1. I usually have a github repo I am working on that is also build into a conda package. What is (kind of) annoying is that once in a while a test on travis fails because some packages were updated (without me noticing) and I need to update my conda environment again. So for this I would like some `conda build` option to update the current environment to the latest packages matching the specifications in `meta.yml`. I think it would be useful if `conda build` would check this when building or even disallow building when your current packages do not represent what would be installed from just using `meta.yml`. All of this should work in the current environment and I assume `conda build` would be the right place to put this functionality 2. I actually need a clean environment to run tests (on travis) that has all the dependencies and at best also all the dependencies in the `test` section of `meta.yml`. I realize that the cleaner way would be to run all the tests when building and put these into the `test` section but for travis CI we decided to run these separately after the build is done. Then use the freshly build package, install it and run the tests. For these we need to recreate the test environment a second time. I assume this would be very easy to implement since conda build can already do that. The earlier proposed `--deps-from PACKAGE` would still be nice and make sense for `conda install` or `conda update` to provide similar functionality, but it is more a convenience for cases where you know a packages dependencies are complete in providing a certain range of packages. When developing this can be helpful but it is not really what you want. It still requires a package to already exists that needs the packages you want. If I understand correctly then these cases are a little different from what @benbovy needs ?! I guess that the main difference from @jhprinz's usecases is that the packages I'd like to contribute are available as conda packages but they don't include any conda recipe in their github repo (the recipes are maintained either in the Continuum's anaconda-recipes repo or as separate conda-forge feedstocks). Moreover, when I'm working on a pull request I often prefer to run unit tests locally on multiple environments (e.g., py27, py35) before committing and pushing my commits, even if these tests will be run again automatically with CI. This way I avoid pushing too many commits like "fix tests with py27"... It would indeed be neat if we could use `conda develop` to automatically create all these environments (at least one command for one environment), though it doesn't seem straightforward as the information needed to setup these environments is usually written in `meta.yml` (which is not directly available here) and/or in files like `.travis.yml`. A solution would be to explicitly provide that information as `conda develop` options, but IMO it feels a bit like copy/pasting the features of `conda create/install` to `conda develop`. In the case explained here, I don't mind using the two commands `conda create; conda develop` to setup one environment, instead of just `conda develop`. The `--deps-from PACKAGE` option would avoid writing `conda create; conda remove; conda develop`. It would also be useful if the command would work when multiple packages are specified. That is, if `packageA` requires `packageB` and `packageC` and the line `conda install --dependencies-only packageA packageB` is run, then only `packageC` would be installed. This behavior would be useful in a CI environment where the tests are run on heads of `packageA` and `packageB`, and not the released package.
2017-05-09T17:59:40
conda/conda
5,269
conda__conda-5269
[ "5147" ]
587594c5247499761671c944fe78da8bd1a3bf1d
diff --git a/conda/cli/main_info.py b/conda/cli/main_info.py --- a/conda/cli/main_info.py +++ b/conda/cli/main_info.py @@ -198,6 +198,9 @@ def get_info_dict(system=False): 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')) + info_dict = dict( platform=context.subdir, conda_version=conda_version, @@ -221,6 +224,7 @@ def get_info_dict(system=False): requests_version=requests_version, user_agent=context.user_agent, conda_location=CONDA_PACKAGE_ROOT, + config_files=config_files, ) if on_win: from ..common.platform import is_admin_on_windows @@ -252,7 +256,7 @@ def get_info_dict(system=False): def get_main_info_str(info_dict): from .._vendor.auxlib.ish import dals - for key in 'pkgs_dirs', 'envs_dirs', 'channels': + for key in 'pkgs_dirs', 'envs_dirs', 'channels', 'config_files': info_dict['_' + key] = ('\n' + 26 * ' ').join(info_dict[key]) info_dict['_rtwro'] = ('writable' if info_dict['root_writable'] else 'read only') @@ -273,6 +277,7 @@ def get_main_info_str(info_dict): package cache : %(_pkgs_dirs)s channel URLs : %(_channels)s config file : %(rc_path)s + config files : %(_config_files)s offline mode : %(offline)s user-agent : %(user_agent)s\ """) % info_dict)
"conda info -a" doesn't tell whole story about condarc files TL;DR: `conda info -a` and `conda config --show` need to list EVERY configuration file they are going to read in, not just the first one they find. I'm using conda inside Anaconda Enterprise. I have conda 4.2.14 in this case (but I've checked and this same problem comes up with 4.3.16). I do a `conda info -a` operation and there are many surprising entries that I cannot find in the listed `.condarc` file: ``` $ conda info -a | grep -i condarc config file : /projects/ijstokes/MarketStructureAnalysis/.condarc $ cat /projects/ijstokes/MarketStructureAnalysis/.condarc envs_dirs: [/projects/ijstokes/MarketStructureAnalysis/envs] channel_alias: http://repo.demo.continuum.io/ ssl_verify: False ``` From some digging I believe this is because conda is picking up a configuration file in `/opt/wakari/anaconda/.condarc` that isn't being reported anywhere (so how would the average person know to go looking for it?) Here is my output: ``` $ conda info -a Current conda install: platform : linux-64 conda version : 4.2.14 conda is private : False conda-env version : 4.2.14 conda-build version : 2.0.6 python version : 2.7.12.final.0 requests version : 2.12.4 root environment : /opt/wakari/anaconda (read only) default environment : /projects/ijstokes/MarketStructureAnalysis/envs/default envs directories : /projects/ijstokes/MarketStructureAnalysis/DEFAULTS /projects/ijstokes/MarketStructureAnalysis/envs /home/ijstokes/.conda/envs /opt/wakari/anaconda/envs package cache : /projects/ijstokes/MarketStructureAnalysis/DEFAULTS/.pkgs /projects/ijstokes/MarketStructureAnalysis/envs/.pkgs /home/ijstokes/.conda/envs/.pkgs /opt/wakari/anaconda/pkgs channel URLs : https://conda.anaconda.org/t/<TOKEN>/anaconda-nb-extensions/linux-64 https://conda.anaconda.org/t/<TOKEN>/anaconda-nb-extensions/noarch http://repo.demo.continuum.io/conda/r-channel/linux-64 http://repo.demo.continuum.io/conda/r-channel/noarch http://repo.demo.continuum.io/conda/wakari/linux-64 http://repo.demo.continuum.io/conda/wakari/noarch http://repo.demo.continuum.io/conda/anaconda/linux-64 http://repo.demo.continuum.io/conda/anaconda/noarch http://repo.demo.continuum.io/conda/anaconda-cluster/linux-64 http://repo.demo.continuum.io/conda/anaconda-cluster/noarch config file : /projects/ijstokes/MarketStructureAnalysis/.condarc offline mode : False # conda environments: # default * /projects/ijstokes/MarketStructureAnalysis/envs/default root /opt/wakari/anaconda sys.version: 2.7.12 |Anaconda custom (64-bit)| (defau... sys.prefix: /opt/wakari/anaconda sys.executable: /opt/wakari/anaconda/bin/python conda location: /opt/wakari/anaconda/lib/python2.7/site-packages/conda conda-build: /opt/wakari/anaconda/bin/conda-build conda-convert: /opt/wakari/anaconda/bin/conda-convert conda-develop: /opt/wakari/anaconda/bin/conda-develop conda-env: /opt/wakari/anaconda/bin/conda-env conda-index: /opt/wakari/anaconda/bin/conda-index conda-inspect: /opt/wakari/anaconda/bin/conda-inspect conda-metapackage: /opt/wakari/anaconda/bin/conda-metapackage conda-render: /opt/wakari/anaconda/bin/conda-render conda-server: /opt/wakari/anaconda/bin/conda-server conda-sign: /opt/wakari/anaconda/bin/conda-sign conda-skeleton: /opt/wakari/anaconda/bin/conda-skeleton user site dirs: CIO_TEST: <not set> CONDA_DEFAULT_ENV: /projects/ijstokes/MarketStructureAnalysis/envs/default CONDA_ENVS_PATH: DEFAULTS LD_LIBRARY_PATH: <not set> PATH: /opt/wakari/anaconda/bin:/opt/anaconda/bin:/projects/ijstokes/MarketStructureAnalysis/envs/default/ bin:/opt/wakari/anaconda/bin:/opt/anaconda/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/opt/aws/bin :/home/ijstokes/.local/bin:/home/ijstokes/bin:/opt/aws/bin PYTHONHOME: <not set> PYTHONPATH: <not set> License directories: /home/ijstokes/.continuum /opt/wakari/anaconda/licenses License files (license*.txt): Package/feature end dates: ``` From another angle: ``` $ conda config --show add_anaconda_token: True add_pip_as_python_dependency: True allow_softlinks: True always_copy: False always_yes: False auto_update_conda: True binstar_upload: None changeps1: True channel_alias: http://repo.demo.continuum.io channel_priority: True channels: - https://conda.anaconda.org/t/an-a642ee89-46f1-41b5-8ebf-0c4ec42db9cb/anaconda-nb-extensions - http://repo.demo.continuum.io/conda/r-channel - http://repo.demo.continuum.io/conda/wakari - http://repo.demo.continuum.io/conda/anaconda - http://repo.demo.continuum.io/conda/anaconda-cluster client_tls_cert: client_tls_cert_key: create_default_packages: - anaconda-client - ipykernel debug: False default_channels: - http://repo.demo.continuum.io/conda/wakari - http://repo.demo.continuum.io/conda/anaconda - http://repo.demo.continuum.io/conda/anaconda-cluster - http://repo.demo.continuum.io/conda/r-channel disallow: [] envs_dirs: - /projects/ijstokes/MarketStructureAnalysis/DEFAULTS - /projects/ijstokes/MarketStructureAnalysis/envs - /home/ijstokes/.conda/envs - /opt/wakari/anaconda/envs json: False offline: False proxy_servers: {} quiet: False shortcuts: True show_channel_urls: None ssl_verify: False track_features: [] update_dependencies: True use_pip: True verbosity: 0 ``` And finally the "hidden" configuration file: ``` $ cat /opt/wakari/anaconda/.condarc channels: - https://conda.anaconda.org/t/an-a642ee89-46f1-41b5-8ebf-0c4ec42db9cb/anaconda-nb-extensions # - http://repo.demo.continuum.io/conda/wakari - http://repo.demo.continuum.io/conda/r-channel - http://repo.demo.continuum.io/conda/wakari - http://repo.demo.continuum.io/conda/anaconda - http://repo.demo.continuum.io/conda/anaconda-cluster # - http://repo.demo.continuum.io/conda/r-channel create_default_packages: - anaconda-client - ipykernel #- anaconda-client #- python #- ipython-we #- pip # Default channels is needed for when users override the system .condarc # with ~/.condarc. This ensures that "defaults" maps to your Anaconda Server and not # repo.continuum.io default_channels: - http://repo.demo.continuum.io/conda/wakari - http://repo.demo.continuum.io/conda/anaconda - http://repo.demo.continuum.io/conda/anaconda-cluster - http://repo.demo.continuum.io/conda/r-channel # channel_alias: http://repo.demo.continuum.io/conda ``` cc @damianavila, @bkreider
Have you tried `conda config --show-sources`? `conda config --show` doesn't show values from the first configuration file found. It shows the final, compiled result from all configuration found. `conda config --show-sources` shows all recognized, uncompiled values in all recognized sources. @kalefranz thanks for clarifying. I think I'd still maintain that the `-a` option on `conda info -a` is not telling the complete story: it should list all configuration files (since `-a` is short for `--all`) rather than make it seem like there is only one config file. You'll see that I did try `conda config --show`. I'll leave it to you to decide if this should remain open or be closed. I think i agree with you @ijstokes. The "config file" key should be enhanced to be a list of config files. Or if you want backward compatibility a new key "config files" should be adding listing all of them and the "config file" key can indicate the highest priority config file. > Or if you want backward compatibility a new key "config files" should be adding listing all of them and the "config file" key can indicate the highest priority config file. That can definitely be done! I guess it would default to being empty if there isn't any configuration set on the system at all?
2017-05-10T02:33:54
conda/conda
5,273
conda__conda-5273
[ "5272" ]
d46ee3535f8049f1f9408bb48246a9f741e58fb0
diff --git a/conda_env/yaml.py b/conda_env/yaml.py --- a/conda_env/yaml.py +++ b/conda_env/yaml.py @@ -6,6 +6,7 @@ from __future__ import absolute_import, print_function from collections import OrderedDict +from conda.common.compat import PY2 from conda.common.yaml import get_yaml yaml = get_yaml() @@ -24,6 +25,12 @@ def represent_ordereddict(dumper, data): yaml.add_representer(OrderedDict, represent_ordereddict) +if PY2: + def represent_unicode(self, data): + return self.represent_str(data.encode('utf-8')) + + yaml.add_representer(unicode, represent_unicode) # NOQA + dump = yaml.dump load = yaml.load dict = OrderedDict
conda env export under python2 is ug ``` $ python2 -m conda_env export -p /conda name: null channels: - !!python/unicode 'file:///Users/kfranz/.conda/conda-bld' - !!python/unicode 'file:///conda/conda-bld' - !!python/unicode 'bkreider' - !!python/unicode 'conda-canary' - !!python/unicode 'conda-forge' - !!python/unicode 'defaults' dependencies: - !!python/unicode 'wget=1.15=2' - !!python/unicode 'conda=4.3.0=py27_0' - !!python/unicode 'conda-env=2.6.0=0' - !!python/unicode 'filelock=2.0.6=py27_0' - !!python/unicode 'boltons=16.3.1=py27_0' - !!python/unicode 'ca-certificates=2016.8.31=0' - !!python/unicode 'certifi=2016.8.31=py27_0' - !!python/unicode 'functools32=3.2.3.2=py27_1' ... ```
2017-05-10T07:58:44
conda/conda
5,274
conda__conda-5274
[ "4596" ]
d46ee3535f8049f1f9408bb48246a9f741e58fb0
diff --git a/conda_env/pip_util.py b/conda_env/pip_util.py --- a/conda_env/pip_util.py +++ b/conda_env/pip_util.py @@ -4,6 +4,8 @@ NOTE: This modules used to in conda, as conda/pip.py """ from __future__ import absolute_import, print_function + +import os from os.path import isfile, join import re import subprocess @@ -52,9 +54,11 @@ def installed(prefix, output=True): if args is None: return args.append('list') + env = os.environ.copy() + env[str('PIP_FORMAT')] = str('legacy') try: pipinst = subprocess.check_output( - args, universal_newlines=True + args, universal_newlines=True, env=env, ).splitlines() except Exception: # Any error should just be ignored
conda env export deprecated? Got a rather strange warning earlier that seemed to imply `conda env export` is going to stop working. I hope I'm just misreading this and/or this warning is talking about something else. FWIW I have found `conda env export` really useful so as to export an environment file to `stdout` that I can then include in issues. This way people can reproduce the issue I'm running into. ```bash $ conda info Current conda install: platform : linux-64 conda version : 4.2.13 conda is private : False conda-env version : 4.2.13 conda-build version : 2.1.2 python version : 3.5.3.final.0 requests version : 2.12.5 root environment : /opt/conda (writable) default environment : /opt/conda/envs/test envs directories : /opt/conda/envs package cache : /opt/conda/pkgs channel URLs : https://conda.anaconda.org/conda-forge/linux-64 https://conda.anaconda.org/conda-forge/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch config file : /root/.condarc offline mode : False $ conda env export DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning. ... ```
It looks like a warning from pip, not from conda. Conda is probably not redirecting pip's stderr. Just a quick reply---yes, that's a pip warning. We'll have to make sure we handle that properly moving forward, but conda env behavior will not be changing because of it. Phew! 😌 Thanks for clarifying. This gets rid of the warning: PIP_FORMAT=legacy conda env export Not yet it isn't! It would still be a good idea to explicitly specify the export format when calling pip. That will get rid of the warning, and you'll never have to worry about the changing default in the future. Oh, I get it. To be added to conda-env. xref https://github.com/conda/conda/issues/5212
2017-05-10T07:58:56
conda/conda
5,275
conda__conda-5275
[ "4795" ]
d46ee3535f8049f1f9408bb48246a9f741e58fb0
diff --git a/conda_env/__main__.py b/conda_env/__main__.py new file mode 100644 --- /dev/null +++ b/conda_env/__main__.py @@ -0,0 +1,5 @@ +import sys + +from .cli.main import main + +sys.exit(main()) diff --git a/conda_env/cli/main_export.py b/conda_env/cli/main_export.py --- a/conda_env/cli/main_export.py +++ b/conda_env/cli/main_export.py @@ -1,13 +1,15 @@ from __future__ import absolute_import, print_function +from argparse import RawDescriptionHelpFormatter import os import textwrap -from argparse import RawDescriptionHelpFormatter -from conda import config -from ..env import from_environment + +from conda.cli.common import add_parser_prefix # conda env import -from conda_env.cli.common import get_prefix +from .common import get_prefix +from ..env import from_environment from ..exceptions import CondaEnvException + description = """ Export a given environment """ @@ -39,13 +41,7 @@ def configure_parser(sub_parsers): action="store_true", help="Do not include .condarc channels", ) - - p.add_argument( - '-n', '--name', - action='store', - help='name of environment (in %s)' % os.pathsep.join(config.envs_dirs), - default=None, - ) + add_parser_prefix(p) p.add_argument( '-f', '--file', @@ -73,7 +69,7 @@ def configure_parser(sub_parsers): # TODO Make this aware of channels that were used to install packages def execute(args, parser): - if not args.name: + if not (args.name or args.prefix): # 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)
conda-env appears to lack support for path-based environments I am trying to use `conda env` with AEN where all the conda environments are path-based (not name-based), however I cannot figure out how to do `conda env attach` or `conda env export` since, so far as I can tell, conda-env only works with name-based conda environments.
2017-05-10T07:59:10
conda/conda
5,276
conda__conda-5276
[ "3689" ]
d46ee3535f8049f1f9408bb48246a9f741e58fb0
diff --git a/conda_env/specs/__init__.py b/conda_env/specs/__init__.py --- a/conda_env/specs/__init__.py +++ b/conda_env/specs/__init__.py @@ -24,4 +24,8 @@ def detect(**kwargs): def build_message(specs): - return "\n".join([s.msg for s in specs if s.msg is not None]) + 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]) diff --git a/conda_env/specs/binstar.py b/conda_env/specs/binstar.py --- a/conda_env/specs/binstar.py +++ b/conda_env/specs/binstar.py @@ -44,7 +44,8 @@ def can_handle(self): # 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" + 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
conda-env 4.2.9 still says to install 'binstar' # Is this a big deal? First, this seems like something minor that I could get in and submit a PR to fix. This isn't going to kill anyone, it's just a minor annoyance that could be cleaned up. I'm sorry if this is already a ticket. I tried searching but _whow_ you guys have a lot of tickets! This is a simple fix that I'll try to come back and submit a PR for if I get the chance. If I file the ticket, I'll be able to find it again for my PR. # Steps to Reproduce 1. Do a clean miniconda install 2. `conda update --all` to get the latest of all the things 3. `conda env create tsnyder/python_training_2016_10` - Refers to https://anaconda.org/tsnyder/python_training_2016_10 # Expected output Something minimal and graceful that says something like > Hey guy. I don't know what `tsnyder/python_training_2016_10` is but I also don't have my buddy `anaconda-client` installed. Please run `conda install anaconda-client` and have an Anaconda Day 🐍 would be nice. # What I got ``` 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 ``` # What to fix? 1. This shouldn't be an "unexpected" error. If `conda env create` takes a positional parameter named `remote_definiton` and you don't have the remote client installed, that should be an expected error that has a cleaner message. Something that says `'{} could not be resolved but you do not have the remote client installed. Please install {}'.format(remote_definition, remote_client)` might be appropriate. 2. It shouldn't be suggesting to install `binstar` anymore. I vaguely remember that the latest `binstar` says "Don't use me anymore" but the UX would be nicer if we didn't send people down that road. # How did I run into this? I'm prepping my userbase for a course that @msarahan is going to be teaching them next week. I'll be advising them to use our Wakari Enterprise install or JupyterHub or ipython in a central environment that I have setup for the purpose of this course. However, I do want to let people know how easy it is to get Anaconda python working on their own systems. So, I'm putting together the instructions on how to do a clean install of miniconda + the environment they need. Since I want to show off Anaconda Repo, I'm trying to do `conda env create` with a `remote_definition` for the first time and noticed the exception mentions installing `binstar`.
Awesome bug report. Which all of them were this detailed. We also accept pull requests 😁 We'll try to get it into a 4.3 release regardless. @nehaljwani Since you have some history here on several of the issues I linked above, do you want to take a stab at fixing this once and for all? It's a bug, so should target 4.3.x. @kalefranz In all of the issues linked above, I think the reporters always started with keeping their environment files in unexpected locations like `/path/to/conda_installation/envs` or `$CONDA_PREFIX/bin` or just had them in their `Downloads` folder and expected conda to magically find it. Asking the reporters to provide the complete path to the environment.yml file seemed easier than explaining them to use relative paths correctly (../ vs ..\\) or placing the file in the current directory (they may respawn the prompt and end up changing directory to somewhere else) I have never been able to reproduce this stack trace on Linux or Windows when the environment.yml file is correctly pointed to, whether it is a relative path or absolute path or just kept in the current directory. The code flow triggers the `from_file()` function at https://github.com/conda/conda/blob/master/conda_env/env.py#L75-L77 and seems correct to me since there doesn't seem to be any call to `os.chdir()` in between. So I don't think `os.path.join(os.getcwd(), args.file)` is really needed here. ``` (root) C:\Users\nwani>notepad env.yml (root) C:\Users\nwani>type env.yml name: python_training_2016_10 dependencies: - python=3.4 - jupyter - numpy - future - matplotlib - scipy - pillow - bokeh - scikit-learn - xlrd - h5py - lxml - openpyxl - xlwt - cython - numba - cffi - line_profiler - netcdf4 - blaze - dask - seaborn - html5lib - beautifulsoup4 - nltk - memory_profiler (root) C:\Users\nwani>conda env create -f env.yml Fetching package metadata ........... Solving package specifications: . mkl-2017.0.1-0 52% |################ | ETA: 0:00:05 10.85 MB/s ... ``` Also, (I may be wrong, but ...) this particular GH issue is trying to point out something else. I think the OP is trying to say that when `anaconda-client` is not installed, instead of the error message being: ``` (root) ubuntu@condaexpts:~$ conda env create tsnyder/python_training_2016_10 SpecNotFound: Please install binstar Please install nbformat: conda install nbformat Conda Env Exception: environment.yml file not found There is no requirements.txt ``` It should say something like (which can be done by `raise exceptions.NoBinstar()`): ``` (root) ubuntu@condaexpts:~$ conda env create tsnyder/python_training_2016_10 The anaconda-client cli must be installed to perform this action ``` Sounds like I've basically flubbed up the whole entire issue! Glad you corrected everything @nehaljwani :)
2017-05-10T08:41:35
conda/conda
5,284
conda__conda-5284
[ "1427" ]
ef896b73f3191cdee93a13fb19ce2a4e79c94767
diff --git a/conda/cli/install.py b/conda/cli/install.py --- a/conda/cli/install.py +++ b/conda/cli/install.py @@ -35,8 +35,6 @@ def check_prefix(prefix, json=False): name = basename(prefix) error = None - if name.startswith('.'): - error = "environment name cannot start with '.': %s" % name if name == ROOT_ENV_NAME: error = "'%s' is a reserved environment name" % name if exists(prefix): diff --git a/conda/misc.py b/conda/misc.py --- a/conda/misc.py +++ b/conda/misc.py @@ -12,14 +12,15 @@ import sys from ._vendor.auxlib.path import expand +from .base.constants import PREFIX_MAGIC_FILE from .base.context import context from .common.compat import iteritems, iterkeys, itervalues, on_win, open from .common.path import url_to_path, win_path_ok from .common.url import is_url, join_url, path_to_url, unquote -from .core.index import get_index, _supplement_index_with_cache +from .core.index import _supplement_index_with_cache, get_index from .core.linked_data import linked_data from .core.package_cache import PackageCache, ProgressiveFetchExtract -from .exceptions import FileNotFoundError, ParseError, PackageNotFoundError +from .exceptions import FileNotFoundError, PackageNotFoundError, ParseError from .gateways.disk.delete import rm_rf from .gateways.disk.link import islink from .instructions import LINK, UNLINK @@ -329,10 +330,8 @@ def list_prefixes(): if not isdir(envs_dir): continue for dn in sorted(os.listdir(envs_dir)): - if dn.startswith('.'): - continue prefix = join(envs_dir, dn) - if isdir(prefix): + if isdir(prefix) and isfile(join(prefix, PREFIX_MAGIC_FILE)): prefix = join(envs_dir, dn) yield prefix
Creating a virtual environment starting with '.' (dot/period) Hi, Is there any way to create a virtual environment that starts with a '.' (dot/period)? I am running a program that searches for virtual python environments in a specific dot-prefixed folder name. The developers for that software use `virtualenv` for their environment, but I would like to keep using conda and was wondering if there is a workaround for this. Cheers
What error do you get? I didn't know there was a restriction. Ah, it looks like we do indeed restrict it. ``` kfranz@0283:~/continuum/conda *test-requests ❯ python -m conda create -n .someenv CondaValueError: environment name cannot start with '.': .someenv ``` I've traced that restriction down to b9f5528c1399612f8513b81eb432af0e3fd8c186. I also don't understand the technical reason it was implemented. The commit author also didn't remember much context.
2017-05-10T19:32:52
conda/conda
5,308
conda__conda-5308
[ "1713" ]
19c3c149801bbc4a9a0b834306e21cab6f7c81f0
diff --git a/conda/cli/main_package.py b/conda/cli/main_package.py --- a/conda/cli/main_package.py +++ b/conda/cli/main_package.py @@ -263,9 +263,11 @@ def which_package(path): if prefix is None: from ..exceptions import CondaVerificationError raise CondaVerificationError("could not determine conda prefix from: %s" % path) + + from ..common.path import paths_equal for dist in linked(prefix): meta = is_linked(prefix, dist) - if any(abspath(join(prefix, f)) == path for f in meta['files']): + if any(paths_equal(join(prefix, f), path) for f in meta['files']): yield dist diff --git a/conda/common/path.py b/conda/common/path.py --- a/conda/common/path.py +++ b/conda/common/path.py @@ -3,7 +3,7 @@ from functools import reduce import os -from os.path import basename, dirname, join, split, splitext +from os.path import basename, dirname, join, split, splitext, abspath, normpath import re from .compat import on_win, string_types @@ -42,6 +42,16 @@ def is_path(value): return re.match(PATH_MATCH_REGEX, value) +def paths_equal(path1, path2): + """ + Examples: + >>> paths_equal('/a/b/c', '/a/b/c/d/..') + True + + """ + return normpath(abspath(path1)) == normpath(abspath(path2)) + + @memoize def url_to_path(url): """Convert a file:// URL to a path.
`conda package -w` is case dependent on Windows It should be case-insensitive, because windows filesystem is case insensitive. E.g., when I run from the environment root: `conda package -w Lib\site-packages\win32\win32file.pyd` Ir finds the package, but if I run `conda package -w lib\site-packages\win32\win32file.pyd` it will report nothing.
I think the problem is the function [`which_path`](https://github.com/conda/conda/blob/master/conda/misc.py#L149) uses string comparisons to test equality against file paths. I think that function should use [`os.path.normpath()`](https://docs.python.org/2/library/os.path.html#os.path.normcase) on all paths to make the path components all lower-case so string comparison works. In fact, a nice path equality utility function that could be used throughout conda would be: ``` python from os.path import normpath, abspath def paths_equal(path1, path2): return normpath(abspath(path1)) == normpath(abspath(path2)) ```
2017-05-12T22:44:25
conda/conda
5,309
conda__conda-5309
[ "2511", "2511" ]
19c3c149801bbc4a9a0b834306e21cab6f7c81f0
diff --git a/conda/cli/main_config.py b/conda/cli/main_config.py --- a/conda/cli/main_config.py +++ b/conda/cli/main_config.py @@ -188,6 +188,11 @@ def configure_parser(sub_parsers): 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", @@ -354,6 +359,15 @@ def execute_config(args, parser): else: print("--add", key, repr(item)) + if args.stdin: + content = sys.stdin.read() + try: + parsed = yaml_load(content) + except Exception: # pragma: no cover + from ..exceptions import ParseError + raise ParseError("invalid yaml content:\n%s" % content) + rc_config.update(parsed) + # prepend, append, add for arg, prepend in zip((args.prepend, args.append), (True, False)): sequence_parameters = [p for p in context.list_parameters()
conda should take config information from --file and stdin conda should take config information from --file and stdin
2017-05-12T23:52:29
conda/conda
5,310
conda__conda-5310
[ "4302" ]
19c3c149801bbc4a9a0b834306e21cab6f7c81f0
diff --git a/conda/cli/main_config.py b/conda/cli/main_config.py --- a/conda/cli/main_config.py +++ b/conda/cli/main_config.py @@ -383,18 +383,31 @@ def execute_config(args, parser): json_warnings.append(message) arglist.insert(0 if prepend else len(arglist), item) + primitive_parameters = frozenset( + p for p in context.list_parameters() + if context.describe_parameter(p)['parameter_type'] == 'primitive' + ) + map_parameters = frozenset( + p for p in context.list_parameters() + if context.describe_parameter(p)['parameter_type'] == 'map' + ) + # 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: + 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) - value = context.typify_parameter(key, item) - rc_config[key] = value # 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 @@ -408,6 +421,7 @@ def execute_config(args, parser): # 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" %
diff --git a/tests/test_config.py b/tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -660,12 +660,31 @@ def test_config_set(): assert stdout == '' assert stderr == '' + with open(rc) as fh: + content = yaml_load(fh.read()) + assert content['always_yes'] is True + stdout, stderr, return_code = run_command(Commands.CONFIG, '--file', rc, '--set', 'always_yes', 'no') assert stdout == '' assert stderr == '' + with open(rc) as fh: + content = yaml_load(fh.read()) + assert content['always_yes'] is False + + stdout, stderr, return_code = run_command(Commands.CONFIG, '--file', rc, + '--set', 'proxy_servers.http', '1.2.3.4:5678') + + assert stdout == '' + assert stderr == '' + + with open(rc) as fh: + content = yaml_load(fh.read()) + assert content['always_yes'] is False + assert content['proxy_servers'] == {'http': '1.2.3.4:5678'} + def test_set_rc_string(): # Test setting string keys in .condarc
Unable to set conda-build.root-dir with config Not sure the right way to do this, but it looks like there might not be any right way ATM. I would like to be able to use `conda config` to get the following added to my `.condarc` file. ```yaml conda-build: root-dir: /tmp ``` If I try to set `conda-build.root-dir` with `conda config`, I get this error. ```bash $ conda config --set "conda-build.root-dir" "/tmp" CondaValueError: Value error: Error key must be one of add_anaconda_token, shortcuts, add_pip_as_python_dependency, ssl_verify, client_tls_cert, binstar_upload, use_pip, add_binstar_token, always_copy, always_yes, client_tls_cert_key, channel_alias, changeps1, channel_priority, show_channel_urls, update_dependencies, allow_softlinks, anaconda_upload, offline, allow_other_channels, auto_update_conda, not conda-build.root-dir ```
cc @msarahan `conda config --set` doesn't currently support map-type parameters. It should be possible to do `conda config --set proxy_servers.http 1.2.3.4:4004` and `conda config --get proxy_servers.http`
2017-05-13T00:18:04
conda/conda
5,311
conda__conda-5311
[ "4986" ]
e7b1a6bf1eac0f00b84cb70911d5df0694978119
diff --git a/conda/cli/main_clean.py b/conda/cli/main_clean.py --- a/conda/cli/main_clean.py +++ b/conda/cli/main_clean.py @@ -120,7 +120,7 @@ def rm_tarballs(args, pkgs_dirs, totalsize, verbose=True): print(fmt % ('Total:', human_bytes(totalsize))) print() - if not context.json: + if not context.json or not context.yes: confirm_yn(args) if context.json and args.dry_run: return @@ -218,7 +218,7 @@ def rm_pkgs(args, pkgs_dirs, warnings, totalsize, pkgsizes, print(fmt % ('Total:', human_bytes(totalsize))) print() - if not context.json: + if not context.json or not context.yes: confirm_yn(args) if context.json and args.dry_run: return @@ -279,7 +279,7 @@ def rm_source_cache(args, cache_dirs, warnings, cache_sizes, total_size): print("%-40s %10s" % ("Total:", human_bytes(total_size))) - if not context.json: + if not context.json or not context.yes: confirm_yn(args) if context.json and args.dry_run: return
--yes not functioning for "Clean" Hi, either `conda clean -y --all` or `conda clean --yes --all` still prompt for a confirmation. conda 4.2.13 macOS 10.12.4
@kalefranz should this be fixed for 4.1 onwards or? Confirmed here as well. `conda==4.2.13` `Windows 32-bit` Probably at least 4.2 onward.
2017-05-13T00:33:15
conda/conda
5,312
conda__conda-5312
[ "5256", "4302" ]
d0399db929580685ed0790f64d55b60d4b10ed64
diff --git a/conda/cli/main_config.py b/conda/cli/main_config.py --- a/conda/cli/main_config.py +++ b/conda/cli/main_config.py @@ -21,8 +21,7 @@ from ..common.configuration import pretty_list, pretty_map from ..common.constants import NULL from ..common.yaml import yaml_dump, yaml_load -from ..config import (rc_bool_keys, rc_list_keys, rc_other, rc_string_keys, sys_rc_path, - user_rc_path) +from ..config import rc_other, sys_rc_path, user_rc_path descr = """ Modify configuration values in .condarc. This is modeled after the git @@ -228,6 +227,10 @@ def format_dict(d): def execute_config(args, parser): + try: + from cytoolz.itertoolz import groupby + except ImportError: # pragma: no cover + from .._vendor.toolz.itertoolz import groupby # NOQA from .._vendor.auxlib.entity import EntityEncoder json_warnings = [] json_get = {} @@ -317,13 +320,19 @@ def execute_config(args, parser): 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 rc_list_keys + rc_bool_keys + rc_string_keys: + if key not in primitive_parameters + sequence_parameters: if key not in rc_other: message = "unknown key %s" % key if not context.json: @@ -356,8 +365,6 @@ def execute_config(args, parser): # 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'] @@ -385,16 +392,20 @@ def execute_config(args, parser): # 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: + 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) - value = context.typify_parameter(key, item) - rc_config[key] = value # 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 @@ -408,6 +419,7 @@ def execute_config(args, parser): # 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" %
diff --git a/tests/test_config.py b/tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -656,15 +656,38 @@ def test_config_set(): with make_temp_condarc() as rc: stdout, stderr, return_code = run_command(Commands.CONFIG, '--file', rc, '--set', 'always_yes', 'yes') - assert stdout == '' assert stderr == '' + with open(rc) as fh: + content = yaml_load(fh.read()) + assert content['always_yes'] is True stdout, stderr, return_code = run_command(Commands.CONFIG, '--file', rc, '--set', 'always_yes', 'no') + assert stdout == '' + assert stderr == '' + with open(rc) as fh: + content = yaml_load(fh.read()) + assert content['always_yes'] is False + stdout, stderr, return_code = run_command(Commands.CONFIG, '--file', rc, + '--set', 'proxy_servers.http', '1.2.3.4:5678') assert stdout == '' assert stderr == '' + with open(rc) as fh: + content = yaml_load(fh.read()) + assert content['always_yes'] is False + assert content['proxy_servers'] == {'http': '1.2.3.4:5678'} + + stdout, stderr, return_code = run_command(Commands.CONFIG, '--file', rc, + '--set', 'ssl_verify', 'false') + assert stdout == '' + assert stderr == '' + + stdout, stderr, return_code = run_command(Commands.CONFIG, '--file', rc, + '--get', 'ssl_verify') + assert stdout.strip() == '--set ssl_verify False' + assert stderr == '' def test_set_rc_string():
Enable ssl_verify with config --get `config get ssl_verify` Gives ``` usage: conda config [-h] [--json] [--debug] [--verbose] [--system | --env | --file FILE] (--show | --show-sources | --validate | --describe | --get [KEY [KEY ...]] | --append KEY VALUE | --prepend KEY VALUE | --set KEY VALUE | --remove KEY VALUE | --remove-key KEY) conda config: error: argument --get: invalid choice: 'ssl_verify' (choose from 'channels', 'disallow', 'create_default_packages', 'track_features', 'envs_dirs', 'pkgs_dirs', 'default_channels', 'pinned_packages', 'add_binstar_token', 'add_anaconda_token', 'add_pip_as_python_dependency', 'always_yes', 'always_copy', 'allow_softlinks', 'always_softlink', 'auto_update_conda', 'changeps1', 'use_pip', 'offline', 'binstar_upload', 'anaconda_upload', 'show_channel_urls', 'allow_other_channels', 'update_dependencies', 'channel_priority', 'shortcuts') ``` It should be possible to set it, it is a valid config parameter Unable to set conda-build.root-dir with config Not sure the right way to do this, but it looks like there might not be any right way ATM. I would like to be able to use `conda config` to get the following added to my `.condarc` file. ```yaml conda-build: root-dir: /tmp ``` If I try to set `conda-build.root-dir` with `conda config`, I get this error. ```bash $ conda config --set "conda-build.root-dir" "/tmp" CondaValueError: Value error: Error key must be one of add_anaconda_token, shortcuts, add_pip_as_python_dependency, ssl_verify, client_tls_cert, binstar_upload, use_pip, add_binstar_token, always_copy, always_yes, client_tls_cert_key, channel_alias, changeps1, channel_priority, show_channel_urls, update_dependencies, allow_softlinks, anaconda_upload, offline, allow_other_channels, auto_update_conda, not conda-build.root-dir ```
cc @msarahan `conda config --set` doesn't currently support map-type parameters. It should be possible to do `conda config --set proxy_servers.http 1.2.3.4:4004` and `conda config --get proxy_servers.http`
2017-05-13T01:26:17
conda/conda
5,313
conda__conda-5313
[ "2173" ]
01352cfa00587b87f78d444f2ca896de91ed9716
diff --git a/conda/cli/main_clean.py b/conda/cli/main_clean.py --- a/conda/cli/main_clean.py +++ b/conda/cli/main_clean.py @@ -12,7 +12,7 @@ from os.path import getsize, isdir, join import sys -from .conda_argparse import add_parser_json, add_parser_yes +from .conda_argparse import add_parser_json, add_parser_quiet, add_parser_yes from ..base.constants import CONDA_TARBALL_EXTENSION from ..base.context import context @@ -37,6 +37,7 @@ def configure_parser(sub_parsers): ) add_parser_yes(p) add_parser_json(p) + add_parser_quiet(p) p.add_argument( "-a", "--all", action="store_true", @@ -151,7 +152,8 @@ def find_pkgs(): pkgs_dirs = defaultdict(list) for pkgs_dir in context.pkgs_dirs: if not os.path.exists(pkgs_dir): - print("WARNING: {0} does not exist".format(pkgs_dir)) + if not context.json: + print("WARNING: {0} does not exist".format(pkgs_dir)) continue pkgs = [i for i in listdir(pkgs_dir) if (isdir(join(pkgs_dir, i)) and # only include actual packages @@ -272,19 +274,20 @@ def rm_source_cache(args, cache_dirs, warnings, cache_sizes, total_size): from ..gateways.disk.delete import rm_rf from ..utils import human_bytes - verbose = not context.json + verbose = not (context.json or context.quiet) if warnings: if verbose: for warning in warnings: print(warning, file=sys.stderr) return - for cache_type in cache_dirs: - print("%s (%s)" % (cache_type, cache_dirs[cache_type])) - print("%-40s %10s" % ("Size:", human_bytes(cache_sizes[cache_type]))) - print() + if verbose: + for cache_type in cache_dirs: + print("%s (%s)" % (cache_type, cache_dirs[cache_type])) + print("%-40s %10s" % ("Size:", human_bytes(cache_sizes[cache_type]))) + print() - print("%-40s %10s" % ("Total:", human_bytes(total_size))) + print("%-40s %10s" % ("Total:", human_bytes(total_size))) if not context.json or not context.yes: confirm_yn(args) @@ -292,7 +295,8 @@ def rm_source_cache(args, cache_dirs, warnings, cache_sizes, total_size): return for dir in cache_dirs.values(): - print("Removing %s" % dir) + if verbose: + print("Removing %s" % dir) rm_rf(dir) @@ -311,7 +315,7 @@ def execute(args, parser): 'files': pkgs_dirs[first], # Backwards compatibility 'total_size': totalsize } - rm_tarballs(args, pkgs_dirs, totalsize, verbose=not context.json) + rm_tarballs(args, pkgs_dirs, totalsize, verbose=not (context.json or context.quiet)) if args.index_cache or args.all: json_result['index_cache'] = { @@ -331,7 +335,7 @@ def execute(args, parser): 'pkg_sizes': {i: dict(zip(pkgs_dirs[i], pkgsizes[i])) for i in pkgs_dirs}, } rm_pkgs(args, pkgs_dirs, warnings, totalsize, pkgsizes, - verbose=not context.json) + verbose=not (context.json or context.quiet)) if args.source_cache or args.all: json_result['source_cache'] = find_source_cache()
Add quiet option to conda clean Would be nice to have a quiet option that simply told how much disk space was freed from each of the storage areas instead of listing all packages removed.
2017-05-13T04:21:51
conda/conda
5,314
conda__conda-5314
[ "1992" ]
01352cfa00587b87f78d444f2ca896de91ed9716
diff --git a/conda/cli/conda_argparse.py b/conda/cli/conda_argparse.py --- a/conda/cli/conda_argparse.py +++ b/conda/cli/conda_argparse.py @@ -381,20 +381,10 @@ def add_parser_known(p): def add_parser_use_index_cache(p): p.add_argument( - "--use-index-cache", + "-C", "--use-index-cache", action="store_true", default=False, - help="Use cache of channel index files.", - ) - - -def add_parser_no_use_index_cache(p): - p.add_argument( - "--no-use-index-cache", - action="store_false", - default=True, - dest="use_index_cache", - help="Force fetching of channel index files.", + help="Use cache of channel index files, even if it has expired.", ) diff --git a/conda/cli/main_remove.py b/conda/cli/main_remove.py --- a/conda/cli/main_remove.py +++ b/conda/cli/main_remove.py @@ -13,10 +13,9 @@ import sys from .conda_argparse import (add_parser_channels, add_parser_help, add_parser_insecure, - add_parser_json, add_parser_no_pin, add_parser_no_use_index_cache, - add_parser_offline, add_parser_prefix, add_parser_pscheck, - add_parser_quiet, add_parser_use_index_cache, add_parser_use_local, - add_parser_yes) + add_parser_json, add_parser_no_pin, add_parser_offline, + add_parser_prefix, add_parser_pscheck, add_parser_quiet, + add_parser_use_index_cache, add_parser_use_local, add_parser_yes) help = "%s a list of packages from a specified conda environment." descr = help + """ @@ -82,7 +81,6 @@ def configure_parser(sub_parsers, name='remove'): add_parser_prefix(p) add_parser_quiet(p) # Putting this one first makes it the default - add_parser_no_use_index_cache(p) add_parser_use_index_cache(p) add_parser_use_local(p) add_parser_offline(p)
add short option for "--use-index-cache" `--use-index-cache` makes search and info much faster, but it's a lot of characters to type. Could you add a short equivalent? To propose something: it could be a capital C like in yum/dnf: ``` -C, --cacheonly Run entirely from system cache, don't update the cache and use it even in case it is expired. ```
2017-05-13T04:49:00
conda/conda
5,316
conda__conda-5316
[ "5315" ]
c40d1013b0998935a693f758d8198579f02f58b2
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -103,7 +103,7 @@ class Context(Configuration): # remote connection details ssl_verify = PrimitiveParameter(True, element_type=string_types + (bool,), - aliases=('insecure',), + aliases=('insecure', 'verify_ssl',), validation=ssl_verify_validation) client_ssl_cert = PrimitiveParameter(None, aliases=('client_cert',), element_type=string_types + (NoneType,))
We should add an alias to `ssl_verify` -> `verify_ssl` Having this would allow to have parity with anaconda-client configuration and perhaps `verify_ssl` is a better name. Thoughts @kalefranz ? ---- Related to https://github.com/conda/conda/issues/5256
2017-05-14T10:47:09
conda/conda
5,333
conda__conda-5333
[ "3399" ]
714412283af4e9d8bd520ab8e7c3e944926833b5
diff --git a/conda/cli/main_info.py b/conda/cli/main_info.py --- a/conda/cli/main_info.py +++ b/conda/cli/main_info.py @@ -11,12 +11,12 @@ from logging import getLogger import os from os import listdir -from os.path import exists, expanduser, join +from os.path import exists, expanduser, isfile, join import re import sys from .common import add_parser_json, add_parser_offline, arg2spec, handle_envs_list, stdout_json -from ..common.compat import itervalues, on_win, iteritems +from ..common.compat import iteritems, itervalues, on_win log = getLogger(__name__) @@ -170,6 +170,11 @@ def get_info_dict(system=False): 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: requests_version = "could not import" except Exception as e: @@ -199,6 +204,12 @@ def get_info_dict(system=False): for c in channels] channels = [mask_anaconda_token(c) for c in channels] + netrc_file = os.environ.get('NETRC') + if not netrc_file: + user_netrc = expanduser("~/.netrc") + if isfile(user_netrc): + netrc_file = user_netrc + info_dict = dict( platform=context.subdir, conda_version=conda_version, @@ -222,6 +233,7 @@ def get_info_dict(system=False): requests_version=requests_version, user_agent=user_agent, conda_location=CONDA_PACKAGE_ROOT, + netrc_file=netrc_file, ) if on_win: from ..common.platform import is_admin_on_windows @@ -274,6 +286,7 @@ def get_main_info_str(info_dict): package cache : %(_pkgs_dirs)s channel URLs : %(_channels)s config file : %(rc_path)s + netrc file : %(netrc_file)s offline mode : %(offline)s user-agent : %(user_agent)s\ """) % info_dict) diff --git a/conda/common/platform.py b/conda/common/platform.py --- a/conda/common/platform.py +++ b/conda/common/platform.py @@ -20,10 +20,11 @@ def is_admin_on_windows(): # pragma: unix no cover try: from ctypes.windll.shell32 import IsUserAnAdmin return IsUserAnAdmin() != 0 - except ImportError: + except ImportError as e: + log.debug('%r', e) return 'unknown' except Exception as e: - log.warn(repr(e)) + log.warn('%r', e) return 'unknown'
Error while installing packages from conda-forge or other channels Hi this issue has been reported initially on conda-forge, but seems to be a general conda problem: https://github.com/conda-forge/conda-forge.github.io/issues/226 Briefly, on a Mac OS X, I get an error "UNAUTHORIZED" error message when installing packages from anaconda cloud channels, in particular conda-forge and my own channel tritemio. For example (with conda-forge in `.condarc`) I get this error: ``` $ conda install phconvert Using Anaconda API: https://api.anaconda.org Fetching package metadata ......Warning: you may need to login to anaconda.org again with 'anaconda login' to access private packages(https://conda.anaconda.org/t/<TOKEN>/conda-forge/osx-64/, 401 Client Error: UNAUTHORIZED for url: https://conda.anaconda.org/t/tr-61d09b16-e11e-4d45-a499-f2ee3e7a348f/conda-forge/osx-64/repodata.json)Warning: you may need to login to anaconda.org again with 'anaconda login' to access private packages(https://conda.anaconda.org/t/<TOKEN>/conda-forge/noarch/, 401 Client Error: UNAUTHORIZED for url: https://conda.anaconda.org/t/tr-61d09b16-e11e-4d45-a499-f2ee3e7a348f/conda-forge/noarch/repodata.json)..... Solving package specifications: .......... Package plan for installation in environment /Users/anto/miniconda3: The following packages will be downloaded: package | build ---------------------------|----------------- phconvert-0.7 | py35_0 213 KB conda-forge The following NEW packages will be INSTALLED: future: 0.15.2-py35_0 hdf5: 1.8.17-1 numexpr: 2.6.1-np111py35_0 phconvert: 0.7-py35_0 conda-forge pytables: 3.2.3.1-np111py35_0 Proceed ([y]/n)? Fetching packages ... Error: HTTPError: 401 Client Error: UNAUTHORIZED for url: https://conda.anaconda.org/t/tr-61d09b16-e11e-4d45-a499-f2ee3e7a348f/conda-forge/osx-64/phconvert-0.7-py35_0.tar.bz2: https://conda.anaconda.org/t/tr-61d09b16-e11e-4d45-a499-f2ee3e7a348f/conda-forge/osx-64/phconvert-0.7-py35_0.tar.bz2 $ ``` I get a similar error when trying to install phconvert from my own channel which used to work (the last release is several months old). I even tried reinstalling miniconda but I still get the same error. Please refer to the original issue for more details.
Logging out from anaconda cloud with `anaconda-client` solves the issue: ``` $ anaconda logout ``` Weird that conda installation was so badly broken due to the unrelated login used to **upload** the packages. cc @pmlandwehr I believe this is fixed as of conda `4.2.11`. Can anybody associated with this ticket help verify? @tritemio @jakirkham @pmlandwehr If conda 4.2.11 is in the default channels yet, it will be sometime tomorrow. Someone from conda-forge will need to merge https://github.com/conda-forge/conda-feedstock/pull/6. conda 4.2.11 doesn't work for a conda-forge instsll on a Mac for me: ``` $ conda --version conda 4.2.11 $ conda install --channel conda-forge ulmo Fetching package metadata ....... CondaHTTPError: HTTP 401 UNAUTHORIZED for url <https://conda.anaconda.org/t/dr-98f97490-dba1-424f-8887-0c26a10ab64c/conda-forge/osx-64/repodata.json> The remote server has indicated you are using invalid credentials for this channel. If the remote site is anaconda.org or follows the Anaconda Server API, you will need to (a) login to the site with `anaconda login`, or (b) provide conda with a valid token directly. Further configuration help can be found at <http://conda.pydata.org/docs/config.html>. $ anaconda whoami Using Anaconda API: https://api.anaconda.org Username: drf5n Member since: Sat Jun 13 10:01:53 2015 +name: David Forrest +url: http://www.vims.edu/~drf +company: VIMS +user_type: user +location: USA +description: $ anaconda logout Using Anaconda API: https://api.anaconda.org logout successful $ conda install --channel conda-forge ulmo Fetching package metadata ....... CondaHTTPError: HTTP 401 UNAUTHORIZED for url <https://conda.anaconda.org/conda-forge/osx-64/repodata.json> The remote server has indicated you are using invalid credentials for this channel. If the remote site is anaconda.org or follows the Anaconda Server API, you will need to (a) login to the site with `anaconda login`, or (b) provide conda with a valid token directly. Further configuration help can be found at <http://conda.pydata.org/docs/config.html>. $ anaconda login Using Anaconda API: https://api.anaconda.org Username: drf5n drf5n's Password: login successful $ anaconda whoami Using Anaconda API: https://api.anaconda.org Username: drf5n Member since: Sat Jun 13 10:01:53 2015 +name: David Forrest +url: http://www.vims.edu/~drf +company: VIMS +user_type: user +location: USA +description: $ conda install --channel conda-forge ulmo Fetching package metadata ....... CondaHTTPError: HTTP 401 UNAUTHORIZED for url <https://conda.anaconda.org/t/dr-0eb923a1-5cce-4961-856a-1b18e2a98a49/conda-forge/osx-64/repodata.json> The remote server has indicated you are using invalid credentials for this channel. If the remote site is anaconda.org or follows the Anaconda Server API, you will need to (a) login to the site with `anaconda login`, or (b) provide conda with a valid token directly. Further configuration help can be found at <http://conda.pydata.org/docs/config.html>. $ ``` and ``` $ conda install --channel conda-forge ulmo -vv DEBUG conda.cli.main:_main(143): verbosity set to 2 DEBUG conda.common.url:path_to_url(36): /Users/drf/anaconda/conda-bld converted to file:///Users/drf/anaconda/conda-bld DEBUG conda.fetch:fetch_index(288): channel_urls=OrderedDict([(u'https://conda.anaconda.org/conda-forge/osx-64', (u'conda-forge', 0)), (u'https://conda.anaconda.org/conda-forge/noarch', (u'conda-forge', 0)), (u'https://repo.continuum.io/pkgs/free/osx-64', (u'defaults', 1)), (u'https://repo.continuum.io/pkgs/free/noarch', (u'defaults', 1)), (u'https://repo.continuum.io/pkgs/pro/osx-64', (u'defaults', 1)), (u'https://repo.continuum.io/pkgs/pro/noarch', (u'defaults', 1))]) Fetching package metadata ...DEBUG requests.packages.urllib3.util.retry:from_int(155): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None) DEBUG requests.packages.urllib3.util.retry:from_int(155): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None) DEBUG requests.packages.urllib3.util.retry:from_int(155): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None) DEBUG conda.fetch:fetch_repodata(86): Opening repodata cache for https://conda.anaconda.org/conda-forge/noarch at /Users/drf/anaconda/pkgs/cache/36521c4e.json DEBUG requests.packages.urllib3.util.retry:from_int(155): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None) DEBUG conda.fetch:fetch_repodata(86): Opening repodata cache for https://conda.anaconda.org/conda-forge/osx-64 at /Users/drf/anaconda/pkgs/cache/fdfa8174.json DEBUG conda.fetch:fetch_repodata(86): Opening repodata cache for https://repo.continuum.io/pkgs/free/osx-64 at /Users/drf/anaconda/pkgs/cache/840cf1fb.json DEBUG requests.packages.urllib3.util.retry:from_int(155): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None) DEBUG conda.fetch:fetch_repodata(86): Opening repodata cache for https://repo.continuum.io/pkgs/free/noarch at /Users/drf/anaconda/pkgs/cache/524e4676.json DEBUG requests.packages.urllib3.util.retry:from_int(155): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None) DEBUG conda.fetch:fetch_repodata(86): Opening repodata cache for https://repo.continuum.io/pkgs/pro/osx-64 at /Users/drf/anaconda/pkgs/cache/ad7eda34.json DEBUG conda.fetch:fetch_repodata(86): Opening repodata cache for https://repo.continuum.io/pkgs/pro/noarch at /Users/drf/anaconda/pkgs/cache/f1a0ac49.json DEBUG conda.connection:add_binstar_token(138): Adding anaconda token for url <https://conda.anaconda.org/conda-forge/osx-64/repodata.json> DEBUG conda.connection:add_binstar_token(138): Adding anaconda token for url <https://conda.anaconda.org/conda-forge/noarch/repodata.json> INFO requests.packages.urllib3.connectionpool:_new_conn(735): Starting new HTTPS connection (1): repo.continuum.io INFO requests.packages.urllib3.connectionpool:_new_conn(735): Starting new HTTPS connection (1): repo.continuum.io INFO requests.packages.urllib3.connectionpool:_new_conn(735): Starting new HTTPS connection (1): conda.anaconda.org INFO requests.packages.urllib3.connectionpool:_new_conn(735): Starting new HTTPS connection (1): repo.continuum.io INFO requests.packages.urllib3.connectionpool:_new_conn(735): Starting new HTTPS connection (1): repo.continuum.io INFO requests.packages.urllib3.connectionpool:_new_conn(735): Starting new HTTPS connection (1): conda.anaconda.org DEBUG requests.packages.urllib3.connectionpool:_make_request(383): "GET /pkgs/free/osx-64/repodata.json.bz2 HTTP/1.1" 304 0 DEBUG conda.fetch:fetch_repodata(118): > GET /pkgs/free/osx-64/repodata.json.bz2 HTTPS > User-Agent: conda/4.2.11 requests/2.7.0 CPython/2.7.11 Darwin/14.5.0 OSX/10.10.5 > Accept: */* > Accept-Encoding: identity > Authorization: Basic YW5vbnltb3VzOnVzZXJAc2l0ZQ== > Connection: keep-alive > If-Modified-Since: Fri, 28 Oct 2016 20:51:24 GMT > If-None-Match: "5813ba4c-4f0de" < HTTPS 304 Not Modified > cache-control: public, max-age=300 > cf-cache-status: HIT > cf-ray: 2fa8d7673b0f0f09-IAD > connection: keep-alive > date: Mon, 31 Oct 2016 17:31:34 GMT > etag: "5813ba4c-4f0de" > expires: Mon, 31 Oct 2016 17:36:34 GMT > last-modified: Fri, 28 Oct 2016 20:51:24 GMT > server: cloudflare-nginx > set-cookie: __cfduid=d08ad45dbc453138385fe3ec96ec5a9001477935094; expires=Tue, 31-Oct-17 17:31:34 GMT; path=/; domain=.continuum.io; HttpOnly > vary: Accept-Encoding DEBUG requests.packages.urllib3.connectionpool:_make_request(383): "GET /pkgs/pro/noarch/repodata.json.bz2 HTTP/1.1" 304 0 DEBUG conda.fetch:fetch_repodata(118): > GET /pkgs/pro/noarch/repodata.json.bz2 HTTPS > User-Agent: conda/4.2.11 requests/2.7.0 CPython/2.7.11 Darwin/14.5.0 OSX/10.10.5 > Accept: */* > Accept-Encoding: identity > Authorization: Basic YW5vbnltb3VzOnVzZXJAc2l0ZQ== > Connection: keep-alive > If-Modified-Since: Fri, 12 Feb 2016 07:52:34 GMT > If-None-Match: "56bd8f42-46" < HTTPS 304 Not Modified > cache-control: public, max-age=300 > cf-cache-status: HIT > cf-ray: 2fa8d7673e03575f-IAD > connection: keep-alive > date: Mon, 31 Oct 2016 17:31:34 GMT > etag: "56bd8f42-46" > expires: Mon, 31 Oct 2016 17:36:34 GMT > last-modified: Fri, 12 Feb 2016 07:52:34 GMT > server: cloudflare-nginx > set-cookie: __cfduid=d3d85e68622468914e3fa715e3709ce321477935094; expires=Tue, 31-Oct-17 17:31:34 GMT; path=/; domain=.continuum.io; HttpOnly > vary: Accept-Encoding DEBUG requests.packages.urllib3.connectionpool:_make_request(383): "GET /pkgs/free/noarch/repodata.json.bz2 HTTP/1.1" 304 0 DEBUG conda.fetch:fetch_repodata(118): > GET /pkgs/free/noarch/repodata.json.bz2 HTTPS > User-Agent: conda/4.2.11 requests/2.7.0 CPython/2.7.11 Darwin/14.5.0 OSX/10.10.5 > Accept: */* > Accept-Encoding: identity > Authorization: Basic YW5vbnltb3VzOnVzZXJAc2l0ZQ== > Connection: keep-alive > If-Modified-Since: Wed, 19 Oct 2016 01:33:38 GMT > If-None-Match: "5806cd72-3f4" < HTTPS 304 Not Modified > cache-control: public, max-age=300 > cf-cache-status: HIT > cf-ray: 2fa8d767592023c0-IAD > connection: keep-alive > date: Mon, 31 Oct 2016 17:31:34 GMT > etag: "5806cd72-3f4" > expires: Mon, 31 Oct 2016 17:36:34 GMT > last-modified: Wed, 19 Oct 2016 01:33:38 GMT > server: cloudflare-nginx > set-cookie: __cfduid=d75e78d2ca346a670c9077b17b491a6121477935094; expires=Tue, 31-Oct-17 17:31:34 GMT; path=/; domain=.continuum.io; HttpOnly > vary: Accept-Encoding ..DEBUG requests.packages.urllib3.connectionpool:_make_request(383): "GET /pkgs/pro/osx-64/repodata.json.bz2 HTTP/1.1" 304 0 DEBUG conda.fetch:fetch_repodata(118): > GET /pkgs/pro/osx-64/repodata.json.bz2 HTTPS > User-Agent: conda/4.2.11 requests/2.7.0 CPython/2.7.11 Darwin/14.5.0 OSX/10.10.5 > Accept: */* > Accept-Encoding: identity > Authorization: Basic YW5vbnltb3VzOnVzZXJAc2l0ZQ== > Connection: keep-alive > If-Modified-Since: Fri, 28 Oct 2016 20:51:35 GMT > If-None-Match: "5813ba57-5659" < HTTPS 304 Not Modified > cache-control: public, max-age=300 > cf-cache-status: HIT > cf-ray: 2fa8d767691056d5-IAD > connection: keep-alive > date: Mon, 31 Oct 2016 17:31:34 GMT > etag: "5813ba57-5659" > expires: Mon, 31 Oct 2016 17:36:34 GMT > last-modified: Fri, 28 Oct 2016 20:51:35 GMT > server: cloudflare-nginx > set-cookie: __cfduid=daa252c17a691a76ac1ac6e937899e3171477935094; expires=Tue, 31-Oct-17 17:31:34 GMT; path=/; domain=.continuum.io; HttpOnly > vary: Accept-Encoding DEBUG requests.packages.urllib3.connectionpool:_make_request(383): "GET /t/dr-0eb923a1-5cce-4961-856a-1b18e2a98a49/conda-forge/noarch/repodata.json HTTP/1.1" 401 13 DEBUG conda.fetch:fetch_repodata(118): > GET /t/dr-0eb923a1-5cce-4961-856a-1b18e2a98a49/conda-forge/noarch/repodata.json HTTPS > User-Agent: conda/4.2.11 requests/2.7.0 CPython/2.7.11 Darwin/14.5.0 OSX/10.10.5 > Accept: */* > Accept-Encoding: gzip, deflate, compress, identity > Authorization: Basic YW5vbnltb3VzOnVzZXJAc2l0ZQ== > Connection: keep-alive > Content-Type: application/json < HTTPS 401 UNAUTHORIZED > connection: keep-alive > content-length: 13 > content-type: text/html; charset=utf-8 > date: Mon, 31 Oct 2016 17:31:34 GMT > license_expired: False > license_valid: True > server: nginx/1.10.1 > set-cookie: session=eyJfaWQiOnsiIGIiOiJZemsyWldSa01qVmtORGM0TTJVMVpXSXlPR1l5TmpZd05qazBaamN4WlRBPSJ9fQ.CvkRdg.yp1RWtljY2hKACm8gdiwyDrJ1ro; Domain=.anaconda.org; HttpOnly; Path=/ Invalid Token DEBUG requests.packages.urllib3.connectionpool:_make_request(383): "GET /t/dr-0eb923a1-5cce-4961-856a-1b18e2a98a49/conda-forge/osx-64/repodata.json HTTP/1.1" 401 13 DEBUG conda.fetch:fetch_repodata(118): > GET /t/dr-0eb923a1-5cce-4961-856a-1b18e2a98a49/conda-forge/osx-64/repodata.json HTTPS > User-Agent: conda/4.2.11 requests/2.7.0 CPython/2.7.11 Darwin/14.5.0 OSX/10.10.5 > Accept: */* > Accept-Encoding: gzip, deflate, compress, identity > Authorization: Basic YW5vbnltb3VzOnVzZXJAc2l0ZQ== > Connection: keep-alive > Content-Type: application/json < HTTPS 401 UNAUTHORIZED > connection: keep-alive > content-length: 13 > content-type: text/html; charset=utf-8 > date: Mon, 31 Oct 2016 17:31:34 GMT > license_expired: False > license_valid: True > server: nginx/1.10.1 > set-cookie: session=eyJfaWQiOnsiIGIiOiJZemsyWldSa01qVmtORGM0TTJVMVpXSXlPR1l5TmpZd05qazBaamN4WlRBPSJ9fQ.CvkRdg.yp1RWtljY2hKACm8gdiwyDrJ1ro; Domain=.anaconda.org; HttpOnly; Path=/ Invalid Token ..An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues INFO conda.common.io:captured(27): overtaking stderr and stdout INFO conda.common.io:captured(33): stderr and stdout yielded back Current conda install: platform : osx-64 conda version : 4.2.11 conda is private : False conda-env version : 4.2.11 conda-build version : 1.14.1 python version : 2.7.11.final.0 requests version : 2.7.0 root environment : /Users/drf/anaconda (writable) default environment : /Users/drf/anaconda envs directories : /Users/drf/anaconda/envs package cache : /Users/drf/anaconda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : /Users/drf/.condarc offline mode : False `$ /Users/drf/anaconda/bin/conda install --channel conda-forge ulmo -vv` Traceback (most recent call last): File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 479, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 145, in _main exit_code = args.func(args, p) File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 238, in install prefix=prefix) File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/api.py", line 24, in get_index index = fetch_index(channel_urls, use_cache=use_cache, unknown=unknown) File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 310, in fetch_index repodatas = [(u, f.result()) for u, f in zip(urls, futures)] File "/Users/drf/anaconda/lib/python2.7/site-packages/concurrent/futures/_base.py", line 403, in result return self.__get_result() File "/Users/drf/anaconda/lib/python2.7/site-packages/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 74, in func res = f(*args, **kwargs) File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 220, in fetch_repodata e.response.reason) CondaHTTPError: HTTP 401 UNAUTHORIZED for url <https://conda.anaconda.org/t/<TOKEN>/conda-forge/osx-64/repodata.json> The remote server has indicated you are using invalid credentials for this channel. If the remote site is anaconda.org or follows the Anaconda Server API, you will need to (a) login to the site with `anaconda login`, or (b) provide conda with a valid token directly. Further configuration help can be found at <http://conda.pydata.org/docs/config.html>. $ ``` @kalefranz Steps to reproduce, using conda 4.2.13: 1. Anaconda3 on OS X, not logged in, just default channels 2. `conda config --add channels conda-forge` 3. `conda install ...` fails with 401 (or anything that hits channels like `search`) 4. `anaconda login` 5. `conda install ...` is ok 6. `anaconda logout` 7. `conda install ...` is ok So it looks like going through the login cycle fixed the issue for me. This fixed it for me: ``` anaconda logout conda update conda ``` Strange. This is still broken with conda 4.2.13. I got the error trying to install with conda-forge in my .condarc `anaconda logout` fixed it -- but I hadn't logged in / uploaded for ages, with multiple re-boots since. Odd. Anyway, if I'm just pulling from a public channel, any logging in should just be ignored, yes? 4.2.16 and 4.3.13 are the latest releases for the respective feature series. If this is still a problem in 4.3.13, then please let me know. > if I'm just pulling from a public channel, any logging in should just be ignored, yes? I honestly don't remember exactly. It's an anaconda.org behavior, not a conda behavior necessarily. If the anaconda.org token is completely invalid, you might get this 401 behavior according to the current design. Also, there is no concept of a public vs private channel... Public vs private is on a per-package basis only. This causes a ton of confusion though and also a lot of extra logic in different places. I'd hope this could someday be changed to the channel either being accessible with the token or not, and not having the granular access where a package may be there with one token, but just "disappear" with another, even though the channel looks just fine because it otherwise contains packages. > there is no concept of a public vs private channel... Public vs private is on a per-package basis only. Ah, that does explain it. nevertheless, if one is only trying to access public packages, then login status should be ignored. I just did a 'conda update conda` and got 4.2.13, and the problem still exists there. I'm not sure how to install a newer one without risking hosing my current conda system.... I eventually gave up and hosed my system per https://github.com/conda/conda/issues/3780#issuecomment-264088686 I had tried just moving anaconda out of the way and reinstalling a new full anaconda a few times, but it didn't fix things. It was the miniconda overwrite that appeared to fix things up. same problem with conda 4.3.8 @drf5n I had the same problem as you I followed all your advices still I can't download packages as I please... First I had the SSL problem, I changed the configuration using `conda config --set ssl_verify False` ; but then another error appeared: > CondaHTTPError: HTTP 403 None for url <None> > The channel you requested is not available on the remote server. I typed `logout anaconda`, then when I try to update conda I have the same error above... I'm pretty desperate, I'm a statistician, signed on to be a data scientist, still, I spent more time dealing with the package installation process than dealing with actual data... Mayday please! EDIT: @kalefranz I meant `anaconda logout` It's `anaconda logout`, not `logout Anaconda`. No amount of logging in, logging out, upgrading, zapping .condarc, or anything else solved the problem for me. I finally moved my ~/anaconda3 directory out of the way, deleted ~/.condarc and ~/.conda, downloaded the Anaconda...sh file again, installed, created an environment, then tried the install again. It didn't matter if I was in an environment or not, the install command failed with the "not authorized" error. I'm not at all sure what the miniconda installation ( https://conda.io/docs/install/quick.html#os-x-miniconda-install ) did, but that method of re-installing anaconda seemed to overwrite whatever it was that was outside the standard anaconda installation and correct the problem for me. Tried that. No joy in Mudville with miniconda either. I gave up and manually found the package I was interested in on anaconda.org, then downloaded and installed it. As you might imagine, this was a bit cumbersome, as I had to work out the dependencies myself. my conda version is 4.3.8. all the time is http connection error.how to solve it? @smontanaro I'd like to figure out what's going with your install. There's obviously something laying around somewhere that's annoyingly sticky. Hopefully for me (not for you), you're still having the problem and it's still reproducible... If so, can you give me the output of `conda config --show-sources`, and then `python -m conda.gateways.anaconda_client`? Also, just so I have it, `conda info`. I am indeed still getting the same 401 error. Executing `conda config --show-sources` just prints a blank line. I can't execute `python -m conda.gateways.anaconda_client` from my preferred environment, but I can execute it by specifying the path to Python explicitly. The output sure doesn't appear interesting to me: ``` % ~/anaconda3/bin/python -m conda.gateways.anaconda_client {} ``` Here's the conda info output (again, run with an explicit path, outside any environment): ``` Current conda install: platform : linux-64 conda version : 4.3.16 conda is private : False conda-env version : 4.3.16 conda-build version : 2.1.9 python version : 3.6.0.final.0 requests version : 2.13.0 root environment : /home/skip/anaconda3 (writable) default environment : /home/skip/anaconda3 envs directories : /home/skip/anaconda3/envs /home/skip/.conda/envs package cache : /home/skip/anaconda3/pkgs /home/skip/.conda/pkgs channel URLs : 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 : None offline mode : False user-agent : conda/4.3.16 requests/2.13.0 CPython/3.6.0 Linux/4.8.0-46-generic debian/stretch/sid glibc/2.24 UID:GID : 1001:1001 ``` I have no ~/.condarc file. @kalefranz - any thoughts? I've been having this problem too and have variously tried wiping everything multiple times (including just now with the latest versions of everything). I found my .netrc file was probably interfering (seems like this is a bug in conda) Do you have a .netrc file in your home directory? I had created one a while back for a few machine specific logins, and among other things had added a default login anonymous... line. Removing the default line in my .netrc file fixed it for me. (edit: note this was on a linux box not an mac, but I think conda is likely to use the .netrc file by accident on macos too) Ah. Could be. .netrc is something requests natively supports. We tried removing support for .netrc files once, and a lot of other people also complained about that. Yeah, I agree that you may want to allow netrc to be used too, but it would be nice to check for this, so that if there is a 401 error, you either (a) prompt the user that it could be their netrc, or (b) try again disabling it. The `conda info` and `conda config` commands could also probably be made aware of what requests sees. > On May 5, 2017, at 2:28 PM, Ethan Gutmann <[email protected]> wrote: > > Yeah, I agree that you may want to allow netrc to be used too, but it would be nice to check for this, so that if there is a 401 error, you either (a) prompt the user that it could be their netrc, or (b) try again disabling it. > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub, or mute the thread. >
2017-05-16T02:11:09
conda/conda
5,335
conda__conda-5335
[ "3810" ]
eb3eb4c934cbc344d84a7073e187360d41905093
diff --git a/conda_env/cli/main_update.py b/conda_env/cli/main_update.py --- a/conda_env/cli/main_update.py +++ b/conda_env/cli/main_update.py @@ -79,7 +79,7 @@ def execute(args, parser): except exceptions.SpecNotFound: raise - if not args.name: + 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
conda env update : does not support --prefix The `conda env update` does not support the `--prefix` / `-p` argument. ``` $ conda info | grep version conda version : 4.2.12 conda-env version : 4.2.12 conda-build version : 1.20.3 python version : 2.7.11.final.0 requests version : 2.10.0 $ conda env update -p ./conda-env usage: conda-env [-h] {attach,create,export,list,remove,upload,update} ... conda-env: error: unrecognized arguments: -p ```
I don't know if I've interpreted your issue correctly, but I think all you need to do is drop the `env` so your command becomes `conda update -p ./conda-env` Here's what I'm trying to achieve: I have a bootstrap script that always gets run when a project gets checked out or updated. This is to make it easy for users who are not conda-savvy, and for continuous build machines, etc. I'd like to have a cmd I can run that can create the environment (from environment.yml) the first time it's run, and then update on subsequent runs. - `conda env update` works really well for this, but doesn't allow custom prefixes. - `conda env create --prefix foo` will respect the prefix, but it fails if the env has already been created (I'm working around this at the moment with `--force`, but it's slow as it rebuilds the complete env every time). - `conda update -prefix foo` does not read environment.yml, so doesn't work for me. I see, I think the right way to do this is `conda env update -n foo`. This will use the environment.yml file to update an env named foo. But that doesnt work with --prefix. I always use local prefix based envs to ensure projects are isolated from each other. I have this issue too. I would really like `conda env update --prefix` to be supported so I can update an environment which is not in the canonical location. How is this still an issue? I need this too. Please? I have this issue too as we like to use the conda env update command for CI/CD and sometimes the env might not exist yet and we want env to be created but may not want the prefix defined in yml file as that is typically the developer's prefix and not one we use for rollout in official production envs.
2017-05-16T03:21:40
conda/conda
5,342
conda__conda-5342
[ "5341" ]
79f86d4cf31e6275cf3b201e76b43a95ecbb9888
diff --git a/conda/cli/main.py b/conda/cli/main.py --- a/conda/cli/main.py +++ b/conda/cli/main.py @@ -80,12 +80,24 @@ def generate_parser(): return p, sub_parsers +def init_loggers(context): + from ..gateways.logging import set_all_logger_level, set_verbosity + if not context.json: + # 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) + + 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',) @@ -119,17 +131,7 @@ def completer(prefix, **kwargs): 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) + init_loggers(context) exit_code = args.func(args, p) if isinstance(exit_code, int): diff --git a/conda_env/cli/main.py b/conda_env/cli/main.py --- a/conda_env/cli/main.py +++ b/conda_env/cli/main.py @@ -1,10 +1,13 @@ -from __future__ import print_function, division, absolute_import - -from logging import getLogger, CRITICAL +from __future__ import absolute_import, division, print_function import os import sys +from conda.base.constants import SEARCH_PATH +from conda.base.context import context +from conda.cli.conda_argparse import ArgumentParser +from conda.cli.main import init_loggers + try: from conda.exceptions import conda_exception_handler except ImportError as e: @@ -30,8 +33,6 @@ else: raise e -from conda.cli.conda_argparse import ArgumentParser - from . import main_attach from . import main_create from . import main_export @@ -39,7 +40,7 @@ from . import main_remove from . import main_upload from . import main_update -from conda.base.context import context + # TODO: This belongs in a helper library somewhere # Note: This only works with `conda-env` as a sub-command. If this gets @@ -68,15 +69,8 @@ def create_parser(): def main(): parser = create_parser() args = parser.parse_args() - context._set_argparse_args(args) - if getattr(args, 'json', False): - # # Silence logging info to avoid interfering with JSON output - # for logger in Logger.manager.loggerDict: - # if logger not in ('fetch', 'progress'): - # getLogger(logger).setLevel(CRITICAL + 1) - for logger in ('print', 'dotupdate', 'stdoutlog', 'stderrlog'): - getLogger(logger).setLevel(CRITICAL + 1) - + context.__init__(SEARCH_PATH, 'conda', args) + init_loggers(context) return conda_exception_handler(args.func, args, parser) diff --git a/conda_env/cli/main_export.py b/conda_env/cli/main_export.py --- a/conda_env/cli/main_export.py +++ b/conda_env/cli/main_export.py @@ -4,7 +4,7 @@ import os import textwrap -from conda.cli.common import add_parser_prefix +from conda.cli.common import add_parser_json, add_parser_prefix # conda env import from .common import get_prefix from ..env import from_environment @@ -63,7 +63,7 @@ def configure_parser(sub_parsers): action='store_true', required=False, help='Do not include channel names with package names.') - + add_parser_json(p) p.set_defaults(func=execute)
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -65,6 +65,18 @@ except ImportError: from mock import patch + +def get_win_locations(): + try: + from menuinst.win32 import dirs_src as win_locations + except ImportError: + try: + from menuinst.win32 import dirs as win_locations + except ImportError: + win_locations = {} + return win_locations + + log = getLogger(__name__) TRACE, DEBUG = TRACE, DEBUG # these are so the imports aren't cleared, but it's easy to switch back and forth TEST_LOG_LEVEL = DEBUG @@ -623,7 +635,7 @@ def test_update_deps_flag_present(self): @pytest.mark.skipif(not on_win, reason="shortcuts only relevant on Windows") def test_shortcut_not_attempted_with_no_shortcuts_arg(self): prefix = make_temp_prefix("_" + str(uuid4())[:7]) - from menuinst.win32 import dirs as win_locations + win_locations = get_win_locations() user_mode = 'user' if exists(join(sys.prefix, u'.nonadmin')) else 'system' shortcut_dir = win_locations[user_mode]["start"] shortcut_file = join(shortcut_dir, "Anaconda Prompt ({0}).lnk".format(basename(prefix))) @@ -636,7 +648,7 @@ def test_shortcut_not_attempted_with_no_shortcuts_arg(self): @pytest.mark.skipif(not on_win, reason="shortcuts only relevant on Windows") def test_shortcut_creation_installs_shortcut(self): - from menuinst.win32 import dirs as win_locations + win_locations = get_win_locations() user_mode = 'user' if exists(join(sys.prefix, u'.nonadmin')) else 'system' shortcut_dir = win_locations[user_mode]["start"] shortcut_dir = join(shortcut_dir, "Anaconda{0} ({1}-bit)" @@ -662,7 +674,7 @@ def test_shortcut_creation_installs_shortcut(self): @pytest.mark.skipif(not on_win, reason="shortcuts only relevant on Windows") def test_shortcut_absent_does_not_barf_on_uninstall(self): - from menuinst.win32 import dirs as win_locations + win_locations = get_win_locations() user_mode = 'user' if exists(join(sys.prefix, u'.nonadmin')) else 'system' shortcut_dir = win_locations[user_mode]["start"] @@ -690,7 +702,7 @@ def test_shortcut_absent_does_not_barf_on_uninstall(self): @pytest.mark.skipif(not on_win, reason="shortcuts only relevant on Windows") def test_shortcut_absent_when_condarc_set(self): - from menuinst.win32 import dirs as win_locations + win_locations = get_win_locations() user_mode = 'user' if exists(join(sys.prefix, u'.nonadmin')) else 'system' shortcut_dir = win_locations[user_mode]["start"] shortcut_dir = join(shortcut_dir, "Anaconda{0} ({1}-bit)"
Add --json flag on conda-env that works! The json flag seems to be there, but it is not working. With a file that looks like ```yaml # environment.yaml name: test_env_1 channels: - defaults dependencies: - python - pytest-cov ``` ``` (root) $ conda-env create --json Using Anaconda API: http s://api.anaconda.org (root) $ ``` So two problems here: 1.) No json output on the create process 2.) `Using Anaconda API: https://api.anaconda.org`
2017-05-16T18:47:06
conda/conda
5,357
conda__conda-5357
[ "5346" ]
79f86d4cf31e6275cf3b201e76b43a95ecbb9888
diff --git a/conda/cli/conda_argparse.py b/conda/cli/conda_argparse.py --- a/conda/cli/conda_argparse.py +++ b/conda/cli/conda_argparse.py @@ -121,7 +121,7 @@ def error(self, message): else: argument = None if argument and argument.dest == "cmd": - m = re.compile(r"invalid choice: '([\w\-]+)'").match(exc.message) + m = re.compile(r"invalid choice: u?'([\w\-]+)'").match(exc.message) if m: cmd = m.group(1) executable = find_executable('conda-' + cmd)
latest 4.3.x (4.3.18-37-g79f86d4c) not picking up conda-build subcommands From conda-build's test suite: ``` ________________________________ 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') ``` This seems to happen only with python 2.7, not 3.6: https://travis-ci.org/conda/conda-build/builds/232848688
Am able to reproduce ``` kfranz@0283:~/continuum/conda-build *(no branch) ❯ /conda/bin/conda info Current conda install: platform : osx-64 conda version : 4.3.18.post37+79f86d4cf conda is private : False conda-env version : 4.3.18.post37+79f86d4cf conda-build version : 3.0.0rc0 python version : 2.7.12.final.0 requests version : 2.12.0 root environment : /conda (writable) default environment : /conda envs directories : /conda/envs /Users/kfranz/.conda/envs package cache : /conda/pkgs /Users/kfranz/.conda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : /Users/kfranz/.condarc netrc file : None offline mode : False user-agent : conda/4.3.18.post37+79f86d4cf requests/2.12.0 CPython/2.7.12 Darwin/16.5.0 OSX/10.12.4 UID:GID : 502:20 kfranz@0283:~/continuum/conda-build *(no branch) ❯ /conda/bin/conda skeleton -h 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') ``` This could be my fault, checking.
2017-05-18T13:09:00
conda/conda
5,359
conda__conda-5359
[ "5358" ]
98c6d80f3299edf775b495f90651d558248d2cf8
diff --git a/conda/cli/conda_argparse.py b/conda/cli/conda_argparse.py --- a/conda/cli/conda_argparse.py +++ b/conda/cli/conda_argparse.py @@ -45,7 +45,6 @@ def _get_action_from_name(self, name): def error(self, message): import re - import subprocess from .find_commands import find_executable exc = sys.exc_info()[1] @@ -57,7 +56,7 @@ def error(self, message): else: argument = None if argument and argument.dest == "cmd": - m = re.compile(r"invalid choice: '([\w\-]+)'").match(exc.message) + m = re.compile(r"invalid choice: u?'([\w\-]+)'").match(exc.message) if m: cmd = m.group(1) executable = find_executable('conda-' + cmd) @@ -67,13 +66,7 @@ def error(self, message): 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) + os.execv(args[0], args) super(ArgumentParser, self).error(message)
conda should exec to non-conda subcommands, not subprocess
2017-05-18T13:17:36
conda/conda
5,368
conda__conda-5368
[ "5367" ]
99f5bff861d7c89419a87967aac22e415bf85581
diff --git a/conda/common/platform.py b/conda/common/platform.py --- a/conda/common/platform.py +++ b/conda/common/platform.py @@ -18,8 +18,8 @@ def is_admin_on_windows(): # pragma: unix no cover if not on_win: # pragma: no cover return False try: - from ctypes.windll.shell32 import IsUserAnAdmin - return IsUserAnAdmin() != 0 + from ctypes import windll + return windll.shell32.IsUserAnAdmin()() != 0 except ImportError as e: log.debug('%r', e) return 'unknown'
conda info always shows 'unknown' for admin indicator on Windows
2017-05-18T21:33:26
conda/conda
5,373
conda__conda-5373
[ "5248" ]
4df735e8779af55b1452b6b3fc2d3d64d4ad06a7
diff --git a/conda/plan.py b/conda/plan.py --- a/conda/plan.py +++ b/conda/plan.py @@ -235,7 +235,7 @@ def format(s, pkg): print(format(oldfmt[pkg] + arrow + newfmt[pkg], pkg)) if downgraded: - print("\nThe following packages will be DOWNGRADED due to dependency conflicts:\n") + print("\nThe following packages will be DOWNGRADED:\n") for pkg in sorted(downgraded): print(format(oldfmt[pkg] + arrow + newfmt[pkg], pkg))
diff --git a/tests/test_plan.py b/tests/test_plan.py --- a/tests/test_plan.py +++ b/tests/test_plan.py @@ -215,7 +215,7 @@ def test_display_actions(): display_actions(actions, index) assert c.stdout == """ -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: cython: 0.19.1-py33_0 --> 0.19-py33_0 @@ -241,7 +241,7 @@ def test_display_actions(): cython: 0.19-py33_0 --> 0.19.1-py33_0 -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: dateutil: 2.1-py33_1 --> 1.5-py33_0 \n\ @@ -268,7 +268,7 @@ def test_display_actions(): display_actions(actions, index) assert c.stdout == """ -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: cython: 0.19.1-py33_0 --> 0.19-py33_0 dateutil: 2.1-py33_1 --> 1.5-py33_0 \n\ @@ -356,7 +356,7 @@ def test_display_actions_show_channel_urls(): display_actions(actions, index) assert c.stdout == """ -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: cython: 0.19.1-py33_0 <unknown> --> 0.19-py33_0 <unknown> @@ -382,7 +382,7 @@ def test_display_actions_show_channel_urls(): cython: 0.19-py33_0 <unknown> --> 0.19.1-py33_0 <unknown> -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: dateutil: 2.1-py33_1 <unknown> --> 1.5-py33_0 <unknown> @@ -409,7 +409,7 @@ def test_display_actions_show_channel_urls(): display_actions(actions, index) assert c.stdout == """ -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: cython: 0.19.1-py33_0 <unknown> --> 0.19-py33_0 <unknown> dateutil: 2.1-py33_1 <unknown> --> 1.5-py33_0 <unknown> @@ -440,7 +440,7 @@ def test_display_actions_show_channel_urls(): display_actions(actions, index) assert c.stdout == """ -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: cython: 0.19.1-py33_0 my_channel --> 0.19-py33_0 <unknown> \n\ dateutil: 2.1-py33_1 <unknown> --> 1.5-py33_0 my_channel @@ -497,7 +497,7 @@ def test_display_actions_link_type(): display_actions(actions, index) assert c.stdout == """ -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: cython: 0.19.1-py33_0 --> 0.19-py33_0 (softlink) dateutil: 2.1-py33_1 --> 1.5-py33_0 (softlink) @@ -547,7 +547,7 @@ def test_display_actions_link_type(): display_actions(actions, index) assert c.stdout == """ -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: cython: 0.19.1-py33_0 --> 0.19-py33_0 dateutil: 2.1-py33_1 --> 1.5-py33_0 \n\ @@ -597,7 +597,7 @@ def test_display_actions_link_type(): display_actions(actions, index) assert c.stdout == """ -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: cython: 0.19.1-py33_0 --> 0.19-py33_0 (copy) dateutil: 2.1-py33_1 --> 1.5-py33_0 (copy) @@ -655,7 +655,7 @@ def test_display_actions_link_type(): display_actions(actions, index) assert c.stdout == """ -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: cython: 0.19.1-py33_0 my_channel --> 0.19-py33_0 <unknown> (copy) dateutil: 2.1-py33_1 <unknown> --> 1.5-py33_0 my_channel (copy) @@ -699,7 +699,7 @@ def test_display_actions_features(): display_actions(actions, index) assert c.stdout == """ -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: numpy: 1.7.1-py33_p0 [mkl] --> 1.7.0-py33_p0 [mkl] @@ -776,7 +776,7 @@ def test_display_actions_features(): display_actions(actions, index) assert c.stdout == """ -The following packages will be DOWNGRADED due to dependency conflicts: +The following packages will be DOWNGRADED: numpy: 1.7.1-py33_p0 <unknown> [mkl] --> 1.7.0-py33_p0 <unknown> [mkl]
confusing messages at downgrading When I willfully downgrade a package, confusing dialogs are given related to dependency conflicts, possibly because the same dialog/logging is used when an automatic downgrade requirement was being determined: ```bash (stable) └─❱❱❱ conda install pandas=0.19 +6295 8:05 ❰─┘ Fetching package metadata ........... Solving package specifications: .......... Package plan for installation in environment /Users/klay6683/miniconda3/envs/stable: The following packages will be DOWNGRADED due to dependency conflicts: pandas: 0.20.1-np112py36_0 conda-forge --> 0.19.2-np112py36_1 conda-forge Proceed ([y]/n)? ``` I think it would be preferable, that in the deliberate downgrade the messages should not say `due to dependency conflicts` and that this part is only added to the dialog when a dependency conflict was automatically found. version: 4.2.13 on macOS
Seems to me the simplest thing for us to do here is to drop the "due to dependency conflicts." It's not clear to me we can reliably say that anyway.
2017-05-19T01:51:04
conda/conda
5,379
conda__conda-5379
[ "5378" ]
dd8b57b6a3f8cfd4d74ecdcf54328d8137526353
diff --git a/conda/gateways/logging.py b/conda/gateways/logging.py --- a/conda/gateways/logging.py +++ b/conda/gateways/logging.py @@ -91,4 +91,3 @@ def trace(self, message, *args, **kwargs): logging.addLevelName(TRACE, "TRACE") logging.Logger.trace = trace -initialize_logging()
duplicate log messages Adding code ```python class DbgViewHandler(logging.Handler): def emit(self, record): print("DbgViewHandler: %s" % record) logger = logging.getLogger("logging_test") logger.setLevel(logging.DEBUG) logger.propagate = False stream_handler = logging.StreamHandler() stream_handler.setLevel(logging.WARNING) # all going to stderr dbgview = DbgViewHandler() # all going to stdout dbgview.setLevel(logging.DEBUG) logger.addHandler(dbgview) logger.addHandler(stream_handler) logger.info("Hello there") logger.warn("Whoa there") ``` To the bottom of conda/gateways/logging.py outputs too many copies of messages.
2017-05-19T15:26:15
conda/conda
5,380
conda__conda-5380
[ "5356" ]
0d0a47e40bc80d0e957ce20d4868b0d27440eaf9
diff --git a/conda/gateways/logging.py b/conda/gateways/logging.py --- a/conda/gateways/logging.py +++ b/conda/gateways/logging.py @@ -37,7 +37,7 @@ def filter(self, record): @memoize def initialize_logging(): - initialize_root_logger() + # initialize_root_logger() # probably don't need to touch the root logger per #5356 initialize_conda_logger() formatter = Formatter("%(message)s\n") @@ -71,7 +71,7 @@ def initialize_conda_logger(level=WARN): def set_all_logger_level(level=DEBUG): formatter = Formatter("%(message)s\n") if level >= INFO else None - attach_stderr_handler(level, formatter=formatter) + # attach_stderr_handler(level, formatter=formatter) # probably don't need to touch the root logger per #5356 # NOQA attach_stderr_handler(level, 'conda', formatter=formatter) attach_stderr_handler(level, 'requests') attach_stderr_handler(level, 'requests.packages.urllib3') @@ -93,4 +93,3 @@ def trace(self, message, *args, **kwargs): logging.addLevelName(TRACE, "TRACE") logging.Logger.trace = trace -initialize_logging()
importing `conda.cli.python_api` changes root logger `conda.gateways.logging.initialize_logging` calls `initialize_root_logger` and `initialize_conda_logger` which add custom handlers named "stderr" to the root and "conda" logger and change their levels. `initialize_logging` gets called when importing `conda.gateways`, `conda.gateways.logging` and `conda.cli.python_api`. This is problematic when `conda.cli.python_api.run_command` is incorporated in a program which also uses `logging` (e.g., defining custom formatters, etc.). See: ```python # uses separate processes to re-init `logging` via `basicConfig` from multiprocessing import Process def run(level): from logging import basicConfig, getLogger awesome_format = "\n>>> AWESOME %(levelname)s: %(message)s" basicConfig(format=awesome_format, level=level) logger = getLogger(__file__) msg = "some message" def log(): logger.debug(msg) logger.info(msg) logger.warn(msg) logger.error(msg) log() import conda.cli.python_api #import conda.gateways #import conda.gateways.logging log() for level in ("INFO", "WARN", "ERROR"): print("{:-^60}".format(level)) process = Process(target=run, args=(level,)) process.start() process.join() print("\n\n") ``` Output (notice the duplicate `ERROR` messages (with `conda`'s logging format) and omitted `WARNING`s): ``` ----------------------------INFO---------------------------- >>> AWESOME INFO: some message >>> AWESOME WARNING: some message >>> AWESOME ERROR: some message >>> AWESOME INFO: No cio_test package found. >>> AWESOME ERROR: some message ERROR cli_python_api_logging.py:log(16): some message ----------------------------WARN---------------------------- >>> AWESOME WARNING: some message >>> AWESOME ERROR: some message >>> AWESOME ERROR: some message ERROR cli_python_api_logging.py:log(16): some message ---------------------------ERROR---------------------------- >>> AWESOME ERROR: some message >>> AWESOME ERROR: some message ERROR cli_python_api_logging.py:log(16): some message ```
2017-05-19T15:26:38
conda/conda
5,382
conda__conda-5382
[ "5298" ]
e047925bba543e2c96fb648649fd2158824dcf55
diff --git a/conda/resolve.py b/conda/resolve.py --- a/conda/resolve.py +++ b/conda/resolve.py @@ -531,7 +531,7 @@ def version_key(self, dist, vtype=None): valid = 1 if cpri < MAX_CHANNEL_PRIORITY else 0 ver = normalized_version(rec.get('version', '')) bld = rec.get('build_number', 0) - bs = rec.get('build_string') + bs = rec.get('build') ts = rec.get('timestamp', 0) return ((valid, -cpri, ver, bld, bs, ts) if context.channel_priority else (valid, ver, -cpri, bld, bs, ts))
Conda does not respect exact matchspecs Really strange here, but I've followed this as far as I can in conda-build, and I think it's in conda. I have these specs: ``` ipdb> sub_build_ms_deps [MatchSpec('openssl 1.0.2k 1'), MatchSpec('zlib 1.2.8 3'), MatchSpec('bzip2 1.0.6 3'), MatchSpec('ncurses 5.9 10'), MatchSpec('curl 7.52.1 0'), MatchSpec('llvm 4.0.0 h95a1600_0'), MatchSpec('cmake 3.6.3 0'), MatchSpec('xz 5.2.2 1'), MatchSpec('expat 2.1.0 0')] ``` These get fed into conda's install_actions function here: https://github.com/conda/conda-build/blob/master/conda_build/environ.py#L655 ``` ipdb> n > /home/msarahan/conda-build/conda_build/build.py(1042)build() 1041 index, index_timestamp = get_build_index(m.config, m.config.build_subdir) -> 1042 build_actions = environ.get_install_actions(m.config.build_prefix, index, 1043 sub_build_ms_deps, m.config, ``` Now I'm not 100% certain that the package exists in repodata yet. I know that it does on disk, but not sure about in-memory. It should, but I'm not certain. My confusion is why with that matchspec for llvm in particular, build string h95a1600, should I *ever* be given a non-matching build string? ``` ipdb> build_actions defaultdict(<type 'list'>, {u'op_order': ('CHECK_FETCH', 'RM_FETCHED', 'FETCH', 'CHECK_EXTRACT', 'RM_EXTRACTED', 'EXTRACT', 'UNLINK', 'LINK', 'SYMLINK_CONDA'), 'SYMLINK_CONDA': ['/home/msarahan/miniconda2'], 'PREFIX': '/home/msarahan/miniconda2/conda-bld/llvm_1494542025512/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla', 'LINK': [ Dist(_Dist__initd=True, channel=u'defaults', dist_name=u'bzip2-1.0.6-3', name=u'bzip2', version=u'1.0.6', build_string=u'3', build_number=3, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel=u'defaults', dist_name=u'expat-2.1.0-0', name=u'expat', version=u'2.1.0', build_string=u'0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel=u'local', dist_name=u'llvm-4.0.0-heefb760_0', name=u'llvm', version=u'4.0.0', build_string=u'heefb760_0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel=u'defaults', dist_name=u'ncurses-5.9-10', name=u'ncurses', version=u'5.9', build_string=u'10', build_number=10, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel=u'defaults', dist_name=u'openssl-1.0.2k-1', name=u'openssl', version=u'1.0.2k', build_string=u'1', build_number=1, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel=u'defaults', dist_name=u'xz-5.2.2-1', name=u'xz', version=u'5.2.2', build_string=u'1', build_number=1, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel=u'defaults', dist_name=u'zlib-1.2.8-3', name=u'zlib', version=u'1.2.8', build_string=u'3', build_number=3, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel=u'defaults', dist_name=u'curl-7.52.1-0', name=u'curl', version=u'7.52.1', build_string=u'0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel=u'defaults', dist_name=u'cmake-3.6.3-0', name=u'cmake', version=u'3.6.3', build_string=u'0', build_number=0, with_features_depends=None, base_url=None, platform=None)]}) ``` Note the relevant bit in the install actions: ```dist_name=u'llvm-4.0.0-heefb760_0', ``` This is with conda 4.3.17.
PS: to make things even more confusing, heefb760 is an older build, done yesterday, while the h95a1600 build is from today - so it isn't the timestamp prioritization messing up. Just wrote a simple test that I expected to fail: ```python def test_build_string(): # regression test for #5298 spec = MatchSpec('llvm 4.0.0 h95a1600_0') dist1 = Dist("local::llvm-4.0.0-h95a1600_0") assert spec.match(dist1) dist2 = Dist("local::llvm-4.0.0-heefb760_0") assert not spec.match(dist2) ``` But it passes. So still looking... I guess I need to dig into what the solver is doing. @msarahan would it be possible for you to upload those two llvm packages to the `conda-test` channel so that I can try to reproduce the behavior? https://anaconda.org/msarahan/llvm/files I have the whole miniconda env preserved also if you need it. Is that install_actions possibly doing anything differently from MatchSpec.match? Seems like it's running the solver, rather than just finding something in an index. Yeah `install_actions` is basically conda-builds interface to the solver right now. And I do think what's going on here is something in resolve.py that I need to track down. @msarahan were you going to upload those two llvm packages to the `conda-test` channel? That would be helpful. @msarahan Just for osx-64 is fine. No, please use them from my channel, as I linked above. These packages are for Linux only. Please use a VM or docker image as necessary. If you want to download them from my channel and re-upload them to the conda-test channel for the sake of future testing, that's fine. Oh, I see. Missed that. Sorry. In theory, I should be able to reproduce this behavior now with the command conda create --dry-run -n testest llvm=4.0.0=h95a1600_0 -c msarahan and in the conda code changing the `install_actions_list()` function in `conda/plan.py` to ```python def install_actions_list(prefix, index, specs, force=False, only_names=None, always_copy=False, pinned=True, minimal_hint=False, update_deps=True, prune=False, channel_priority_map=None, is_update=False): result = [install_actions(prefix, index, specs, force, only_names, always_copy, pinned, minimal_hint, update_deps, prune, channel_priority_map, is_update)] print(result) return result ``` to be extra sure that conda and conda-build are using exactly the same code paths. I'm so far unable to reproduce the behavior. ``` [vagrant@localhost vagrant]$ python -m conda create --dry-run -n testest -c msarahan openssl=1.0.2k=1 zlib=1.2.8=3 bzip2=1.0.6=3 ncurses=5.9=10 curl=7.52.1=0 cmake=3.6.3=0 xz=5.2.2=1 expat=2.1.0=0 llvm=4.0.0=h95a1600_0 Fetching package metadata ........... Solving package specifications: . [defaultdict(<class 'list'>, {'LINK': [Dist(_Dist__initd=True, channel='defaults', dist_name='bzip2-1.0.6-3', name='bzip2', version='1.0.6', build_string='3', build_number=3, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='expat-2.1.0-0', name='expat', version='2.1.0', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='msarahan', dist_name='libgcc_linux-cos6-x86_64-6.3.0-h1011ec8_0', name='libgcc_linux-cos6-x86_64', version='6.3.0', build_string='h1011ec8_0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='msarahan', dist_name='libstdcxx_linux-cos6-x86_64-6.3.0-h1011ec8_0', name='libstdcxx_linux-cos6-x86_64', version='6.3.0', build_string='h1011ec8_0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='ncurses-5.9-10', name='ncurses', version='5.9', build_string='10', build_number=10, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='openssl-1.0.2k-1', name='openssl', version='1.0.2k', build_string='1', build_number=1, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='xz-5.2.2-1', name='xz', version='5.2.2', build_string='1', build_number=1, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='msarahan', dist_name='zlib-1.2.8-3', name='zlib', version='1.2.8', build_string='3', build_number=3, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='curl-7.52.1-0', name='curl', version='7.52.1', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='msarahan', dist_name='llvm-4.0.0-h95a1600_0', name='llvm', version='4.0.0', build_string='h95a1600_0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='cmake-3.6.3-0', name='cmake', version='3.6.3', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None)], 'op_order': ('CHECK_FETCH', 'RM_FETCHED', 'FETCH', 'CHECK_EXTRACT', 'RM_EXTRACTED', 'EXTRACT', 'UNLINK', 'LINK', 'SYMLINK_CONDA'), 'SYMLINK_CONDA': ['/usr/local'], 'PREFIX': '/home/vagrant/.conda/envs/testest'})] Package plan for installation in environment /home/vagrant/.conda/envs/testest: The following NEW packages will be INSTALLED: bzip2: 1.0.6-3 cmake: 3.6.3-0 curl: 7.52.1-0 expat: 2.1.0-0 libgcc_linux-cos6-x86_64: 6.3.0-h1011ec8_0 msarahan libstdcxx_linux-cos6-x86_64: 6.3.0-h1011ec8_0 msarahan llvm: 4.0.0-h95a1600_0 msarahan ncurses: 5.9-10 openssl: 1.0.2k-1 xz: 5.2.2-1 zlib: 1.2.8-3 msarahan [vagrant@localhost vagrant]$ python -m conda create --dry-run -n testest -c msarahan openssl=1.0.2k=1 zlib=1.2.8=3 bzip2=1.0.6=3 ncurses=5.9=10 curl=7.52.1=0 cmake=3.6.3=0 xz=5.2.2=1 expat=2.1.0=0 llvm=4.0.0=heefb760_0 Fetching package metadata ........... Solving package specifications: . [defaultdict(<class 'list'>, {'PREFIX': '/home/vagrant/.conda/envs/testest', 'SYMLINK_CONDA': ['/usr/local'], 'op_order': ('CHECK_FETCH', 'RM_FETCHED', 'FETCH', 'CHECK_EXTRACT', 'RM_EXTRACTED', 'EXTRACT', 'UNLINK', 'LINK', 'SYMLINK_CONDA'), 'LINK': [Dist(_Dist__initd=True, channel='defaults', dist_name='bzip2-1.0.6-3', name='bzip2', version='1.0.6', build_string='3', build_number=3, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='expat-2.1.0-0', name='expat', version='2.1.0', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='msarahan', dist_name='llvm-4.0.0-heefb760_0', name='llvm', version='4.0.0', build_string='heefb760_0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='ncurses-5.9-10', name='ncurses', version='5.9', build_string='10', build_number=10, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='openssl-1.0.2k-1', name='openssl', version='1.0.2k', build_string='1', build_number=1, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='xz-5.2.2-1', name='xz', version='5.2.2', build_string='1', build_number=1, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='msarahan', dist_name='zlib-1.2.8-3', name='zlib', version='1.2.8', build_string='3', build_number=3, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='curl-7.52.1-0', name='curl', version='7.52.1', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None), Dist(_Dist__initd=True, channel='defaults', dist_name='cmake-3.6.3-0', name='cmake', version='3.6.3', build_string='0', build_number=0, with_features_depends=None, base_url=None, platform=None)]})] Package plan for installation in environment /home/vagrant/.conda/envs/testest: The following NEW packages will be INSTALLED: bzip2: 1.0.6-3 cmake: 3.6.3-0 curl: 7.52.1-0 expat: 2.1.0-0 llvm: 4.0.0-heefb760_0 msarahan ncurses: 5.9-10 openssl: 1.0.2k-1 xz: 5.2.2-1 zlib: 1.2.8-3 msarahan ```
2017-05-19T18:56:28
conda/conda
5,393
conda__conda-5393
[ "5384", "5384" ]
3a9025698a2ccc104f074e4384532a6d27363e2c
diff --git a/conda/cli/main.py b/conda/cli/main.py --- a/conda/cli/main.py +++ b/conda/cli/main.py @@ -82,7 +82,7 @@ def generate_parser(): def init_loggers(context): from ..gateways.logging import set_all_logger_level, set_verbosity - if not context.json: + if context.json: # Silence logging info to avoid interfering with JSON output for logger in ('print', 'dotupdate', 'stdoutlog', 'stderrlog'): getLogger(logger).setLevel(CRITICAL + 1)
Conda 4.3.19 (canary) is breaking json output parsing for navigator ```plain $ conda create -n test-conda python --json Solving package specifications: # This line should not be there....! { "actions": { "LINK": [ "defaults::openssl-1.0.2k-2", "defaults::readline-6.2-2", "defaults::sqlite-3.13.0-0", "defaults::tk-8.5.18-0", "defaults::xz-5.2.2-1", "defaults::zlib-1.2.8-3", "defaults::python-3.6.1-2", "defaults::setuptools-27.2.0-py36_0", "defaults::wheel-0.29.0-py36_0", "defaults::pip-9.0.1-py36_1" ], "PREFIX": "/Users/gpena-castellanos/anaconda/envs/test-conda", "SYMLINK_CONDA": [ "/Users/gpena-castellanos/anaconda" ], "op_order": [ "CHECK_FETCH", "RM_FETCHED", "FETCH", "CHECK_EXTRACT", "RM_EXTRACTED", "EXTRACT", "UNLINK", "LINK", "SYMLINK_CONDA" ] }, "success": true } ``` Conda 4.3.19 (canary) is breaking json output parsing for navigator ```plain $ conda create -n test-conda python --json Solving package specifications: # This line should not be there....! { "actions": { "LINK": [ "defaults::openssl-1.0.2k-2", "defaults::readline-6.2-2", "defaults::sqlite-3.13.0-0", "defaults::tk-8.5.18-0", "defaults::xz-5.2.2-1", "defaults::zlib-1.2.8-3", "defaults::python-3.6.1-2", "defaults::setuptools-27.2.0-py36_0", "defaults::wheel-0.29.0-py36_0", "defaults::pip-9.0.1-py36_1" ], "PREFIX": "/Users/gpena-castellanos/anaconda/envs/test-conda", "SYMLINK_CONDA": [ "/Users/gpena-castellanos/anaconda" ], "op_order": [ "CHECK_FETCH", "RM_FETCHED", "FETCH", "CHECK_EXTRACT", "RM_EXTRACTED", "EXTRACT", "UNLINK", "LINK", "SYMLINK_CONDA" ] }, "success": true } ```
2017-05-20T18:00:36
conda/conda
5,404
conda__conda-5404
[ "5217", "5217" ]
d837cc25b5e6a5760a229ab2883ef31411087dde
diff --git a/conda/cli/python_api.py b/conda/cli/python_api.py --- a/conda/cli/python_api.py +++ b/conda/cli/python_api.py @@ -35,7 +35,10 @@ def get_configure_parser_function(command): def run_command(command, *arguments, **kwargs): - """ + """Runs a conda command in-process with a given set of command-line interface arguments. + + Differences from the command-line interface: + Always uses --yes flag, thus does not ask for confirmation. Args: command: one of the Commands.X @@ -67,6 +70,7 @@ def run_command(command, *arguments, **kwargs): split_command_line = split(command_line) args = p.parse_args(split_command_line) + args.yes = True # always skip user confirmation, force setting context.always_yes context.__init__( search_path=configuration_search_path, app_name=APP_NAME,
`cli.python_api` captures `stdout` from `cli.common.confirm_yn` `cli.python_api.run_command` captures any output to `stdout`/`stderr` via `common.io.captured`. This causes the user confirmation messages from `cli.common.confirm_yn`, i.e., ```bash Proceed ([y]/n)? ``` to also be captured, i.e., not being output/accessible until the command finishes (which might be never if the user does not interact). The examples in the doc string are ```python Examples: >> run_command(Commands.CREATE, "-n newenv python=3 flask", use_exception_handler=True) >> run_command(Commands.CREATE, "-n newenv", "python=3", "flask") >> run_command(Commands.CREATE, ["-n newenv", "python=3", "flask"], search_path=()) ``` and show exactly such use cases. Due to this, `run_command` is only generally usable if any of `--json`, `--yes` or `--dry-run` is supplied. There could be two solutions to this: 1. Force the user to include at least one of those arguments. 2. Instead of only capturing the output, it could be recorded but also forwarded to `stdout`/`stderr`. This could/should be made optional via some `kwarg` for `run_command`. Possibility 1. is of course much simpler and could at least serve as a temporary solution. `cli.python_api` captures `stdout` from `cli.common.confirm_yn` `cli.python_api.run_command` captures any output to `stdout`/`stderr` via `common.io.captured`. This causes the user confirmation messages from `cli.common.confirm_yn`, i.e., ```bash Proceed ([y]/n)? ``` to also be captured, i.e., not being output/accessible until the command finishes (which might be never if the user does not interact). The examples in the doc string are ```python Examples: >> run_command(Commands.CREATE, "-n newenv python=3 flask", use_exception_handler=True) >> run_command(Commands.CREATE, "-n newenv", "python=3", "flask") >> run_command(Commands.CREATE, ["-n newenv", "python=3", "flask"], search_path=()) ``` and show exactly such use cases. Due to this, `run_command` is only generally usable if any of `--json`, `--yes` or `--dry-run` is supplied. There could be two solutions to this: 1. Force the user to include at least one of those arguments. 2. Instead of only capturing the output, it could be recorded but also forwarded to `stdout`/`stderr`. This could/should be made optional via some `kwarg` for `run_command`. Possibility 1. is of course much simpler and could at least serve as a temporary solution.
Definitely prefer option 1 if anybody wants to swing by and submit an easy PR. Definitely prefer option 1 if anybody wants to swing by and submit an easy PR.
2017-05-22T17:34:19
conda/conda
5,412
conda__conda-5412
[ "5411" ]
ce7e9d845ddd17f52967d9cc454f824617a78fdc
diff --git a/conda/cli/main_config.py b/conda/cli/main_config.py --- a/conda/cli/main_config.py +++ b/conda/cli/main_config.py @@ -9,7 +9,7 @@ import collections import json import os -from os.path import join +from os.path import isfile, join import sys from textwrap import wrap @@ -138,6 +138,13 @@ def configure_parser(sub_parsers): action="store_true", help="Describe available 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='*', @@ -231,12 +238,45 @@ def format_dict(d): return lines +def parameter_description_builder(name): + from .._vendor.auxlib.entity import EntityEncoder + builder = [] + details = context.describe_parameter(name) + aliases = details['aliases'] + string_delimiter = details.get('string_delimiter') + element_types = details['element_types'] + default_value_str = json.dumps(details['default_value'], cls=EntityEncoder) + + if details['parameter_type'] == 'primitive': + builder.append("%s (%s)" % (name, ', '.join(sorted(set(et for et in element_types))))) + else: + builder.append("%s (%s: %s)" % (name, details['parameter_type'], + ', '.join(sorted(set(et for et in element_types))))) + + if aliases: + builder.append(" aliases: %s" % ', '.join(aliases)) + if string_delimiter: + builder.append(" string delimiter: '%s'" % string_delimiter) + + builder.extend(' ' + line for line in wrap(details['description'], 70)) + + builder.append('') + + builder.extend(yaml_dump({name: json.loads(default_value_str)}).strip().split('\n')) + + builder = ['# ' + line for line in builder] + builder.append('') + builder.append('') + return builder + + def execute_config(args, parser): try: - from cytoolz.itertoolz import groupby + from cytoolz.itertoolz import concat, groupby except ImportError: # pragma: no cover - from .._vendor.toolz.itertoolz import groupby # NOQA + from .._vendor.toolz.itertoolz import concat, groupby # NOQA from .._vendor.auxlib.entity import EntityEncoder + json_warnings = [] json_get = {} @@ -280,26 +320,8 @@ def execute_config(args, parser): sort_keys=True, indent=2, separators=(',', ': '), cls=EntityEncoder)) else: - 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(sorted(set(et for et in element_types))))) - else: - print("%s (%s: %s)" % (name, details['parameter_type'], - ', '.join(sorted(set(et for et in 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() + print('\n'.join(concat(parameter_description_builder(name) + for name in paramater_names))) return if args.validate: @@ -318,6 +340,23 @@ def execute_config(args, parser): 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:
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -610,7 +610,7 @@ def test_conda_config_describe(self): stdout, stderr = run_command(Commands.CONFIG, prefix, "--describe") assert not stderr for param_name in context.list_parameters(): - assert re.search(r'^%s \(' % param_name, stdout, re.MULTILINE) + assert re.search(r'^# %s \(' % param_name, stdout, re.MULTILINE) stdout, stderr = run_command(Commands.CONFIG, prefix, "--describe --json") assert not stderr @@ -629,6 +629,19 @@ def test_conda_config_describe(self): assert json_obj['envvars'] == {'quiet': True} assert json_obj['cmd_line'] == {'json': True} + run_command(Commands.CONFIG, prefix, "--set changeps1 false") + with pytest.raises(CondaError): + run_command(Commands.CONFIG, prefix, "--write-default") + + rm_rf(join(prefix, 'condarc')) + run_command(Commands.CONFIG, prefix, "--write-default") + + with open(join(prefix, 'condarc')) as fh: + data = fh.read() + + for param_name in context.list_parameters(): + assert re.search(r'^# %s \(' % param_name, data, re.MULTILINE) + def test_conda_config_validate(self): with make_temp_env() as prefix: run_command(Commands.CONFIG, prefix, "--set ssl_verify no")
Create a conda command to write default config values and info to condarc It would be nice to have a way to materialize the whole spectrum of configuration options for conda in the user condarc (if empty). `conda config --write-defaults` I guess this could also be used for other locations `conda config --write-defaults --sytem` Something like: ![image](https://cloud.githubusercontent.com/assets/3627835/26373862/ce48e49a-3fc8-11e7-9fd6-80baccfeb145.png)
2017-05-23T21:24:29
conda/conda
5,414
conda__conda-5414
[ "5081", "5081" ]
ce7e9d845ddd17f52967d9cc454f824617a78fdc
diff --git a/conda/resolve.py b/conda/resolve.py --- a/conda/resolve.py +++ b/conda/resolve.py @@ -510,6 +510,9 @@ def generate_feature_metric(self, C): def generate_removal_count(self, C, specs): return {'!'+self.push_MatchSpec(C, ms.name): 1 for ms in specs} + def generate_install_count(self, C, specs): + return {self.push_MatchSpec(C, ms.name): 1 for ms in specs if ms.optional} + def generate_package_count(self, C, missing): return {self.push_MatchSpec(C, nm): 1 for nm in missing} @@ -687,7 +690,7 @@ def install_specs(self, specs, installed, update_deps=True): def install(self, specs, installed=None, update_deps=True, returnall=False): # type: (List[str], Option[?], bool, bool) -> List[Dist] specs, preserve = self.install_specs(specs, installed or [], update_deps) - pkgs = self.solve(specs, returnall=returnall) + pkgs = self.solve(specs, returnall=returnall, _remove=False) self.restore_bad(pkgs, preserve) return pkgs @@ -725,11 +728,11 @@ def remove_specs(self, specs, installed): def remove(self, specs, installed): specs, preserve = self.remove_specs(specs, installed) - pkgs = self.solve(specs) + pkgs = self.solve(specs, _remove=True) self.restore_bad(pkgs, preserve) return pkgs - def solve(self, specs, returnall=False): + def solve(self, specs, returnall=False, _remove=False): # type: (List[str], bool) -> List[Dist] try: stdoutlog.info("Solving package specifications: ") @@ -771,9 +774,10 @@ def mysat(specs, add_if=False): speca.extend(MatchSpec(s) for s in specm) # Removed packages: minimize count - eq_optional_c = r2.generate_removal_count(C, speco) - solution, obj7 = C.minimize(eq_optional_c, solution) - log.debug('Package removal metric: %d', obj7) + if _remove: + eq_optional_c = r2.generate_removal_count(C, speco) + solution, obj7 = C.minimize(eq_optional_c, solution) + log.debug('Package removal metric: %d', obj7) # Requested packages: maximize versions eq_req_v, eq_req_b = r2.generate_version_metrics(C, specr) @@ -795,6 +799,12 @@ def mysat(specs, add_if=False): solution, obj4 = C.minimize(eq_req_b, solution) log.debug('Initial package build metric: %d', obj4) + # Optional installations: minimize count + if not _remove: + eq_optional_install = r2.generate_install_count(C, speco) + solution, obj49 = C.minimize(eq_optional_install, solution) + log.debug('Optional package install metric: %d', obj49) + # Dependencies: minimize the number of packages that need upgrading eq_u = r2.generate_update_count(C, speca) solution, obj50 = C.minimize(eq_u, solution)
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -714,6 +714,16 @@ def test_package_pinning(self): assert not package_is_installed(prefix, "python-2.7") assert not package_is_installed(prefix, "itsdangerous-0.23") + @pytest.mark.xfail(on_win, strict=True, reason="On Windows the Python package is pulled in as 'vc' feature-provider.") + def test_package_optional_pinning(self): + with make_temp_env("") as prefix: + run_command(Commands.CONFIG, prefix, + "--add pinned_packages", "python=3.6.1=2") + run_command(Commands.INSTALL, prefix, "openssl") + assert not package_is_installed(prefix, "python") + run_command(Commands.INSTALL, prefix, "flask") + assert package_is_installed(prefix, "python-3.6.1") + def test_update_deps_flag_absent(self): with make_temp_env("python=2 itsdangerous=0.23") as prefix: assert package_is_installed(prefix, 'python-2')
Make pinned packages optional/constrained dependencies In the conda 4.3 feature branch, make the `get_pinned_specs()` function in `conda/plan.py` return `MatchSpec` objects with the `optional=True` flag. Make sure (by writing extra unit tests) that the `conda.cli.common.spec_from_line()` function is both working correctly and being used correctly. Package pinning configuration was recently implemented within condarc files via https://github.com/conda/conda/pull/4921/files. Reviewing that PR would be a good place to start. Make pinned packages optional/constrained dependencies In the conda 4.3 feature branch, make the `get_pinned_specs()` function in `conda/plan.py` return `MatchSpec` objects with the `optional=True` flag. Make sure (by writing extra unit tests) that the `conda.cli.common.spec_from_line()` function is both working correctly and being used correctly. Package pinning configuration was recently implemented within condarc files via https://github.com/conda/conda/pull/4921/files. Reviewing that PR would be a good place to start.
While working on the test I notice something isn't working quite right, I suspect the solver: ``` run_command(Commands.INSTALL, prefix, "openssl") assert not package_is_installed(prefix, "python") run_command(Commands.INSTALL, prefix, "flask") assert package_is_installed(prefix, "python-3.6.1-2") ``` works fine, while ``` run_command(Commands.CONFIG, prefix, "--add pinned_packages", "python=3.6.1-2") run_command(Commands.INSTALL, prefix, "openssl") assert not package_is_installed(prefix, "python") run_command(Commands.INSTALL, prefix, "flask") assert package_is_installed(prefix, "python-3.6.1-2") ``` yields the error ``` UnsatisfiableError: The following specifications were found to be in conflict: - flask - python 3.6.1-2 (optional) ``` @mcg1969 , do you have any idea why this may be happening, and where I should follow up (file a separate bug report, etc.) ? Interesting. Normally I tell people _never doubt the solver_ but this is certainly sufficiently new functionality that we should check. I'll see what I can find. ha ha! _never doubt the solver_. `python=3.6.1-2` is not the correct spec. It's either `python=3.6.1=2` or `python 3.6.1 2`, depending on how you've implemented it. `python=3.6.1-2` means `Python version 3.6.1-2`, not `Python version 3.6.1 build 2`. Thanks ! (Just a shot in the dark: the solver itself only treats a bunch of numbers (roughly speaking :-) ), which we generate from all the various inputs (match-spec, index content, etc.). I could imagine that our encoding of the request from those inputs into numbers might be wrong somehow, i.e. the query we submit to the solver proper may not be what we intended.) Oh ! Now that isn't very intuitive, is it ? Is that documented somewhere ? Anyhow, thanks for the quick find, I'll adjust my test logic and see whether it works. Well, `python=3.6.1=2` is the proper command-line syntax, and that's documented. `python 3.6.1 2` is the proper MatchSpec syntax, which is also documented, but perhaps internally. OK, fair enough. Thanks for your assistance ! ``` run_command(Commands.CONFIG, prefix, "--add pinned_packages", "python=3.6.1=2") run_command(Commands.INSTALL, prefix, "openssl") assert not package_is_installed(prefix, "python") ``` is failing, i.e. python is being installed even though openssl doesn't depend on it. The MatchSpec objects look good, though. @stefanseefeld > is failing, i.e. python is being installed even though openssl doesn't depend on it Are you working in 4.3.x or 4.4.x? Right, I understand. This is on 4.4.x. I guess that means then that the `optional=True` flag sent to the MatchSpec object isn't working correctly within resolve? Is this on windows? If so, features are to blame, and we're discussing that in another issue. This is GNU/Linux. Ah, I'll bet I know why. You're passing an optional MatchSpec right to `Resolve.solve`, I'll bet. That's not going to work, I don't think. The reason why is that I've been using the optional specification for a long time to effect package _removals_. When you do a `conda remove xxx`, the solver gets a set of specs that exclude `xxx`, and which make _all other packages optional_. That way, if it has to remove other packages because they have a dependency relationship with `xxx`, it is given permission to do so. But of course, we don't _want_ to remove all the packages in the environment; indeed, we want to keep as many of them as possible. So the solver has a specific pass that _maximizes the number of optional specs it keeps around_. I was frankly unaware that y'all were trying to do this. It makes sense, don't get me wrong, but optional specs fed directly to `Resolve.solve` have had a specific meaning for quite some time. It's not entirely clear to me how this is going to be fixed. So it sounds like we need two kinds of optional dependencies: 1) optional, but try hard to include it; and 2) optional, but try hard _not_ to include it. It's important to note that pinned dependencies are _not_ always optional. In Stefan's example above, for instance, `python=3.6.1=2` starts out as "optional but try hard not to include it". But as soon as it _does_ get included in the environment, it is _no longer optional at all_. Yeah, from a user's perspective I find the terminology confusing. It's the "pinned" that is the operational term here. Optional merely means that the pinning should have no bearing on whether or not the package gets installed. So perhaps we can just find a better term to express the concept, to be less confusing to ourselves. Well, we're trying to _implement_ pinning using conda's internal optional dependency mechanism. We don't necessarily need to use the term "optional" in public facing documentation, that's for sure. But I realized over lunch how we can get this to work. We can create a "virtual package" that is installed in each environment. That package would include as optional dependencies every pinned package. This would ensure that conda behaves properly no matter what the operations are. That sounds good. (And yes, please let's make sure the user-facing information deploys a less ambiguous term to flag this). I'm getting confused each time I try to parse the title of this very issue. ;-) @stefanseefeld I just found an error that will/should be affecting your tests here... https://github.com/conda/conda/blob/4.4.x/conda/models/index_record.py#L126 Should be `optional=True`, not `option=True`. Good catch ! Unfortunately, the test still fails with that fixed. I'll keep looking... The tests _should_ fail unless the metapackage idea is implemented. If you supply an "optional=True" directly to the `conda.resolve.Resolve.solve` spec list, it's going to try to install it---it just won't complain if it can't. OK, so it sounds like we need a plan for how to attack this. I'd like to help, but don't think I have enough knowledge about the solver internals to even understand what needs to be done. While working on the test I notice something isn't working quite right, I suspect the solver: ``` run_command(Commands.INSTALL, prefix, "openssl") assert not package_is_installed(prefix, "python") run_command(Commands.INSTALL, prefix, "flask") assert package_is_installed(prefix, "python-3.6.1-2") ``` works fine, while ``` run_command(Commands.CONFIG, prefix, "--add pinned_packages", "python=3.6.1-2") run_command(Commands.INSTALL, prefix, "openssl") assert not package_is_installed(prefix, "python") run_command(Commands.INSTALL, prefix, "flask") assert package_is_installed(prefix, "python-3.6.1-2") ``` yields the error ``` UnsatisfiableError: The following specifications were found to be in conflict: - flask - python 3.6.1-2 (optional) ``` @mcg1969 , do you have any idea why this may be happening, and where I should follow up (file a separate bug report, etc.) ? Interesting. Normally I tell people _never doubt the solver_ but this is certainly sufficiently new functionality that we should check. I'll see what I can find. ha ha! _never doubt the solver_. `python=3.6.1-2` is not the correct spec. It's either `python=3.6.1=2` or `python 3.6.1 2`, depending on how you've implemented it. `python=3.6.1-2` means `Python version 3.6.1-2`, not `Python version 3.6.1 build 2`. Thanks ! (Just a shot in the dark: the solver itself only treats a bunch of numbers (roughly speaking :-) ), which we generate from all the various inputs (match-spec, index content, etc.). I could imagine that our encoding of the request from those inputs into numbers might be wrong somehow, i.e. the query we submit to the solver proper may not be what we intended.) Oh ! Now that isn't very intuitive, is it ? Is that documented somewhere ? Anyhow, thanks for the quick find, I'll adjust my test logic and see whether it works. Well, `python=3.6.1=2` is the proper command-line syntax, and that's documented. `python 3.6.1 2` is the proper MatchSpec syntax, which is also documented, but perhaps internally. OK, fair enough. Thanks for your assistance ! ``` run_command(Commands.CONFIG, prefix, "--add pinned_packages", "python=3.6.1=2") run_command(Commands.INSTALL, prefix, "openssl") assert not package_is_installed(prefix, "python") ``` is failing, i.e. python is being installed even though openssl doesn't depend on it. The MatchSpec objects look good, though. @stefanseefeld > is failing, i.e. python is being installed even though openssl doesn't depend on it Are you working in 4.3.x or 4.4.x? Right, I understand. This is on 4.4.x. I guess that means then that the `optional=True` flag sent to the MatchSpec object isn't working correctly within resolve? Is this on windows? If so, features are to blame, and we're discussing that in another issue. This is GNU/Linux. Ah, I'll bet I know why. You're passing an optional MatchSpec right to `Resolve.solve`, I'll bet. That's not going to work, I don't think. The reason why is that I've been using the optional specification for a long time to effect package _removals_. When you do a `conda remove xxx`, the solver gets a set of specs that exclude `xxx`, and which make _all other packages optional_. That way, if it has to remove other packages because they have a dependency relationship with `xxx`, it is given permission to do so. But of course, we don't _want_ to remove all the packages in the environment; indeed, we want to keep as many of them as possible. So the solver has a specific pass that _maximizes the number of optional specs it keeps around_. I was frankly unaware that y'all were trying to do this. It makes sense, don't get me wrong, but optional specs fed directly to `Resolve.solve` have had a specific meaning for quite some time. It's not entirely clear to me how this is going to be fixed. So it sounds like we need two kinds of optional dependencies: 1) optional, but try hard to include it; and 2) optional, but try hard _not_ to include it. It's important to note that pinned dependencies are _not_ always optional. In Stefan's example above, for instance, `python=3.6.1=2` starts out as "optional but try hard not to include it". But as soon as it _does_ get included in the environment, it is _no longer optional at all_. Yeah, from a user's perspective I find the terminology confusing. It's the "pinned" that is the operational term here. Optional merely means that the pinning should have no bearing on whether or not the package gets installed. So perhaps we can just find a better term to express the concept, to be less confusing to ourselves. Well, we're trying to _implement_ pinning using conda's internal optional dependency mechanism. We don't necessarily need to use the term "optional" in public facing documentation, that's for sure. But I realized over lunch how we can get this to work. We can create a "virtual package" that is installed in each environment. That package would include as optional dependencies every pinned package. This would ensure that conda behaves properly no matter what the operations are. That sounds good. (And yes, please let's make sure the user-facing information deploys a less ambiguous term to flag this). I'm getting confused each time I try to parse the title of this very issue. ;-) @stefanseefeld I just found an error that will/should be affecting your tests here... https://github.com/conda/conda/blob/4.4.x/conda/models/index_record.py#L126 Should be `optional=True`, not `option=True`. Good catch ! Unfortunately, the test still fails with that fixed. I'll keep looking... The tests _should_ fail unless the metapackage idea is implemented. If you supply an "optional=True" directly to the `conda.resolve.Resolve.solve` spec list, it's going to try to install it---it just won't complain if it can't. OK, so it sounds like we need a plan for how to attack this. I'd like to help, but don't think I have enough knowledge about the solver internals to even understand what needs to be done.
2017-05-24T13:21:11
conda/conda
5,421
conda__conda-5421
[ "5420" ]
3e96017a129c066ec7738968d3cbe4b59dd26b7b
diff --git a/conda_env/cli/main_update.py b/conda_env/cli/main_update.py --- a/conda_env/cli/main_update.py +++ b/conda_env/cli/main_update.py @@ -1,18 +1,16 @@ from argparse import RawDescriptionHelpFormatter import os -import textwrap import sys +import textwrap -from conda import config -from conda.cli import common -from conda.cli import install as cli_install +from conda.cli import common, install as cli_install from conda.misc import touch_nonadmin -from ..installers.base import get_installer, InvalidInstaller -from .. import specs as install_specs -from .. import exceptions # for conda env from conda_env.cli.common import get_prefix +from .. import exceptions, specs as install_specs from ..exceptions import CondaEnvException +from ..installers.base import InvalidInstaller, get_installer + description = """ Update the current environment based on environment file """ @@ -35,12 +33,7 @@ def configure_parser(sub_parsers): 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, - ) + common.add_parser_prefix(p) p.add_argument( '-f', '--file', action='store',
conda-env update error in 4.3.20 ``` 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' ```
2017-05-25T04:03:54
conda/conda
5,426
conda__conda-5426
[ "5425" ]
c93159791bb4600a1f67a06c7108c5c73ffcfd98
diff --git a/conda/common/platform.py b/conda/common/platform.py --- a/conda/common/platform.py +++ b/conda/common/platform.py @@ -19,12 +19,12 @@ def is_admin_on_windows(): # pragma: unix no cover return False try: from ctypes import windll - return windll.shell32.IsUserAnAdmin()() != 0 + return windll.shell32.IsUserAnAdmin() != 0 except ImportError as e: log.debug('%r', e) return 'unknown' except Exception as e: - log.warn('%r', e) + log.info('%r', e) return 'unknown'
diff --git a/tests/common/test_platform.py b/tests/common/test_platform.py new file mode 100644 --- /dev/null +++ b/tests/common/test_platform.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import, division, print_function, unicode_literals + +from conda.common.compat import on_win +from conda.common.platform import is_admin_on_windows + + +def test_is_admin_on_windows(): + result = is_admin_on_windows() + if not on_win: + assert result is False + else: + assert result is False or result is True
Launching navigator via prompt warnings appear _From @RidaZubair on May 24, 2017 9:47_ **OS:** Windows **Anaconda: 4.4.0** **Actual:** On launching navigator via prompt following warning appears on prompt ![2](https://cloud.githubusercontent.com/assets/27444898/26396930/175ef622-408e-11e7-8e75-e9c2218e15de.png) _Copied from original issue: ContinuumIO/navigator#1189_
_From @goanpeca on May 24, 2017 13:52_ @kalefranz whats with the conda.common.platform error there? @RidaZubair warnings are just to inform that the conda commands that we called might have return something on the stderr, but by themselves they are not errors. However I am currious about the first Warning on Conda. Is Navigator not working in any way? In general WARNING messages are not a problem. _From @goanpeca on May 25, 2017 12:56_ Remove any warnings for output on stderr when parsing conda commands. Depending on the conda version, was probably https://github.com/conda/conda/pull/5368, fixed in 4.3.20. Crud, that error is pretty obvious. https://github.com/conda/conda/pull/5368/files#diff-56d5b142f8053df84f4a4e13d99c3864R22 A second couple-character patch for 4.3.21.
2017-05-25T13:14:13