repo
stringclasses
32 values
instance_id
stringlengths
13
37
base_commit
stringlengths
40
40
patch
stringlengths
1
1.89M
test_patch
stringclasses
1 value
problem_statement
stringlengths
304
69k
hints_text
stringlengths
0
246k
created_at
stringlengths
20
20
version
stringclasses
1 value
FAIL_TO_PASS
stringclasses
1 value
PASS_TO_PASS
stringclasses
1 value
environment_setup_commit
stringclasses
1 value
traceback
stringlengths
64
23.4k
__index_level_0__
int64
29
19k
conda/conda
conda__conda-2915
deaccea600d7b80cbcc939f018a5fdfe2a066967
diff --git a/conda/egg_info.py b/conda/egg_info.py --- a/conda/egg_info.py +++ b/conda/egg_info.py @@ -15,6 +15,7 @@ from .misc import rel_path + def get_site_packages_dir(installed_pkgs): for info in itervalues(installed_pkgs): if info['name'] == 'python': diff --git a/conda/exceptions.py b/conda/exceptions.py --- a/conda/exceptions.py +++ b/conda/exceptions.py @@ -8,6 +8,3 @@ class InvalidInstruction(CondaException): def __init__(self, instruction, *args, **kwargs): msg = "No handler for instruction: %r" % instruction super(InvalidInstruction, self).__init__(msg, *args, **kwargs) - -class LockError(RuntimeError, CondaException): - pass diff --git a/conda/lock.py b/conda/lock.py --- a/conda/lock.py +++ b/conda/lock.py @@ -17,11 +17,11 @@ """ from __future__ import absolute_import, division, print_function -import logging import os -import time - -from .exceptions import LockError +import logging +from os.path import join +import glob +from time import sleep LOCKFN = '.conda_lock' @@ -33,13 +33,15 @@ class Locked(object): """ Context manager to handle locks. """ - def __init__(self, path, retries=10): + def __init__(self, path): self.path = path self.end = "-" + str(os.getpid()) - self.lock_path = os.path.join(self.path, LOCKFN + self.end) - self.retries = retries + self.lock_path = join(self.path, LOCKFN + self.end) + self.pattern = join(self.path, LOCKFN + '-*') + self.remove = True def __enter__(self): + retries = 10 # Keep the string "LOCKERROR" in this string so that external # programs can look for it. lockstr = ("""\ @@ -48,24 +50,33 @@ def __enter__(self): If you are sure that conda is not running, remove it and try again. You can also use: $ conda clean --lock\n""") sleeptime = 1 - - for _ in range(self.retries): - if os.path.isdir(self.lock_path): - stdoutlog.info(lockstr % self.lock_path) + files = None + while retries: + files = glob.glob(self.pattern) + if files and not files[0].endswith(self.end): + stdoutlog.info(lockstr % str(files)) stdoutlog.info("Sleeping for %s seconds\n" % sleeptime) - - time.sleep(sleeptime) + sleep(sleeptime) sleeptime *= 2 + retries -= 1 else: - os.makedirs(self.lock_path) - return self + break + else: + stdoutlog.error("Exceeded max retries, giving up") + raise RuntimeError(lockstr % str(files)) - stdoutlog.error("Exceeded max retries, giving up") - raise LockError(lockstr % self.lock_path) + if not files: + try: + os.makedirs(self.lock_path) + except OSError: + pass + else: # PID lock already here --- someone else will remove it. + self.remove = False def __exit__(self, exc_type, exc_value, traceback): - try: - os.rmdir(self.lock_path) - os.rmdir(self.path) - except OSError: - pass + if self.remove: + for path in self.lock_path, self.path: + try: + os.rmdir(path) + except OSError: + pass
[Regression] Conda create environment fails on lock if root environment is not under user control This issue is introduced in Conda 4.1.0 (Conda 4.0.8 works fine). ``` $ conda create -n root2 python=2 [123/1811] Fetching package metadata ....... Solving package specifications ............. Package plan for installation in environment /home/frol/.conda/envs/root2: The following NEW packages will be INSTALLED: openssl: 1.0.2h-1 (soft-link) pip: 8.1.2-py27_0 (soft-link) python: 2.7.11-0 (soft-link) readline: 6.2-2 (soft-link) setuptools: 23.0.0-py27_0 (soft-link) sqlite: 3.13.0-0 (soft-link) tk: 8.5.18-0 (soft-link) wheel: 0.29.0-py27_0 (soft-link) zlib: 1.2.8-3 (soft-link) Proceed ([y]/n)? Linking packages ... 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 "/usr/local/miniconda/bin/conda", line 6, in <module> sys.exit(main()) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/cli/main.py", line 120, in main args_func(args, p) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/cli/main.py", line 127, in args_func args.func(args, p) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 57, in execute install(args, parser, 'create') File "/usr/local/miniconda/lib/python2.7/site-packages/conda/cli/install.py", line 407, in install execute_actions(actions, index, verbose=not args.quiet) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/plan.py", line 566, in execute_actions inst.execute_instructions(plan, index, verbose) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/instructions.py", line 137, in execute_instructions cmd(state, arg) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/instructions.py", line 80, in LINK_CMD link(state['prefix'], dist, lt, index=state['index'], shortcuts=shortcuts) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/install.py", line 1035, in link with Locked(prefix), Locked(pkgs_dir): File "/usr/local/miniconda/lib/python2.7/site-packages/conda/lock.py", line 60, in __enter__ os.makedirs(self.lock_path) File "/usr/local/miniconda/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: '/usr/local/miniconda/pkgs/.conda_lock-949' ``` `/usr/local/miniconda/` is a system-wide installation of miniconda, so obviously, users cannot create lock files there. P.S. I have a dream that updating conda software won't break things on every release...
It seems that I cannot even do `source activate ...` as a regular user now. It just hangs. Here is what I get when I interrupt it with `^C`: ``` $ source activate root2 ^CTraceback (most recent call last): File "/usr/local/miniconda/bin/conda", line 6, in <module> sys.exit(main()) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/cli/main.py", line 48, in main activate.main() File "/usr/local/miniconda/lib/python2.7/site-packages/conda/cli/activate.py", line 121, in main path = get_path(shelldict) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/cli/activate.py", line 108, in get_path return run_in(shelldict["printpath"], shelldict)[0] File "/usr/local/miniconda/lib/python2.7/site-packages/conda/utils.py", line 174, in run_in stdout, stderr = p.communicate() File "/usr/local/miniconda/lib/python2.7/subprocess.py", line 799, in communicate return self._communicate(input) File "/usr/local/miniconda/lib/python2.7/subprocess.py", line 1409, in _communicate stdout, stderr = self._communicate_with_poll(input) File "/usr/local/miniconda/lib/python2.7/subprocess.py", line 1463, in _communicate_with_poll ready = poller.poll() KeyboardInterrupt ``` It also seems like there is no way to pin Conda version. Installing any package to the root env tries to update Conda to the latest version: ``` $ conda install python Using Anaconda Cloud api site https://api.anaconda.org Fetching package metadata: .... Solving package specifications: ......... Package plan for installation in environment /usr/local/miniconda: The following packages will be UPDATED: conda: 4.0.8-py27_0 --> 4.1.0-py27_0 conda-env: 2.4.5-py27_0 --> 2.5.0-py27_0 Proceed ([y]/n)? ``` You can now pin 4.0.9. ``` conda install conda=4.0.9 conda config --set auto_update_conda false ``` `auto_update_conda` setting will be added to 4.1.1 also, which is coming out tonight or tomorrow morning. Freaking lock on the whole package cache. We're going to get rid of that soon. I can't really tell what initially tripped here. What are the permissions on `/usr/local/miniconda/pkgs/.conda_lock-949`? Are they yours, or root, or does it even exist? Ohhh I think I get it, from your issue title. I actually thought this was already broken anyway. I plan on having 4.2 out in a couple weeks now, and should be a simple fix at that point. Ok with staying on 4.0.9 for this use case until then? @kalefranz It seems that I don't have options here but wait. I use Docker containers and this bug doesn't bother me that much. However, I would say that it is not a minor regression to postpone it to the next release. (From my experience, next release will break things in another way, so people will stuck with 4.0.*) In the last several months our coverage has gone from ~48% to almost 70%. The code base is still far more fragile and brittle than I'd like it to be, but we're making progress I think. Reverting #2320 fixed the regression. However, it seems that it just fails silently at locking, but at least it works in non-concurrent scenarios. cc @alanhdu @frol: Yeah, that's about right. Before #2320, conda would just swallow all `OsError`s (including `PermissionError`s). For now, we could add a `try ... except` around https://github.com/conda/conda/blob/master/conda/lock.py#L60, catch a `PermissionError` (or whatever the equivalent Python 2 error is), and try to do something smart (or just silently fail... depends how important that lock actually is). I am seeing this issue as well @kalefranz After reading this, I thought I would be able to downgrade conda to 4.0.9. However after doing that, I am still unable to activate centrally administered conda environments as a user. Is there a prior version of conda you would reccommend? Or did the 4.1.3 version leave something in my miniconda install that is causing the problem? Do I need to re-install miniconda2 from scratch? Should I just wait for this to be fixed before proceeding with trying to build a central conda install for our users? @davidslac There are two options you may try: 1. Downgrade conda-env together with conda: ``` bash $ conda install conda=4.0.9 'conda-env<2.5' ``` 2. Patch (revert changes) conda lock in Conda 4.1.x: ``` bash $ curl -o "/usr/local/miniconda/lib/python"*"/site-packages/conda/lock.py" \ "https://raw.githubusercontent.com/conda/conda/9428ad0b76be55e8070e04dd577c96e7dab571e0/conda/lock.py" ``` Thanks! I tried both, but it sill did not work. It's probably something I'm overlooking on my part - after the first failure I deleted the lock.pyc, but still no luck. I'll just hope for a fix in the future. I suspect though, that central administration is not as standard of a use case, so one is more likely to run into problems. It may be we should just provide a channel of our packages to our users and let them administer their own software stacks, give them some environments we know work. best, David On 06/27/16 10:58, Vlad Frolov wrote: > @davidslac https://github.com/davidslac There are two options you > may try: > > 1. > > ``` > Downgrade conda-env: > > $ conda install'conda-env<2.5' > ``` > > 2. > > ``` > Patch (revert changes) conda lock: > > $ curl -o"/usr/local/miniconda/lib/python"*"/site-packages/conda/lock.py" \ > "https://raw.githubusercontent.com/conda/conda/9428ad0b76be55e8070e04dd577c96e7dab571e0/conda/lock.py" > ```
2016-06-29T17:16:25Z
[]
[]
Traceback (most recent call last): File "/usr/local/miniconda/bin/conda", line 6, in <module> sys.exit(main()) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/cli/main.py", line 120, in main args_func(args, p) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/cli/main.py", line 127, in args_func args.func(args, p) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 57, in execute install(args, parser, 'create') File "/usr/local/miniconda/lib/python2.7/site-packages/conda/cli/install.py", line 407, in install execute_actions(actions, index, verbose=not args.quiet) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/plan.py", line 566, in execute_actions inst.execute_instructions(plan, index, verbose) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/instructions.py", line 137, in execute_instructions cmd(state, arg) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/instructions.py", line 80, in LINK_CMD link(state['prefix'], dist, lt, index=state['index'], shortcuts=shortcuts) File "/usr/local/miniconda/lib/python2.7/site-packages/conda/install.py", line 1035, in link with Locked(prefix), Locked(pkgs_dir): File "/usr/local/miniconda/lib/python2.7/site-packages/conda/lock.py", line 60, in __enter__ os.makedirs(self.lock_path) File "/usr/local/miniconda/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: '/usr/local/miniconda/pkgs/.conda_lock-949'
3,981
conda/conda
conda__conda-3257
83f397d3d596dedc93e0160104dad46c6bfdb7ef
diff --git a/conda/utils.py b/conda/utils.py --- a/conda/utils.py +++ b/conda/utils.py @@ -313,6 +313,12 @@ def human_bytes(n): "sh.exe": dict( msys2_shell_base, exe="sh.exe", ), + "zsh.exe": dict( + msys2_shell_base, exe="zsh.exe", + ), + "zsh": dict( + msys2_shell_base, exe="zsh", + ), } else:
Zsh.exe not supported on MSYS2 The following error is reported in a MSYS2 zsh shell: ``` ➜ dotfiles git:(master) ✗ source activate py35_32 Traceback (most recent call last): File "C:\Miniconda3\Scripts\conda-script.py", line 5, in <module> sys.exit(main()) File "C:\Miniconda3\lib\site-packages\conda\cli\main.py", line 48, in main activate.main() File "C:\Miniconda3\lib\site-packages\conda\cli\activate.py", line 105, in main shelldict = shells[shell] KeyError: 'zsh.exe' ```
2016-08-09T15:16:41Z
[]
[]
Traceback (most recent call last): File "C:\Miniconda3\Scripts\conda-script.py", line 5, in <module> sys.exit(main()) File "C:\Miniconda3\lib\site-packages\conda\cli\main.py", line 48, in main activate.main() File "C:\Miniconda3\lib\site-packages\conda\cli\activate.py", line 105, in main shelldict = shells[shell] KeyError: 'zsh.exe'
3,990
conda/conda
conda__conda-3633
2d850dc7ce6ded5c7573ce470dca81517a6f9b94
diff --git a/conda/common/configuration.py b/conda/common/configuration.py --- a/conda/common/configuration.py +++ b/conda/common/configuration.py @@ -23,7 +23,7 @@ from itertools import chain from logging import getLogger from os import environ, stat -from os.path import join +from os.path import join, basename from stat import S_IFDIR, S_IFMT, S_IFREG try: @@ -343,7 +343,7 @@ def load_file_configs(search_path): # returns an ordered map of filepath and dict of raw parameter objects def _file_yaml_loader(fullpath): - assert fullpath.endswith(".yml") or fullpath.endswith("condarc"), fullpath + assert fullpath.endswith((".yml", ".yaml")) or "condarc" in basename(fullpath), fullpath yield fullpath, YamlRawParameter.make_raw_parameters_from_file(fullpath) def _dir_yaml_loader(fullpath):
BUG: CONDARC env var broken in latest conda After upgrading to conda version 4.2.7 the CONDARC env var no longer supports filenames of any format. It appears to only support filenames that end with .yml or .condarc. This is a functionality regression bug. Can this be fixed immediately!? **conda info** Current conda install: ``` platform : osx-64 conda version : 4.2.7 conda is private : False conda-env version : 4.2.7 conda-build version : 1.21.3 python version : 2.7.12.final.0 requests version : 2.9.1 root environment : /opt/anaconda (writable) default environment : /opt/anaconda envs directories : /opt/anaconda/envs package cache : /opt/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/ https://conda.anaconda.org/r/osx-64/ https://conda.anaconda.org/r/noarch/ config file : /Users/jhull/.condarc offline mode : False ``` **export CONDARC=~/.condarc.cloud** **conda info** Traceback (most recent call last): File "/opt/anaconda/bin/conda", line 4, in <module> import conda.cli File "/opt/anaconda/lib/python2.7/site-packages/conda/cli/**init**.py", line 8, in <module> from .main import main # NOQA File "/opt/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 46, in <module> from ..base.context import context File "/opt/anaconda/lib/python2.7/site-packages/conda/base/context.py", line 252, in <module> context = Context(SEARCH_PATH, conda, None) File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 692, in **init** self._add_search_path(search_path) File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 699, in _add_search_path return self._add_raw_data(load_file_configs(search_path)) File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 371, in load_file_configs raw_data = odict(kv for kv in chain.from_iterable(load_paths)) File "/opt/anaconda/lib/python2.7/collections.py", line 69, in __init__ self.__update(_args, *_kwds) File "/opt/anaconda/lib/python2.7/_abcoll.py", line 571, in update for key, value in other: File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 371, in <genexpr> raw_data = odict(kv for kv in chain.from_iterable(load_paths)) File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 346, in _file_yaml_loader **assert fullpath.endswith(".yml") or fullpath.endswith("condarc"), fullpath AssertionError: /Users/jhull/.condarc.cloud**
Added to my list to talk through with @mcg1969 tomorrow.
2016-10-14T16:07:18Z
[]
[]
Traceback (most recent call last): File "/opt/anaconda/bin/conda", line 4, in <module> import conda.cli File "/opt/anaconda/lib/python2.7/site-packages/conda/cli/**init**.py", line 8, in <module> from .main import main # NOQA File "/opt/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 46, in <module> from ..base.context import context File "/opt/anaconda/lib/python2.7/site-packages/conda/base/context.py", line 252, in <module> context = Context(SEARCH_PATH, conda, None) File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 692, in **init** self._add_search_path(search_path) File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 699, in _add_search_path return self._add_raw_data(load_file_configs(search_path)) File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 371, in load_file_configs raw_data = odict(kv for kv in chain.from_iterable(load_paths)) File "/opt/anaconda/lib/python2.7/collections.py", line 69, in __init__ self.__update(_args, *_kwds) File "/opt/anaconda/lib/python2.7/_abcoll.py", line 571, in update for key, value in other: File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 371, in <genexpr> raw_data = odict(kv for kv in chain.from_iterable(load_paths)) File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 346, in _file_yaml_loader **assert fullpath.endswith(".yml") or fullpath.endswith("condarc"), fullpath AssertionError: /Users/jhull/.condarc.cloud**
4,012
conda/conda
conda__conda-4774
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"""
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:01Z
[]
[]
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:
4,058
conda/conda
conda__conda-5090
ec9c9999ea57d3351d5c5c688baacc982c3daee2
diff --git a/conda/cli/activate.py b/conda/cli/activate.py --- a/conda/cli/activate.py +++ b/conda/cli/activate.py @@ -45,7 +45,7 @@ def help(command, shell): def prefix_from_arg(arg, shelldict): - from conda.base.context import context, locate_prefix_by_name + 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. @@ -114,8 +114,8 @@ def get_activate_path(shelldict): def main(): - from conda.base.constants import ROOT_ENV_NAME - from conda.utils import shells + 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]) @@ -163,9 +163,9 @@ 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_prefix, shell) + from ..base.context import context + from ..install import symlink_conda + symlink_conda(prefix, context.root_prefix, shell) except (IOError, OSError) as e: if e.errno == errno.EPERM or e.errno == errno.EACCES: msg = ("Cannot activate environment {0}.\n" @@ -176,7 +176,7 @@ def main(): sys.exit(0) # raise CondaSystemExit elif sys.argv[1] == '..changeps1': - from conda.base.context import context + from ..base.context import context path = int(context.changeps1) else: diff --git a/conda/cli/common.py b/conda/cli/common.py --- a/conda/cli/common.py +++ b/conda/cli/common.py @@ -88,7 +88,7 @@ def __init__(self, prefix, parsed_args, **kwargs): def _get_items(self): # TODO: Include .tar.bz2 files for local installs. - from conda.core.index import get_index + from ..core.index import get_index args = self.parsed_args call_dict = dict(channel_urls=args.channel or (), use_cache=True, @@ -106,7 +106,7 @@ def __init__(self, prefix, parsed_args, **kwargs): @memoize def _get_items(self): - from conda.core.linked_data import linked + from ..core.linked_data import linked packages = linked(context.prefix_w_legacy_search) return [dist.quad[0] for dist in packages] @@ -573,7 +573,7 @@ def get_index_trap(*args, **kwargs): Retrieves the package index, but traps exceptions and reports them as JSON if necessary. """ - from conda.core.index import get_index + from ..core.index import get_index kwargs.pop('json', None) return get_index(*args, **kwargs) @@ -603,7 +603,7 @@ def stdout_json_success(success=True, **kwargs): def handle_envs_list(acc, output=True): - from conda import misc + from .. import misc if output: print("# conda environments:") diff --git a/conda/cli/install.py b/conda/cli/install.py --- a/conda/cli/install.py +++ b/conda/cli/install.py @@ -377,7 +377,7 @@ def install(args, parser, command='install'): def check_write(command, prefix, json=False): if inroot_notwritable(prefix): - from conda.cli.help import root_read_only + from .help import root_read_only root_read_only(command, prefix, json=json) diff --git a/conda/cli/main.py b/conda/cli/main.py --- a/conda/cli/main.py +++ b/conda/cli/main.py @@ -102,7 +102,7 @@ def _main(*args): if "remove" in module: imported.configure_parser(sub_parsers, name='uninstall') - from conda.cli.find_commands import find_commands + from .find_commands import find_commands def completer(prefix, **kwargs): return [i for i in list(sub_parsers.choices) + find_commands() 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 @@ -17,9 +17,6 @@ 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.url import mask_anaconda_token -from ..config import rc_path, sys_rc_path, user_rc_path -from ..models.channel import prioritize_channels log = getLogger(__name__) @@ -80,12 +77,12 @@ def configure_parser(sub_parsers): p.set_defaults(func=execute) -python_re = re.compile('python\d\.\d') def get_user_site(): site_dirs = [] try: if not on_win: if exists(expanduser('~/.local/lib')): + python_re = re.compile('python\d\.\d') for path in listdir(expanduser('~/.local/lib/')): if python_re.match(path): site_dirs.append("~/.local/lib/%s" % path) @@ -107,12 +104,13 @@ def get_user_site(): SKIP_FIELDS = IGNORE_FIELDS | {'name', 'version', 'build', 'build_number', 'channel', 'schannel', 'size', 'fn', 'depends'} + def dump_record(pkg): return {k: v for k, v in iteritems(pkg.dump()) if k not in IGNORE_FIELDS} def pretty_package(dist, pkg): - from conda.utils import human_bytes + from ..utils import human_bytes pkg = dump_record(pkg) d = OrderedDict([ @@ -137,58 +135,48 @@ def pretty_package(dist, pkg): for dep in pkg['depends']: print(' %s' % dep) -def execute(args, parser): - import os - from os.path import dirname - - import conda - from conda.base.context import context - from conda.models.channel import offline_keep - from conda.resolve import Resolve - from conda.api import get_index - from conda.connection import user_agent - if args.root: - if context.json: - stdout_json({'root_prefix': context.root_prefix}) - else: - print(context.root_prefix) - return +def print_package_info(packages): + from ..api import get_index + from ..base.context import context + from ..resolve import Resolve + index = get_index() + r = Resolve(index) + if context.json: + stdout_json({ + package: [dump_record(r.index[d]) + for d in r.get_dists_for_spec(arg2spec(package))] + for package in packages + }) + else: + for package in packages: + for dist in r.get_dists_for_spec(arg2spec(package)): + pretty_package(dist, r.index[dist]) - if args.packages: - index = get_index() - r = Resolve(index) - if context.json: - stdout_json({ - package: [dump_record(r.index[d]) - for d in r.get_dists_for_spec(arg2spec(package))] - for package in args.packages - }) - else: - for package in args.packages: - for dist in r.get_dists_for_spec(arg2spec(package)): - pretty_package(dist, r.index[dist]) - return - options = 'envs', 'system', 'license' +def get_info_dict(system=False): + from .. import CONDA_PACKAGE_ROOT, __version__ as conda_version + from ..base.context import context + from ..common.url import mask_anaconda_token + from ..config import rc_path, sys_rc_path, user_rc_path + from ..connection import user_agent + from ..models.channel import offline_keep, prioritize_channels try: - from conda.install import linked_data + from ..install import linked_data root_pkgs = linked_data(context.root_prefix) except: root_pkgs = None try: - import requests - requests_version = requests.__version__ + from requests import __version__ as requests_version except ImportError: requests_version = "could not import" except Exception as e: - requests_version = "Error %s" % e + requests_version = "Error %r" % e try: - import conda_env - conda_env_version = conda_env.__version__ + from conda_env import __version__ as conda_env_version except: try: cenv = [p for p in itervalues(root_pkgs) if p['name'] == 'conda-env'] @@ -205,16 +193,7 @@ def execute(args, parser): else: conda_build_version = conda_build.__version__ - channels = context.channels - - if args.unsafe_channels: - if not context.json: - print("\n".join(channels)) - else: - print(json.dumps({"channels": channels})) - return 0 - - channels = list(prioritize_channels(channels).keys()) + channels = list(prioritize_channels(context.channels).keys()) if not context.json: channels = [c + ('' if offline_keep(c) else ' (offline)') for c in channels] @@ -222,7 +201,7 @@ def execute(args, parser): info_dict = dict( platform=context.subdir, - conda_version=conda.__version__, + conda_version=conda_version, conda_env_version=conda_env_version, conda_build_version=conda_build_version, root_prefix=context.root_prefix, @@ -242,54 +221,13 @@ def execute(args, parser): python_version='.'.join(map(str, sys.version_info)), requests_version=requests_version, user_agent=user_agent, + conda_location=CONDA_PACKAGE_ROOT, ) if not on_win: info_dict['UID'] = os.geteuid() info_dict['GID'] = os.getegid() - if args.all or context.json: - for option in options: - setattr(args, option, True) - - if (args.all or all(not getattr(args, opt) for opt in options)) and not context.json: - for key in 'pkgs_dirs', 'envs_dirs', 'channels': - info_dict['_' + key] = ('\n' + 26 * ' ').join(info_dict[key]) - info_dict['_rtwro'] = ('writable' if info_dict['root_writable'] else - 'read only') - print("""\ -Current conda install: - - platform : %(platform)s - conda version : %(conda_version)s - conda is private : %(conda_private)s - conda-env version : %(conda_env_version)s - conda-build version : %(conda_build_version)s - python version : %(python_version)s - requests version : %(requests_version)s - root environment : %(root_prefix)s (%(_rtwro)s) - default environment : %(default_prefix)s - envs directories : %(_envs_dirs)s - package cache : %(_pkgs_dirs)s - channel URLs : %(_channels)s - config file : %(rc_path)s - offline mode : %(offline)s - user-agent : %(user_agent)s\ -""" % info_dict) - - if not on_win: - print("""\ - UID:GID : %(UID)s:%(GID)s -""" % info_dict) - else: - print() - - if args.envs: - handle_envs_list(info_dict['envs'], not context.json) - - if args.system: - from conda.cli.find_commands import find_commands, find_executable - - site_dirs = get_user_site() + if system: evars = ['PATH', 'PYTHONPATH', 'PYTHONHOME', 'CONDA_DEFAULT_ENV', 'CIO_TEST', 'CONDA_ENVS_PATH'] @@ -298,20 +236,99 @@ def execute(args, parser): elif context.platform == 'osx': evars.append('DYLD_LIBRARY_PATH') + info_dict.update({ + 'sys.version': sys.version, + 'sys.prefix': sys.prefix, + 'sys.executable': sys.executable, + 'site_dirs': get_user_site(), + 'env_vars': {ev: os.getenv(ev, '<not set>') for ev in evars}, + }) + + return info_dict + + +def get_main_info_str(info_dict): + 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("""\ + Current conda install: + + platform : %(platform)s + conda version : %(conda_version)s + conda is private : %(conda_private)s + conda-env version : %(conda_env_version)s + conda-build version : %(conda_build_version)s + python version : %(python_version)s + requests version : %(requests_version)s + root environment : %(root_prefix)s (%(_rtwro)s) + default environment : %(default_prefix)s + envs directories : %(_envs_dirs)s + package cache : %(_pkgs_dirs)s + channel URLs : %(_channels)s + config file : %(rc_path)s + offline mode : %(offline)s + user-agent : %(user_agent)s\ + """ % info_dict) + + if not on_win: + builder.append("""\ + UID:GID : %(UID)s:%(GID)s + """ % info_dict) + else: + builder.append("") + + return '\n'.join(builder) + + +def execute(args, parser): + from ..base.context import context + + if args.root: if context.json: - info_dict['sys.version'] = sys.version - info_dict['sys.prefix'] = sys.prefix - info_dict['sys.executable'] = sys.executable - info_dict['site_dirs'] = get_user_site() - info_dict['env_vars'] = {ev: os.getenv(ev, '<not set>') for ev in evars} + stdout_json({'root_prefix': context.root_prefix}) + else: + print(context.root_prefix) + return + + if args.packages: + print_package_info(args.packages) + return + + if args.unsafe_channels: + if not context.json: + print("\n".join(context.channels)) else: + print(json.dumps({"channels": context.channels})) + return 0 + + options = 'envs', 'system', 'license' + + if args.all or context.json: + for option in options: + setattr(args, option, True) + + info_dict = get_info_dict(args.system) + + if (args.all or all(not getattr(args, opt) for opt in options)) and not context.json: + print(get_main_info_str(info_dict)) + + if args.envs: + handle_envs_list(info_dict['envs'], not context.json) + + if args.system: + if not context.json: + from .find_commands import find_commands, find_executable print("sys.version: %s..." % (sys.version[:40])) print("sys.prefix: %s" % sys.prefix) print("sys.executable: %s" % sys.executable) - print("conda location: %s" % dirname(conda.__file__)) + print("conda location: %s" % info_dict['conda_location']) for cmd in sorted(set(find_commands() + ['build'])): print("conda-%s: %s" % (cmd, find_executable('conda-' + cmd))) print("user site dirs: ", end='') + site_dirs = get_user_site() if site_dirs: print(site_dirs[0]) else: @@ -320,8 +337,8 @@ def execute(args, parser): print(' %s' % site_dir) print() - for ev in sorted(evars): - print("%s: %s" % (ev, os.getenv(ev, '<not set>'))) + for name, value in sorted(iteritems(info_dict['env_vars'])): + print("%s: %s" % (name, value)) print() if args.license and not context.json: 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 @@ -200,7 +200,7 @@ def execute(args, parser): regex = r'^%s$' % regex if args.revisions: - from conda.history import History + from ..history import History h = History(prefix) if isfile(h.path): if not context.json: 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 @@ -109,10 +109,11 @@ def configure_parser(sub_parsers, name='remove'): def execute(args, parser): - import conda.plan as plan - import conda.instructions as inst - from conda.gateways.disk.delete import rm_rf - from conda.core.linked_data import linked_data + from ..core.linked_data import linked_data + from ..gateways.disk.delete import rm_rf + from ..instructions import PREFIX + from ..plan import (add_unlink, display_actions, execute_actions, is_root_prefix, + nothing_to_do, remove_actions) if not (args.all or args.package_names): raise CondaValueError('no package names supplied,\n' @@ -137,22 +138,22 @@ def execute(args, parser): specs = None if args.features: specs = ['@' + f for f in set(args.package_names)] - actions = plan.remove_actions(prefix, specs, index, pinned=args.pinned) + actions = remove_actions(prefix, specs, index, pinned=args.pinned) action_groups = actions, elif args.all: - if plan.is_root_prefix(prefix): + if is_root_prefix(prefix): raise CondaEnvironmentError('cannot remove root environment,\n' ' add -n NAME or -p PREFIX option') - actions = {inst.PREFIX: prefix} + actions = {PREFIX: prefix} for dist in sorted(iterkeys(index)): - plan.add_unlink(actions, dist) + add_unlink(actions, dist) action_groups = actions, else: specs = specs_from_args(args.package_names) r = Resolve(index) prefix_spec_map = create_prefix_spec_map_with_deps(r, specs, prefix) - if (context.conda_in_root and plan.is_root_prefix(prefix) and names_in_specs( + if (context.conda_in_root and is_root_prefix(prefix) and names_in_specs( ROOT_NO_RM, specs) and not args.force): raise CondaEnvironmentError('cannot remove %s from root environment' % ', '.join(ROOT_NO_RM)) @@ -160,12 +161,12 @@ def execute(args, parser): for prfx, spcs in iteritems(prefix_spec_map): index = linked_data(prfx) index = {dist: info for dist, info in iteritems(index)} - actions.append(plan.remove_actions(prfx, list(spcs), index=index, force=args.force, - pinned=args.pinned)) + actions.append(remove_actions(prfx, list(spcs), index=index, force=args.force, + pinned=args.pinned)) action_groups = tuple(actions) delete_trash() - if any(plan.nothing_to_do(actions) for actions in action_groups): + if any(nothing_to_do(actions) for actions in action_groups): if args.all: print("\nRemove all packages in environment %s:\n" % prefix, file=sys.stderr) if not context.json: @@ -184,7 +185,7 @@ def execute(args, parser): if not context.json: print() print("Package plan for package removal in environment %s:" % action["PREFIX"]) - plan.display_actions(action, index) + display_actions(action, index) if context.json and args.dry_run: stdout_json({ @@ -200,9 +201,9 @@ def execute(args, parser): for actions in action_groups: if context.json and not context.quiet: with json_progress_bars(): - plan.execute_actions(actions, index, verbose=not context.quiet) + execute_actions(actions, index, verbose=not context.quiet) else: - plan.execute_actions(actions, index, verbose=not context.quiet) + execute_actions(actions, index, verbose=not context.quiet) if specs: try: with open(join(prefix, 'conda-meta', 'history'), 'a') as f: diff --git a/conda/cli/main_search.py b/conda/cli/main_search.py --- a/conda/cli/main_search.py +++ b/conda/cli/main_search.py @@ -128,7 +128,7 @@ def execute(args, parser): def execute_search(args, parser): import re - from conda.resolve import Resolve + from ..resolve import Resolve if args.reverse_dependency: if not args.regex: diff --git a/conda/config.py b/conda/config.py --- a/conda/config.py +++ b/conda/config.py @@ -9,7 +9,7 @@ import sys from os.path import abspath, expanduser, isfile, join -from conda.base.context import context, non_x86_linux_machines +from .base.context import context, non_x86_linux_machines non_x86_linux_machines = non_x86_linux_machines @@ -77,7 +77,7 @@ def get_local_urls(): - from conda.models.channel import get_conda_build_local_url + from .models.channel import get_conda_build_local_url return get_conda_build_local_url() or [] diff --git a/conda/connection.py b/conda/connection.py --- a/conda/connection.py +++ b/conda/connection.py @@ -142,7 +142,7 @@ def add_binstar_token(url): for binstar_url, token in iteritems(read_binstar_tokens()): if clean_url.startswith(binstar_url): log.debug("Adding anaconda token for url <%s>", clean_url) - from conda.models.channel import Channel + from .models.channel import Channel channel = Channel(clean_url) channel.token = token return channel.url(with_credentials=True) diff --git a/conda/exceptions.py b/conda/exceptions.py --- a/conda/exceptions.py +++ b/conda/exceptions.py @@ -547,7 +547,7 @@ def __init__(self, invalid_spec): def print_conda_exception(exception): - from conda.base.context import context + from .base.context import context stdoutlogger = getLogger('stdout') stderrlogger = getLogger('stderr') @@ -559,22 +559,6 @@ def print_conda_exception(exception): stderrlogger.info("\n\n%r", exception) -def get_info(): - from conda.cli import conda_argparse - from conda.cli.main_info import configure_parser - from shlex import split - from conda.common.io import captured - - p = conda_argparse.ArgumentParser() - sub_parsers = p.add_subparsers(metavar='command', dest='cmd') - configure_parser(sub_parsers) - - args = p.parse_args(split("info")) - with captured() as c: - args.func(args, p) - return c.stdout, c.stderr - - def print_unexpected_error_message(e): # bomb = "\U0001F4A3 " # explosion = "\U0001F4A5 " @@ -584,9 +568,9 @@ def print_unexpected_error_message(e): stderrlogger = getLogger('stderr') - from conda.base.context import context + from .base.context import context if context.json: - from conda.cli.common import stdout_json + from .cli.common import stdout_json stdout_json(dict(error=traceback)) else: message = """\ @@ -600,9 +584,8 @@ def print_unexpected_error_message(e): stderrlogger.info(message) command = ' '.join(sys.argv) if ' info' not in command: - # get and print `conda info` - info_stdout, info_stderr = get_info() - stderrlogger.info(info_stdout if info_stdout else info_stderr) + from .cli.main_info import get_info_dict, get_main_info_str + stderrlogger.info(get_main_info_str(get_info_dict())) stderrlogger.info("`$ {0}`".format(command)) stderrlogger.info('\n') stderrlogger.info('\n'.join(' ' + line for line in traceback.splitlines())) @@ -633,7 +616,7 @@ def handle_exception(e): if isinstance(e, CondaExitZero): return 0 elif isinstance(e, CondaError): - from conda.base.context import context + from .base.context import context if context.debug or context.verbosity > 0: print_unexpected_error_message(e) else: diff --git a/conda/exports.py b/conda/exports.py --- a/conda/exports.py +++ b/conda/exports.py @@ -79,7 +79,7 @@ import conda.base.context # NOQA -from conda.base.context import get_prefix as context_get_prefix, non_x86_linux_machines # NOQA +from .base.context import get_prefix as context_get_prefix, non_x86_linux_machines # NOQA non_x86_linux_machines = non_x86_linux_machines from ._vendor.auxlib.entity import EntityEncoder # NOQA diff --git a/conda/gateways/adapters/ftp.py b/conda/gateways/adapters/ftp.py --- a/conda/gateways/adapters/ftp.py +++ b/conda/gateways/adapters/ftp.py @@ -17,21 +17,21 @@ # limitations under the License. from __future__ import absolute_import, division, print_function, unicode_literals +from base64 import b64decode import cgi import ftplib -import os -from base64 import b64decode from io import BytesIO -from conda.gateways.logging import getLogger +import os + from requests import Response from requests.adapters import BaseAdapter from requests.hooks import dispatch_hook +from ..logging import getLogger from ...common.compat import StringIO from ...common.url import urlparse from ...exceptions import AuthenticationError - log = getLogger(__name__) diff --git a/conda/gateways/adapters/localfs.py b/conda/gateways/adapters/localfs.py --- a/conda/gateways/adapters/localfs.py +++ b/conda/gateways/adapters/localfs.py @@ -12,7 +12,7 @@ from tempfile import SpooledTemporaryFile from ...common.compat import ensure_binary -from conda.common.path import url_to_path +from ...common.path import url_to_path log = getLogger(__name__) diff --git a/conda/gateways/download.py b/conda/gateways/download.py --- a/conda/gateways/download.py +++ b/conda/gateways/download.py @@ -2,16 +2,16 @@ from __future__ import absolute_import, division, print_function, unicode_literals import hashlib -from logging import getLogger, DEBUG -from os.path import exists, basename +from logging import DEBUG, getLogger +from os.path import basename, exists from threading import Lock import warnings -from conda._vendor.auxlib.logz import stringify from requests.exceptions import ConnectionError, HTTPError, SSLError from .. import CondaError from .._vendor.auxlib.ish import dals +from .._vendor.auxlib.logz import stringify from ..base.context import context from ..connection import CondaSession from ..exceptions import BasicClobberError, CondaHTTPError, MD5MismatchError, maybe_raise diff --git a/conda/install.py b/conda/install.py --- a/conda/install.py +++ b/conda/install.py @@ -60,7 +60,7 @@ def win_conda_bat_redirect(src, dst, shell): Works of course only with callable files, e.g. `.bat` or `.exe` files. """ - from conda.utils import shells + from .utils import shells try: makedirs(dirname(dst)) except OSError as exc: # Python >2.5
Unexpected Error related to urllib3 Using Anaconda2-4.3.1-Linux-x86_64 in Linux 14.04.5 with Python 2.7. Anytime I use any conda command I get the following error: ```` >>$ conda -h An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions ```` I have already tried to install/upgrade urllib3, requests, and boxsdk with pip, but to no avail. Anyone know how to fix this?
I download Anaconda(python 2.7 & ubuntu 64 bit ) and has the same problem. I use Anaconda2-4.1.1-Linux-x86_64 in ubuntu 14.04 64 bit , and this problem not occurs
2017-04-21T04:16:02Z
[]
[]
Traceback (most recent call last): File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module> sys.exit(conda.cli.main()) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main return conda_exception_handler(_main, *args) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler print_unexpected_error_message(e) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message info_stdout, info_stderr = get_info() File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info args.func(args, p) File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute from conda.api import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module> from .core.index import get_index File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module> from .repodata import collect_all_repodata File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module> from requests.packages.urllib3.exceptions import InsecureRequestWarning ImportError: No module named packages.urllib3.exceptions
4,075
conda/conda
conda__conda-5232
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:42Z
[]
[]
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'
4,106
conda/conda
conda__conda-5357
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:00Z
[]
[]
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
4,136
conda/conda
conda__conda-6442
5c0cf2afb1c2d0b1dddd7e396cf13f4bfaecf4d6
diff --git a/conda/models/match_spec.py b/conda/models/match_spec.py --- a/conda/models/match_spec.py +++ b/conda/models/match_spec.py @@ -349,10 +349,8 @@ def _make(field_name, value): matcher = value elif field_name in _implementors: matcher = _implementors[field_name](value) - elif text_type(value): - matcher = StrMatch(value) else: - raise NotImplementedError() + matcher = StrMatch(text_type(value)) return field_name, matcher
conda 4.4.0rc2 NotImplementedError on 'conda list' "command": "/home/rob/miniconda3/bin/conda list" ``` Traceback (most recent call last): File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/exceptions.py\", line 683, in __call__ return func(*args, **kwargs) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main_list.py\", line 150, in execute show_channel_urls=context.show_channel_urls) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main_list.py\", line 90, in print_packages show_channel_urls=show_channel_urls) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main_list.py\", line 52, in list_packages info = is_linked(prefix, dist) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/core/linked_data.py\", line 166, in is_linked elif MatchSpec(dist).match(prefix_record): File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 67, in __call__ return super(MatchSpecType, cls).__call__(**parsed) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 178, in __init__ self._match_components = self._build_components(**kwargs) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 359, in _build_components return frozendict(_make(key, value) for key, value in iteritems(kwargs)) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 359, in <genexpr> return frozendict(_make(key, value) for key, value in iteritems(kwargs)) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 355, in _make raise NotImplementedError() NotImplementedError ```
2017-12-12T18:06:40Z
[]
[]
Traceback (most recent call last): File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/exceptions.py\", line 683, in __call__ return func(*args, **kwargs) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main_list.py\", line 150, in execute show_channel_urls=context.show_channel_urls) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main_list.py\", line 90, in print_packages show_channel_urls=show_channel_urls) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/cli/main_list.py\", line 52, in list_packages info = is_linked(prefix, dist) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/core/linked_data.py\", line 166, in is_linked elif MatchSpec(dist).match(prefix_record): File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 67, in __call__ return super(MatchSpecType, cls).__call__(**parsed) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 178, in __init__ self._match_components = self._build_components(**kwargs) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 359, in _build_components return frozendict(_make(key, value) for key, value in iteritems(kwargs)) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 359, in <genexpr> return frozendict(_make(key, value) for key, value in iteritems(kwargs)) File \"/home/rob/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py\", line 355, in _make raise NotImplementedError() NotImplementedError
4,218
conda/conda
conda__conda-6511
eba59e3d6ba486b6e9a39864b1daacbc7f99f719
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -982,7 +982,7 @@ def _first_writable_envs_dir(): return envs_dir from ..exceptions import NotWritableError - raise NotWritableError(context.envs_dirs[0]) + raise NotWritableError(context.envs_dirs[0], None) # backward compatibility for conda-build diff --git a/conda/exceptions.py b/conda/exceptions.py --- a/conda/exceptions.py +++ b/conda/exceptions.py @@ -591,12 +591,13 @@ def __init__(self, message): super(SafetyError, self).__init__(message) -class NotWritableError(CondaError): +class NotWritableError(CondaError, OSError): - def __init__(self, path): - kwargs = { + def __init__(self, path, errno, **kwargs): + kwargs.update({ 'path': path, - } + 'errno': errno, + }) if on_win: message = dals(""" The current user does not have write permissions to a required path. 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 @@ -12,6 +12,7 @@ from .link import lexists from ...common.compat import on_win from ...common.path import expand +from ...exceptions import NotWritableError log = getLogger(__name__) @@ -62,29 +63,32 @@ def touch(path, mkdir=False, sudo_safe=False): # True if the file did not exist but was created # False if the file already existed # raises: permissions errors such as EPERM and EACCES - path = expand(path) - log.trace("touching path %s", path) - if lexists(path): - utime(path, None) - return True - else: - dirpath = dirname(path) - if not isdir(dirpath) and mkdir: - if sudo_safe: - mkdir_p_sudo_safe(dirpath) - else: - mkdir_p(dirpath) - else: - assert isdir(dirname(path)) - try: - fh = open(path, 'a') - except: - raise + try: + path = expand(path) + log.trace("touching path %s", path) + if lexists(path): + utime(path, None) + return True else: - fh.close() - if sudo_safe and not on_win and os.environ.get('SUDO_UID') is not None: - uid = int(os.environ['SUDO_UID']) - gid = int(os.environ.get('SUDO_GID', -1)) - log.trace("chowning %s:%s %s", uid, gid, path) - os.chown(path, uid, gid) - return False + dirpath = dirname(path) + if not isdir(dirpath) and mkdir: + if sudo_safe: + mkdir_p_sudo_safe(dirpath) + else: + mkdir_p(dirpath) + else: + assert isdir(dirname(path)) + try: + fh = open(path, 'a') + except: + raise + else: + fh.close() + if sudo_safe and not on_win and os.environ.get('SUDO_UID') is not None: + uid = int(os.environ['SUDO_UID']) + gid = int(os.environ.get('SUDO_GID', -1)) + log.trace("chowning %s:%s %s", uid, gid, path) + os.chown(path, uid, gid) + return False + except (IOError, OSError) as e: + raise NotWritableError(path, e.errno, caused_by=e)
PermissionError writing to environments.txt "command": "conda install jupyter_core --yes" ``` Traceback (most recent call last): File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/exceptions.py\", line 721, in __call__ return func(*args, **kwargs) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/main_install.py\", line 11, in execute install(args, parser, 'install') File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/install.py\", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/install.py\", line 269, in handle_txn unlink_link_transaction.execute() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 220, in execute self.verify() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/common/io.py\", line 402, in decorated return f(*args, **kwds) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 207, in verify exceptions = self._verify(self.prefix_setups, self.prefix_action_groups) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 460, in _verify cls._verify_transaction_level(prefix_setups), File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 455, in <genexpr> exceptions = tuple(exc for exc in concatv( File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 323, in _verify_individual_level error_result = axn.verify() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/path_actions.py\", line 870, in verify touch(USER_ENVIRONMENTS_TXT_FILE, mkdir=True, sudo_safe=True) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/gateways/disk/update.py\", line 89, in touch os.chown(path, uid, gid) PermissionError: [Errno 1] Operation not permitted: '/home/nbcommon/.conda/environments.txt' ```
2017-12-21T20:40:03Z
[]
[]
Traceback (most recent call last): File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/exceptions.py\", line 721, in __call__ return func(*args, **kwargs) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/main_install.py\", line 11, in execute install(args, parser, 'install') File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/install.py\", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/install.py\", line 269, in handle_txn unlink_link_transaction.execute() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 220, in execute self.verify() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/common/io.py\", line 402, in decorated return f(*args, **kwds) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 207, in verify exceptions = self._verify(self.prefix_setups, self.prefix_action_groups) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 460, in _verify cls._verify_transaction_level(prefix_setups), File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 455, in <genexpr> exceptions = tuple(exc for exc in concatv( File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 323, in _verify_individual_level error_result = axn.verify() File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/path_actions.py\", line 870, in verify touch(USER_ENVIRONMENTS_TXT_FILE, mkdir=True, sudo_safe=True) File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/gateways/disk/update.py\", line 89, in touch os.chown(path, uid, gid) PermissionError: [Errno 1] Operation not permitted: '/home/nbcommon/.conda/environments.txt'
4,228
conda/conda
conda__conda-6525
09912b87b21b0a66d638e65561ed126677846a91
diff --git a/conda/core/solve.py b/conda/core/solve.py --- a/conda/core/solve.py +++ b/conda/core/solve.py @@ -241,7 +241,7 @@ def solve_final_state(self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, the output of 'conda info' and 'conda list' for the active environment, along with the command you invoked that resulted in this error. matches_for_spec: %s - """) % matches_for_spec) + """) % dashlist((text_type(s) for s in matches_for_spec), indent=4)) target_dist = matches_for_spec[0] if deps_modifier == DepsModifier.FREEZE_INSTALLED: new_spec = MatchSpec(index[target_dist])
TypeError: not all arguments converted during string formatting "command": "C:\\Users\\court\\Anaconda3\\Scripts\\conda install matplotlib" "user_agent": "conda/4.4.1 requests/2.18.4 CPython/3.6.3 Windows/10 Windows/10.0.16299" ``` Traceback (most recent call last): File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\exceptions.py\", line 721, in __call__ return func(*args, **kwargs) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\cli\\main.py\", line 78, in _main exit_code = do_call(args, p) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\cli\\conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\cli\\main_install.py\", line 11, in execute install(args, parser, 'install') File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\cli\\install.py\", line 220, in install force_reinstall=context.force, File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\core\\solve.py\", line 503, in solve_for_transaction force_remove, force_reinstall) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\core\\solve.py\", line 436, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\core\\solve.py\", line 244, in solve_final_state \"\"\") % matches_for_spec) TypeError: not all arguments converted during string formatting ```
2017-12-22T03:34:59Z
[]
[]
Traceback (most recent call last): File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\exceptions.py\", line 721, in __call__ return func(*args, **kwargs) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\cli\\main.py\", line 78, in _main exit_code = do_call(args, p) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\cli\\conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\cli\\main_install.py\", line 11, in execute install(args, parser, 'install') File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\cli\\install.py\", line 220, in install force_reinstall=context.force, File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\core\\solve.py\", line 503, in solve_for_transaction force_remove, force_reinstall) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\core\\solve.py\", line 436, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File \"C:\\Users\\court\\Anaconda3\\lib\\site-packages\\conda\\core\\solve.py\", line 244, in solve_final_state \"\"\") % matches_for_spec) TypeError: not all arguments converted during string formatting
4,232
conda/conda
conda__conda-6540
6c5d2bab095f9a2a4f846515800dbcf38f2fac39
diff --git a/conda/common/io.py b/conda/common/io.py --- a/conda/common/io.py +++ b/conda/common/io.py @@ -5,6 +5,7 @@ from concurrent.futures import ThreadPoolExecutor from contextlib import contextmanager from enum import Enum +from errno import EPIPE, ESHUTDOWN from functools import wraps from itertools import cycle import json @@ -326,11 +327,17 @@ def spinner(message=None, enabled=True, json=False): if json: pass else: - if exception_raised: - sys.stdout.write("failed\n") - else: - sys.stdout.write("done\n") - sys.stdout.flush() + try: + if exception_raised: + sys.stdout.write("failed\n") + else: + sys.stdout.write("done\n") + sys.stdout.flush() + except (IOError, OSError) as e: + # Ignore BrokenPipeError and errors related to stdout or stderr being + # closed by a downstream program. + if e.errno not in (EPIPE, ESHUTDOWN): + raise class ProgressBar(object): @@ -368,12 +375,18 @@ def finish(self): self.update_to(1) def close(self): - if self.json: - sys.stdout.write('{"fetch":"%s","finished":true,"maxval":1,"progress":1}\n\0' - % self.description) - sys.stdout.flush() - elif self.enabled: - self.pbar.close() + try: + if self.json: + sys.stdout.write('{"fetch":"%s","finished":true,"maxval":1,"progress":1}\n\0' + % self.description) + sys.stdout.flush() + elif self.enabled: + self.pbar.close() + except (IOError, OSError) as e: + # Ignore BrokenPipeError and errors related to stdout or stderr being + # closed by a downstream program. + if e.errno not in (EPIPE, ESHUTDOWN): + raise self.enabled = False
BrokenPipeError "command": "conda create -p ./untitled -y python=3.6" "user_agent": "conda/4.4.2 requests/2.18.4 CPython/3.6.3 Linux/4.10.0-28-generic ubuntu/16.04 glibc/2.23" ``` Traceback (most recent call last): File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/exceptions.py\", line 722, in __call__ return func(*args, **kwargs) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/main_create.py\", line 11, in execute install(args, parser, 'create') File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/install.py\", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/install.py\", line 265, in handle_txn progressive_fetch_extract.execute() File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py\", line 543, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py\", line 595, in _execute_actions progress_bar.close() File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/common/io.py\", line 376, in close self.pbar.close() File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py\", line 1054, in close self.bar_format, self.postfix, self.unit_divisor)) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py\", line 201, in print_status fp_write('\\r' + s + (' ' * max(last_len[0] - len_s, 0))) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py\", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe ```
2017-12-22T18:08:33Z
[]
[]
Traceback (most recent call last): File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/exceptions.py\", line 722, in __call__ return func(*args, **kwargs) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/main_create.py\", line 11, in execute install(args, parser, 'create') File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/install.py\", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/cli/install.py\", line 265, in handle_txn progressive_fetch_extract.execute() File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py\", line 543, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py\", line 595, in _execute_actions progress_bar.close() File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/common/io.py\", line 376, in close self.pbar.close() File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py\", line 1054, in close self.bar_format, self.postfix, self.unit_divisor)) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py\", line 201, in print_status fp_write('\\r' + s + (' ' * max(last_len[0] - len_s, 0))) File \"/home/jon/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py\", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
4,236
conda/conda
conda__conda-6542
84d8f425252dafadcaeed5a834300e058456881f
diff --git a/conda/core/envs_manager.py b/conda/core/envs_manager.py --- a/conda/core/envs_manager.py +++ b/conda/core/envs_manager.py @@ -7,7 +7,7 @@ from ..base.constants import ROOT_ENV_NAME from ..base.context import context -from ..common.compat import on_win +from ..common.compat import ensure_text_type, on_win, open from ..common.path import expand, paths_equal from ..gateways.disk.read import yield_lines from ..gateways.disk.test import is_conda_environment @@ -30,7 +30,7 @@ def register_env(location): return with open(USER_ENVIRONMENTS_TXT_FILE, 'a') as fh: - fh.write(location) + fh.write(ensure_text_type(location)) fh.write('\n') diff --git a/conda/gateways/disk/read.py b/conda/gateways/disk/read.py --- a/conda/gateways/disk/read.py +++ b/conda/gateways/disk/read.py @@ -19,7 +19,7 @@ from ..._vendor.auxlib.collection import first from ..._vendor.auxlib.ish import dals from ...base.constants import PREFIX_PLACEHOLDER -from ...common.compat import ensure_text_type +from ...common.compat import ensure_text_type, open from ...exceptions import CondaUpgradeError, CondaVerificationError, PathNotFoundError from ...models.channel import Channel from ...models.enums import FileMode, PathType
python 2 can't read unicode in environments.txt on a conda install operation, during the transaction ``` Traceback (most recent call last): File "/Users/kfranz/continuum/conda/conda/core/link.py", line 535, in _execute_actions action.execute() File "/Users/kfranz/continuum/conda/conda/core/path_actions.py", line 876, in execute register_env(self.target_prefix) File "/Users/kfranz/continuum/conda/conda/core/envs_manager.py", line 28, in register_env if location in yield_lines(USER_ENVIRONMENTS_TXT_FILE): File "/Users/kfranz/continuum/conda/conda/gateways/disk/read.py", line 49, in yield_lines if not line or line.startswith('#'): UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 54: ordinal not in range(128) ```
Part of my `~/.conda/environments.txt` file that's causing python 2 to choke: ``` /usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/envs/shapely=1.6.0 /var/folders/cp/7r2s_s593j7_cpdtxxsmct880000gp/T/26b3 çêôñáß /var/folders/cp/7r2s_s593j7_cpdtxxsmct880000gp/T/8eba áçêßôñ /Users/kfranz/miniconda/envs/py2 /conda3 /Users/kfranz/miniconda/envs/_test2 ```
2017-12-22T18:45:25Z
[]
[]
Traceback (most recent call last): File "/Users/kfranz/continuum/conda/conda/core/link.py", line 535, in _execute_actions action.execute() File "/Users/kfranz/continuum/conda/conda/core/path_actions.py", line 876, in execute register_env(self.target_prefix) File "/Users/kfranz/continuum/conda/conda/core/envs_manager.py", line 28, in register_env if location in yield_lines(USER_ENVIRONMENTS_TXT_FILE): File "/Users/kfranz/continuum/conda/conda/gateways/disk/read.py", line 49, in yield_lines if not line or line.startswith('#'): UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 54: ordinal not in range(128)
4,237
conda/conda
conda__conda-6558
2060458e0c546a3c70fa041e738cb73b41c4b0d3
diff --git a/conda/egg_info.py b/conda/egg_info.py --- a/conda/egg_info.py +++ b/conda/egg_info.py @@ -29,7 +29,7 @@ def get_site_packages_dir(installed_pkgs): def get_egg_info_files(sp_dir): - for fn in os.listdir(sp_dir): + for fn in (isdir(sp_dir) and os.listdir(sp_dir) or ()): if fn.endswith('.egg-link'): with open(join(sp_dir, fn), 'r') as reader: for egg in get_egg_info_files(reader.readline().strip()):
conda list FileNotFoundError ``` "command": "/Users/hideki/anaconda/bin/conda list" "user_agent": "conda/4.4.3 requests/2.14.2 CPython/3.5.2 Darwin/16.7.0 OSX/10.12.6" Traceback (most recent call last): File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/exceptions.py\", line 722, in __call__ return func(*args, **kwargs) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/cli/main_list.py\", line 150, in execute show_channel_urls=context.show_channel_urls) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/cli/main_list.py\", line 85, in print_packages other_python = get_egg_info(prefix) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/egg_info.py\", line 86, in get_egg_info for path in get_egg_info_files(join(prefix, sp_dir)): File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/egg_info.py\", line 35, in get_egg_info_files for egg in get_egg_info_files(reader.readline().strip()): File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/egg_info.py\", line 32, in get_egg_info_files for fn in os.listdir(sp_dir): FileNotFoundError: [Errno 2] No such file or directory: '/Users/hideki/darkflow' ```
2017-12-23T07:04:44Z
[]
[]
Traceback (most recent call last): File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/exceptions.py\", line 722, in __call__ return func(*args, **kwargs) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/cli/main_list.py\", line 150, in execute show_channel_urls=context.show_channel_urls) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/cli/main_list.py\", line 85, in print_packages other_python = get_egg_info(prefix) File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/egg_info.py\", line 86, in get_egg_info for path in get_egg_info_files(join(prefix, sp_dir)): File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/egg_info.py\", line 35, in get_egg_info_files for egg in get_egg_info_files(reader.readline().strip()): File \"/Users/hideki/anaconda/lib/python3.5/site-packages/conda/egg_info.py\", line 32, in get_egg_info_files for fn in os.listdir(sp_dir): FileNotFoundError: [Errno 2] No such file or directory: '/Users/hideki/darkflow'
4,240
conda/conda
conda__conda-6573
fbf3c0dac0667293d8926031119fb0798344d848
diff --git a/conda/core/repodata.py b/conda/core/repodata.py --- a/conda/core/repodata.py +++ b/conda/core/repodata.py @@ -4,7 +4,7 @@ import bz2 from collections import defaultdict from contextlib import closing -from errno import ENODEV +from errno import EACCES, ENODEV, EPERM from genericpath import getmtime, isfile import hashlib import json @@ -26,7 +26,7 @@ with_metaclass) from ..common.url import join_url, maybe_unquote from ..core.package_cache import PackageCache -from ..exceptions import CondaDependencyError, CondaHTTPError, CondaIndexError +from ..exceptions import CondaDependencyError, CondaHTTPError, CondaIndexError, NotWritableError from ..gateways.connection import (ConnectionError, HTTPError, InsecureRequestWarning, InvalidSchema, SSLError) from ..gateways.connection.session import CondaSession @@ -219,8 +219,14 @@ def _load(self): else: if not isdir(dirname(self.cache_path_json)): mkdir_p(dirname(self.cache_path_json)) - with open(self.cache_path_json, 'w') as fh: - fh.write(raw_repodata_str or '{}') + try: + with open(self.cache_path_json, 'w') as fh: + fh.write(raw_repodata_str or '{}') + except (IOError, OSError) as e: + if e.errno in (EACCES, EPERM): + raise NotWritableError(self.cache_path_json, e.errno, caused_by=e) + else: + raise _internal_state = self._process_raw_repodata_str(raw_repodata_str) self._internal_state = _internal_state self._pickle_me()
cached repodata.json PermissionsError ``` error: PermissionError(13, 'Permission denied') command: /Users/apple/.conda/envs/cafe/bin/conda uninstall protobuf user_agent: conda/4.4.3 requests/2.18.4 CPython/3.6.1 Darwin/16.1.0 OSX/10.12.1 _messageid: -9223372036845375609 _messagetime: 1514148478933 / 2017-12-24 14:47:58 _receipttime: 1514148478933 / 2017-12-24 14:47:58 Traceback (most recent call last): File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/exceptions.py", line 722, in __call__ return func(*args, **kwargs) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/cli/main_remove.py", line 82, in execute txn = solver.solve_for_transaction(force_remove=args.force) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 501, in solve_for_transaction force_remove, force_reinstall) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 434, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 178, in solve_final_state index, r = self._prepare(prepared_specs) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 557, in _prepare self.subdirs, prepared_specs) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 214, in get_reduced_index new_records = query_all(spec) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in query_all return tuple(concat(future.result() for future in as_completed(futures))) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 99, in query self.load() File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 143, in load _internal_state = self._load() File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 222, in _load with open(self.cache_path_json, 'w') as fh: PermissionError: [Errno 13] Permission denied: '/Users/apple/miniconda3/pkgs/cache/809318c1.json' ```
2017-12-24T23:17:48Z
[]
[]
Traceback (most recent call last): File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/exceptions.py", line 722, in __call__ return func(*args, **kwargs) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/cli/main_remove.py", line 82, in execute txn = solver.solve_for_transaction(force_remove=args.force) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 501, in solve_for_transaction force_remove, force_reinstall) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 434, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 178, in solve_final_state index, r = self._prepare(prepared_specs) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 557, in _prepare self.subdirs, prepared_specs) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 214, in get_reduced_index new_records = query_all(spec) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in query_all return tuple(concat(future.result() for future in as_completed(futures))) File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 99, in query self.load() File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 143, in load _internal_state = self._load() File "/Users/apple/miniconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 222, in _load with open(self.cache_path_json, 'w') as fh: PermissionError: [Errno 13] Permission denied: '/Users/apple/miniconda3/pkgs/cache/809318c1.json'
4,246
conda/conda
conda__conda-6589
fbf3c0dac0667293d8926031119fb0798344d848
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals +from errno import ENOENT from logging import getLogger import os from os.path import (abspath, basename, dirname, expanduser, isdir, isfile, join, normpath, @@ -30,6 +31,16 @@ except ImportError: # pragma: no cover from .._vendor.toolz.itertoolz import concat, concatv, unique +try: + os.getcwd() +except (IOError, OSError) as e: + if e.errno == ENOENT: + # FileNotFoundError can occur when cwd has been deleted out from underneath the process. + # To resolve #6584, let's go with setting cwd to sys.prefix, and see how far we get. + os.chdir(sys.prefix) + else: + raise + log = getLogger(__name__) _platform_map = {
os.getcwd() FileNotFoundError ``` error: FileNotFoundError(2, 'No such file or directory') command: /root/anaconda3/bin/conda shell.posix deactivate user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.13.0-kali1-amd64 kali/2017.3 glibc/2.25 _messageid: -9223372036844975611 _messagetime: 1514233339489 / 2017-12-25 14:22:19 Traceback (most recent call last): File "/root/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 110, in main from ..activate import main as activator_main File "/root/anaconda3/lib/python3.6/site-packages/conda/activate.py", line 12, in <module> context.__init__() # oOn import, context does not include SEARCH_PATH. This line fixes that. File "/root/anaconda3/lib/python3.6/site-packages/conda/base/context.py", line 214, in __init__ argparse_args=argparse_args) File "/root/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 723, in __init__ self._set_search_path(search_path) File "/root/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 729, in _set_search_path self._set_raw_data(load_file_configs(search_path)) File "/root/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 366, in load_file_configs expanded_paths = tuple(expand(path) for path in search_path) File "/root/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 366, in <genexpr> expanded_paths = tuple(expand(path) for path in search_path) File "/root/anaconda3/lib/python3.6/site-packages/conda/common/path.py", line 49, in expand return abspath(expanduser(expandvars(path))) File "/root/anaconda3/lib/python3.6/posixpath.py", line 374, in abspath cwd = os.getcwd() FileNotFoundError: [Errno 2] No such file or directory ```
``` error: FileNotFoundError(2, 'No such file or directory') command: /Users/limxing/anaconda3/bin/conda install iris user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.4 Darwin/17.3.0 OSX/10.13.2 _messageid: -9223372036844475580 _messagetime: 1514289512434 / 2017-12-26 05:58:32 Traceback (most recent call last): File "/Users/limxing/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/Users/limxing/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 74, in _main context.__init__(argparse_args=args) File "/Users/limxing/anaconda3/lib/python3.6/site-packages/conda/base/context.py", line 214, in __init__ argparse_args=argparse_args) File "/Users/limxing/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 723, in __init__ self._set_search_path(search_path) File "/Users/limxing/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 729, in _set_search_path self._set_raw_data(load_file_configs(search_path)) File "/Users/limxing/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 366, in load_file_configs expanded_paths = tuple(expand(path) for path in search_path) File "/Users/limxing/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 366, in <genexpr> expanded_paths = tuple(expand(path) for path in search_path) File "/Users/limxing/anaconda3/lib/python3.6/site-packages/conda/common/path.py", line 49, in expand return abspath(expanduser(expandvars(path))) File "/Users/limxing/anaconda3/lib/python3.6/posixpath.py", line 374, in abspath cwd = os.getcwd() FileNotFoundError: [Errno 2] No such file or directory ``` ``` error: FileNotFoundError(2, 'No such file or directory') command: /home/anti/miniconda3/bin/conda update --all user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.4 Linux/3.10.0-693.11.1.el7.x86_64 centos/7 glibc/2.17 _messageid: -9223372036844375596 _messagetime: 1514305043219 / 2017-12-26 10:17:23 Traceback (most recent call last): File "/home/anti/miniconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/anti/miniconda3/lib/python3.6/site-packages/conda/cli/main.py", line 74, in _main context.__init__(argparse_args=args) File "/home/anti/miniconda3/lib/python3.6/site-packages/conda/base/context.py", line 214, in __init__ argparse_args=argparse_args) File "/home/anti/miniconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 723, in __init__ self._set_search_path(search_path) File "/home/anti/miniconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 729, in _set_search_path self._set_raw_data(load_file_configs(search_path)) File "/home/anti/miniconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 366, in load_file_configs expanded_paths = tuple(expand(path) for path in search_path) File "/home/anti/miniconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 366, in <genexpr> expanded_paths = tuple(expand(path) for path in search_path) File "/home/anti/miniconda3/lib/python3.6/site-packages/conda/common/path.py", line 49, in expand return abspath(expanduser(expandvars(path))) File "/home/anti/miniconda3/lib/python3.6/posixpath.py", line 374, in abspath cwd = os.getcwd() FileNotFoundError: [Errno 2] No such file or directory ``` https://stackoverflow.com/questions/23889636/error-while-executing-os-getcwd
2017-12-27T20:26:53Z
[]
[]
Traceback (most recent call last): File "/root/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 110, in main from ..activate import main as activator_main File "/root/anaconda3/lib/python3.6/site-packages/conda/activate.py", line 12, in <module> context.__init__() # oOn import, context does not include SEARCH_PATH. This line fixes that. File "/root/anaconda3/lib/python3.6/site-packages/conda/base/context.py", line 214, in __init__ argparse_args=argparse_args) File "/root/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 723, in __init__ self._set_search_path(search_path) File "/root/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 729, in _set_search_path self._set_raw_data(load_file_configs(search_path)) File "/root/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 366, in load_file_configs expanded_paths = tuple(expand(path) for path in search_path) File "/root/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 366, in <genexpr> expanded_paths = tuple(expand(path) for path in search_path) File "/root/anaconda3/lib/python3.6/site-packages/conda/common/path.py", line 49, in expand return abspath(expanduser(expandvars(path))) File "/root/anaconda3/lib/python3.6/posixpath.py", line 374, in abspath cwd = os.getcwd() FileNotFoundError: [Errno 2] No such file or directory
4,249
conda/conda
conda__conda-6616
f9f6c2195ae457c899883c49846d9292d3776ce8
diff --git a/conda/cli/common.py b/conda/cli/common.py --- a/conda/cli/common.py +++ b/conda/cli/common.py @@ -7,6 +7,7 @@ from .._vendor.auxlib.ish import dals from ..base.constants import ROOT_ENV_NAME from ..base.context import context +from ..common.io import swallow_broken_pipe from ..common.path import paths_equal from ..models.match_spec import MatchSpec @@ -155,6 +156,7 @@ def disp_features(features): return '' +@swallow_broken_pipe def stdout_json(d): import json from .._vendor.auxlib.entity import EntityEncoder diff --git a/conda/cli/main_search.py b/conda/cli/main_search.py --- a/conda/cli/main_search.py +++ b/conda/cli/main_search.py @@ -2,12 +2,11 @@ from __future__ import absolute_import, division, print_function, unicode_literals from collections import defaultdict -import sys from .install import calculate_channel_urls from ..base.context import context from ..cli.common import stdout_json -from ..common.io import spinner +from ..common.io import Spinner from ..compat import text_type from ..core.repodata import SubdirData from ..models.match_spec import MatchSpec @@ -25,7 +24,7 @@ def execute(args, parser): else: subdirs = context.subdirs - with spinner("Loading channels", not context.verbosity and not context.quiet, context.json): + with Spinner("Loading channels", not context.verbosity and not context.quiet, context.json): spec_channel = spec.get_exact_value('channel') channel_urls = (spec_channel,) if spec_channel else context.channels @@ -66,8 +65,7 @@ def execute(args, parser): record.build, record.schannel, )) - sys.stdout.write('\n'.join(builder)) - sys.stdout.write('\n') + print('\n'.join(builder)) def pretty_record(record): @@ -95,5 +93,4 @@ def push_line(display_name, attr_name): push_line("md5", "md5") builder.append("%-12s: %s" % ("dependencies", dashlist(record.depends))) builder.append('\n') - sys.stdout.write('\n'.join(builder)) - sys.stdout.write('\n') + print('\n'.join(builder)) diff --git a/conda/common/io.py b/conda/common/io.py --- a/conda/common/io.py +++ b/conda/common/io.py @@ -32,6 +32,39 @@ _FORMATTER = Formatter("%(levelname)s %(name)s:%(funcName)s(%(lineno)d): %(message)s") +class ContextDecorator(object): + """Base class for a context manager class (implementing __enter__() and __exit__()) that also + makes it a decorator. + """ + + # TODO: figure out how to improve this pattern so e.g. swallow_broken_pipe doesn't have to be instantiated # NOQA + + def __call__(self, f): + @wraps(f) + def decorated(*args, **kwds): + with self: + return f(*args, **kwds) + return decorated + + +class SwallowBrokenPipe(ContextDecorator): + # Ignore BrokenPipeError and errors related to stdout or stderr being + # closed by a downstream program. + + def __enter__(self): + pass + + def __exit__(self, exc_type, exc_val, exc_tb): + if (exc_val + and isinstance(exc_val, EnvironmentError) + and getattr(exc_val, 'errno', None) + and exc_val.errno in (EPIPE, ESHUTDOWN)): + return True + + +swallow_broken_pipe = SwallowBrokenPipe() + + class CaptureTarget(Enum): """Constants used for contextmanager captured. @@ -262,20 +295,35 @@ def interrupt(signum, frame): class Spinner(object): + """ + Args: + message (str): + A message to prefix the spinner with. The string ': ' is automatically appended. + enabled (bool): + If False, usage is a no-op. + json (bool): + If True, will not output non-json to stdout. + + """ + # spinner_cycle = cycle("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏") spinner_cycle = cycle('/-\\|') - def __init__(self, enable_spin=True): + def __init__(self, message, enabled=True, json=False): + self.message = message + self.enabled = enabled + self.json = json + self._stop_running = Event() self._spinner_thread = Thread(target=self._start_spinning) self._indicator_length = len(next(self.spinner_cycle)) + 1 self.fh = sys.stdout - self.show_spin = enable_spin and hasattr(self.fh, "isatty") and self.fh.isatty() + self.show_spin = enabled and not json and hasattr(self.fh, "isatty") and self.fh.isatty() def start(self): if self.show_spin: self._spinner_thread.start() - else: + elif not self.json: self.fh.write("...working... ") self.fh.flush() @@ -283,60 +331,37 @@ def stop(self): if self.show_spin: self._stop_running.set() self._spinner_thread.join() + self.show_spin = False def _start_spinning(self): - while not self._stop_running.is_set(): - self.fh.write(next(self.spinner_cycle) + ' ') - self.fh.flush() - sleep(0.10) - self.fh.write('\b' * self._indicator_length) + try: + while not self._stop_running.is_set(): + self.fh.write(next(self.spinner_cycle) + ' ') + self.fh.flush() + sleep(0.10) + self.fh.write('\b' * self._indicator_length) + except EnvironmentError as e: + if e.errno in (EPIPE, ESHUTDOWN): + self.stop() + else: + raise + @swallow_broken_pipe + def __enter__(self): + if not self.json: + sys.stdout.write("%s: " % self.message) + sys.stdout.flush() + self.start() -@contextmanager -def spinner(message=None, enabled=True, json=False): - """ - Args: - message (str, optional): - An optional message to prefix the spinner with. - If given, ': ' are automatically added. - enabled (bool): - If False, usage is a no-op. - json (bool): - If True, will not output non-json to stdout. - """ - sp = Spinner(enabled) - exception_raised = False - try: - if message: - if json: - pass - else: - sys.stdout.write("%s: " % message) + def __exit__(self, exc_type, exc_val, exc_tb): + self.stop() + if not self.json: + with swallow_broken_pipe: + if exc_type or exc_val: + sys.stdout.write("failed\n") + else: + sys.stdout.write("done\n") sys.stdout.flush() - if not json: - sp.start() - yield - except: - exception_raised = True - raise - finally: - if not json: - sp.stop() - if message: - if json: - pass - else: - try: - if exception_raised: - sys.stdout.write("failed\n") - else: - sys.stdout.write("done\n") - sys.stdout.flush() - except (IOError, OSError) as e: - # Ignore BrokenPipeError and errors related to stdout or stderr being - # closed by a downstream program. - if e.errno not in (EPIPE, ESHUTDOWN): - raise class ProgressBar(object): @@ -361,32 +386,38 @@ def __init__(self, description, enabled=True, json=False): pass elif enabled: bar_format = "{desc}{bar} | {percentage:3.0f}% " - self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) + try: + self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) + except EnvironmentError as e: + if e.errno in (EPIPE, ESHUTDOWN): + self.enabled = False + else: + raise def update_to(self, fraction): - if self.json: - sys.stdout.write('{"fetch":"%s","finished":false,"maxval":1,"progress":%f}\n\0' - % (self.description, fraction)) - elif self.enabled: - self.pbar.update(fraction - self.pbar.n) + try: + if self.json and self.enabled: + sys.stdout.write('{"fetch":"%s","finished":false,"maxval":1,"progress":%f}\n\0' + % (self.description, fraction)) + elif self.enabled: + self.pbar.update(fraction - self.pbar.n) + except EnvironmentError as e: + if e.errno in (EPIPE, ESHUTDOWN): + self.enabled = False + else: + raise def finish(self): self.update_to(1) + @swallow_broken_pipe def close(self): - try: - if self.json: - sys.stdout.write('{"fetch":"%s","finished":true,"maxval":1,"progress":1}\n\0' - % self.description) - sys.stdout.flush() - elif self.enabled: - self.pbar.close() - except (IOError, OSError) as e: - # Ignore BrokenPipeError and errors related to stdout or stderr being - # closed by a downstream program. - if e.errno not in (EPIPE, ESHUTDOWN): - raise - self.enabled = False + if self.enabled and self.json: + sys.stdout.write('{"fetch":"%s","finished":true,"maxval":1,"progress":1}\n\0' + % self.description) + sys.stdout.flush() + elif self.enabled: + self.pbar.close() class ThreadLimitedThreadPoolExecutor(ThreadPoolExecutor): @@ -433,15 +464,6 @@ def submit(self, fn, *args, **kwargs): as_completed = as_completed # anchored here for import by other modules -class ContextDecorator(object): - def __call__(self, f): - @wraps(f) - def decorated(*args, **kwds): - with self: - return f(*args, **kwds) - return decorated - - class time_recorder(ContextDecorator): # pragma: no cover start_time = None record_file = expand(join('~', '.conda', 'instrumentation-record.csv')) diff --git a/conda/core/link.py b/conda/core/link.py --- a/conda/core/link.py +++ b/conda/core/link.py @@ -24,7 +24,7 @@ from ..base.constants import SafetyChecks from ..base.context import context from ..common.compat import ensure_text_type, iteritems, itervalues, odict, on_win -from ..common.io import spinner, time_recorder +from ..common.io import Spinner, time_recorder from ..common.path import (explode_directories, get_all_directories, get_major_minor_version, get_python_site_packages_short_path) from ..common.signals import signal_handler @@ -181,7 +181,7 @@ def prepare(self): self.transaction_context = {} - with spinner("Preparing transaction", not context.verbosity and not context.quiet, + with Spinner("Preparing transaction", not context.verbosity and not context.quiet, context.json): for stp in itervalues(self.prefix_setups): grps = self._prepare(self.transaction_context, stp.target_prefix, @@ -202,7 +202,7 @@ def verify(self): self._verified = True return - with spinner("Verifying transaction", not context.verbosity and not context.quiet, + with Spinner("Verifying transaction", not context.verbosity and not context.quiet, context.json): exceptions = self._verify(self.prefix_setups, self.prefix_action_groups) if exceptions: @@ -466,7 +466,7 @@ def _execute(cls, all_action_groups): with signal_handler(conda_signal_handler), time_recorder("unlink_link_execute"): pkg_idx = 0 try: - with spinner("Executing transaction", not context.verbosity and not context.quiet, + with Spinner("Executing transaction", not context.verbosity and not context.quiet, context.json): for pkg_idx, axngroup in enumerate(all_action_groups): cls._execute_actions(pkg_idx, axngroup) @@ -483,7 +483,7 @@ def _execute(cls, all_action_groups): # reverse all executed packages except the one that failed rollback_excs = [] if context.rollback_enabled: - with spinner("Rolling back transaction", + with Spinner("Rolling back transaction", not context.verbosity and not context.quiet, context.json): failed_pkg_idx = pkg_idx reverse_actions = reversed(tuple(enumerate( diff --git a/conda/core/solve.py b/conda/core/solve.py --- a/conda/core/solve.py +++ b/conda/core/solve.py @@ -18,7 +18,7 @@ from ..base.context import context from ..common.compat import iteritems, itervalues, odict, string_types, text_type from ..common.constants import NULL -from ..common.io import spinner +from ..common.io import Spinner from ..common.path import get_major_minor_version, paths_equal from ..exceptions import PackagesNotFoundError from ..gateways.logging import TRACE @@ -492,7 +492,7 @@ def solve_for_transaction(self, deps_modifier=NULL, prune=NULL, ignore_pinned=NU UnlinkLinkTransaction: """ - with spinner("Solving environment", not context.verbosity and not context.quiet, + with Spinner("Solving environment", not context.verbosity and not context.quiet, context.json): if self.prefix == context.root_prefix and context.enable_private_envs: # This path has the ability to generate a multi-prefix transaction. The basic logic @@ -516,7 +516,7 @@ def solve_for_transaction(self, deps_modifier=NULL, prune=NULL, ignore_pinned=NU ) if conda_newer_records: latest_version = conda_newer_records[-1].version - sys.stderr.write(dedent(""" + print(dedent(""" ==> WARNING: A newer version of conda exists. <== current version: %s @@ -526,8 +526,7 @@ def solve_for_transaction(self, deps_modifier=NULL, prune=NULL, ignore_pinned=NU $ conda update -n base conda - - """) % (CONDA_VERSION, latest_version)) + """) % (CONDA_VERSION, latest_version), file=sys.stderr) return UnlinkLinkTransaction(stp)
More BrokenPipeError ``` error: BrokenPipeError(32, 'Broken pipe') command: /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/conda install -p /home/ubuntu/anaconda3/envs/tensorflow_p36 tensorflow-gpu -y user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-1044-aws ubuntu/16.04 glibc/2.23 _messageid: -9223372036845075603 _messagetime: 1514219033248 / 2017-12-25 10:23:53 Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe ```
``` error: BrokenPipeError(32, 'Broken pipe') command: /Users/Rex/anaconda3/bin/conda install --yes --json --force-pscheck --prefix /Users/Rex/anaconda3/envs/test spyder==3.2.5 user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Darwin/17.3.0 OSX/10.13.2 _messageid: -9223372036843575583 _messagetime: 1514436380331 / 2017-12-27 22:46:20 Traceback (most recent call last): File "/Users/Rex/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/Users/Rex/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/Users/Rex/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/Users/Rex/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/Users/Rex/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/Users/Rex/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 296, in handle_txn common.stdout_json_success(prefix=prefix, actions=actions) File "/Users/Rex/anaconda3/lib/python3.6/site-packages/conda/cli/common.py", line 168, in stdout_json_success stdout_json(result) File "/Users/Rex/anaconda3/lib/python3.6/site-packages/conda/cli/common.py", line 161, in stdout_json json.dump(d, sys.stdout, indent=2, sort_keys=True, cls=EntityEncoder) File "/Users/Rex/anaconda3/lib/python3.6/json/__init__.py", line 180, in dump fp.write(chunk) BrokenPipeError: [Errno 32] Broken pipe ```
2017-12-30T23:28:33Z
[]
[]
Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 281, in handle_txn progressive_fetch_extract.execute() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 575, in execute exc = self._execute_actions(prec_or_spec, prec_actions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 590, in _execute_actions progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 365, in __init__ self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 767, in __init__ self.postfix, unit_divisor)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 201, in print_status fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/conda/_vendor/tqdm/_tqdm.py", line 195, in fp_write fp_flush() BrokenPipeError: [Errno 32] Broken pipe
4,253
conda/conda
conda__conda-6619
114e4b3cfb0fae3d566fd08a0c0c1d7e24c19891
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 @@ -11,11 +11,12 @@ from .. import CondaError from .._vendor.auxlib.entity import EntityEncoder +from ..base.constants import PathConflict, SafetyChecks from ..base.context import context, sys_rc_path, user_rc_path from ..common.compat import isiterable, iteritems, itervalues, string_types, text_type from ..common.configuration import pretty_list, pretty_map from ..common.io import timeout -from ..common.serialize import yaml_dump, yaml_load +from ..common.serialize import yaml, yaml_dump, yaml_load try: from cytoolz.itertoolz import concat, groupby @@ -309,6 +310,17 @@ def execute_config(args, parser): # config.rc_keys if not args.get: + + # Add representers for enums. + # Because a representer cannot be added for the base Enum class (it must be added for + # each specific Enum subclass), and because of import rules), I don't know of a better + # location to do this. + def enum_representer(dumper, data): + return dumper.represent_str(str(data)) + + yaml.representer.RoundTripRepresenter.add_representer(SafetyChecks, enum_representer) + yaml.representer.RoundTripRepresenter.add_representer(PathConflict, enum_representer) + try: with open(rc_path, 'w') as rc: rc.write(yaml_dump(rc_config))
RepresenterError('cannot represent an object: prevent',) ``` error: RepresenterError('cannot represent an object: prevent',) command: C:\tools\Anaconda3\Scripts\conda config --set path_conflict prevent user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Windows/10 Windows/10.0.16299 _messageid: -9223372036843225525 _messagetime: 1514570427640 / 2017-12-29 12:00:27 Traceback (most recent call last): File "C:\tools\Anaconda3\lib\site-packages\conda\exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "C:\tools\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\tools\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\tools\Anaconda3\lib\site-packages\conda\cli\main_config.py", line 29, in execute execute_config(args, parser) File "C:\tools\Anaconda3\lib\site-packages\conda\cli\main_config.py", line 312, in execute_config rc.write(yaml_dump(rc_config)) File "C:\tools\Anaconda3\lib\site-packages\conda\common\serialize.py", line 81, in yaml_dump indent=2) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\main.py", line 254, in dump version=version, tags=tags, block_seq_indent=block_seq_indent) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\main.py", line 224, in dump_all dumper.represent(data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 49, in represent node = self.represent_data(data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 83, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 852, in represent_dict return self.represent_mapping(tag, data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 698, in represent_mapping node_value = self.represent_data(item_value) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 93, in represent_data node = self.yaml_representers[None](self, data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 324, in represent_undefined raise RepresenterError("cannot represent an object: %s" % data) ruamel_yaml.representer.RepresenterError: cannot represent an object: prevent ```
2018-01-01T00:01:33Z
[]
[]
Traceback (most recent call last): File "C:\tools\Anaconda3\lib\site-packages\conda\exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "C:\tools\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\tools\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\tools\Anaconda3\lib\site-packages\conda\cli\main_config.py", line 29, in execute execute_config(args, parser) File "C:\tools\Anaconda3\lib\site-packages\conda\cli\main_config.py", line 312, in execute_config rc.write(yaml_dump(rc_config)) File "C:\tools\Anaconda3\lib\site-packages\conda\common\serialize.py", line 81, in yaml_dump indent=2) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\main.py", line 254, in dump version=version, tags=tags, block_seq_indent=block_seq_indent) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\main.py", line 224, in dump_all dumper.represent(data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 49, in represent node = self.represent_data(data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 83, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 852, in represent_dict return self.represent_mapping(tag, data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 698, in represent_mapping node_value = self.represent_data(item_value) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 93, in represent_data node = self.yaml_representers[None](self, data) File "C:\tools\Anaconda3\lib\site-packages\ruamel_yaml\representer.py", line 324, in represent_undefined raise RepresenterError("cannot represent an object: %s" % data) ruamel_yaml.representer.RepresenterError: cannot represent an object: prevent
4,254
conda/conda
conda__conda-6652
114e4b3cfb0fae3d566fd08a0c0c1d7e24c19891
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -283,7 +283,8 @@ def build_activate(self, env_name_or_prefix): def build_deactivate(self): # query environment old_conda_shlvl = int(os.getenv('CONDA_SHLVL', 0)) - if old_conda_shlvl <= 0: + old_conda_prefix = os.getenv('CONDA_PREFIX', None) + if old_conda_shlvl <= 0 or old_conda_prefix is None: return { 'unset_vars': (), 'set_vars': {}, @@ -291,7 +292,6 @@ def build_deactivate(self): 'deactivate_scripts': (), 'activate_scripts': (), } - old_conda_prefix = os.environ['CONDA_PREFIX'] deactivate_scripts = self._get_deactivate_scripts(old_conda_prefix) new_conda_shlvl = old_conda_shlvl - 1 @@ -548,12 +548,12 @@ def main(argv=None): activator_args = argv[2:] activator = Activator(shell, activator_args) try: - sys.stdout.write(activator.execute()) + print(activator.execute(), end='') return 0 except Exception as e: from . import CondaError if isinstance(e, CondaError): - sys.stderr.write(text_type(e)) + print(text_type(e), file=sys.stderr) return e.return_code else: raise
KeyError(u'CONDA_PREFIX',) ``` error: KeyError(u'CONDA_PREFIX',) command: D:\Anaconda2\Scripts\conda shell.cmd.exe deactivate deactivate user_agent: conda/4.4.4 requests/2.18.4 CPython/2.7.14 Windows/10 Windows/10.0.16299 _messageid: -9223372036842425555 _messagetime: 1514685063692 / 2017-12-30 19:51:03 Traceback (most recent call last): File "D:\Anaconda2\lib\site-packages\conda\cli\main.py", line 111, in main return activator_main() File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 529, in main sys.stdout.write(activator.execute()) File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 149, in execute return getattr(self, self.command)() File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 139, in deactivate return self._finalize(self._yield_commands(self.build_deactivate()), File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 288, in build_deactivate old_conda_prefix = os.environ['CONDA_PREFIX'] File "D:\Anaconda2\lib\os.py", line 425, in __getitem__ return self.data[key.upper()] KeyError: u'CONDA_PREFIX' ```
2018-01-04T20:35:44Z
[]
[]
Traceback (most recent call last): File "D:\Anaconda2\lib\site-packages\conda\cli\main.py", line 111, in main return activator_main() File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 529, in main sys.stdout.write(activator.execute()) File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 149, in execute return getattr(self, self.command)() File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 139, in deactivate return self._finalize(self._yield_commands(self.build_deactivate()), File "D:\Anaconda2\lib\site-packages\conda\activate.py", line 288, in build_deactivate old_conda_prefix = os.environ['CONDA_PREFIX'] File "D:\Anaconda2\lib\os.py", line 425, in __getitem__ return self.data[key.upper()] KeyError: u'CONDA_PREFIX'
4,258
conda/conda
conda__conda-6653
4d963e1da043f3eb8b0430263a6185db134f33df
diff --git a/conda/common/io.py b/conda/common/io.py --- a/conda/common/io.py +++ b/conda/common/io.py @@ -2,7 +2,8 @@ from __future__ import absolute_import, division, print_function, unicode_literals from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor +from concurrent.futures import ThreadPoolExecutor, _base, as_completed +from concurrent.futures.thread import _WorkItem from contextlib import contextmanager from enum import Enum from errno import EPIPE, ESHUTDOWN @@ -11,7 +12,6 @@ import json import logging from logging import CRITICAL, Formatter, NOTSET, StreamHandler, WARN, getLogger -from math import floor import os from os.path import dirname, isdir, isfile, join import signal @@ -35,7 +35,7 @@ class CaptureTarget(Enum): """Constants used for contextmanager captured. - Used similarily like the constants PIPE, STDOUT for stdlib's subprocess.Popen. + Used similarly like the constants PIPE, STDOUT for stdlib's subprocess.Popen. """ STRING = -1 STDOUT = -2 @@ -303,7 +303,6 @@ def spinner(message=None, enabled=True, json=False): If False, usage is a no-op. json (bool): If True, will not output non-json to stdout. - """ sp = Spinner(enabled) exception_raised = False @@ -390,21 +389,48 @@ def close(self): self.enabled = False -@contextmanager -def backdown_thread_pool(max_workers=10): - """Tries to create an executor with max_workers, but will back down ultimately to a single - thread of the OS decides you can't have more than one. - """ - try: - yield ThreadPoolExecutor(max_workers) - except RuntimeError as e: # pragma: no cover - # RuntimeError is thrown if number of threads are limited by OS - log.debug(repr(e)) - try: - yield ThreadPoolExecutor(floor(max_workers / 2)) - except RuntimeError as e: - log.debug(repr(e)) - yield ThreadPoolExecutor(1) +class ThreadLimitedThreadPoolExecutor(ThreadPoolExecutor): + + def __init__(self, max_workers=10): + super(ThreadLimitedThreadPoolExecutor, self).__init__(max_workers) + + def submit(self, fn, *args, **kwargs): + """ + This is an exact reimplementation of the `submit()` method on the parent class, except + with an added `try/except` around `self._adjust_thread_count()`. So long as there is at + least one living thread, this thread pool will not throw an exception if threads cannot + be expanded to `max_workers`. + + In the implementation, we use "protected" attributes from concurrent.futures (`_base` + and `_WorkItem`). Consider vendoring the whole concurrent.futures library + as an alternative to these protected imports. + + https://github.com/agronholm/pythonfutures/blob/3.2.0/concurrent/futures/thread.py#L121-L131 # NOQA + https://github.com/python/cpython/blob/v3.6.4/Lib/concurrent/futures/thread.py#L114-L124 + """ + with self._shutdown_lock: + if self._shutdown: + raise RuntimeError('cannot schedule new futures after shutdown') + + f = _base.Future() + w = _WorkItem(f, fn, args, kwargs) + + self._work_queue.put(w) + try: + self._adjust_thread_count() + except RuntimeError: + # RuntimeError: can't start new thread + # See https://github.com/conda/conda/issues/6624 + if len(self._threads) > 0: + # It's ok to not be able to start new threads if we already have at least + # one thread alive. + pass + else: + raise + return f + + +as_completed = as_completed # anchored here for import by other modules class ContextDecorator(object): @@ -427,6 +453,7 @@ def __enter__(self): enabled = os.environ.get('CONDA_INSTRUMENTATION_ENABLED') if enabled and boolify(enabled): self.start_time = time() + return self def __exit__(self, exc_type, exc_val, exc_tb): if self.start_time: diff --git a/conda/core/index.py b/conda/core/index.py --- a/conda/core/index.py +++ b/conda/core/index.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from concurrent.futures import as_completed from itertools import chain from logging import getLogger @@ -11,7 +10,7 @@ from .._vendor.boltons.setutils import IndexedSet from ..base.context import context from ..common.compat import iteritems, itervalues -from ..common.io import backdown_thread_pool, time_recorder +from ..common.io import ThreadLimitedThreadPoolExecutor, as_completed, time_recorder from ..exceptions import OperationNotAllowed from ..models.channel import Channel, all_channel_urls from ..models.dist import Dist @@ -162,7 +161,7 @@ def get_reduced_index(prefix, channels, subdirs, specs): # keep_specs.append(spec) # consolidated_specs.update(keep_specs) - with backdown_thread_pool() as executor: + with ThreadLimitedThreadPoolExecutor() as executor: channel_urls = all_channel_urls(channels, subdirs=subdirs) check_whitelist(channel_urls) diff --git a/conda/core/repodata.py b/conda/core/repodata.py --- a/conda/core/repodata.py +++ b/conda/core/repodata.py @@ -23,6 +23,7 @@ from ..base.context import context from ..common.compat import (ensure_binary, ensure_text_type, ensure_unicode, text_type, with_metaclass) +from ..common.io import ThreadLimitedThreadPoolExecutor, as_completed from ..common.url import join_url, maybe_unquote from ..core.package_cache import PackageCache from ..exceptions import CondaDependencyError, CondaHTTPError, CondaIndexError, NotWritableError @@ -75,23 +76,14 @@ class SubdirData(object): @staticmethod def query_all(channels, subdirs, package_ref_or_match_spec): + from .index import check_whitelist # TODO: fix in-line import channel_urls = all_channel_urls(channels, subdirs=subdirs) - - executor = None - try: - from concurrent.futures import ThreadPoolExecutor, as_completed - executor = ThreadPoolExecutor(10) + check_whitelist(channel_urls) + with ThreadLimitedThreadPoolExecutor() as executor: futures = (executor.submit( SubdirData(Channel(url)).query, package_ref_or_match_spec ) for url in channel_urls) return tuple(concat(future.result() for future in as_completed(futures))) - except RuntimeError as e: # pragma: no cover - # concurrent.futures is only available in Python >= 3.2 or if futures is installed - # RuntimeError is thrown if number of threads are limited by OS - raise - finally: - if executor: - executor.shutdown(wait=True) def query(self, package_ref_or_match_spec): if not self._loaded:
RuntimeError: can't start new thread ``` error: RuntimeError("generator didn't stop after throw()",) command: /home/mholekev/miniconda3/bin/conda install --yes numpy scipy matplotlib jupyter git pandas user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/2.6.32-696.10.3.el6.x86_64 centos/6.7 glibc/2.12 _messageid: -9223372036842075552 _messagetime: 1514766990662 / 2017-12-31 18:36:30 Traceback (most recent call last): File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/common/io.py", line 399, in backdown_thread_pool yield ThreadPoolExecutor(max_workers) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 214, in get_reduced_index new_records = query_all(spec) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in query_all return tuple(concat(future.result() for future in as_completed(futures))) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in <genexpr> return tuple(concat(future.result() for future in as_completed(futures))) File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/_base.py", line 217, in as_completed fs = set(fs) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 186, in <genexpr> futures = (executor.submit(sd.query, spec) for sd in subdir_datas) File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 123, in submit self._adjust_thread_count() File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 142, in _adjust_thread_count t.start() File "/home/mholekev/miniconda3/lib/python3.6/threading.py", line 846, in start _start_new_thread(self._bootstrap, ()) RuntimeError: can't start new thread ```
``` error: RuntimeError("can't start new thread",) command: /ahg/regevdata/users/subraman/software/miniconda3/bin/conda create -n test user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.3 Linux/2.6.32-696.16.1.el6.x86_64 rhel/6.9 glibc/2.12 _messageid: -9223372036842425559 _messagetime: 1514681157023 / 2017-12-30 18:45:57 Traceback (most recent call last): File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/site-packages/conda/cli/main_create.py", line 11, in execute install(args, parser, 'create') File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/site-packages/conda/cli/install.py", line 236, in install force_reinstall=context.force, File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 514, in solve_for_transaction SubdirData.query_all(self.channels, self.subdirs, conda_newer_spec), File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 88, in query_all return tuple(concat(future.result() for future in as_completed(futures))) File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 88, in <genexpr> return tuple(concat(future.result() for future in as_completed(futures))) File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/concurrent/futures/_base.py", line 217, in as_completed fs = set(fs) File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 87, in <genexpr> ) for url in channel_urls) File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 123, in submit self._adjust_thread_count() File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 142, in _adjust_thread_count t.start() File "/ahg/regevdata/users/subraman/software/miniconda3/lib/python3.6/threading.py", line 846, in start _start_new_thread(self._bootstrap, ()) RuntimeError: can't start new thread ```
2018-01-04T21:02:35Z
[]
[]
Traceback (most recent call last): File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/common/io.py", line 399, in backdown_thread_pool yield ThreadPoolExecutor(max_workers) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 214, in get_reduced_index new_records = query_all(spec) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in query_all return tuple(concat(future.result() for future in as_completed(futures))) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 187, in <genexpr> return tuple(concat(future.result() for future in as_completed(futures))) File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/_base.py", line 217, in as_completed fs = set(fs) File "/home/mholekev/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 186, in <genexpr> futures = (executor.submit(sd.query, spec) for sd in subdir_datas) File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 123, in submit self._adjust_thread_count() File "/home/mholekev/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 142, in _adjust_thread_count t.start() File "/home/mholekev/miniconda3/lib/python3.6/threading.py", line 846, in start _start_new_thread(self._bootstrap, ()) RuntimeError: can't start new thread
4,259
conda/conda
conda__conda-6655
114e4b3cfb0fae3d566fd08a0c0c1d7e24c19891
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -413,24 +413,30 @@ def _replace_prefix_in_path(self, old_prefix, new_prefix, starting_path_dirs=Non else: path_list = list(starting_path_dirs) if on_win: # pragma: unix no cover - # windows has a nasty habit of adding extra Library\bin directories - prefix_dirs = tuple(self._get_path_dirs(old_prefix)) - try: - first_idx = path_list.index(prefix_dirs[0]) - except ValueError: - first_idx = 0 + if old_prefix is not None: + # windows has a nasty habit of adding extra Library\bin directories + prefix_dirs = tuple(self._get_path_dirs(old_prefix)) + try: + first_idx = path_list.index(prefix_dirs[0]) + except ValueError: + first_idx = 0 + else: + last_idx = path_list.index(prefix_dirs[-1]) + del path_list[first_idx:last_idx+1] else: - last_idx = path_list.index(prefix_dirs[-1]) - del path_list[first_idx:last_idx+1] + first_idx = 0 if new_prefix is not None: path_list[first_idx:first_idx] = list(self._get_path_dirs(new_prefix)) else: - try: - idx = path_list.index(join(old_prefix, 'bin')) - except ValueError: - idx = 0 + if old_prefix is not None: + try: + idx = path_list.index(join(old_prefix, 'bin')) + except ValueError: + idx = 0 + else: + del path_list[idx] else: - del path_list[idx] + idx = 0 if new_prefix is not None: path_list.insert(idx, join(new_prefix, 'bin')) return self.path_conversion(path_list)
AttributeError: 'NoneType' object has no attribute 'endswith' ``` error: AttributeError("'NoneType' object has no attribute 'endswith'",) command: /home/wang/anaconda2/bin/conda shell.posix activate py2 user_agent: conda/4.4.4 requests/2.18.4 CPython/2.7.13 Linux/3.19.0-42-generic ubuntu/14.04 glibc/2.19 _messageid: -9223372036842325539 _messagetime: 1514696872936 / 2017-12-30 23:07:52 Traceback (most recent call last): File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 111, in main return activator_main() File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 529, in main sys.stdout.write(activator.execute()) File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 149, in execute return getattr(self, self.command)() File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 135, in activate return self._finalize(self._yield_commands(self.build_activate(self.env_name_or_prefix)), File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 247, in build_activate new_path = self.pathsep_join(self._replace_prefix_in_path(old_conda_prefix, prefix)) File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 411, in _replace_prefix_in_path idx = path_list.index(join(old_prefix, 'bin')) File "/home/wang/anaconda2/lib/python2.7/posixpath.py", line 70, in join elif path == '' or path.endswith('/'): AttributeError: 'NoneType' object has no attribute 'endswith' ```
2018-01-04T21:22:38Z
[]
[]
Traceback (most recent call last): File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 111, in main return activator_main() File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 529, in main sys.stdout.write(activator.execute()) File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 149, in execute return getattr(self, self.command)() File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 135, in activate return self._finalize(self._yield_commands(self.build_activate(self.env_name_or_prefix)), File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 247, in build_activate new_path = self.pathsep_join(self._replace_prefix_in_path(old_conda_prefix, prefix)) File "/home/wang/anaconda2/lib/python2.7/site-packages/conda/activate.py", line 411, in _replace_prefix_in_path idx = path_list.index(join(old_prefix, 'bin')) File "/home/wang/anaconda2/lib/python2.7/posixpath.py", line 70, in join elif path == '' or path.endswith('/'): AttributeError: 'NoneType' object has no attribute 'endswith'
4,260
conda/conda
conda__conda-6656
114e4b3cfb0fae3d566fd08a0c0c1d7e24c19891
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -968,6 +968,14 @@ def determine_target_prefix(ctx, args=None): except AttributeError: prefix_path = None + if prefix_name is not None and not prefix_name.strip(): # pragma: no cover + from ..exceptions import ArgumentError + raise ArgumentError("Argument --name requires a value.") + + if prefix_path is not None and not prefix_path.strip(): # pragma: no cover + from ..exceptions import ArgumentError + raise ArgumentError("Argument --prefix requires a value.") + if prefix_name is None and prefix_path is None: return ctx.default_prefix elif prefix_path is not None:
conda update --name AssertionError ``` error: AssertionError() command: /Users/cpthgli/.anyenv/envs/pyenv/versions/default/bin/conda update --name --all --yes user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.4 Darwin/17.3.0 OSX/10.13.2 _messageid: -9223372036843525540 _messagetime: 1514462637935 / 2017-12-28 06:03:57 Traceback (most recent call last): File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main_update.py", line 14, in execute install(args, parser, 'update') File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/install.py", line 140, in install prefix = context.target_prefix File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/base/context.py", line 454, in target_prefix return determine_target_prefix(self) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/base/context.py", line 974, in determine_target_prefix return locate_prefix_by_name(prefix_name) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/base/context.py", line 923, in locate_prefix_by_name assert name AssertionError ```
2018-01-04T21:31:32Z
[]
[]
Traceback (most recent call last): File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main_update.py", line 14, in execute install(args, parser, 'update') File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/install.py", line 140, in install prefix = context.target_prefix File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/base/context.py", line 454, in target_prefix return determine_target_prefix(self) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/base/context.py", line 974, in determine_target_prefix return locate_prefix_by_name(prefix_name) File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/base/context.py", line 923, in locate_prefix_by_name assert name AssertionError
4,261
conda/conda
conda__conda-6694
4d963e1da043f3eb8b0430263a6185db134f33df
diff --git a/conda/core/solve.py b/conda/core/solve.py --- a/conda/core/solve.py +++ b/conda/core/solve.py @@ -380,9 +380,9 @@ def solve_final_state(self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, if ascendant_name not in specs_to_add_names: update_names.add(ascendant_name) grouped_specs = groupby(lambda s: s.name in update_names, final_environment_specs) - new_final_environment_specs = set(grouped_specs[False]) + new_final_environment_specs = set(grouped_specs.get(False, ())) update_specs = set(MatchSpec(spec.name, optional=spec.optional) - for spec in grouped_specs[True]) + for spec in grouped_specs.get(True, ())) final_environment_specs = new_final_environment_specs | update_specs solution = r.solve(final_environment_specs)
KeyError with '--update-deps' ``` error: KeyError(True,) command: /home/jgrnt/miniconda/bin/conda install --update-deps python= numpy nose scipy matplotlib pandas pytest h5py mkl mkl-service user_agent: conda/4.4.7 requests/2.18.4 CPython/3.6.3 Linux/4.14.4-gentoo gentoo/2.4.1 glibc/2.25 _messageid: -9223372036837525416 _messagetime: 1515513689937 / 2018-01-09 10:01:29 Traceback (most recent call last): File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/exceptions.py", line 743, in __call__ return func(*args, **kwargs) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 236, in install force_reinstall=context.force, File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 437, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 385, in solve_final_state for spec in grouped_specs[True]) KeyError: True ```
2018-01-09T17:28:03Z
[]
[]
Traceback (most recent call last): File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/exceptions.py", line 743, in __call__ return func(*args, **kwargs) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 236, in install force_reinstall=context.force, File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 437, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "/home/jgrnt/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 385, in solve_final_state for spec in grouped_specs[True]) KeyError: True
4,268
conda/conda
conda__conda-6724
c23e57dfb935b5852eefb4e04187caf82b4e0b78
diff --git a/conda/plan.py b/conda/plan.py --- a/conda/plan.py +++ b/conda/plan.py @@ -351,7 +351,6 @@ def revert_actions(prefix, revision=-1, index=None): # TODO: If revision raise a revision error, should always go back to a safe revision # change h = History(prefix) - h.update() user_requested_specs = itervalues(h.get_requested_specs_map()) try: state = h.get_state(revision) @@ -360,7 +359,7 @@ def revert_actions(prefix, revision=-1, index=None): curr = h.get_state() if state == curr: - return {} # TODO: return txn with nothing_to_do + return UnlinkLinkTransaction() _supplement_index_with_prefix(index, prefix) r = Resolve(index) @@ -371,11 +370,6 @@ def revert_actions(prefix, revision=-1, index=None): link_dists = tuple(d for d in state if not is_linked(prefix, d)) unlink_dists = set(curr) - set(state) - # dists = (Dist(s) for s in state) - # actions = ensure_linked_actions(dists, prefix) - # for dist in curr - state: - # add_unlink(actions, Dist(dist)) - # check whether it is a safe revision for dist in concatv(link_dists, unlink_dists): if dist not in index:
Cannot roll back with 'conda install --revision' ``` error: AttributeError("'dict' object has no attribute 'get_pfe'",) command: C:\Program Files\Anaconda3\Scripts\conda install --revision 4 user_agent: conda/4.4.4 requests/2.18.4 CPython/3.5.2 Windows/8.1 Windows/6.3.9600 _messageid: -9223372036843575560 _messagetime: 1514442489595 / 2017-12-28 00:28:09 Traceback (most recent call last): File "C:\Program Files\Anaconda3\lib\site-packages\conda\exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 11, in execute install(args, parser, 'install') File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\install.py", line 232, in install progressive_fetch_extract = unlink_link_transaction.get_pfe() AttributeError: 'dict' object has no attribute 'get_pfe' ```
2018-01-13T05:54:39Z
[]
[]
Traceback (most recent call last): File "C:\Program Files\Anaconda3\lib\site-packages\conda\exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 11, in execute install(args, parser, 'install') File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\install.py", line 232, in install progressive_fetch_extract = unlink_link_transaction.get_pfe() AttributeError: 'dict' object has no attribute 'get_pfe'
4,274
conda/conda
conda__conda-6764
fa6526110300f241a41610894fbce34ff4341fdd
diff --git a/conda/exceptions.py b/conda/exceptions.py --- a/conda/exceptions.py +++ b/conda/exceptions.py @@ -582,6 +582,21 @@ def __init__(self, message): super(CondaUpgradeError, self).__init__(msg) +class CaseInsensitiveFileSystemError(CondaError): + def __init__(self, package_location, extract_location, **kwargs): + message = dals(""" + Cannot extract package to a case-insensitive file system. + package location: %(package_location)s + extract location: %(extract_location)s + """) + super(CaseInsensitiveFileSystemError, self).__init__( + message, + package_location=package_location, + extract_location=extract_location, + **kwargs + ) + + class CondaVerificationError(CondaError): def __init__(self, message): super(CondaVerificationError, self).__init__(message) 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 @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from errno import EACCES, EPERM +from errno import EACCES, ELOOP, EPERM from io import open from logging import getLogger import os @@ -24,7 +24,8 @@ from ...common.compat import ensure_binary, on_win from ...common.path import ensure_pad, expand, win_path_double_escape, win_path_ok from ...common.serialize import json_dump -from ...exceptions import BasicClobberError, CondaOSError, maybe_raise +from ...exceptions import (BasicClobberError, CaseInsensitiveFileSystemError, CondaOSError, + maybe_raise) from ...models.enums import FileMode, LinkType log = getLogger(__name__) @@ -142,7 +143,17 @@ def members_with_progress(): progress_update_callback(q / num_members) yield member - t.extractall(path=destination_directory, members=members_with_progress()) + try: + t.extractall(path=destination_directory, members=members_with_progress()) + except EnvironmentError as e: + if e.errno == ELOOP: + raise CaseInsensitiveFileSystemError( + package_location=tarball_full_path, + extract_location=destination_directory, + caused_by=e, + ) + else: + raise if sys.platform.startswith('linux') and os.getuid() == 0: # When extracting as root, tarfile will by restore ownership
OSError: Too many levels of symlinks This happened in a conda render operation, but does not appear to be readily reproducible - perhaps just a fluke, but something to watch out for if it happens often enough. ``` Traceback (most recent call last): File "/Users/msarahan/miniconda3/bin/c3i", line 11, in <module> load_entry_point('conda-concourse-ci', 'console_scripts', 'c3i')() File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/cli.py", line 123, in main execute.submit_one_off(**args.__dict__) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/execute.py", line 647, in submit_one_off **kwargs) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/execute.py", line 508, in compute_builds variant_config_files=kw.get('variant_config_files', [])) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/execute.py", line 72, in collect_tasks config=config) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/compute_build_graph.py", line 379, in construct_graph recipes_dir, config=config) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/compute_build_graph.py", line 206, in add_recipe_to_graph rendered = _get_or_render_metadata(recipe_dir, worker, config=config) File "/Users/msarahan/miniconda3/lib/python3.6/site-packages/conda/utils.py", line 38, in __call__ return self.func(*args, **kw) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/compute_build_graph.py", line 199, in _get_or_render_metadata bypass_env_check=True, config=config) File "/Users/msarahan/code/conda-build/conda_build/api.py", line 49, in render permit_undefined_jinja=not finalize): File "/Users/msarahan/code/conda-build/conda_build/metadata.py", line 1781, in get_output_metadata_set permit_unsatisfiable_variants=permit_unsatisfiable_variants) File "/Users/msarahan/code/conda-build/conda_build/metadata.py", line 645, in finalize_outputs_pass fm = finalize_metadata(om, permit_unsatisfiable_variants=permit_unsatisfiable_variants) File "/Users/msarahan/code/conda-build/conda_build/render.py", line 387, in finalize_metadata exclude_pattern) File "/Users/msarahan/code/conda-build/conda_build/render.py", line 306, in add_upstream_pins permit_unsatisfiable_variants, exclude_pattern) File "/Users/msarahan/code/conda-build/conda_build/render.py", line 289, in _read_upstream_pin_files extra_run_specs = get_upstream_pins(m, actions, env) File "/Users/msarahan/code/conda-build/conda_build/render.py", line 251, in get_upstream_pins pfe.execute() File "/Users/msarahan/miniconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 494, in execute self._execute_action(action) File "/Users/msarahan/miniconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 515, in _execute_action raise CondaMultiError(exceptions) conda.CondaMultiError: OSError(62, 'Too many levels of symbolic links') OSError(62, 'Too many levels of symbolic links') OSError(62, 'Too many levels of symbolic links') ```
In an auto-upload report we got something similar. Maybe more details here. "command": "/Users/boris/bin/miniconda/bin/conda install clangxx_osx-64" "user_agent": "conda/4.4.1 requests/2.18.4 CPython/2.7.14 Darwin/17.3.0 OSX/10.13.2" ``` Traceback (most recent call last): File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/exceptions.py\", line 721, in __call__ return func(*args, **kwargs) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/cli/main.py\", line 78, in _main exit_code = do_call(args, p) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call exit_code = getattr(module, func_name)(args, parser) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/cli/main_install.py\", line 11, in execute install(args, parser, 'install') File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/cli/install.py\", line 239, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/cli/install.py\", line 256, in handle_txn unlink_link_transaction.display_actions(progressive_fetch_extract) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/core/link.py\", line 706, in display_actions legacy_action_groups = self.make_legacy_action_groups(pfe) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/core/link.py\", line 689, in make_legacy_action_groups pfe.prepare() File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/common/io.py\", line 402, in decorated return f(*args, **kwds) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/core/package_cache.py\", line 508, in prepare for prec in self.link_precs) File \"/Users/boris/bin/miniconda/lib/python2.7/_abcoll.py\", line 571, in update for key, value in other: File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/core/package_cache.py\", line 508, in <genexpr> for prec in self.link_precs) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/core/package_cache.py\", line 402, in make_actions_for_record ), None) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/core/package_cache.py\", line 399, in <genexpr> pcrec for pcrec in concat(PackageCache(pkgs_dir).query(pref_or_spec) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/core/package_cache.py\", line 400, in <genexpr> for pkgs_dir in context.pkgs_dirs) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/core/package_cache.py\", line 116, in query return (pcrec for pcrec in itervalues(self._package_cache_records) if pcrec == param) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/core/package_cache.py\", line 209, in _package_cache_records self.load() File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/core/package_cache.py\", line 88, in load package_cache_record = self._make_single_record(base_name) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/core/package_cache.py\", line 294, in _make_single_record extract_tarball(package_tarball_full_path, extracted_package_dir) File \"/Users/boris/bin/miniconda/lib/python2.7/site-packages/conda/gateways/disk/create.py\", line 145, in extract_tarball t.extractall(path=destination_directory, members=members_with_progress()) File \"/Users/boris/bin/miniconda/lib/python2.7/tarfile.py\", line 2081, in extractall self.extract(tarinfo, path) File \"/Users/boris/bin/miniconda/lib/python2.7/tarfile.py\", line 2118, in extract self._extract_member(tarinfo, os.path.join(path, tarinfo.name)) File \"/Users/boris/bin/miniconda/lib/python2.7/tarfile.py\", line 2194, in _extract_member self.makefile(tarinfo, targetpath) File \"/Users/boris/bin/miniconda/lib/python2.7/tarfile.py\", line 2234, in makefile with bltn_open(targetpath, \"wb\") as target: IOError: [Errno 62] Too many levels of symbolic links: u'/Users/boris/bin/miniconda/pkgs/openssl-1.0.2l-h077ae2c_5/ssl/man/man3/mdc2.3' ``` Only `defaults` in the operation's channel list. I'm running into the exact error above when trying to use the undocumented `CONDA_SUBDIR` setting on a fresh anaconda install. System: python 3.6.3 anaconda 5.0.1 macOS 10.13.2 All other config options (channels, environment, etc) are default. I am able to replicate the error from the root environment of a clean install with the following command: ``` CONDA_SUBDIR=linux-64 \ $HOME/anaconda3/bin/conda install \ --yes --mkdir --json -vv \ --prefix $HOME/temp_conda_env \ python=3.6 flask pyyaml yaml pandas nomkl ``` Traceback: https://gist.github.com/cscanlin/25fa05575918752252a071f352a7395a For reference, I am trying to use `CONDA_SUBDIR` in an attempt at picking up the torch on conda support for Zappa: https://github.com/Miserlou/Zappa/pull/108 Please let me know if I can provide additional details, thanks! Hey Chris, really appreciate someone digging into conda + Zappa. It’s been on my list for a *long* time, and I just haven’t had the bandwidth. Going to try to look into this particular issue later today. Sent from my iPhone > On Jan 21, 2018, at 9:34 PM, Chris Scanlin <[email protected]> wrote: > > I'm running into the exact error above when trying to use the undocumented CONDA_SUBDIR setting on a fresh anaconda install. > > System: > python 3.6.3 > anaconda 5.0.1 > macOS 10.13.2 > > All other config options (channels, environment, etc) are default. > > I am able to replicate the error from the root environment of a clean install with the following command: > > CONDA_SUBDIR=linux-64 \ > $HOME/anaconda3/bin/conda install \ > --yes --mkdir --json -vv \ > --prefix $HOME/temp_conda_env \ > python=3.6 flask pyyaml yaml pandas nomkl > Traceback: https://gist.github.com/cscanlin/25fa05575918752252a071f352a7395a > > For reference, I am trying to use CONDA_SUBDIR in an attempt at picking up the torch on conda support for Zappa: Miserlou/Zappa#108 > > Please let me know if I can provide additional details, thanks! > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub, or mute the thread. > Issue here is with trying to use python's `tarfile.extractall()` on the linux-64 openssl package, while on macOS. Relevant stack trace is ``` Traceback (most recent call last): File "/Users/kfranz/continuum/conda/conda/exceptions.py", line 751, in __call__ return func(*args, **kwargs) File "/Users/kfranz/continuum/conda/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/Users/kfranz/continuum/conda/conda/cli/conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "/Users/kfranz/continuum/conda/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/Users/kfranz/continuum/conda/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/Users/kfranz/continuum/conda/conda/cli/install.py", line 272, in handle_txn unlink_link_transaction.display_actions(progressive_fetch_extract) File "/Users/kfranz/continuum/conda/conda/core/link.py", line 706, in display_actions legacy_action_groups = self.make_legacy_action_groups(pfe) File "/Users/kfranz/continuum/conda/conda/core/link.py", line 689, in make_legacy_action_groups pfe.prepare() File "/Users/kfranz/continuum/conda/conda/common/io.py", line 415, in decorated return f(*args, **kwds) File "/Users/kfranz/continuum/conda/conda/core/package_cache.py", line 540, in prepare for prec in self.link_precs) File "/Users/kfranz/continuum/conda/conda/core/package_cache.py", line 540, in <genexpr> for prec in self.link_precs) File "/Users/kfranz/continuum/conda/conda/core/package_cache.py", line 434, in make_actions_for_record ), None) File "/Users/kfranz/continuum/conda/conda/core/package_cache.py", line 431, in <genexpr> pcrec for pcrec in concat(PackageCache(pkgs_dir).query(pref_or_spec) File "/Users/kfranz/continuum/conda/conda/core/package_cache.py", line 432, in <genexpr> for pkgs_dir in context.pkgs_dirs) File "/Users/kfranz/continuum/conda/conda/core/package_cache.py", line 118, in query return (pcrec for pcrec in itervalues(self._package_cache_records) if pcrec == param) File "/Users/kfranz/continuum/conda/conda/core/package_cache.py", line 211, in _package_cache_records self.load() File "/Users/kfranz/continuum/conda/conda/core/package_cache.py", line 90, in load package_cache_record = self._make_single_record(base_name) File "/Users/kfranz/continuum/conda/conda/core/package_cache.py", line 308, in _make_single_record extract_tarball(package_tarball_full_path, extracted_package_dir) File "/Users/kfranz/continuum/conda/conda/gateways/disk/create.py", line 145, in extract_tarball t.extractall(path=destination_directory, members=members_with_progress()) File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tarfile.py", line 1996, in extractall numeric_owner=numeric_owner) File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tarfile.py", line 2038, in extract numeric_owner=numeric_owner) File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tarfile.py", line 2108, in _extract_member self.makefile(tarinfo, targetpath) File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tarfile.py", line 2148, in makefile with bltn_open(targetpath, "wb") as target: OSError: [Errno 62] Too many levels of symbolic links: '/Users/kfranz/linux-64/openssl-1.0.2n-hb7f436b_0/ssl/man/man3/mdc2.3' ``` The linux-64 package has ``` ❯ ls -al /Users/kfranz/linux-64/openssl-1.0.2n-hb7f436b_0/ssl/man/man3/MDC* lrwxr-xr-x 1 kfranz staff 6B Jan 22 13:23 /Users/kfranz/linux-64/openssl-1.0.2n-hb7f436b_0/ssl/man/man3/MDC2.3@ -> mdc2.3 lrwxr-xr-x 1 kfranz staff 6B Jan 22 13:23 /Users/kfranz/linux-64/openssl-1.0.2n-hb7f436b_0/ssl/man/man3/MDC2_Final.3@ -> mdc2.3 lrwxr-xr-x 1 kfranz staff 6B Jan 22 13:23 /Users/kfranz/linux-64/openssl-1.0.2n-hb7f436b_0/ssl/man/man3/MDC2_Init.3@ -> mdc2.3 lrwxr-xr-x 1 kfranz staff 6B Jan 22 13:23 /Users/kfranz/linux-64/openssl-1.0.2n-hb7f436b_0/ssl/man/man3/MDC2_Update.3@ -> mdc2.3 ``` Specifically the problem is with ssl/man/man3/MDC2.3@ -> mdc2.3 So probably something going on with case sensitivity differences in the file system here. Still figuring out what the correct fix is...
2018-01-22T20:43:42Z
[]
[]
Traceback (most recent call last): File "/Users/msarahan/miniconda3/bin/c3i", line 11, in <module> load_entry_point('conda-concourse-ci', 'console_scripts', 'c3i')() File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/cli.py", line 123, in main execute.submit_one_off(**args.__dict__) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/execute.py", line 647, in submit_one_off **kwargs) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/execute.py", line 508, in compute_builds variant_config_files=kw.get('variant_config_files', [])) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/execute.py", line 72, in collect_tasks config=config) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/compute_build_graph.py", line 379, in construct_graph recipes_dir, config=config) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/compute_build_graph.py", line 206, in add_recipe_to_graph rendered = _get_or_render_metadata(recipe_dir, worker, config=config) File "/Users/msarahan/miniconda3/lib/python3.6/site-packages/conda/utils.py", line 38, in __call__ return self.func(*args, **kw) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/compute_build_graph.py", line 199, in _get_or_render_metadata bypass_env_check=True, config=config) File "/Users/msarahan/code/conda-build/conda_build/api.py", line 49, in render permit_undefined_jinja=not finalize): File "/Users/msarahan/code/conda-build/conda_build/metadata.py", line 1781, in get_output_metadata_set permit_unsatisfiable_variants=permit_unsatisfiable_variants) File "/Users/msarahan/code/conda-build/conda_build/metadata.py", line 645, in finalize_outputs_pass fm = finalize_metadata(om, permit_unsatisfiable_variants=permit_unsatisfiable_variants) File "/Users/msarahan/code/conda-build/conda_build/render.py", line 387, in finalize_metadata exclude_pattern) File "/Users/msarahan/code/conda-build/conda_build/render.py", line 306, in add_upstream_pins permit_unsatisfiable_variants, exclude_pattern) File "/Users/msarahan/code/conda-build/conda_build/render.py", line 289, in _read_upstream_pin_files extra_run_specs = get_upstream_pins(m, actions, env) File "/Users/msarahan/code/conda-build/conda_build/render.py", line 251, in get_upstream_pins pfe.execute() File "/Users/msarahan/miniconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 494, in execute self._execute_action(action) File "/Users/msarahan/miniconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 515, in _execute_action raise CondaMultiError(exceptions) conda.CondaMultiError: OSError(62, 'Too many levels of symbolic links')
4,279
conda/conda
conda__conda-6776
c1af02bb4fcfb8c962bb52d040ba705174345889
diff --git a/conda/exceptions.py b/conda/exceptions.py --- a/conda/exceptions.py +++ b/conda/exceptions.py @@ -592,6 +592,12 @@ def __init__(self, message): super(SafetyError, self).__init__(message) +class CondaMemoryError(MemoryError, CondaError): + def __init__(self, caused_by, **kwargs): + message = "The conda process ran out of memory. Increase system memory and/or try again." + super(CondaMemoryError, self).__init__(message, caused_by=caused_by, **kwargs) + + class NotWritableError(CondaError, OSError): def __init__(self, path, errno, **kwargs): @@ -784,6 +790,8 @@ def handle_exception(self, exc_val, exc_tb): if isinstance(exc_val, EnvironmentError): if getattr(exc_val, 'errno', None) == ENOSPC: return self.handle_application_exception(NoSpaceLeftError(exc_val), exc_tb) + if isinstance(exc_val, MemoryError): + return self.handle_application_exception(CondaMemoryError(exc_val), exc_tb) if isinstance(exc_val, KeyboardInterrupt): self._print_conda_exception(CondaError("KeyboardInterrupt"), _format_exc()) return 1
MemoryError ``` error: MemoryError() command: C:\Users\Jason\Anaconda3\Scripts\conda install rise user_agent: conda/4.4.7 requests/2.18.4 CPython/3.6.3 Windows/10 Windows/10.0.16299 _messageid: -9223372036837525402 _messagetime: 1515517517366 / 2018-01-09 11:05:17 MemoryError During handling of the above exception, another exception occurred: MemoryError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\exceptions.py", line 743, in __call__ return func(*args, **kwargs) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 11, in execute install(args, parser, 'install') File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\cli\install.py", line 236, in install force_reinstall=context.force, File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\solve.py", line 437, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\solve.py", line 145, in solve_final_state solution = tuple(Dist(d) for d in prefix_data.iter_records()) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\linked_data.py", line 90, in iter_records return itervalues(self._prefix_records) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\linked_data.py", line 110, in _prefix_records return self.__prefix_records or self.load() or self.__prefix_records File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\linked_data.py", line 48, in load self._load_single_record(meta_file) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\linked_data.py", line 116, in _load_single_record prefix_record = PrefixRecord(**json_data) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 718, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 735, in __init__ setattr(self, key, kwargs[key]) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 427, in __set__ instance.__dict__[self.name] = self.validate(instance, self.box(instance, instance.__class__, val)) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 666, in box return self._type(**val) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 718, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 735, in __init__ setattr(self, key, kwargs[key]) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 427, in __set__ instance.__dict__[self.name] = self.validate(instance, self.box(instance, instance.__class__, val)) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 590, in box return self._type(v if isinstance(v, et) else et(**v) for v in val) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 590, in <genexpr> return self._type(v if isinstance(v, et) else et(**v) for v in val) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 718, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) MemoryError ```
2018-01-24T11:31:59Z
[]
[]
Traceback (most recent call last): File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\exceptions.py", line 743, in __call__ return func(*args, **kwargs) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 11, in execute install(args, parser, 'install') File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\cli\install.py", line 236, in install force_reinstall=context.force, File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\solve.py", line 437, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\solve.py", line 145, in solve_final_state solution = tuple(Dist(d) for d in prefix_data.iter_records()) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\linked_data.py", line 90, in iter_records return itervalues(self._prefix_records) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\linked_data.py", line 110, in _prefix_records return self.__prefix_records or self.load() or self.__prefix_records File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\linked_data.py", line 48, in load self._load_single_record(meta_file) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\core\linked_data.py", line 116, in _load_single_record prefix_record = PrefixRecord(**json_data) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 718, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 735, in __init__ setattr(self, key, kwargs[key]) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 427, in __set__ instance.__dict__[self.name] = self.validate(instance, self.box(instance, instance.__class__, val)) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 666, in box return self._type(**val) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 718, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 735, in __init__ setattr(self, key, kwargs[key]) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 427, in __set__ instance.__dict__[self.name] = self.validate(instance, self.box(instance, instance.__class__, val)) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 590, in box return self._type(v if isinstance(v, et) else et(**v) for v in val) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 590, in <genexpr> return self._type(v if isinstance(v, et) else et(**v) for v in val) File "C:\Users\Jason\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 718, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) MemoryError
4,283
conda/conda
conda__conda-6777
d503c26e0a9165f21b758238cdf08c3f1b81d20f
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -43,6 +43,12 @@ def __init__(self, shell, arguments=None): self.shell = shell self._raw_arguments = arguments + if PY2: + self.environ = {ensure_fs_path_encoding(k): ensure_fs_path_encoding(v) + for k, v in iteritems(os.environ)} + else: + self.environ = os.environ.copy() + if shell == 'posix': self.pathsep_join = ':'.join self.path_conversion = native_path_to_unix @@ -215,13 +221,13 @@ def build_activate(self, env_name_or_prefix): prefix = normpath(prefix) # query environment - old_conda_shlvl = int(os.getenv('CONDA_SHLVL', 0)) - old_conda_prefix = os.getenv('CONDA_PREFIX') + old_conda_shlvl = int(self.environ.get('CONDA_SHLVL', 0)) + old_conda_prefix = self.environ.get('CONDA_PREFIX') max_shlvl = context.max_shlvl if old_conda_prefix == prefix: return self.build_reactivate() - if os.getenv('CONDA_PREFIX_%s' % (old_conda_shlvl-1)) == prefix: + if self.environ.get('CONDA_PREFIX_%s' % (old_conda_shlvl-1)) == prefix: # in this case, user is attempting to activate the previous environment, # i.e. step back down return self.build_deactivate() @@ -282,8 +288,8 @@ def build_activate(self, env_name_or_prefix): def build_deactivate(self): # query environment - old_conda_shlvl = int(os.getenv('CONDA_SHLVL', 0)) - old_conda_prefix = os.getenv('CONDA_PREFIX', None) + old_conda_shlvl = int(self.environ.get('CONDA_SHLVL', 0)) + old_conda_prefix = self.environ.get('CONDA_PREFIX', None) if old_conda_shlvl <= 0 or old_conda_prefix is None: return { 'unset_vars': (), @@ -314,7 +320,7 @@ def build_deactivate(self): } activate_scripts = () else: - new_prefix = os.getenv('CONDA_PREFIX_%d' % new_conda_shlvl) + new_prefix = self.environ.get('CONDA_PREFIX_%d' % new_conda_shlvl) conda_default_env = self._default_env(new_prefix) conda_prompt_modifier = self._prompt_modifier(conda_default_env) @@ -341,8 +347,8 @@ def build_deactivate(self): } def build_reactivate(self): - conda_prefix = os.environ.get('CONDA_PREFIX') - conda_shlvl = int(os.environ.get('CONDA_SHLVL', -1)) + conda_prefix = self.environ.get('CONDA_PREFIX') + conda_shlvl = int(self.environ.get('CONDA_SHLVL', -1)) if not conda_prefix or conda_shlvl < 1: # no active environment, so cannot reactivate; do nothing return { @@ -352,7 +358,7 @@ def build_reactivate(self): 'deactivate_scripts': (), 'activate_scripts': (), } - conda_default_env = os.environ.get('CONDA_DEFAULT_ENV', self._default_env(conda_prefix)) + conda_default_env = self.environ.get('CONDA_DEFAULT_ENV', self._default_env(conda_prefix)) # environment variables are set only to aid transition from conda 4.3 to conda 4.4 return { 'unset_vars': (), @@ -366,7 +372,7 @@ def build_reactivate(self): } def _get_starting_path_list(self): - path = os.environ['PATH'] + path = self.environ['PATH'] if on_win: # On Windows, the Anaconda Python interpreter prepends sys.prefix\Library\bin on # startup. It's a hack that allows users to avoid using the correct activation @@ -446,8 +452,8 @@ def _update_prompt(self, set_vars, conda_prompt_modifier): return if self.shell == 'posix': - ps1 = os.environ.get('PS1', '') - current_prompt_modifier = os.environ.get('CONDA_PROMPT_MODIFIER') + ps1 = self.environ.get('PS1', '') + current_prompt_modifier = self.environ.get('CONDA_PROMPT_MODIFIER') if current_prompt_modifier: ps1 = re.sub(re.escape(current_prompt_modifier), r'', ps1) # Because we're using single-quotes to set shell variables, we need to handle the @@ -458,8 +464,8 @@ def _update_prompt(self, set_vars, conda_prompt_modifier): 'PS1': conda_prompt_modifier + ps1, }) elif self.shell == 'csh': - prompt = os.environ.get('prompt', '') - current_prompt_modifier = os.environ.get('CONDA_PROMPT_MODIFIER') + prompt = self.environ.get('prompt', '') + current_prompt_modifier = self.environ.get('CONDA_PROMPT_MODIFIER') if current_prompt_modifier: prompt = re.sub(re.escape(current_prompt_modifier), r'', prompt) set_vars.update({ @@ -498,6 +504,13 @@ def ensure_binary(value): return value +def ensure_fs_path_encoding(value): + try: + return value.decode(FILESYSTEM_ENCODING) + except AttributeError: + 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: @@ -532,6 +545,7 @@ def path_identity(paths): on_win = bool(sys.platform == "win32") PY2 = sys.version_info[0] == 2 +FILESYSTEM_ENCODING = sys.getfilesystemencoding() if PY2: # pragma: py3 no cover string_types = basestring, # NOQA text_type = unicode # NOQA
source activate env error **I'm submitting a...** - [x] bug report - [ ] feature request ### Current Behavior when i try to activate a conda env,this doesn't work for me the output is: ``` Traceback (most recent call last): File "/anaconda/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/anaconda/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 513 Logged from file exceptions.py, line 724 ``` ### Steps to Reproduce i have regularly updated conda to the lateset version recently, and i installed pipenv.i know that cannot work with a conda-created env, but i suspect this may lead to this error then this error came ### Expected Behavior <!-- What do you think should happen? --> ##### `conda info` <!-- between the ticks below, paste the output of 'conda info' --> ``` active environment : None shell level : 0 user config file : /Users/bubu/.condarc populated config files : /Users/bubu/.condarc conda version : 4.4.7 conda-build version : 3.2.1 python version : 2.7.13.final.0 base environment : /anaconda (writable) channel URLs : https://conda.anaconda.org/anaconda-fusion/osx-64 https://conda.anaconda.org/anaconda-fusion/noarch https://repo.continuum.io/pkgs/main/osx-64 https://repo.continuum.io/pkgs/main/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 package cache : /anaconda/pkgs /Users/bubu/.conda/pkgs envs directories : /anaconda/envs /Users/bubu/.conda/envs platform : osx-64 user-agent : conda/4.4.7 requests/2.18.4 CPython/2.7.13 Darwin/17.3.0 OSX/10.13.2 UID:GID : 501:20 netrc file : None offline mode : False ``` ##### `conda config --show-sources` <!-- between the ticks below, paste the output of 'conda config --show-sources' --> ``` ==> /Users/bubu/.condarc <== ssl_verify: True channels: - anaconda-fusion - defaults ``` ##### `conda list --show-channel-urls` <!-- between the ticks below, paste the output of 'conda list --show-channel-urls' --> ``` # packages in environment at /anaconda: # _license 1.1 py27_1 defaults alabaster 0.7.9 py27_0 defaults amqp 1.4.9 <pip> anaconda custom py27_0 defaults anaconda-client 1.6.3 py27_0 defaults anaconda-navigator 1.5.2 py27_0 defaults anaconda-project 0.4.1 py27_0 defaults ansible 2.4.1.0 <pip> apipkg 1.4 <pip> appdirs 1.4.3 <pip> appnope 0.1.0 py27_0 defaults appscript 1.0.1 py27_0 defaults argcomplete 1.0.0 py27_1 defaults argon2-cffi 16.3.0 <pip> astroid 1.4.9 py27_0 defaults astropy 1.3.3 np112py27_0 defaults attrs 17.2.0 <pip> autobahn 17.7.1 <pip> Automat 0.6.0 <pip> babel 2.3.4 py27_0 defaults backports 1.0 py27_0 defaults backports.weakref 1.0rc1 <pip> backports_abc 0.5 py27_0 defaults bcrypt 3.1.4 <pip> beautifulsoup4 4.5.3 py27_0 defaults billiard 3.3.0.23 <pip> binaryornot 0.4.3 <pip> bitarray 0.8.1 py27_0 defaults blaze 0.10.1 py27_0 defaults bleach 2.0.0 <pip> bokeh 0.12.4 py27_0 defaults boto 2.45.0 py27_0 defaults bottle 0.12.13 <pip> bottle-sqlite 0.1.3 <pip> bottleneck 1.2.1 np112py27_0 defaults ca-certificates 2017.08.26 ha1e5d58_0 defaults cache-client 0.1.0 <pip> cdecimal 2.3 py27_2 defaults celery 3.1.23 <pip> certifi 2017.11.5 py27hfa9a1c4_0 defaults certifi 2017.4.17 <pip> cffi 1.9.1 py27_0 defaults Chameleon 3.1 <pip> chardet 2.3.0 py27_0 defaults chardet 3.0.3 <pip> check-manifest 0.35 <pip> chest 0.2.3 py27_0 defaults click 6.7 py27_0 defaults click-default-group 1.2 <pip> cloudpickle 0.2.2 py27_0 defaults clyent 1.2.2 py27_0 defaults colorama 0.3.7 py27_0 defaults conda 4.4.7 py27_0 defaults conda-build 3.2.1 py27_0 defaults conda-env 2.6.0 h36134e3_0 defaults conda-verify 2.0.0 py27_0 defaults configobj 5.0.6 py27_0 defaults configparser 3.5.0 py27_0 defaults constantly 15.1.0 <pip> contextlib2 0.5.4 py27_0 defaults cookiecutter 1.5.1 <pip> crockford 0.0.2 <pip> cryptography 1.7.1 py27_0 defaults cssselect 1.0.1 <pip> curl 7.52.1 0 defaults cvxopt 1.1.9 <pip> cycler 0.10.0 py27_0 defaults cython 0.25.2 py27_0 defaults cytoolz 0.8.2 py27_0 defaults dask 0.13.0 py27_0 defaults datashape 0.5.4 py27_0 defaults decorator 4.0.11 py27_0 defaults defusedxml 0.5.0 <pip> devpi 2.2.0 <pip> devpi-client 3.0.0 <pip> devpi-common 3.1.0 <pip> devpi-server 4.3.0 <pip> devpi-web 3.2.0 <pip> dill 0.2.5 py27_0 defaults Django 1.10.5 <pip> django-extensions 1.7.9 <pip> django-filter 1.0.1 <pip> django-rest-swagger 2.1.1 <pip> django-silk 0.7.3 <pip> djangorestframework 3.5.4 <pip> djangorestframework-bulk 0.2.1 <pip> dlib 19.4.0 <pip> docopt 0.6.2 <pip> docutils 0.13.1 py27_0 defaults dpkt 1.9.1 <pip> dry-rest-permissions 0.1.8 <pip> entrypoints 0.2.2 py27_0 defaults entrypoints 0.2.2 <pip> enum34 1.1.6 py27_0 defaults environment-kernels 1.1 <pip> et_xmlfile 1.0.1 py27_0 defaults etu-tools 0.3.0 <pip> execnet 1.4.1 <pip> factory-boy 2.8.1 <pip> fake-useragent 0.1.7 <pip> Faker 0.7.12 <pip> falcon 1.2.0 <pip> fastcache 1.0.2 py27_1 defaults filelock 2.0.7 py27_0 defaults fire 0.1.2 <pip> first 2.0.1 <pip> flake8 3.3.0 <pip> Flask 0.3 <pip> flask 0.12 py27_0 defaults flask-cors 3.0.2 py27_0 defaults Flask-Login 0.4.0 <pip> freetype 2.5.5 2 defaults funcsigs 1.0.2 py27_0 defaults functools32 3.2.3.2 py27_0 defaults future 0.16.0 <pip> futures 3.0.5 py27_0 defaults GB2260 0.4.1 <pip> gdbn 0.1 <pip> get_terminal_size 1.0.0 py27_0 defaults gevent 1.2.2 <pip> gevent 1.2.1 py27_0 defaults Glances 2.9.1 <pip> glob2 0.6 py27h55c9705_0 defaults gnumpy 0.2 <pip> greenlet 0.4.12 <pip> greenlet 0.4.11 py27_0 defaults grequests 0.3.0 <pip> grin 1.2.1 py27_3 defaults gunicorn 19.7.1 <pip> gym 0.9.3 <pip> h5py 2.7.0 np112py27_0 defaults hdf5 1.8.17 1 defaults heapdict 1.0.0 py27_1 defaults hkdf 0.0.3 <pip> holidays 0.8.1 <pip> html5lib 0.999999999 <pip> humanize 0.5.1 <pip> hupper 1.0 <pip> hyperlink 17.3.0 <pip> icu 54.1 0 defaults idna 2.6 <pip> idna 2.2 py27_0 defaults imagesize 0.7.1 py27_0 defaults incremental 17.5.0 <pip> ipaddress 1.0.18 py27_0 defaults ipykernel 4.5.2 py27_0 defaults ipykernel 4.6.1 <pip> ipython 5.1.0 py27_1 defaults ipython 5.4.1 <pip> ipython_genutils 0.1.0 py27_0 defaults ipywidgets 6.0.0 <pip> ipywidgets 5.2.2 py27_1 defaults isbnlib 3.7.2 <pip> isort 4.2.5 py27_0 defaults itchat 1.3.10 <pip> itsdangerous 0.24 py27_0 defaults jbig 2.1 0 defaults jdcal 1.3 py27_0 defaults jedi 0.10.2 <pip> jedi 0.9.0 py27_1 defaults jieba 0.39 <pip> jinja2 2.9.4 py27_0 defaults jinja2-time 0.2.0 <pip> joblib 0.11 <pip> jpeg 9b 0 defaults js2xml 0.3.1 <pip> json-lines 0.3.1 <pip> jsonschema 2.5.1 py27_0 defaults jsonschema 2.6.0 <pip> jupyter 1.0.0 py27_3 defaults jupyter-client 5.0.1 <pip> jupyter-core 4.3.0 <pip> jupyter_client 4.4.0 py27_0 defaults jupyter_console 5.0.0 py27_0 defaults jupyter_core 4.2.1 py27_0 defaults kii-client 0.1.3 <pip> kombu 3.0.37 <pip> lazy-object-proxy 1.2.2 py27_0 defaults libiconv 1.14 0 defaults libpng 1.6.27 0 defaults libtiff 4.0.6 3 defaults libxml2 2.9.4 0 defaults libxslt 1.1.29 0 defaults line-profiler 2.0 <pip> llvmlite 0.18.0 py27_0 defaults locket 0.2.0 py27_1 defaults lxml 3.7.2 py27_0 defaults magic-wormhole 0.10.2 <pip> Markdown 2.2.0 <pip> markupsafe 0.23 py27_2 defaults matplotlib 2.0.2 np112py27_0 defaults mccabe 0.6.1 <pip> meld3 1.0.2 <pip> mistune 0.7.4 <pip> mistune 0.7.3 py27_1 defaults mkl 2017.0.1 0 defaults mkl-service 1.1.2 py27_3 defaults more-itertools 3.2.0 <pip> mpmath 0.19 py27_1 defaults multipledispatch 0.4.9 py27_0 defaults mysql 0.0.1 <pip> MySQL-python 1.2.5 <pip> nbconvert 4.2.0 py27_0 defaults nbconvert 5.2.1 <pip> nbformat 4.2.0 py27_0 defaults nbformat 4.3.0 <pip> ncmbot 0.1.6 <pip> networkx 1.11 py27_0 defaults nlib 0.6 <pip> nltk 3.2.2 py27_0 defaults nolearn 0.5b1 <pip> nose 1.3.7 py27_1 defaults notebook 5.0.0 <pip> notebook 4.3.1 py27_0 defaults numba 0.33.0 np112py27_0 defaults numexpr 2.6.2 np112py27_0 defaults numpy 1.12.1 py27_0 defaults numpydoc 0.6.0 py27_0 defaults odo 0.5.0 py27_1 defaults olefile 0.44 <pip> openapi-codec 1.3.2 <pip> opencv-python 3.2.0.7 <pip> openface 0.2.1 <pip> openpyxl 2.4.1 py27_0 defaults openssl 1.0.2n hdbc3d79_0 defaults org-client 0.4.12 <pip> packaging 16.8 <pip> pandas 0.17.1 <pip> pandas 0.20.2 np112py27_0 defaults pandocfilters 1.4.1 <pip> paramiko 2.3.1 <pip> parse-accept-language 0.1.2 <pip> parsel 1.2.0 <pip> partd 0.3.7 py27_0 defaults passlib 1.7.1 <pip> PasteDeploy 1.5.2 <pip> path.py 10.0 py27_0 defaults pathlib 1.0.1 <pip> pathlib2 2.2.0 py27_0 defaults patsy 0.4.1 py27_0 defaults pendulum 1.0.2 <pip> pep8 1.7.0 py27_0 defaults petl 1.1.1 <pip> pew 1.1.2 <pip> pexpect 4.2.1 py27_0 defaults pickleshare 0.7.4 py27_0 defaults pigar 0.7.0 <pip> pillow 4.0.0 py27_0 defaults pip 9.0.1 py27h1567d89_4 defaults pip-tools 1.9.0 <pip> pipreqs 0.4.9 <pip> pkginfo 1.4.1 <pip> pkginfo 1.4.1 py27_0 defaults pluggy 0.4.0 <pip> ply 3.9 py27_0 defaults poyo 0.4.1 <pip> pprofile 1.11.0 <pip> profiling 0.1.3 <pip> progressbar 2.3 <pip> prompt_toolkit 1.0.9 py27_0 defaults protobuf 3.3.0 <pip> psutil 5.0.1 py27_0 defaults psycopg2 2.7.1 <pip> ptpython 0.39 <pip> ptyprocess 0.5.1 py27_0 defaults py 1.4.32 py27_0 defaults py-heat 0.0.2 <pip> py-heat-magic 0.0.2 <pip> pyasn1 0.1.9 py27_0 defaults pyasn1-modules 0.0.10 <pip> pyaudio 0.2.7 py27_0 defaults pycodestyle 2.3.1 <pip> pycosat 0.6.3 py27h6c51c7e_0 defaults pycparser 2.17 py27_0 defaults pycrypto 2.6.1 py27_4 defaults pycurl 7.43.0 py27_2 defaults PyDispatcher 2.0.5 <pip> pyflakes 1.5.0 py27_0 defaults pyglet 1.2.4 <pip> pygments 2.1.3 py27_0 defaults pylint 1.6.4 py27_1 defaults pymongo 3.5.1 <pip> PyMySQL 0.7.11 <pip> PyNaCl 1.1.2 <pip> pyopenssl 16.2.0 py27_0 defaults pyparsing 2.1.4 py27_0 defaults pyparsing 2.2.0 <pip> pypng 0.0.18 <pip> PyQRCode 1.2.1 <pip> pyqt 5.6.0 py27_1 defaults pyquery 1.3.0 <pip> pyramid 1.8.3 <pip> pyramid-chameleon 0.3 <pip> pyresttest 1.7.2.dev0 <pip> pyspider 0.3.9 <pip> pytables 3.3.0 np112py27_0 defaults pytest 3.0.5 py27_0 defaults python 2.7.13 0 defaults python-cjson 1.2.1 <pip> python-dateutil 2.6.0 py27_0 defaults python-mimeparse 1.6.0 <pip> python.app 1.2 py27_4 defaults pythonpy 0.4.11 <pip> pytz 2016.10 py27_0 defaults pywavelets 0.5.2 np112py27_0 defaults pyyaml 3.12 py27_0 defaults pyzmq 16.0.2 py27_0 defaults qiniu 7.2.0 <pip> qt 5.6.2 0 defaults qtawesome 0.4.3 py27_0 defaults qtconsole 4.2.1 py27_1 defaults qtmodern 0.1.4 <pip> qtpy 1.2.1 py27_0 defaults QtPy 1.3.1 <pip> queuelib 1.4.2 <pip> raven 6.0.0 <pip> readline 6.2 2 defaults readme-renderer 17.2 <pip> redis 3.2.0 0 defaults redis-py 2.10.5 py27_0 defaults repoze.lru 0.6 <pip> requestium 0.1.9 <pip> requests 2.12.4 py27_0 defaults requests 2.18.4 <pip> requests-file 1.4.2 <pip> rope 0.9.4 py27_1 defaults ruamel_yaml 0.11.14 py27_1 defaults scandir 1.4 py27_0 defaults scikit-image 0.13.0 np112py27_0 defaults scikit-learn 0.18.2 np112py27_0 defaults scikit-learn 0.17.1 <pip> scipy 0.19.1 np112py27_0 defaults scipy 0.16.1 <pip> Scrapy 1.4.0 <pip> seaborn 0.7.1 py27_0 defaults selenium 3.8.0 <pip> serpy 0.1.1 <pip> service-identity 17.0.0 <pip> setuptools 38.4.0 py27_0 defaults setuptools 38.4.0 <pip> shutilwhich 1.1.0 <pip> simplegeneric 0.8.1 py27_1 defaults simplejson 3.11.1 <pip> singledispatch 3.4.0.3 py27_0 defaults sip 4.18 py27_0 defaults six 1.10.0 py27_0 defaults sklearn 0.0 <pip> slimit 0.8.1 <pip> snowballstemmer 1.2.1 py27_0 defaults sockjs-tornado 1.0.3 py27_0 defaults spake2 0.7 <pip> speechpy 1.1 <pip> sphinx 1.5.1 py27_0 defaults spyder 3.1.2 py27_0 defaults sqlalchemy 1.1.5 py27_0 defaults sqlite 3.13.0 0 defaults ssl_match_hostname 3.4.0.2 py27_1 defaults sso-auth-drf 1.4.2 <pip> statsmodels 0.8.0 np112py27_0 defaults subprocess32 3.2.7 py27_0 defaults supervisor 3.3.2 <pip> sympy 1.0 py27_0 defaults tblib 1.3.2 <pip> tensorflow 1.2.0 <pip> terminado 0.6 py27_0 defaults terminaltables 3.1.0 <pip> testpath 0.3.1 <pip> textrank4zh 0.3 <pip> tflearn 0.3.2 <pip> tk 8.5.18 0 defaults tldextract 2.2.0 <pip> toolz 0.8.2 py27_0 defaults tornado 4.4.2 py27_0 defaults tornado 4.5.1 <pip> tox 2.7.0 <pip> tqdm 4.15.0 <pip> traitlets 4.3.1 py27_0 defaults translationstring 1.3 <pip> Twisted 17.5.0 <pip> txaio 2.8.1 <pip> txtorcon 0.19.3 <pip> u-msgpack-python 2.4.1 <pip> unicodecsv 0.14.1 py27_0 defaults urllib3 1.22 <pip> urwid 1.3.1 <pip> valuedispatch 0.0.1 <pip> venusian 1.1.0 <pip> virtualenv 15.1.0 <pip> virtualenv-clone 0.2.6 <pip> w3lib 1.18.0 <pip> waitress 1.0.2 <pip> wcwidth 0.1.7 py27_0 defaults web.py 0.38 <pip> webencodings 0.5.1 <pip> WebOb 1.7.2 <pip> weibo 0.2.2 <pip> Werkzeug 0.12.1 <pip> werkzeug 0.11.15 py27_0 defaults wheel 0.29.0 py27_0 defaults whichcraft 0.4.1 <pip> Whoosh 2.7.4 <pip> widgetsnbextension 2.0.0 <pip> widgetsnbextension 1.2.6 py27_0 defaults wrapt 1.10.8 py27_0 defaults WsgiDAV 2.2.4 <pip> xlrd 1.0.0 py27_0 defaults xlsxwriter 0.9.6 py27_0 defaults xlwings 0.10.2 py27_0 defaults xlwt 1.2.0 py27_0 defaults xz 5.2.2 1 defaults yaml 0.1.6 0 defaults yarg 0.1.9 <pip> zlib 1.2.8 3 defaults zoo-client 0.7.8 <pip> zope.deprecation 4.2.0 <pip> zope.interface 4.4.1 <pip> ```
Have the same issue after an update The same issue +1 The same issue +1 Can someone who is having this problem please give me the output of CONDA_VERBOSE=3 conda shell.posix activate base For people having this problem, please give me step-by-step setup and commands I can use to reproduce this myself. ``` → source activate py3 Traceback (most recent call last): File "/Users/sherbein/opt/miniconda2/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/Users/sherbein/opt/miniconda2/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/Users/sherbein/opt/miniconda2/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/Users/sherbein/opt/miniconda2/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/Users/sherbein/opt/miniconda2/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/Users/sherbein/opt/miniconda2/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 447 Logged from file exceptions.py, line 724 ``` ``` → CONDA_VERBOSE=3 conda shell.posix activate base PS1='(base) ' export CONDA_DEFAULT_ENV='base' export CONDA_PREFIX='/Users/sherbein/opt/miniconda2' export CONDA_PROMPT_MODIFIER='(base) ' export CONDA_PYTHON_EXE='/Users/sherbein/opt/miniconda2/bin/python' export CONDA_SHLVL='1' export PATH='/Users/sherbein/opt/miniconda2/bin:/Users/sherbein/opt/miniconda2/bin:/Users/sherbein/.cargo/bin:/usr/local/bin:/usr/local/texlive/2016/bin/x86_64-darwin:/usr/local/sbin:/Users/sherbein/.dotfiles/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/sherbein/.antigen/bundles/robbyrussell/oh-my-zsh/lib:/Users/sherbein/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/git:/Users/sherbein/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/command-not-found:/Users/sherbein/.antigen/bundles/zsh-users/zsh-syntax-highlighting' ``` FWIW, I get the exact same error when I try and use `conda activate py3` (both before and after removing conda from my PATH and sourcing `conda.sh` in `etc/profile.d`) @SteVwonder: Can you show the output of ``` /Users/sherbein/opt/miniconda2/bin/python -c 'import conda; conda.CondaError.__str__ = lambda self: "\n".join(map(conda.text_type, [self.message, self._kwargs])); from conda.cli.main import main; main("conda", "shell.posix", "activate", "py3")' ``` ? ``` → /Users/sherbein/opt/miniconda2/bin/python -c 'import conda; conda.CondaError.__str__ = lambda self: "\n".join(map(conda.text_type, [self.message, self._kwargs])); from conda.cli.main import main; main("conda", "shell.posix", "activate", "py3")' # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/Users/sherbein/opt/miniconda2/lib/python2.7/site-packages/conda/cli/main.py", line 111, in main return activator_main() File "/Users/sherbein/opt/miniconda2/lib/python2.7/site-packages/conda/activate.py", line 551, in main assert len(argv) >= 3 AssertionError `$ -c` environment variables: CIO_TEST=<not set> CONDA_ROOT=/Users/sherbein/opt/miniconda2 PATH=/Users/sherbein/opt/miniconda2/bin:/Users/sherbein/.cargo/bin:/usr/loc al/bin:/usr/local/texlive/2016/bin/x86_64-darwin:/usr/local/sbin:/User s/sherbein/.dotfiles/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin: /Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/o pt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/sherbein/ .antigen/bundles/robbyrussell/oh-my- zsh/lib:/Users/sherbein/.antigen/bundles/robbyrussell/oh-my- zsh/plugins/git:/Users/sherbein/.antigen/bundles/robbyrussell/oh-my- zsh/plugins/command-not-found:/Users/sherbein/.antigen/bundles/zsh- users/zsh-syntax-highlighting PKG_CONFIG_PATH=/Users/sherbein/.local/munge/0.5.13/lib/pkgconfig REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> SUDO_EDITOR=emacsclient -nw active environment : None user config file : /Users/sherbein/.condarc populated config files : conda version : 4.4.7 conda-build version : not installed python version : 2.7.14.final.0 base environment : /Users/sherbein/opt/miniconda2 (writable) channel URLs : https://repo.continuum.io/pkgs/main/osx-64 https://repo.continuum.io/pkgs/main/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 package cache : /Users/sherbein/opt/miniconda2/pkgs /Users/sherbein/.conda/pkgs envs directories : /Users/sherbein/opt/miniconda2/envs /Users/sherbein/.conda/envs platform : osx-64 user-agent : conda/4.4.7 requests/2.18.4 CPython/2.7.14 Darwin/17.3.0 OSX/10.13.2 UID:GID : 501:20 netrc file : None offline mode : False ``` Ah, there was an error in the command I wrote down, sorry. Can you try ``` /Users/sherbein/opt/miniconda2/bin/python -c 'import conda; conda.CondaError.__str__ = lambda self: "\n".join(map(conda.text_type, [self.message, self._kwargs])); from conda.cli.main import main; import sys; sys.argv[:]=["conda", "shell.posix", "activate", "py3"]; main()' ``` instead? ``` PS1='(py3) ' export CONDA_DEFAULT_ENV='py3' export CONDA_PREFIX='/Users/sherbein/opt/miniconda2/envs/py3' export CONDA_PROMPT_MODIFIER='(py3) ' export CONDA_PYTHON_EXE='/Users/sherbein/opt/miniconda2/bin/python' export CONDA_SHLVL='1' export PATH='/Users/sherbein/opt/miniconda2/envs/py3/bin:/Users/sherbein/opt/miniconda2/bin:/Users/sherbein/.cargo/bin:/usr/local/bin:/usr/local/texlive/2016/bin/x86_64-darwin:/usr/local/sbin:/Users/sherbein/.dotfiles/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/sherbein/.antigen/bundles/robbyrussell/oh-my-zsh/lib:/Users/sherbein/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/git:/Users/sherbein/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/command-not-found:/Users/sherbein/.antigen/bundles/zsh-users/zsh-syntax-highlighting' ``` Now that's strange.. I don't understand how your previous `source activate py3` was able to error out. The Python code that gets executed by `source activate` should be the same as with `conda shell.posix activate py3` which didn't fail somehow... Can you show ``` head /Users/sherbein/opt/miniconda2/etc/profile.d/conda.sh ``` ? ``` → head /Users/sherbein/opt/miniconda2/etc/profile.d/conda.sh _CONDA_EXE="/Users/sherbein/opt/miniconda2/bin/conda" _CONDA_ROOT="/Users/sherbein/opt/miniconda2" _conda_set_vars() { # set _CONDA_SHELL_FLAVOR if [ -n "${BASH_VERSION:+x}" ]; then _CONDA_SHELL_FLAVOR=bash elif [ -n "${ZSH_VERSION:+x}" ]; then _CONDA_SHELL_FLAVOR=zsh elif [ -n "${KSH_VERSION:+x}" ]; then _CONDA_SHELL_FLAVOR=ksh ``` And you can still reproduce the error with `source activate py3`? ``` → source activate py3 Traceback (most recent call last): File "/Users/sherbein/opt/miniconda2/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/Users/sherbein/opt/miniconda2/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/Users/sherbein/opt/miniconda2/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/Users/sherbein/opt/miniconda2/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/Users/sherbein/opt/miniconda2/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/Users/sherbein/opt/miniconda2/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 447 Logged from file exceptions.py, line 724 → eval $(conda shell.posix activate py3) → which python /Users/sherbein/opt/miniconda2/envs/py3/bin/python ``` What is `which activate` and `cat $(which activate)` ? ``` → which activate /Users/sherbein/opt/miniconda2/bin/activate → cat $(which activate) #!/bin/sh _CONDA_ROOT="/Users/sherbein/opt/miniconda2" #!/bin/sh _conda_set_vars() { # set _CONDA_SHELL_FLAVOR if [ -n "${BASH_VERSION:+x}" ]; then _CONDA_SHELL_FLAVOR=bash elif [ -n "${ZSH_VERSION:+x}" ]; then _CONDA_SHELL_FLAVOR=zsh elif [ -n "${KSH_VERSION:+x}" ]; then _CONDA_SHELL_FLAVOR=ksh elif [ -n "${POSH_VERSION:+x}" ]; then _CONDA_SHELL_FLAVOR=posh else # https://unix.stackexchange.com/a/120138/92065 local _q="$(ps -p$$ -o cmd="",comm="",fname="" 2>/dev/null | sed 's/^-//' | grep -oE '\w+' | head -n1)" if [ "$_q" = dash ]; then _CONDA_SHELL_FLAVOR=dash else (>&2 echo "Unrecognized shell.") return 1 fi fi # https://unix.stackexchange.com/questions/4650/determining-path-to-sourced-shell-script/ local script_dir case "$_CONDA_SHELL_FLAVOR" in bash) script_dir="$(dirname "${BASH_SOURCE[0]}")";; zsh) script_dir="$(dirname "${(%):-%x}")";; # http://stackoverflow.com/a/28336473/2127762 dash) x=$(lsof -p $$ -Fn0 | tail -1); script_dir="$(dirname "${x#n}")";; *) script_dir="$(cd "$(dirname "$_")" && echo "$PWD")";; esac if [ -z "${_CONDA_ROOT+x}" ]; then _CONDA_ROOT="$(dirname "$script_dir")" fi } _conda_script_is_sourced() { # http://stackoverflow.com/a/28776166/2127762 sourced=0 if [ -n "${ZSH_EVAL_CONTEXT:+x}" ]; then case $ZSH_EVAL_CONTEXT in *:file) sourced=1;; esac elif [ -n "${KSH_VERSION:+x}" ]; then [ "$(cd $(dirname -- $0) && pwd -P)/$(basename -- $0)" != "$(cd $(dirname -- ${.sh.file}) && pwd -P)/$(basename -- ${.sh.file})" ] && sourced=1 elif [ -n "${BASH_VERSION:+x}" ]; then [ "${BASH_SOURCE[0]}" = "$0" ] && sourced=1 else # All other shells: examine $0 for known shell binary filenames # Detects `sh` and `dash`; add additional shell filenames as needed. case ${0##*/} in sh|dash) sourced=0;; *) sourced=1;; esac fi return $sourced } if ! _conda_script_is_sourced; then ( >&2 echo "Error: activate must be sourced. Run 'source activate envname'" >&2 echo "instead of 'activate envname'." ) exit 1 fi _conda_set_vars . "$_CONDA_ROOT/etc/profile.d/conda.sh" || return $? _conda_activate "$@" ``` I have still no clue.. What does ``` (set -x ; source activate py3) ``` output? Oh. Good call. That might be it. I'm guessing this has to do with my zsh prompt (which I have been excluding from the above posts to hide my IP address/hostname, but is included here) ``` # sherbein at roaming-4-24-60.host.udel.edu in ~ [17:01:58] → (set -x ; source activate py3) +-zsh:1> source activate py3 +/Users/sherbein/opt/miniconda2/bin/activate:2> _CONDA_ROOT=/Users/sherbein/opt/miniconda2 +/Users/sherbein/opt/miniconda2/bin/activate:57> _conda_script_is_sourced +_conda_script_is_sourced:2> sourced=0 +_conda_script_is_sourced:3> [ -n x ']' +_conda_script_is_sourced:4> case toplevel:file:shfunc (*:file) +_conda_script_is_sourced:13> return 0 +/Users/sherbein/opt/miniconda2/bin/activate:65> _conda_set_vars +_conda_set_vars:2> [ -n '' ']' +_conda_set_vars:4> [ -n x ']' +_conda_set_vars:5> _CONDA_SHELL_FLAVOR=zsh +_conda_set_vars:22> local script_dir +_conda_set_vars:23> case zsh (bash) +_conda_set_vars:23> case zsh (zsh) +_conda_set_vars:25> script_dir=+_conda_set_vars:25> dirname /Users/sherbein/opt/miniconda2/bin/activate +_conda_set_vars:25> script_dir=/Users/sherbein/opt/miniconda2/bin +_conda_set_vars:30> [ -z x ']' +/Users/sherbein/opt/miniconda2/bin/activate:66> . /Users/sherbein/opt/miniconda2/etc/profile.d/conda.sh +/Users/sherbein/opt/miniconda2/etc/profile.d/conda.sh:1> _CONDA_EXE=/Users/sherbein/opt/miniconda2/bin/conda +/Users/sherbein/opt/miniconda2/etc/profile.d/conda.sh:2> _CONDA_ROOT=/Users/sherbein/opt/miniconda2 +/Users/sherbein/opt/miniconda2/etc/profile.d/conda.sh:105> _conda_set_vars +_conda_set_vars:2> [ -n '' ']' +_conda_set_vars:4> [ -n x ']' +_conda_set_vars:5> _CONDA_SHELL_FLAVOR=zsh +_conda_set_vars:15> [ -z x ']' +_conda_set_vars:29> [ -z x ']' +/Users/sherbein/opt/miniconda2/etc/profile.d/conda.sh:107> [ -z x ']' +/Users/sherbein/opt/miniconda2/bin/activate:67> _conda_activate py3 +_conda_activate:1> [ -n '' ']' +_conda_activate:8> local ask_conda +_conda_activate:9> ask_conda=+_conda_activate:9> PS1=$'\n%{\C-[[1m\C-[[34m%}#%{\C-[[00m%} %{\C-[[36m%}%n %{\C-[[37m%}at %{\C-[[32m%}roaming-4-24-60.host.udel.edu %{\C-[[37m%}in %{\C-[[1m\C-[[33m%}${PWD/#$HOME/~}%{\C-[[00m%}$(ys_hg_prompt_info)$(git_prompt_info) %{\C-[[37m%}[%*]\n%{\C-[[1m\C-[[31m%}→ %{\C-[[00m%}' /Users/sherbein/opt/miniconda2/bin/conda shell.posix activate py3 Traceback (most recent call last): File "/Users/sherbein/opt/miniconda2/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/Users/sherbein/opt/miniconda2/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/Users/sherbein/opt/miniconda2/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/Users/sherbein/opt/miniconda2/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/Users/sherbein/opt/miniconda2/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/Users/sherbein/opt/miniconda2/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 447 Logged from file exceptions.py, line 724 +_conda_activate:9> ask_conda='' +_conda_activate:9> return 1 ``` ``` # sherbein at roaming-4-24-60.host.udel.edu in ~ [17:04:06] → export PS1="#" # #source activate py3 (py3) # ``` Running `conda config --set changeps1 False` fixed this problem for me. Thanks @mbargull for helping me track this down! I know how frustrating remote troubleshooting can be. I appreciate your time and effort on this! You're welcome. The funny thing is that the first things I tried was a `PS1='%}'` and `PS1='→'` 🙄 . The minimal working reproducer is the concatenation `PS1='%}→` 😆. So the actual error is just ``` $ PS1=→ →source activate EncodingError: A unicode encoding or decoding error has occurred. Python 2 is the interpreter under which conda is running in your base environment. Replacing your base environment with one having Python 3 may help resolve this issue. If you still have a need for Python 2 environments, consider using 'conda create' and 'conda activate'. For example: $ conda create -n py2 python=2 $ conda activate py2 Error details: UnicodeDecodeError('ascii', '\xe2\x86\x92', 0, 1, 'ordinal not in range(128)') ``` but that gets masked by another bug that happens during error reporting: https://github.com/conda/conda/issues/6759. My general advice would be to always use Miniconda3 and use Python 2 in a separate environment, i.e., ``` conda create -n py2 python=2 ``` or if you use `anaconda` then ``` conda create -n anaconda2 python=2 anaconda ``` . That way, `conda` itself will always use Python 3 and doesn't run into those Unicode decoding errors. Many thx! @mbargull fixed! From https://github.com/conda/conda/issues/6753#issuecomment-359110810, the root-cause stack trace here is ``` Traceback (most recent call last): File "/Users/rthomas/bug/env/lib/python2.7/site-packages/conda/cli/main.py", line 111, in main return activator_main() File "/Users/rthomas/bug/env/lib/python2.7/site-packages/conda/activate.py", line 557, in main print(activator.execute(), end='') File "/Users/rthomas/bug/env/lib/python2.7/site-packages/conda/activate.py", line 149, in execute return getattr(self, self.command)() File "/Users/rthomas/bug/env/lib/python2.7/site-packages/conda/activate.py", line 135, in activate return self._finalize(self._yield_commands(self.build_activate(self.env_name_or_prefix)), File "/Users/rthomas/bug/env/lib/python2.7/site-packages/conda/activate.py", line 267, in build_activate self._update_prompt(set_vars, conda_prompt_modifier) File "/Users/rthomas/bug/env/lib/python2.7/site-packages/conda/activate.py", line 456, in _update_prompt ps1 = ps1.replace("'", "'\"'\"'") EncodingError: <unprintable EncodingError object> ```
2018-01-24T12:11:29Z
[]
[]
Traceback (most recent call last): File "/anaconda/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/anaconda/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/anaconda/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 513
4,284
conda/conda
conda__conda-6847
158599161fcfcce024bf8257c7278a10fb3085e2
diff --git a/conda/common/path.py b/conda/common/path.py --- a/conda/common/path.py +++ b/conda/common/path.py @@ -8,7 +8,7 @@ import re import subprocess -from .compat import on_win, string_types +from .compat import PY2, ensure_fs_path_encoding, on_win, string_types from .. import CondaError from .._vendor.auxlib.decorators import memoize @@ -46,6 +46,8 @@ def is_path(value): def expand(path): + if on_win and PY2: + path = ensure_fs_path_encoding(path) return abspath(expanduser(expandvars(path)))
Conda(py2) Installation to a path (ascii characters only) with non-ascii characters in username Create a user with non-ascii characters in name. And try to install Miniconda2 to a path with only ascii characters ``` C:\Users\AndrésGarcía\Downloads>start /wait "" Miniconda2-4.3.30.2-Windows-x86_64.exe /InstallationType=JustMe /AddToPath=0 /RegisterPython=0 /NoRegistry=1 /S /D=C:\AG\mc2 ``` This will throw a menuinst traceback, ignore for now. See https://github.com/ContinuumIO/menuinst/issues/54 Then try to activate the base environment: ``` C:\Users\AndrésGarcía\Downloads>cd /d C:\AG\mc2 C:\AG\mc2>Scripts\activate Traceback (most recent call last): File "C:\AG\mc2\Scripts\conda-script.py", line 10, in <module> sys.exit(main()) File "C:\AG\mc2\lib\site-packages\conda\cli\main.py", line 178, in main init_loggers() File "C:\AG\mc2\lib\site-packages\conda\cli\main.py", line 84, in init_loggers from ..console import setup_verbose_handlers File "C:\AG\mc2\lib\site-packages\conda\console.py", line 9, in <module> from .base.context import context File "C:\AG\mc2\lib\site-packages\conda\base\context.py", line 771, in <module> context = Context(SEARCH_PATH, APP_NAME, None) File "C:\AG\mc2\lib\site-packages\conda\common\configuration.py", line 727, in __init__ self._set_search_path(search_path) File "C:\AG\mc2\lib\site-packages\conda\common\configuration.py", line 745, in _set_search_path self._set_raw_data(load_file_configs(search_path)) File "C:\AG\mc2\lib\site-packages\conda\common\configuration.py", line 364, in load_file_configs expanded_paths = tuple(expand(path) for path in search_path) File "C:\AG\mc2\lib\site-packages\conda\common\configuration.py", line 364, in <genexpr> expanded_paths = tuple(expand(path) for path in search_path) File "C:\AG\mc2\lib\site-packages\conda\common\path.py", line 247, in expand return abspath(expanduser(expandvars(path))) File "C:\AG\mc2\lib\ntpath.py", line 311, in expanduser return userhome + path[i:] UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 13: ordinal not in range(128) C:\AG\mc2> ```
`C:\AG\mc2\lib\ntpath.py` is a part of the CPython stdlib, I don't really see what we can do about this. You just cannot have any unicode in `PATH` or in `%UserProfile%` on Python 2 AFAICT. @zooba what do you recommend? Probably best to detect Python 2 and pre-encode to `sys.getfilesystemencoding()` in `conda\common\path.py`. `expandvars` will do this automatically, but it looks like `expanduser` does not. You can preempt some of the edge-case failures by decoding back to Unicode and seeing if the path has changed (which means a username outside of the active code page), but unfortunately there's no real way to handle this properly in Python 2.x. You're sure to have plenty of other issues in this case though, so as long as you're encoding with `getfilesystemencoding` and not `ascii`, it's about the best option.
2018-02-06T17:47:23Z
[]
[]
Traceback (most recent call last): File "C:\AG\mc2\Scripts\conda-script.py", line 10, in <module> sys.exit(main()) File "C:\AG\mc2\lib\site-packages\conda\cli\main.py", line 178, in main init_loggers() File "C:\AG\mc2\lib\site-packages\conda\cli\main.py", line 84, in init_loggers from ..console import setup_verbose_handlers File "C:\AG\mc2\lib\site-packages\conda\console.py", line 9, in <module> from .base.context import context File "C:\AG\mc2\lib\site-packages\conda\base\context.py", line 771, in <module> context = Context(SEARCH_PATH, APP_NAME, None) File "C:\AG\mc2\lib\site-packages\conda\common\configuration.py", line 727, in __init__ self._set_search_path(search_path) File "C:\AG\mc2\lib\site-packages\conda\common\configuration.py", line 745, in _set_search_path self._set_raw_data(load_file_configs(search_path)) File "C:\AG\mc2\lib\site-packages\conda\common\configuration.py", line 364, in load_file_configs expanded_paths = tuple(expand(path) for path in search_path) File "C:\AG\mc2\lib\site-packages\conda\common\configuration.py", line 364, in <genexpr> expanded_paths = tuple(expand(path) for path in search_path) File "C:\AG\mc2\lib\site-packages\conda\common\path.py", line 247, in expand return abspath(expanduser(expandvars(path))) File "C:\AG\mc2\lib\ntpath.py", line 311, in expanduser return userhome + path[i:] UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 13: ordinal not in range(128)
4,296
conda/conda
conda__conda-6867
31a52a8a8771aafb0582822dd2e00b3274e1ffba
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 @@ -7,10 +7,11 @@ from os import rename as os_rename, utime from os.path import dirname, isdir import re +from shutil import move from . import exp_backoff_fn, mkdir_p, mkdir_p_sudo_safe from .delete import rm_rf -from .link import islink, lexists +from .link import lexists from ...common.compat import on_win from ...common.path import expand from ...exceptions import NotWritableError @@ -44,15 +45,6 @@ def update_file_in_place_as_binary(file_full_path, callback): fh.close() -def _copy_then_remove(source_path, destination_path): - from .create import copy, create_hard_link_or_copy - if islink(source_path): - copy(source_path, destination_path) - else: - create_hard_link_or_copy(source_path, destination_path) - rm_rf(source_path) - - def rename(source_path, destination_path, force=False): if lexists(destination_path) and force: rm_rf(destination_path) @@ -62,10 +54,13 @@ def rename(source_path, destination_path, force=False): os_rename(source_path, destination_path) except EnvironmentError as e: if e.errno in (EINVAL, EXDEV): - # see https://github.com/conda/conda/issues/6711 - log.trace("Could not rename do to errno [%s]. Falling back to copy/remove.", - e.errno) - _copy_then_remove(source_path, destination_path) + # https://github.com/conda/conda/issues/6811 + # https://github.com/conda/conda/issues/6711 + log.trace("Could not rename %s => %s due to errno [%s]. Falling back" + " to copy/unlink", source_path, destination_path, e.errno) + # https://github.com/moby/moby/issues/25409#issuecomment-238537855 + # shutil.move() falls back to copy+unlink + move(source_path, destination_path) else: raise else:
IsADirectoryError **I'm submitting a...** - [X] bug report ## Current Behavior When installing certain packages it will break with IsADirectoryError ``` <<HTTPS 200 OK < Accept-Ranges: bytes < Content-Disposition: attachment; filename="six-1.11.0-py35h423b573_1.tar.bz2"; filename*=UTF-8''six-1.11.0-py35h423b573_1.tar.bz2 < Content-Type: application/x-tar < Date: Mon, 29 Jan 2018 11:43:42 GMT < ETag: "576d38abfcb7ceb3b323b802b1fec665" < Last-Modified: Sat, 21 Oct 2017 18:55:29 GMT < Server: AmazonS3 < x-amz-id-2: IGiKj9lk7QKmYRYyZCVaUEM4Ax19T3slC8e1+ZVXTR3gT5Hg9UNd/8CxoS9yDWZt5PdfORpg9mo= < x-amz-request-id: 8A668C11FD79A607 < Content-Length: 21870 < Elapsed: 00:00.106578 TRACE conda.core.path_actions:execute(1238): extracting /opt/conda/pkgs/six-1.11.0-py35h423b573_1.tar.bz2 => /opt/conda/pkgs/six-1.11.0-py35h423b573_1 TRACE conda.gateways.disk.update:rename(60): renaming /opt/conda/pkgs/six-1.11.0-py35h423b573_1 => /opt/conda/pkgs/six-1.11.0-py35h423b573_1.c~ DEBUG conda.gateways.disk.create:extract_tarball(132): extracting /opt/conda/pkgs/six-1.11.0-py35h423b573_1.tar.bz2 to /opt/conda/pkgs/six-1.11.0-py35h423b573_1 TRACE conda.gateways.disk.create:write_as_json_to_file(61): writing json to file /opt/conda/pkgs/six-1.11.0-py35h423b573_1/info/repodata_record.json TRACE conda.gateways.disk.create:write_as_json_to_file(61): writing json to file /opt/conda/pkgs/six-1.11.0-py35h423b573_1/info/repodata_record.json TRACE conda.gateways.disk.delete:rm_rf(29): rm_rf /opt/conda/pkgs/six-1.11.0-py35h423b573_1.tar.bz2.c~ TRACE conda.gateways.disk.delete:rm_rf(29): rm_rf /opt/conda/pkgs/six-1.11.0-py35h423b573_1.c~ DEBUG conda.common.signals:signal_handler(56): de-registering handler for Signals.SIGIOT DEBUG conda.common.signals:signal_handler(56): de-registering handler for Signals.SIGINT DEBUG conda.common.signals:signal_handler(56): de-registering handler for Signals.SIGTERM DEBUG conda.common.signals:signal_handler(56): de-registering handler for Signals.SIGQUIT Traceback (most recent call last): File "/opt/conda/lib/python3.5/site-packages/conda/exceptions.py", line 772, in __call__ return func(*args, **kwargs) File "/opt/conda/lib/python3.5/site-packages/conda_env/cli/main.py", line 74, in do_call exit_code = getattr(module, func_name)(args, parser) File "/opt/conda/lib/python3.5/site-packages/conda_env/cli/main_update.py", line 107, in execute installer.install(prefix, specs, args, env) File "/opt/conda/lib/python3.5/site-packages/conda_env/installers/conda.py", line 38, in install pfe.execute() File "/opt/conda/lib/python3.5/site-packages/conda/core/package_cache.py", line 590, in execute raise CondaMultiError(exceptions) conda.CondaMultiError: [Errno 21] Is a directory: '/opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0' [Errno 21] Is a directory: '/opt/conda/pkgs/libedit-3.1-heed3624_0' ``` ### Steps to Reproduce - run the continuumio/miniconda3 docker image - run `conda update conda` - create a file test.yaml with the following contents: ``` name: test dependencies: - lxml==3.7.2 - anaconda::redis-py==2.10.5 - beautifulsoup4==4.5.3 - feedparser==5.2.1 - html5lib==0.999 - w3lib==1.16.0 - clinicalgraphics::libgcrypt11=1 - python=3.5 ``` - run `conda env update -f test.yaml` ## Expected Behavior It should install without problems ## Environment Information ``` active environment : None user config file : /root/.condarc populated config files : conda version : 4.4.8 conda-build version : not installed python version : 3.6.2.final.0 base environment : /opt/conda (writable) channel URLs : https://repo.continuum.io/pkgs/main/linux-64 https://repo.continuum.io/pkgs/main/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch package cache : /opt/conda/pkgs /root/.conda/pkgs envs directories : /opt/conda/envs /root/.conda/envs platform : linux-64 user-agent : conda/4.4.8 requests/2.18.4 CPython/3.6.2 Linux/4.4.0-112-generic debian/8 glibc/2.19 UID:GID : 0:0 netrc file : None offline mode : False ``` </p></details> <details open><summary><code>`conda config --show-sources`</code></summary><p> ``` ``` </p></details> <details><summary><code>`conda list --show-channel-urls`</code></summary><p> <!-- between the ticks below, paste the output of 'conda list --show-channel-urls' --> ``` # packages in environment at /opt/conda: # # Name Version Build Channel asn1crypto 0.22.0 py36h265ca7c_1 defaults ca-certificates 2017.08.26 h1d4fec5_0 defaults certifi 2017.7.27.1 py36h8b7b77e_0 defaults cffi 1.10.0 py36had8d393_1 defaults chardet 3.0.4 py36h0f667ec_1 defaults conda 4.4.8 py36_0 defaults conda-env 2.6.0 h36134e3_1 defaults cryptography 2.0.3 py36ha225213_1 defaults idna 2.6 py36h82fb2a8_1 defaults libedit 3.1 heed3624_0 defaults libffi 3.2.1 h4deb6c0_3 defaults libgcc-ng 7.2.0 hcbc56d2_1 defaults libstdcxx-ng 7.2.0 h24385c6_1 defaults ncurses 6.0 h06874d7_1 defaults openssl 1.0.2l h9d1a558_3 defaults pip 9.0.1 py36h30f8307_2 defaults pycosat 0.6.3 py36h0a5515d_0 defaults pycparser 2.18 py36hf9f622e_1 defaults pyopenssl 17.2.0 py36h5cc804b_0 defaults pysocks 1.6.7 py36hd97a5b1_1 defaults python 3.6.2 h02fb82a_12 defaults readline 7.0 hac23ff0_3 defaults requests 2.18.4 py36he2e5f8d_1 defaults ruamel_yaml 0.11.14 py36ha2fb22d_2 defaults setuptools 36.5.0 py36he42e2e1_0 defaults six 1.10.0 py36hcac75e4_1 defaults sqlite 3.20.1 h6d8b0f3_1 defaults tk 8.6.7 h5979e9b_1 defaults urllib3 1.22 py36hbe7ace6_0 defaults wheel 0.29.0 py36he7f4e38_1 defaults xz 5.2.3 h2bcbf08_1 defaults yaml 0.1.7 h96e3832_1 defaults zlib 1.2.11 hfbfcf68_1 defaults ``` </p></details>
I am also seeing this with conda-build. For context, with conda-build, it happens very frequently with the cross-platform build. So, on our linux-64 docker image, when we run with CONDA_SUBDIR=linux-32 and ``linux32 conda-build``, we can get this error right away. I'm less sure about how to reproduce with the OP's report. I know that @nehaljwani has tried, and it's tough to get to happen reliably. I think that's because it depends on the state of the package cache. You must have the correct initial state (something already existing there) to get this problem to happen. This seems to be the same problem in my case, if run the command again, it seems to work. We have frozen conda to an old version as this was crashing our CI pipelines. Do you think this is related to https://github.com/conda/conda/issues/6631? That issue isn't new; it was present in conda 4.3, and probably 4.2. But something in conda 4.4 could be helping to exacerbate it. It seems to be unrelated, also this bug doesn't exist in 4.4.7. To reproduce this, exact steps: ``` # Spawn the container sudo docker run --rm -it continuumio/miniconda3:4.3.27 /bin/bash # Inside the container cat <<EOF > ~/test.yaml name: test dependencies: - anaconda::ca-certificates==2017.08.26 EOF # Update conda to 4.4.9 conda install -y conda=4.4.9 # Trigger the problem conda env update -f ~/test.yaml Solving environment: done Downloading and Extracting Packages ca-certificates 2017.08.26: ############################5 | 75% IsADirectoryError(21, 'Is a directory') ``` However, if I switch my docker daemon configuration from (overlay2/aufs): ``` { "storage-driver": "overlay2" } ``` To: ``` { "storage-driver": "devicemapper" } ``` Then the problem goes away. Logs: [log_overlay2.txt](https://github.com/conda/conda/files/1716159/log_overlay2.txt) [log_devicemapper.txt](https://github.com/conda/conda/files/1716160/log_devicemapper.txt) But, that doesn't mean that this is not a bug in Conda. Because, if I switch the update from conda 4.4.9 to 4.4.7 (as @pvanderlinden has pointed out), the problem doesn't occur, even in the case of overlay2. The difference in verbose logs is: 4.4.7: ``` TRACE conda.core.path_actions:execute(1238): extracting /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.tar.bz2 => /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0 TRACE conda.gateways.disk.update:rename(50): renaming /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0 => /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.c~ DEBUG conda.core.path_actions:execute(1251): Invalid cross-device link on rename /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0 => /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.c~ TRACE conda.gateways.disk.delete:rm_rf(29): rm_rf /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0 DEBUG conda.gateways.disk.create:extract_tarball(131): extracting /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.tar.bz2 to /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0 TRACE conda.gateways.disk.create:write_as_json_to_file(60): writing json to file /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0/info/repodata_record.json TRACE conda.gateways.disk.create:write_as_json_to_file(60): writing json to file /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0/info/repodata_record.json TRACE conda.gateways.disk.delete:rm_rf(29): rm_rf /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.tar.bz2.c~ TRACE conda.gateways.disk.delete:rm_rf(29): rm_rf /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.c~ TRACE conda.gateways.disk.delete:rm_rf(49): rm_rf failed. Not a link, file, or directory: /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.c~ ``` For conda > 4.4.7: ``` TRACE conda.core.path_actions:execute(1238): extracting /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.tar.bz2 => /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0 TRACE conda.gateways.disk.update:rename(60): renaming /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0 => /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.c~ TRACE conda.gateways.disk.update:rename(67): Could not rename do to errno [18]. Falling back to copy/remove. TRACE conda.gateways.disk.create:create_hard_link_or_copy(201): creating hard link /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0 => /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.c~ INFO conda.gateways.disk.create:create_hard_link_or_copy(204): hard link failed, so copying /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0 => /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.c~ TRACE conda.gateways.disk.create:_do_copy(251): copying /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0 => /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.c~ TRACE conda.gateways.disk.delete:rm_rf(29): rm_rf /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0 TRACE conda.core.path_actions:reverse(1206): moving /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.tar.bz2.c~ => /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.tar.bz2 TRACE conda.gateways.disk.delete:rm_rf(29): rm_rf /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.tar.bz2 TRACE conda.gateways.disk.update:rename(60): renaming /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.tar.bz2.c~ => /opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0.tar.bz2 DEBUG conda.core.package_cache:execute(586): IsADirectoryError(21, 'Is a directory') NoneType: None ``` If I revert this commit: 0b57e1ea4ff49b82df3bcd02408368cf182a3aba , then the problem mentioned in this issue goes away, but of course, that's not the right fix. Okay, seems like the [function in that commit ](https://github.com/conda/conda/blob/4.4.9/conda/gateways/disk/update.py#L47-L53)was written keeping files in mind, not directories! So, the IsADirectoryError exception is coming from https://github.com/conda/conda/blob/4.4.9/conda/gateways/disk/create.py#L259
2018-02-12T13:46:42Z
[]
[]
Traceback (most recent call last): File "/opt/conda/lib/python3.5/site-packages/conda/exceptions.py", line 772, in __call__ return func(*args, **kwargs) File "/opt/conda/lib/python3.5/site-packages/conda_env/cli/main.py", line 74, in do_call exit_code = getattr(module, func_name)(args, parser) File "/opt/conda/lib/python3.5/site-packages/conda_env/cli/main_update.py", line 107, in execute installer.install(prefix, specs, args, env) File "/opt/conda/lib/python3.5/site-packages/conda_env/installers/conda.py", line 38, in install pfe.execute() File "/opt/conda/lib/python3.5/site-packages/conda/core/package_cache.py", line 590, in execute raise CondaMultiError(exceptions) conda.CondaMultiError: [Errno 21] Is a directory: '/opt/conda/pkgs/ca-certificates-2017.08.26-h1d4fec5_0'
4,301
conda/conda
conda__conda-6909
70ef29117690193a92181f2bd4e7e0ab845158ba
diff --git a/conda/__init__.py b/conda/__init__.py --- a/conda/__init__.py +++ b/conda/__init__.py @@ -8,7 +8,7 @@ import sys from ._vendor.auxlib.packaging import get_version -from .common.compat import iteritems, text_type +from .common.compat import text_type __all__ = ( "__name__", "__version__", "__author__", "__email__", "__license__", "__summary__", "__url__", @@ -46,20 +46,20 @@ def __repr__(self): def __str__(self): try: return text_type(self.message % self._kwargs) - except TypeError: - # TypeError: not enough arguments for format string + except: 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('_')) + result = dict((k, v) for k, v in vars(self).items() if not k.startswith('_')) result.update(exception_type=text_type(type(self)), exception_name=self.__class__.__name__, message=text_type(self), diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -129,7 +129,10 @@ def __init__(self, shell, arguments=None): def _finalize(self, commands, ext): commands = concatv(commands, ('',)) # add terminating newline if ext is None: - return self.command_join.join(commands) + output = self.command_join.join(commands) + if PY2: + return ensure_binary(output) + return output elif ext: with NamedTemporaryFile('w+b', suffix=ext, delete=False) as tf: # the default mode is 'w+b', and universal new lines don't work in that mode diff --git a/conda/cli/common.py b/conda/cli/common.py --- a/conda/cli/common.py +++ b/conda/cli/common.py @@ -9,6 +9,7 @@ from ..base.context import context from ..common.io import swallow_broken_pipe from ..common.path import paths_equal +from ..common.serialize import json_dump from ..models.match_spec import MatchSpec @@ -158,10 +159,7 @@ def disp_features(features): @swallow_broken_pipe def stdout_json(d): - import json - from .._vendor.auxlib.entity import EntityEncoder - json.dump(d, sys.stdout, indent=2, sort_keys=True, cls=EntityEncoder) - sys.stdout.write('\n') + print(json_dump(d)) def stdout_json_success(success=True, **kwargs): diff --git a/conda/cli/main.py b/conda/cli/main.py --- a/conda/cli/main.py +++ b/conda/cli/main.py @@ -80,28 +80,15 @@ def _main(*args): return exit_code -def _ensure_text_type(value): - # copying here from conda/common/compat.py to avoid the import - try: - return value.decode('utf-8') - except AttributeError: - # AttributeError: '<>' object has no attribute 'decode' - # In this case assume already text_type and do nothing - return value - except UnicodeDecodeError: - try: - from requests.packages.chardet import detect - except ImportError: # pragma: no cover - from pip._vendor.requests.packages.chardet import detect - encoding = detect(value).get('encoding') or 'utf-8' - return value.decode(encoding) - - def main(*args): + # conda.common.compat contains only stdlib imports + from ..common.compat import ensure_text_type # , init_std_stream_encoding + + # init_std_stream_encoding() if not args: args = sys.argv - args = tuple(_ensure_text_type(s) for s in args) + args = tuple(ensure_text_type(s) for s in args) if len(args) > 1: try: diff --git a/conda/common/compat.py b/conda/common/compat.py --- a/conda/common/compat.py +++ b/conda/common/compat.py @@ -3,6 +3,7 @@ # What is compat, and what isn't? # If a piece of code is "general" and used in multiple modules, it goes here. # If it's only used in one module, keep it in that module, preferably near the top. +# This module should contain ONLY stdlib imports. from __future__ import absolute_import, division, print_function, unicode_literals from itertools import chain @@ -49,6 +50,7 @@ from itertools import zip_longest if sys.version_info[1] >= 5: from json import JSONDecodeError + JSONDecodeError = JSONDecodeError else: JSONDecodeError = ValueError elif PY2: # pragma: py3 no cover @@ -145,6 +147,29 @@ def _clone_with_metaclass(Class): primitive_types = tuple(chain(string_types, integer_types, (float, complex, bool, NoneType))) +def _init_stream_encoding(stream): + # PY2 compat: Initialize encoding for an IO stream. + # Python 2 sets the encoding of stdout/stderr to None if not run in a + # terminal context and thus falls back to ASCII. + if getattr(stream, "encoding", True): + # avoid the imports below if they are not necessary + return stream + from codecs import getwriter + from locale import getpreferredencoding + encoding = getpreferredencoding() + try: + encoder = getwriter(encoding) + except LookupError: + encoder = getwriter("UTF-8") + base_stream = getattr(stream, "buffer", stream) + return encoder(base_stream) + + +def init_std_stream_encoding(): + sys.stdout = _init_stream_encoding(sys.stdout) + sys.stderr = _init_stream_encoding(sys.stderr) + + def ensure_binary(value): try: return value.encode('utf-8') diff --git a/conda/common/serialize.py b/conda/common/serialize.py --- a/conda/common/serialize.py +++ b/conda/common/serialize.py @@ -4,7 +4,7 @@ import json from logging import getLogger -from .compat import PY2, odict +from .compat import PY2, odict, ensure_text_type from .._vendor.auxlib.decorators import memoize from .._vendor.auxlib.entity import EntityEncoder @@ -86,5 +86,5 @@ def json_load(string): def json_dump(object): - return json.dumps(object, indent=2, sort_keys=True, - separators=(',', ': '), cls=EntityEncoder) + return ensure_text_type(json.dumps(object, indent=2, sort_keys=True, + separators=(',', ': '), cls=EntityEncoder)) diff --git a/conda/core/repodata.py b/conda/core/repodata.py --- a/conda/core/repodata.py +++ b/conda/core/repodata.py @@ -16,12 +16,12 @@ from time import time import warnings -from .. import CondaError, iteritems +from .. import CondaError from .._vendor.auxlib.ish import dals 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, text_type, +from ..common.compat import (ensure_binary, ensure_text_type, ensure_unicode, iteritems, text_type, with_metaclass) from ..common.io import ThreadLimitedThreadPoolExecutor, as_completed from ..common.url import join_url, maybe_unquote
activate script fails with conda=4.4.10 and zsh=5.3.1 with cryptic logging error <!-- Hi! This is an issue tracker for conda -- the package manager. File feature requests for conda here, as well as bug reports about something conda has messed up. If your issue is a bug report or feature request for: * a specific conda package from Anaconda ('defaults' channel): ==> file at https://github.com/ContinuumIO/anaconda-issues * a specific conda package from conda-forge: ==> file at the corresponding feedstock under https://github.com/conda-forge * repo.continuum.io access and service: ==> file at https://github.com/ContinuumIO/anaconda-issues * anaconda.org access and service: ==> file at https://anaconda.org/contact/report * commands under 'conda build': ==> file at https://github.com/conda/conda-build * commands under 'conda env': ==> please file it here! * all other conda commands that start with 'conda': ==> please file it here! --> **I'm submitting a...** - [x] bug report - [ ] feature request ## Current Behavior <!-- What actually happens? If you want to include console output, please use "Steps to Reproduce" below. --> Using ZSH 5.3.1 the activate script of `conda=4.4.10` does not work and fails with some cryptic Python logging error. It doesn't even detect an error. With 4.4.0 it at least fails at unicode-decoding `PS1` and offers to submit a report. The script works in Bash. ### Steps to Reproduce <!-- If the current behavior is a bug, please provide specific, minimal steps to independently reproduce. Include the exact conda commands that reproduce the issue and their output between the ticks below. --> ``` $ source ~/anaconda/bin/activate Traceback (most recent call last): File "/home/ondrej/anaconda/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/home/ondrej/anaconda/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/home/ondrej/anaconda/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/home/ondrej/anaconda/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/home/ondrej/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/home/ondrej/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 458 Logged from file exceptions.py, line 770 $ echo $ZSH_VERSION 5.3.1 ``` ## Expected Behavior <!-- What do you think should happen? --> The source script should work as it did with `conda<=4.3*`. My current workaround is to prepend `~/anaconda/bin` to `$PATH` manually. ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` active environment : base active env location : /home/ondrej/anaconda shell level : 1 user config file : /home/ondrej/.condarc populated config files : /home/ondrej/.condarc conda version : 4.4.10 conda-build version : 1.19.0 python version : 2.7.13.final.0 base environment : /home/ondrej/anaconda (writable) channel URLs : https://conda.anaconda.org/anaconda-fusion/linux-64 https://conda.anaconda.org/anaconda-fusion/noarch https://repo.continuum.io/pkgs/main/linux-64 https://repo.continuum.io/pkgs/main/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch package cache : /home/ondrej/anaconda/pkgs /home/ondrej/.conda/pkgs envs directories : /home/ondrej/anaconda/envs /home/ondrej/.conda/envs platform : linux-64 user-agent : conda/4.4.10 requests/2.14.2 CPython/2.7.13 Linux/4.9.0-5-amd64 debian/9 glibc/2.24 UID:GID : 1000:1000 netrc file : None offline mode : False ``` </p></details> <details open><summary><code>`conda config --show-sources`</code></summary><p> <!-- between the ticks below, paste the output of 'conda config --show-sources' --> ``` ==> /home/ondrej/.condarc <== ssl_verify: True channels: - anaconda-fusion - defaults ``` </p></details> <details><summary><code>`conda list --show-channel-urls`</code></summary><p> <!-- between the ticks below, paste the output of 'conda list --show-channel-urls' --> ``` # packages in environment at /home/ondrej/anaconda: # # Name Version Build Channel _license 1.1 py27_1 defaults _nb_ext_conf 0.3.0 py27_0 defaults abstract-rendering 0.5.1 np111py27_0 defaults accelerate 2.0.2 np19py27_p0 defaults accelerate_cudalib 2.0 0 defaults alabaster 0.7.9 py27_0 defaults anaconda custom py27h4a00acb_0 defaults anaconda-clean 1.0.0 py27_0 defaults anaconda-client 1.6.0 py27_0 defaults anaconda-navigator 1.5.0 py27_0 defaults anaconda-project 0.4.1 py27_0 defaults apipkg 1.4 <pip> argcomplete 1.0.0 py27_1 defaults astroid 1.4.9 py27_0 defaults astropy 1.3 np111py27_0 defaults babel 2.3.4 py27_0 defaults backports 1.0 py27_0 defaults backports_abc 0.5 py27_0 defaults bcolz 0.11.3 py27_0 defaults beautiful-soup 4.3.2 py27_0 <unknown> beautifulsoup4 4.5.3 py27_0 defaults binstar 0.12 2 defaults bitarray 0.8.1 py27_0 <unknown> blaze 0.10.1 py27_0 defaults blaze-core 0.9.0 py27_0 defaults blinker 1.4 py_0 conda-forge bokeh 0.12.4 py27_0 defaults boto 2.45.0 py27_0 defaults bottleneck 1.2.0 np111py27_0 defaults ca-certificates 2018.1.18 0 conda-forge cairo 1.14.8 0 defaults cdecimal 2.3 py27_2 defaults certifi 2018.1.18 py27_0 defaults cffi 1.9.1 py27_0 defaults chardet 2.3.0 <pip> chardet 2.3.0 py27_0 defaults chest 0.2.3 py27_0 defaults click 6.7 py27_0 defaults cloudpickle 0.2.2 py27_0 defaults clyent 1.2.2 py27_0 defaults colorama 0.3.7 py27_0 defaults conda 4.4.10 py27_0 defaults conda-build 1.19.0 py27_0 defaults conda-env 2.6.0 h36134e3_1 defaults conda-manager 0.3.1 py27_0 defaults configobj 5.0.6 py27_0 <unknown> configparser 3.5.0 py27_0 defaults configparser 3.3.0.post2 <pip> contextlib2 0.5.4 py27_0 defaults coverage 4.0.3 <pip> cryptography 1.7.1 py27_0 defaults cudatoolkit 7.0 1 defaults curl 7.52.1 0 defaults cycler 0.10.0 py27_0 defaults cython 0.25.2 py27_0 defaults cytoolz 0.8.2 py27_0 defaults dask 0.13.0 py27_0 defaults datashape 0.5.4 py27_0 defaults dbus 1.10.10 0 defaults decorator 4.0.11 py27_0 defaults dill 0.2.5 py27_0 defaults docutils 0.13.1 py27_0 defaults doit 0.29.0 <pip> dynd-python 0.7.2 py27_0 defaults ecdsa 0.13 <pip> entrypoints 0.2.2 py27_0 defaults enum34 1.1.6 py27_0 defaults et_xmlfile 1.0.1 py27_0 defaults execnet 1.4.1 <pip> expat 2.1.0 0 defaults fastcache 1.0.2 py27_1 defaults fftw 3.3.4 0 https://conda.binstar.org/jakirkham filelock 2.0.6 py27_0 defaults flask 0.12 py27_0 defaults flask-cors 3.0.2 py27_0 defaults flask-login 0.4.0 py27_0 defaults flask-sqlalchemy 2.3.2 py_0 conda-forge fontconfig 2.12.1 2 defaults freetype 2.5.5 2 defaults funcsigs 1.0.2 py27_0 defaults functools32 3.2.3.2 py27_0 defaults futures 3.0.5 py27_0 defaults get_terminal_size 1.0.0 py27_0 defaults gevent 1.2.1 py27_0 defaults glib 2.50.2 1 defaults greenlet 0.4.11 py27_0 defaults grin 1.2.1 py27_3 defaults gst-plugins-base 1.8.0 0 defaults gstreamer 1.8.0 0 defaults h5py 2.6.0 np111py27_2 defaults harfbuzz 0.9.39 2 defaults hdf4 4.2.11 0 defaults hdf5 1.8.17 1 defaults heapdict 1.0.0 py27_1 defaults hmmlearn 0.2.0 <pip> hmmlearn 0.3.0b np111py27_0 omnia holoviews 1.8.3 py27_0 defaults icalendar 3.10 <pip> icu 54.1 0 defaults idna 2.2 py27_0 defaults imagesize 0.7.1 py27_0 defaults ipaddress 1.0.18 py27_0 defaults ipdb 0.8.1 <pip> ipykernel 4.5.2 py27_0 defaults ipython 5.1.0 py27_0 defaults ipython-notebook 4.0.4 py27_0 defaults ipython-qtconsole 4.0.1 py27_0 defaults ipython_genutils 0.1.0 py27_0 defaults ipywidgets 5.2.2 py27_1 defaults isort 4.2.5 py27_0 defaults itsdangerous 0.24 py27_0 <unknown> javaobj-py3 0.2.3 <pip> jbig 2.1 0 defaults jdcal 1.3 py27_0 defaults jedi 0.9.0 py27_1 defaults jinja2 2.9.4 py27_0 defaults joblib 0.8.4 py27_0 defaults jpeg 9b 0 defaults jsonschema 2.5.1 py27_0 defaults jupyter 1.0.0 py27_3 defaults jupyter_client 4.4.0 py27_0 defaults jupyter_console 5.0.0 py27_0 defaults jupyter_core 4.2.1 py27_0 defaults krb5 1.13.2 0 defaults lazy-object-proxy 1.2.2 py27_0 defaults ldap3 2.3 py27hcb53f9d_0 defaults libdynd 0.7.2 0 defaults libffi 3.2.1 1 defaults libgcc 4.8.5 2 defaults libgcc-ng 7.2.0 h7cc24e2_2 defaults libgfortran 3.0.0 1 defaults libiconv 1.14 0 defaults libpng 1.6.27 0 defaults libsodium 1.0.10 0 defaults libtiff 4.0.6 3 defaults libxcb 1.12 1 defaults libxml2 2.9.4 0 defaults libxslt 1.1.29 0 defaults llvmlite 0.15.0 py27_0 defaults locket 0.2.0 py27_1 defaults lockfile 0.12.2 <pip> logilab-common 1.0.2 py27_0 defaults luigi 2.1.1 <pip> lxml 3.7.2 py27_0 defaults markupsafe 0.23 py27_2 defaults matplotlib 2.0.0 np111py27_0 defaults mistune 0.7.3 py27_0 defaults mkl 2017.0.1 0 defaults mkl-rt 11.1 p0 defaults mkl-service 1.1.2 py27_3 defaults mklfft 2.1 np19py27_p0 defaults mock 2.0.0 py27_0 defaults mpmath 0.19 py27_1 defaults multipledispatch 0.4.9 py27_0 defaults mysql 5.5.24 0 defaults mysql-python 1.2.5 py27_0 defaults nb_anacondacloud 1.2.0 py27_0 defaults nb_conda 2.0.0 py27_0 defaults nb_conda_kernels 2.0.0 py27_0 defaults nbconvert 4.2.0 py27_0 defaults nbformat 4.2.0 py27_0 defaults nbpresent 3.0.2 py27_0 defaults networkx 1.11 py27_0 defaults nltk 3.2.2 py27_0 defaults nose 1.3.7 py27_1 defaults notebook 4.3.1 py27_0 defaults numba 0.30.1 np111py27_0 defaults numbapro 0.23.1 py27_p0 defaults numbapro_cudalib 0.2 0 defaults numexpr 2.6.1 np111py27_2 defaults numpy 1.11.3 py27_0 defaults numpydoc 0.6.0 py27_0 defaults odo 0.5.0 py27_1 defaults openldap 2.4.36 1 defaults openpyxl 2.4.1 py27_0 defaults openssl 1.0.2n hb7f436b_0 defaults pandas 0.19.2 np111py27_1 defaults param 1.5.1 py27_0 defaults paramiko 1.16.0 <pip> partd 0.3.7 py27_0 defaults patchelf 0.9 0 defaults path.py 10.0 py27_0 defaults pathlib2 2.2.0 py27_0 defaults patsy 0.4.1 py27_0 defaults pbr 1.3.0 py27_0 defaults pcre 8.39 1 defaults pep8 1.7.0 py27_0 defaults pexpect 4.2.1 py27_0 defaults pickleshare 0.7.4 py27_0 defaults pillow 4.0.0 py27_0 defaults pip 9.0.1 py27_1 defaults pixman 0.34.0 0 defaults pkginfo 1.3.2 py27_0 defaults ply 3.9 py27_0 defaults progressbar 2.3 py27_0 defaults progressbar2 3.10.1 <pip> prompt_toolkit 1.0.9 py27_0 defaults psutil 5.0.1 py27_0 defaults ptyprocess 0.5.1 py27_0 defaults py 1.4.32 py27_0 defaults pyasn1 0.1.9 py27_0 defaults pycairo 1.10.0 py27_0 defaults pycosat 0.6.3 py27ha4109ae_0 defaults pycparser 2.17 py27_0 defaults pycrypto 2.6.1 py27_4 defaults pycurl 7.43.0 py27_2 defaults pyfftw 0.9.2 np19py27_1 https://conda.binstar.org/jakirkham pyflakes 1.5.0 py27_0 defaults pygments 2.1.3 py27_0 defaults pyhdf 0.9.0 np111py27_1 conda-forge pyinotify 0.9.6 <pip> pylint 1.6.4 py27_1 defaults pyopenssl 16.2.0 py27_0 defaults pyparsing 2.1.4 py27_0 defaults pyqt 5.6.0 py27_2 defaults pyserial 2.7 py27_0 defaults pytables 3.3.0 np111py27_0 defaults pytest 3.0.5 py27_0 defaults pytest-cov 2.2.1 <pip> python 2.7.13 0 defaults python-daemon 2.1.1 <pip> python-dateutil 2.6.0 py27_0 defaults python-ldap 2.4.13 py27_0 defaults python-utils 2.0.0 <pip> pytz 2016.10 py27_0 defaults pyyaml 3.12 py27_0 defaults pyzmq 16.0.2 py27_0 defaults qt 5.6.2 3 defaults qtawesome 0.4.3 py27_0 defaults qtconsole 4.2.1 py27_1 defaults qtpy 1.2.1 py27_0 defaults readline 6.2 2 defaults redis 3.2.0 0 defaults redis-py 2.10.5 py27_0 defaults requests 2.14.2 py27_0 defaults rk 0.3b1 <pip> rope 0.9.4 py27_1 <unknown> ruamel_yaml 0.11.14 py27_1 defaults ruffus 2.6.3 <pip> runipy 0.1.3 py27_0 <unknown> scandir 1.4 py27_0 defaults scikit-image 0.12.3 np111py27_1 defaults scikit-learn 0.18.1 np111py27_1 defaults scipy 0.18.1 np111py27_1 defaults seaborn 0.7.1 py27_0 defaults setuptools 38.4.0 py27_0 defaults simplegeneric 0.8.1 py27_1 defaults singledispatch 3.4.0.3 py27_0 defaults sip 4.18 py27_0 defaults six 1.10.0 py27_0 defaults snowballstemmer 1.2.1 py27_0 defaults sockjs-tornado 1.0.3 py27_0 defaults spectrum 0.1 <pip> sphinx 1.5.1 py27_0 defaults sphinx_rtd_theme 0.1.9 py27_0 defaults spyder 3.1.2 py27_0 defaults sqlalchemy 1.1.5 py27_0 defaults sqlite 3.13.0 0 defaults sqlsoup 0.9.1 <pip> ssl_match_hostname 3.4.0.2 py27_1 defaults statsmodels 0.6.1 np111py27_1 defaults subprocess32 3.2.7 py27_0 defaults sympy 1.0 py27_0 defaults system 5.8 2 <unknown> terminado 0.6 py27_0 defaults theano 0.5.0 np15py27_0 defaults tk 8.5.18 0 defaults toolz 0.8.2 py27_0 defaults tornado 4.4.2 py27_0 defaults traitlets 4.3.1 py27_0 defaults ujson 1.35 py27_0 defaults unicodecsv 0.14.1 py27_0 defaults util-linux 2.21 0 <unknown> wcwidth 0.1.7 py27_0 defaults werkzeug 0.11.15 py27_0 defaults wheel 0.29.0 py27_0 defaults widgetsnbextension 1.2.6 py27_0 defaults wrapt 1.10.8 py27_0 defaults xarray 0.9.3 py27_0 defaults xlrd 1.0.0 py27_0 defaults xlsxwriter 0.9.6 py27_0 defaults xlwt 1.2.0 py27_0 defaults xmltodict 0.10.2 <pip> xz 5.2.2 1 defaults yaml 0.1.6 0 defaults zeromq 4.1.5 0 defaults zlib 1.2.8 3 defaults ``` </p></details>
Because python2 is in the base environment, we don't have exception chaining here, and there's really no way to know the underlying root cause of this error. It's probably a unicode encoding/decoding error somewhere, being it's python2 in the base environment. So your suggestion is to give up on this and migrate to python3 in the base environment? Let's try to get to the exception without doing that. What do you get for ``` CONDA_VERBOSE=3 conda shell.posix activate ``` ? https://github.com/conda/conda/issues/6739#issuecomment-362941051 I'll submit a PR
2018-02-21T19:32:02Z
[]
[]
Traceback (most recent call last): File "/home/ondrej/anaconda/lib/python2.7/site-packages/conda/gateways/logging.py", line 64, in emit msg = self.format(record) File "/home/ondrej/anaconda/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/home/ondrej/anaconda/lib/python2.7/logging/__init__.py", line 465, in format record.message = record.getMessage() File "/home/ondrej/anaconda/lib/python2.7/logging/__init__.py", line 329, in getMessage msg = msg % self.args File "/home/ondrej/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 43, in __repr__ return '%s: %s' % (self.__class__.__name__, text_type(self)) File "/home/ondrej/anaconda/lib/python2.7/site-packages/conda/__init__.py", line 47, in __str__ return text_type(self.message % self._kwargs) ValueError: unsupported format character '{' (0x7b) at index 458
4,307
conda/conda
conda__conda-7476
d9ca6008736ff84dabfc484e115eeb5730e96e34
diff --git a/docs/scrape_help.py b/docs/scrape_help.py --- a/docs/scrape_help.py +++ b/docs/scrape_help.py @@ -50,7 +50,8 @@ def run_command(*args, **kwargs): err = b'' out, err = out.decode('utf-8'), err.decode('utf-8') if p.returncode != 0: - print("%r failed with error code %s" % (' '.join(map(quote, args[0])), p.returncode), file=sys.stderr) + print("%r failed with error code %s" % + (' '.join(map(quote, args[0])), p.returncode), file=sys.stderr) elif err: print("%r gave stderr output: %s" % (' '.join(*args), err)) @@ -128,7 +129,7 @@ def get_help(command): m = subcommands_re.match(line) if m: commands.extend(['%s %s' % (command, i) for i in - m.group(1).split(',')]) + m.group(1).split(',')]) break return commands @@ -147,7 +148,7 @@ def man_replacements(): (info['sys_rc_path'], r'\fI\,system .condarc path\/\fP'), (info['root_prefix'], r'root prefix'), - ]) + ]) return r @@ -165,7 +166,7 @@ def generate_man(command): '--version-string', conda_version, '--no-info', 'conda %s' % command, - ]) + ]) retries -= 1 if not manpage: @@ -186,11 +187,11 @@ def generate_html(command): man = Popen(['man', abspath(join(manpath, 'conda-%s.1' % command_file))], stdout=PIPE) htmlpage = check_output([ 'man2html', - '-bare', # Don't use HTML, HEAD, or BODY tags + '-bare', # Don't use HTML, HEAD, or BODY tags 'title', 'conda-%s' % command_file, - '-topm', '0', # No top margin - '-botm', '0', # No bottom margin - ], + '-topm', '0', # No top margin + '-botm', '0', # No bottom margin + ], stdin=man.stdout) with open(join(manpath, 'conda-%s.html' % command_file), 'wb') as f: @@ -233,7 +234,9 @@ def main(): 'metapackage', # 'pipbuild', 'render', - # 'sign', # let's drop this one; I've dropped support for it in 4.3.x; coming back with TUF in the near future + # let's drop this one; I've dropped support for it in 4.3.x + # coming back with TUF in the near future + # 'sign', 'skeleton', 'skeleton cpan', 'skeleton cran', @@ -267,5 +270,6 @@ def gen_command(command): else: write_rst(command, sep='build') + if __name__ == '__main__': sys.exit(main()) diff --git a/docs/source/conf.py b/docs/source/conf.py --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -17,7 +17,8 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import sys +import os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -27,7 +28,7 @@ # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. @@ -38,7 +39,6 @@ 'sphinx.ext.ifconfig', 'sphinx.ext.inheritance_diagram', # 'sphinx.ext.napoleon', - 'numpydoc', ] # Add any paths that contain templates here, relative to this directory. @@ -48,7 +48,7 @@ source_suffix = '.rst' # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' @@ -68,31 +68,31 @@ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' @@ -112,36 +112,36 @@ html_context = { 'github_user': 'conda', - 'github_repo': 'conda', + 'github_repo': 'conda-docs', 'github_version': 'master/', 'display_github': True, 'conf_py_path': 'docs/source/', 'source_suffix': '.rst', - } +} # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -150,44 +150,44 @@ # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'condadoc' @@ -196,42 +196,42 @@ # -- Options for LaTeX output -------------------------------------------------- latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', -# Additional stuff for the LaTeX preamble. -#'preamble': '', + # Additional stuff for the LaTeX preamble. + # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'conda.tex', u'conda Documentation', - u'Anaconda, Inc.', 'manual'), + ('index', 'conda.tex', u'conda Documentation', + u'Anaconda, Inc.', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output -------------------------------------------- @@ -244,7 +244,7 @@ ] # If true, show URL addresses after external links. -#man_show_urls = False +# man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ @@ -253,16 +253,16 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'conda', u'conda Documentation', - u'Anaconda, Inc.', 'conda', 'One line description of project.', - 'Miscellaneous'), + ('index', 'conda', u'conda Documentation', + u'Anaconda, Inc.', 'conda', 'One line description of project.', + 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. -#texinfo_appendices = [] +# texinfo_appendices = [] # If false, no module index is generated. -#texinfo_domain_indices = True +# texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' +# texinfo_show_urls = 'footnote'
An unexpected error has occurred, please consider sending the following traceback to the conda GitHub issue tracker Hello. When trying to update anaconda recently via conda update anaconda, I received this error and was told to submit the issue here. This is the result from conda info. Traceback (most recent call last): File "/Users/danielr/anaconda/bin/conda", line 3, in <module> from conda.cli import main File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/cli/**init**.py", line 8, in <module> from conda.cli.main import main File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 48, in <module> from conda.cli import main_create File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 11, in <module> from conda.cli import common, install File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 18, in <module> import conda.plan as plan File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/plan.py", line 22, in <module> from conda.fetch import fetch_pkg File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 24, in <module> from conda.connection import CondaSession, unparse_url, RETRIES File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/connection.py", line 22, in <module> import requests ImportError: No module named requests
Try `pip install requests` and see if you can use conda. Thanks for the suggestion. Unfortunately I got the following error. Downloading/unpacking requests Downloading requests-2.4.3-py2.py3-none-any.whl (459kB): 459kB downloaded Installing collected packages: requests Cleaning up... Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/commands/install.py", line 279, in run requirement_set.install(install_options, global_options, root=options.root_path) File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py", line 1380, in install requirement.install(install_options, global_options, _args, *_kwargs) File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py", line 664, in install self.move_wheel_files(self.source_dir, root=root) File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py", line 894, in move_wheel_files pycompile=self.pycompile, File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/wheel.py", line 202, in move_wheel_files clobber(source, lib_dir, True) File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/wheel.py", line 189, in clobber os.makedirs(destsubdir) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/requests' Storing debug log for failure in /Users/danielr/Library/Logs/pip.log Can you show me the output of `conda info -a`? Hi @asmeurer. Thanks for your interest in my issue. The result of `conda info -a` is below. It seems the problem is with the missing requests package. But I am unable to install it as you see above. I'm confused as to what to do about this. Seems like a catch 22. Traceback (most recent call last): File "/Users/danielr/anaconda/bin/conda", line 3, in <module> from conda.cli import main File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/cli/**init**.py", line 8, in <module> from conda.cli.main import main File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 48, in <module> from conda.cli import main_create File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 11, in <module> from conda.cli import common, install File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 18, in <module> import conda.plan as plan File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/plan.py", line 22, in <module> from conda.fetch import fetch_pkg File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 24, in <module> from conda.connection import CondaSession, unparse_url, RETRIES File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/connection.py", line 22, in <module> import requests ImportError: No module named requests Just to let you know that I uninstalled anaconda and reinstalled it and now it seems to be working... Thanks for your help.
2018-06-30T16:05:22Z
[]
[]
Traceback (most recent call last): File "/Users/danielr/anaconda/bin/conda", line 3, in <module> from conda.cli import main File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/cli/**init**.py", line 8, in <module> from conda.cli.main import main File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 48, in <module> from conda.cli import main_create File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 11, in <module> from conda.cli import common, install File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 18, in <module> import conda.plan as plan File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/plan.py", line 22, in <module> from conda.fetch import fetch_pkg File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 24, in <module> from conda.connection import CondaSession, unparse_url, RETRIES File "/Users/danielr/anaconda/lib/python2.7/site-packages/conda/connection.py", line 22, in <module> import requests ImportError: No module named requests
4,364
conda/conda
conda__conda-7919
1471f043eed980d62f46944e223f0add6a9a790b
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -229,7 +229,7 @@ class Context(Configuration): anaconda_upload = PrimitiveParameter(None, aliases=('binstar_upload',), element_type=(bool, NoneType)) _croot = PrimitiveParameter('', aliases=('croot',)) - _conda_build = MapParameter(string_types, aliases=('conda-build',)) + _conda_build = MapParameter(string_types, aliases=('conda-build', 'conda_build')) def __init__(self, search_path=None, argparse_args=None): if search_path is None:
config appears to not pick up conda_build/matrix_base_dir in 4.6.0b1 In my .condarc: ``` conda_build: matrix_base_dir: ~/code/automated-build/c3i_configurations/anaconda_public ``` This is for c3i. Somehow this isn't getting loaded properly: ``` c3i one-off py36_win python-3.6-feedstock -p "win*" Traceback (most recent call last): File "/Users/msarahan/miniconda3/bin/c3i", line 11, in <module> load_entry_point('conda-concourse-ci', 'console_scripts', 'c3i')() File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/cli.py", line 240, in main execute.submit_one_off(pass_throughs=pass_throughs, **args.__dict__) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/execute.py", line 802, in submit_one_off config_root_dir = os.path.expanduser(config_root_dir) File "/Users/msarahan/miniconda3/lib/python3.6/posixpath.py", line 235, in expanduser path = os.fspath(path) TypeError: expected str, bytes or os.PathLike object, not NoneType ``` The code that loads this setting is at https://github.com/conda/conda-concourse-ci/blob/master/conda_concourse_ci/cli.py#L43
I isolated this to https://github.com/conda/conda/commit/1418be0fc7368ddbbfdae5994168b98f01b0c190#diff-b48dce471b4b8aed241c3b09306aa176 That commit causes the conda_build key to not be loaded at all. I am investigating.
2018-10-28T14:26:40Z
[]
[]
Traceback (most recent call last): File "/Users/msarahan/miniconda3/bin/c3i", line 11, in <module> load_entry_point('conda-concourse-ci', 'console_scripts', 'c3i')() File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/cli.py", line 240, in main execute.submit_one_off(pass_throughs=pass_throughs, **args.__dict__) File "/Users/msarahan/code/conda-concourse-ci/conda_concourse_ci/execute.py", line 802, in submit_one_off config_root_dir = os.path.expanduser(config_root_dir) File "/Users/msarahan/miniconda3/lib/python3.6/posixpath.py", line 235, in expanduser path = os.fspath(path) TypeError: expected str, bytes or os.PathLike object, not NoneType
4,393
conda/conda
conda__conda-8184
8eeb1bba428cceb56c6dae120c51e35b3332b854
diff --git a/conda/common/pkg_formats/python.py b/conda/common/pkg_formats/python.py --- a/conda/common/pkg_formats/python.py +++ b/conda/common/pkg_formats/python.py @@ -113,7 +113,8 @@ def _check_files(self): for fname in self.MANDATORY_FILES: if self._metadata_dir_full_path: fpath = join(self._metadata_dir_full_path, fname) - assert isfile(fpath) + if not isfile(fpath): + raise OSError(ENOENT, strerror(ENOENT), fpath) def _check_path_data(self, path, checksum, size): """Normalizes record data content and format.""" diff --git a/conda/core/prefix_data.py b/conda/core/prefix_data.py --- a/conda/core/prefix_data.py +++ b/conda/core/prefix_data.py @@ -256,7 +256,8 @@ def _load_site_packages(self): for af in non_conda_anchor_files: try: python_record = read_python_record(self.prefix_path, af, python_pkg_record.version) - except EnvironmentError: + except EnvironmentError as e: + log.info("Python record ignored for anchor path '%s'\n due to %s", af, e) continue except ValidationError: import sys
conda pip interop AssertionError in 4.6.1 This is the error with the most reports for 4.6.1 (over 100 in the last 24 hours). I've got a PR in the works to resolve this one. ``` error: AssertionError() command: D:\Users\rahul\Anaconda3\Scripts\conda-script.py list user_agent: conda/4.6.1 requests/2.18.4 CPython/3.6.5 Windows/10 Windows/10.0.17763 _messageid: -9223372036617369010 _messagetime: 1548792058544 / 2019-01-29 14:00:58 Traceback (most recent call last): File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\exceptions.py", line 1001, in __call__ return func(*args, **kwargs) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main exit_code = do_call(args, p) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 81, in do_call exit_code = getattr(module, func_name)(args, parser) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\cli\main_list.py", line 142, in execute show_channel_urls=context.show_channel_urls) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\cli\main_list.py", line 80, in print_packages show_channel_urls=show_channel_urls) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\cli\main_list.py", line 45, in list_packages installed = sorted(PrefixData(prefix, pip_interop_enabled=True).iter_records(), File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\core\prefix_data.py", line 116, in iter_records return itervalues(self._prefix_records) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\core\prefix_data.py", line 145, in _prefix_records return self.__prefix_records or self.load() or self.__prefix_records File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\core\prefix_data.py", line 69, in load self._load_site_packages() File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\core\prefix_data.py", line 258, in _load_site_packages python_record = read_python_record(self.prefix_path, af, python_pkg_record.version) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\gateways\disk\read.py", line 245, in read_python_record pydist = PythonDistribution.init(prefix_path, anchor_file, python_version) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\common\pkg_formats\python.py", line 78, in init return PythonInstalledDistribution(prefix_path, anchor_file, python_version) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\common\pkg_formats\python.py", line 382, in __init__ super(PythonInstalledDistribution, self).__init__(anchor_full_path, python_version) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\common\pkg_formats\python.py", line 106, in __init__ self._check_files() File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\common\pkg_formats\python.py", line 116, in _check_files assert isfile(fpath) AssertionError ```
2019-01-30T14:49:40Z
[]
[]
Traceback (most recent call last): File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\exceptions.py", line 1001, in __call__ return func(*args, **kwargs) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main exit_code = do_call(args, p) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 81, in do_call exit_code = getattr(module, func_name)(args, parser) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\cli\main_list.py", line 142, in execute show_channel_urls=context.show_channel_urls) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\cli\main_list.py", line 80, in print_packages show_channel_urls=show_channel_urls) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\cli\main_list.py", line 45, in list_packages installed = sorted(PrefixData(prefix, pip_interop_enabled=True).iter_records(), File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\core\prefix_data.py", line 116, in iter_records return itervalues(self._prefix_records) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\core\prefix_data.py", line 145, in _prefix_records return self.__prefix_records or self.load() or self.__prefix_records File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\core\prefix_data.py", line 69, in load self._load_site_packages() File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\core\prefix_data.py", line 258, in _load_site_packages python_record = read_python_record(self.prefix_path, af, python_pkg_record.version) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\gateways\disk\read.py", line 245, in read_python_record pydist = PythonDistribution.init(prefix_path, anchor_file, python_version) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\common\pkg_formats\python.py", line 78, in init return PythonInstalledDistribution(prefix_path, anchor_file, python_version) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\common\pkg_formats\python.py", line 382, in __init__ super(PythonInstalledDistribution, self).__init__(anchor_full_path, python_version) File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\common\pkg_formats\python.py", line 106, in __init__ self._check_files() File "D:\Users\rahul\Anaconda3\lib\site-packages\conda\common\pkg_formats\python.py", line 116, in _check_files assert isfile(fpath) AssertionError
4,409
conda/conda
conda__conda-8248
e419d60b4398c4b1c2c8f871792942c7962274f3
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 @@ -222,8 +222,11 @@ def typify(value, type_hint=None): if isinstance(type_hint, type) and issubclass(type_hint, Enum): try: return type_hint(value) - except ValueError: - return type_hint[value] + except ValueError as e: + try: + return type_hint[value] + except KeyError: + raise TypeCoercionError(value, text_type(e)) type_hint = set(type_hint) if not (type_hint - NUMBER_TYPES_SET): return numberify(value) diff --git a/conda/base/constants.py b/conda/base/constants.py --- a/conda/base/constants.py +++ b/conda/base/constants.py @@ -199,6 +199,15 @@ def __str__(self): return self.value +class SatSolverChoice(Enum): + PYCOSAT = 'pycosat' + PYCRYPTOSAT = 'pycryptosat' + PYSAT = 'pysat' + + def __str__(self): + return self.value + + # Magic files for permissions determination PACKAGE_CACHE_MAGIC_FILE = 'urls.txt' PREFIX_MAGIC_FILE = join('conda-meta', 'history') diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -14,7 +14,7 @@ DEFAULT_AGGRESSIVE_UPDATE_PACKAGES, DEFAULT_CHANNELS, DEFAULT_CHANNEL_ALIAS, DEFAULT_CUSTOM_CHANNELS, DepsModifier, ERROR_UPLOAD_URL, PLATFORM_DIRECTORIES, PREFIX_MAGIC_FILE, PathConflict, - ROOT_ENV_NAME, SEARCH_PATH, SafetyChecks, UpdateModifier) + ROOT_ENV_NAME, SEARCH_PATH, SafetyChecks, SatSolverChoice, UpdateModifier) from .. import __version__ as CONDA_VERSION from .._vendor.appdirs import user_data_dir from .._vendor.auxlib.decorators import memoize, memoizedproperty @@ -25,8 +25,8 @@ from ..common.compat import NoneType, iteritems, itervalues, odict, on_win, string_types from ..common.configuration import (Configuration, ConfigurationLoadError, MapParameter, PrimitiveParameter, SequenceParameter, ValidationError) -from ..common.path import expand, paths_equal from ..common.os.linux import linux_get_libc_version +from ..common.path import expand, paths_equal from ..common.url import has_scheme, path_to_url, split_scheme_auth_token try: @@ -217,7 +217,7 @@ class Context(Configuration): # ###################################################### deps_modifier = PrimitiveParameter(DepsModifier.NOT_SET) update_modifier = PrimitiveParameter(UpdateModifier.UPDATE_SPECS) - sat_solver = PrimitiveParameter(None, element_type=string_types + (NoneType,)) + sat_solver = PrimitiveParameter(SatSolverChoice.PYCOSAT) solver_ignore_timestamps = PrimitiveParameter(False) # no_deps = PrimitiveParameter(NULL, element_type=(type(NULL), bool)) # CLI-only @@ -675,7 +675,6 @@ def category_map(self): 'allow_non_channel_urls', )), ('Basic Conda Configuration', ( # TODO: Is there a better category name here? - 'env_prompt', 'envs_dirs', 'pkgs_dirs', )), @@ -722,6 +721,7 @@ def category_map(self): 'always_yes', 'auto_activate_base', 'changeps1', + 'env_prompt', 'json', 'notify_outdated_conda', 'quiet', 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 @@ -15,7 +15,7 @@ from .._vendor.auxlib.entity import EntityEncoder from .._vendor.toolz import concat, groupby from ..base.constants import (ChannelPriority, DepsModifier, PathConflict, SafetyChecks, - UpdateModifier) + UpdateModifier, SatSolverChoice) from ..base.context import context, sys_rc_path, user_rc_path from ..common.compat import (Mapping, Sequence, isiterable, iteritems, itervalues, string_types, text_type) @@ -357,6 +357,7 @@ def enum_representer(dumper, data): yaml.representer.RoundTripRepresenter.add_representer(DepsModifier, enum_representer) yaml.representer.RoundTripRepresenter.add_representer(UpdateModifier, enum_representer) yaml.representer.RoundTripRepresenter.add_representer(ChannelPriority, enum_representer) + yaml.representer.RoundTripRepresenter.add_representer(SatSolverChoice, enum_representer) try: with open(rc_path, 'w') as rc: diff --git a/conda/common/logic.py b/conda/common/logic.py --- a/conda/common/logic.py +++ b/conda/common/logic.py @@ -34,6 +34,7 @@ from logging import DEBUG, getLogger from .compat import iteritems, odict +from ..base.constants import SatSolverChoice log = getLogger(__name__) @@ -264,33 +265,32 @@ def process_solution(self, sat_solution): return solution -def get_sat_solver_cls(name=None): +def get_sat_solver_cls(sat_solver_choice=SatSolverChoice.PYCOSAT): solvers = odict([ - ('pycosat', PycoSatSolver), - ('pycryptosat', CryptoMiniSatSolver), - ('pysat', PySatSolver), + (SatSolverChoice.PYCOSAT, PycoSatSolver), + (SatSolverChoice.PYCRYPTOSAT, CryptoMiniSatSolver), + (SatSolverChoice.PYSAT, PySatSolver), ]) - if name is not None: - try: - cls = solvers[name] - except KeyError: - raise ValueError('Unknown SAT solver interface: "{}".'.format(name)) - try: - cls().run(0) - except Exception: - raise RuntimeError('Could not run SAT solver through interface "{}".'.format(name)) - else: - log.debug('Using SAT solver interface "{}".'.format(name)) - return cls - for name, cls in solvers.items(): + cls = solvers[sat_solver_choice] + try: + cls().run(0) + except Exception as e: + log.warning("Could not run SAT solver through interface '%s'.", sat_solver_choice) + log.debug("SAT interface error due to: %s", e, exc_info=True) + else: + log.debug("Using SAT solver interface '%s'.", sat_solver_choice) + return cls + for solver_choice, cls in solvers.items(): try: cls().run(0) - except Exception: - log.warn('Could not run SAT solver through interface "{}".'.format(name)) + except Exception as e: + log.debug("Attempted SAT interface '%s' but unavailable due to: %s", + sat_solver_choice, e) else: - log.debug('Using SAT solver interface "{}".'.format(name)) + log.debug("Falling back to SAT solver interface '%s'.", sat_solver_choice) return cls - raise RuntimeError('Could not run any SAT solver.') + from ..exceptions import CondaDependencyError + raise CondaDependencyError("Cannot run solver. No functioning SAT implementations available.") # Code that uses special cases (generates no clauses) is in ADTs/FEnv.h in
RuntimeError: Could not run any SAT solver. ``` error: RuntimeError('Could not run any SAT solver.') command: C:\Tools\Progs\python\anaconda3\scripts\conda-script.py install -p C:\Tools\Progs\python\anaconda3 -y anaconda-client==1.7.2 user_agent: conda/4.6.1 requests/2.21.0 CPython/3.7.1 Windows/10 Windows/10.0.15063 _messageid: -9223372036617369659 _messagetime: 1548779675918 / 2019-01-29 10:34:35 Traceback (most recent call last): File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\exceptions.py", line 1001, in __call__ return func(*args, **kwargs) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main exit_code = do_call(args, p) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 81, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\cli\main_install.py", line 21, in execute install(args, parser, 'install') File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\cli\install.py", line 250, in install force_reinstall=context.force_reinstall or context.force, File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\core\solve.py", line 107, in solve_for_transaction force_remove, force_reinstall) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\core\solve.py", line 145, in solve_for_diff force_remove) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\core\solve.py", line 240, in solve_final_state ssc = self._find_inconsistent_packages(ssc) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\core\solve.py", line 342, in _find_inconsistent_packages _, inconsistent_precs = ssc.r.bad_installed(ssc.solution_precs, ()) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\resolve.py", line 896, in bad_installed C = r2.gen_clauses() File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\common\io.py", line 85, in decorated return f(*args, **kwds) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\resolve.py", line 668, in gen_clauses C = Clauses(sat_solver_cls=get_sat_solver_cls(context.sat_solver)) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\_vendor\auxlib\decorators.py", line 56, in _memoized_func result = func(*args, **kwargs) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\common\logic.py", line 293, in get_sat_solver_cls raise RuntimeError('Could not run any SAT solver.') RuntimeError: Could not run any SAT solver. ``` This shouldn't be a `RuntimeError` that results in an ugly stack trace, but rather some type of `CondaError` that says they've probably managed to uninstall `pycosat`.
This one is related. We just need to improve the error handling here. ``` error: RuntimeError('Could not run SAT solver through interface "pycryptosat".') command: /home/brentp/miniconda3/bin/conda install -y conda-build user_agent: conda/4.6.2 requests/2.21.0 CPython/3.7.1 Linux/4.15.0-43-generic ubuntu/16.04.5 glibc/2.23 _messageid: -9223372036616970284 _messagetime: 1548885913575 / 2019-01-30 16:05:13 Traceback (most recent call last): File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/common/logic.py", line 279, in get_sat_solver_cls cls().run(0) File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/common/logic.py", line 175, in run solver = self.setup(m, **run_kwargs) File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/common/logic.py", line 223, in setup from pycryptosat import Solver ModuleNotFoundError: No module named 'pycryptosat' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/exceptions.py", line 1001, in __call__ return func(*args, **kwargs) File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/cli/main.py", line 84, in _main exit_code = do_call(args, p) File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 82, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/cli/main_install.py", line 20, in execute install(args, parser, 'install') File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/cli/install.py", line 253, in install force_reinstall=context.force_reinstall or context.force, File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/core/solve.py", line 107, in solve_for_transaction force_remove, force_reinstall) File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/core/solve.py", line 145, in solve_for_diff force_remove) File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/core/solve.py", line 240, in solve_final_state ssc = self._find_inconsistent_packages(ssc) File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/core/solve.py", line 342, in _find_inconsistent_packages _, inconsistent_precs = ssc.r.bad_installed(ssc.solution_precs, ()) File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/resolve.py", line 896, in bad_installed C = r2.gen_clauses() File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/common/io.py", line 85, in decorated return f(*args, **kwds) File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/resolve.py", line 668, in gen_clauses C = Clauses(sat_solver_cls=get_sat_solver_cls(context.sat_solver)) File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/_vendor/auxlib/decorators.py", line 59, in _memoized_func result = func(*args, **kwargs) File "/home/brentp/miniconda3/lib/python3.7/site-packages/conda/common/logic.py", line 281, in get_sat_solver_cls raise RuntimeError('Could not run SAT solver through interface "{}".'.format(name)) RuntimeError: Could not run SAT solver through interface "pycryptosat". ``` I got this error today and was befuddled enough to just uninstall and reinstall anaconda. (also some cursing...) My hunch was that activate wasn't working correctly when doing an env create with an environment.yml file because I also ended up with a mixture of python 3.6 and 3.7 in the base environment (which was on 3.6). When I went to try and fix that base environment, I think this SAT silver error was the next error I got.
2019-02-11T02:13:42Z
[]
[]
Traceback (most recent call last): File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\exceptions.py", line 1001, in __call__ return func(*args, **kwargs) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main exit_code = do_call(args, p) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 81, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\cli\main_install.py", line 21, in execute install(args, parser, 'install') File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\cli\install.py", line 250, in install force_reinstall=context.force_reinstall or context.force, File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\core\solve.py", line 107, in solve_for_transaction force_remove, force_reinstall) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\core\solve.py", line 145, in solve_for_diff force_remove) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\core\solve.py", line 240, in solve_final_state ssc = self._find_inconsistent_packages(ssc) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\core\solve.py", line 342, in _find_inconsistent_packages _, inconsistent_precs = ssc.r.bad_installed(ssc.solution_precs, ()) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\resolve.py", line 896, in bad_installed C = r2.gen_clauses() File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\common\io.py", line 85, in decorated return f(*args, **kwds) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\resolve.py", line 668, in gen_clauses C = Clauses(sat_solver_cls=get_sat_solver_cls(context.sat_solver)) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\_vendor\auxlib\decorators.py", line 56, in _memoized_func result = func(*args, **kwargs) File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\common\logic.py", line 293, in get_sat_solver_cls raise RuntimeError('Could not run any SAT solver.') RuntimeError: Could not run any SAT solver.
4,415
conda/conda
conda__conda-8328
662df07042b2b0f5096334c4594f4351a5685978
diff --git a/conda/cli/install.py b/conda/cli/install.py --- a/conda/cli/install.py +++ b/conda/cli/install.py @@ -201,7 +201,11 @@ def install(args, parser, command='install'): specs = [] if args.file: for fpath in args.file: - specs.extend(common.specs_from_url(fpath, json=context.json)) + try: + specs.extend(common.specs_from_url(fpath, json=context.json)) + except UnicodeError: + raise CondaError("Error reading file, file should be a text file containing" + " packages \nconda create --help for details") if '@EXPLICIT' in specs: explicit(specs, prefix, verbose=not context.quiet, index_args=index_args) return
warn on incorrect use of `conda install --file` argument ``` error: UnicodeDecodeError('charmap', b'BZh91AY&SY+\xeah\xb3\x02<M\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe2\xc30.\xddt\x84r|s)\xf7\xbdel\x1b\xee\x95\xef\xbb\xbe\xb9\xf7\xcd\xf7\xce\xef\xa1\x93\xe8\xfa\xb7\xdf\x0c\xfb\xef\xb7\xaez`\x07@\x03)\x04\x00\x00\x0fW\xbd\xe0\xf1\xd3@\xf6\x18\x07;s\xdfp\xe8\xaa_6\xe0\x1f{\xbc\x06\xf1c\xa0\x01@(\xf7\x86\x9e\xeb\xb8\xd36\xae6\xd9m\xa1\xaa\xa1}\x9d\x8d\xca+\xa0\x18\xaa6\x07@\xcb\xe3v\xfaE\xefM=\x05HSZ(g\xd8\x00\xf46{\xef\x80\x00Wz^\xdb\xe0;/{\x9b\xb9\xcf\x838{\xcf\xa0<\xde\xbeoW\xa6\xb4ty\xef\xb6\xaf\xb7\xc7\xde\xe1\xdc\xf7Z\x1e>\xect\x0e\xaf@\x00k\xe3\xef\xbe\xef\x07\xbe\xde\xf8\xbd\xb0\x00\x00\xf6\xcd\x10\xbd\xa5-\xeb\xdcu\xed\xef9\xd7\x80\x03=\xe9m\xdd\xd7\xdb\xed\x14\x1d:\x9b\x0fn\xf9\xb5}\xef\xb5\xef\x8d\xefy\xd9J/\xb6\x93\xd6\x9aV\x8dh4\xb6\x01\xf7U\x03Y\x18@\xa2\xb5\x8a\x87\xdc}\xde\xf9\xb6\xef\xbe\xd5\x01\xa0\xb3kT[\xb9\xd1\xdb\xbc\xf1\xf3\x0e\x90\x14\x00\x15\xdb\xefw\xddgZ\x01\xa9\x00|1\xde\xcf\x90\xfa\x03\x00\x00>\x8e8\xd0)\x88\x04Z\xfba]\xb0\x92\xa1\xe1\x0e\xfb\xe3\xc3!\xb2\x1b\x1c\xc0\x03\xdd\xef\xbet\x06\x82G\x9fw\xb9\xd5\x00\xad\xa8^\x9d\xf3\x9e\x015\xf4\xd0\x17\xb9{\x92|\xbe\xb7\x03\x8f\xa0\x1e\xea^\xd6\x05qe\xb5\xa5\xa98\x1c\x00\xd8\xb2\xedu\xe3\x85h;\xef{\xdf}\x8fG{\xdc\xeb\xb9\x81\xb1\xf5\xba\xef}\xc6^\xd5\x93k%\xa9g\xd1\xeb\xaa\xdf\x07\x9b\x8f\xaeq\x9d\xf7:\xaa\x16E\xdd\xf7\x9b3\x16\xc0\xdb\x06\xf6eD\x06\x9a\x1bc\xd7\x9d\xe7{6\xbeGo{\xdd:\xe8q\x97\x9a\xf5\xf2w\xd9\xf7s\xde\xde\xbe\xef\xbc\xf6\xb6s;\xb4\x9e\xdes\xe0\x03\xd1\xd7_\x1e\x9f@c\xeb\xbb];\xb7\xde\xf5\xd8\x95ml\rbh\xa5\xedTP\x02\xb3\xday\xbbt\xad\xdd\xdd\xa4i\x8f\xbe\xbe\xdb\xef\xbe\xd5|\x1an\xa6\xecrV\xd7Z\xf2\xf1\xd0T\x85\xe0;\xd3\xde\xd8\xe9\xdd\xb3\xafx\xc5b\xfb\x10]\x87\xbd\'\xb8(oc\\\xf3\x1d\xd8Nfks\xde\xe0\tU\x0e\xf6\x0b\xb0V\x9d\xec<u\x9e\x81\xad(2\x0e\xb9\x03\x93\xb6\xaf^\x05\x17A\xdb\x00[{\xc7s\xc9\xbd_-\xdcs\xc77>\x01\xdf9\xee\xaf\x14\xa5B\x82\x95\xf7\x1f=\xb7\xcc}w\xb7\x94\xfa\xd9\xcd\x8e\x9eC\xc3^\xb4\x1e\xcb\xbe\xd3\xd7\xd06\xc1\xad\xedJ7\xde\xe0\x00\x1e\xf8\xc3\xeb\xdb\x01R\x15B\xda\x10\xddz\xb1\xbb}}\xf7ot\xeb\xe8\x0f^\xb5\xd7\xbe\xfbe\xf7=\x8e=\xb7h\xf8\xfb{Qx\x84\t6\xcf\x9b\xd7\xbbL\xcb\xee(\r<@\x06\xde\xe0\x1e\x81\xe4\xf4\x05\x00\x00\x02\xd9\xe8\x00\x00\x00\x00\x06\xdfx\x02\xa8\xf2/G\xbe\xc0\x01\xd3M\x00\xfb\xb0\x18\xe5F<\xfb}\xf6\x01\xa0\x0f@\x1dk\xd9\x9c\xb3}\xb7n\xec\xde\xb7\x9e\xcfy\xe3\xb0\x07\x9a\xdb\x8e\xdc\xbb\x8e\xf5\xb6[)T\x1e\xdbom.\xee\xeb7Z\xfb\xdcv\xb6l\x0bywJ\x9f{\x9d\xb7\xb5\xd8\t\xb6\xe7jq\xb8v\xcd\xd6\xef\xae\xd1\x0e\xec\xf7\xdaN\xf7\xdfww\xbb\xb1\xf3\xa3{\xab\xeam\x8aP\xf44\x9d\x06\xa7l=\xf7\xdd{\xef\x8a\xf9\xef\x9f=\xef\x1ez.\xf6\xed\xb2z\xf8X\xdfgk\xe1\xef\x80\xfb\xd9\xb7\xc6\xf9\xf7\xbd\xa7{\xac\xdch\xf7\xde\xeep\xfb\x1b\xde\xed\xd7\xbdw\xbb\xb9;\xef>\xd3\xb7\xb1\xf7\xc5\xbb\xe9\xbboy^\xf5V\xd4\thP\x1a\xa0\n\x00P\xb3\rn\x1e\xd3\x1f-\xcd\xf7\xbb\xd5|6\xa7\xb6\xd9\x97\x04\xda\xaa\xb6\xd6m\x1b}\xf6<\xaf}\x8e\xd7t\xc3d)\xa3\xad\x14(h\xe9\xca \xd8V6\xac\x02\xdbZ\x0b\xb2\xdd\xcb\xad\xbb\xbb]>\xf9\xddvb}\x9a\xb3\x00\x14\xf5NB\x95\x13\xa5\x86\xfb1Vvn\xdc\xa6u\xba\xe5\xa6\xb2\xd5\x94\xd0\x00\xd6q\x8aQJ\xdd\x9c\x07r\xc7wjZa\xd3w\xc7\x0e\xae\xcd\xb6Jj\xf4\xf7\x03^%.|\xefV/\xbb\xe8\x9dxz\x1f{f\xf1\x1f\x00>\xe3\xb9f\x1bc\x96\xad\xb6\xc7N\xec\xeb\xb5\x0f\xb7;oNq\x1fRn\x06\x9a\x1a\xdb\x8e\x1c\xea\xde\x8ak.\xed\xdbu\x95\xa4\xbd\xcdS\x96\xd8\xbdqu\x07\x9e`\x07C\xeeg\xd7\xa3l&\xc1\xd3\xb9\x83v+\xa3\xa1\xb6\xf9wh\x80\x86\xad\xb5Zl\x1a\x16\xc5\xa3\x8f,\xf3\xc3,\xad\xb7\xa6:y\xde\x8e\x9d4\x00\x07M\x07\xa1Ww\x1c\xcb\x1ba\x85k\x00\x1a\t\xbe\xdb<\xf2=+\xa0\x0e{\xba\xf5\xbd\xde\xb1Mh\x00\x00\n\x1b\xa2\xeek\xb3n\xeeu\xdd0\xeb\x1dw\xb6\xf5\xbc\xde\xcfv\xf4\xefz\xdc\xa6\xebrs\xb5\xedx\xd5\xa0\xfb\x9e\xec\x93\xdb\xef\x99\xf2y\xf0\x03\xed\x80\xd6\xd6\x1d\xb0:\xa4v\x19\xd8+\x15;g|\xf8\x8e\xe8\x1f}\xaf[\x9e\xeb\x89\xed\xe5\xefs\xbe=\x80\xdeWpVj\xde\xe7O_;\xee\x80c\xbbN\x15w\xde\xf5\xd7\xa5\xf5\xd7\xc7\xdfZdto)\xdb\x80\x00\x03M(\x02\xf6=\xca+z\x08\xeb\xb0=\xe7q\xe4fu\x17}\xefJ\xab\xbd\xbe\xdf[O\xb6\xbb\xaf\xb7\xaf\xbd\xae\xd8S\x80\xd0\x03\x94\x8d[/]\xe7\x9a\xb6=\x9b\xb5n\xef8>\xee\xcd\xceA\xf7\x8e\xf7\x93\x0f\xb7\xbep\xf9\xbe\xfb\xce\xfb]{\xe6[\xd7P\xfah\xfam\x81\xad\x1b`hk\xa7\xce\xba\xf9wv\xb7\xbbw\xcf=\xbd\xdb\xaf\x91\r\xef\xb7\xaf\xb5\xa6\xde\xc7\xbd\xcf]Y\xbb\xed\xdd\xeb\x9f7R{b\xf5\x9d\xb3\xba\xee\x1e>\xfb\xe9|\xeb\x8e\xbe\xed\xd3\xdf}\xe9\xf16\xcf\xa6\xee\xed\xbb\xbe\xec\xfb\x9d\xe7\xdb;9{\xb7\xaf}>\xfb\x81\xf2\x1e\x95G\xabl\xf5}\xd5\xdbg\x1d;\xbd\xef\x81\xdb\xd9\xee\xee{F\x9d\xb3E\xed\xde|\x9f}\xf5\xda\x8e\xfb\xbaAdLm\x8e\xe3\xdf^\xfb\xe6\xfa"T\x8a\x97mT_[\xeb#u\xdfk{\xe5\xab\xeb5\xf3\x14-}\xa7\r\xf3}\xf6}6SX\x0b\xebg\xbe\xea\x9d\xee+\x17\xa7\xbeg\xbe\xe73\xc4\xb7\xd7{\xc7\xda{\xde\xee\x8b\xab\xd2n>\x9e\xec[\x1bL\xed_{\xdd\xb3\xd7*\x17\xcfw+=s^\xec\x0e> \xa2\x12\t\x01K|\xfb\xd5\xb6RQ(\x0c\xe6;\xbe\xfb\xa3\xbd\xdd\xef\x9f\x1b\xdfx>\xbc\xdf{\xb7x5_k\xcd\xc6\x85\x8eis\x93!\x8erp\x00\xf4\x05\xf7\xbe\xe7"\r\xeb\xc3\xe0\x06\x8f@|;\x1e\xfb\xc2\x14\x03\xdd\xb8\xf9w\x03P\xa1\r\x11\x04\x00L\x80\x00\x00\x00\x00\x00F\x04\xc2d\r\x00\x00\x00\x00\x00\x00\x00\x04\xc0\x00\x00\x04\xc10\x00\x04a\x00\x00\x00\x1a\x00\t\xb4hA\xa0\x80@\x08\x00&\x80F@\x00\t\xa6\x9a\x00&\x00\x00\x98\x9944\rL\xd4i\x84\xd3\x02d\x06\x9a4\xd3\x056\x8c\x99Ldd\xd0d\xd2\x8f\x11\x84\xf4\x10\xc9O\xc24\xd4\xf4\xc1L\xd0\x13hI\xe2OH%2\x11\x04\x08\x10\t\xa0\x08\xd3 \x024\xd3\t\x84\xc9\xa6\x93\x02z\r4\rS\xc4\xd4\xf2e=\x13\xc6\x80\xa3\xcaz\x98\x9e\xa6d\x994\x9e&\x05=\x90dh\x13$\xf2G\xa4\xc6Dd\xf4\xc8\x9a1\xa9\xb4M=LL\x9e\x9a\x086\x88\xd3A&\x92$ @\x04\x01\x1a4\x98\x13\x04\xc8b\ny5=\xa2\x9f\x90\xd3@L\x04\xc1\r\x1a\'\xa9\xb4\x9bS\xd0\xc1T\xf7\xa4=\x06\x91\xb5)\xfbEM\xe6\x89\xea\xa7\xe2)\xb4\xd9\'\xa1O\xc5O\xf5\x18\xa6\xd0\xd4\xf6\xa9\xe2\x9a\x99\x8fR6\x88\x8d\xe5Oh\xa62M\x19=5\x02$\x88A\r\x04d\x04\xc2\r0\x86\x91\x80&\x13L#\nyO)\xe8\xd3M\x18\x99\x06\x934\x99S=0\x06\x83*y0\x89\xe0\x9aeO\x19\x02j\x9e\x9bBg\xa6\x93\x19I\xe4\x9e\xa9\xec\xa9\xa7\xe4\xd3\xd2\x08\xd3S=S\xf2\xa3\xf4M\xa8\xc1#\xcd\x14\xde\xa4\x11$\x81\x02\x00\x9a\x00L OA\x88\x02hmL\x0112z#M2h\x1a\r\r\x0cS\xd0\x057\xa8\xd4\xa7\xfa\x01\x88\xa4\xf6\x9bM4\x8d\x90e3\x13Jbz\x9f\xa8\xc4&\xcax\x94\xdbH\x9eS\xda&\xa6\xf5F\xf52\x9bS\xf4I\xa6\xd4\x07\xa9\xa7\xae\xebg\xaey\xb4\x0b\xfdi\xee4ouqm\xe8i\xedp\xe1|\xe9\xd2\xf1\xcb\xccV\x92\x97F\xe2\x1e\xb5\xacY\x00nVF\x91hV;\x90`B\xf1\xc5\xd7\xba3(\xe5\xc5.\xb2\x1e%\xf7\xf0,p3\xfa,{N\xccV\xc4y\xb7S\x81\xa0A]B\xf2\xaf\x88\xac\xde\xaa\x05\x12a\x84u\xe7+h\xc2\xce\'%S\xb5\x84A\xc93hC\x88L.\x9c({V7\xdf\xb4@\x01\xe2\xf8c\xd8k\xf78\xf5\xe5\xdf\xcd\x96x_\xb7\x16\xbd\x80\\/\nW^\xff|\xc6\xc2v\xc2h\xa9\xb9\xb3\x07\xd9J\xc8;\x05X\x7f\xcdH\xdd\x13!\x0f6A%\xe2\x9dL\xac\xccmge9\x86\xd6\xadf\x8b.\x0f\x90`\xa5F\x8cE\x10\x14\x86\x8c\xb1c\n\xf2\xff\xfa\xb5mY\x9a\xb6\x01:rAA(\xf0a\xa6\x83\xcfm\xc8B\\\x18\xde\x83\x06\x80\xe2a\x17\xc6\xcf-\'\x889\x88\xa2H\'\x04&\xaaqX\x9cS Q\xf0$\x00\xfcD\x0f\xc7@k\x8d\x052\x94\x1f\xc7\xb7\xc5s\x7fv\xf3\xf8\xff\xba\xf2\xf29\x1a\xfc\x97\xef\xfd\xa7\xb5\xa2\xe9Qw\xb2\xbc?\xf5\xf3\x83A\x0c\x17\xf1\x1c\xe58\xad\x89\x90\x15\x18\xaa\xc2\xb5\x00`\xc0\xe8\xbf)1!\x1d\xbf\x99\xf5\xef~{\x0f\x89\xa2$\xef9\'\xa2\xcb\x9e\xf2\xca\xfc\xa4V?\xff\x1f\xd5\xffK\xff\xbb\x7f\xc5!\x8a\xb2C\x08dI4\xc6\x8a?\xf37\xf5\xcc\xaa\xb1\xd9~\x0fi6&S@\xc3\x92\xba\xc2k\x11\x00D\t\x8a\xc1A\xf2\xb9\x93\x08L#\xd4\xa0\xd5n7\x93\x0c_\xf8\x9f\x9b\xff\xb0\xab5\xfa\xec\xcf\xdcq\xf8\'p\xe2\r\xe66,\xce\x19]8\x8b9\x82\xce\x0c\x03\x06I\xb0\x9f\xb3\xfe\xda\xad\xe4\xb4a\xbe\x88cc\x92zG!\x95\x83\x06K\xa2Zn3r0\x02\x01\xd6O\xfd\x11\x16\xa9t\xc0qo\x90\xc82m\x8c\x8a\x9b\xcc\xf9\xd0?m\xde\xf5\xf8\xbe\xa0\xc0U\x93\xc1\xc8G \x19\x97\xeeq-\x1e\xa49A\xfa@tK\xaa\x1d\x90\x8f\x8c\x99\x12n\x87\xb4#%.bZJH\x9f\x03\xe0\x11\xa1\xf5\xf8\x8cX\x80\nG\x07u\x86\x94\xe9\x88\x85"\x0b0\x15d\xcc\x18pv\x11w\xfa\xad\xb8\x04\xa8Yy\xd4\xa2\xe8\xf2\x86M\xb2\xda?;`\xda\xb2\x8bu\x08\xc9\x9b\x83\r\xe0\xa2\x9e\xaeA\xf8-A--))C&\x04\x98\x93\x12aI\x17\x87d&\xa4\x82d\x80\x85\x06\xe4\x80{\x11P*\xca\xd0E\x80W%\xd9\xda\xa4\xa3\xa0m\xf9\xd8\xebl|x\x8e\xda7\x9ah\xcc\xe2\xe1\x84(\x84\x83\x83\xd2W\x85\xfd<\x01\x9a\x9d<\\\xd9\xee 8\xad\xbd{\x8b\x9f>n.\xbe~.~-:)\xa3\xc0\xdf\xe8o\xea\x1a\x878\xb4\xb3F\xf0\xec\xf4P\x07\x04s\xc1\x0eFa5\xbe\xa8\xe2\xef\xc1G\x8ex\x8f\xb2^>\xa6n\x0eB\x18\xb8\x85x\x00o4\x8b\x87\xbd\xca\x00c\xc81\xf5\x8f\xc5\x18\x88\xc3\x8bTr\xc7\x8bC\xca\xae+ \x12\xaa\xabP\xca\x86\x82((\xa2\x07Qa\xde\xe6\x98\xf60\xe6u!\xe2W\x04\xe4^\xf7%D\xd5\xedd\x0c:\xe1\xc3:\x99\xdf\x19\xdc\xc3\xd2\x0fM\x07\xce\xbe\x7f\x86\xe6/\xcb\xfa=d\xec9\xbeOC2\x8b\x07S\x05#k\xb7\xe9n;\xa3\xd1\x80\xcd\xa3\x08\xb3\x1f]a\xd4@\x0e\x0c\xdau\xf4U\xcf\x86\n\xb4\x81\xac,\xb0\x0b\x05\x83Q\t\xf2\x10\xd9\x1b\x17\xd4\xc1\x983\xa41\x03!dg\xce\xcc\xf5:\xa5\xba\xf5\xcdp\xa5\x88B3\x02o\xf24\x9b\xfe\x92i\xda\x9c\xac\xd7\x12\x1c\x92\x07#\x91\xea\xb9V\xf4\x0e\xc5\x80+\xeb\x88\xaf0\x8a\xb5T\x10\xfa\x94\x1d\xf0v\xfe\xc6?\x95;\xff\x06\xfb\xadE\xd7\xce\xde[\xa1T\xe6=\xd6qZ\x06i\xbe\xfb\x9a?\xcaj1\xad8\x95\x90kACp\x81\x87\xb9\xa1\xbb*\x88jn\r\xbb\x0c\xb6U\xd0k\x99\xcb\xe7s*b\x97<\xd6\x06\x05[|B\x8b\xe2qX\xc3]C]\x8b\xa6\xd9\x87\xcc\xc9\xa0>\x92\x0c\x10\x06dFu\x08}\x9d\x91\xa7R`a\xff\xd1*\xa3(\xb6\x13\n&\xaa\x8e\x8d\x84\xc0B\xe5N\x00\xbb\xcf\x15,\xf5-MO\x90\xee\xc4v}>\xc4v=\x7f_n+\xe8/X\xeb\x88PE\xd9\xb2\xf7\x8du\xce\x16\x16\x81\xdaZv\xdb`\xecrVD\x053\x01^;u6\xdcx\xed\x18\xee\xb5;Kq\xdc\x06a|\xcb\xb16\x1eC,\xbb(\x06\xa2=\xb4\x0f;\x08\x81\x10\x01\x02\x9e\x93\x94\x9e\x9f\x9cVrqi\xf9\xc6"jyT\xe7\x12\xbc\xf2\x98\xe9\xf7\x95\x18Q\xd1Q\xd0\xb1\rQF\xbdvq\x7ff:\x9d\xbb_T/1\xd9\xef\x1b\xa3\xd76\x0b\x16\x86\xac\xcd\xf6\x19\x9b\x1ag%\x8c\xd0rL\xfe\xba\xb8\xb9\x90p6\x9aje\x14\xe0\xac\xe0+\xae\xaa\xa6\x18\xeac$%\x07\xd9\xa2\x0b< t\x8a\xddSg\x9a\x1a\xc0\x88uD@\xe4\xc2$X\xf6\xee\xaf\x0f\xc3\xae\xe7\x04\xe2\xd5\x13#^\xf6\xba2\x04"\xb3\x0f\xe11\xb5\x0f\xb4\xd6\xe29\xe8\x8c6\xa7\xe8\xd97\xbaH\xa45\xf7\x8d\xb8\xb8\x95\xdfqr-\xc9\xc3\xa9\xf5\xb9\x8e\xfe[\rb\x02Y\x81\x9e\xa5(\x82\x1a*\x91\xfd\xde\x8f/\xde\x9a\xd9\xe1\x11\xfc"\xad\x9f,\x84\x1c\x8a$b\xc4g\xb6\xd45\xf1\xdc\xb2\xf8Q\xf7P_:\x01?\xe9\xc6\xcb\xaf*\x00\xf8\xe2$G\xa9\x8a\xde\x022\xf4\x88\x88B\nZ\x1e\xce\x00\x8d\xa0\x82\xb2B\xc4!\xac20\xa9P$\x86x\xa9\x88\xb3E\xa6\xbd\x9b\x9f\x8dd\x80\x98[\xf3f[\xfb\x99\xbeg+k\xd0\xc1\xe5\xd66z\x8dT\xe7\x9e\xc2k\x08\x93a\x1f_6\x14C\xa4\x81\xdd\xf4=\x7f@;\xffdQ\xdeX\xae\xfe\xbb\xc2\xc6n\xbb\xd9[\xbd\xcf\xe6X*s5\xf6\x14Q\xdd\x90\t\xff\xea\x84\xc0\xeb\x8a(\x90U\x8cE\x88\xa8\x8cT\x15F#\x15"\x83\xe8\x14\xf8\x12[\x0f\x9e5,\xcf\x90L\xc9\xed\xa6\xa9\x9f\x0e\xcc~F\x8b\xc3y\xfaM\xea\xa7\xa3N\xd1\xf8\x0c\x00:\x8e\x14`\x83\x07\x9aE\x11\n5aZN\xce\xcc1\x044\x85\n\r\x8d\x88\xd0\xa2\x08\x94,:\x19\x1b\x98u\xb8\x98\xcdfv^\xd7\rm\n\t\xbd\xe1\xf7\xd6\xa8\x00\'\x85$4.\x90\xcd\x9e\xa4\x1b@\xa2\xc5\t$\x86\xd0\xb7G\x13\x81d\xe1\xa1\xb2^%\xd4r\xc3x\xc2\xbeK\x19\xf4\xfa\xca\x1c4\x14A\x00~\xc4Dx\x07[\xd3\xd8\x0c\x0c\xf1\xd6\xac\xabQR\xc9\xaf\xaa\xd5\xf0\x9f)\xc0\xb9.vk/\xe1cZ\xdeN\xad*\x8a\xbd"\xad\xd5\xbe\x0e\xcdq\xde\xfc_\xaa\xe9\x11\xe9\xa8\x0b\x88\xdfSMH\xea\x9a/\x84\x1f\x11\x99\x9a\xb7\xcd\xf2\xe7\xb3D\xa6]\xda\xa8\x93\x0c\xa8\x1a\x04>\x8f\xb3\xf5\x9d\xb4\xc3\xbd\xf0f\xdf\xc6\xcf}\xdf\xf5h\x03\x807\xd7?\xd8ox0\x1d\xa6\xfd\xaap\xd7{\xb5\xa4\xfb\xdbb\xe3$}\xa2\x0c\ny\xe9\x94\xde\xa6\x04T)\xf2\xa3\x1e\xc6\xfc\xb9\x1e\x8c\xb8\'\xa0\xc8\x0fR\x1aI\xa2\x02\x89\xd05k\xe7#\xe7\xf9\xdf\xc1\xdd\xb0\x88@8\r\xb7\x8f`\xd2\xfb\x16\x7f\xb3\xe0\xfaj\xa4v,x\xba\x9a\xfeW\rj\x88|\x87\x1fE\xca\xce\xee\xc3\xf0\x00C\x11B\xc3\x07\xf7\xfb\x13\x1b\xdb\xa3\x00\xba\xf1\xd1\x90\xc1\x83!\xed\xee\xe7\x06\x17\x87S\x0c\xee\x7f\xc6\xea^\xb7Fk\xddU\x94\x84\x84#\x92MY\x0e7]\xe6O\x8d\xf5\x1bc\xddY\xf4:\xfb\xb9\xf6\xdf\xeb\xff\x86\xa3\xfd\xd5^Z$P\x98\xc4~\x15\x0c\x95\x1fP\xa3\np&\xb3\xe6\xe5\xd7\x07\xfdZ/\xd8\x18g\xff4\xcc\x0bKm\x1f\xb3\x84.>9\tu?\xb4\x84\xe0kKiN\x8b\xfd\xf9pU\'\xac\xcc\x12\xbeO\xff\xa1\x14G\xf6\xfc\x1e\x0f/\xb1\xb3\xe2!\xba\xa2@\xdf\x03\x95=\x18\x14\xd4\xf0p\xado\x8b\x82A\xd9!\xbc\xe2\x80$q\xb7\xd58\xb5wg"0\xec\'Y\xee\xf6\xb9i\xc62\x84\xc2\x06k\\\xa8R\x11\xb3\xee\xe5Q<v\xea\rW\x9f\x96\xe3\xc2\xb3,\xbb]\xa5\xd9\xa2\xaf\xd87\x9e_5fL\x9d\xa7|a\x95L\x9aE\xc5\xee\x82\x93\xd8\x13\xd0\xc8x\xb6i\x02N\x15~\x88\x90\xe8\xb0\xd5\xcd\xf8?\x10\x0c\x8ds\xbd\xf8p\x9c\x81w\x9f?a>7\x85\xb6\xe9s\x10\x86\x9dz\x1b\xe1t\xb4a\x81\x04z\xe1\xd5\xe3\xfdF\x8c\xec\xc6X$\r\xb4\xd3\xe3\xcc\xc1\xde\xb8\x83\xfeuu(\xc3\xaf\xf0}K\xb6\xa9x+\x01M\xcb\xf5\xc6\xdd\xca\xc7Ls\xf3\x13N\xf0\xea\x19\x9830"\x19\x92\xb8\x97\x9c$\xf2\x1d1f\x0c\xc0#\x039\x96QZ\x95\xd1\x15\'/"\xa7%\xc4b\x8ab;:\'\xd3\x7f\xb5`\x0cG\xac8\xcd\x06y\xdcM\xae%&\xff\x87NL+\x9f\xf8\x9e\x8e\x8e\xc3\x01p\x8fpGQ\xa6?\x8a\x08\xacZc\x13\xe9\xbc\x7f8\xfc\x9f{\x9b\xf1[\xd7\xdeg\xe9d!Y\xee\xbd1?\xba\x16\x87\xf5Y\xff\x81\x81\xfc\xb5O\xc3\xf0^S\xf4^y\xd3vY\xe8\xf9_\xab\xa5!\xfeB\xaa\xa4_\x94lR\x1f}\xf5\xcd\x1a<\xaf\xae\x88`\xcc\x94T\xc3\x94\xa5\xd59\xb4\x8d\xe0a\xdf}\xf9\xbfMWX\x90\xd1\x16\x84!",%\x19\xa0es\xbd"\x1f8\x80\xa0\xbcN\x84\x90\x95\xa0\xe6E\xf9\xe6\xa8|\x1erD9\x8b\xa3\x04\x1a_\xa6\xda\x96\xff\xaa\xcb\x97\xfe~\xa1\xf1\xcd\xfcD\xf6Up\x18$/\xa1c\x17\xf4q\x10\x10@\xa3v76\x8f\xcf\xb0Nl\xaf\x05dY{\x8b\x97\x17\x88\xd1\x83M\x9e\x1e\x1cTn\xa3F\xcc\xe6L*\\\x93#\x8aK\xb6]S\x94\x10H7\xc7\xd8\xf4\xb9\xaa\x7f\xcc\xe9 7a\x84>\x11\x137KT\x8a&\x918\x81{rD\xe7p\xc1\xf1\xe9A\x11beu\xb0\x8b}\x8c\x83\x85\x86\xce\xebP\xbb\x91\x0c=\xa4\x00-\x81\xe4\x82+\x1c4\x84\xdd\xe9\xac\xdf\xe0\x8c\x83\xfd\xe0G\xc4[\xc9\xd3\xd5\xa4\xb7A\xb6\x05\xd8\x92\xc3ov\xd1\x10P\xd6\x80$hhTe\xc9\xf5\xee\xcf\xc1\xf9\xfb\xa6\x10V\xf4S\xbf\x897\xe3\xaa\xc2_\x9b\xbb\xa2\x84\xad\x0fSK\x9b\x9f*}\x910\x81\x8fX\x89w\xc6\xbf\xe3{z\xb7w\xdbX\x8fu\xb3\xd6F~\xb9\xd6\\]\xfd\x92\xc2\xef\x13\xe5\x83\x1f\xaf?\'\x176Gm#\x1e/\xdc\\O\xa6\xc6\xea\n\xe3\x17{$\x94S\xea\xf5\x89\xf5\xf7\xe3^_\xb3]\xae\xc4\xa7\xf4\xc2\xf4\xdd\x93\xd0\xf4\xa23@T!\rlU\xbd)\x86\xbd\xcc\xd8\x15Z\xe4E\x0f\x15\xed%\xd92Ae\x0b\xd0\x17\x1cm\xb7\xb1\xbeb\x18O\xdf\xa5\x12A\xbc6\x0566\x0c\\\xda+;`\xa4\x19\x0b\x95-\xee\xce-\x8b2\x06Cb@\x8b\x06\xca\xfa3@\x1c(\x98h\x9c\xda\xa82\xfd(\x18\x98\xc7\xda\xfb\xaa.\x9el+\xd8\xcc/{C7W^\xff\xe1\xcb\xd8\xe7v\xdc\x15\xdfn\x04\x0e\x04\xe5uK\xdb\x8b\x83\xf5\xe4\xedT\xd9\xa5\xe1\x06d<.\xdc\x023\xbe,\xab*\xf7\x8e\x01\x05\xc8\xc8\x80\xfd\x0c\x89\x1f)\x85\x1f\x98\x94v\xee\x8d\x95\xc1U\xee\xfdK\xe2\x84\xcf\xa8w\xb7X\xd7\xe5\x95 \x0ei\xfd&\x81Q\x9f~U``\x07\xeeb\xbc\xd5HnF\xe8\xc8\x8c\x1duY\x14\x16C\xcf.xP\x89D\x90\xd5\x01\xbc\xdd\xe5\x18\xaeA\x93&\x00q\xbd\xf0\xda\xd3M`\x9f\x99\xe1\xfe\x0f\xbf\xec\xf9\xf5\xce\xe7\xe5\xecx\xd9\x08x\x18W\x81v:\xdf\x91\xee\xf3\xa2\x97\xd7\xd8\x158@\'\x82\x00\xd8l\xb0k\xb0 \xcd\x00_nXW\xae\x12\xa4\xb8\x02D JPa\x9fj\xc8\x07\xb8\x1a\x03J\x17\x0e\x1f\xf1\xcdH\x0b\xfc\x8atx\x9dx\x1d#\x91\xd9\xec\x81\xf2\xe2\xa9\xad\xb7N\x94\xb1\r\xaa\'\xb5\x1a\xb8\xb5\xed\xa6\x05\xb5\xfa#a\xd7#Al\xec\xb3\xa7\xa3{g\xc8\xf1\xb8\x1a\xb5\x10\xd5D\xd5ia/vX\xb0\x19pl\xc5\x8f\x9c\xef\xd91\xcdl\xd6\x83t,\xf9\xc6f]\x19\x9a\x92\x89\x81\xa8\xc2\x071\x13N\x92\tu"\x98\xf8\xaa\x92\x0c\xe8\xf1\x86\xed\xc1.\x1aH\x92g*\x84\x95U\x14LQN\x81\x89\x0e\xa6D\xa6\xdc\xd5\xcd\xa6\xaaiL\xb2^\xf1U\xf5KH\xc6:\xa1:m`R\xe7Y\x18\xa6\xab\x17\xd6\xb1\xb6\x0c\xcb\x1b\x9cU\xc1E\xef\x87V\x91z7U\\\xdd\x8b\xe0~\x1a\xa1\xe4 =\x1a>\x8a\xee\x00\x05!B\xb0H\x00\xd9P\xba\x97\x05\x0f\xd9\x12\xe2\xbcCN\xcc\xe0\xcb\x1b_ \xe2\xf9\'\xaf\xde\xcet9\x9e&l\xb83;;\xc03/\x1d\xc4X\x06\x7fU\x8b\xefa4\xe1\x12\xd0\xd1o\xbc\xfb\x970\x80\xa8\xa0K\xbeV\x16r\x9aZ\x03\xc3\xd3\t#\xc6\xe1\xdf\x04dS<\xc6\x85\xc1\xd1YB\xc0\x81\x98\xf1C\x145\x1c"\xc2\x18\x9f\x1bI\x90t\t\xeaH\x81\xaa\xa1\t\xbb\xe3v\x1dnpD\xe7D2\x93\x88\xf9y\xa8\xe7c"u\x14Q!\xc8\xbe\xfb\\\xe9\x9d6\xd3\x91\xa9f\x05 \x18\xc7\xa0z\x9aE4n\\\xf9\xa0\xafH\x90\x80\x82\xc6\x89,U\xc4\x90\x81+.\x00\x92V\x9d\xbcv\xadL?\x07\rc\x14\xcbx\x9a\xe3Qr\xd8\xd1\xc3v\xf5\xb9\x9c\x94\x99\x07*\xa2\x81Pz(u*%n\xd2\x8adb\x02\xc3\x9eRY-P6\x13\x1c\x14C0\xa2\xacU@3d\x02\x86\x01\x994GsI\x19:p\x9a\xe7\xdd\xa1\xbe\xb2\r\xf2&\xa0\xdbk\xfa!\x1d;\x89\x15\x99\x17L\x85\xd2\xedn \xc4\x0b\x98\x17;\x041m\xb3\xea]m\xc7\xe8\x1fE&h\xd6\xaa\xaaE\xe7\xa0\xde}\xf1\xf0:_R\xee\xa6\xea\xf9\x1eF:\x03y\x9a\xc6\xfc\xd9\xdb\xd6\xb9[^E\x17/\n\x9bp\xad\xcb\xf93\x1f3\x8c\x1e\x9b\xc8\xc2\xd0XL\x08.\\\xb4p\x06d`KI\x90\x96\xb14\x05\x14U\xb6t\x05\x865\xcc\xf4\xdb\x96\x11s\xa2m\x13\xbes\x14\xd4\x94m\xd8\x06\xa0\xf0\x08\xe6%\x16\xfbF\x82\xbd-\x9f\xec\xdd>\xa4\x80)\x94 l\x8c\x05\xce\xce\xd4N\xda\x13L.|\xb7\xfb\x89\x9aG\x0f\x03@\xee\xe0\xa5\xac=t\xf1\x1b\xb1\xbc\x0b\xbd/\x1bj\xf0\x82\x02\xee\n\xe1\xb4\xbb\xa7b\xee|{\xa4\x1c^\xe3\xb5?\xd6^\xf4\xfd\x1dq\x83\xc9`\xc0.\x0c \xaa\x89j\x11\'\x0fZ\xcf\x12\xecn\x8c\x0c\xc8\x1f\xbaA\xfb\x90\xd4\x00T\xd3\x95n\x8b\x88)\x91w\xf4\xaf\x9eg\xadi;\xd2\xfc\xf4\x15\x9f\x08\xfdfd\x1a9\xa9=*\xc1\xe4DV\x0c<\xc0\x1c\xd8 2V\x9e\xbdY\x13\x96\xcd\x10\x91\xeeb8\x8a\x0c\xa6\xa2\xa5 7\xe1\xf8+9\xd25\x82!\xce\x1e&/\x1b\x1b\x88\t>\xa1t\xc9e\xe4G\xbd\xe8f\xcb\xc8oW0\xf2\xc6\x100f-{\xd0\x80\xf5m\xf6z\xdbg\xd3\xe5\xfbq\x8f\xdc\xf3\x17\xf4G\x97F\xff\xbf\t\xc28\xf4\xb2\x8cy\x86@\xd6\x10\xc0`\xbc\xd8\x17\xb9\x19\x9f\x0en\xb8\x98|L\xc0k\x81C!f\xb7\xb8\xa3\xe0-[\x1a\x82\x84\x17\x8c\xceq\xac\x9c~\x9d\x01H\x06\x14j\xc3\xd8\xed\x02)\xca\xd0q\x00*\x037=B\xae\xc9\xa1\xbbn*\xfd\xea\x87\xc0\xb0|\xbb\xa8\x9f4\xf3\x1d\xac\xac\xc7\x06\x97\x90\xa0\x80\'\x927\xab\xe9$&0\x81\xa1A\x97Fv\x80WWS\xc4\x01\x80f\xd2$\x05q\xefH\xbe\xbd6\xd9\xf6\x9a\xb9\xe6\x81\x0f\xa58\xa0\xeb\xa0A\x84\xb7$\x88Ts\xf4\xb8\x1df0\xf4\xcdixt\xaa\xa5\xf5K\xef\x11\xd8gc\xaeOsj\x0cBq\x12f\xf5\xd3\xd2@\x1c\xf6@\xacn\x99\n\x95\xa7\xb4\x95\x9dT\x8b\x08\x81vr!\xaeb\x99\xa9\xd7gi;&\xd8?\x7fYq\xffd\x0fvg\xa8\xec\xba\x81\x92\x17\x03\x19\xf0\xab\x85K\x8d]e\xf4v|R|\xe6\xc9<\xb8\xa95"\x8cST\x94bx\xca\xc9\x95\xfd\xa8\xe2\xb2n\x08\xa3 \x05\xd9g\xdc\xd0\xffc\xd7\xe6d\x0f.kL\x80\x19N\xf1\xe8\xcc;8\x93\xa1\xb4q\xfc@\xd2\x02\xcf\x0c\x10\x99h\xf30\xf3\xd8E\x87\xb1\xe6\xeav.\x87\xbe\x80-\xd7\xddn\xc6\x94\xef\x87a\xce\xda\xa2_\x90<\x1d\xe1\xc5\x00\xf9hg\xb3\x010\xd4!\xb5T\xa6\xcca8\x89O\x04\x12\x9e\xd7\xa5\xa4\x9d\xb7\xc8\xb7\xac\xbd\xd6w|Vppq\x82\xb98\xf3\xe6\xd9\x16\x02=\x1fGY\x9bm!\xae\xe8N9\xc1C\xc6s\x02\x8bZg\xfa\xf5{\'e~\xb2\xd3@"\xe1\x80<M\xd5\x03\x1ep\xa2&\x06W\x93\x9a\x80\x9edK\xda\xef\x06\x07\xb1\x1a\x07\xcf\xd9=\x9c\x9a\xa9\xee\xa5wg\xf9\x9c\x8e\xb3\x86\xc1\x81\xd2P\x9b\xf1aspa`\xa5\xc8\x12\x08\x12\\\xd1\xeel\xfcZ\xaao\x0b\x1c\xc5h\xe6\x04;\x99oG\xe1\xd7\x07\xfc\xd3\xa1\xcdH\t]\xa8[\xae\x1b\x96?#\xd4p\xde\xdd\xc7\xe3;\xda\x81\xbc\xa9\xf2{\x06\x9b\x1c7P\x14r\xb4\x89\xcc\xb9G^\r\xdc\xc3\x98v\xe4\x18\xf0d\xc5\x03c\xd1\r\xcc\xeen\x19\xb5\xa39\xbajo0\xb6\x06\xd7o~\x1b\x83\x12\xa6\xa21\xea9\xe9\x93\xe2\xfa\xa35\xf5\x17\xf6\xd7=\\\xdd\x14k\xf48\xa5\xbbS\xc1\tV\xd0!6\xfe\xae\x17s\xbb\xf5M\xb3\x99\xf4Fs$\xf0w\x1472\x14\xe76e\'@\xda\x88N*,t&,}\xe6\xd4k\x8b`\x0f\x18s\xa3\x80S\x8e\x01\x85\x0c\x01\xbf\xa9\xddN\xc4\x14\x91;\xc5^\xd9\x89u\x82\xb5BP\xb8G[\x06\x88\xb4!3\xc6P\xef\xa5\x17"\xa5\xf4\x1c\xac\xadDJ\x14%v\x9b\xa1\t\xcfj\x8a\xbb\xb0:\xee\xf0\xcb\\\xcb\xa09\x08\x07}\x9d\x1c\x0b\xe0\xa7Uh\x87a\x87\x8e\x1e\xa2~\xcd\x14\xef\xd3V\x7f\x7f\xd9`@U\xcdP\x84\x92L\xb0a\x17\xa3\x9a\xa6E\xf7N\xbeeK\xa4;\xa6\x06\xb2HI\xc6\xc1\xd4C\x06+2[|\x9b\xd4\xfd@gpeR\xbbqd\xd6"\xb0D\x83\x85i\x0fF\xee\xc6,\x90\xd8@\xb4[K\xb7\xc4\xad+3>\x05\x10\x852\x0eC\xa8|\x9b\xdc\x84\xbe\xf1\xe0\x9f\xb1>>,\x14\xbbp\xb8\xeb\x83\xa3q\x9b\xf8\x17O\xd3\xcd\xd19u\xaf3;{\xdar3\\\xc7n|=\xaf*}=u\xd4n\r\xda8[\xce\xea\x18}7 \xb3\xd2n;{=\xcf\xa7C\xb8\xc3\xad\xe2}\x99`%\x17u\xfb{=\xf6\x94\xcd\x86:D\xee\xcb>\x93\xf3\xb9\x16H\x1b(\xd6\xce>\xeb(\x9b\xe6\xeb\xe3r\xf8\xfc=\xb2\xc1\xae}\xba\xe0\x1a\xde)\xc91\n\x822\xe4\x1c\xb6^\xbe\xecf\xf8p\xc7[\xcf\xe6\xee4t\x06\xa1\xda!F\xee\xd0s%|\xb6\xf0HG\xa8\xbe\x99\x9e,z\x8f\xc0\x83\xd9\xcf\xeb\xf9\xd3\xb1\x9a\xdb>\xd3\x07\x1e\xac\x00q(\x81\xb3\xba\xe2\xb1\x7f\x84\xc5\xc6\xa0\x1f\xf0\xa0\x0f\xb3\xaf\xee\xdetHB\xce\xa8\xa3\xcc\x80\xc8`\xe5d\xe6#\x18\xc8O7\xb18\x92\xd78`\x14\xb47\x97\x91\x8d\xae\xb7WZ\xa4\xa3\xa7t\x89dX\x99\xd8\x01=\x059_eA\x12\xb8\x89\xca\xe2\x18\x87\x85@\xba\xc3\xc9\x0c\xa5D\xab\xcb\xfd|\x13\x83K9W\xa0\xd0\xb6\xf2\x16s\x85\x94\x8a\x91\xde?I@\t\xc0\x15l\xa4\x95\xaf\xb3a\x00ec(c\x91\x16\xf1\x86\x83\x11\xe1\x00\xc1\xacW\xd9J\x07\xb0\xed\xf9\xed\x88ns\x9ezDQ\x87\x91\xf0\xad_Gna7B\xde\xc2j\xbeE\xbcls\x15\\\xbe\x11M\'d\xbc\xc9\x00\xd6~\x12\xe4sswJ\x88HxP\x8a\x0bld%\xaey\n,\xbc\x9c\x16\x12\x92\xd5\\\xa4\x9b,m\xcc(\xa2r!\xf2\x01\x00$\xea\x12.!k\x81\t\xe8eT\x9a\x12\xf9\x16\xf5/Q\xcf\x92,T\xe6D\xad\xc1\xa9\x9f\xafk\x85\x87i\'\x17/\x87E;\xb3\x82\xcc\xb8}\x8f\xba\xa1\xde\xd9\x11\xf8<\xe3\nI\x9f=r\x90\xcf9\x8cP\xadF\x01o\xe9Q\x87\x11X\xa2\x8d:}\x054v\x02\x81\xbd\x0c\xa36!\xb4\x14\xd3\x86@J\t\xc4\xb8~`\x82I\x92\xb4\xd5\x07\xc3\xcc\x04\xde\xd3_t\x90\xadE\xbdu\x8b\xdfE\xf8y\xf2:f\xd1:n*q\'#\x95\xcd\xa1\x86J\x16#\x1e\xca\x04c\t\xe6\x03\tR\x8c5\x9a\xf4\xd4\xa3\x17\xde\xc9\xbd\xc8\x836\xab@\xe3\x99H[\xca\xaan\x11\xe7\x16\xad\x08\xf3\xf4\xc1\x1e\x07\xc9U\x950A\xb8t\x17\x1b\xfc\x8d\xf8=\x08\xcd\xa0N2R\x13{\x0f\xa1\x8c\x82}\x16\xa7\xe7o\xf3@\xd1M\x97H{\x83\x92z\xb6%\\q\xcf4{\x1cS\xc8[\xe5g.\x16\xeawS\xfd\x1c\x8b\xaa\x01\xadeO\x96\xbaR\\)\xf2\xd7\xb3\xb6Y2e\x9a)9\x82F]\x11\xc4f\xaen\xd4\x95\xa9)\x15\\[IP\xb2A\xda\xdf\xe8g\x87D\xc0\xe3\x1cY\xcc\x15H\xf6\x8e\x81A{\\\xeb\xcd!&\xb4\x82\x02\xf4`\xad\xe3:\xb2p\x87\x91\xbef\xb5\xd7\xa8\xb9<\xe2\x93\xb55P\xf3\xd9\xb4\xb1\xa3\n\xe3\xf3T\xb0\xbc\x84\xab7u\xb5\xf6\xd4\xb8\xde\xa7eOBv\x12\x831p\xb2C\x85\xd3j\x15TI+\xa9H\x1b\xba\xb7(U\xb1y\xcd\x91\x9b~\xb8G\xc8F\xd8?p\xf5\x9bh\x1e\x9a\x8ax\xe4\xaeXaa\xb2\xa3\xb7\xba\xd6\x8bv\x82\x00lFS!{\x86\x83\x94\xcdd\xb1j5L`6d\x81S\xaa\n2\x99\x99\x11\xcf/3\x15\xf7?U\xb3\x03\xa8g\x95Cm\x1f!9\x93qZ#}\t\x0c]}>*\xf1\x8f~\xb5]LG\x8d1\xf4\x1a#j\xb0@b\xce\xf2\x95\x11A},||\xc5\x06\xcbs\xbb\x82y`(Y\xf2\xe1\x04\x99n\xb6\xb3\x01\x8b\x11k\nK:\xda\xcb`!\xef\xa7x`\x10\x1c\xd4_\x05uUa\x85C\x1c\xce\x95\xec\xe2\x15\xe9@\x08\x88\x0fN.\xe6\xb8\xf5\x07\xb7R!\xe4C\xe7\xacQ\xb4\x9a\x08\x84\xf5T\x8a\xb9\x10\x91"\xf3\x88\xb9y\xf2\xe5\x90\xe6\x01\xd2\xf1\xa1^pc\x07\xa5\xec9\x16\xec.\xf7\x92\x9e\x06\xcbW\xa2\xb3h\xfa7z\xc0\xdd\xab\x8c&\x9a\x0b\x13\x97\xb9TBdq\x9d2\xf6K\xbbb h\xea^\xed\xf1\x97!=\xed\x8b\xf9\xf2\x0c[t\x16$\x11\xde\x16\xc4\xfb44\x11{\xd0CsJ.7[\xa6\x97\xdd\x04\xd6g\xbe\xd3Kk\x1b\xfc\xca\xfd\x9f\x88\xbd\xe0]\x0b\x1d\xf6\xa3\x04\xda\xb0M<4P>\xdba\n\xfe\xf3\x9b\xf7\xdf\xe4\x1f\xc8:\xc3Ix~\x01\x89[\xdc\xc3XV]\xb8\x82PG0\xcb\xdc\xacww\xfc`\xe28\xdc\xdb\xeeh\x04*\xfdq\xd6\x1da\x8c=\xa0Dy\x08\x0e\xa7\xb0 c\xcb\x91N\x17}\xaa\x8e\xbbp\xf1\xe6\x93\xee\xa8\x90\x13.\xae\xdf\xc8\xbb3\xc6\x08\xfd?\r,1\xbfO8\xaf\xcdIa\xf7\t\x96/\xe2f\x03\x0cR\x18\xd8\xbfq\xb1\xca\xc6\x03T\x98\xc7,@(\xca\xbe`\xdb\x10R\xee\xfa\xc4\xbb\xbf5\xfd\xf0\x97~\x1f\x00a\x91\x84\xe9\xac\xd8y\xfd?u\xe6\xee\x0fy\xb5\xbe3\x0fh\x7fp\xd3\xa4\x0e\x86\x14a\xee\xa9\xaf{A\t\xf7\xb8\xf4\x96\x97@;\t\xf9\xbc\xaeOK\xfe\x7f\xe1\xf6\x19\xf3\x1e\xe7\x99J\x16\xc9\x1d\xee\x9b\xe6\xde\xc9\xa40\xe9\xf5\xf88\xa9\x82\x04\xf0l\x81\x89\xa8\x01\xc9S\x17\x9b1\xae\xfe\xbf\x08\xa3\xccG\xf0\x17\xee\x17\xe0\xa2\xf1\xfa\x9f\xe5\xeb\xed\xbc\xec\x90@\xf9\xc7xl\x0b\xe6\x07^\x142\xe9\xc5\xad\xda\x9c\x1d\xd8@\x86\x1e^\x0f\xd4\xd9\xfd\x9d\x81A\xe5\x06\x08m\x8b\x05\xa5h\xa0^\x19\x01\x07\x07\x86\x86,^\xa2\xa6\xdc\xe7\x1e\xca@D\x18\xf4\xef\xa0~\xaf:\x02 4\xea\xd5\xf8\x9f}\xa6\x80X\xce\xf6o\xd4\x8d\x14[\xf5\xd0\x12\x98\xaa(f\x08\xdd\xb4\x04\x8c\xec\xb8\x7f\xed\xee\xf5\x9e\x04@:\xb2\x0c\xb7p\x06\xb9\xd1qA\xe4\x8f\xd8\xce\xe6\x01vq\x9ch\x9f\x0b\x04\xcf\x01\xb0\x80k\x80\xd0\x8c0"\\\x03(MV\x9a)\x8d\x16[\x0b5?\xe0\x19\xf31Q\xfan\x84\xa8\x89\xb9B(5Rj\xf0k\x01\xc3\x97\xc7\x90\x1e\x0f3\x1d#~\x0f\xf1A\x926t\x16\xd8\x11\xc8\x12\x02#O\xd2\xf8\x87U\xc0!\xb5\xeb\x01\xb2\xc9\xa7\xa7\xd9\xb8\xec\xf2\xfe_\x8fQ)\x06P\xb2\xe6\x80!\x84\xbc\xbd"\x91\xe0C\x81\x19\x0e\x19\xc9\x14L\x92\xec\x1a\x83XsiB\'\xe1\xc2)TA4p\xc5\xc4\x91!\xd3EVJ\x13\xc6\x9b\xd8\n5\x81\x00\xc8\x00,\xd5!G\xc2\x1b\xd1F\x00\xc3\xbc\xaaZ\xcc\x91\xf1\xb3\xdd3\xf4\xc33|\x8f\xa1\xcf\x14\xfe\xf7m\xc2\xdez\xfa\xe1p\x97\x89\xc0\x13\x95\xc5\xb5\x96', 142, 143, 'character maps to <undefined>') command: C:\ProgramData\Anaconda3\Scripts\conda install --file https://repo.continuum.io/pkgs/free/win-32/pyyaml-3.11-py27_3.tar.bz2 user_agent: conda/4.4.7 requests/2.18.4 CPython/3.6.3 Windows/7 Windows/6.1.7601 _messageid: -9223372036837525397 _messagetime: 1515518595057 / 2018-01-09 11:23:15 Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 743, in __call__ return func(*args, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 11, in execute install(args, parser, 'install') File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\install.py", line 182, in install specs.extend(common.specs_from_url(fpath, json=context.json)) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\common.py", line 126, in specs_from_url for line in open(path): File "C:\ProgramData\Anaconda3\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 142: character maps to <undefined> ```
The `--file` parameter on `conda install` isn't meant for something like `conda install --file package.tar.bz2` or for `environment.yml` files. Basically, if we have a problem parsing the contents of the file around https://github.com/conda/conda/blob/4.4.11/conda/cli/install.py#L182, we should raise an appropriate `CondaError` with a helpful message. similar to #6697
2019-02-23T18:28:46Z
[]
[]
Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 743, in __call__ return func(*args, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 11, in execute install(args, parser, 'install') File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\install.py", line 182, in install specs.extend(common.specs_from_url(fpath, json=context.json)) File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\common.py", line 126, in specs_from_url for line in open(path): File "C:\ProgramData\Anaconda3\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 142: character maps to <undefined>
4,421
conda/conda
conda__conda-8917
296a67dd74c1c6c78058c1b94d6aeec33691fe3b
diff --git a/conda/resolve.py b/conda/resolve.py --- a/conda/resolve.py +++ b/conda/resolve.py @@ -113,7 +113,8 @@ def __init__(self, index, processed=False, channels=()): self._pool_cache = {} self._strict_channel_cache = {} - self._system_precs = {_ for _ in index if _.package_type == PackageType.VIRTUAL_SYSTEM} + self._system_precs = {_ for _ in index if ( + hasattr(_, 'package_type') and _.package_type == PackageType.VIRTUAL_SYSTEM)} # sorting these in reverse order is effectively prioritizing # contstraint behavior from newer packages. It is applying broadening
Errors with conda 4.7.6 on conda-forge builds: AttributeError: 'Dist' object has no attribute 'package_type' It seems that the conda 4.7.6 or conda-build 3.17.8 upgrade is causing errors on all recent conda-forge builds: https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49363&view=logs&jobId=10bda42a-d420-5c28-a43f-bc4e66405e5c&taskId=bef775d0-a1a2-55a3-9721-17147029baf0&lineStart=256&lineEnd=274&colStart=1&colEnd=62 ``` + xargs -n1 cat + xargs -r /usr/bin/sudo -n yum install -y + find /home/conda/conda-recipes -mindepth 2 -maxdepth 2 -type f -name yum_requirements.txt + grep -v -e '^#' -e '^$' + test 1 == 1 + python /home/conda/.ci_support/build_all.py /home/conda/conda-recipes Building ipymidicontrols with conda-forge/label/main Traceback (most recent call last): File "/home/conda/.ci_support/build_all.py", line 131, in <module> build_all(args.recipes_dir, args.arch) File "/home/conda/.ci_support/build_all.py", line 68, in build_all build_folders(recipes_dir, new_comp_folders, arch, channel_urls) File "/home/conda/.ci_support/build_all.py", line 94, in build_folders conda_resolve = conda_build.conda_interface.Resolve(index) File "/opt/conda/lib/python3.7/site-packages/conda/resolve.py", line 116, in __init__ self._system_precs = {_ for _ in index if _.package_type == PackageType.VIRTUAL_SYSTEM} File "/opt/conda/lib/python3.7/site-packages/conda/resolve.py", line 116, in <setcomp> self._system_precs = {_ for _ in index if _.package_type == PackageType.VIRTUAL_SYSTEM} AttributeError: 'Dist' object has no attribute 'package_type' ``` Some examples of builds having this error, all having conda 4.7.6, conda-build 3.18.7: * https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49404&view=logs&jobId=10bda42a-d420-5c28-a43f-bc4e66405e5c&taskId=bef775d0-a1a2-55a3-9721-17147029baf0&lineStart=183&lineEnd=185&colStart=1&colEnd=1 * https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49419&view=logs&jobId=10bda42a-d420-5c28-a43f-bc4e66405e5c&taskId=bef775d0-a1a2-55a3-9721-17147029baf0&lineStart=183&lineEnd=185&colStart=1&colEnd=1 * https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49420&view=logs&jobId=10bda42a-d420-5c28-a43f-bc4e66405e5c&taskId=bef775d0-a1a2-55a3-9721-17147029baf0&lineStart=183&lineEnd=185&colStart=1&colEnd=1 Examples of successful builds just before these, all having conda 4.7.5, conda-build 3.17.8: * https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49197&view=logs&jobId=240f1fee-52bc-5498-a14a-8361bde76ba0&taskId=2fb5b0a7-737c-5f5c-8f3f-f6db6174bacf&lineStart=99&lineEnd=101&colStart=1&colEnd=1 * https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49327&view=logs&jobId=10bda42a-d420-5c28-a43f-bc4e66405e5c&taskId=bef775d0-a1a2-55a3-9721-17147029baf0&lineStart=183&lineEnd=185&colStart=1&colEnd=1 * https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49127&view=logs&jobId=10bda42a-d420-5c28-a43f-bc4e66405e5c&taskId=bef775d0-a1a2-55a3-9721-17147029baf0&lineStart=183&lineEnd=185&colStart=1&colEnd=1
2019-07-12T14:20:14Z
[]
[]
Traceback (most recent call last): File "/home/conda/.ci_support/build_all.py", line 131, in <module> build_all(args.recipes_dir, args.arch) File "/home/conda/.ci_support/build_all.py", line 68, in build_all build_folders(recipes_dir, new_comp_folders, arch, channel_urls) File "/home/conda/.ci_support/build_all.py", line 94, in build_folders conda_resolve = conda_build.conda_interface.Resolve(index) File "/opt/conda/lib/python3.7/site-packages/conda/resolve.py", line 116, in __init__ self._system_precs = {_ for _ in index if _.package_type == PackageType.VIRTUAL_SYSTEM} File "/opt/conda/lib/python3.7/site-packages/conda/resolve.py", line 116, in <setcomp> self._system_precs = {_ for _ in index if _.package_type == PackageType.VIRTUAL_SYSTEM} AttributeError: 'Dist' object has no attribute 'package_type'
4,443
conda/conda
conda__conda-8999
a4f8a776d78e47d3665e0adcf175139d718d1a5a
diff --git a/conda/cli/install.py b/conda/cli/install.py --- a/conda/cli/install.py +++ b/conda/cli/install.py @@ -229,6 +229,8 @@ def install(args, parser, command='install'): elif REPODATA_FN not in repodata_fns: repodata_fns.append(REPODATA_FN) + args_set_update_modifier = hasattr(args, "update_modifier") and args.update_modifier != NULL + for repodata_fn in repodata_fns: try: update_modifier = context.update_modifier @@ -281,9 +283,12 @@ def install(args, parser, command='install'): if not hasattr(args, 'update_modifier'): if repodata_fn == repodata_fns[-1]: raise e - elif args.update_modifier == NULL: + elif not args_set_update_modifier or args.update_modifier not in ( + UpdateModifier.FREEZE_INSTALLED, + UpdateModifier.UPDATE_SPECS): try: - if not args.json: + if not args.json and (not args_set_update_modifier or + args.update_modifier == UpdateModifier.FREEZE_INSTALLED): print("Initial quick solve with frozen env failed. " "Unfreezing env and trying again.") unlink_link_transaction = solver.solve_for_transaction( diff --git a/conda/core/solve.py b/conda/core/solve.py --- a/conda/core/solve.py +++ b/conda/core/solve.py @@ -195,8 +195,10 @@ def solve_final_state(self, update_modifier=NULL, deps_modifier=NULL, prune=NULL the solved state of the environment. """ + update_modifier_set = True if update_modifier is NULL: update_modifier = context.update_modifier + update_modifier_set = False else: update_modifier = UpdateModifier(text_type(update_modifier).lower()) if deps_modifier is NULL: @@ -248,8 +250,14 @@ def solve_final_state(self, update_modifier=NULL, deps_modifier=NULL, prune=NULL context.json): ssc = self._collect_all_metadata(ssc) - fail_message = ("failed\n" if self._repodata_fn == REPODATA_FN else "failed with %s, " - "will retry with next repodata source.\n" % self._repodata_fn) + if not update_modifier_set or update_modifier != UpdateModifier.UPDATE_SPECS: + fail_message = "failed with initial frozen solve. Retrying with flexible solve.\n" + elif self._repodata_fn != REPODATA_FN: + fail_message = ("failed with repodata from %s, will retry with next repodata" + " source.\n" % self._repodata_fn) + else: + fail_message = "failed\n" + with Spinner("Solving environment", not context.verbosity and not context.quiet, context.json, fail_message=fail_message): ssc = self._remove_specs(ssc)
Solving environment: failed with current_repodata.json, will retry with next repodata source. UnsatisfiableError: <!-- Hi! Read this; it's important. This is an issue tracker for conda -- the package manager. File feature requests for conda here, as well as bug reports about something conda has messed up. If your issue is a bug report for: * a specific conda package from Anaconda ('defaults' channel): ==> file at https://github.com/ContinuumIO/anaconda-issues * a specific conda package from conda-forge: ==> file at the corresponding feedstock under https://github.com/conda-forge * repo.anaconda.com access and service: ==> file at https://github.com/ContinuumIO/anaconda-issues * anaconda.org access and service: ==> file at https://anaconda.org/contact/report * commands under 'conda build': ==> file at https://github.com/conda/conda-build * commands under 'conda env': ==> please file it here! * all other conda commands that start with 'conda': ==> please file it here! If you continue on, **please include all requested information below.** If a maintainer determines the information is required to understand your issue, and if it is not provided, your issue may be closed automatically. --> ## Current Behavior <!-- What actually happens? If you want to include console output, please use "Steps to Reproduce" below. --> Cannot install or update packages when conda-forge is added ### Steps to Reproduce <!-- If the current behaviour is a bug, please provide specific, minimal steps to independently reproduce. Include the exact conda commands that reproduce the issue and their output between the ticks below. --> 1. Install Anaconda3-2019.07-Windows-x86_64.exe (https://repo.continuum.io/archive/Anaconda3-2019.07-Windows-x86_64.exe) 2. Enable conda-forge ``` conda config --add channels conda-forge conda config --set channel_priority strict ``` Here's what happens: ``` blim09@DESKTOP-J3L8E29:C:\Windows\system32 $ conda update --all Collecting package metadata (current_repodata.json): done Solving environment: failed with current_repodata.json, will retry with next repodata source. UnsatisfiableError: blim09@DESKTOP-J3L8E29:C:\Windows\system32 $ ``` ``` blim09@DESKTOP-J3L8E29:C:\Windows\system32 $ conda update --all --verbose Collecting package metadata (current_repodata.json): ...working... done Solving environment: ...working... failed with current_repodata.json, will retry with next repodata source. Traceback (most recent call last): File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\exceptions.py", line 1062, in __call__ return func(*args, **kwargs) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main exit_code = do_call(args, p) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 82, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\cli\main_update.py", line 20, in execute install(args, parser, 'update') File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\cli\install.py", line 307, in install raise e File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\cli\install.py", line 256, in install force_reinstall=context.force_reinstall or context.force, File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\core\solve.py", line 112, in solve_for_transaction force_remove, force_reinstall) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\core\solve.py", line 150, in solve_for_diff force_remove) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\core\solve.py", line 262, in solve_final_state ssc = self._run_sat(ssc) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\common\io.py", line 88, in decorated return f(*args, **kwds) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\core\solve.py", line 780, in _run_sat repodata_fn=self._repodata_fn) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\common\io.py", line 88, in decorated return f(*args, **kwds) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\resolve.py", line 1219, in solve raise UnsatisfiableError({}) conda.exceptions.UnsatisfiableError blim09@DESKTOP-J3L8E29:C:\Windows\system32 $ ``` Everything works correctly when conda-forge is removed ## Expected Behavior <!-- What do you think should happen? --> Packages should install or update normally ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` active environment: None user config file : C:\Users\blim09\.condarc populated config files : C:\Users\blim09\.condarc conda version : 4.7.10 conda-build version : 3.18.9 python version : 3.7.3.final.0 virtual packages : base environment : C:\Users\blim09\Anaconda3 (writable) channel URLs : https://conda.anaconda.org/conda-forge/win-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Users\blim09\Anaconda3\pkgs C:\Users\blim09\.conda\pkgs C:\Users\blim09\AppData\Local\conda\conda\pkgs envs directories : C:\Users\blim09\Anaconda3\envs C:\Users\blim09\.conda\envs C:\Users\blim09\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/4.7.10 requests/2.22.0 CPython/3.7.3 Windows/10 Windows/10.0.18362 administrator : True netrc file : None offline mode : False ``` </p></details> <details open><summary><code>`conda config --show-sources`</code></summary><p> <!-- between the ticks below, paste the output of 'conda config --show-sources' --> ``` ==> C:\Users\blim09\.condarc <== channel_priority: strict channels: - conda-forge - defaults ``` </p></details> <details><summary><code>`conda list --show-channel-urls`</code></summary><p> <!-- between the ticks below, paste the output of 'conda list --show-channel-urls' --> ``` # packages in environment at C:\Users\blim09\Anaconda3: # # Name Version Build Channel _ipyw_jlab_nb_ext_conf 0.1.0 py37_0 defaults alabaster 0.7.12 py37_0 defaults anaconda 2019.07 py37_0 defaults anaconda-client 1.7.2 py37_0 defaults anaconda-navigator 1.9.7 py37_0 defaults anaconda-project 0.8.3 py_0 defaults asn1crypto 0.24.0 py37_0 defaults astroid 2.2.5 py37_0 defaults astropy 3.2.1 py37he774522_0 defaults atomicwrites 1.3.0 py37_1 defaults attrs 19.1.0 py37_1 defaults babel 2.7.0 py_0 defaults backcall 0.1.0 py37_0 defaults backports 1.0 py_2 defaults backports.functools_lru_cache 1.5 py_2 defaults backports.os 0.1.1 py37_0 defaults backports.shutil_get_terminal_size 1.0.0 py37_2 defaults backports.tempfile 1.0 py_1 defaults backports.weakref 1.0.post1 py_1 defaults beautifulsoup4 4.7.1 py37_1 defaults bitarray 0.9.3 py37he774522_0 defaults bkcharts 0.2 py37_0 defaults blas 1.0 mkl defaults bleach 3.1.0 py37_0 defaults blosc 1.16.3 h7bd577a_0 defaults bokeh 1.2.0 py37_0 defaults boto 2.49.0 py37_0 defaults bottleneck 1.2.1 py37h452e1ab_1 defaults bzip2 1.0.8 he774522_0 defaults ca-certificates 2019.5.15 0 defaults certifi 2019.6.16 py37_0 defaults cffi 1.12.3 py37h7a1dbc1_0 defaults chardet 3.0.4 py37_1 defaults click 7.0 py37_0 defaults cloudpickle 1.2.1 py_0 defaults clyent 1.2.2 py37_1 defaults colorama 0.4.1 py37_0 defaults comtypes 1.1.7 py37_0 defaults conda 4.7.10 py37_0 defaults conda-build 3.18.9 py37_0 defaults conda-env 2.6.0 1 defaults conda-package-handling 1.3.11 py37_0 defaults conda-verify 3.4.2 py_1 defaults console_shortcut 0.1.1 3 defaults contextlib2 0.5.5 py37_0 defaults cryptography 2.7 py37h7a1dbc1_0 defaults curl 7.65.2 h2a8f88b_0 defaults cycler 0.10.0 py37_0 defaults cython 0.29.12 py37ha925a31_0 defaults cytoolz 0.10.0 py37he774522_0 defaults dask 2.1.0 py_0 defaults dask-core 2.1.0 py_0 defaults decorator 4.4.0 py37_1 defaults defusedxml 0.6.0 py_0 defaults distributed 2.1.0 py_0 defaults docutils 0.14 py37_0 defaults entrypoints 0.3 py37_0 defaults et_xmlfile 1.0.1 py37_0 defaults fastcache 1.1.0 py37he774522_0 defaults filelock 3.0.12 py_0 defaults flask 1.1.1 py_0 defaults freetype 2.9.1 ha9979f8_1 defaults future 0.17.1 py37_0 defaults get_terminal_size 1.0.0 h38e98db_0 defaults gevent 1.4.0 py37he774522_0 defaults glob2 0.7 py_0 defaults greenlet 0.4.15 py37hfa6e2cd_0 defaults h5py 2.9.0 py37h5e291fa_0 defaults hdf5 1.10.4 h7ebc959_0 defaults heapdict 1.0.0 py37_2 defaults html5lib 1.0.1 py37_0 defaults icc_rt 2019.0.0 h0cc432a_1 defaults icu 58.2 ha66f8fd_1 defaults idna 2.8 py37_0 defaults imageio 2.5.0 py37_0 defaults imagesize 1.1.0 py37_0 defaults importlib_metadata 0.17 py37_1 defaults intel-openmp 2019.4 245 defaults ipykernel 5.1.1 py37h39e3cac_0 defaults ipython 7.6.1 py37h39e3cac_0 defaults ipython_genutils 0.2.0 py37_0 defaults ipywidgets 7.5.0 py_0 defaults isort 4.3.21 py37_0 defaults itsdangerous 1.1.0 py37_0 defaults jdcal 1.4.1 py_0 defaults jedi 0.13.3 py37_0 defaults jinja2 2.10.1 py37_0 defaults joblib 0.13.2 py37_0 defaults jpeg 9b hb83a4c4_2 defaults json5 0.8.4 py_0 defaults jsonschema 3.0.1 py37_0 defaults jupyter 1.0.0 py37_7 defaults jupyter_client 5.3.1 py_0 defaults jupyter_console 6.0.0 py37_0 defaults jupyter_core 4.5.0 py_0 defaults jupyterlab 1.0.2 py37hf63ae98_0 defaults jupyterlab_server 1.0.0 py_0 defaults keyring 18.0.0 py37_0 defaults kiwisolver 1.1.0 py37ha925a31_0 defaults krb5 1.16.1 hc04afaa_7 defaults lazy-object-proxy 1.4.1 py37he774522_0 defaults libarchive 3.3.3 h0643e63_5 defaults libcurl 7.65.2 h2a8f88b_0 defaults libiconv 1.15 h1df5818_7 defaults liblief 0.9.0 ha925a31_2 defaults libpng 1.6.37 h2a8f88b_0 defaults libsodium 1.0.16 h9d3ae62_0 defaults libssh2 1.8.2 h7a1dbc1_0 defaults libtiff 4.0.10 hb898794_2 defaults libxml2 2.9.9 h464c3ec_0 defaults libxslt 1.1.33 h579f668_0 defaults llvmlite 0.29.0 py37ha925a31_0 defaults locket 0.2.0 py37_1 defaults lxml 4.3.4 py37h1350720_0 defaults lz4-c 1.8.1.2 h2fa13f4_0 defaults lzo 2.10 h6df0209_2 defaults m2w64-gcc-libgfortran 5.3.0 6 defaults m2w64-gcc-libs 5.3.0 7 defaults m2w64-gcc-libs-core 5.3.0 7 defaults m2w64-gmp 6.1.0 2 defaults m2w64-libwinpthread-git 5.0.0.4634.697f757 2 defaults markupsafe 1.1.1 py37he774522_0 defaults matplotlib 3.1.0 py37hc8f65d3_0 defaults mccabe 0.6.1 py37_1 defaults menuinst 1.4.16 py37he774522_0 defaults mistune 0.8.4 py37he774522_0 defaults mkl 2019.4 245 defaults mkl-service 2.0.2 py37he774522_0 defaults mkl_fft 1.0.12 py37h14836fe_0 defaults mkl_random 1.0.2 py37h343c172_0 defaults mock 3.0.5 py37_0 defaults more-itertools 7.0.0 py37_0 defaults mpmath 1.1.0 py37_0 defaults msgpack-python 0.6.1 py37h74a9793_1 defaults msys2-conda-epoch 20160418 1 defaults multipledispatch 0.6.0 py37_0 defaults navigator-updater 0.2.1 py37_0 defaults nbconvert 5.5.0 py_0 defaults nbformat 4.4.0 py37_0 defaults networkx 2.3 py_0 defaults nltk 3.4.4 py37_0 defaults nose 1.3.7 py37_2 defaults notebook 6.0.0 py37_0 defaults numba 0.44.1 py37hf9181ef_0 defaults numexpr 2.6.9 py37hdce8814_0 defaults numpy 1.16.4 py37h19fb1c0_0 defaults numpy-base 1.16.4 py37hc3f5095_0 defaults numpydoc 0.9.1 py_0 defaults olefile 0.46 py37_0 defaults openpyxl 2.6.2 py_0 defaults openssl 1.1.1c he774522_1 defaults packaging 19.0 py37_0 defaults pandas 0.24.2 py37ha925a31_0 defaults pandoc 2.2.3.2 0 defaults pandocfilters 1.4.2 py37_1 defaults parso 0.5.0 py_0 defaults partd 1.0.0 py_0 defaults path.py 12.0.1 py_0 defaults pathlib2 2.3.4 py37_0 defaults patsy 0.5.1 py37_0 defaults pep8 1.7.1 py37_0 defaults pickleshare 0.7.5 py37_0 defaults pillow 6.1.0 py37hdc69c19_0 defaults pip 19.1.1 py37_0 defaults pkginfo 1.5.0.1 py37_0 defaults pluggy 0.12.0 py_0 defaults ply 3.11 py37_0 defaults powershell_shortcut 0.0.1 2 defaults prometheus_client 0.7.1 py_0 defaults prompt_toolkit 2.0.9 py37_0 defaults psutil 5.6.3 py37he774522_0 defaults py 1.8.0 py37_0 defaults py-lief 0.9.0 py37ha925a31_2 defaults pycodestyle 2.5.0 py37_0 defaults pycosat 0.6.3 py37hfa6e2cd_0 defaults pycparser 2.19 py37_0 defaults pycrypto 2.6.1 py37hfa6e2cd_9 defaults pycurl 7.43.0.3 py37h7a1dbc1_0 defaults pyflakes 2.1.1 py37_0 defaults pygments 2.4.2 py_0 defaults pylint 2.3.1 py37_0 defaults pyodbc 4.0.26 py37ha925a31_0 defaults pyopenssl 19.0.0 py37_0 defaults pyparsing 2.4.0 py_0 defaults pyqt 5.9.2 py37h6538335_2 defaults pyreadline 2.1 py37_1 defaults pyrsistent 0.14.11 py37he774522_0 defaults pysocks 1.7.0 py37_0 defaults pytables 3.5.2 py37h1da0976_1 defaults pytest 5.0.1 py37_0 defaults pytest-arraydiff 0.3 py37h39e3cac_0 defaults pytest-astropy 0.5.0 py37_0 defaults pytest-doctestplus 0.3.0 py37_0 defaults pytest-openfiles 0.3.2 py37_0 defaults pytest-remotedata 0.3.1 py37_0 defaults python 3.7.3 h8c8aaf0_1 defaults python-dateutil 2.8.0 py37_0 defaults python-libarchive-c 2.8 py37_11 defaults pytz 2019.1 py_0 defaults pywavelets 1.0.3 py37h8c2d366_1 defaults pywin32 223 py37hfa6e2cd_1 defaults pywinpty 0.5.5 py37_1000 defaults pyyaml 5.1.1 py37he774522_0 defaults pyzmq 18.0.0 py37ha925a31_0 defaults qt 5.9.7 vc14h73c81de_0 defaults qtawesome 0.5.7 py37_1 defaults qtconsole 4.5.1 py_0 defaults qtpy 1.8.0 py_0 defaults requests 2.22.0 py37_0 defaults rope 0.14.0 py_0 defaults ruamel_yaml 0.15.46 py37hfa6e2cd_0 defaults scikit-image 0.15.0 py37ha925a31_0 defaults scikit-learn 0.21.2 py37h6288b17_0 defaults scipy 1.2.1 py37h29ff71c_0 defaults seaborn 0.9.0 py37_0 defaults send2trash 1.5.0 py37_0 defaults setuptools 41.0.1 py37_0 defaults simplegeneric 0.8.1 py37_2 defaults singledispatch 3.4.0.3 py37_0 defaults sip 4.19.8 py37h6538335_0 defaults six 1.12.0 py37_0 defaults snappy 1.1.7 h777316e_3 defaults snowballstemmer 1.9.0 py_0 defaults sortedcollections 1.1.2 py37_0 defaults sortedcontainers 2.1.0 py37_0 defaults soupsieve 1.8 py37_0 defaults sphinx 2.1.2 py_0 defaults sphinxcontrib 1.0 py37_1 defaults sphinxcontrib-applehelp 1.0.1 py_0 defaults sphinxcontrib-devhelp 1.0.1 py_0 defaults sphinxcontrib-htmlhelp 1.0.2 py_0 defaults sphinxcontrib-jsmath 1.0.1 py_0 defaults sphinxcontrib-qthelp 1.0.2 py_0 defaults sphinxcontrib-serializinghtml 1.1.3 py_0 defaults sphinxcontrib-websupport 1.1.2 py_0 defaults spyder 3.3.6 py37_0 defaults spyder-kernels 0.5.1 py37_0 defaults sqlalchemy 1.3.5 py37he774522_0 defaults sqlite 3.29.0 he774522_0 defaults statsmodels 0.10.0 py37h8c2d366_0 defaults sympy 1.4 py37_0 defaults tblib 1.4.0 py_0 defaults terminado 0.8.2 py37_0 defaults testpath 0.4.2 py37_0 defaults tk 8.6.8 hfa6e2cd_0 defaults toolz 0.10.0 py_0 defaults tornado 6.0.3 py37he774522_0 defaults tqdm 4.32.1 py_0 defaults traitlets 4.3.2 py37_0 defaults unicodecsv 0.14.1 py37_0 defaults urllib3 1.24.2 py37_0 defaults vc 14.1 h0510ff6_4 defaults vs2015_runtime 14.15.26706 h3a45250_4 defaults wcwidth 0.1.7 py37_0 defaults webencodings 0.5.1 py37_1 defaults werkzeug 0.15.4 py_0 defaults wheel 0.33.4 py37_0 defaults widgetsnbextension 3.5.0 py37_0 defaults win_inet_pton 1.1.0 py37_0 defaults win_unicode_console 0.5 py37_0 defaults wincertstore 0.2 py37_0 defaults winpty 0.4.3 4 defaults wrapt 1.11.2 py37he774522_0 defaults xlrd 1.2.0 py37_0 defaults xlsxwriter 1.1.8 py_0 defaults xlwings 0.15.8 py37_0 defaults xlwt 1.3.0 py37_0 defaults xz 5.2.4 h2fa13f4_4 defaults yaml 0.1.7 hc54c509_2 defaults zeromq 4.3.1 h33f27b4_3 defaults zict 1.0.0 py_0 defaults zipp 0.5.1 py_0 defaults zlib 1.2.11 h62dcd97_3 defaults zstd 1.3.7 h508b16e_0 defaults ``` </p></details>
2019-07-25T19:47:35Z
[]
[]
Traceback (most recent call last): File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\exceptions.py", line 1062, in __call__ return func(*args, **kwargs) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main exit_code = do_call(args, p) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 82, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\cli\main_update.py", line 20, in execute install(args, parser, 'update') File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\cli\install.py", line 307, in install raise e File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\cli\install.py", line 256, in install force_reinstall=context.force_reinstall or context.force, File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\core\solve.py", line 112, in solve_for_transaction force_remove, force_reinstall) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\core\solve.py", line 150, in solve_for_diff force_remove) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\core\solve.py", line 262, in solve_final_state ssc = self._run_sat(ssc) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\common\io.py", line 88, in decorated return f(*args, **kwds) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\core\solve.py", line 780, in _run_sat repodata_fn=self._repodata_fn) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\common\io.py", line 88, in decorated return f(*args, **kwds) File "C:\Users\blim09\Anaconda3\lib\site-packages\conda\resolve.py", line 1219, in solve raise UnsatisfiableError({}) conda.exceptions.UnsatisfiableError
4,448
dagster-io/dagster
dagster-io__dagster-14785
96058ec8434f97130ddac1fcab36102e6e33627f
diff --git a/python_modules/dagster/setup.py b/python_modules/dagster/setup.py --- a/python_modules/dagster/setup.py +++ b/python_modules/dagster/setup.py @@ -106,7 +106,7 @@ def get_version() -> str: "docstring-parser", "universal_pathlib", # https://github.com/pydantic/pydantic/issues/5821 - "pydantic != 1.10.7", + "pydantic != 1.10.7,<2.0.0", ], extras_require={ "docker": ["docker"],
Support Pydantic V2 and/or peg it to V1 for now ### What's the use case? Pydantic is beta testing a V2 version, which replaces the core of the library with Rust and overhauls the API. I'd like to use it as a dependency in a pre-release project to validate my own data, however, Dagster now bundles Pydantic V1 and hasn't yet capped the version. This is what I get when I try to upgrade: ``` Traceback (most recent call last): File "/Users/admin/Desktop/hello-dagster/venv/bin/dagster", line 5, in <module> from dagster.cli import main File "/Users/admin/Desktop/hello-dagster/venv/lib/python3.10/site-packages/dagster/__init__.py", line 100, in <module> from dagster._config.pythonic_config import ( File "/Users/admin/Desktop/hello-dagster/venv/lib/python3.10/site-packages/dagster/_config/pythonic_config/__init__.py", line 22, in <module> from pydantic import ConstrainedFloat, ConstrainedInt, ConstrainedStr File "/Users/admin/Desktop/hello-dagster/venv/lib/python3.10/site-packages/pydantic/_migration.py", line 279, in wrapper raise PydanticImportError(f'`{import_path}` has been removed in V2.') pydantic.errors.PydanticImportError: `pydantic:ConstrainedFloat` has been removed in V2. For further information visit https://errors.pydantic.dev/2.0b2/u/import-error ``` ### Ideas of implementation I think as a pre-release this won't cause problems for anyone except people like me who want to use the new version, but a) Dagster should probably change requirements.text to reflect `pydantic<2` and b) maybe support it when it's no longer a pre-release. The V2 does include some V1 shims, so it shouldn't be too bad, but some parts of the API did change in breaking ways. ### Additional information _No response_ ### Message from the maintainers Impacted by this issue? Give it a 👍! We factor engagement into prioritization.
@benpankow - thoughts on this one?
2023-06-13T23:29:25Z
[]
[]
Traceback (most recent call last): File "/Users/admin/Desktop/hello-dagster/venv/bin/dagster", line 5, in <module> from dagster.cli import main File "/Users/admin/Desktop/hello-dagster/venv/lib/python3.10/site-packages/dagster/__init__.py", line 100, in <module> from dagster._config.pythonic_config import ( File "/Users/admin/Desktop/hello-dagster/venv/lib/python3.10/site-packages/dagster/_config/pythonic_config/__init__.py", line 22, in <module> from pydantic import ConstrainedFloat, ConstrainedInt, ConstrainedStr File "/Users/admin/Desktop/hello-dagster/venv/lib/python3.10/site-packages/pydantic/_migration.py", line 279, in wrapper raise PydanticImportError(f'`{import_path}` has been removed in V2.') pydantic.errors.PydanticImportError: `pydantic:ConstrainedFloat` has been removed in V2.
4,518
dagster-io/dagster
dagster-io__dagster-2852
9719aa0b6fef7abf29aefd78e1d738596031f181
diff --git a/python_modules/libraries/dagster-ge/setup.py b/python_modules/libraries/dagster-ge/setup.py --- a/python_modules/libraries/dagster-ge/setup.py +++ b/python_modules/libraries/dagster-ge/setup.py @@ -25,6 +25,6 @@ def get_version(): "Operating System :: OS Independent", ], packages=find_packages(exclude=["test"]), - install_requires=["dagster", "dagster-pandas", "pandas", "great_expectations"], + install_requires=["dagster", "dagster-pandas", "pandas", "great_expectations >=0.11.9"], zip_safe=False, )
dagster-ge great_expectations pin It looks like dagster-ge should have a bottom pin of `0.11.9`: ``` import: 'dagster_ge' Traceback (most recent call last): File "/home/conda/feedstock_root/build_artifacts/dagster_1598270757893/test_tmp/run_test.py", line 2, in <module> import dagster_ge File "/home/conda/feedstock_root/build_artifacts/dagster_1598270757893/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/python3.7/site-packages/dagster_ge/__init__.py", line 1, in <module> from .factory import ge_validation_solid_factory File "/home/conda/feedstock_root/build_artifacts/dagster_1598270757893/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/python3.7/site-packages/dagster_ge/factory.py", line 6, in <module> from great_expectations.render.page_renderer_util import ( ModuleNotFoundError: No module named 'great_expectations.render.page_renderer_util' ``` This file is present in 0.11.9, but not in 0.11.8: - https://github.com/great-expectations/great_expectations/tree/0.11.8/great_expectations/render - https://github.com/great-expectations/great_expectations/tree/0.11.9/great_expectations/render
2020-08-24T12:43:34Z
[]
[]
Traceback (most recent call last): File "/home/conda/feedstock_root/build_artifacts/dagster_1598270757893/test_tmp/run_test.py", line 2, in <module> import dagster_ge File "/home/conda/feedstock_root/build_artifacts/dagster_1598270757893/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/python3.7/site-packages/dagster_ge/__init__.py", line 1, in <module> from .factory import ge_validation_solid_factory File "/home/conda/feedstock_root/build_artifacts/dagster_1598270757893/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/python3.7/site-packages/dagster_ge/factory.py", line 6, in <module> from great_expectations.render.page_renderer_util import ( ModuleNotFoundError: No module named 'great_expectations.render.page_renderer_util'
4,539
dagster-io/dagster
dagster-io__dagster-7788
cba914464ee73a9e9161e87cbf4762ee9a029315
diff --git a/python_modules/dagster/dagster/core/decorator_utils.py b/python_modules/dagster/dagster/core/decorator_utils.py --- a/python_modules/dagster/dagster/core/decorator_utils.py +++ b/python_modules/dagster/dagster/core/decorator_utils.py @@ -62,7 +62,7 @@ def param_is_var_keyword(param: funcsigs.Parameter) -> bool: def format_docstring_for_description(fn: Callable) -> Optional[str]: if fn.__doc__ is not None: docstring = fn.__doc__ - if docstring[0].isspace(): + if len(docstring) > 0 and docstring[0].isspace(): return textwrap.dedent(docstring).strip() else: first_newline_pos = docstring.find("\n")
Empty docstring causes crash ## Summary <!-- A brief description of the issue and what you expect to happen instead --> Empty docstring causes a crash. I was doing the cereal tutorial and was typing the code (vs cut/paste). Out of habit I added an empty doc string. Running the job `dagster job execute -f cereal.py` throws an error. ## Reproduction <!-- A minimal example that exhibits the behavior --> Add an empty docstring. E.g. ```python @op def download_cereals(): '''''' response = requests.get("https://docs.dagster.io/assets/cereal.csv") lines = response.text.split("\n") return [row for row in csv.DictReader(lines)] ``` ```bash ❯ dagster job execute -f cereal.py Using temporary directory /Users/jasonwirth/code/dagster_examples/tmpyz8xbih8 for storage. This will be removed when ``dagster job execute`` exits. To persist information across sessions, set the environment variable DAGSTER_HOME to a directory to use. 0it [00:00, ?it/s] 0it [00:00, ?it/s] Traceback (most recent call last): File "/Users/jasonwirth/miniconda3/envs/dagster/bin/dagster", line 8, in <module> sys.exit(main()) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/cli/__init__.py", line 50, in main cli(auto_envvar_prefix=ENV_PREFIX) # pylint:disable=E1123 File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/cli/job.py", line 131, in job_execute_command execute_execute_command(instance, kwargs, True) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/core/telemetry.py", line 110, in wrap result = f(*args, **kwargs) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/cli/pipeline.py", line 390, in execute_execute_command pipeline_origin = get_pipeline_or_job_python_origin_from_kwargs(kwargs, using_job_op_graph_apis) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/cli/workspace/cli_target.py", line 445, in get_pipeline_or_job_python_origin_from_kwargs repository_origin = get_repository_python_origin_from_kwargs(kwargs) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/cli/workspace/cli_target.py", line 578, in get_repository_python_origin_from_kwargs code_pointer_dict = _get_code_pointer_dict_from_kwargs(kwargs) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/cli/workspace/cli_target.py", line 500, in _get_code_pointer_dict_from_kwargs for loadable_target in get_loadable_targets( File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/grpc/utils.py", line 33, in get_loadable_targets else loadable_targets_from_python_file(python_file, working_directory) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/core/workspace/autodiscovery.py", line 26, in loadable_targets_from_python_file loaded_module = load_python_file(python_file, working_directory) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/core/code_pointer.py", line 86, in load_python_file return import_module_from_path(module_name, python_file) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/seven/__init__.py", line 50, in import_module_from_path spec.loader.exec_module(module) File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/Users/jasonwirth/code/dagster_examples/cereal.py", line 9, in <module> def download_cereals(): File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/core/definitions/decorators/op_decorator.py", line 299, in op return _Op()(name) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/core/definitions/decorators/op_decorator.py", line 130, in __call__ description=self.description or format_docstring_for_description(fn), File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/core/decorator_utils.py", line 65, in format_docstring_for_description if docstring[0].isspace(): IndexError: string index out of range ``` ## Dagit UI/UX Issue Screenshots <!-- (Optional) --> ## Additional Info about Your Environment <!-- (Optional) --> ❯ dagster --version dagster, version 0.14.14 --- #### Message from the maintainers: Impacted by this bug? Give it a 👍. We factor engagement into prioritization.
2022-05-08T15:31:14Z
[]
[]
Traceback (most recent call last): File "/Users/jasonwirth/miniconda3/envs/dagster/bin/dagster", line 8, in <module> sys.exit(main()) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/cli/__init__.py", line 50, in main cli(auto_envvar_prefix=ENV_PREFIX) # pylint:disable=E1123 File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/cli/job.py", line 131, in job_execute_command execute_execute_command(instance, kwargs, True) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/core/telemetry.py", line 110, in wrap result = f(*args, **kwargs) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/cli/pipeline.py", line 390, in execute_execute_command pipeline_origin = get_pipeline_or_job_python_origin_from_kwargs(kwargs, using_job_op_graph_apis) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/cli/workspace/cli_target.py", line 445, in get_pipeline_or_job_python_origin_from_kwargs repository_origin = get_repository_python_origin_from_kwargs(kwargs) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/cli/workspace/cli_target.py", line 578, in get_repository_python_origin_from_kwargs code_pointer_dict = _get_code_pointer_dict_from_kwargs(kwargs) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/cli/workspace/cli_target.py", line 500, in _get_code_pointer_dict_from_kwargs for loadable_target in get_loadable_targets( File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/grpc/utils.py", line 33, in get_loadable_targets else loadable_targets_from_python_file(python_file, working_directory) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/core/workspace/autodiscovery.py", line 26, in loadable_targets_from_python_file loaded_module = load_python_file(python_file, working_directory) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/core/code_pointer.py", line 86, in load_python_file return import_module_from_path(module_name, python_file) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/seven/__init__.py", line 50, in import_module_from_path spec.loader.exec_module(module) File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/Users/jasonwirth/code/dagster_examples/cereal.py", line 9, in <module> def download_cereals(): File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/core/definitions/decorators/op_decorator.py", line 299, in op return _Op()(name) File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/core/definitions/decorators/op_decorator.py", line 130, in __call__ description=self.description or format_docstring_for_description(fn), File "/Users/jasonwirth/miniconda3/envs/dagster/lib/python3.10/site-packages/dagster/core/decorator_utils.py", line 65, in format_docstring_for_description if docstring[0].isspace(): IndexError: string index out of range
4,582
docker/compose
docker__compose-10
b4c905dc83fb44d6fb5ac0b4a0e8d5c63205c28b
diff --git a/fig/cli/log_printer.py b/fig/cli/log_printer.py --- a/fig/cli/log_printer.py +++ b/fig/cli/log_printer.py @@ -31,28 +31,18 @@ def _make_log_generators(self): def _make_log_generator(self, container, color_fn): prefix = color_fn(container.name + " | ") - websocket = self._attach(container) - return (prefix + line for line in split_buffer(read_websocket(websocket), '\n')) + for line in split_buffer(self._attach(container), '\n'): + yield prefix + line def _attach(self, container): params = { - 'stdin': False, 'stdout': True, 'stderr': True, - 'logs': False, 'stream': True, } params.update(self.attach_params) params = dict((name, 1 if value else 0) for (name, value) in list(params.items())) - return container.attach_socket(params=params, ws=True) - -def read_websocket(websocket): - while True: - data = websocket.recv() - if data: - yield data - else: - break + return container.attach(**params) def split_buffer(reader, separator): """ diff --git a/fig/container.py b/fig/container.py --- a/fig/container.py +++ b/fig/container.py @@ -122,6 +122,9 @@ def links(self): links.append(bits[2]) return links + def attach(self, *args, **kwargs): + return self.client.attach(self.id, *args, **kwargs) + def attach_socket(self, **kwargs): return self.client.attach_socket(self.id, **kwargs)
Getting ValueError: scheme unix is invalid Getting this error when running docker v0.7.2. Here's the corresponding traceback: ``` Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==0.0.2', 'console_scripts', 'fig')() File "/usr/local/lib/python2.7/dist-packages/fig/cli/main.py", line 37, in main command.sys_dispatch() File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 19, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 22, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 25, in perform_command handler(command_options) File "/usr/local/lib/python2.7/dist-packages/fig/cli/main.py", line 226, in up log_printer = LogPrinter(containers) File "/usr/local/lib/python2.7/dist-packages/fig/cli/log_printer.py", line 13, in __init__ self.generators = self._make_log_generators() File "/usr/local/lib/python2.7/dist-packages/fig/cli/log_printer.py", line 26, in _make_log_generators generators.append(self._make_log_generator(container, color_fn)) File "/usr/local/lib/python2.7/dist-packages/fig/cli/log_printer.py", line 32, in _make_log_generator websocket = self._attach(container) File "/usr/local/lib/python2.7/dist-packages/fig/cli/log_printer.py", line 45, in _attach return container.attach_socket(params=params, ws=True) File "/usr/local/lib/python2.7/dist-packages/fig/container.py", line 131, in attach_socket return self.client.attach_socket(self.id, **kwargs) File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 251, in attach_socket return self._attach_websocket(container, params) File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 217, in _attach_websocket return self._create_websocket_connection(full_url) File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 220, in _create_websocket_connection return websocket.create_connection(url) File "/usr/local/lib/python2.7/dist-packages/websocket.py", line 178, in create_connection websock.connect(url, **options) File "/usr/local/lib/python2.7/dist-packages/websocket.py", line 419, in connect hostname, port, resource, is_secure = _parse_url(url) File "/usr/local/lib/python2.7/dist-packages/websocket.py", line 141, in _parse_url raise ValueError("scheme %s is invalid" % scheme) ValueError: scheme unix is invalid ```
Seems like it's for an old version of docker and expecting a tcp socket, while newer ones mount on /var/run/docker.sock. @aronasorman Shouldn't be the case. I get this on 0.7.4. Unless you mean that fig expects older versions? I am having the same issue with Docker 0.7.5
2014-01-14T12:51:14Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==0.0.2', 'console_scripts', 'fig')() File "/usr/local/lib/python2.7/dist-packages/fig/cli/main.py", line 37, in main command.sys_dispatch() File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 19, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 22, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 25, in perform_command handler(command_options) File "/usr/local/lib/python2.7/dist-packages/fig/cli/main.py", line 226, in up log_printer = LogPrinter(containers) File "/usr/local/lib/python2.7/dist-packages/fig/cli/log_printer.py", line 13, in __init__ self.generators = self._make_log_generators() File "/usr/local/lib/python2.7/dist-packages/fig/cli/log_printer.py", line 26, in _make_log_generators generators.append(self._make_log_generator(container, color_fn)) File "/usr/local/lib/python2.7/dist-packages/fig/cli/log_printer.py", line 32, in _make_log_generator websocket = self._attach(container) File "/usr/local/lib/python2.7/dist-packages/fig/cli/log_printer.py", line 45, in _attach return container.attach_socket(params=params, ws=True) File "/usr/local/lib/python2.7/dist-packages/fig/container.py", line 131, in attach_socket return self.client.attach_socket(self.id, **kwargs) File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 251, in attach_socket return self._attach_websocket(container, params) File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 217, in _attach_websocket return self._create_websocket_connection(full_url) File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 220, in _create_websocket_connection return websocket.create_connection(url) File "/usr/local/lib/python2.7/dist-packages/websocket.py", line 178, in create_connection websock.connect(url, **options) File "/usr/local/lib/python2.7/dist-packages/websocket.py", line 419, in connect hostname, port, resource, is_secure = _parse_url(url) File "/usr/local/lib/python2.7/dist-packages/websocket.py", line 141, in _parse_url raise ValueError("scheme %s is invalid" % scheme) ValueError: scheme unix is invalid
4,618
docker/compose
docker__compose-1026
66555aa69b1ebfde8ba16183ea66f6c7e4b491e7
diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ def find_version(*file_paths): install_requires = [ 'docopt >= 0.6.1, < 0.7', 'PyYAML >= 3.10, < 4', - 'requests >= 2.2.1, < 3', + 'requests >= 2.2.1, < 2.5.0', 'texttable >= 0.8.1, < 0.9', 'websocket-client >= 0.11.0, < 1.0', 'docker-py >= 0.6.0, < 0.8',
'requests' version conflict docker-compose install the latest `requests` version (2.5.1) but docker-py expects `requests` version lower than 2.5.0. #### docker-compose(fig) https://github.com/docker/fig/blob/master/setup.py ``` install_requires = [ ... 'requests >= 2.2.1, < 3', 'docker-py >= 0.6.0, < 0.8', ... ] ``` #### docker-py https://github.com/docker/docker-py/blob/master/setup.py ``` install_requires = [ ... 'requests >= 2.2.1, < 2.5.0', ... ] ``` Here is the error message: ``` Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 5, in <module> from pkg_resources import load_entry_point File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3018, in <module> working_set = WorkingSet._build_master() File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 614, in _build_master return cls._build_from_requirements(__requires__) File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 627, in _build_from_requirements dists = ws.resolve(reqs, Environment()) File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 810, in resolve raise VersionConflict(dist, req).with_context(dependent_req) pkg_resources.ContextualVersionConflict: (requests 2.5.1 (/usr/local/lib/python2.7/dist-packages), Requirement.parse('requests<2.5.0,>=2.2.1'), set(['docker-py'])) ```
To check conflict ``` $ pip install pip-conflict-checker $ pipconflictchecker -------------------------------------------------- Conflicts Detected -------------------------------------------------- - requests(2.5.1) docker-py(<2.5.0,>=2.2.1) ``` I get the same error. Are there any workarounds until a permanent fix is landed? For a temporary workaround, you can clone docker-compose and update `requests` version in setup.py: ``` $ git clone [email protected]:docker/fig.git $ cd fig ``` replace the string `'requests >= 2.2.1, < 3',` to `'requests >= 2.2.1, < 2.5.0',` in setup.py and then run: `$ pip install .` Thanks for the tip @blackrosezy. Uninstalling requests and installing «valid» version also worked: ``` bash pip uninstall requests pip install requests==2.4.3 ``` docker-py should be updated to support newer versions, is there a corresponding ticket for that? docker/docker-py#469 seems to address it.
2015-02-25T17:37:00Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 5, in <module> from pkg_resources import load_entry_point File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3018, in <module> working_set = WorkingSet._build_master() File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 614, in _build_master return cls._build_from_requirements(__requires__) File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 627, in _build_from_requirements dists = ws.resolve(reqs, Environment()) File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 810, in resolve raise VersionConflict(dist, req).with_context(dependent_req) pkg_resources.ContextualVersionConflict: (requests 2.5.1 (/usr/local/lib/python2.7/dist-packages), Requirement.parse('requests<2.5.0,>=2.2.1'), set(['docker-py']))
4,620
docker/compose
docker__compose-1159
03535a61588e205dfe687707996b1e0d35d065cd
diff --git a/compose/__init__.py b/compose/__init__.py --- a/compose/__init__.py +++ b/compose/__init__.py @@ -1,4 +1,4 @@ from __future__ import unicode_literals from .service import Service # noqa:flake8 -__version__ = '1.1.0' +__version__ = '1.2.0' diff --git a/compose/cli/command.py b/compose/cli/command.py --- a/compose/cli/command.py +++ b/compose/cli/command.py @@ -4,9 +4,9 @@ import logging import os import re -import yaml import six +from .. import config from ..project import Project from ..service import ConfigError from .docopt_command import DocoptCommand @@ -25,7 +25,7 @@ class Command(DocoptCommand): def dispatch(self, *args, **kwargs): try: super(Command, self).dispatch(*args, **kwargs) - except SSLError, e: + except SSLError as e: raise errors.UserError('SSL error: %s' % e) except ConnectionError: if call_silently(['which', 'docker']) != 0: @@ -69,18 +69,11 @@ def get_client(self, verbose=False): return verbose_proxy.VerboseProxy('docker', client) return client - def get_config(self, config_path): - try: - with open(config_path, 'r') as fh: - return yaml.safe_load(fh) - except IOError as e: - raise errors.UserError(six.text_type(e)) - def get_project(self, config_path, project_name=None, verbose=False): try: - return Project.from_config( + return Project.from_dicts( self.get_project_name(config_path, project_name), - self.get_config(config_path), + config.load(config_path), self.get_client(verbose=verbose)) except ConfigError as e: raise errors.UserError(six.text_type(e)) diff --git a/compose/cli/docker_client.py b/compose/cli/docker_client.py --- a/compose/cli/docker_client.py +++ b/compose/cli/docker_client.py @@ -32,4 +32,4 @@ def docker_client(): ) timeout = int(os.environ.get('DOCKER_CLIENT_TIMEOUT', 60)) - return Client(base_url=base_url, tls=tls_config, version='1.14', timeout=timeout) + return Client(base_url=base_url, tls=tls_config, version='1.15', timeout=timeout) diff --git a/compose/cli/log_printer.py b/compose/cli/log_printer.py --- a/compose/cli/log_printer.py +++ b/compose/cli/log_printer.py @@ -46,7 +46,7 @@ def no_color(text): if monochrome: color_fn = no_color else: - color_fn = color_fns.next() + color_fn = next(color_fns) generators.append(self._make_log_generator(container, color_fn)) return generators diff --git a/compose/cli/main.py b/compose/cli/main.py --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -1,26 +1,26 @@ from __future__ import print_function from __future__ import unicode_literals +from inspect import getdoc +from operator import attrgetter import logging -import sys import re import signal -from operator import attrgetter +import sys -from inspect import getdoc +from docker.errors import APIError import dockerpty from .. import __version__ from ..project import NoSuchService, ConfigurationError from ..service import BuildError, CannotBeScaledError +from ..config import parse_environment from .command import Command +from .docopt_command import NoSuchCommand +from .errors import UserError from .formatter import Formatter from .log_printer import LogPrinter from .utils import yesno -from docker.errors import APIError -from .errors import UserError -from .docopt_command import NoSuchCommand - log = logging.getLogger(__name__) @@ -238,8 +238,8 @@ def rm(self, project, options): Usage: rm [options] [SERVICE...] Options: - --force Don't ask to confirm removal - -v Remove volumes associated with containers + -f, --force Don't ask to confirm removal + -v Remove volumes associated with containers """ all_containers = project.containers(service_names=options['SERVICE'], stopped=True) stopped_containers = [c for c in all_containers if not c.is_running] @@ -276,6 +276,7 @@ def run(self, project, options): new container name. --entrypoint CMD Override the entrypoint of the image. -e KEY=VAL Set an environment variable (can be used multiple times) + -u, --user="" Run as specified username or uid --no-deps Don't start linked services. --rm Remove container after run. Ignored in detached mode. --service-ports Run command with the service's ports enabled and mapped @@ -293,7 +294,7 @@ def run(self, project, options): if len(deps) > 0: project.up( service_names=deps, - start_links=True, + start_deps=True, recreate=False, insecure_registry=insecure_registry, detach=options['-d'] @@ -316,28 +317,31 @@ def run(self, project, options): } if options['-e']: - for option in options['-e']: - if 'environment' not in service.options: - service.options['environment'] = {} - k, v = option.split('=', 1) - service.options['environment'][k] = v + # Merge environment from config with -e command line + container_options['environment'] = dict( + parse_environment(service.options.get('environment')), + **parse_environment(options['-e'])) if options['--entrypoint']: container_options['entrypoint'] = options.get('--entrypoint') + + if options['--user']: + container_options['user'] = options.get('--user') + + if not options['--service-ports']: + container_options['ports'] = [] + container = service.create_container( one_off=True, insecure_registry=insecure_registry, **container_options ) - service_ports = None - if options['--service-ports']: - service_ports = service.options['ports'] if options['-d']: - service.start_container(container, ports=service_ports, one_off=True) + service.start_container(container) print(container.name) else: - service.start_container(container, ports=service_ports, one_off=True) + service.start_container(container) dockerpty.start(project.client, container.id, interactive=not options['-T']) exit_code = container.wait() if options['--rm']: @@ -389,17 +393,29 @@ def stop(self, project, options): They can be started again with `docker-compose start`. - Usage: stop [SERVICE...] + Usage: stop [options] [SERVICE...] + + Options: + -t, --timeout TIMEOUT Specify a shutdown timeout in seconds. + (default: 10) """ - project.stop(service_names=options['SERVICE']) + timeout = options.get('--timeout') + params = {} if timeout is None else {'timeout': int(timeout)} + project.stop(service_names=options['SERVICE'], **params) def restart(self, project, options): """ Restart running containers. - Usage: restart [SERVICE...] + Usage: restart [options] [SERVICE...] + + Options: + -t, --timeout TIMEOUT Specify a shutdown timeout in seconds. + (default: 10) """ - project.restart(service_names=options['SERVICE']) + timeout = options.get('--timeout') + params = {} if timeout is None else {'timeout': int(timeout)} + project.restart(service_names=options['SERVICE'], **params) def up(self, project, options): """ @@ -418,30 +434,33 @@ def up(self, project, options): Usage: up [options] [SERVICE...] Options: - --allow-insecure-ssl Allow insecure connections to the docker - registry - -d Detached mode: Run containers in the background, - print new container names. - --no-color Produce monochrome output. - --no-deps Don't start linked services. - --no-recreate If containers already exist, don't recreate them. - --no-build Don't build an image, even if it's missing + --allow-insecure-ssl Allow insecure connections to the docker + registry + -d Detached mode: Run containers in the background, + print new container names. + --no-color Produce monochrome output. + --no-deps Don't start linked services. + --no-recreate If containers already exist, don't recreate them. + --no-build Don't build an image, even if it's missing + -t, --timeout TIMEOUT When attached, use this timeout in seconds + for the shutdown. (default: 10) + """ insecure_registry = options['--allow-insecure-ssl'] detached = options['-d'] monochrome = options['--no-color'] - start_links = not options['--no-deps'] + start_deps = not options['--no-deps'] recreate = not options['--no-recreate'] service_names = options['SERVICE'] project.up( service_names=service_names, - start_links=start_links, + start_deps=start_deps, recreate=recreate, insecure_registry=insecure_registry, - detach=options['-d'], + detach=detached, do_build=not options['--no-build'], ) @@ -460,7 +479,9 @@ def handler(signal, frame): signal.signal(signal.SIGINT, handler) print("Gracefully stopping... (press Ctrl+C again to force)") - project.stop(service_names=service_names) + timeout = options.get('--timeout') + params = {} if timeout is None else {'timeout': int(timeout)} + project.stop(service_names=service_names, **params) def list_containers(containers): diff --git a/compose/config.py b/compose/config.py new file mode 100644 --- /dev/null +++ b/compose/config.py @@ -0,0 +1,432 @@ +import os +import yaml +import six + + +DOCKER_CONFIG_KEYS = [ + 'cap_add', + 'cap_drop', + 'cpu_shares', + 'command', + 'detach', + 'dns', + 'dns_search', + 'domainname', + 'entrypoint', + 'env_file', + 'environment', + 'hostname', + 'image', + 'links', + 'mem_limit', + 'net', + 'ports', + 'privileged', + 'restart', + 'stdin_open', + 'tty', + 'user', + 'volumes', + 'volumes_from', + 'working_dir', +] + +ALLOWED_KEYS = DOCKER_CONFIG_KEYS + [ + 'build', + 'expose', + 'external_links', + 'name', +] + +DOCKER_CONFIG_HINTS = { + 'cpu_share' : 'cpu_shares', + 'link' : 'links', + 'port' : 'ports', + 'privilege' : 'privileged', + 'priviliged': 'privileged', + 'privilige' : 'privileged', + 'volume' : 'volumes', + 'workdir' : 'working_dir', +} + + +def load(filename): + working_dir = os.path.dirname(filename) + return from_dictionary(load_yaml(filename), working_dir=working_dir, filename=filename) + + +def from_dictionary(dictionary, working_dir=None, filename=None): + service_dicts = [] + + for service_name, service_dict in list(dictionary.items()): + if not isinstance(service_dict, dict): + raise ConfigurationError('Service "%s" doesn\'t have any configuration options. All top level keys in your docker-compose.yml must map to a dictionary of configuration options.' % service_name) + loader = ServiceLoader(working_dir=working_dir, filename=filename) + service_dict = loader.make_service_dict(service_name, service_dict) + service_dicts.append(service_dict) + + return service_dicts + + +def make_service_dict(name, service_dict, working_dir=None): + return ServiceLoader(working_dir=working_dir).make_service_dict(name, service_dict) + + +class ServiceLoader(object): + def __init__(self, working_dir, filename=None, already_seen=None): + self.working_dir = working_dir + self.filename = filename + self.already_seen = already_seen or [] + + def make_service_dict(self, name, service_dict): + if self.signature(name) in self.already_seen: + raise CircularReference(self.already_seen) + + service_dict = service_dict.copy() + service_dict['name'] = name + service_dict = resolve_environment(service_dict, working_dir=self.working_dir) + service_dict = self.resolve_extends(service_dict) + return process_container_options(service_dict, working_dir=self.working_dir) + + def resolve_extends(self, service_dict): + if 'extends' not in service_dict: + return service_dict + + extends_options = process_extends_options(service_dict['name'], service_dict['extends']) + + if self.working_dir is None: + raise Exception("No working_dir passed to ServiceLoader()") + + other_config_path = expand_path(self.working_dir, extends_options['file']) + other_working_dir = os.path.dirname(other_config_path) + other_already_seen = self.already_seen + [self.signature(service_dict['name'])] + other_loader = ServiceLoader( + working_dir=other_working_dir, + filename=other_config_path, + already_seen=other_already_seen, + ) + + other_config = load_yaml(other_config_path) + other_service_dict = other_config[extends_options['service']] + other_service_dict = other_loader.make_service_dict( + service_dict['name'], + other_service_dict, + ) + validate_extended_service_dict( + other_service_dict, + filename=other_config_path, + service=extends_options['service'], + ) + + return merge_service_dicts(other_service_dict, service_dict) + + def signature(self, name): + return (self.filename, name) + + +def process_extends_options(service_name, extends_options): + error_prefix = "Invalid 'extends' configuration for %s:" % service_name + + if not isinstance(extends_options, dict): + raise ConfigurationError("%s must be a dictionary" % error_prefix) + + if 'service' not in extends_options: + raise ConfigurationError( + "%s you need to specify a service, e.g. 'service: web'" % error_prefix + ) + + for k, _ in extends_options.items(): + if k not in ['file', 'service']: + raise ConfigurationError( + "%s unsupported configuration option '%s'" % (error_prefix, k) + ) + + return extends_options + + +def validate_extended_service_dict(service_dict, filename, service): + error_prefix = "Cannot extend service '%s' in %s:" % (service, filename) + + if 'links' in service_dict: + raise ConfigurationError("%s services with 'links' cannot be extended" % error_prefix) + + if 'volumes_from' in service_dict: + raise ConfigurationError("%s services with 'volumes_from' cannot be extended" % error_prefix) + + if 'net' in service_dict: + if get_service_name_from_net(service_dict['net']) is not None: + raise ConfigurationError("%s services with 'net: container' cannot be extended" % error_prefix) + + +def process_container_options(service_dict, working_dir=None): + for k in service_dict: + if k not in ALLOWED_KEYS: + msg = "Unsupported config option for %s service: '%s'" % (service_dict['name'], k) + if k in DOCKER_CONFIG_HINTS: + msg += " (did you mean '%s'?)" % DOCKER_CONFIG_HINTS[k] + raise ConfigurationError(msg) + + service_dict = service_dict.copy() + + if 'volumes' in service_dict: + service_dict['volumes'] = resolve_host_paths(service_dict['volumes'], working_dir=working_dir) + + if 'build' in service_dict: + service_dict['build'] = resolve_build_path(service_dict['build'], working_dir=working_dir) + + return service_dict + + +def merge_service_dicts(base, override): + d = base.copy() + + if 'environment' in base or 'environment' in override: + d['environment'] = merge_environment( + base.get('environment'), + override.get('environment'), + ) + + if 'volumes' in base or 'volumes' in override: + d['volumes'] = merge_volumes( + base.get('volumes'), + override.get('volumes'), + ) + + if 'image' in override and 'build' in d: + del d['build'] + + if 'build' in override and 'image' in d: + del d['image'] + + list_keys = ['ports', 'expose', 'external_links'] + + for key in list_keys: + if key in base or key in override: + d[key] = base.get(key, []) + override.get(key, []) + + list_or_string_keys = ['dns', 'dns_search'] + + for key in list_or_string_keys: + if key in base or key in override: + d[key] = to_list(base.get(key)) + to_list(override.get(key)) + + already_merged_keys = ['environment', 'volumes'] + list_keys + list_or_string_keys + + for k in set(ALLOWED_KEYS) - set(already_merged_keys): + if k in override: + d[k] = override[k] + + return d + + +def merge_environment(base, override): + env = parse_environment(base) + env.update(parse_environment(override)) + return env + + +def parse_links(links): + return dict(parse_link(l) for l in links) + + +def parse_link(link): + if ':' in link: + source, alias = link.split(':', 1) + return (alias, source) + else: + return (link, link) + + +def get_env_files(options, working_dir=None): + if 'env_file' not in options: + return {} + + if working_dir is None: + raise Exception("No working_dir passed to get_env_files()") + + env_files = options.get('env_file', []) + if not isinstance(env_files, list): + env_files = [env_files] + + return [expand_path(working_dir, path) for path in env_files] + + +def resolve_environment(service_dict, working_dir=None): + service_dict = service_dict.copy() + + if 'environment' not in service_dict and 'env_file' not in service_dict: + return service_dict + + env = {} + + if 'env_file' in service_dict: + for f in get_env_files(service_dict, working_dir=working_dir): + env.update(env_vars_from_file(f)) + del service_dict['env_file'] + + env.update(parse_environment(service_dict.get('environment'))) + env = dict(resolve_env_var(k, v) for k, v in six.iteritems(env)) + + service_dict['environment'] = env + return service_dict + + +def parse_environment(environment): + if not environment: + return {} + + if isinstance(environment, list): + return dict(split_env(e) for e in environment) + + if isinstance(environment, dict): + return environment + + raise ConfigurationError( + "environment \"%s\" must be a list or mapping," % + environment + ) + + +def split_env(env): + if '=' in env: + return env.split('=', 1) + else: + return env, None + + +def resolve_env_var(key, val): + if val is not None: + return key, val + elif key in os.environ: + return key, os.environ[key] + else: + return key, '' + + +def env_vars_from_file(filename): + """ + Read in a line delimited file of environment variables. + """ + if not os.path.exists(filename): + raise ConfigurationError("Couldn't find env file: %s" % filename) + env = {} + for line in open(filename, 'r'): + line = line.strip() + if line and not line.startswith('#'): + k, v = split_env(line) + env[k] = v + return env + + +def resolve_host_paths(volumes, working_dir=None): + if working_dir is None: + raise Exception("No working_dir passed to resolve_host_paths()") + + return [resolve_host_path(v, working_dir) for v in volumes] + + +def resolve_host_path(volume, working_dir): + container_path, host_path = split_volume(volume) + if host_path is not None: + host_path = os.path.expanduser(host_path) + host_path = os.path.expandvars(host_path) + return "%s:%s" % (expand_path(working_dir, host_path), container_path) + else: + return container_path + + +def resolve_build_path(build_path, working_dir=None): + if working_dir is None: + raise Exception("No working_dir passed to resolve_build_path") + + _path = expand_path(working_dir, build_path) + if not os.path.exists(_path) or not os.access(_path, os.R_OK): + raise ConfigurationError("build path %s either does not exist or is not accessible." % _path) + else: + return _path + + +def merge_volumes(base, override): + d = dict_from_volumes(base) + d.update(dict_from_volumes(override)) + return volumes_from_dict(d) + + +def dict_from_volumes(volumes): + if volumes: + return dict(split_volume(v) for v in volumes) + else: + return {} + + +def volumes_from_dict(d): + return [join_volume(v) for v in d.items()] + + +def split_volume(string): + if ':' in string: + (host, container) = string.split(':', 1) + return (container, host) + else: + return (string, None) + + +def join_volume(pair): + (container, host) = pair + if host is None: + return container + else: + return ":".join((host, container)) + + +def expand_path(working_dir, path): + return os.path.abspath(os.path.join(working_dir, path)) + + +def to_list(value): + if value is None: + return [] + elif isinstance(value, six.string_types): + return [value] + else: + return value + + +def get_service_name_from_net(net_config): + if not net_config: + return + + if not net_config.startswith('container:'): + return + + _, net_name = net_config.split(':', 1) + return net_name + + +def load_yaml(filename): + try: + with open(filename, 'r') as fh: + return yaml.safe_load(fh) + except IOError as e: + raise ConfigurationError(six.text_type(e)) + + +class ConfigurationError(Exception): + def __init__(self, msg): + self.msg = msg + + def __str__(self): + return self.msg + + +class CircularReference(ConfigurationError): + def __init__(self, trail): + self.trail = trail + + @property + def msg(self): + lines = [ + "{} in {}".format(service_name, filename) + for (filename, service_name) in self.trail + ] + return "Circular reference:\n {}".format("\n extends ".join(lines)) diff --git a/compose/container.py b/compose/container.py --- a/compose/container.py +++ b/compose/container.py @@ -2,6 +2,7 @@ from __future__ import absolute_import import six +from functools import reduce class Container(object): diff --git a/compose/project.py b/compose/project.py --- a/compose/project.py +++ b/compose/project.py @@ -2,6 +2,8 @@ from __future__ import absolute_import import logging +from functools import reduce +from .config import get_service_name_from_net, ConfigurationError from .service import Service from .container import Container from docker.errors import APIError @@ -18,6 +20,15 @@ def sort_service_dicts(services): def get_service_names(links): return [link.split(':')[0] for link in links] + def get_service_dependents(service_dict, services): + name = service_dict['name'] + return [ + service for service in services + if (name in get_service_names(service.get('links', [])) or + name in service.get('volumes_from', []) or + name == get_service_name_from_net(service.get('net'))) + ] + def visit(n): if n['name'] in temporary_marked: if n['name'] in get_service_names(n.get('links', [])): @@ -28,8 +39,7 @@ def visit(n): raise DependencyError('Circular import between %s' % ' and '.join(temporary_marked)) if n in unmarked: temporary_marked.add(n['name']) - dependents = [m for m in services if (n['name'] in get_service_names(m.get('links', []))) or (n['name'] in m.get('volumes_from', []))] - for m in dependents: + for m in get_service_dependents(n, services): visit(m) temporary_marked.remove(n['name']) unmarked.remove(n) @@ -59,20 +69,12 @@ def from_dicts(cls, name, service_dicts, client): for service_dict in sort_service_dicts(service_dicts): links = project.get_links(service_dict) volumes_from = project.get_volumes_from(service_dict) + net = project.get_net(service_dict) - project.services.append(Service(client=client, project=name, links=links, volumes_from=volumes_from, **service_dict)) + project.services.append(Service(client=client, project=name, links=links, net=net, + volumes_from=volumes_from, **service_dict)) return project - @classmethod - def from_config(cls, name, config, client): - dicts = [] - for service_name, service in list(config.items()): - if not isinstance(service, dict): - raise ConfigurationError('Service "%s" doesn\'t have any configuration options. All top level keys in your docker-compose.yml must map to a dictionary of configuration options.' % service_name) - service['name'] = service_name - dicts.append(service) - return cls.from_dicts(name, dicts, client) - def get_service(self, name): """ Retrieve a service by name. Raises NoSuchService @@ -84,31 +86,31 @@ def get_service(self, name): raise NoSuchService(name) - def get_services(self, service_names=None, include_links=False): + def get_services(self, service_names=None, include_deps=False): """ Returns a list of this project's services filtered by the provided list of names, or all services if service_names is None or []. - If include_links is specified, returns a list including the links for + If include_deps is specified, returns a list including the dependencies for service_names, in order of dependency. Preserves the original order of self.services where possible, - reordering as needed to resolve links. + reordering as needed to resolve dependencies. Raises NoSuchService if any of the named services do not exist. """ if service_names is None or len(service_names) == 0: return self.get_services( service_names=[s.name for s in self.services], - include_links=include_links + include_deps=include_deps ) else: unsorted = [self.get_service(name) for name in service_names] services = [s for s in self.services if s in unsorted] - if include_links: - services = reduce(self._inject_links, services, []) + if include_deps: + services = reduce(self._inject_deps, services, []) uniques = [] [uniques.append(s) for s in services if s not in uniques] @@ -145,6 +147,28 @@ def get_volumes_from(self, service_dict): del service_dict['volumes_from'] return volumes_from + def get_net(self, service_dict): + if 'net' in service_dict: + net_name = get_service_name_from_net(service_dict.get('net')) + + if net_name: + try: + net = self.get_service(net_name) + except NoSuchService: + try: + net = Container.from_id(self.client, net_name) + except APIError: + raise ConfigurationError('Serivce "%s" is trying to use the network of "%s", which is not the name of a service or container.' % (service_dict['name'], net_name)) + else: + net = service_dict['net'] + + del service_dict['net'] + + else: + net = 'bridge' + + return net + def start(self, service_names=None, **options): for service in self.get_services(service_names): service.start(**options) @@ -170,13 +194,13 @@ def build(self, service_names=None, no_cache=False): def up(self, service_names=None, - start_links=True, + start_deps=True, recreate=True, insecure_registry=False, detach=False, do_build=True): running_containers = [] - for service in self.get_services(service_names, include_links=start_links): + for service in self.get_services(service_names, include_deps=start_deps): if recreate: for (_, container) in service.recreate_containers( insecure_registry=insecure_registry, @@ -193,7 +217,7 @@ def up(self, return running_containers def pull(self, service_names=None, insecure_registry=False): - for service in self.get_services(service_names, include_links=True): + for service in self.get_services(service_names, include_deps=True): service.pull(insecure_registry=insecure_registry) def remove_stopped(self, service_names=None, **options): @@ -206,19 +230,22 @@ def containers(self, service_names=None, stopped=False, one_off=False): for service in self.get_services(service_names) if service.has_container(container, one_off=one_off)] - def _inject_links(self, acc, service): - linked_names = service.get_linked_names() + def _inject_deps(self, acc, service): + net_name = service.get_net_name() + dep_names = (service.get_linked_names() + + service.get_volumes_from_names() + + ([net_name] if net_name else [])) - if len(linked_names) > 0: - linked_services = self.get_services( - service_names=linked_names, - include_links=True + if len(dep_names) > 0: + dep_services = self.get_services( + service_names=list(set(dep_names)), + include_deps=True ) else: - linked_services = [] + dep_services = [] - linked_services.append(service) - return acc + linked_services + dep_services.append(service) + return acc + dep_services class NoSuchService(Exception): @@ -230,13 +257,5 @@ def __str__(self): return self.msg -class ConfigurationError(Exception): - def __init__(self, msg): - self.msg = msg - - def __str__(self): - return self.msg - - class DependencyError(ConfigurationError): pass diff --git a/compose/service.py b/compose/service.py --- a/compose/service.py +++ b/compose/service.py @@ -3,55 +3,20 @@ from collections import namedtuple import logging import re -import os from operator import attrgetter import sys +import six from docker.errors import APIError +from docker.utils import create_host_config +from .config import DOCKER_CONFIG_KEYS from .container import Container, get_container_name from .progress_stream import stream_output, StreamOutputError log = logging.getLogger(__name__) -DOCKER_CONFIG_KEYS = [ - 'cap_add', - 'cap_drop', - 'cpu_shares', - 'command', - 'detach', - 'dns', - 'dns_search', - 'domainname', - 'entrypoint', - 'env_file', - 'environment', - 'hostname', - 'image', - 'mem_limit', - 'net', - 'ports', - 'privileged', - 'restart', - 'stdin_open', - 'tty', - 'user', - 'volumes', - 'volumes_from', - 'working_dir', -] -DOCKER_CONFIG_HINTS = { - 'cpu_share' : 'cpu_shares', - 'link' : 'links', - 'port' : 'ports', - 'privilege' : 'privileged', - 'priviliged': 'privileged', - 'privilige' : 'privileged', - 'volume' : 'volumes', - 'workdir' : 'working_dir', -} - DOCKER_START_KEYS = [ 'cap_add', 'cap_drop', @@ -87,7 +52,7 @@ class ConfigError(ValueError): class Service(object): - def __init__(self, name, client=None, project='default', links=None, external_links=None, volumes_from=None, **options): + def __init__(self, name, client=None, project='default', links=None, external_links=None, volumes_from=None, net=None, **options): if not re.match('^%s+$' % VALID_NAME_CHARS, name): raise ConfigError('Invalid service name "%s" - only %s are allowed' % (name, VALID_NAME_CHARS)) if not re.match('^%s+$' % VALID_NAME_CHARS, project): @@ -95,26 +60,13 @@ def __init__(self, name, client=None, project='default', links=None, external_li if 'image' in options and 'build' in options: raise ConfigError('Service %s has both an image and build path specified. A service can either be built to image or use an existing image, not both.' % name) - for filename in get_env_files(options): - if not os.path.exists(filename): - raise ConfigError("Couldn't find env file for service %s: %s" % (name, filename)) - - supported_options = DOCKER_CONFIG_KEYS + ['build', 'expose', - 'external_links'] - - for k in options: - if k not in supported_options: - msg = "Unsupported config option for %s service: '%s'" % (name, k) - if k in DOCKER_CONFIG_HINTS: - msg += " (did you mean '%s'?)" % DOCKER_CONFIG_HINTS[k] - raise ConfigError(msg) - self.name = name self.client = client self.project = project self.links = links or [] self.external_links = external_links or [] self.volumes_from = volumes_from or [] + self.net = net or None self.options = options def containers(self, stopped=False, one_off=False): @@ -217,6 +169,7 @@ def create_container(self, one_off=False, insecure_registry=False, do_build=True, + intermediate_container=None, **override_options): """ Create a container for this service. If the image doesn't exist, attempt to pull @@ -224,7 +177,9 @@ def create_container(self, """ container_options = self._get_container_create_options( override_options, - one_off=one_off) + one_off=one_off, + intermediate_container=intermediate_container, + ) if (do_build and self.can_be_built() and @@ -289,57 +244,33 @@ def recreate_container(self, container, **override_options): entrypoint=['/bin/echo'], command=[], detach=True, + host_config=create_host_config(volumes_from=[container.id]), ) - intermediate_container.start(volumes_from=container.id) + intermediate_container.start() intermediate_container.wait() container.remove() options = dict(override_options) - new_container = self.create_container(do_build=False, **options) - self.start_container(new_container, intermediate_container=intermediate_container) + new_container = self.create_container( + do_build=False, + intermediate_container=intermediate_container, + **options + ) + self.start_container(new_container) intermediate_container.remove() return (intermediate_container, new_container) - def start_container_if_stopped(self, container, **options): + def start_container_if_stopped(self, container): if container.is_running: return container else: log.info("Starting %s..." % container.name) - return self.start_container(container, **options) - - def start_container(self, container, intermediate_container=None, **override_options): - options = dict(self.options, **override_options) - port_bindings = build_port_bindings(options.get('ports') or []) - - volume_bindings = dict( - build_volume_binding(parse_volume_spec(volume)) - for volume in options.get('volumes') or [] - if ':' in volume) - - privileged = options.get('privileged', False) - net = options.get('net', 'bridge') - dns = options.get('dns', None) - dns_search = options.get('dns_search', None) - cap_add = options.get('cap_add', None) - cap_drop = options.get('cap_drop', None) - - restart = parse_restart_spec(options.get('restart', None)) + return self.start_container(container) - container.start( - links=self._get_links(link_to_self=options.get('one_off', False)), - port_bindings=port_bindings, - binds=volume_bindings, - volumes_from=self._get_volumes_from(intermediate_container), - privileged=privileged, - network_mode=net, - dns=dns, - dns_search=dns_search, - restart_policy=restart, - cap_add=cap_add, - cap_drop=cap_drop, - ) + def start_container(self, container): + container.start() return container def start_or_create_containers( @@ -363,6 +294,15 @@ def start_or_create_containers( def get_linked_names(self): return [s.name for (s, _) in self.links] + def get_volumes_from_names(self): + return [s.name for s in self.volumes_from if isinstance(s, Service)] + + def get_net_name(self): + if isinstance(self.net, Service): + return self.net.name + else: + return + def _next_container_name(self, all_containers, one_off=False): bits = [self.project, self.name] if one_off: @@ -398,7 +338,6 @@ def _get_volumes_from(self, intermediate_container=None): for volume_source in self.volumes_from: if isinstance(volume_source, Service): containers = volume_source.containers(stopped=True) - if not containers: volumes_from.append(volume_source.create_container().id) else: @@ -412,7 +351,26 @@ def _get_volumes_from(self, intermediate_container=None): return volumes_from - def _get_container_create_options(self, override_options, one_off=False): + def _get_net(self): + if not self.net: + return "bridge" + + if isinstance(self.net, Service): + containers = self.net.containers() + if len(containers) > 0: + net = 'container:' + containers[0].id + else: + log.warning("Warning: Service %s is trying to use reuse the network stack " + "of another service that is not running." % (self.net.name)) + net = None + elif isinstance(self.net, Container): + net = 'container:' + self.net.id + else: + net = self.net + + return net + + def _get_container_create_options(self, override_options, one_off=False, intermediate_container=None): container_options = dict( (k, self.options[k]) for k in DOCKER_CONFIG_KEYS if k in self.options) @@ -450,8 +408,6 @@ def _get_container_create_options(self, override_options, one_off=False): (parse_volume_spec(v).internal, {}) for v in container_options['volumes']) - container_options['environment'] = merge_environment(container_options) - if self.can_be_built(): container_options['image'] = self.full_name else: @@ -461,8 +417,47 @@ def _get_container_create_options(self, override_options, one_off=False): for key in DOCKER_START_KEYS: container_options.pop(key, None) + container_options['host_config'] = self._get_container_host_config(override_options, one_off=one_off, intermediate_container=intermediate_container) + return container_options + def _get_container_host_config(self, override_options, one_off=False, intermediate_container=None): + options = dict(self.options, **override_options) + port_bindings = build_port_bindings(options.get('ports') or []) + + volume_bindings = dict( + build_volume_binding(parse_volume_spec(volume)) + for volume in options.get('volumes') or [] + if ':' in volume) + + privileged = options.get('privileged', False) + cap_add = options.get('cap_add', None) + cap_drop = options.get('cap_drop', None) + + dns = options.get('dns', None) + if isinstance(dns, six.string_types): + dns = [dns] + + dns_search = options.get('dns_search', None) + if isinstance(dns_search, six.string_types): + dns_search = [dns_search] + + restart = parse_restart_spec(options.get('restart', None)) + + return create_host_config( + links=self._get_links(link_to_self=one_off), + port_bindings=port_bindings, + binds=volume_bindings, + volumes_from=self._get_volumes_from(intermediate_container), + privileged=privileged, + network_mode=self._get_net(), + dns=dns, + dns_search=dns_search, + restart_policy=restart, + cap_add=cap_add, + cap_drop=cap_drop, + ) + def _get_image_name(self, image): repo, tag = parse_repository_tag(image) if tag == "": @@ -482,7 +477,7 @@ def build(self, no_cache=False): try: all_events = stream_output(build_output, sys.stdout) - except StreamOutputError, e: + except StreamOutputError as e: raise BuildError(self, unicode(e)) image_id = None @@ -590,8 +585,7 @@ def parse_repository_tag(s): def build_volume_binding(volume_spec): internal = {'bind': volume_spec.internal, 'ro': volume_spec.mode == 'ro'} - external = os.path.expanduser(volume_spec.external) - return os.path.abspath(os.path.expandvars(external)), internal + return volume_spec.external, internal def build_port_bindings(ports): @@ -620,54 +614,3 @@ def split_port(port): external_ip, external_port, internal_port = parts return internal_port, (external_ip, external_port or None) - - -def get_env_files(options): - env_files = options.get('env_file', []) - if not isinstance(env_files, list): - env_files = [env_files] - return env_files - - -def merge_environment(options): - env = {} - - for f in get_env_files(options): - env.update(env_vars_from_file(f)) - - if 'environment' in options: - if isinstance(options['environment'], list): - env.update(dict(split_env(e) for e in options['environment'])) - else: - env.update(options['environment']) - - return dict(resolve_env(k, v) for k, v in env.iteritems()) - - -def split_env(env): - if '=' in env: - return env.split('=', 1) - else: - return env, None - - -def resolve_env(key, val): - if val is not None: - return key, val - elif key in os.environ: - return key, os.environ[key] - else: - return key, '' - - -def env_vars_from_file(filename): - """ - Read in a line delimited file of environment variables. - """ - env = {} - for line in open(filename, 'r'): - line = line.strip() - if line and not line.startswith('#'): - k, v = split_env(line) - env[k] = v - return env diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -27,10 +27,10 @@ def find_version(*file_paths): install_requires = [ 'docopt >= 0.6.1, < 0.7', 'PyYAML >= 3.10, < 4', - 'requests >= 2.2.1, < 2.5.0', + 'requests >= 2.2.1, < 2.6', 'texttable >= 0.8.1, < 0.9', 'websocket-client >= 0.11.0, < 1.0', - 'docker-py >= 0.6.0, < 0.8', + 'docker-py >= 1.0.0, < 1.2', 'dockerpty >= 0.3.2, < 0.4', 'six >= 1.3.0, < 2', ]
Setting environment variable on CLI raises exception when service has environment definition It looks like I can't set an environment variable in the fig.yml and on the console at the same time. fig version: `1.0.1` python version: `2.7 (homebrew)` OS: OSX `10.10.2` _fig.yml:_ ``` bliep: image: ubuntu:14.04 environment: - SECRET_KEY ``` _full output:_ ``` $ fig run -e BLA=bla bliep Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==1.0.1', 'console_scripts', 'fig')() File "/usr/local/lib/python2.7/site-packages/fig/cli/main.py", line 31, in main command.sys_dispatch() File "/usr/local/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/lib/python2.7/site-packages/fig/cli/command.py", line 28, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/local/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/lib/python2.7/site-packages/fig/cli/command.py", line 56, in perform_command handler(project, command_options) File "/usr/local/lib/python2.7/site-packages/fig/cli/main.py", line 312, in run service.options['environment'][k] = v TypeError: list indices must be integers, not unicode ```
hmm, I thought this was fixed. Maybe it's in 1.1 or still in a PR somewhere. I believe the workaround for now is to use the mapping form in the fig.yml ``` yaml image: ubuntu:14.04 environment: SECRET_KEY: ``` sorry, nope: ``` $ cat fig.yml bliep: image: ubuntu:14.04 environment: - BLOP: $ fig run -e BLOP=bla bliep Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==1.0.1', 'console_scripts', 'fig')() File "/usr/local/lib/python2.7/site-packages/fig/cli/main.py", line 31, in main command.sys_dispatch() File "/usr/local/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/lib/python2.7/site-packages/fig/cli/command.py", line 28, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/local/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/lib/python2.7/site-packages/fig/cli/command.py", line 56, in perform_command handler(project, command_options) File "/usr/local/lib/python2.7/site-packages/fig/cli/main.py", line 312, in run service.options['environment'][k] = v TypeError: list indices must be integers, not unicode ``` You did not make the change I suggested. You still have a list in `environment`. You need to remove the dash. sorry, you are right and yes, that workaround works.
2015-03-23T17:56:16Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==1.0.1', 'console_scripts', 'fig')() File "/usr/local/lib/python2.7/site-packages/fig/cli/main.py", line 31, in main command.sys_dispatch() File "/usr/local/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/lib/python2.7/site-packages/fig/cli/command.py", line 28, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/local/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/lib/python2.7/site-packages/fig/cli/command.py", line 56, in perform_command handler(project, command_options) File "/usr/local/lib/python2.7/site-packages/fig/cli/main.py", line 312, in run service.options['environment'][k] = v TypeError: list indices must be integers, not unicode
4,621
docker/compose
docker__compose-128
e6016bd5b4a24953ef8e4c8549e9018cd560d76f
diff --git a/fig/cli/main.py b/fig/cli/main.py --- a/fig/cli/main.py +++ b/fig/cli/main.py @@ -8,7 +8,7 @@ from inspect import getdoc from .. import __version__ -from ..project import NoSuchService, DependencyError +from ..project import NoSuchService, ConfigurationError from ..service import CannotBeScaledError from .command import Command from .formatter import Formatter @@ -40,7 +40,7 @@ def main(): except KeyboardInterrupt: log.error("\nAborting.") sys.exit(1) - except (UserError, NoSuchService, DependencyError) as e: + except (UserError, NoSuchService, ConfigurationError) as e: log.error(e.msg) sys.exit(1) except NoSuchCommand as e: diff --git a/fig/project.py b/fig/project.py --- a/fig/project.py +++ b/fig/project.py @@ -67,6 +67,8 @@ def from_dicts(cls, name, service_dicts, client): def from_config(cls, name, config, client): dicts = [] for service_name, service in list(config.items()): + if not isinstance(service, dict): + raise ConfigurationError('Service "%s" doesn\'t have any configuration options. All top level keys in your fig.yml must map to a dictionary of configuration options.') service['name'] = service_name dicts.append(service) return cls.from_dicts(name, dicts, client) @@ -156,9 +158,13 @@ def __str__(self): return self.msg -class DependencyError(Exception): +class ConfigurationError(Exception): def __init__(self, msg): self.msg = msg def __str__(self): return self.msg + +class DependencyError(ConfigurationError): + pass +
OSX - 'str' object does not support item assignment System specs: - Mac OSX 10.8.5 - Python 2.7.2 (built-in) - Fig 0.2.2 My fig.yml: ``` image: stackbrew/ubuntu ports: - 3306:3306 - 6379:6379 links: - mysql - redis mysql: image: orchardup/mysql redis: image: orchardup/redis ``` When running `fig up`, I get the following error: ``` Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==0.2.2', 'console_scripts', 'fig')() File "/Library/Python/2.7/site-packages/fig/cli/main.py", line 39, in main command.sys_dispatch() File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 26, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 27, in perform_command handler(command_options) File "/Library/Python/2.7/site-packages/fig/cli/main.py", line 287, in up (old, new) = self.project.recreate_containers(service_names=options['SERVICE']) File "/Library/Python/2.7/site-packages/fig/cli/utils.py", line 22, in get x = self._property_cache[f] = f(self) File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 75, in project return Project.from_config(self.project_name, config, self.client) File "/Library/Python/2.7/site-packages/fig/project.py", line 64, in from_config service['name'] = service_name TypeError: 'str' object does not support item assignment ``` I tried removing everything from the fig.yml shy of the image entry, and the same error occurs regardless. Any help would be greatly appreciated.
Everything in your `fig.yml` needs to be inside a service. So if, for example, your main service is a web app, it should look like this: ``` web: image: stackbrew/ubuntu ports: - 3306:3306 - 6379:6379 links: - mysql - redis mysql: image: orchardup/mysql redis: image: orchardup/redis ``` We should throw a better error message here though, so I'm going to leave this open. There I go, not reading the documentation carefully enough. Thank you for a polite response and for taking the effort to improve the error messages. No worries – thanks for helping debug! Is there any part of the documentation that wasn't clear enough that we could improve?
2014-03-03T16:22:20Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==0.2.2', 'console_scripts', 'fig')() File "/Library/Python/2.7/site-packages/fig/cli/main.py", line 39, in main command.sys_dispatch() File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 26, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 27, in perform_command handler(command_options) File "/Library/Python/2.7/site-packages/fig/cli/main.py", line 287, in up (old, new) = self.project.recreate_containers(service_names=options['SERVICE']) File "/Library/Python/2.7/site-packages/fig/cli/utils.py", line 22, in get x = self._property_cache[f] = f(self) File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 75, in project return Project.from_config(self.project_name, config, self.client) File "/Library/Python/2.7/site-packages/fig/project.py", line 64, in from_config service['name'] = service_name TypeError: 'str' object does not support item assignment
4,627
docker/compose
docker__compose-1374
7e0ab0714fc6d023f2f1c19e8b6cb58cf6eef869
diff --git a/compose/service.py b/compose/service.py --- a/compose/service.py +++ b/compose/service.py @@ -476,6 +476,11 @@ def build(self, no_cache=False): except StreamOutputError as e: raise BuildError(self, unicode(e)) + # Ensure the HTTP connection is not reused for another + # streaming command, as the Docker daemon can sometimes + # complain about it + self.client.close() + image_id = None for event in all_events:
APIError: 500 Server Error on first docker-compose up / build cc @aanand I noticed this when testing the most recent RC (4) Steps to reproduce: 1. Clone https://github.com/nathanleclaire/hubfwd 2. Run `docker-compose up` in the repo Expected behavior: It doesn't blow up Actual behavior: It blows up On the first `up` and the first `up` only, so build smells suspicious. ``` Creating hubfwd_app_1... Building app... Step 0 : FROM golang:1.4.2 ---> 121a93c90463 Step 1 : RUN go get -u github.com/codegangsta/negroni ---> Running in 5e2161a172f9 ---> 623f1c94741b Removing intermediate container 5e2161a172f9 Step 2 : RUN go get -u github.com/gorilla/mux ---> Running in c74924a6c8fd ---> 7923dd360f79 Removing intermediate container c74924a6c8fd Step 3 : RUN go get -u github.com/Sirupsen/logrus ---> Running in 93443d6cf298 ---> 3ae5e3801312 Removing intermediate container 93443d6cf298 Step 4 : RUN mkdir -p /go/src/github.com/nathanleclaire/hubfwd ---> Running in 8deddcbb0f1d ---> 6586dfbe5b2e Removing intermediate container 8deddcbb0f1d Step 5 : WORKDIR /go/src/github.com/nathanleclaire/hubfwd ---> Running in bb42cbdf1032 ---> 0d824f6e8519 Removing intermediate container bb42cbdf1032 Step 6 : COPY . /go/src/github.com/nathanleclaire/hubfwd ---> ad6983d66cf7 Removing intermediate container e16e62829fb7 Step 7 : CMD go build ---> Running in 550e4ab79b39 ---> 15ebeafc0600 Removing intermediate container 550e4ab79b39 Successfully built 15ebeafc0600 Attaching to hubfwd_app_1 Exception in thread Thread-1: Traceback (most recent call last): File "/compose/build/docker-compose/out00-PYZ.pyz/threading", line 810, in __bootstrap_inner File "/compose/build/docker-compose/out00-PYZ.pyz/threading", line 763, in run File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.multiplexer", line 41, in _enqueue_output File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.log_printer", line 59, in _make_log_generator File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.utils", line 77, in split_buffer File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 199, in _multiplexed_response_stream_helper File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 143, in _get_raw_response_socket File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 95, in _raise_for_status APIError: 500 Server Error: Internal Server Error ("http: Hijack is incompatible with use of CloseNotifier") ``` I'm on OSX using a VM created by `docker-machine` in VirtualBox (boot2docker).
Bump on this - I got it with https://github.com/nathanleclaire/laraveldocker as well: (rc4) ``` Attaching to laraveldocker_db_1, laraveldocker_redis_1, laraveldocker_beanstalkd_1, laraveldocker_web_1 Exception in thread Thread-1: Traceback (most recent call last): File "/compose/build/docker-compose/out00-PYZ.pyz/threading", line 810, in __bootstrap_inner File "/compose/build/docker-compose/out00-PYZ.pyz/threading", line 763, in run File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.multiplexer", line 41, in _enqueue_output File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.log_printer", line 59, in _make_log_generator File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.utils", line 77, in split_buffer File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 199, in _multiplexed_response_stream_helper File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 143, in _get_raw_response_socket File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 95, in _raise_for_status APIError: 500 Server Error: Internal Server Error ("http: Hijack is incompatible with use of CloseNotifier") ``` Also getting this after `docker-compose up`: Versions: - docker-compose 1.2.0 (installed by `sudo pip install -U https://github.com/docker/compose/archive/1.2.0.zip`) - Docker version 1.6.0, build 4749651 - Boot2Docker-cli version: v1.6.0 and via virtualbox - OSX Yosemite ``` Exception in thread Thread-1: Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run self.__target(*self.__args, **self.__kwargs) File "/Library/Python/2.7/site-packages/compose/cli/multiplexer.py", line 41, in _enqueue_output for item in generator: File "/Library/Python/2.7/site-packages/compose/cli/log_printer.py", line 59, in _make_log_generator for line in line_generator: File "/Library/Python/2.7/site-packages/compose/cli/utils.py", line 77, in split_buffer for data in reader: File "/Library/Python/2.7/site-packages/docker/client.py", line 225, in _multiplexed_response_stream_helper socket = self._get_raw_response_socket(response) File "/Library/Python/2.7/site-packages/docker/client.py", line 167, in _get_raw_response_socket self._raise_for_status(response) File "/Library/Python/2.7/site-packages/docker/client.py", line 119, in _raise_for_status raise errors.APIError(e, response, explanation=explanation) APIError: 500 Server Error: Internal Server Error ("http: Hijack is incompatible with use of CloseNotifier") Exception in thread Thread-5: Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run self.__target(*self.__args, **self.__kwargs) File "/Library/Python/2.7/site-packages/compose/cli/multiplexer.py", line 41, in _enqueue_output for item in generator: File "/Library/Python/2.7/site-packages/compose/cli/log_printer.py", line 59, in _make_log_generator for line in line_generator: File "/Library/Python/2.7/site-packages/compose/cli/utils.py", line 77, in split_buffer for data in reader: File "/Library/Python/2.7/site-packages/docker/client.py", line 225, in _multiplexed_response_stream_helper socket = self._get_raw_response_socket(response) File "/Library/Python/2.7/site-packages/docker/client.py", line 167, in _get_raw_response_socket self._raise_for_status(response) File "/Library/Python/2.7/site-packages/docker/client.py", line 119, in _raise_for_status raise errors.APIError(e, response, explanation=explanation) APIError: 500 Server Error: Internal Server Error ("http: Hijack is incompatible with use of CloseNotifier") ``` :+1: also experiencing this issue. :+1: Have you figured out the solution already? :+1: For anyone reading, it seems that if I do `docker-compose build` manually and then do a `docker-compose up` everything works fine. That should hopefully serve as a workaround until this gets addressed. I can reproduce. @nathanleclaire's workaround (`docker-compose build` first) does indeed fix it for me. Looking at the `docker inspect` output of a container in both the working and failing case, I can't find anything obvious that's wrong. Very strange. Me too, and running `docker-compose build` and then `docker-compose up` like @nathanleclaire said fixes it Yay, this workaround worked for me too. Experiencing the same issue here, same versions +1, same issue/version, thanks for the workaround! +1, same problem for me Somehow your `up` supports http://golang.org/pkg/net/http/#CloseNotifier and `build` not :) I think problem is in keep-alive, so in one connection you `build` and `attach`. To fix this you need to create new connection, not sure how can we fix it on docker side. https://go-review.googlesource.com/#/c/3821/ +1 @LK4D4: nice find. I wonder if there's a way to force docker-py/requests to create a new connection for attaching. @shin-? It looks like `docker.Client` extends http://docs.python-requests.org/en/latest/api/#request-sessions, so I think we could call `client.close()` and that would force it to re-establish a new connection.
2015-04-29T16:56:45Z
[]
[]
Traceback (most recent call last): File "/compose/build/docker-compose/out00-PYZ.pyz/threading", line 810, in __bootstrap_inner File "/compose/build/docker-compose/out00-PYZ.pyz/threading", line 763, in run File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.multiplexer", line 41, in _enqueue_output File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.log_printer", line 59, in _make_log_generator File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.utils", line 77, in split_buffer File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 199, in _multiplexed_response_stream_helper File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 143, in _get_raw_response_socket File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 95, in _raise_for_status APIError: 500 Server Error: Internal Server Error ("http: Hijack is incompatible with use of CloseNotifier")
4,630
docker/compose
docker__compose-1376
878d90febf822dbf9c38fc23d75fbda908a9cb0f
diff --git a/compose/service.py b/compose/service.py --- a/compose/service.py +++ b/compose/service.py @@ -462,8 +462,10 @@ def _get_container_host_config(self, override_options, one_off=False, intermedia def build(self, no_cache=False): log.info('Building %s...' % self.name) + path = six.binary_type(self.options['build']) + build_output = self.client.build( - self.options['build'], + path=path, tag=self.full_name, stream=True, rm=True,
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 5: ordinal not in range(128) Ubuntu 14.04 x64 ``` shell $ docker --version Docker version 1.6.0, build 4749651 $ docker-compose --version docker-compose 1.2.0 ``` Getting error on `$ sudo docker-compose build` ``` shell $ sudo docker-compose build Building web... Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 119, in build File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 191, in build File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 475, in build File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 300, in build File "/code/build/docker-compose/out00-PYZ.pyz/docker.utils.utils", line 73, in tar File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 284, in walk File "/code/build/docker-compose/out00-PYZ.pyz/posixpath", line 80, in join UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 5: ordinal not in range(128) ``` docker-compose.yml ``` yml web: build: . command: gulp serve ports: - 3001:3001 volumes: - .:/app - /bower_components:./app/bower_components volumes_from: - bower_components ``` Dockerfile ``` shell FROM ubuntu:14.04 ENV NVM_VERSION 0.24.1 ENV NODE_VERSION 0.12.0 ENV NPM_VERSION 2.5.1 RUN wget -qO- https://raw.githubusercontent.com/creationix/nvm/v$NVM_VERSION/install.sh | bash \ && source ~/.bashrc \ && nvm install $NODE_VERSION \ && nvm alias default $NODE_VERSION \ && npm install -g npm@"$NPM_VERSION" gulp bower \ WORKDIR /app CMD tail -f /dev/null ```
NOTE: with`docker-comose -v 1.1.0-rc2` everything works well I can't reproduce, but from the stack trace it looks like something's going wrong when trying to tar your build directory - specifically, when trying to build a path. Do you have a file somewhere with an odd name? I have the same probleme than @itsNikolay. Ubuntu 14.04 x64 ``` $ docker --version Docker version 1.6.0, build 4749651 $ docker-compose --version docker-compose 1.2.0 ``` ``` $ docker-compose build db uses an image, skipping Building web... Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 119, in build File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 191, in build File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 475, in build File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 300, in build File "/code/build/docker-compose/out00-PYZ.pyz/docker.utils.utils", line 73, in tar File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 284, in walk File "/code/build/docker-compose/out00-PYZ.pyz/posixpath", line 80, in join UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 8: ordinal not in range(128) ``` Works with docker-compose 1.1.0. It's would be great to have a better error message to locate a possible file with odd name Having the same issue with docker-compose 1.1.0: $ docker --version Docker version 1.3.1, build 4e9bbfa $ docker-compose --version docker-compose 1.1.0 Even after running docker-compose rm && docker-compose up -d it stalls on `'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128)` Full trace: ``` $ docker-compose up -d Recreating adoveoweb_redisphpsessionhandler_1... Recreating adoveoweb_mailcatcher_1... Creating adoveoweb_phpfiles_1... Traceback (most recent call last): File "<string>", line 3, in <module> File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 445, in up File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.project", line 184, in up File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.service", line 259, in recreate_containers File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.service", line 227, in create_container File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.service", line 453, in _get_container_create_options File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.service", line 636, in merge_environment File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.service", line 670, in env_vars_from_file UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128) ``` UPDATE: Upgraded docker-compose to 1.2.0 and the problem went away UPDATE: Upgraded docker to 1.6.0 and the problem has not yet resurfaced - everything works afaik I can reproduce this bug with a minimal project: ``` $ touch donées.txt $ cat > docker-compose.yml << eof data: build: . eof $ cat > Dockerfile <<eof FROM scratch COPY donées.txt . eof ``` after I have the bug ``` $ docker-compose build Building data... Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 119, in build File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 191, in build File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 475, in build File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 300, in build File "/code/build/docker-compose/out00-PYZ.pyz/docker.utils.utils", line 73, in tar File "/code/build/docker-compose/out00-PYZ.pyz/os", line 284, in walk File "/code/build/docker-compose/out00-PYZ.pyz/posixpath", line 80, in join UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128) ``` If I rename the file `donées.txt` as `data.txt` it's work. Looks like a codepage / conversion thing; http://stackoverflow.com/questions/24475393/unicodedecodeerror-ascii-codec-cant-decode-byte-0xc3-in-position-23-ordinal I can't even run `docker build` when there's a file with that name (Mac OS X 10.10.3). When I run @oalbiez's commands: ``` $ docker build Sending build context to Docker daemon 4.608 kB Sending build context to Docker daemon Step 0 : FROM scratch ---> Step 1 : COPY donées.txt . INFO[0000] donées.txt: no such file or directory ``` `docker-compose build` gives me the same error, unsurprisingly. That output looks like utf-8 treated as non-UTF8 yes. I have the same problem with compose 1.2 but not 1.1, Ubuntu 15.04, Docker 1.6.0. Even a compose yml with one service to build with a Dockerfile with one line did not work but "docker build ." has no problem. Getting conflicting reports about what versions of Compose it does and doesn't work with. @itsNikolay, @motin, @madaray: 1. Could you try @oalbiez's minimal failing case with both Compose 1.1 and 1.2? 2. If you can't reproduce the error with that, can you reduce your failing case to a minimal one? I recommend passing `--no-cache` to both `docker build` and `docker-compose build`, just to be sure we don't get any false negatives. I tracked this down to our "apple-­touch-­icon-­precomposed.png". After copying apple-­touch-­icon.png it works. Not sure why this doesn't happen with 1.1.0. UPDATE: The name was corrupted somehow: apple-\302\255touch-\302\255icon-\302\255precomposed.png @aanand, I am having the same issue with 1.2.0, but not 1.1.0 (Ubuntu 14.04 with kernel version 3.16.0-30-generic). The traceback information are exactly the same as @itsNikolay 's. ``` Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 464, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 208, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 214, in recreate_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 187, in create_container File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 475, in build File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 300, in build File "/code/build/docker-compose/out00-PYZ.pyz/docker.utils.utils", line 73, in tar File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 284, in walk File "/code/build/docker-compose/out00-PYZ.pyz/posixpath", line 80, in join UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 39: ordinal not in range(128) ``` My Dockerfile and docker-compose.yml are pretty simple. I am trying to run a simple node application talk with redis database to keep the session. ``` FROM node:0.10-onbuild MAINTAINER YIRAN Mao <[email protected]> RUN mkdir -p /usr/src/app WORKDIR /usr/src/app EXPOSE 3000 EXPOSE 3001 ``` ``` redis: image: redis:2.8.19 command: redis-server --appendonly yes volumes: - /data/:/data/ ports: - "6379:6379" keystone: build: . command: node app.js ports: - "5000:3000" - "5001:3001" volumes: - ./:/usr/src/app ``` @yeelan0319 I think you're leaving out important details here. Could you paste your `package.json`, for a start? @aanand Glad to hear that may help. My application is just a keystone sample application which you can get it easily at [keystonejs.com](keystonejs.com). And here is the package.json: ``` { "name": "keystonejs", "version": "0.0.0", "private": true, "dependencies": { "async": "~0.9.0", "cloudinary": "^1.0.12", "connect-redis": "^2.2.0", "dotenv": "~0.4.0", "express-handlebars": "~1.1.0", "handlebars": "~2.0.0", "i18n": "^0.5.0", "keystone": "~0.3.0", "moment": "~2.8.1", "node-sass": "~1.0.1", "node-sass-middleware": "^0.4.0", "underscore": "~1.7.0" }, "devDependencies": { "gulp": "~3.7.0", "gulp-jshint": "~1.9.0", "jshint-stylish": "~0.1.3", "gulp-watch": "~0.6.5" }, "engines": { "node": ">=0.10.22", "npm": ">=1.3.14" }, "scripts": { "start": "node keystone.js" }, "main": "keystone.js" } ```
2015-04-30T10:58:59Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 119, in build File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 191, in build File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 475, in build File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 300, in build File "/code/build/docker-compose/out00-PYZ.pyz/docker.utils.utils", line 73, in tar File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 294, in walk File "/code/build/docker-compose/out00-PYZ.pyz/os", line 284, in walk File "/code/build/docker-compose/out00-PYZ.pyz/posixpath", line 80, in join UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 5: ordinal not in range(128)
4,631
docker/compose
docker__compose-140
71533791dd31d0e4b511d07ee547497b97cc990d
diff --git a/fig/container.py b/fig/container.py --- a/fig/container.py +++ b/fig/container.py @@ -86,7 +86,10 @@ def human_readable_state(self): @property def human_readable_command(self): self.inspect_if_not_inspected() - return ' '.join(self.dictionary['Config']['Cmd']) + if self.dictionary['Config']['Cmd']: + return ' '.join(self.dictionary['Config']['Cmd']) + else: + return '' @property def environment(self):
Container List Fails I have a basic fig file with: ``` redis: image: dockerfile/redis ports: - "6379:6379" ``` and starting fig with `fig up -d` succeeds, however trying to list processes running throws the following error: ``` vagrant@docker:~$ fig ps Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==0.3.0', 'console_scripts', 'fig')() File "/usr/local/lib/python2.7/dist-packages/fig/cli/main.py", line 39, in main command.sys_dispatch() File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/lib/python2.7/dist-packages/fig/cli/command.py", line 30, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/lib/python2.7/dist-packages/fig/cli/command.py", line 47, in perform_command return super(Command, self).perform_command(options, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 27, in perform_command handler(command_options) File "/usr/local/lib/python2.7/dist-packages/fig/cli/main.py", line 158, in ps command = container.human_readable_command File "/usr/local/lib/python2.7/dist-packages/fig/container.py", line 89, in human_readable_command return ' '.join(self.dictionary['Config']['Cmd']) TypeError ```
Ahah – this is a Docker 0.8.1 thing, where `['Config']['Cmd']` might return `None`. I'll get this fixed for you.
2014-03-04T11:36:30Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==0.3.0', 'console_scripts', 'fig')()
4,634
docker/compose
docker__compose-1642
db7e5124f312422b75f9ef537fc16987c729ef7d
diff --git a/compose/project.py b/compose/project.py --- a/compose/project.py +++ b/compose/project.py @@ -226,6 +226,9 @@ def up(self, services = self.get_services(service_names, include_deps=start_deps) + for service in services: + service.remove_duplicate_containers() + plans = self._get_convergence_plans( services, allow_recreate=allow_recreate, diff --git a/compose/service.py b/compose/service.py --- a/compose/service.py +++ b/compose/service.py @@ -378,6 +378,26 @@ def start_container(self, container): container.start() return container + def remove_duplicate_containers(self, timeout=DEFAULT_TIMEOUT): + for c in self.duplicate_containers(): + log.info('Removing %s...' % c.name) + c.stop(timeout=timeout) + c.remove() + + def duplicate_containers(self): + containers = sorted( + self.containers(stopped=True), + key=lambda c: c.get('Created'), + ) + + numbers = set() + + for c in containers: + if c.number in numbers: + yield c + else: + numbers.add(c.number) + def config_hash(self): return json_hash(self.config_dict())
Duplicate container is left over when recreate fails This is related to #1045. After hitting the issue mentioned in #1045, subsequent `docker-compose up` fails with: ``` $ sudo docker-compose up -d Recreating foo_bar_1... Traceback (most recent call last): ... requests.exceptions.ReadTimeout: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60) $ sudo DOCKER_CLIENT_TIMEOUT=300 docker-compose up Recreating foo_bar_1... Recreating 9c1b31a841_foo_bar_1... Conflict. The name "foo_bar_1" is already in use by container 4af37fe03b76. You have to delete (or rename) that container to be able to reuse that name. ```
I also see a lot of these. I'm not sure if those are caused by #1045 Ubuntu 15.04; Docker 1.7 Looks related to #1349 - Compose has somehow gotten into a situation where there are two containers with the suffix `_1`, one of which has been renamed but then failed to recreate (perhaps because there was an HTTP timeout). I think after the failure, `9c1b31a841_foo_bar_1` still has the correct labels, so it's still considered an instance of the service. So there are two instances with the id of 1. compose would need to only recreate once per instance id. In many ways this is related to #1516. OK yeah, looks like this happens if we successfully create the new container but fail to start it. I can reproduce by sticking a `sys.exit()` in `recreate_container`: ``` python new_container = self.create_container(...) sys.exit(1) self.start_container(new_container) ``` This results in a renamed old container, plus an unstarted new container, both with `container-number=1`. > In many ways this is related to #1516. Random container numbers would solve the immediate error, yeah, but we'd still be left with two containers where we only wanted one. > I also see a lot of these. > > Ubuntu 15.04; Docker 1.7 Same combination, same problem. I also doubt it's #1045 I could get back to work by coming back to Docker 1.4.1 and docker-compose 1.2.0. This bug seems to show up if there is an exception (e.g. with #1045) or if you Ctrl+C in the middle of a `docker-compose up`. Essentially, docker-compose fails to clean up the temporary containers. Which version can I downgrade to so that I can get around this issue? @iMerica Run `docker-compose rm -f` to clear everything out, then downgrade to 1.2.0.
2015-07-03T09:47:08Z
[]
[]
Traceback (most recent call last): ... requests.exceptions.ReadTimeout: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
4,651
docker/compose
docker__compose-1658
e9da790f760c8998412f1a44e99df47a71aa1719
diff --git a/compose/service.py b/compose/service.py --- a/compose/service.py +++ b/compose/service.py @@ -65,6 +65,10 @@ def __init__(self, service): self.service = service +class NoSuchImageError(Exception): + pass + + VolumeSpec = namedtuple('VolumeSpec', 'external internal mode') @@ -225,8 +229,11 @@ def ensure_image_exists(self, do_build=True, insecure_registry=False): - if self.image(): + try: + self.image() return + except NoSuchImageError: + pass if self.can_be_built(): if do_build: @@ -241,7 +248,7 @@ def image(self): return self.client.inspect_image(self.image_name) except APIError as e: if e.response.status_code == 404 and e.explanation and 'No such image' in str(e.explanation): - return None + raise NoSuchImageError("Image '{}' not found".format(self.image_name)) else: raise @@ -275,7 +282,17 @@ def convergence_plan(self, return ConvergencePlan('recreate', containers) def _containers_have_diverged(self, containers): - config_hash = self.config_hash() + config_hash = None + + try: + config_hash = self.config_hash() + except NoSuchImageError as e: + log.debug( + 'Service %s has diverged: %s', + self.name, six.text_type(e), + ) + return True + has_diverged = False for c in containers:
x-smart-recreate crashes when modified image name/tag Just got this error with docker-compose 1.3.0rc2 : ``` $ docker-compose up --x-smart-recreate Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 469, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 221, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 261, in _get_convergence_plans File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 285, in convergence_plan File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 299, in _containers_have_diverged File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 415, in config_hash File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 420, in config_dict TypeError: 'NoneType' object has no attribute '__getitem__' ``` Resolved after `docker-compose pull`
Can you provide more information please? What sequence of commands did you type? What does your YAML look like? Does the problem only occur if you use `--x-smart-recreate`? Simple case (tested with 1.4.0dev) : ``` $ mkdir demo $ cd demo $ cat <<EOF > docker-compose.yml example: image: debian:latest command: echo "hello world" EOF $ docker-compose up -d --x-smart-recreate Pulling example (debian:latest)... latest: Pulling from debian 64e5325c0d9d: Pull complete bf84c1d84a8f: Already exists debian:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security. Digest: sha256:2613dd69166e1bcc0a3e4b1f7cfe30d3dfde7762aea0e2f467632bda681d9765 Status: Downloaded newer image for debian:latest Creating demo_example_1... ``` => OK ``` $ cat <<EOF > docker-compose.yml example: image: debian:8.1 command: echo "hello world" EOF $ docker-compose up -d --x-smart-recreate Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.4.0.dev0', 'console_scripts', 'docker-compose')() File "/Users/joseph/git-workplace/contrib/compose/compose/cli/main.py", line 33, in main command.sys_dispatch() File "/Users/joseph/git-workplace/contrib/compose/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/Users/joseph/git-workplace/contrib/compose/compose/cli/command.py", line 34, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/Users/joseph/git-workplace/contrib/compose/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/Users/joseph/git-workplace/contrib/compose/compose/cli/command.py", line 66, in perform_command handler(project, command_options) File "/Users/joseph/git-workplace/contrib/compose/compose/cli/main.py", line 465, in up timeout=timeout File "/Users/joseph/git-workplace/contrib/compose/compose/project.py", line 232, in up smart_recreate=smart_recreate, File "/Users/joseph/git-workplace/contrib/compose/compose/project.py", line 273, in _get_convergence_plans smart_recreate=smart_recreate, File "/Users/joseph/git-workplace/contrib/compose/compose/service.py", line 264, in convergence_plan if smart_recreate and not self._containers_have_diverged(containers): File "/Users/joseph/git-workplace/contrib/compose/compose/service.py", line 278, in _containers_have_diverged config_hash = self.config_hash() File "/Users/joseph/git-workplace/contrib/compose/compose/service.py", line 382, in config_hash return json_hash(self.config_dict()) File "/Users/joseph/git-workplace/contrib/compose/compose/service.py", line 387, in config_dict 'image_id': self.image()['Id'], TypeError: 'NoneType' object has no attribute '__getitem__' ``` => FAILED with a new image tag ``` $ docker pull debian:8.1 8.1: Pulling from debian 64e5325c0d9d: Already exists bf84c1d84a8f: Already exists debian:8.1: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security. Digest: sha256:44241b371e469ff74cd6b401231bfef80832108b5ee0e6bb7a2ac26a70326dd5 Status: Downloaded newer image for debian:8.1 $ docker-compose up -d --x-smart-recreate Recreating demo_example_1... ``` => OK after pulling with Docker cli ``` $ cat <<EOF > docker-compose.yml example: image: alpine:3.1 command: echo "hello world" EOF $ docker-compose up -d --x-smart-recreate Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.4.0.dev0', 'console_scripts', 'docker-compose')() File "/Users/joseph/git-workplace/contrib/compose/compose/cli/main.py", line 33, in main command.sys_dispatch() File "/Users/joseph/git-workplace/contrib/compose/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/Users/joseph/git-workplace/contrib/compose/compose/cli/command.py", line 34, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/Users/joseph/git-workplace/contrib/compose/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/Users/joseph/git-workplace/contrib/compose/compose/cli/command.py", line 66, in perform_command handler(project, command_options) File "/Users/joseph/git-workplace/contrib/compose/compose/cli/main.py", line 465, in up timeout=timeout File "/Users/joseph/git-workplace/contrib/compose/compose/project.py", line 232, in up smart_recreate=smart_recreate, File "/Users/joseph/git-workplace/contrib/compose/compose/project.py", line 273, in _get_convergence_plans smart_recreate=smart_recreate, File "/Users/joseph/git-workplace/contrib/compose/compose/service.py", line 264, in convergence_plan if smart_recreate and not self._containers_have_diverged(containers): File "/Users/joseph/git-workplace/contrib/compose/compose/service.py", line 278, in _containers_have_diverged config_hash = self.config_hash() File "/Users/joseph/git-workplace/contrib/compose/compose/service.py", line 382, in config_hash return json_hash(self.config_dict()) File "/Users/joseph/git-workplace/contrib/compose/compose/service.py", line 387, in config_dict 'image_id': self.image()['Id'], TypeError: 'NoneType' object has no attribute '__getitem__' ``` => FAILED with a new image name ``` $ docker pull alpine:3.1 3.1: Pulling from alpine 878b6301beda: Already exists alpine:3.1: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security. Digest: sha256:5083b4c32bc726ff6f074e5513615ec0befcc9a69224c3be9261513cabe2cf6e Status: Downloaded newer image for alpine:3.1 $ docker-compose up -d --x-smart-recreate Recreating demo_example_1... ``` => OK after pulling with Docker cli The bug appears when changing the tag or the name of the image.
2015-07-06T14:34:04Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 469, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 221, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 261, in _get_convergence_plans File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 285, in convergence_plan File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 299, in _containers_have_diverged File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 415, in config_hash File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 420, in config_dict TypeError: 'NoneType' object has no attribute '__getitem__'
4,656
docker/compose
docker__compose-166
a3374ac51d7a83d09ac83980264ffdd6e68d6e7e
diff --git a/fig/cli/log_printer.py b/fig/cli/log_printer.py --- a/fig/cli/log_printer.py +++ b/fig/cli/log_printer.py @@ -18,7 +18,7 @@ def __init__(self, containers, attach_params=None): def run(self): mux = Multiplexer(self.generators) for line in mux.loop(): - sys.stdout.write(line) + sys.stdout.write(line.encode(sys.__stdout__.encoding or 'utf8')) def _make_log_generators(self): color_fns = cycle(colors.rainbow()) diff --git a/fig/cli/socketclient.py b/fig/cli/socketclient.py --- a/fig/cli/socketclient.py +++ b/fig/cli/socketclient.py @@ -81,7 +81,7 @@ def recv(self, socket, stream): chunk = socket.recv(4096) if chunk: - stream.write(chunk) + stream.write(chunk.encode(stream.encoding or 'utf8')) stream.flush() else: break diff --git a/fig/service.py b/fig/service.py --- a/fig/service.py +++ b/fig/service.py @@ -295,7 +295,7 @@ def build(self): match = re.search(r'Successfully built ([0-9a-f]+)', line) if match: image_id = match.group(1) - sys.stdout.write(line) + sys.stdout.write(line.encode(sys.__stdout__.encoding or 'utf8')) if image_id is None: raise BuildError()
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 66: ordinal not in range(128) I sporadically get the following error while building a container with PHP 5: ``` db uses an image, skipping Building web... Step 1 : FROM doos/base ---> e12d62b19d01 Step 2 : RUN add-apt-repository ppa:ondrej/php5 ---> Running in f79de09aa4e8 Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.cCNHEbGwpL --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80/ --recv 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com gpg: Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==0.2.2', 'console_scripts', 'fig')() File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/main.py", line 39, in main command.sys_dispatch() File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/command.py", line 26, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 27, in perform_command handler(command_options) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/main.py", line 103, in build self.project.build(service_names=options['SERVICE']) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/project.py", line 128, in build service.build(**options) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/service.py", line 284, in build sys.stdout.write(line) UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 66: ordinal not in range(128) ``` Here are my Dockerfiles and Fig file: http://pastebin.com/raw.php?i=ghJ32AcD I'm on Mavericks 10.9.2 using VirtualBox 4.3.6, Vagrant 1.4.3, docker-osx & docker 0.8.0, and fig 0.2.2. Any idea what might cause this?
2014-03-25T13:43:42Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==0.2.2', 'console_scripts', 'fig')() File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/main.py", line 39, in main command.sys_dispatch() File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/command.py", line 26, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 27, in perform_command handler(command_options) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/main.py", line 103, in build self.project.build(service_names=options['SERVICE']) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/project.py", line 128, in build service.build(**options) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/service.py", line 284, in build sys.stdout.write(line) UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 66: ordinal not in range(128)
4,657
docker/compose
docker__compose-1705
5a462305552de3272d9b54f25644f1e1de39f174
diff --git a/compose/legacy.py b/compose/legacy.py --- a/compose/legacy.py +++ b/compose/legacy.py @@ -149,7 +149,7 @@ def _get_legacy_containers_iter( for service in services: for container in containers: - if LABEL_VERSION in container['Labels']: + if LABEL_VERSION in (container.get('Labels') or {}): continue name = get_container_name(container)
_get_legacy_containers_iter() TypeError: argument of type 'NoneType' is not iterable I just upgraded from 1.1.0 to 1.3.2, and after dealing with the /tmp directory being mounted as noexec (issue #1339), I ran into another issue that I couldn't find in the backlog; ``` $ docker-compose up -d Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 32, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 471, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 230, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 398, in remove_duplicate_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 405, in duplicate_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 112, in containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.legacy", line 56, in check_for_legacy_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.legacy", line 138, in get_legacy_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.legacy", line 152, in _get_legacy_containers_iter TypeError: argument of type 'NoneType' is not iterable ``` Downgrading to 1.3.1 seems to alleviate this behavior.
Which docker version are you using? In docker 1.6 "no labels" is an empty mapping, but this errors seems like it's returning `null` instead of the empty mapping. My docker version: ``` Docker version 1.6.2, build 7c8fca2 ``` I suspect this pull is related: #1643 Can confirm the same behaviour - `Docker version 1.6.2, build 7c8fca2`. Upgraded from docker-compose 1.1.0 to 1.3.2 via `pip install -U docker-compose` and I get the following result from `docker-compose migrate-to-labels`: ``` Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.3.2', 'console_scripts', 'docker-compose')() File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 32, in main command.sys_dispatch() File "/usr/local/lib/python2.7/dist-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 34, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 66, in perform_command handler(project, command_options) File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 515, in migrate_to_labels legacy.migrate_project_to_labels(project) File "/usr/local/lib/python2.7/dist-packages/compose/legacy.py", line 121, in migrate_project_to_labels one_off=False, File "/usr/local/lib/python2.7/dist-packages/compose/legacy.py", line 138, in get_legacy_containers one_off=one_off, File "/usr/local/lib/python2.7/dist-packages/compose/legacy.py", line 152, in _get_legacy_containers_iter if LABEL_VERSION in container['Labels']: TypeError: argument of type 'NoneType' is not iterable ``` Suggest simply prefixing the erroneous conditional on the last frame of that stacktrace (compose/legacy.py:152) with `container['Labels'] and`. If I get a chance later today I'll submit a PR myself, but I'm happy for someone to beat me to the punch! Seeing this with `Docker version 1.7.0, build 0baf609`, so it's not just a docker-1.6 issue. Can also confirm this same behavior with `Docker version 1.7.0, build 0baf609` and `Docker version 1.6.1, build 97cd073` with `docker-compose version: 1.3.2`. After reverting back to `docker-compose version: 1.2.0`, I no longer see the issue. I think the easy fix is to change `container['Labels']` to `container.get('Labels', {})`, but I'm still not sure how this is happening, since it seems like the default empty value should always be the empty mapping `{}` not None. Maybe this behaviour differs based on the version of docker that was used to create the container? Do you happen to know if the old containers were created with a version of docker < 1.6 ? A paste of the `docker inspect <container name>` for one of the old containers would be really helpful for debugging this. I'm seeing this and I think had a set of container that I upgraded to labels with the `docker-compose migrate-to-labels` command.
2015-07-15T16:14:53Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 32, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 471, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 230, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 398, in remove_duplicate_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 405, in duplicate_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 112, in containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.legacy", line 56, in check_for_legacy_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.legacy", line 138, in get_legacy_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.legacy", line 152, in _get_legacy_containers_iter TypeError: argument of type 'NoneType' is not iterable
4,660
docker/compose
docker__compose-1835
6cb8e512f211696d6c1ba5482606d791eaf302a3
diff --git a/compose/container.py b/compose/container.py --- a/compose/container.py +++ b/compose/container.py @@ -22,10 +22,14 @@ def from_ps(cls, client, dictionary, **kwargs): """ Construct a container object from the output of GET /containers/json. """ + name = get_container_name(dictionary) + if name is None: + return None + new_dictionary = { 'Id': dictionary['Id'], 'Image': dictionary['Image'], - 'Name': '/' + get_container_name(dictionary), + 'Name': '/' + name, } return cls(client, new_dictionary, **kwargs) diff --git a/compose/project.py b/compose/project.py --- a/compose/project.py +++ b/compose/project.py @@ -310,11 +310,11 @@ def containers(self, service_names=None, stopped=False, one_off=False): else: service_names = self.service_names - containers = [ + containers = filter(None, [ Container.from_ps(self.client, container) for container in self.client.containers( all=stopped, - filters={'label': self.labels(one_off=one_off)})] + filters={'label': self.labels(one_off=one_off)})]) def matches_service_names(container): return container.labels.get(LABEL_SERVICE) in service_names diff --git a/compose/service.py b/compose/service.py --- a/compose/service.py +++ b/compose/service.py @@ -101,11 +101,11 @@ def __init__(self, name, client=None, project='default', links=None, external_li self.options = options def containers(self, stopped=False, one_off=False): - containers = [ + containers = filter(None, [ Container.from_ps(self.client, container) for container in self.client.containers( all=stopped, - filters={'label': self.labels(one_off=one_off)})] + filters={'label': self.labels(one_off=one_off)})]) if not containers: check_for_legacy_containers( @@ -494,12 +494,13 @@ def get_container_name(self, number, one_off=False): # TODO: this would benefit from github.com/docker/docker/pull/11943 # to remove the need to inspect every container def _next_container_number(self, one_off=False): - numbers = [ - Container.from_ps(self.client, container).number + containers = filter(None, [ + Container.from_ps(self.client, container) for container in self.client.containers( all=True, filters={'label': self.labels(one_off=one_off)}) - ] + ]) + numbers = [c.number for c in containers] return 1 if not numbers else max(numbers) + 1 def _get_links(self, link_to_self):
TypeError: coercing to Unicode: need string or buffer, NoneType found The first time I do `docker-compose up -d` everything works The second time I get the following error ``` Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 460, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 221, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 261, in _get_convergence_plans File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 278, in convergence_plan File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 101, in containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.container", line 28, in from_ps TypeError: coercing to Unicode: need string or buffer, NoneType found ``` ``` docker-compose --version docker-compose version: 1.3.1 CPython version: 2.7.9 OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013 ``` ``` docker info Containers: 8 Images: 98 Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs Dirs: 114 Dirperm1 Supported: false Execution Driver: native-0.2 Logging Driver: json-file Kernel Version: 3.13.0-53-generic Operating System: Ubuntu 14.04.2 LTS CPUs: 1 Total Memory: 992.5 MiB Name: ip-10-0-11-99 ID: 3RM6:3ZR5:FK7P:N6TM:CE35:2VFA:BUJ7:UDBR:IUDR:OSB7:7BP2:TEHS WARNING: No swap limit support ```
@sstarcher try downgrading to docker-compose v1.2.0 I've been having a similar issue with a php-fpm container. The root cause is the "affinity:container" ENV variable that is being added when docker-compose **recreates** containers. See https://github.com/docker/compose/issues/1598 for details. +1 @sstarcher @devinrsmith I can't reproduce. Could you paste your `docker-compose.yml`? Was it previously working with Compose 1.2 or is this your first time running it? @aanand I'll get you an example tomorrow. It happened on several of our servers with different docker compose files. It was previously working on 1.2. Broke on 1.3. Downgraded to 1.2, back and working. We see the same error from docker-compose 1.3.1 and docker 1.7.0 using AUFS. It's working for me, but exactly the same setup isn't working for my Greek colleague who gets the same error as in the issue. Downgrading to docker-compose 1.2.0 is one solution, but is there a better solution? I have the same issue. However, when I use `docker-compose migrate-to-labels`, the containers are created and started correctly. When I removed some old (dead and exited) containers, `docker-compose up -d` is working again. [Identical Issue here too](https://gist.github.com/bb1daba5966d2958fdc1) I _might_ try to fix this tomorrow and submit a pull request (_unless someone is already on it!_) Same issue here, I was able to fix it by removing some dead containers, everything is going well again. b368272 at least tries to fix this; I'm not sure how `get_container_name()` should change for a "Dead" container though. docker-compose 1.3.1 docker 1.7.0 docker-compose.yml ``` { "image1": { "image": "ubuntu", "volumes": [ "/:/logstashforwarder:ro" ], "command": "sleep 10000" }, "image2": { "image": "ubuntu", "command": "sleep 10000", "volumes": [ "/:/hostfs:ro" ] } } ``` Run the following twice docker-compose up -d ``` Recreating opt_image2_1... Cannot destroy container 982a0d62eab102811a5a697a3df2de46fad5c7acd34a9bb5bea44e98d47fb1ee: Driver aufs failed to remove root filesystem 982a0d62eab102811a5a697a3df2de46fad5c7acd34a9bb5bea44e98d47fb1ee: rename /var/lib/docker/aufs/mnt/982a0d62eab102811a5a697a3df2de46fad5c7acd34a9bb5bea44e98d47fb1ee /var/lib/docker/aufs/mnt/982a0d62eab102811a5a697a3df2de46fad5c7acd34a9bb5bea44e98d47fb1ee-removing: device or resource busy ``` Afterwards if you try docker-compose rm you will get ``` docker-compose rm Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 247, in rm File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 281, in containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.container", line 28, in from_ps TypeError: coercing to Unicode: need string or buffer, NoneType found ``` FWIW, confirmed with 1.3.3, rolling back to 1.2.0 indeed fixes the issue. @prologic Can you paste the JSON of a "Dead" container? I can't reproduce one locally. I'm also not sure what we should do if we can't determine a container's name. I get this error (1.3.3) when doing `compose run --rm run bash`. I have a service called `run`. Changing the service name works (e.g. `runa`). This had been working (I think 1.3.0 was the last version I had - it was 1.3.something) up until now that I have 1.3.3. I can confirm this: ``` docker-compose up -d Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 32, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 471, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 230, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 398, in remove_duplicate_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 405, in duplicate_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 112, in containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.legacy", line 56, in check_for_legacy_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.legacy", line 138, in get_legacy_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.legacy", line 152, in _get_legacy_containers_iter TypeError: argument of type 'NoneType' is not iterable ``` Docker Compose ``` docker-compose --version docker-compose version: 1.3.2 CPython version: 2.7.9 OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013 ``` Docker ``` docker version Client version: 1.7.1 Client API version: 1.19 Go version (client): go1.4.2 Git commit (client): 786b29d OS/Arch (client): linux/amd64 Server version: 1.7.1 Server API version: 1.19 Go version (server): go1.4.2 Git commit (server): 786b29d OS/Arch (server): linux/amd64 ``` docker-compose.yml ``` wildfly: build: ./sp ports: - "8080:8080" - "9990:9990" - "39331:8787" links: - mysql:db volumes: - ./volumes/remote_deploy:/opt/jboss/wildfly/standalone/deployments - ./volumes/sp_properties:/opt/jboss/wildfly/standalone/sp_properties mysql: image: mysql environment: MYSQL_USER: mysql MYSQL_PASSWORD: mysql MYSQL_DATABASE: test ``` A rollback to 1.2.0 fixed the issue. I think same issue here: ``` # docker-compose logs Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 32, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 158, in logs File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 301, in containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.container", line 28, in from_ps TypeError: coercing to Unicode: need string or buffer, NoneType found # docker-compose --version docker-compose version: 1.3.3 CPython version: 2.7.9 OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013 ``` when `docker-compose up -d <service_name>` in progress (linked service starting) - same issue ``` $ docker-compose ps Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.3.3', 'console_scripts', 'docker-compose')() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 32, in main command.sys_dispatch() File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 34, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 66, in perform_command handler(project, command_options) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 195, in ps project.containers(service_names=options['SERVICE'], stopped=True) + File "/usr/lib/python2.7/site-packages/compose/project.py", line 301, in containers filters={'label': self.labels(one_off=one_off)})] File "/usr/lib/python2.7/site-packages/compose/container.py", line 28, in from_ps 'Name': '/' + get_container_name(dictionary), TypeError: coercing to Unicode: need string or buffer, NoneType found ``` Versions ``` $ sudo docker version Client version: 1.7.1 Client API version: 1.19 Go version (client): go1.4.2 Git commit (client): 786b29d OS/Arch (client): linux/amd64 Server version: 1.7.1 Server API version: 1.19 Go version (server): go1.4.2 Git commit (server): 786b29d OS/Arch (server): linux/amd64 sudo docker-compose --version docker-compose version: 1.3.3 CPython version: 2.7.10 OpenSSL version: OpenSSL 1.0.2d 9 Jul 2015 ``` we are receiving the same error with latest pip release fnigi]# docker-compose -v dockdocker-compose version: 1.4.0rc2 fnigi]# docker -v Docker version 1.6.0, build 4749651 the same with version 1.7.1 and 1.3.3 od docker-compose the same configuration work on an upgraded python env on Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36) seem broken Anyone experiencing this issue: please paste the output of `docker ps -a` immediately after you get the error. in compose/container.py add line `print('get_container_name - container:', container) # debug` in get_container_name function: ``` def get_container_name(container): print('get_container_name - container:', container) # debug if not container.get('Name') and not container.get('Names'): return None # inspect if 'Name' in container: return container['Name'] # ps shortest_name = min(container['Names'], key=lambda n: len(n.split('/'))) return shortest_name.split('/')[-1] ``` When ``` $ sudo docker-compose up -d <service-name> ``` Then Immediately call ``` $ sudo docker-compose ps ``` And result is ``` .... (u'get_container_name - container:', {u'Status': u'Removal In Progress', u'Created': 1438267340, u'Image': u'ib_frontend', u'Labels': {u'com.docker.compose.service': u'frontend', u'com.docker.compose.config-hash': u'e527b462027b756c37e4c631b21f143dac9f1d39c986ee23b4d0e9acef2f62b1', u'com.docker.compose.project': u'ib', u'com.docker.compose.version': u'1.3.3', u'com.docker.compose.oneoff': u'False', u'com.docker.compose.container-number': u'1'}, u'Ports': [], u'Command': u'gulp --debug', u'Names': None, u'Id': u'2b8755775154015d668ef4212d6470f07ad3b83dd01c24e57bd6c2997de69d28'}) Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.3.3', 'console_scripts', 'docker-compose')() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 32, in main command.sys_dispatch() File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 34, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 66, in perform_command handler(project, command_options) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 195, in ps project.containers(service_names=options['SERVICE'], stopped=True) + File "/usr/lib/python2.7/site-packages/compose/project.py", line 301, in containers filters={'label': self.labels(one_off=one_off)})] File "/usr/lib/python2.7/site-packages/compose/container.py", line 28, in from_ps 'Name': '/' + get_container_name(dictionary), TypeError: coercing to Unicode: need string or buffer, NoneType found ``` On this dictionary get_container_name return None and we have TypeError ``` {u'Command': u'gulp --debug', u'Created': 1438267340, u'Id': u'2b8755775154015d668ef4212d6470f07ad3b83dd01c24e57bd6c2997de69d28', u'Image': u'ib_frontend', u'Labels': {u'com.docker.compose.config-hash': u'e527b462027b756c37e4c631b21f143dac9f1d39c986ee23b4d0e9acef2f62b1', u'com.docker.compose.container-number': u'1', u'com.docker.compose.oneoff': u'False', u'com.docker.compose.project': u'ib', u'com.docker.compose.service': u'frontend', u'com.docker.compose.version': u'1.3.3'}, u'Names': None, u'Ports': [], u'Status': u'Removal In Progress'} ``` Names are None After <service-name> started `docker-complse ps` works without any errors. When immediately call of `sudo docker ps` ``` $ sudo docker ps .... waiting about 1-2 seconds and then produced output ... CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4628aaee3ed7 ib_backend "/var/webapps/IB/con About a minute ago Up About a minute 8000/tcp ib_backend_run_1 dc80f79e28da memcached "memcached -m 64" 26 minutes ago Up 26 minutes 11211/tcp ib_memcached_1 546f431ea39d elasticsearch "/var/webapps/IB/con 26 minutes ago Up 26 minutes 9000/tcp, 9300/tcp, 0.0.0.0:9200->9200/tcp ib_elasticsearch_1 b4a5d058d1c0 ib_redis "/usr/bin/redis-serv 26 minutes ago Up 26 minutes 6379/tcp ib_redis_1 27e3541b7778 ib_postgres "/var/webapps/IB/con 26 minutes ago Up 26 minutes 5432/tcp ``` Sorry for my poor English. and another shot of `docker-compose ps` and `docker ps` when `docker-compose up -d` in progress ``` $ sudo docker-compose ps ... (u'get_container_name - container:', {u'Status': u'Removal In Progress', u'Created': 1438280708, u'Image': u'elasticsearch', u'Labels': {u'com.docker.compose.service': u'elasticsearch', u'com.docker.compose.config-hash': u'e83fac7baf70ed5d259c9c73b36224d7df63fc0c979750388ad1205350a5503f', u'com.docker.compose.project': u'ib', u'com.docker.compose.version': u'1.3.3', u'com.docker.compose.oneoff': u'False', u'com.docker.compose.container-number': u'1'}, u'Ports': [], u'Command': u'/var/webapps/IB/containers/elasticsearch_entrypoint.sh elasticsearch -Des.config=/var/webapps/IB/containers/elasticsearch.yml', u'Names': None, u'Id': u'546f431ea39ddff8c3c3c8b798c17a93348013d4c5a17cf46696087533349ff6'}) Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.3.3', 'console_scripts', 'docker-compose')() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 32, in main command.sys_dispatch() File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 34, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 66, in perform_command handler(project, command_options) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 195, in ps project.containers(service_names=options['SERVICE'], stopped=True) + File "/usr/lib/python2.7/site-packages/compose/project.py", line 301, in containers filters={'label': self.labels(one_off=one_off)})] File "/usr/lib/python2.7/site-packages/compose/container.py", line 28, in from_ps 'Name': '/' + get_container_name(dictionary), TypeError: coercing to Unicode: need string or buffer, NoneType found $ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e8a2ea48e3b0 elasticsearch "/var/webapps/IB/con 4 seconds ago Up 1 seconds 9000/tcp, 9300/tcp, 0.0.0.0:9200->9200/tcp ib_elasticsearch_1 d07381a7f001 ib_redis "/usr/bin/redis-serv 19 seconds ago Up 14 seconds 6379/tcp ib_redis_1 e07808b3640e ib_postgres "/var/webapps/IB/con 30 seconds ago Up 27 seconds 5432/tcp ib_postgres_1 dc80f79e28da memcached "memcached -m 64" 33 minutes ago Up 33 minutes 11211/tcp ib_memcached_1 ``` Sorry, I need the output of `docker ps -a` - updated the comment. In your first paste, it looks like you've got a container without a name - the one running the `ib_postgres` image. It looks like the `/containers/json` API endpoint can sometimes return a container JSON blob without a name. That definitely sounds like a Docker bug to me, so let's figure out how to reproduce it. It could be related to renaming containers. Anyone who's experiencing this, please: 1. Clear everything out with `docker-compose kill && docker-compose rm -f` 2. Use `docker-compose --verbose up -d` to start/recreate your containers 3. When you encounter the error, paste the output of the last `docker-compose --verbose up -d` command you ran 4. Also paste the output of `docker ps -a` > 1. Clear everything out with docker-compose kill && docker-compose rm -f @aanand, this issue correspond to container state `Removal in Progress` and when `docker-compose (up|rm|kill)` will be recreate/remove some containers for linking it to another. this patch worked for me: ``` diff diff --git a/compose/cli/docker_client.py b/compose/cli/docker_client.py index 244bcbe..56cf4f8 100644 --- a/compose/cli/docker_client.py +++ b/compose/cli/docker_client.py @@ -4,6 +4,15 @@ import ssl import os +# issue-1593 compose not interesting in 'Removal In Progress' containers +class ComposeDockerClient(Client): + def containers(self, *args, **kwargs): + return list(filter( + lambda i: i['Status'] != 'Removal In Progress', + super(ComposeDockerClient, self).containers(*args, **kwargs), + )) + + def docker_client(): """ Returns a docker-py client configured using environment variables @@ -34,4 +43,6 @@ def docker_client(): ) timeout = int(os.environ.get('DOCKER_CLIENT_TIMEOUT', 60)) - return Client(base_url=base_url, tls=tls_config, version=api_version, timeout=timeout) + return ComposeDockerClient( + base_url=base_url, tls=tls_config, version=api_version, timeout=timeout + ) ``` Sorry for my poor English. PS. may be docker-py must have new filter params to exclude `Removal in Progress` containers ``` Compose version 1.3.2 Docker base_url: http+docker://localunixsocket Docker version: KernelVersion=2.6.32-504.16.2.el6.x86_64, Arch=amd64, ApiVersion=1.18, Version=1.6.2, GitCommit=7c8fca2, Os=linux, GoVersion=go1.4.2 docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=dockerregistry', u'com.docker.compose.service=DockerRegistry', u'com.docker.compose.oneoff=False']}) docker containers -> (list with 0 items) docker containers <- (all=True) docker containers -> (list with 0 items) docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=dockerregistry', u'com.docker.compose.service=DockerRegistryUI', u'com.docker.compose.oneoff=False']}) docker containers -> (list with 0 items) docker containers <- (all=True) docker containers -> (list with 0 items) docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=dockerregistry', u'com.docker.compose.service=DockerRegistry', u'com.docker.compose.oneoff=False']}) docker containers -> (list with 0 items) docker containers <- (all=True) docker containers -> (list with 0 items) docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=dockerregistry', u'com.docker.compose.service=DockerRegistryUI', u'com.docker.compose.oneoff=False']}) docker containers -> (list with 0 items) docker containers <- (all=True) docker containers -> (list with 0 items) docker inspect_image <- ('docker-registry.mitre.org:8443/autobuild/docker_registry:9') docker inspect_image -> {u'Architecture': u'amd64', u'Author': u'Venkat Natarajan <[email protected]>', u'Comment': u'', u'Config': {u'AttachStderr': False, u'AttachStdin': False, u'AttachStdout': False, u'Cmd': None, u'CpuShares': 0, u'Cpuset': u'', u'Domainname': u'', ... docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=dockerregistry', u'com.docker.compose.service=DockerRegistry', u'com.docker.compose.oneoff=False']}) docker containers -> (list with 0 items) docker inspect_image <- ('docker-registry.mitre.org:8443/autobuild/docker_registry:9') docker inspect_image -> {u'Architecture': u'amd64', u'Author': u'Venkat Natarajan <[email protected]>', u'Comment': u'', u'Config': {u'AttachStderr': False, u'AttachStdin': False, u'AttachStdout': False, u'Cmd': None, u'CpuShares': 0, u'Cpuset': u'', u'Domainname': u'', ... Creating dockerregistry_DockerRegistry_1... docker create_container <- (name=u'dockerregistry_DockerRegistry_1', image='docker-registry.mitre.org:8443/autobuild/docker_registry:9', labels={u'com.docker.compose.service': u'DockerRegistry', 'com.docker.compose.config-hash': 'f5d00447e880c7fa0ccc47dde09aad90fb7136e944c2769897980ea46a1af4ed', u'com.docker.compose.project': u'dockerregistry', 'com.docker.compose.version': u'1.3.2', 'mitre.release': '@@RELEASE@@', u'com.docker.compose.oneoff': u'False', 'com.docker.compose.container-number': '1', 'mitre.environment': '@@ENVIRONMENT@@'}, host_config={'Links': [], 'PortBindings': {'443/tcp': [{'HostPort': '8443', 'HostIp': ''}], '5000/tcp': [{'HostPort': '5000', 'HostIp': u'127.0.0.1'}]}, 'Binds': [u'/data/docker_registry/config:/data/docker_registry/config:ro', u'/etc/pki/tls/private/r10a-venkat-docker.key:/etc/ssl/private/ssl-cert-snakeoil.key:rw', u'/data/docker_registry/includes/authnz_ldap.conf:/etc/apache2/conf-available/authnz_ldap.conf:ro', u'/data/docker_registry:/docker_registry:rw', u'/logs/docker_registry:/var/log/apache2:rw', u'/etc/pki/tls/certs/r10a-venkat-docker.crt:/etc/ssl/certs/ssl-cert-snakeoil.pem:rw'], 'RestartPolicy': {u'MaximumRetryCount': 0, u'Name': u'always'}, 'ExtraHosts': [], 'LogConfig': {'Type': u'json-file', 'Config': {}}, 'VolumesFrom': []}, environment={'SETTINGS_FLAVOR': 'dev', 'SEARCH_BACKEND': 'sqlalchemy', 'SQLALCHEMY_INDEX_DATABASE': 'sqlite:////tmp/docker-registry.db', 'DOCKER_REGISTRY_CONFIG': '/data/docker_registry/config/config.yml'}, volumes={u'/data/docker_registry/config': {}, u'/etc/ssl/private/ssl-cert-snakeoil.key': {}, u'/etc/apache2/conf-available/authnz_ldap.conf': {}, u'/docker_registry': {}, u'/var/log/apache2': {}, u'/etc/ssl/certs/ssl-cert-snakeoil.pem': {}}, detach=True, ports=[u'443', u'5000']) docker create_container -> {u'Id': u'd95374a1ead2b98f089c4d5e0e3a6a42fb0702ef267f2edde0b380a81c592c42', u'Warnings': None} docker inspect_container <- (u'd95374a1ead2b98f089c4d5e0e3a6a42fb0702ef267f2edde0b380a81c592c42') docker inspect_container -> {u'AppArmorProfile': u'', u'Args': [u'-c', u'/etc/supervisord.conf'], u'Config': {u'AttachStderr': False, u'AttachStdin': False, u'AttachStdout': False, u'Cmd': None, u'CpuShares': 0, u'Cpuset': u'', u'Domainname': u'', u'Entrypoint': [u'/usr/bin/supervisord', ... docker start <- (u'd95374a1ead2b98f089c4d5e0e3a6a42fb0702ef267f2edde0b380a81c592c42') docker start -> None docker inspect_image <- ('docker-registry.mitre.org:8443/autobuild/docker_registry_ui:9') docker inspect_image -> {u'Architecture': u'amd64', u'Author': u'Venkatesan Natarajan <[email protected]>', u'Comment': u'', u'Config': {u'AttachStderr': False, u'AttachStdin': False, u'AttachStdout': False, u'Cmd': [u'/bin/sh', u'-c', u'$START_SCRIPT'], u'CpuShares': 0, u'Cpuset': u'', u'Domainname': u'', ... docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=dockerregistry', u'com.docker.compose.service=DockerRegistryUI', u'com.docker.compose.oneoff=False']}) docker containers -> (list with 0 items) docker inspect_image <- ('docker-registry.mitre.org:8443/autobuild/docker_registry_ui:9') docker inspect_image -> {u'Architecture': u'amd64', u'Author': u'Venkatesan Natarajan <[email protected]>', u'Comment': u'', u'Config': {u'AttachStderr': False, u'AttachStdin': False, u'AttachStdout': False, u'Cmd': [u'/bin/sh', u'-c', u'$START_SCRIPT'], u'CpuShares': 0, u'Cpuset': u'', u'Domainname': u'', ... docker containers <- (all=False, filters={u'label': [u'com.docker.compose.project=dockerregistry', u'com.docker.compose.service=DockerRegistry', u'com.docker.compose.oneoff=False']}) docker containers -> (list with 1 items) docker inspect_container <- (u'd95374a1ead2b98f089c4d5e0e3a6a42fb0702ef267f2edde0b380a81c592c42') docker inspect_container -> {u'AppArmorProfile': u'', u'Args': [u'-c', u'/etc/supervisord.conf'], u'Config': {u'AttachStderr': False, u'AttachStdin': False, u'AttachStdout': False, u'Cmd': None, u'CpuShares': 0, u'Cpuset': u'', u'Domainname': u'', u'Entrypoint': [u'/usr/bin/supervisord', ... Creating dockerregistry_DockerRegistryUI_1... docker create_container <- (name=u'dockerregistry_DockerRegistryUI_1', image='docker-registry.mitre.org:8443/autobuild/docker_registry_ui:9', labels={u'com.docker.compose.service': u'DockerRegistryUI', 'com.docker.compose.config-hash': '8949aef8e893f2bd04b031dd96801466d7dc22ed2923920769e7201c2c939ca8', u'com.docker.compose.project': u'dockerregistry', 'com.docker.compose.version': u'1.3.2', 'mitre.release': '@@RELEASE@@', u'com.docker.compose.oneoff': u'False', 'com.docker.compose.container-number': '1', 'mitre.environment': '@@ENVIRONMENT@@'}, host_config={'Links': ['dockerregistry_DockerRegistry_1:DockerRegistry_1', 'dockerregistry_DockerRegistry_1:docker-registry.mitre.org', 'dockerregistry_DockerRegistry_1:dockerregistry_DockerRegistry_1'], 'PortBindings': {'443/tcp': [{'HostPort': '444', 'HostIp': ''}]}, 'Binds': [u'/etc/pki/tls/private/r10a-venkat-docker.key:/etc/apache2/docker.key:ro', u'/data/docker_registry_ui/includes/authnz_ldap.conf:/etc/apache2/conf-enabled/authnz_ldap.conf:rw', u'/logs/docker_registry_ui:/var/log/apache2:rw', u'/etc/pki/tls/certs/r10a-venkat-docker.crt:/etc/apache2/docker.crt:ro'], 'RestartPolicy': {u'MaximumRetryCount': 0, u'Name': u'always'}, 'ExtraHosts': [], 'LogConfig': {'Type': u'json-file', 'Config': {}}, 'VolumesFrom': []}, environment={'ENV_DOCKER_REGISTRY_PORT': '8443', 'ENV_DOCKER_REGISTRY_HOST': 'docker-registry.mitre.org', 'ENV_USE_SSL': 'yes'}, volumes={u'/etc/apache2/docker.key': {}, u'/etc/apache2/conf-enabled/authnz_ldap.conf': {}, u'/var/log/apache2': {}, u'/etc/apache2/docker.crt': {}}, detach=True, ports=[u'443']) docker create_container -> {u'Id': u'03373d7eaba13df0c686aa3097ca1602c492d2a0800a5ea97330024464b47c1e', u'Warnings': None} docker inspect_container <- (u'03373d7eaba13df0c686aa3097ca1602c492d2a0800a5ea97330024464b47c1e') docker inspect_container -> {u'AppArmorProfile': u'', u'Args': [u'-c', u'$START_SCRIPT'], u'Config': {u'AttachStderr': False, u'AttachStdin': False, u'AttachStdout': False, u'Cmd': [u'/bin/sh', u'-c', u'$START_SCRIPT'], u'CpuShares': 0, u'Cpuset': u'', u'Domainname': u'', u'Entrypoint': None, ... docker start <- (u'03373d7eaba13df0c686aa3097ca1602c492d2a0800a5ea97330024464b47c1e') docker start -> None docker containers <- (all=False, filters={u'label': [u'com.docker.compose.project=dockerregistry', u'com.docker.compose.service=DockerRegistry', u'com.docker.compose.oneoff=False']}) docker containers -> (list with 1 items) docker containers <- (all=False, filters={u'label': [u'com.docker.compose.project=dockerregistry', u'com.docker.compose.service=DockerRegistryUI', u'com.docker.compose.oneoff=False']}) docker containers -> (list with 1 items) ----------------------------------------------------------- Compose version 1.3.2 Docker base_url: http+docker://localunixsocket Docker version: KernelVersion=2.6.32-504.16.2.el6.x86_64, Arch=amd64, ApiVersion=1.18, Version=1.6.2, GitCommit=7c8fca2, Os=linux, GoVersion =go1.4.2 docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=dockerregistry', u'com.docker.compose.service=DockerRegistr y', u'com.docker.compose.oneoff=False']}) docker containers -> (list with 1 items) Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 32, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 471, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 230, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 398, in remove_duplicate_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 405, in duplicate_containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 106, in containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.container", line 28, in from_ps TypeError: coercing to Unicode: need string or buffer, NoneType found ``` ``` [venkat@r10a-venkat-docker bin]$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ef9075284e6c docker-registry.mitre.org:8443/autobuild/mitre_open_docker_registry_ui:18 "/bin/sh -c $START_S 3 minutes ago Dead 03373d7eaba1 docker-registry.mitre.org:8443/autobuild/docker_registry_ui:9 "/bin/sh -c $START_S 3 minutes ago Exited (137) 2 minutes ago dockerregistry_DockerRegistryUI_1 08ab0eaf1b69 docker-registry.mitre.org:8443/autobuild/mitre_open_docker_registry_ui:18 "/bin/sh -c $START_S 22 minutes ago Dead loving_meitner 9dcfb52a9a1a docker-registry.mitre.org:8443/autobuild/mitre_open_docker_registry_ui:18 "/bin/sh -c $START_S 34 minutes ago Dead angry_fermi 471f00dccbe2 docker-registry.mitre.org:8443/autobuild/docker_registry_ui:9 "/bin/sh -c $START_S 35 minutes ago Dead loving_hodgkin fe121f0792a4 docker-registry.mitre.org:8443/autobuild/docker_registry:9 "/usr/bin/supervisor 35 minutes ago Dead 8d713fdd23ea docker-registry.mitre.org:8443/autobuild/mitre_open_docker_registry_ui:18 "/bin/sh -c $START_S 2 weeks ago Dead angry_darwin f2f298d71e6f docker-registry.mitre.org:8443/autobuild/docker_registry_ui:9 "/bin/sh -c $START_S 2 weeks ago Dead adoring_davinci ``` I've implemented a fix here: https://github.com/aanand/fig/compare/bump-1.4.0...aanand:fix-name-none Please try it out if you've been experiencing this issue: http://cl.ly/0G3c3y0y1k19/docker-compose-Darwin-x86_64 http://cl.ly/0r3J020O2s2C/docker-compose-Linux-x86_64 Works for me call `ps` without fix ``` $ docker-compose ps Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.3.3', 'console_scripts', 'docker-compose')() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 32, in main command.sys_dispatch() File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 34, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 66, in perform_command handler(project, command_options) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 195, in ps project.containers(service_names=options['SERVICE'], stopped=True) + File "/usr/lib/python2.7/site-packages/compose/project.py", line 301, in containers filters={'label': self.labels(one_off=one_off)})] File "/usr/lib/python2.7/site-packages/compose/container.py", line 28, in from_ps 'Name': '/' + get_container_name(dictionary), TypeError: coercing to Unicode: need string or buffer, NoneType found ``` and call `ps` with fix ``` $ /tmp/docker-compose-Linux-x86_64 ps Name Command State Ports ------------------------------------------------------------------------------------------------------------ 64ffb1d005_ib_redis_1 /usr/bin/redis-server Exit 0 ib_backend_1 /var/webapps/IB/containers ... Up 0.0.0.0:8000->8000/tcp ib_celery_1 /var/webapps/IB/containers ... Up ib_elasticsearch_1 /var/webapps/IB/containers ... Up 9000/tcp, 0.0.0.0:9200->9200/tcp, 9300/tcp ib_frontend_1 gulp --debug Up 0.0.0.0:5000->5000/tcp ib_memcached_1 memcached -m 64 Up 11211/tcp ib_postgres_1 /var/webapps/IB/containers ... Up 5432/tcp ib_redis_1 /usr/bin/redis-server Up 6379/tcp ib_ws_1 /var/webapps/IB/containers ... Up 0.0.0.0:8080->8080/tcp ``` When do double call `up -d` without fix ``` $ docker-compose up -d Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.3.3', 'console_scripts', 'docker-compose')() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 32, in main command.sys_dispatch() File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 34, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 66, in perform_command handler(project, command_options) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 471, in up timeout=timeout File "/usr/lib/python2.7/site-packages/compose/project.py", line 230, in up service.remove_duplicate_containers() File "/usr/lib/python2.7/site-packages/compose/service.py", line 398, in remove_duplicate_containers for c in self.duplicate_containers(): File "/usr/lib/python2.7/site-packages/compose/service.py", line 405, in duplicate_containers self.containers(stopped=True), File "/usr/lib/python2.7/site-packages/compose/service.py", line 106, in containers filters={'label': self.labels(one_off=one_off)})] File "/usr/lib/python2.7/site-packages/compose/container.py", line 28, in from_ps 'Name': '/' + get_container_name(dictionary), TypeError: coercing to Unicode: need string or buffer, NoneType found ``` When do double call `up -d` with fix ``` $ /tmp/docker-compose-Linux-x86_64 up -d Removing ib_elasticsearch_1... Removing ib_memcached_1... Cannot destroy container 7cce897e11ad63816286bcf70cdf742f28d006e28d5b6831fd49922a5c690db7: Driver devicemapper failed to remove init filesystem 7cce897e11ad63816286bcf70cdf742f28d006e28d5b6831fd49922a5c690db7-init: Device is Busy ``` Where `double call` is call `docker-compose up -d` at second time util first `up -d` is not done even with the fix, when running a `docker-compose run` having the service being `up` already, returns a weird message: ``` Could not get container for ``` I also noticed that with the patch, my containers no longer carry the name that `docker-compose` lists on the logs when `up`ing it. So when I do `docker-compose ps` and `docker ps` I see the container but the name doesn't show on the second command. May be something with docker itself? I'm running the latest `1.4.1` there @robertoandrade Do you mean 1.7.1? We don't support 1.4.x any more.
2015-08-10T15:28:55Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 460, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 221, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 261, in _get_convergence_plans File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 278, in convergence_plan File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 101, in containers File "/code/build/docker-compose/out00-PYZ.pyz/compose.container", line 28, in from_ps TypeError: coercing to Unicode: need string or buffer, NoneType found
4,671
docker/compose
docker__compose-1859
7d5e26bd37f740944ca2640b23c144ec85dd856e
diff --git a/compose/config/config.py b/compose/config/config.py --- a/compose/config/config.py +++ b/compose/config/config.py @@ -186,8 +186,16 @@ def resolve_extends(self, service_dict): already_seen=other_already_seen, ) + base_service = extends_options['service'] other_config = load_yaml(other_config_path) - other_service_dict = other_config[extends_options['service']] + + if base_service not in other_config: + msg = ( + "Cannot extend service '%s' in %s: Service not found" + ) % (base_service, other_config_path) + raise ConfigurationError(msg) + + other_service_dict = other_config[base_service] other_loader.detect_cycle(extends_options['service']) other_service_dict = other_loader.make_service_dict( service_dict['name'],
Stack trace when trying to extend a nonexistent service ``` yaml web: image: busybox extends: service: foo ``` ``` $ docker-compose up -d Traceback (most recent call last): File "/Users/aanand/.virtualenvs/docker-compose/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.4.0.dev0', 'console_scripts', 'docker-compose')() File "/Users/aanand/work/docker/compose/compose/cli/main.py", line 39, in main command.sys_dispatch() File "/Users/aanand/work/docker/compose/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/Users/aanand/work/docker/compose/compose/cli/command.py", line 27, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/Users/aanand/work/docker/compose/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/Users/aanand/work/docker/compose/compose/cli/command.py", line 57, in perform_command verbose=options.get('--verbose')) File "/Users/aanand/work/docker/compose/compose/cli/command.py", line 78, in get_project config.load(config_details), File "/Users/aanand/work/docker/compose/compose/config/config.py", line 132, in load service_dict = loader.make_service_dict(service_name, service_dict) File "/Users/aanand/work/docker/compose/compose/config/config.py", line 156, in make_service_dict service_dict = self.resolve_extends(service_dict) File "/Users/aanand/work/docker/compose/compose/config/config.py", line 183, in resolve_extends other_service_dict = other_config[extends_options['service']] KeyError: 'foo' ```
2015-08-12T21:36:21Z
[]
[]
Traceback (most recent call last): File "/Users/aanand/.virtualenvs/docker-compose/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.4.0.dev0', 'console_scripts', 'docker-compose')() File "/Users/aanand/work/docker/compose/compose/cli/main.py", line 39, in main command.sys_dispatch() File "/Users/aanand/work/docker/compose/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/Users/aanand/work/docker/compose/compose/cli/command.py", line 27, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/Users/aanand/work/docker/compose/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/Users/aanand/work/docker/compose/compose/cli/command.py", line 57, in perform_command verbose=options.get('--verbose')) File "/Users/aanand/work/docker/compose/compose/cli/command.py", line 78, in get_project config.load(config_details), File "/Users/aanand/work/docker/compose/compose/config/config.py", line 132, in load service_dict = loader.make_service_dict(service_name, service_dict) File "/Users/aanand/work/docker/compose/compose/config/config.py", line 156, in make_service_dict service_dict = self.resolve_extends(service_dict) File "/Users/aanand/work/docker/compose/compose/config/config.py", line 183, in resolve_extends other_service_dict = other_config[extends_options['service']] KeyError: 'foo'
4,672
docker/compose
docker__compose-2018
e9871b084e65001aa3d260fea18263018491568d
diff --git a/compose/utils.py b/compose/utils.py --- a/compose/utils.py +++ b/compose/utils.py @@ -21,7 +21,6 @@ def parallel_execute(objects, obj_callable, msg_index, msg): """ stream = get_output_stream(sys.stdout) lines = [] - errors = {} for obj in objects: write_out_msg(stream, lines, msg_index(obj), msg) @@ -29,16 +28,17 @@ def parallel_execute(objects, obj_callable, msg_index, msg): q = Queue() def inner_execute_function(an_callable, parameter, msg_index): + error = None try: result = an_callable(parameter) except APIError as e: - errors[msg_index] = e.explanation + error = e.explanation result = "error" except Exception as e: - errors[msg_index] = e + error = e result = 'unexpected_exception' - q.put((msg_index, result)) + q.put((msg_index, result, error)) for an_object in objects: t = Thread( @@ -49,15 +49,17 @@ def inner_execute_function(an_callable, parameter, msg_index): t.start() done = 0 + errors = {} total_to_execute = len(objects) while done < total_to_execute: try: - msg_index, result = q.get(timeout=1) + msg_index, result, error = q.get(timeout=1) if result == 'unexpected_exception': - raise errors[msg_index] + errors[msg_index] = result, error if result == 'error': + errors[msg_index] = result, error write_out_msg(stream, lines, msg_index, msg, status='error') else: write_out_msg(stream, lines, msg_index, msg) @@ -65,10 +67,14 @@ def inner_execute_function(an_callable, parameter, msg_index): except Empty: pass - if errors: - stream.write("\n") - for error in errors: - stream.write("ERROR: for {} {} \n".format(error, errors[error])) + if not errors: + return + + stream.write("\n") + for msg_index, (result, error) in errors.items(): + stream.write("ERROR: for {} {} \n".format(msg_index, error)) + if result == 'unexpected_exception': + raise error def get_output_stream(stream):
test_scale_with_api_returns_unexpected_exception fails frequently on jenkins `tests/integration/service_test.py ServiceTest.test_scale_with_api_returns_unexpected_exception` aka `Test that when scaling if the API returns an error, that is not of type` fails in many of our jenkins run - https://jenkins.dockerproject.org/job/Compose-PRs/1213/console with error: ``` Traceback (most recent call last): File "/code/tests/integration/testcases.py", line 22, in tearDown self.client.remove_container(c['Id']) File "/code/.tox/py27/lib/python2.7/site-packages/docker/utils/decorators.py", line 20, in wrapped return f(self, resource_id, *args, **kwargs) File "/code/.tox/py27/lib/python2.7/site-packages/docker/client.py", line 696, in remove_container self._raise_for_status(res) File "/code/.tox/py27/lib/python2.7/site-packages/docker/clientbase.py", line 103, in _raise_for_status raise errors.NotFound(e, response, explanation=explanation) NotFound: 404 Client Error: Not Found ("Cannot destroy container faeacc68496793312980e36e20be6c7ae2a04a9b5f98c12f815a2235963ae834: Driver overlay failed to remove root filesystem faeacc68496793312980e36e20be6c7ae2a04a9b5f98c12f815a2235963ae834: stat /var/lib/docker/overlay/faeacc68496793312980e36e20be6c7ae2a04a9b5f98c12f815a2235963ae834: no such file or directory") ``` This is a docker engine bug, but something about this specific test triggers it frequently. Looking at the test, I can't really tell what it might be. The failure is coming from `tearDown()`. We could wrap this cleanup in a try/except, which would have the added benefit of completing the rest of the cleanup.
Ok, I spent some time looking into this today, and I've made some progress. If I add a `time.sleep(0.1)` [here](https://github.com/docker/compose/blob/1.4.0/tests/integration/testcases.py#L21) between the `kill` and the `rm` it doesn't fail. So it likely has to do with container state. If I inspect the container before the `rm` it's in state created, but the directory for the container does not exist on disk. I'll continue trying to track down the error in the engine, but for now I think our options are either to try/except and skip the remove, or attempt removing the container a couple times with a short sleep between attempts. Ok, so this isn't a daemon bug after-all! It's a problem with how we handle the threads in `parallel_execute()`. When we encounter an error, we're not joining the threads, so some can still be running after the first one hits an exception. In some cases, the `mock.patch()` is removed before the thread runs `create()` so we actually create a container, and when we attempt to remove it, the daemon is still in the process of creating it. There's probably a missing lock in the daemon somewhere (preventing commands from trying to inspect or remove a half-created container), but we can still fix this on the compose side by waiting for the threads to complete before exiting the function.
2015-09-09T18:44:15Z
[]
[]
Traceback (most recent call last): File "/code/tests/integration/testcases.py", line 22, in tearDown self.client.remove_container(c['Id']) File "/code/.tox/py27/lib/python2.7/site-packages/docker/utils/decorators.py", line 20, in wrapped return f(self, resource_id, *args, **kwargs) File "/code/.tox/py27/lib/python2.7/site-packages/docker/client.py", line 696, in remove_container self._raise_for_status(res) File "/code/.tox/py27/lib/python2.7/site-packages/docker/clientbase.py", line 103, in _raise_for_status raise errors.NotFound(e, response, explanation=explanation) NotFound: 404 Client Error: Not Found ("Cannot destroy container faeacc68496793312980e36e20be6c7ae2a04a9b5f98c12f815a2235963ae834: Driver overlay failed to remove root filesystem faeacc68496793312980e36e20be6c7ae2a04a9b5f98c12f815a2235963ae834: stat /var/lib/docker/overlay/faeacc68496793312980e36e20be6c7ae2a04a9b5f98c12f815a2235963ae834: no such file or directory")
4,686
docker/compose
docker__compose-2055
f49fc1867c2d4ea80a1de33cc9531834efc96d03
diff --git a/compose/cli/multiplexer.py b/compose/cli/multiplexer.py --- a/compose/cli/multiplexer.py +++ b/compose/cli/multiplexer.py @@ -2,6 +2,8 @@ from threading import Thread +from six.moves import _thread as thread + try: from Queue import Queue, Empty except ImportError: @@ -38,6 +40,9 @@ def loop(self): yield item except Empty: pass + # See https://github.com/docker/compose/issues/189 + except thread.error: + raise KeyboardInterrupt() def _init_readers(self): for iterator in self.iterators:
Ctrl-C on `docker-compose up` raises thread.error I get this intermittently (sometimes it does shutdown gracefully): ``` ^CGracefully stopping... (press Ctrl+C again to force) Stopping dailylead_db_1... Stopping dailylead_queue_1... Traceback (most recent call last): File "<string>", line 3, in <module> File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.main", line 39, in main File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 21, in sys_dispatch File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.command", line 30, in dispatch File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 24, in dispatch File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.command", line 47, in perform_command File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 27, in perform_command File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.main", line 316, in up File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.log_printer", line 20, in run File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.multiplexer", line 20, in loop File "/Users/ben/fig/build/fig/out00-PYZ.pyz/Queue", line 182, in get thread.error: release unlocked lock ```
me too I've seen this too - perhaps KeyboardInterrupt messes with Queue somehow. Not sure if there's a clean solution - perhaps we should just catch `thread.error` in this loop: https://github.com/orchardup/fig/blob/master/fig/cli/multiplexer.py#L24-L3 On Mon, Jul 21, 2014 at 6:24 AM, Patrick Arminio [email protected] wrote: > me too > > — > Reply to this email directly or view it on GitHub > https://github.com/orchardup/fig/issues/189#issuecomment-49604372. So the combination of threads and signals (SIGINT in this case) doesn't play well together (IIRC, signals are dispatched to one thread and it's non-deterministic which thread that will be). I'm sure this can be fixed, though I may just change how the multiplexer works to use `select()` instead of threads and blocking IO. That _should_ just make this problem just disappear, but we'll see. When you have multiple streams you want to read from, the idiomatic approach is to use `select()` in any case. I should have time to do that this weekend, as this is biting us too. Still seeing this on 0.5.2, is it fixed in mainline? not yet. happens to me too. I'm new to fig. Anyone know how you end up clearing the process it leaves behind. It leaves behind my nodejs process running and with a state of `Exit -1`? Edit: As soon as I asked, I figured it out. `fig rm`. Sorry about that. +1, happening to me as well. Using the passenger image. +1 while using `spotify/cassandra` Same here with 1.0.1 using custom image and mysql. I just hit this. It seems hard to reproduce. I ran it ten times and I didn't hit the "release unlocked lock" bug, but I did hit this: ``` Traceback (most recent call last): File "/code/build/fig/out00-PYZ.pyz/threading", line 552, in __bootstrap_inner File "/code/build/fig/out00-PYZ.pyz/threading", line 505, in run File "/code/build/fig/out00-PYZ.pyz/fig.cli.multiplexer", line 41, in _enqueue_output File "/code/build/fig/out00-PYZ.pyz/fig.cli.log_printer", line 56, in _make_log_generator File "/code/build/fig/out00-PYZ.pyz/fig.cli.utils", line 77, in split_buffer File "/code/build/fig/out00-PYZ.pyz/docker.client", line 332, in _multiplexed_socket_stream_helper File "/code/build/fig/out00-PYZ.pyz/docker.client", line 319, in recvall error: [Errno 4] Interrupted system call ``` In my setup I'm using fig to just run one service. Same here with **1.1.0-rc2**. ``` Traceback (most recent call last): File "<string>", line 3, in <module> File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 455, in up File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.log_printer", line 22, in run File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.multiplexer", line 25, in loop File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/Queue", line 182, in get thread.error: release unlocked lock ``` Yep same here = only seems to happen when I introduced a queuing server (rabbitmq) Definitely seeing it here; for me, it's when I ctrl-c to stop a multi-container app that includes couchdb, and it happens on the stop of the couchdb container. Any news on this? `Multiplexer` still uses threading, so this still happens. If anyone wants to take a crack at refactoring it to use IO streams + `select()` instead of generators + threading, go for it. ``` ^CGracefully stopping... (press Ctrl+C again to force) Stopping blog_phpmyadmin_1... Stopping blog_web_1... Stopping blog_mysql_1... Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 32, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 481, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.log_printer", line 22, in run File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.multiplexer", line 25, in loop File "/code/build/docker-compose/out00-PYZ.pyz/Queue", line 182, in get thread.error: release unlocked lock ``` ``` $ docker-compose -v docker-compose version: 1.3.2 CPython version: 2.7.9 OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013 $ docker -v Docker version 1.7.1, build 786b29d $ docker info Containers: 3 Images: 117 Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs Dirs: 190 Dirperm1 Supported: false Execution Driver: native-0.2 Logging Driver: json-file Kernel Version: 3.13.0-24-generic Operating System: Ubuntu 14.04.2 LTS CPUs: 4 Total Memory: 14.69 GiB Name: desktop ID: MQKY:YIVZ:XCTH:DRAP:QYGC:SLX5:Z3HU:EZSW:E4T5:GYLP:4WMR:RSMI WARNING: No swap limit support ``` +1 :+1: ``` ^CGracefully stopping... (press Ctrl+C again to force) Stopping nginx_registry_1... Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 32, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 481, in up File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.log_printer", line 22, in run File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.multiplexer", line 25, in loop File "/code/build/docker-compose/out00-PYZ.pyz/Queue", line 182, in get thread.error: release unlocked lock ``` It also happen to me. My docker version like following. ``` $ docker-compose -v docker-compose version: 1.3.3 CPython version: 2.7.9 OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013 ``` ``` $ docker -v Docker version 1.8.1, build d12ea79 ``` ``` $ docker info Containers: 78 Images: 360 Storage Driver: devicemapper Pool Name: docker-253:0-134331561-pool Pool Blocksize: 65.54 kB Backing Filesystem: xfs Data file: /dev/loop0 Metadata file: /dev/loop1 Data Space Used: 8.428 GB Data Space Total: 107.4 GB Data Space Available: 38.98 GB Metadata Space Used: 19.23 MB Metadata Space Total: 2.147 GB Metadata Space Available: 2.128 GB Udev Sync Supported: true Deferred Removal Enabled: false Data loop file: /var/lib/docker/devicemapper/devicemapper/data Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata Library Version: 1.02.93-RHEL7 (2015-01-28) Execution Driver: native-0.2 Logging Driver: json-file Kernel Version: 3.10.0-229.11.1.el7.x86_64 Operating System: CentOS Linux 7 (Core) CPUs: 4 Total Memory: 7.585 GiB Name: nexhub06.ndeploy ID: CKJK:WFUB:JXXS:OG7K:U7ST:GUNU:HR3M:2J2A:LWTL:MVCW:PBWP:FXY3 ``` Seeing it here too. Is system info helpful or superfluous? I've been using compose from `pip install` and never once saw this issue. I just recently tried the binary and I get it almost every time I ctrl-c the logs. I think it might have something to do with the version of python we're building against, or pyinstaller itself.
2015-09-16T00:57:48Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.main", line 39, in main File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 21, in sys_dispatch File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.command", line 30, in dispatch File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 24, in dispatch File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.command", line 47, in perform_command File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 27, in perform_command File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.main", line 316, in up File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.log_printer", line 20, in run File "/Users/ben/fig/build/fig/out00-PYZ.pyz/fig.cli.multiplexer", line 20, in loop File "/Users/ben/fig/build/fig/out00-PYZ.pyz/Queue", line 182, in get thread.error: release unlocked lock
4,694
docker/compose
docker__compose-2132
13d5efcd8b646eaf1d2d1f4733737e5b28c0df4c
diff --git a/compose/cli/log_printer.py b/compose/cli/log_printer.py --- a/compose/cli/log_printer.py +++ b/compose/cli/log_printer.py @@ -6,8 +6,8 @@ from . import colors from .multiplexer import Multiplexer -from .utils import split_buffer from compose import utils +from compose.utils import split_buffer class LogPrinter(object): @@ -75,7 +75,7 @@ def build_no_log_generator(container, prefix, color_func): def build_log_generator(container, prefix, color_func): # Attach to container before log printer starts running stream = container.attach(stdout=True, stderr=True, stream=True, logs=True) - line_generator = split_buffer(stream, u'\n') + line_generator = split_buffer(stream) for line in line_generator: yield prefix + line diff --git a/compose/cli/utils.py b/compose/cli/utils.py --- a/compose/cli/utils.py +++ b/compose/cli/utils.py @@ -7,7 +7,6 @@ import ssl import subprocess -import six from docker import version as docker_py_version from six.moves import input @@ -36,31 +35,6 @@ def yesno(prompt, default=None): return None -def split_buffer(reader, separator): - """ - Given a generator which yields strings and a separator string, - joins all input, splits on the separator and yields each chunk. - - Unlike string.split(), each chunk includes the trailing - separator, except for the last one if none was found on the end - of the input. - """ - buffered = six.text_type('') - separator = six.text_type(separator) - - for data in reader: - buffered += data.decode('utf-8') - while True: - index = buffered.find(separator) - if index == -1: - break - yield buffered[:index + 1] - buffered = buffered[index + 1:] - - if len(buffered) > 0: - yield buffered - - def call_silently(*args, **kwargs): """ Like subprocess.call(), but redirects stdout and stderr to /dev/null. diff --git a/compose/container.py b/compose/container.py --- a/compose/container.py +++ b/compose/container.py @@ -212,9 +212,6 @@ def links(self): def attach(self, *args, **kwargs): return self.client.attach(self.id, *args, **kwargs) - def attach_socket(self, **kwargs): - return self.client.attach_socket(self.id, **kwargs) - def __repr__(self): return '<Container: %s (%s)>' % (self.name, self.id[:6]) diff --git a/compose/progress_stream.py b/compose/progress_stream.py --- a/compose/progress_stream.py +++ b/compose/progress_stream.py @@ -1,7 +1,3 @@ -import json - -import six - from compose import utils @@ -16,10 +12,7 @@ def stream_output(output, stream): lines = {} diff = 0 - for chunk in output: - if six.PY3: - chunk = chunk.decode('utf-8') - event = json.loads(chunk) + for event in utils.json_stream(output): all_events.append(event) if 'progress' in event or 'progressDetail' in event: diff --git a/compose/service.py b/compose/service.py --- a/compose/service.py +++ b/compose/service.py @@ -34,6 +34,7 @@ from .utils import json_hash from .utils import parallel_execute + log = logging.getLogger(__name__) diff --git a/compose/utils.py b/compose/utils.py --- a/compose/utils.py +++ b/compose/utils.py @@ -1,6 +1,7 @@ import codecs import hashlib import json +import json.decoder import logging import sys from threading import Thread @@ -13,6 +14,8 @@ log = logging.getLogger(__name__) +json_decoder = json.JSONDecoder() + def parallel_execute(objects, obj_callable, msg_index, msg): """ @@ -83,6 +86,71 @@ def get_output_stream(stream): return codecs.getwriter('utf-8')(stream) +def stream_as_text(stream): + """Given a stream of bytes or text, if any of the items in the stream + are bytes convert them to text. + + This function can be removed once docker-py returns text streams instead + of byte streams. + """ + for data in stream: + if not isinstance(data, six.text_type): + data = data.decode('utf-8') + yield data + + +def line_splitter(buffer, separator=u'\n'): + index = buffer.find(six.text_type(separator)) + if index == -1: + return None, None + return buffer[:index + 1], buffer[index + 1:] + + +def split_buffer(stream, splitter=None, decoder=lambda a: a): + """Given a generator which yields strings and a splitter function, + joins all input, splits on the separator and yields each chunk. + + Unlike string.split(), each chunk includes the trailing + separator, except for the last one if none was found on the end + of the input. + """ + splitter = splitter or line_splitter + buffered = six.text_type('') + + for data in stream_as_text(stream): + buffered += data + while True: + item, rest = splitter(buffered) + if not item: + break + + buffered = rest + yield item + + if buffered: + yield decoder(buffered) + + +def json_splitter(buffer): + """Attempt to parse a json object from a buffer. If there is at least one + object, return it and the rest of the buffer, otherwise return None. + """ + try: + obj, index = json_decoder.raw_decode(buffer) + rest = buffer[json.decoder.WHITESPACE.match(buffer, index).end():] + return obj, rest + except ValueError: + return None, None + + +def json_stream(stream): + """Given a stream of text, return a stream of json objects. + This handles streams which are inconsistently buffered (some entries may + be newline delimited, and others are not). + """ + return split_buffer(stream_as_text(stream), json_splitter, json_decoder.decode) + + def write_out_msg(stream, lines, msg_index, msg, status="done"): """ Using special ANSI code characters we can write out the msg over the top of
docker-compose crashes on build - json data from daemon is not parsed correctly When trying to build my images using docker-compose, it does not work. Using `docker build` does work. This is the command I run. ``` $ docker-compose --verbose build sonar Compose version 1.1.0 Docker base_url: http://192.168.59.103:2375 Docker version: KernelVersion=3.18.5-tinycore64, Arch=amd64, ApiVersion=1.17, Version=1.5.0, GitCommit=a8a31ef, Os=linux, GoVersion=go1.4.1 Building sonar... docker build <- ('sonar', rm=True, tag=u'sonardocker_sonar', nocache=False, stream=True) docker build -> <generator object _stream_helper at 0x10534b190> Step 0 : FROM xxx.xxx:5000/base-java ---> 82af2109b0f0 Step 1 : MAINTAINER Tim Soethout Traceback (most recent call last): File "/usr/local/Cellar/fig/1.1.0/libexec/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.1.0', 'console_scripts', 'docker-compose')() File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/main.py", line 31, in main command.sys_dispatch() File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/command.py", line 27, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/command.py", line 59, in perform_command handler(project, command_options) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/main.py", line 119, in build project.build(service_names=options['SERVICE'], no_cache=no_cache) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/project.py", line 167, in build service.build(no_cache) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/service.py", line 484, in build all_events = stream_output(build_output, sys.stdout) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/progress_stream.py", line 18, in stream_output event = json.loads(chunk) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads return _default_decoder.decode(s) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 368, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 4 column 1 (char 39 - 162) ``` This last line suggest something in the parsing of the daemon response is not working as expected. On the docker daemon side (boot2docker) I have the following logs. It seems that the build works as expected, only docker-compose can't handle the json it gets back from the daemon. ``` time="2015-03-04T19:31:36Z" level="debug" msg="Calling GET /version" time="2015-03-04T19:31:36Z" level="info" msg="GET /v1.14/version" time="2015-03-04T19:31:36Z" level="info" msg="+job version()" time="2015-03-04T19:31:36Z" level="info" msg="-job version() = OK (0)" time="2015-03-04T19:31:36Z" level="debug" msg="Calling POST /build" time="2015-03-04T19:31:36Z" level="info" msg="POST /v1.14/build?pull=True&nocache=False&q=False&t=sonardocker_sonar&forcerm=False&rm=True" time="2015-03-04T19:31:36Z" level="info" msg="+job build()" time="2015-03-04T19:31:36Z" level="debug" msg="[BUILDER] Use cached version" time="2015-03-04T19:31:36Z" level="debug" msg="[BUILDER] Command to be executed: [/bin/sh -c apt-get update && apt-get install procps -y]" time="2015-03-04T19:31:36Z" level="debug" msg="[BUILDER] Use cached version" time="2015-03-04T19:31:36Z" level="debug" msg="[BUILDER] Command to be executed: [/bin/sh -c apt-get update && apt-get install -y --force-yes sonar]" time="2015-03-04T19:31:36Z" level="debug" msg="[BUILDER] Use cached version" time="2015-03-04T19:31:36Z" level="debug" msg="[BUILDER] Use cached version" time="2015-03-04T19:31:36Z" level="debug" msg="[BUILDER] Command to be executed: [/bin/sh -c chmod 755 /app/init]" time="2015-03-04T19:31:36Z" level="debug" msg="[BUILDER] Use cached version" time="2015-03-04T19:31:36Z" level="debug" msg="[BUILDER] Use cached version" time="2015-03-04T19:31:36Z" level="debug" msg="[BUILDER] Use cached version" time="2015-03-04T19:31:36Z" level="debug" msg="[BUILDER] Use cached version" time="2015-03-04T19:31:37Z" level="debug" msg="[BUILDER] Use cached version" time="2015-03-04T19:31:37Z" level="info" msg="-job build() = OK (0)" ``` What I notice is that docker-compose uses the `v1.14` version of the api, while the "normal" `docker build` uses the `v1.17` api: ``` time="2015-03-04T19:42:51Z" level="debug" msg="Calling POST /build" time="2015-03-04T19:42:51Z" level="info" msg="POST /v1.17/build?dockerfile=Dockerfile&rm=1&t=sonar" time="2015-03-04T19:42:51Z" level="info" msg="+job build()" time="2015-03-04T19:42:51Z" level="debug" msg="[BUILDER] Use cached version" time="2015-03-04T19:42:51Z" level="debug" msg="[BUILDER] Command to be executed: [/bin/sh -c apt-get update && apt-get install procps -y]" time="2015-03-04T19:42:51Z" level="debug" msg="[BUILDER] Use cached version" time="2015-03-04T19:42:51Z" level="debug" msg="[BUILDER] Command to be executed: [/bin/sh -c apt-get update && apt-get install -y --force-yes sonar]" time="2015-03-04T19:42:51Z" level="debug" msg="[BUILDER] Use cached version" time="2015-03-04T19:42:51Z" level="debug" msg="[BUILDER] Cache miss" time="2015-03-04T19:42:51Z" level="debug" msg="CopyFileWithTar(/mnt/sda1/var/lib/docker/tmp/docker-build999836939/assets/init, /mnt/sda1/var/lib/docker/aufs/mnt/46a584cbc5150d0a3286716ad43f18817572ef84a990138185d5285d1ef163ee/app/init)" time="2015-03-04T19:42:51Z" level="debug" msg="Skipping excluded path: .wh..wh.aufs" time="2015-03-04T19:42:51Z" level="debug" msg="Skipping excluded path: .wh..wh.orph" time="2015-03-04T19:42:51Z" level="debug" msg="Skipping excluded path: .wh..wh.plnk" time="2015-03-04T19:42:51Z" level="debug" msg="[BUILDER] Command to be executed: [/bin/sh -c chmod 755 /app/init]" time="2015-03-04T19:42:51Z" level="debug" msg="[BUILDER] Cache miss" time="2015-03-04T19:42:51Z" level="info" msg="+job allocate_interface(6814090adc83ba62ebe24f13ad889344216ec1434066a45980b52809ad8ff4c0)" time="2015-03-04T19:42:51Z" level="info" msg="-job allocate_interface(6814090adc83ba62ebe24f13ad889344216ec1434066a45980b52809ad8ff4c0) = OK (0)" time="2015-03-04T19:42:51Z" level="info" msg="+job log(start, 6814090adc83ba62ebe24f13ad889344216ec1434066a45980b52809ad8ff4c0, cfd71b715943)" time="2015-03-04T19:42:51Z" level="info" msg="-job log(start, 6814090adc83ba62ebe24f13ad889344216ec1434066a45980b52809ad8ff4c0, cfd71b715943) = OK (0)" time="2015-03-04T19:42:51Z" level="info" msg="+job logs(6814090adc83ba62ebe24f13ad889344216ec1434066a45980b52809ad8ff4c0)" time="2015-03-04T19:42:52Z" level="info" msg="+job log(die, 6814090adc83ba62ebe24f13ad889344216ec1434066a45980b52809ad8ff4c0, cfd71b715943)" time="2015-03-04T19:42:52Z" level="info" msg="-job log(die, 6814090adc83ba62ebe24f13ad889344216ec1434066a45980b52809ad8ff4c0, cfd71b715943) = OK (0)" time="2015-03-04T19:42:52Z" level="info" msg="+job release_interface(6814090adc83ba62ebe24f13ad889344216ec1434066a45980b52809ad8ff4c0)" time="2015-03-04T19:42:52Z" level="info" msg="-job release_interface(6814090adc83ba62ebe24f13ad889344216ec1434066a45980b52809ad8ff4c0) = OK (0)" time="2015-03-04T19:42:52Z" level="info" msg="-job logs(6814090adc83ba62ebe24f13ad889344216ec1434066a45980b52809ad8ff4c0) = OK (0)" time="2015-03-04T19:42:52Z" level="debug" msg="Skipping excluded path: .wh..wh.aufs" time="2015-03-04T19:42:52Z" level="debug" msg="Skipping excluded path: .wh..wh.orph" time="2015-03-04T19:42:52Z" level="debug" msg="Skipping excluded path: .wh..wh.plnk" time="2015-03-04T19:42:52Z" level="debug" msg="[BUILDER] Cache miss" time="2015-03-04T19:42:52Z" level="debug" msg="Creating dest directory: /mnt/sda1/var/lib/docker/vfs/dir/5599661b259884f341f5506b4ede76ca2fe62e0b8974597f25adbf62fa3c2c07" time="2015-03-04T19:42:52Z" level="debug" msg="Calling TarUntar(/mnt/sda1/var/lib/docker/aufs/mnt/a5557c694ad9e0f870eb2f08c25111daae94611fda8366cbc40ac86bfc559433/opt/sonar/extensions, /mnt/sda1/var/lib/docker/vfs/dir/5599661b259884f341f5506b4ede76ca2fe62e0b8974597f25adbf62fa3c2c07)" time="2015-03-04T19:42:52Z" level="debug" msg="TarUntar(/mnt/sda1/var/lib/docker/aufs/mnt/a5557c694ad9e0f870eb2f08c25111daae94611fda8366cbc40ac86bfc559433/opt/sonar/extensions /mnt/sda1/var/lib/docker/vfs/dir/5599661b259884f341f5506b4ede76ca2fe62e0b8974597f25adbf62fa3c2c07)" time="2015-03-04T19:42:52Z" level="debug" msg="Skipping excluded path: .wh..wh.aufs" time="2015-03-04T19:42:52Z" level="debug" msg="Skipping excluded path: .wh..wh.orph" time="2015-03-04T19:42:52Z" level="debug" msg="Skipping excluded path: .wh..wh.plnk" time="2015-03-04T19:42:52Z" level="debug" msg="[BUILDER] Cache miss" time="2015-03-04T19:42:52Z" level="debug" msg="Creating dest directory: /mnt/sda1/var/lib/docker/vfs/dir/8c569d91bc95aac5c308b2a3f9a23431a225ef4a7bb9b00641c61f89967b8a0d" time="2015-03-04T19:42:52Z" level="debug" msg="Calling TarUntar(/mnt/sda1/var/lib/docker/aufs/mnt/a9b31d20747c1cac990def5433cf8c829e9ecf920cbe250498fcbd776a5bf705/opt/sonar/extensions, /mnt/sda1/var/lib/docker/vfs/dir/8c569d91bc95aac5c308b2a3f9a23431a225ef4a7bb9b00641c61f89967b8a0d)" time="2015-03-04T19:42:52Z" level="debug" msg="TarUntar(/mnt/sda1/var/lib/docker/aufs/mnt/a9b31d20747c1cac990def5433cf8c829e9ecf920cbe250498fcbd776a5bf705/opt/sonar/extensions /mnt/sda1/var/lib/docker/vfs/dir/8c569d91bc95aac5c308b2a3f9a23431a225ef4a7bb9b00641c61f89967b8a0d)" time="2015-03-04T19:42:52Z" level="debug" msg="Skipping excluded path: .wh..wh.aufs" time="2015-03-04T19:42:52Z" level="debug" msg="Skipping excluded path: .wh..wh.orph" time="2015-03-04T19:42:52Z" level="debug" msg="Skipping excluded path: .wh..wh.plnk" time="2015-03-04T19:42:52Z" level="debug" msg="[BUILDER] Cache miss" time="2015-03-04T19:42:52Z" level="debug" msg="Creating dest directory: /mnt/sda1/var/lib/docker/vfs/dir/b72ddfc443cb6b8632337bdd60a5b4ea62c33d274e2b540e846c3e13a1a0b7b5" time="2015-03-04T19:42:52Z" level="debug" msg="Calling TarUntar(/mnt/sda1/var/lib/docker/aufs/mnt/5da66e951afbee05bc863a68db8c7b3c788a97ed2e31b849b5d0b8356c8d243a/opt/sonar/extensions, /mnt/sda1/var/lib/docker/vfs/dir/b72ddfc443cb6b8632337bdd60a5b4ea62c33d274e2b540e846c3e13a1a0b7b5)" time="2015-03-04T19:42:52Z" level="debug" msg="TarUntar(/mnt/sda1/var/lib/docker/aufs/mnt/5da66e951afbee05bc863a68db8c7b3c788a97ed2e31b849b5d0b8356c8d243a/opt/sonar/extensions /mnt/sda1/var/lib/docker/vfs/dir/b72ddfc443cb6b8632337bdd60a5b4ea62c33d274e2b540e846c3e13a1a0b7b5)" time="2015-03-04T19:42:52Z" level="debug" msg="Skipping excluded path: .wh..wh.aufs" time="2015-03-04T19:42:52Z" level="debug" msg="Skipping excluded path: .wh..wh.orph" time="2015-03-04T19:42:52Z" level="debug" msg="Skipping excluded path: .wh..wh.plnk" time="2015-03-04T19:42:52Z" level="debug" msg="[BUILDER] Cache miss" time="2015-03-04T19:42:52Z" level="debug" msg="Creating dest directory: /mnt/sda1/var/lib/docker/vfs/dir/6288cf8325d559a91f4c75093c459ce4e53b2fe28dcae315a43c7835f98dfe47" time="2015-03-04T19:42:52Z" level="debug" msg="Calling TarUntar(/mnt/sda1/var/lib/docker/aufs/mnt/7bc83dd46e21b0a1da9cb77acc36470d0941df6c709d87f03bd9d3811bf36c00/opt/sonar/extensions, /mnt/sda1/var/lib/docker/vfs/dir/6288cf8325d559a91f4c75093c459ce4e53b2fe28dcae315a43c7835f98dfe47)" time="2015-03-04T19:42:52Z" level="debug" msg="TarUntar(/mnt/sda1/var/lib/docker/aufs/mnt/7bc83dd46e21b0a1da9cb77acc36470d0941df6c709d87f03bd9d3811bf36c00/opt/sonar/extensions /mnt/sda1/var/lib/docker/vfs/dir/6288cf8325d559a91f4c75093c459ce4e53b2fe28dcae315a43c7835f98dfe47)" time="2015-03-04T19:42:53Z" level="debug" msg="Skipping excluded path: .wh..wh.aufs" time="2015-03-04T19:42:53Z" level="debug" msg="Skipping excluded path: .wh..wh.orph" time="2015-03-04T19:42:53Z" level="debug" msg="Skipping excluded path: .wh..wh.plnk" time="2015-03-04T19:42:53Z" level="info" msg="-job build() = OK (0)" ```
i have the same issue I've the same error too ``` File "/usr/local/Cellar/fig/1.1.0/libexec/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.1.0', 'console_scripts', 'docker-compose')() File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/main.py", line 31, in main command.sys_dispatch() File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/command.py", line 27, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/command.py", line 59, in perform_command handler(project, command_options) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/main.py", line 445, in up do_build=not options['--no-build'], File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/project.py", line 184, in up do_build=do_build): File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/service.py", line 259, in recreate_containers **override_options) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/service.py", line 244, in create_container stream_output(output, sys.stdout) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/progress_stream.py", line 37, in stream_output print_output_event(event, stream, is_terminal) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/progress_stream.py", line 50, in print_output_event raise StreamOutputError(event['errorDetail']['message']) compose.progress_stream.StreamOutputError: Get https://index.docker.io/v1/repositories/library/postgres/images: x509: certificate has expired or is not yet valid ``` I have the same issue as @steve0hh +1 Are you still able to reproduce this? @steve0hh that is a different issue and should have been fixed a while ago @dnephin yeah. got it! thanks!
2015-10-02T23:52:52Z
[]
[]
Traceback (most recent call last): File "/usr/local/Cellar/fig/1.1.0/libexec/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.1.0', 'console_scripts', 'docker-compose')() File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/main.py", line 31, in main command.sys_dispatch() File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/command.py", line 27, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/command.py", line 59, in perform_command handler(project, command_options) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/cli/main.py", line 119, in build project.build(service_names=options['SERVICE'], no_cache=no_cache) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/project.py", line 167, in build service.build(no_cache) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/service.py", line 484, in build all_events = stream_output(build_output, sys.stdout) File "/usr/local/Cellar/fig/1.1.0/libexec/lib/python2.7/site-packages/compose/progress_stream.py", line 18, in stream_output event = json.loads(chunk) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads return _default_decoder.decode(s) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 368, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 4 column 1 (char 39 - 162)
4,700
docker/compose
docker__compose-2210
cd0b63879b177f39d87345381384bc56b6b782ef
diff --git a/compose/config/config.py b/compose/config/config.py --- a/compose/config/config.py +++ b/compose/config/config.py @@ -14,7 +14,6 @@ from .validation import validate_against_service_schema from .validation import validate_extended_service_exists from .validation import validate_extends_file_path -from .validation import validate_service_names from .validation import validate_top_level_object @@ -165,16 +164,6 @@ def find_candidates_in_parent_dirs(filenames, path): return (candidates, path) -@validate_top_level_object -@validate_service_names -def pre_process_config(config): - """ - Pre validation checks and processing of the config file to interpolate env - vars returning a config dict ready to be tested against the schema. - """ - return interpolate_environment_variables(config) - - def load(config_details): """Load the configuration from a working directory and a list of configuration files. Files are loaded in order, and merged on top @@ -194,7 +183,7 @@ def build_service(filename, service_name, service_dict): return service_dict def load_file(filename, config): - processed_config = pre_process_config(config) + processed_config = interpolate_environment_variables(config) validate_against_fields_schema(processed_config) return [ build_service(filename, name, service_config) @@ -209,7 +198,10 @@ def merge_services(base, override): } config_file = config_details.config_files[0] + validate_top_level_object(config_file.config) for next_file in config_details.config_files[1:]: + validate_top_level_object(next_file.config) + config_file = ConfigFile( config_file.filename, merge_services(config_file.config, next_file.config)) @@ -283,9 +275,9 @@ def validate_and_construct_extends(self): ) self.extended_service_name = extends['service'] - full_extended_config = pre_process_config( - load_yaml(self.extended_config_path) - ) + config = load_yaml(self.extended_config_path) + validate_top_level_object(config) + full_extended_config = interpolate_environment_variables(config) validate_extended_service_exists( self.extended_service_name, diff --git a/compose/config/validation.py b/compose/config/validation.py --- a/compose/config/validation.py +++ b/compose/config/validation.py @@ -2,7 +2,6 @@ import logging import os import sys -from functools import wraps import six from docker.utils.ports import split_port @@ -65,27 +64,21 @@ def format_boolean_in_environment(instance): return True -def validate_service_names(func): - @wraps(func) - def func_wrapper(config): - for service_name in config.keys(): - if type(service_name) is int: - raise ConfigurationError( - "Service name: {} needs to be a string, eg '{}'".format(service_name, service_name) - ) - return func(config) - return func_wrapper +def validate_service_names(config): + for service_name in config.keys(): + if not isinstance(service_name, six.string_types): + raise ConfigurationError( + "Service name: {} needs to be a string, eg '{}'".format( + service_name, + service_name)) -def validate_top_level_object(func): - @wraps(func) - def func_wrapper(config): - if not isinstance(config, dict): - raise ConfigurationError( - "Top level object needs to be a dictionary. Check your .yml file that you have defined a service at the top level." - ) - return func(config) - return func_wrapper +def validate_top_level_object(config): + if not isinstance(config, dict): + raise ConfigurationError( + "Top level object needs to be a dictionary. Check your .yml file " + "that you have defined a service at the top level.") + validate_service_names(config) def validate_extends_file_path(service_name, extends_options, filename):
Stack trace when an override file is empty If I create an empty `docker-compose.override.yml` in a project, `docker-compose up` throws the following error: ``` Traceback (most recent call last): File "<string>", line 3, in <module> File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 53, in main File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 23, in sys_dispatch File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 26, in dispatch File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 163, in perform_command File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 54, in project_from_options File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 90, in get_project File "/compose/build/docker-compose/out00-PYZ.pyz/compose.config.config", line 215, in load File "/compose/build/docker-compose/out00-PYZ.pyz/compose.config.config", line 205, in merge_services TypeError: 'NoneType' object is not iterable ``` We should instead show the same `Top level object needs to be a dictionary` error that you get if your `docker-compose.yml` file is empty.
2015-10-16T19:49:57Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 53, in main File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 23, in sys_dispatch File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 26, in dispatch File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 163, in perform_command File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 54, in project_from_options File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 90, in get_project File "/compose/build/docker-compose/out00-PYZ.pyz/compose.config.config", line 215, in load File "/compose/build/docker-compose/out00-PYZ.pyz/compose.config.config", line 205, in merge_services TypeError: 'NoneType' object is not iterable
4,703
docker/compose
docker__compose-2239
6f78271b826c59d7f58d03e68cca13438436bdbf
diff --git a/compose/config/config.py b/compose/config/config.py --- a/compose/config/config.py +++ b/compose/config/config.py @@ -1,3 +1,4 @@ +import codecs import logging import os import sys @@ -455,6 +456,8 @@ def parse_environment(environment): def split_env(env): + if isinstance(env, six.binary_type): + env = env.decode('utf-8') if '=' in env: return env.split('=', 1) else: @@ -477,7 +480,7 @@ def env_vars_from_file(filename): if not os.path.exists(filename): raise ConfigurationError("Couldn't find env file: %s" % filename) env = {} - for line in open(filename, 'r'): + for line in codecs.open(filename, 'r', 'utf-8'): line = line.strip() if line and not line.startswith('#'): k, v = split_env(line)
UnicodeDecodeError - for environment variable with non-ascii character value ``` $ docker-compose --version docker-compose version: 1.3.2 CPython version: 2.7.9 OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013 $ cat docker-compose.yml code: image: busybox $ docker-compose run -e FOO=bär code ls Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 32, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 342, in run File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 225, in create_container File "/code/build/docker-compose/out00-PYZ.pyz/compose.container", line 38, in create File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 237, in create_container File "/code/build/docker-compose/out00-PYZ.pyz/docker.utils.utils", line 528, in create_container_config UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128) ```
This happens also when the environment variables are loaded from a file with `env_file: ./somefile` and inside the file some environment variables have values containing non-ASCII characters. ``` $ docker-compose version docker-compose version: 1.4.2 docker-py version: 1.3.1 CPython version: 2.7.9 OpenSSL version: OpenSSL 1.0.1j 15 Oct 2014 ``` Error output: ``` Traceback (most recent call last): File "<string>", line 3, in <module> File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 39, in main File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 313, in run File "/compose/build/docker-compose/out00-PYZ.pyz/compose.project", line 274, in up File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 377, in execute_convergence_plan File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 284, in create_container File "/compose/build/docker-compose/out00-PYZ.pyz/compose.container", line 42, in create File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 243, in create_container File "/compose/build/docker-compose/out00-PYZ.pyz/docker.utils.utils", line 534, in create_container_config UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128) ``` Both of these cases are fixed in master and the 1.5.0 release. You can try it out with the release candidate: https://github.com/docker/compose/releases/tag/1.5.0rc1 Oops, I was wrong. They're only fixed on python3.
2015-10-22T16:13:37Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 32, in main File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 342, in run File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 225, in create_container File "/code/build/docker-compose/out00-PYZ.pyz/compose.container", line 38, in create File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 237, in create_container File "/code/build/docker-compose/out00-PYZ.pyz/docker.utils.utils", line 528, in create_container_config UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
4,705
docker/compose
docker__compose-2326
67dc90ec0e71282bbf3ec27f30d2b1232406b76d
diff --git a/compose/config/config.py b/compose/config/config.py --- a/compose/config/config.py +++ b/compose/config/config.py @@ -457,7 +457,7 @@ def parse_environment(environment): def split_env(env): if isinstance(env, six.binary_type): - env = env.decode('utf-8') + env = env.decode('utf-8', 'replace') if '=' in env: return env.split('=', 1) else: diff --git a/compose/utils.py b/compose/utils.py --- a/compose/utils.py +++ b/compose/utils.py @@ -95,7 +95,7 @@ def stream_as_text(stream): """ for data in stream: if not isinstance(data, six.text_type): - data = data.decode('utf-8') + data = data.decode('utf-8', 'replace') yield data
UnicodeDecodeError exception on non-unicode character output (1.5.0) #### Description of problem: Containers outputing non-unicode characters throws a fatal exception. #### How reproducible: Since version 1.5.0 (final version and both RC) #### Steps to Reproduce: - Create the following `docker-compose.yml` file: ``` web: image: ubuntu command: "/code/test.sh" volumes: - .:/code ``` - Create a `test.sh` file in the same folder (**Important**: file should include some ISO8859-1 encoded characters or from other non-unicode charset). For example download this one https://www.dropbox.com/s/clsuzzv5g9zc2qj/test.sh?dl=0 ``` #!/bin/sh echo ae��u ``` - Run `docker-compose up` #### Actual Results: ``` Creating composer_web_1 Attaching to composer_web_1 Gracefully stopping... (press Ctrl+C again to force) Stopping composer_web_1 ... done Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/compose/cli/main.py", line 54, in main File "/code/compose/cli/docopt_command.py", line 23, in sys_dispatch File "/code/compose/cli/docopt_command.py", line 26, in dispatch File "/code/compose/cli/main.py", line 170, in perform_command File "/code/compose/cli/main.py", line 588, in up File "/code/compose/cli/main.py", line 658, in attach_to_logs File "/code/compose/cli/log_printer.py", line 27, in run File "/code/compose/cli/multiplexer.py", line 35, in loop UnicodeDecodeError: 'utf8' codec can't decode byte 0xed in position 2: invalid continuation byte docker-compose returned -1 ``` #### Expected Results: ``` Starting composer_web_1 Attaching to composer_web_1 web_1 | ae��u composer_web_1 exited with code 0 Gracefully stopping... (press Ctrl+C again to force) ``` #### Additional info: - Containers are running ok with `docker run`, it's a docker-compose issue - On 1.5.0 RC1 and 1.5.0 RC2 it only fails after running a `sleep` command inside the script, on final version it fails on every non-unicode output #### `uname -a`: ``` Linux smarconi 3.19.0-31-generic #36-Ubuntu SMP Wed Oct 7 15:04:02 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux ``` #### `docker-compose version`: ``` docker-compose version: 1.5.0 docker-py version: 1.5.0 CPython version: 2.7.9 OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013 ``` #### `docker version`: ``` Client version: 1.7.1 Client API version: 1.19 Go version (client): go1.4.2 Git commit (client): 786b29d OS/Arch (client): linux/amd64 Server version: 1.7.1 Server API version: 1.19 Go version (server): go1.4.2 Git commit (server): 786b29d OS/Arch (server): linux/amd64 ``` #### `docker info`: ``` Containers: 0 Images: 415 Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs Dirs: 419 Dirperm1 Supported: true Execution Driver: native-0.2 Logging Driver: json-file Kernel Version: 3.19.0-31-generic Operating System: Ubuntu 15.04 CPUs: 8 Total Memory: 7.516 GiB Name: smarconi ID: JWSO:PS6C:FOC4:NSTQ:DA2N:FVTD:ZJM3:JJCN:CDOW:EORB:YSJW:GYCJ WARNING: No swap limit support ```
I guess we can use `replace` or `ignore` in the `decode()`.
2015-11-04T20:57:48Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/compose/cli/main.py", line 54, in main File "/code/compose/cli/docopt_command.py", line 23, in sys_dispatch File "/code/compose/cli/docopt_command.py", line 26, in dispatch File "/code/compose/cli/main.py", line 170, in perform_command File "/code/compose/cli/main.py", line 588, in up File "/code/compose/cli/main.py", line 658, in attach_to_logs File "/code/compose/cli/log_printer.py", line 27, in run File "/code/compose/cli/multiplexer.py", line 35, in loop UnicodeDecodeError: 'utf8' codec can't decode byte 0xed in position 2: invalid continuation byte
4,713
docker/compose
docker__compose-2400
2f20dfe508382a124b9b2d2986076c5668d3314d
diff --git a/compose/utils.py b/compose/utils.py --- a/compose/utils.py +++ b/compose/utils.py @@ -102,7 +102,7 @@ def stream_as_text(stream): def line_splitter(buffer, separator=u'\n'): index = buffer.find(six.text_type(separator)) if index == -1: - return None, None + return None return buffer[:index + 1], buffer[index + 1:] @@ -120,11 +120,11 @@ def split_buffer(stream, splitter=None, decoder=lambda a: a): for data in stream_as_text(stream): buffered += data while True: - item, rest = splitter(buffered) - if not item: + buffer_split = splitter(buffered) + if buffer_split is None: break - buffered = rest + item, buffered = buffer_split yield item if buffered: @@ -140,7 +140,7 @@ def json_splitter(buffer): rest = buffer[json.decoder.WHITESPACE.match(buffer, index).end():] return obj, rest except ValueError: - return None, None + return None def json_stream(stream): @@ -148,7 +148,7 @@ def json_stream(stream): This handles streams which are inconsistently buffered (some entries may be newline delimited, and others are not). """ - return split_buffer(stream_as_text(stream), json_splitter, json_decoder.decode) + return split_buffer(stream, json_splitter, json_decoder.decode) def write_out_msg(stream, lines, msg_index, msg, status="done"):
docker-compose build fails on ADD url directive After updating to docker-compose 1.5.1 (latest from Debian Unstable), trying to build the following image with docker-compose throws an error. The same yml file with docker-compose 1.4.0 builds the image without errors. ``` $ docker-compose -f pep-wilma.yml build pepwilma Building pepwilma Step 0 : FROM node:0.10-slim ---> 04e511e59c2e [...] Step 16 : ADD https://raw.githubusercontent.com/Bitergia/docker/master/utils/entrypoint-common.sh / Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.5.1', 'console_scripts', 'docker-compose')() File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 54, in main command.sys_dispatch() File "/usr/lib/python2.7/dist-packages/compose/cli/docopt_command.py", line 23, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/lib/python2.7/dist-packages/compose/cli/docopt_command.py", line 26, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 171, in perform_command handler(project, command_options) File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 192, in build force_rm=bool(options.get('--force-rm', False))) File "/usr/lib/python2.7/dist-packages/compose/project.py", line 284, in build service.build(no_cache, pull, force_rm) File "/usr/lib/python2.7/dist-packages/compose/service.py", line 727, in build all_events = stream_output(build_output, sys.stdout) File "/usr/lib/python2.7/dist-packages/compose/progress_stream.py", line 15, in stream_output for event in utils.json_stream(output): File "/usr/lib/python2.7/dist-packages/compose/utils.py", line 131, in split_buffer yield decoder(buffered) File "/usr/lib/python2.7/json/decoder.py", line 367, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 15 column 1 (char 4 - 544) ``` The original yml can be found here: [pep-wilma.yml](https://github.com/Bitergia/fiware-chanchan-docker/blob/master/compose/pep-wilma.yml) To build the image, we've just replaced the image line with build: ``` diff diff --git a/compose/pep-wilma.yml b/compose/pep-wilma.yml index f91f349..3a46b13 100644 --- a/compose/pep-wilma.yml +++ b/compose/pep-wilma.yml @@ -43,7 +43,7 @@ idm: - "5000" pepwilma: - image: bitergia/pep-wilma:4.3.0 + build: ../images/pep-wilma/4.3.0 hostname: pepwilma links: - orion ``` Replacing the ADD line from the Dockerfile with a local file or COPY works as expected, as building the image directly with docker. ``` $ docker-compose version docker-compose version: 1.5.1 docker-py version: 1.5.0 CPython version: 2.7.10+ OpenSSL version: OpenSSL 1.0.2d 9 Jul 2015 ``` ``` $ docker version Client: Version: 1.8.3 API version: 1.20 Go version: go1.5.1 Git commit: f4bf5c7 Built: OS/Arch: linux/amd64 Server: Version: 1.8.3 API version: 1.20 Go version: go1.5.1 Git commit: f4bf5c7 Built: OS/Arch: linux/amd64 ```
2015-11-16T17:37:00Z
[]
[]
Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.5.1', 'console_scripts', 'docker-compose')() File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 54, in main command.sys_dispatch() File "/usr/lib/python2.7/dist-packages/compose/cli/docopt_command.py", line 23, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/lib/python2.7/dist-packages/compose/cli/docopt_command.py", line 26, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 171, in perform_command handler(project, command_options) File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 192, in build force_rm=bool(options.get('--force-rm', False))) File "/usr/lib/python2.7/dist-packages/compose/project.py", line 284, in build service.build(no_cache, pull, force_rm) File "/usr/lib/python2.7/dist-packages/compose/service.py", line 727, in build all_events = stream_output(build_output, sys.stdout) File "/usr/lib/python2.7/dist-packages/compose/progress_stream.py", line 15, in stream_output for event in utils.json_stream(output): File "/usr/lib/python2.7/dist-packages/compose/utils.py", line 131, in split_buffer yield decoder(buffered) File "/usr/lib/python2.7/json/decoder.py", line 367, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 2 column 1 - line 15 column 1 (char 4 - 544)
4,732
docker/compose
docker__compose-255
feb8ad7b4cbfdba86aa56742835a877ffb53f420
diff --git a/fig/cli/log_printer.py b/fig/cli/log_printer.py --- a/fig/cli/log_printer.py +++ b/fig/cli/log_printer.py @@ -10,16 +10,17 @@ class LogPrinter(object): - def __init__(self, containers, attach_params=None): + def __init__(self, containers, attach_params=None, output=sys.stdout): self.containers = containers self.attach_params = attach_params or {} self.prefix_width = self._calculate_prefix_width(containers) self.generators = self._make_log_generators() + self.output = output def run(self): mux = Multiplexer(self.generators) for line in mux.loop(): - sys.stdout.write(line.encode(sys.__stdout__.encoding or 'utf-8')) + self.output.write(line) def _calculate_prefix_width(self, containers): """ @@ -45,12 +46,12 @@ def _make_log_generators(self): return generators def _make_log_generator(self, container, color_fn): - prefix = color_fn(self._generate_prefix(container)) + prefix = color_fn(self._generate_prefix(container)).encode('utf-8') # Attach to container before log printer starts running line_generator = split_buffer(self._attach(container), '\n') for line in line_generator: - yield prefix + line.decode('utf-8') + yield prefix + line exit_code = container.wait() yield color_fn("%s exited with code %s\n" % (container.name, exit_code)) diff --git a/fig/cli/socketclient.py b/fig/cli/socketclient.py --- a/fig/cli/socketclient.py +++ b/fig/cli/socketclient.py @@ -81,7 +81,7 @@ def recv(self, socket, stream): chunk = socket.recv(4096) if chunk: - stream.write(chunk.encode(stream.encoding or 'utf-8')) + stream.write(chunk) stream.flush() else: break diff --git a/fig/progress_stream.py b/fig/progress_stream.py new file mode 100644 --- /dev/null +++ b/fig/progress_stream.py @@ -0,0 +1,83 @@ +import json +import os +import codecs + + +class StreamOutputError(Exception): + pass + + +def stream_output(output, stream): + is_terminal = hasattr(stream, 'fileno') and os.isatty(stream.fileno()) + stream = codecs.getwriter('utf-8')(stream) + all_events = [] + lines = {} + diff = 0 + + for chunk in output: + event = json.loads(chunk) + all_events.append(event) + + if 'progress' in event or 'progressDetail' in event: + image_id = event['id'] + + if image_id in lines: + diff = len(lines) - lines[image_id] + else: + lines[image_id] = len(lines) + stream.write("\n") + diff = 0 + + if is_terminal: + # move cursor up `diff` rows + stream.write("%c[%dA" % (27, diff)) + + print_output_event(event, stream, is_terminal) + + if 'id' in event and is_terminal: + # move cursor back down + stream.write("%c[%dB" % (27, diff)) + + stream.flush() + + return all_events + + +def print_output_event(event, stream, is_terminal): + if 'errorDetail' in event: + raise StreamOutputError(event['errorDetail']['message']) + + terminator = '' + + if is_terminal and 'stream' not in event: + # erase current line + stream.write("%c[2K\r" % 27) + terminator = "\r" + pass + elif 'progressDetail' in event: + return + + if 'time' in event: + stream.write("[%s] " % event['time']) + + if 'id' in event: + stream.write("%s: " % event['id']) + + if 'from' in event: + stream.write("(from %s) " % event['from']) + + status = event.get('status', '') + + if 'progress' in event: + stream.write("%s %s%s" % (status, event['progress'], terminator)) + elif 'progressDetail' in event: + detail = event['progressDetail'] + if 'current' in detail: + percentage = float(detail['current']) / float(detail['total']) * 100 + stream.write('%s (%.1f%%)%s' % (status, percentage, terminator)) + else: + stream.write('%s%s' % (status, terminator)) + elif 'stream' in event: + stream.write("%s%s" % (event['stream'], terminator)) + else: + stream.write("%s%s\n" % (status, terminator)) diff --git a/fig/service.py b/fig/service.py --- a/fig/service.py +++ b/fig/service.py @@ -5,8 +5,8 @@ import re import os import sys -import json from .container import Container +from .progress_stream import stream_output, StreamOutputError log = logging.getLogger(__name__) @@ -343,84 +343,6 @@ def can_be_scaled(self): return True -class StreamOutputError(Exception): - pass - - -def stream_output(output, stream): - is_terminal = hasattr(stream, 'fileno') and os.isatty(stream.fileno()) - all_events = [] - lines = {} - diff = 0 - - for chunk in output: - event = json.loads(chunk) - all_events.append(event) - - if 'progress' in event or 'progressDetail' in event: - image_id = event['id'] - - if image_id in lines: - diff = len(lines) - lines[image_id] - else: - lines[image_id] = len(lines) - stream.write("\n") - diff = 0 - - if is_terminal: - # move cursor up `diff` rows - stream.write("%c[%dA" % (27, diff)) - - print_output_event(event, stream, is_terminal) - - if 'id' in event and is_terminal: - # move cursor back down - stream.write("%c[%dB" % (27, diff)) - - stream.flush() - - return all_events - -def print_output_event(event, stream, is_terminal): - if 'errorDetail' in event: - raise StreamOutputError(event['errorDetail']['message']) - - terminator = '' - - if is_terminal and 'stream' not in event: - # erase current line - stream.write("%c[2K\r" % 27) - terminator = "\r" - pass - elif 'progressDetail' in event: - return - - if 'time' in event: - stream.write("[%s] " % event['time']) - - if 'id' in event: - stream.write("%s: " % event['id']) - - if 'from' in event: - stream.write("(from %s) " % event['from']) - - status = event.get('status', '') - - if 'progress' in event: - stream.write("%s %s%s" % (status, event['progress'], terminator)) - elif 'progressDetail' in event: - detail = event['progressDetail'] - if 'current' in detail: - percentage = float(detail['current']) / float(detail['total']) * 100 - stream.write('%s (%.1f%%)%s' % (status, percentage, terminator)) - else: - stream.write('%s%s' % (status, terminator)) - elif 'stream' in event: - stream.write("%s%s" % (event['stream'], terminator)) - else: - stream.write("%s%s\n" % (status, terminator)) - - NAME_RE = re.compile(r'^([^_]+)_([^_]+)_(run_)?(\d+)$')
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2023' When trying to install `RUN /bin/bash -l -c 'passenger-install-nginx-module --auto --auto-download --prefix=/opt/nginx'` from Docker, I get: ``` Traceback (most recent call last): File "<string>", line 3, in <module> File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.main", line 39, in main File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 21, in sys_dispatch File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.command", line 31, in dispatch File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 24, in dispatch File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.command", line 50, in perform_command File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 27, in perform_command File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.main", line 108, in build File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.project", line 123, in build File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.service", line 313, in build File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.service", line 374, in stream_output File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.service", line 419, in print_output_event UnicodeEncodeError: 'ascii' codec can't encode character u'\u2023' in position 2: ordinal not in range(128) ``` I guess the reason is that at this point nginx shows a list of languages and there is a unicode character used as a bullet point in front of each language. fig version is: 0.4.1 docker version is: Client version: 0.11.1 Client API version: 1.11 Go version (client): go1.2.1 Git commit (client): fb99f99 Server version: 0.11.1 Server API version: 1.11 Git commit (server): fb99f99 Go version (server): go1.2.1
Getting a similar problem when installing a PPA. https://gist.github.com/dginther/9b194951e60c1d3a0fb9 Could you try #233 and tell if it helps? Sure, I can try that. meanwhile I put a big ugly hack in that fixed things for me. ``` def print_output_event(event, stream, is_terminal): if 'errorDetail' in event: raise StreamOutputError(event['errorDetail']['message']) reload(sys) sys.setdefaultencoding('utf-8') terminator = '' ```
2014-06-18T14:35:03Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.main", line 39, in main File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 21, in sys_dispatch File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.command", line 31, in dispatch File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 24, in dispatch File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.command", line 50, in perform_command File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 27, in perform_command File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.cli.main", line 108, in build File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.project", line 123, in build File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.service", line 313, in build File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.service", line 374, in stream_output File "/Users/nonsense/code/fig/build/fig/out00-PYZ.pyz/fig.service", line 419, in print_output_event UnicodeEncodeError: 'ascii' codec can't encode character u'\u2023' in position 2: ordinal not in range(128)
4,751
docker/compose
docker__compose-2877
7bae4cdbb25650274ec91a3598eb73e074fd3a9f
diff --git a/compose/config/config.py b/compose/config/config.py --- a/compose/config/config.py +++ b/compose/config/config.py @@ -874,6 +874,9 @@ def validate_paths(service_dict): build_path = build elif isinstance(build, dict) and 'context' in build: build_path = build['context'] + else: + # We have a build section but no context, so nothing to validate + return if ( not is_url(build_path) and diff --git a/compose/config/validation.py b/compose/config/validation.py --- a/compose/config/validation.py +++ b/compose/config/validation.py @@ -253,10 +253,9 @@ def handle_generic_service_error(error, path): msg_format = "{path} contains an invalid type, it should be {msg}" error_msg = _parse_valid_types_from_validator(error.validator_value) - # TODO: no test case for this branch, there are no config options - # which exercise this branch elif error.validator == 'required': - msg_format = "{path} is invalid, {msg}" + error_msg = ", ".join(error.validator_value) + msg_format = "{path} is invalid, {msg} is required." elif error.validator == 'dependencies': config_key = list(error.validator_value.keys())[0]
Obscure failure when build context is not specified When trying to use a `docker-compose.yml` file like this one: ``` version: "2" services: foo: build: dockerfile: "Dockerfile.foo" ``` The failure mode from docker-compose 1.6.0 is an unhandled `UnboundLocalError`: ``` Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.6.0', 'console_scripts', 'docker-compose')() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 55, in main command.sys_dispatch() File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 23, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 26, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 172, in perform_command project = project_from_options(self.base_dir, options) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 52, in project_from_options verbose=options.get('--verbose'), File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 80, in get_project config_data = config.load(config_details) File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 298, in load [file.get_service_dicts() for file in config_details.config_files]) File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 376, in load_services return build_services(service_config) File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 359, in build_services for name, service_dict in service_config.items() File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 348, in build_service validate_service(service_config, service_names, config_file.version) File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 531, in validate_service validate_paths(service_dict) File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 881, in validate_paths not is_url(build_path) and UnboundLocalError: local variable 'build_path' referenced before assignment ``` This makes it difficult to understand the problem - which seems to be that the context has not been specified.
Thanks for the bug report!
2016-02-10T18:33:09Z
[]
[]
Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.6.0', 'console_scripts', 'docker-compose')() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 55, in main command.sys_dispatch() File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 23, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 26, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 172, in perform_command project = project_from_options(self.base_dir, options) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 52, in project_from_options verbose=options.get('--verbose'), File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 80, in get_project config_data = config.load(config_details) File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 298, in load [file.get_service_dicts() for file in config_details.config_files]) File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 376, in load_services return build_services(service_config) File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 359, in build_services for name, service_dict in service_config.items() File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 348, in build_service validate_service(service_config, service_names, config_file.version) File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 531, in validate_service validate_paths(service_dict) File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 881, in validate_paths not is_url(build_path) and UnboundLocalError: local variable 'build_path' referenced before assignment
4,782
docker/compose
docker__compose-2948
1f2c2942d7acab16bf45006f024054a7f2a8b6a1
diff --git a/compose/config/config.py b/compose/config/config.py --- a/compose/config/config.py +++ b/compose/config/config.py @@ -33,11 +33,11 @@ from .validation import match_named_volumes from .validation import validate_against_fields_schema from .validation import validate_against_service_schema +from .validation import validate_config_section from .validation import validate_depends_on from .validation import validate_extends_file_path from .validation import validate_network_mode from .validation import validate_top_level_object -from .validation import validate_top_level_service_objects from .validation import validate_ulimits @@ -388,22 +388,31 @@ def merge_services(base, override): return build_services(service_config) -def process_config_file(config_file, service_name=None): - service_dicts = config_file.get_service_dicts() - validate_top_level_service_objects(config_file.filename, service_dicts) +def interpolate_config_section(filename, config, section): + validate_config_section(filename, config, section) + return interpolate_environment_variables(config, section) + - interpolated_config = interpolate_environment_variables(service_dicts, 'service') +def process_config_file(config_file, service_name=None): + services = interpolate_config_section( + config_file.filename, + config_file.get_service_dicts(), + 'service') if config_file.version == V2_0: processed_config = dict(config_file.config) - processed_config['services'] = services = interpolated_config - processed_config['volumes'] = interpolate_environment_variables( - config_file.get_volumes(), 'volume') - processed_config['networks'] = interpolate_environment_variables( - config_file.get_networks(), 'network') + processed_config['services'] = services + processed_config['volumes'] = interpolate_config_section( + config_file.filename, + config_file.get_volumes(), + 'volume') + processed_config['networks'] = interpolate_config_section( + config_file.filename, + config_file.get_networks(), + 'network') if config_file.version == V1: - processed_config = services = interpolated_config + processed_config = services config_file = config_file._replace(config=processed_config) validate_against_fields_schema(config_file) diff --git a/compose/config/interpolation.py b/compose/config/interpolation.py --- a/compose/config/interpolation.py +++ b/compose/config/interpolation.py @@ -21,7 +21,7 @@ def process_item(name, config_dict): ) return dict( - (name, process_item(name, config_dict)) + (name, process_item(name, config_dict or {})) for name, config_dict in config.items() ) diff --git a/compose/config/validation.py b/compose/config/validation.py --- a/compose/config/validation.py +++ b/compose/config/validation.py @@ -91,29 +91,49 @@ def match_named_volumes(service_dict, project_volumes): ) -def validate_top_level_service_objects(filename, service_dicts): - """Perform some high level validation of the service name and value. - - This validation must happen before interpolation, which must happen - before the rest of validation, which is why it's separate from the - rest of the service validation. +def python_type_to_yaml_type(type_): + type_name = type(type_).__name__ + return { + 'dict': 'mapping', + 'list': 'array', + 'int': 'number', + 'float': 'number', + 'bool': 'boolean', + 'unicode': 'string', + 'str': 'string', + 'bytes': 'string', + }.get(type_name, type_name) + + +def validate_config_section(filename, config, section): + """Validate the structure of a configuration section. This must be done + before interpolation so it's separate from schema validation. """ - for service_name, service_dict in service_dicts.items(): - if not isinstance(service_name, six.string_types): + if not isinstance(config, dict): + raise ConfigurationError( + "In file '{filename}', {section} must be a mapping, not " + "{type}.".format( + filename=filename, + section=section, + type=anglicize_json_type(python_type_to_yaml_type(config)))) + + for key, value in config.items(): + if not isinstance(key, six.string_types): raise ConfigurationError( - "In file '{}' service name: {} needs to be a string, eg '{}'".format( - filename, - service_name, - service_name)) + "In file '{filename}', the {section} name {name} must be a " + "quoted string, i.e. '{name}'.".format( + filename=filename, + section=section, + name=key)) - if not isinstance(service_dict, dict): + if not isinstance(value, (dict, type(None))): raise ConfigurationError( - "In file '{}' service '{}' doesn\'t have any configuration options. " - "All top level keys in your docker-compose.yml must map " - "to a dictionary of configuration options.".format( - filename, service_name - ) - ) + "In file '{filename}', {section} '{name}' must be a mapping not " + "{type}.".format( + filename=filename, + section=section, + name=key, + type=anglicize_json_type(python_type_to_yaml_type(value)))) def validate_top_level_object(config_file): @@ -182,10 +202,10 @@ def get_unsupported_config_msg(path, error_key): return msg -def anglicize_validator(validator): - if validator in ["array", "object"]: - return 'an ' + validator - return 'a ' + validator +def anglicize_json_type(json_type): + if json_type.startswith(('a', 'e', 'i', 'o', 'u')): + return 'an ' + json_type + return 'a ' + json_type def is_service_dict_schema(schema_id): @@ -293,14 +313,14 @@ def _parse_valid_types_from_validator(validator): a valid type. Parse the valid types and prefix with the correct article. """ if not isinstance(validator, list): - return anglicize_validator(validator) + return anglicize_json_type(validator) if len(validator) == 1: - return anglicize_validator(validator[0]) + return anglicize_json_type(validator[0]) return "{}, or {}".format( - ", ".join([anglicize_validator(validator[0])] + validator[1:-1]), - anglicize_validator(validator[-1])) + ", ".join([anglicize_json_type(validator[0])] + validator[1:-1]), + anglicize_json_type(validator[-1])) def _parse_oneof_validator(error):
Cryptic error when volumes key has incorrect syntax In the doc, there is very little explanation for the named volumes. It should be at least said that using one implies also having a top-level volumes key. Nevermind, running `docker-compose build` gives an explicit message about this. So I added a top-level volumes key like this: ``` yaml version: '2' services: app: volumes: - db:/var/lib/mysql volumes: - db ``` But the `docker-compose build` failed miserably with the following error: ``` Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.6.0', 'console_scripts', 'docker-compose')() File "/usr/lib/python3.5/site-packages/compose/cli/main.py", line 55, in main command.sys_dispatch() File "/usr/lib/python3.5/site-packages/compose/cli/docopt_command.py", line 23, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/lib/python3.5/site-packages/compose/cli/docopt_command.py", line 26, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/lib/python3.5/site-packages/compose/cli/main.py", line 172, in perform_command project = project_from_options(self.base_dir, options) File "/usr/lib/python3.5/site-packages/compose/cli/command.py", line 52, in project_from_options verbose=options.get('--verbose'), File "/usr/lib/python3.5/site-packages/compose/cli/command.py", line 80, in get_project config_data = config.load(config_details) File "/usr/lib/python3.5/site-packages/compose/config/config.py", line 288, in load for config_file in config_details.config_files File "/usr/lib/python3.5/site-packages/compose/config/config.py", line 288, in <listcomp> for config_file in config_details.config_files File "/usr/lib/python3.5/site-packages/compose/config/config.py", line 389, in process_config_file config_file.get_volumes(), 'volume') File "/usr/lib/python3.5/site-packages/compose/config/interpolation.py", line 25, in interpolate_environment_variables for name, config_dict in config.items() AttributeError: 'list' object has no attribute 'items' ``` Instead, the expected syntax is (at least that's what's working for me): ``` yaml version: '2' services: app: volumes: - db:/var/lib/mysql volumes: db: driver: local ``` It would be nice to at least add an example in the docs. And maybe give a less cryptic error message. Anyway, thanks for the great work, docker-compose is awesome!
https://docs.docker.com/compose/compose-file/#version-2 has an example, but I guess it wouldn't hurt to have one in the volume section as well. We should have a better error message for that case.
2016-02-18T04:00:35Z
[]
[]
Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.6.0', 'console_scripts', 'docker-compose')() File "/usr/lib/python3.5/site-packages/compose/cli/main.py", line 55, in main command.sys_dispatch() File "/usr/lib/python3.5/site-packages/compose/cli/docopt_command.py", line 23, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/lib/python3.5/site-packages/compose/cli/docopt_command.py", line 26, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/lib/python3.5/site-packages/compose/cli/main.py", line 172, in perform_command project = project_from_options(self.base_dir, options) File "/usr/lib/python3.5/site-packages/compose/cli/command.py", line 52, in project_from_options verbose=options.get('--verbose'), File "/usr/lib/python3.5/site-packages/compose/cli/command.py", line 80, in get_project config_data = config.load(config_details) File "/usr/lib/python3.5/site-packages/compose/config/config.py", line 288, in load for config_file in config_details.config_files File "/usr/lib/python3.5/site-packages/compose/config/config.py", line 288, in <listcomp> for config_file in config_details.config_files File "/usr/lib/python3.5/site-packages/compose/config/config.py", line 389, in process_config_file config_file.get_volumes(), 'volume') File "/usr/lib/python3.5/site-packages/compose/config/interpolation.py", line 25, in interpolate_environment_variables for name, config_dict in config.items() AttributeError: 'list' object has no attribute 'items'
4,793
docker/compose
docker__compose-2975
c7ceacfeaea5e8c3bd0e91cb04ac1e139446ce75
diff --git a/compose/config/validation.py b/compose/config/validation.py --- a/compose/config/validation.py +++ b/compose/config/validation.py @@ -312,6 +312,10 @@ def _parse_oneof_validator(error): types = [] for context in error.context: + if context.validator == 'oneOf': + _, error_msg = _parse_oneof_validator(context) + return path_string(context.path), error_msg + if context.validator == 'required': return (None, context.message)
Empty args list results in unhelpful error Having the Dockerfile ``` Dockerfile FROM scratch ``` and the `docker-compose.yml` file ``` yml version: "2" services: web: build: context: . args: ``` Gives me the following error on any docker-compose command (`config`, `build`) ``` Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/compose/cli/main.py", line 55, in main File "/code/compose/cli/docopt_command.py", line 23, in sys_dispatch File "/code/compose/cli/docopt_command.py", line 26, in dispatch File "/code/compose/cli/main.py", line 169, in perform_command File "/code/compose/cli/main.py", line 210, in config File "/code/compose/config/config.py", line 288, in load File "/code/compose/config/config.py", line 397, in process_config_file File "/code/compose/config/validation.py", line 371, in validate_against_fields_schema File "/code/compose/config/validation.py", line 412, in _validate_against_schema File "/code/compose/config/validation.py", line 362, in process_errors File "/code/compose/config/validation.py", line 362, in <genexpr> File "/code/compose/config/validation.py", line 360, in format_error_message File "/code/compose/config/validation.py", line 248, in handle_generic_service_error File "/code/compose/config/validation.py", line 328, in _parse_oneof_validator File "/code/compose/config/validation.py", line 303, in _parse_valid_types_from_validator File "/code/compose/config/validation.py", line 188, in anglicize_validator TypeError: coercing to Unicode: need string or buffer, dict found docker-compose returned -1 ``` Using `docker-compose version 1.6.0, build d99cad6` on Ubuntu 15.10. I see the empty dictionary is a stupid mistake, it came up when I commented out all the arguments, but would it be possible to provide a helpful error message here?
2016-02-19T19:24:35Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/compose/cli/main.py", line 55, in main File "/code/compose/cli/docopt_command.py", line 23, in sys_dispatch File "/code/compose/cli/docopt_command.py", line 26, in dispatch File "/code/compose/cli/main.py", line 169, in perform_command File "/code/compose/cli/main.py", line 210, in config File "/code/compose/config/config.py", line 288, in load File "/code/compose/config/config.py", line 397, in process_config_file File "/code/compose/config/validation.py", line 371, in validate_against_fields_schema File "/code/compose/config/validation.py", line 412, in _validate_against_schema File "/code/compose/config/validation.py", line 362, in process_errors File "/code/compose/config/validation.py", line 362, in <genexpr> File "/code/compose/config/validation.py", line 360, in format_error_message File "/code/compose/config/validation.py", line 248, in handle_generic_service_error File "/code/compose/config/validation.py", line 328, in _parse_oneof_validator File "/code/compose/config/validation.py", line 303, in _parse_valid_types_from_validator File "/code/compose/config/validation.py", line 188, in anglicize_validator TypeError: coercing to Unicode: need string or buffer, dict found
4,794
docker/compose
docker__compose-3269
86530287d6fdc13e52ffbc3fe2447888ecc6e197
diff --git a/compose/container.py b/compose/container.py --- a/compose/container.py +++ b/compose/container.py @@ -39,7 +39,7 @@ def from_ps(cls, client, dictionary, **kwargs): @classmethod def from_id(cls, client, id): - return cls(client, client.inspect_container(id)) + return cls(client, client.inspect_container(id), has_been_inspected=True) @classmethod def create(cls, client, **options):
`docker-compose logs` gets confused when scaling down and then up again **What I do** - View logs of a service with `docker-compose logs --follow` - Scale up service (e.g. from 1 to 2) - Scale down service (e.g. from 2 to 1) - Scale up again (e.g. from 1 to 3) **What I expect to see** - Compose streams logs of service instance 1 - ... then instances 1+2 - ... then instance 1 only (possibly with a message telling me that instance 2 is gone) - ... the instances 1+2+3 **What I see instead** - Compose streams logs of service instance 1 - ... then instances 1+2 - ... then, when scaling down, I get the following traceback: ``` Traceback (most recent call last): File "threading.py", line 810, in __bootstrap_inner File "threading.py", line 763, in run File "compose/cli/log_printer.py", line 190, in watch_events File "compose/project.py", line 355, in events File "compose/container.py", line 71, in service File "compose/container.py", line 108, in labels File "compose/container.py", line 181, in get File "compose/container.py", line 236, in inspect_if_not_inspected File "compose/container.py", line 245, in inspect File ".tox/py27/lib/python2.7/site-packages/docker/utils/decorators.py", line 21, in wrapped File ".tox/py27/lib/python2.7/site-packages/docker/api/container.py", line 182, in inspect_container File ".tox/py27/lib/python2.7/site-packages/docker/client.py", line 158, in _result File ".tox/py27/lib/python2.7/site-packages/docker/client.py", line 153, in _raise_for_status NotFound: 404 Client Error: Not Found ("No such container: 751d68c04b7bef09e6b4b2bbfd74b6733736491621a6b131ac68beba8751970a") ``` - Compose then only displays logs for instance 1 and doesn't display other instances, even if I scale back up **Extra info** ``` $ docker-compose -v docker-compose version 1.7.0rc1, build 1ad8866 ``` To reproduce: ``` bash git clone git://github.com/jpetazzo/orchestration-workshop cd orchestration-workshop/dockercoins docker-compose up -d docker-compose logs --tail 1 --follow worker # in another terminal ... docker-compose scale worker=2 docker-compose scale worker=1 docker-compose scale worker=3 docker-compose down ``` Related to: #3075 #2227
Thanks for the bug report! I'm not able to reproduce this issue. I think this would only happen if the container was removed with `docker rm -f <conatiner id>`, but even with that I couldn't reproduce the issue. If scale stops a container it should still exist, so I'm not sure why it failed to find it. That said, I did find a bug while looking into it. I had attempted to handle this error, but I missed `Container.from_id()` was not setting `has_been_inspected` to `True`, which meant that a second API call was being made unnecessarily outside of the `try/except`, which is what lead to this crash. So even though I wasn't able to reproduce the problem, I think I have a fix for it.
2016-04-05T15:35:26Z
[]
[]
Traceback (most recent call last): File "threading.py", line 810, in __bootstrap_inner File "threading.py", line 763, in run File "compose/cli/log_printer.py", line 190, in watch_events File "compose/project.py", line 355, in events File "compose/container.py", line 71, in service File "compose/container.py", line 108, in labels File "compose/container.py", line 181, in get File "compose/container.py", line 236, in inspect_if_not_inspected File "compose/container.py", line 245, in inspect File ".tox/py27/lib/python2.7/site-packages/docker/utils/decorators.py", line 21, in wrapped File ".tox/py27/lib/python2.7/site-packages/docker/api/container.py", line 182, in inspect_container File ".tox/py27/lib/python2.7/site-packages/docker/client.py", line 158, in _result File ".tox/py27/lib/python2.7/site-packages/docker/client.py", line 153, in _raise_for_status NotFound: 404 Client Error: Not Found ("No such container: 751d68c04b7bef09e6b4b2bbfd74b6733736491621a6b131ac68beba8751970a")
4,815
docker/compose
docker__compose-3351
a0aea42f758038536ab984244a0a61f1097624dc
diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ def find_version(*file_paths): 'requests >= 2.6.1, < 2.8', 'texttable >= 0.8.1, < 0.9', 'websocket-client >= 0.32.0, < 1.0', - 'docker-py > 1.7.2, < 2', + 'docker-py >= 1.8.0, < 2', 'dockerpty >= 0.4.1, < 0.5', 'six >= 1.3.0, < 2', 'jsonschema >= 2.5.1, < 3',
TypeError: kwargs_from_env() got an unexpected keyword argument 'environment' after 1.7 update Hello! After updating Docker got this error when building: ``` $ docker-compose build Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.7.0', 'console_scripts', 'docker-compose')() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 57, in main command() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 105, in perform_command project = project_from_options('.', options) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 31, in project_from_options environment=environment File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 76, in get_project host=host, environment=environment File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 49, in get_client environment=environment File "/usr/lib/python2.7/site-packages/compose/cli/docker_client.py", line 52, in docker_client kwargs = kwargs_from_env(environment=environment) TypeError: kwargs_from_env() got an unexpected keyword argument 'environment' ``` I'm using Fedora 23. Docker from docker repository. ``` $ rpm -qa | grep -i docker docker-compose-1.7.0-1.fc23.noarch python-docker-py-1.7.2-1.fc23.noarch docker-engine-1.11.0-1.fc23.x86_64 python-dockerpty-0.4.1-2.fc23.noarch python3-docker-py-1.7.2-1.fc23.noarch docker-engine-selinux-1.11.0-1.fc23.noarch ``` ``` $ python --version Python 2.7.11 ``` Docker-compose 1.6 still works well.
Looks like we forgot to update `setup.py`, it requires `docker-py >= 1.8`, so you'll need to pip install that. setup.py specifies `docker-py > 1.7.2, < 2` which should theoretically install 1.8.0, but Fedora's repackaging/distribution might confuse it.
2016-04-20T00:39:56Z
[]
[]
Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.7.0', 'console_scripts', 'docker-compose')() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 57, in main command() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 105, in perform_command project = project_from_options('.', options) File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 31, in project_from_options environment=environment File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 76, in get_project host=host, environment=environment File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 49, in get_client environment=environment File "/usr/lib/python2.7/site-packages/compose/cli/docker_client.py", line 52, in docker_client kwargs = kwargs_from_env(environment=environment) TypeError: kwargs_from_env() got an unexpected keyword argument 'environment'
4,823
docker/compose
docker__compose-3436
c9fe8920c97384b02ea446d95a4d59df4a3d75a3
diff --git a/compose/cli/main.py b/compose/cli/main.py --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -334,6 +334,13 @@ def exec_command(self, options): """ index = int(options.get('--index')) service = self.project.get_service(options['SERVICE']) + detach = options['-d'] + + if IS_WINDOWS_PLATFORM and not detach: + raise UserError( + "Interactive mode is not yet supported on Windows.\n" + "Please pass the -d flag when using `docker-compose exec`." + ) try: container = service.get_container(number=index) except ValueError as e: @@ -350,7 +357,7 @@ def exec_command(self, options): exec_id = container.create_exec(command, **create_exec_options) - if options['-d']: + if detach: container.start_exec(exec_id, tty=tty) return
Windows: NameError: global name 'ExecOperation' is not defined If I try to run a `docker-compose exec` command it always gives me this error: ``` D:\Path\> docker-compose exec some-container some-command Traceback (most recent call last): File "<string>", line 3, in <module> File "compose\cli\main.py", line 57, in main File "compose\cli\main.py", line 108, in perform_command File "compose\cli\main.py", line 347, in exec_command NameError: global name 'ExecOperation' is not defined docker-compose returned -1 ``` Is there a known bug on this message? My guess is that this has something to do with this message `Interactive mode is not yet supported on Windows.` when you use `docker-compose run` but I'm not sure.. Thanks for any help in advance! Some more system information: ``` D:\> docker version Client: Version: 1.11.0 API version: 1.23 Go version: go1.5.4 Git commit: 4dc5990 Built: Wed Apr 13 18:13:28 2016 OS/Arch: windows/amd64 Server: Version: 1.11.0 API version: 1.23 Go version: go1.5.4 Git commit: 4dc5990 Built: Wed Apr 13 19:36:04 2016 OS/Arch: linux/amd64 D:\> docker-compose version docker-compose version 1.7.0, build 0d7bf73 docker-py version: 1.8.0 CPython version: 2.7.11 OpenSSL version: OpenSSL 1.0.2d 9 Jul 2015 ```
Yes, this is similar to the warning in `docker run`, with `exec` not handling the error quite as gracefully. `exec` on Windows currently only supports detached mode (`-d`)
2016-05-09T23:30:43Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "compose\cli\main.py", line 57, in main File "compose\cli\main.py", line 108, in perform_command File "compose\cli\main.py", line 347, in exec_command NameError: global name 'ExecOperation' is not defined
4,830
docker/compose
docker__compose-3615
72d3d5d84ba29b1fb6d8ac37dfc8eca76812b2e2
diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ def find_version(*file_paths): 'requests >= 2.6.1, < 2.8', 'texttable >= 0.8.1, < 0.9', 'websocket-client >= 0.32.0, < 1.0', - 'docker-py >= 1.8.1, < 2', + 'docker-py == 1.9.0rc2', 'dockerpty >= 0.4.1, < 0.5', 'six >= 1.3.0, < 2', 'jsonschema >= 2.5.1, < 3',
Support npipe url values for DOCKER_HOST The Windows Docker Engine recently got support for named pipe (think of the unix socket on Linux) instead of listening on local http port 2375. See https://github.com/docker/docker/pull/19911 for the first PR. Now it seems that Docker Compose needs this support as well when the Docker Engine is no longer listening on tcp port. ``` C:\> docker-compose --verbose up compose.config.config.find: Using configuration files: .\docker-compose.yml docker.auth.auth.load_config: File doesn't exist Traceback (most recent call last): File "<string>", line 3, in <module> File "C:\projects\compose\compose\cli\main.py", line 55, in main File "C:\projects\compose\compose\cli\docopt_command.py", line 23, in sys_dispatch File "C:\projects\compose\compose\cli\docopt_command.py", line 26, in dispatch File "C:\projects\compose\compose\cli\main.py", line 172, in perform_command File "C:\projects\compose\compose\cli\command.py", line 52, in project_from_options File "C:\projects\compose\compose\cli\command.py", line 85, in get_project File "C:\projects\compose\compose\cli\command.py", line 68, in get_client File "c:\projects\compose\venv\lib\site-packages\docker\api\daemon.py", line 78, in version File "c:\projects\compose\venv\lib\site-packages\docker\utils\decorators.py", line 47, in inner File "c:\projects\compose\venv\lib\site-packages\docker\client.py", line 112, in _get File "c:\projects\compose\venv\lib\site-packages\requests\sessions.py", line 477, in get File "c:\projects\compose\venv\lib\site-packages\requests\sessions.py", line 465, in request File "c:\projects\compose\venv\lib\site-packages\requests\sessions.py", line 573, in send File "c:\projects\compose\venv\lib\site-packages\requests\adapters.py", line 415, in send requests.exceptions.ConnectionError: ('Connection aborted.', error(10061, 'No connection could be made because the target machine actively refused it')) docker-compose returned -1 C:\> docker-compose --version docker-compose version 1.6.0, build cdb920a C:\> docker version Client: Version: 1.11.0-dev API version: 1.23 Go version: go1.6 Git commit: 9e53024 Built: Sat Mar 19 14:35:55 2016 OS/Arch: windows/amd64 Server: Version: 1.11.0-dev API version: 1.23 Go version: go1.6 Git commit: 9e53024 Built: Sat Mar 19 14:35:55 2016 OS/Arch: windows/amd64 ``` Tested on a TP4 with the nightly docker.exe
2016-06-16T22:13:12Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "C:\projects\compose\compose\cli\main.py", line 55, in main File "C:\projects\compose\compose\cli\docopt_command.py", line 23, in sys_dispatch File "C:\projects\compose\compose\cli\docopt_command.py", line 26, in dispatch File "C:\projects\compose\compose\cli\main.py", line 172, in perform_command File "C:\projects\compose\compose\cli\command.py", line 52, in project_from_options File "C:\projects\compose\compose\cli\command.py", line 85, in get_project File "C:\projects\compose\compose\cli\command.py", line 68, in get_client File "c:\projects\compose\venv\lib\site-packages\docker\api\daemon.py", line 78, in version File "c:\projects\compose\venv\lib\site-packages\docker\utils\decorators.py", line 47, in inner File "c:\projects\compose\venv\lib\site-packages\docker\client.py", line 112, in _get File "c:\projects\compose\venv\lib\site-packages\requests\sessions.py", line 477, in get File "c:\projects\compose\venv\lib\site-packages\requests\sessions.py", line 465, in request File "c:\projects\compose\venv\lib\site-packages\requests\sessions.py", line 573, in send File "c:\projects\compose\venv\lib\site-packages\requests\adapters.py", line 415, in send requests.exceptions.ConnectionError: ('Connection aborted.', error(10061, 'No connection could be made because the target machine actively refused it'))
4,841
docker/compose
docker__compose-367
847ec5b559cf97296c80624774cc4210bbabcac6
diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -22,8 +22,16 @@ def find_version(*file_paths): return version_match.group(1) raise RuntimeError("Unable to find version string.") -with open('requirements.txt') as f: - install_requires = f.read().splitlines() + +install_requires = [ + 'docopt >= 0.6.1, < 0.7', + 'PyYAML >= 3.10, < 4', + 'requests >= 2.2.1, < 3', + 'texttable >= 0.8.1, < 0.9', + 'websocket-client >= 0.11.0, < 0.12', + 'dockerpty >= 0.2.3, < 0.3', +] + with open('requirements-dev.txt') as f: tests_require = f.read().splitlines()
Using == in setup.py from requirements.txt will cause conflicts with other python packages requirements.txt with == operator is meant to be used when you need completely limit the versions of package. fig uses requirements.txt input in setup.py to fill install_requires. If any package installed after fig requires other version or updates the dependency things will break. ``` fig up -d Traceback (most recent call last): File "/usr/local/bin/fig", line 5, in <module> from pkg_resources import load_entry_point File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2749, in <module> working_set = WorkingSet._build_master() File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 446, in _build_master return cls._build_from_requirements(__requires__) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 459, in _build_from_requirements dists = ws.resolve(reqs, Environment()) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 628, in resolve raise DistributionNotFound(req) pkg_resources.DistributionNotFound: requests==2.2.1 ``` The latest version of requests package available is 2.3.0 (which was installed in this case) and it's of course backward compatibile. You should either stop relaying on reading requirements.txt or start using >= operator.
`requirements.txt` should actually contain a full list of pinned versions (using ==). That way tests can run against a specific version each time, and you have a way to build a virtualenv with known working dependencies. I think the problem here is that setup.py uses the list from requirements.txt for `install_requires`, which is not correct. setup.py should use `>=, <` Reference: https://caremad.io/blog/setup-vs-requirement/
2014-07-29T17:30:45Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/fig", line 5, in <module> from pkg_resources import load_entry_point File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2749, in <module> working_set = WorkingSet._build_master() File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 446, in _build_master return cls._build_from_requirements(__requires__) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 459, in _build_from_requirements dists = ws.resolve(reqs, Environment()) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 628, in resolve raise DistributionNotFound(req) pkg_resources.DistributionNotFound: requests==2.2.1
4,844
docker/compose
docker__compose-3830
d29f8e10222f3dbd3b57d8dfb9a15404a4302609
diff --git a/compose/cli/docker_client.py b/compose/cli/docker_client.py --- a/compose/cli/docker_client.py +++ b/compose/cli/docker_client.py @@ -11,15 +11,16 @@ from ..const import HTTP_TIMEOUT from .errors import UserError from .utils import generate_user_agent +from .utils import unquote_path log = logging.getLogger(__name__) def tls_config_from_options(options): tls = options.get('--tls', False) - ca_cert = options.get('--tlscacert') - cert = options.get('--tlscert') - key = options.get('--tlskey') + ca_cert = unquote_path(options.get('--tlscacert')) + cert = unquote_path(options.get('--tlscert')) + key = unquote_path(options.get('--tlskey')) verify = options.get('--tlsverify') skip_hostname_check = options.get('--skip-hostname-check', False) diff --git a/compose/cli/utils.py b/compose/cli/utils.py --- a/compose/cli/utils.py +++ b/compose/cli/utils.py @@ -122,3 +122,11 @@ def generate_user_agent(): else: parts.append("{}/{}".format(p_system, p_release)) return " ".join(parts) + + +def unquote_path(s): + if not s: + return s + if s[0] == '"' and s[-1] == '"': + return s[1:-1] + return s
docker-compose $(docker-machine config default) up Fails. docker and docker-compose handle arguments differently. `docker-compose $(docker-machine config default) up`causes an error. (see below) and `docker-compose $(docker-machine config default | xargs) up` works. joe@jsd-mbp ~ $ docker-compose $(docker-machine config default) -f docker-compose.yml up [2.2.3] Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 58, in main File "compose/cli/main.py", line 106, in perform_command File "compose/cli/command.py", line 33, in project_from_options File "compose/cli/docker_client.py", line 36, in tls_config_from_options File "site-packages/docker/tls.py", line 47, in **init** docker.errors.TLSParameterError: Path to a certificate and key files must be provided through the client_config param. TLS configurations should map the Docker CLI client configurations. See https://docs.docker.com/engine/articles/https/ for API details. docker-compose returned -1 joe@jsd-mbp ~ $
this issus is that tls.py is calling os.path.isfile(cert) where cert is a quoted path. so in python ```tls_cert=' "/Users/joe/.docker/machine/cert.pem" ' Makes sense. Thanks for the report! Compose doesn't like it, even if you strip the quotes ``` $ docker-compose $(docker-machine config default | sed 's/\"//g') ps ERROR: TLS configuration is invalid - make sure your DOCKER_TLS_VERIFY and DOCKER_CERT_PATH are set correctly. You might need to run `eval "$(docker-machine env default)"` ``` Try docker-compose $(docker-machine config default | xargs ) ps Sent from my iPad > On Jun 9, 2016, at 8:30 AM, Matt Wright [email protected] wrote: > > Compose doesn't like it, even if you strip the quotes > > $ docker-compose $(docker-machine config default | sed 's/\"//g') ps > ERROR: TLS configuration is invalid - make sure your DOCKER_TLS_VERIFY and DOCKER_CERT_PATH are set correctly. > You might need to run `eval "$(docker-machine env default)"` > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub, or mute the thread. @jduhamel ah, that does work, thanks
2016-08-09T22:14:20Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 58, in main File "compose/cli/main.py", line 106, in perform_command File "compose/cli/command.py", line 33, in project_from_options File "compose/cli/docker_client.py", line 36, in tls_config_from_options File "site-packages/docker/tls.py", line 47, in **init** docker.errors.TLSParameterError: Path to a certificate and key files must be provided through the client_config param. TLS configurations should map the Docker CLI client configurations. See https://docs.docker.com/engine/articles/https/ for API details.
4,853
docker/compose
docker__compose-387
0a15e7fe9cae05bd1312db224d1499752fd41443
diff --git a/fig/cli/formatter.py b/fig/cli/formatter.py --- a/fig/cli/formatter.py +++ b/fig/cli/formatter.py @@ -4,11 +4,17 @@ import texttable +def get_tty_width(): + tty_size = os.popen('stty size', 'r').read().split() + if len(tty_size) != 2: + return 80 + _, width = tty_size + return width + + class Formatter(object): def table(self, headers, rows): - height, width = os.popen('stty size', 'r').read().split() - - table = texttable.Texttable(max_width=width) + table = texttable.Texttable(max_width=get_tty_width()) table.set_cols_dtype(['t' for h in headers]) table.add_rows([headers] + rows) table.set_deco(table.HEADER)
fig ps fails hellou I use fig (v0.5.2) to build my docker images on a jenkins server. my script builds all images, which looks like this: echo ----- BUILD fig up -d echo ----- DONE fig ps however the `fig ps`call just fails: ``` stty: standard input: Inappropriate ioctl for device Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 30, in main File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 21, in sys_dispatch File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 31, in dispatch File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 24, in dispatch File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 50, in perform_command File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 27, in perform_command File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 178, in ps File "/code/build/fig/out00-PYZ.pyz/fig.cli.formatter", line 9, in table ValueError: need more than 0 values to unpack ```
I've run into this same problems with another python project while running on jenkins. ``` os.popen('stty size', 'r').read() ``` Returns an empty string on jenkins, so the splitting into two variables fails. `fig.cli.formatter.Formatter` needs to check for empty list after `split()`, and default to some value (probably 80).
2014-08-07T16:30:53Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 30, in main File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 21, in sys_dispatch File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 31, in dispatch File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 24, in dispatch File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 50, in perform_command File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 27, in perform_command File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 178, in ps File "/code/build/fig/out00-PYZ.pyz/fig.cli.formatter", line 9, in table ValueError: need more than 0 values to unpack
4,854
docker/compose
docker__compose-3930
3dec600d8218833de11279e1dac6af048222dbc6
diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ def find_version(*file_paths): 'requests >= 2.6.1, < 2.8', 'texttable >= 0.8.1, < 0.9', 'websocket-client >= 0.32.0, < 1.0', - 'docker-py >= 1.9.0, < 2.0', + 'docker-py >= 1.10.2, < 2.0', 'dockerpty >= 0.4.1, < 0.5', 'six >= 1.3.0, < 2', 'jsonschema >= 2.5.1, < 3',
Cannot use URL as build context According to https://docs.docker.com/compose/compose-file/#/context it should be possible to use URL to a git repository for build context, but I am having no luck docker-py version: 1.8.1 CPython version: 2.7.9 OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013 docker-compose.yml ``` version: '2' services: test: build: context: https://github.com/docker/compose.git ``` docker-compose build ``` Building test Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 58, in main File "compose/cli/main.py", line 109, in perform_command File "compose/cli/main.py", line 215, in build File "compose/project.py", line 300, in build File "compose/service.py", line 719, in build File ".tox/py27/lib/python2.7/site-packages/docker/api/build.py", line 104, in build File ".tox/py27/lib/python2.7/site-packages/docker/utils/decorators.py", line 46, in inner AttributeError: 'NoneType' object has no attribute 'update' docker-compose returned -1 ``` Unable to pull private images when using credentials helper I'm using the secretservice credentials helper with docker 1.11.2 and docker-compose 1.8.0-rc1. If I try to run `docker-compose up`, it fails to pull private images from our gitlab registry. --verbose says: ``` docker.auth.auth.resolve_authconfig: No entry found docker.api.image.pull: No auth config found ``` Pulling the image manually using docker pull works.
I can't seem to be able to reproduce this on 1.7.1 or 1.8.0. What version of docker-compose are you using? Did you install it through pip, or are you using the binary distribution? Hi @shin- , I just tried with 1.8.0. ``` $ docker-compose version docker-compose version 1.8.0, build f3628c7 docker-py version: 1.9.0 CPython version: 2.7.9 OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013 ``` Installed (or download) from https://github.com/docker/compose/releases: ``` curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose ``` Running in Ubuntu: ``` $ uname -a Linux devmachine 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux ``` ``` $ docker-compose build Building test Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 61, in main File "compose/cli/main.py", line 113, in perform_command File "compose/cli/main.py", line 219, in build File "compose/project.py", line 300, in build File "compose/service.py", line 727, in build File "site-packages/docker/api/build.py", line 104, in build File "site-packages/docker/utils/decorators.py", line 46, in inner AttributeError: 'NoneType' object has no attribute 'update' docker-compose returned -1 ``` @feltraco Care to share your compose file? I still can't reproduce the issue using a similar environment. ``` $ ls docker-compose docker-compose.yml $ ./docker-compose version docker-compose version 1.8.0, build f3628c7 docker-py version: 1.9.0 CPython version: 2.7.9 OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013 $ cat docker-compose.yml version: '2' services: test: build: context: https://github.com/docker/compose.git $ uname -a Linux yuna 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux $ ./docker-compose build Building test Step 1 : FROM debian:wheezy ---> 2e9c7e5da19c [...] Successfully built ade0143bebdb ``` Oh, nevermind - the issue triggers when you have a `HttpHeaders` entry in your `config.json` file. I've created issue https://github.com/docker/docker-py/issues/1148 to track its resolution in docker-py, after which we can port the fix in compose. Thank you for the report, and thanks for your patience. docker-compose version 1.8.0-rc1, build 9bf6bc6 docker-py version: 1.8.1 CPython version: 2.7.9 OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013 same here, same docker-compose version. Docker pull works, of course - cause is the credentials helper, i use ``` "credsStore": "osxkeychain" ``` docker-compose version 1.8.0-rc1 Docker version 1.11.2, build b9f10c9 I think docker-py first needs to be updated to support the credential store API. See docker/docker-py/issues/1023. Then docker-compose can be updated to use the new docker-py. @grosskur docker is supporting credenial stores now, but compose is not. Is there any chance to move on?
2016-09-10T00:21:50Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 58, in main File "compose/cli/main.py", line 109, in perform_command File "compose/cli/main.py", line 215, in build File "compose/project.py", line 300, in build File "compose/service.py", line 719, in build File ".tox/py27/lib/python2.7/site-packages/docker/api/build.py", line 104, in build File ".tox/py27/lib/python2.7/site-packages/docker/utils/decorators.py", line 46, in inner AttributeError: 'NoneType' object has no attribute 'update'
4,859
docker/compose
docker__compose-3964
7687412e03b9c37cced49109d142de9d73472e8f
diff --git a/compose/service.py b/compose/service.py --- a/compose/service.py +++ b/compose/service.py @@ -1109,6 +1109,8 @@ def format_environment(environment): def format_env(key, value): if value is None: return key + if isinstance(value, six.binary_type): + value = value.decode('utf-8') return '{key}={value}'.format(key=key, value=value) return [format_env(*item) for item in environment.items()]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 7: ordinal not in range(128) In `docker-compose.yml` I have something like that: ``` yaml app: environment: VARIABLE: ${VARIABLE} ``` When `VARIABLE` contains characters from Polish alphabet like `ą, ć, ę, ł, ń, ó, ś, ź, ż` it returns error: ``` Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 56, in main File "compose/cli/docopt_command.py", line 23, in sys_dispatch File "compose/cli/docopt_command.py", line 26, in dispatch File "compose/cli/main.py", line 191, in perform_command File "compose/cli/main.py", line 657, in up File "compose/project.py", line 318, in up File "compose/service.py", line 370, in execute_convergence_plan File "compose/service.py", line 410, in recreate_container File "compose/service.py", line 258, in create_container File "compose/service.py", line 625, in _get_container_create_options File "compose/service.py", line 1031, in format_environment File "compose/service.py", line 1030, in format_env UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 7: ordinal not in range(128) docker-compose returned -1 make: *** [run_compose_up] Error 255 ``` Is it possible that more than ASCII will be handled?
Hi @szemek , what version of Compose are you running? I confirmed the issue still happens with master.
2016-09-21T01:08:34Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 56, in main File "compose/cli/docopt_command.py", line 23, in sys_dispatch File "compose/cli/docopt_command.py", line 26, in dispatch File "compose/cli/main.py", line 191, in perform_command File "compose/cli/main.py", line 657, in up File "compose/project.py", line 318, in up File "compose/service.py", line 370, in execute_convergence_plan File "compose/service.py", line 410, in recreate_container File "compose/service.py", line 258, in create_container File "compose/service.py", line 625, in _get_container_create_options File "compose/service.py", line 1031, in format_environment File "compose/service.py", line 1030, in format_env UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 7: ordinal not in range(128)
4,863
docker/compose
docker__compose-4104
3b46a62f363fe3d2e59a264151f840b6ec8e54b4
diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ def find_version(*file_paths): 'requests >= 2.6.1, != 2.11.0, < 2.12', 'texttable >= 0.8.1, < 0.9', 'websocket-client >= 0.32.0, < 1.0', - 'docker-py >= 1.10.5, < 2.0', + 'docker-py >= 1.10.6, < 2.0', 'dockerpty >= 0.4.1, < 0.5', 'six >= 1.3.0, < 2', 'jsonschema >= 2.5.1, < 3',
Working with multiple Windows containers: The semaphore timeout period has expired. Starting twelve containers with docker-compose 1.9.0-rc2 still shows a problem. Follow up of #4082 ``` PS C:\xxxxx> docker-compose up -d Creating xxxxx_consul_1 Creating xxxxx_db_1 Creating xxxxx_service1_1 Creating xxxxx_service2_1 Creating xxxxx_service3_1 Creating xxxxx_service4_1 Creating xxxxx_service5_1 Creating xxxxx_cli_1 ERROR: for service6 (121, 'WaitNamedPipe', 'The semaphore timeout period has expired.') ERROR: for service7 (121, 'WaitNamedPipe', 'The semaphore timeout period has expired.') ERROR: for service8 (121, 'WaitNamedPipe', 'The semaphore timeout period has expired.') ERROR: for service9 (121, 'WaitNamedPipe', 'The semaphore timeout period has expired.') ERROR: for service3 (121, 'WaitNamedPipe', 'The semaphore timeout period has expired.') Traceback (most recent call last): File "<string>", line 3, in <module> File "compose\cli\main.py", line 65, in main File "compose\cli\main.py", line 117, in perform_command File "compose\cli\main.py", line 849, in up File "compose\project.py", line 400, in up File "compose\parallel.py", line 64, in parallel_execute pywintypes.error: (121, 'WaitNamedPipe', 'The semaphore timeout period has expired.') docker-compose returned -1 PS C:\xxxxx> docker-compose --version docker-compose version 1.9.0-rc2, build d41f869 ```
Thanks for reporting. Haven't seen that one before. From a quick research, it seems that error usually appears when the client can not reach the server through the named pipe - any chance your Docker Engine might have errored out or been down during that test for some reason? Can you reproduce consistently? Thanks I can reproduce it. Tried today starting 6 services at once and got the same error. Docker engine does not show any errors in Event log. I also checked with ``` powershell iwr https://github.com/Microsoft/Virtualization-Documentation/raw/master/windows-server-container-tools/Debug-ContainerHost/Debug-ContainerHost.ps1 -UseBasicParsing | iex ``` Windows Defender is running with high CPU load in background. Trying to turn it off. @StefanScherer Thanks for the feedback. I'll try and reproduce. I identified the issue: docker/docker-py#1284 (Fix PR: docker/docker-py#1285)
2016-11-02T23:51:03Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "compose\cli\main.py", line 65, in main File "compose\cli\main.py", line 117, in perform_command File "compose\cli\main.py", line 849, in up File "compose\project.py", line 400, in up File "compose\parallel.py", line 64, in parallel_execute pywintypes.error: (121, 'WaitNamedPipe', 'The semaphore timeout period has expired.')
4,872
docker/compose
docker__compose-4113
9046e33ab2b303ee3103cdc694fff54614f58977
diff --git a/compose/config/config.py b/compose/config/config.py --- a/compose/config/config.py +++ b/compose/config/config.py @@ -771,7 +771,7 @@ def merge_service_dicts(base, override, version): for field in ['dns', 'dns_search', 'env_file', 'tmpfs']: md.merge_field(field, merge_list_or_string) - md.merge_field('logging', merge_logging) + md.merge_field('logging', merge_logging, default={}) for field in set(ALLOWED_KEYS) - set(md): md.merge_scalar(field)
docker-compose.yml merge broken when i want to merge two docker-compose.yml i get following error with the current beta 1.12.3-beta29.3 (619507e) docker-compose -f ../docker-compose.yml -f docker-compose.yml up myService ``` Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 65, in main File "compose/cli/main.py", line 114, in perform_command File "compose/cli/command.py", line 36, in project_from_options File "compose/cli/command.py", line 103, in get_project File "compose/config/config.py", line 323, in load File "compose/config/config.py", line 414, in load_services File "compose/config/config.py", line 405, in merge_services File "compose/config/config.py", line 405, in <dictcomp> File "compose/config/config.py", line 704, in merge_service_dicts_from_files File "compose/config/config.py", line 774, in merge_service_dicts File "compose/config/config.py", line 728, in merge_field File "compose/config/config.py", line 807, in merge_logging File "compose/config/config.py", line 749, in merge_scalar File "compose/config/config.py", line 720, in needs_merge TypeError: argument of type 'NoneType' is not iterable docker-compose returned -1 ``` diagnostic id: E9B25A88-ABE3-46AF-B578-39A426964940
Thanks for the report! Related: #4103
2016-11-03T23:30:22Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 65, in main File "compose/cli/main.py", line 114, in perform_command File "compose/cli/command.py", line 36, in project_from_options File "compose/cli/command.py", line 103, in get_project File "compose/config/config.py", line 323, in load File "compose/config/config.py", line 414, in load_services File "compose/config/config.py", line 405, in merge_services File "compose/config/config.py", line 405, in <dictcomp> File "compose/config/config.py", line 704, in merge_service_dicts_from_files File "compose/config/config.py", line 774, in merge_service_dicts File "compose/config/config.py", line 728, in merge_field File "compose/config/config.py", line 807, in merge_logging File "compose/config/config.py", line 749, in merge_scalar File "compose/config/config.py", line 720, in needs_merge TypeError: argument of type 'NoneType' is not iterable
4,874
docker/compose
docker__compose-4339
5ade097d74ddb192a5baefa75cfce6fbad5c20a7
diff --git a/compose/parallel.py b/compose/parallel.py --- a/compose/parallel.py +++ b/compose/parallel.py @@ -12,6 +12,8 @@ from six.moves.queue import Queue from compose.cli.signals import ShutdownException +from compose.errors import HealthCheckFailed +from compose.errors import NoHealthCheckConfigured from compose.errors import OperationFailedError from compose.utils import get_output_stream @@ -48,7 +50,7 @@ def parallel_execute(objects, func, get_name, msg, get_deps=None): elif isinstance(exception, APIError): errors[get_name(obj)] = exception.explanation writer.write(get_name(obj), 'error') - elif isinstance(exception, OperationFailedError): + elif isinstance(exception, (OperationFailedError, HealthCheckFailed, NoHealthCheckConfigured)): errors[get_name(obj)] = exception.msg writer.write(get_name(obj), 'error') elif isinstance(exception, UpstreamError): @@ -164,21 +166,27 @@ def feed_queue(objects, func, get_deps, results, state): for obj in pending: deps = get_deps(obj) - - if any(dep[0] in state.failed for dep in deps): - log.debug('{} has upstream errors - not processing'.format(obj)) - results.put((obj, None, UpstreamError())) - state.failed.add(obj) - elif all( - dep not in objects or ( - dep in state.finished and (not ready_check or ready_check(dep)) - ) for dep, ready_check in deps - ): - log.debug('Starting producer thread for {}'.format(obj)) - t = Thread(target=producer, args=(obj, func, results)) - t.daemon = True - t.start() - state.started.add(obj) + try: + if any(dep[0] in state.failed for dep in deps): + log.debug('{} has upstream errors - not processing'.format(obj)) + results.put((obj, None, UpstreamError())) + state.failed.add(obj) + elif all( + dep not in objects or ( + dep in state.finished and (not ready_check or ready_check(dep)) + ) for dep, ready_check in deps + ): + log.debug('Starting producer thread for {}'.format(obj)) + t = Thread(target=producer, args=(obj, func, results)) + t.daemon = True + t.start() + state.started.add(obj) + except (HealthCheckFailed, NoHealthCheckConfigured) as e: + log.debug( + 'Healthcheck for service(s) upstream of {} failed - ' + 'not processing'.format(obj) + ) + results.put((obj, None, e)) if state.is_done(): results.put(STOP)
Failed healthcheck raises uncaught exception and kills execution. Just testing out the new healthcheck feature in config v2.1 and ensuring my containers start in order via the `depends_on` however, intermittently, I get an error like this: ```sh $ docker-compose up Creating network "default" with the default driver Creating rabbitmq_1 Creating redis_1 Creating s3_1 Creating database_1 Creating elasticsearch_1 Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 64, in main File "compose/cli/main.py", line 116, in perform_command File "compose/cli/main.py", line 848, in up File "compose/project.py", line 410, in up File "compose/parallel.py", line 44, in parallel_execute File "compose/parallel.py", line 118, in parallel_execute_iter File "compose/parallel.py", line 175, in feed_queue File "compose/parallel.py", line 175, in <genexpr> File "compose/service.py", line 560, in <lambda> File "compose/service.py", line 920, in is_healthy compose.errors.HealthCheckFailed docker-compose returned -1 ``` This occurs when my database's healthcheck fails on startup. After doing some digging, it looks like exceptions raised in the [`is_healthy`](https://github.com/docker/compose/blob/bump-1.10.0-rc2/compose/service.py#L905-L921) method aren't being caught because they're called (as [`ready_check`](https://github.com/docker/compose/blob/bump-1.10.0-rc2/compose/parallel.py#L174)) outside the [`try..except` scope (inside `feed_queue`) in the `parralel_execute_iter` method](https://github.com/docker/compose/blob/bump-1.10.0-rc2/compose/parallel.py#L118-L126). Does that make sense? ``` $ docker --version Docker version 1.13.0-rc6, build 2f2d055 $ docker-compose --version docker-compose version 1.10.0-rc2, build fb241d0 ```
Thanks for the report! I'll look into it.
2017-01-17T21:23:15Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 64, in main File "compose/cli/main.py", line 116, in perform_command File "compose/cli/main.py", line 848, in up File "compose/project.py", line 410, in up File "compose/parallel.py", line 44, in parallel_execute File "compose/parallel.py", line 118, in parallel_execute_iter File "compose/parallel.py", line 175, in feed_queue File "compose/parallel.py", line 175, in <genexpr> File "compose/service.py", line 560, in <lambda> File "compose/service.py", line 920, in is_healthy compose.errors.HealthCheckFailed
4,884
docker/compose
docker__compose-4370
9a0962dacb786556e1b87b9c117010521eda2f85
diff --git a/compose/service.py b/compose/service.py --- a/compose/service.py +++ b/compose/service.py @@ -22,6 +22,7 @@ from .config import merge_environment from .config.types import VolumeSpec from .const import DEFAULT_TIMEOUT +from .const import IS_WINDOWS_PLATFORM from .const import LABEL_CONFIG_HASH from .const import LABEL_CONTAINER_NUMBER from .const import LABEL_ONE_OFF @@ -769,9 +770,9 @@ def build(self, no_cache=False, pull=False, force_rm=False): build_opts = self.options.get('build', {}) path = build_opts.get('context') - # python2 os.path() doesn't support unicode, so we need to encode it to - # a byte string - if not six.PY3: + # python2 os.stat() doesn't support unicode on some UNIX, so we + # encode it to a bytestring to be safe + if not six.PY3 and not IS_WINDOWS_PLATFORM: path = path.encode('utf8') build_output = self.client.build(
docker-compose cannot handle unicode file paths on Windows I've just hit this error: ``` Traceback (most recent call last): File "<string>", line 3, in <module> File "compose\cli\main.py", line 61, in main File "compose\cli\main.py", line 113, in perform_command File "compose\cli\main.py", line 219, in build File "compose\project.py", line 300, in build File "compose\service.py", line 727, in build File "site-packages\docker\api\build.py", line 54, in build File "site-packages\docker\utils\utils.py", line 103, in tar File "tarfile.py", line 2006, in add File "tarfile.py", line 1878, in gettarinfo WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\[redacted]\\?.jpg' ``` The actual file name is `∆.jpg` (don't ask why). This looks like the same issue in http://stackoverflow.com/questions/11545185/handling-utf-filenames-in-python
I've installed the project using Python 3.5.1 and it seems to be working without any issues. I am getting the above error in **Mac**: docker-compose -f /Users/saurabhsarkar/Documents/ASPNetCore/Console☃App/docker-compose.debug.yml down /var/folders/sj/k148ghk548v7b8lqf_4yd41m0000gn/T/_MEIpZB1OL/compose/config/config.py:222: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 61, in main File "compose/cli/main.py", line 110, in perform_command File "compose/cli/command.py", line 35, in project_from_options File "compose/cli/command.py", line 98, in get_project File "compose/config/config.py", line 234, in find UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 49: ordinal not in range(128) docker-compose returned -1 Installing Python 3.5.1 is not helping. _[using **docker-compose version 1.8.0, build f3628c7**]_ On **Windows** when I am running the command on Powershell or cmd: docker-compose -f "C:\Users\saurabsa\documents\visual studio 2015\Projects\WebApplication☃3\src\WebApplication☃3\docker-compose.yml" down its throwing the error: RROR: .IOError: [Errno 22] invalid mode ('r') or filename: 'C:\Users\saurabsa\documents\visual studio 2015\Projects\WeApplication?3\src\WebApplication?3\docker-compose.yml' _[using **docker-compose version 1.8.0, build d988a55**]_ same error here when I try build a project who mount a volume with a file with special character. `WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\\marci\\Documents\\GitHub\\Walletsaver\\bestarnew\\test\\data\\suggestion?067927c0-ad49-11e6-84cd-b797ecf45ea3.json` @BYK For a work around, how do you "install the project using Python 3.5.1"? @happiness801 it's been a long time but I think I did `pip install git+https://github.com/docker/compose.git`
2017-01-20T23:07:34Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "compose\cli\main.py", line 61, in main File "compose\cli\main.py", line 113, in perform_command File "compose\cli\main.py", line 219, in build File "compose\project.py", line 300, in build File "compose\service.py", line 727, in build File "site-packages\docker\api\build.py", line 54, in build File "site-packages\docker\utils\utils.py", line 103, in tar File "tarfile.py", line 2006, in add File "tarfile.py", line 1878, in gettarinfo WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\[redacted]\\?.jpg'
4,886
docker/compose
docker__compose-4383
e05a9f4e62d94322c3b504f134627840c1547d27
diff --git a/compose/cli/main.py b/compose/cli/main.py --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -14,6 +14,30 @@ from inspect import getdoc from operator import attrgetter + +# Attempt to detect https://github.com/docker/compose/issues/4344 +try: + # A regular import statement causes PyInstaller to freak out while + # trying to load pip. This way it is simply ignored. + pip = __import__('pip') + pip_packages = pip.get_installed_distributions() + if 'docker-py' in [pkg.project_name for pkg in pip_packages]: + from .colors import red + print( + red('ERROR:'), + "Dependency conflict: an older version of the 'docker-py' package " + "is polluting the namespace. " + "Run the following command to remedy the issue:\n" + "pip uninstall docker docker-py; pip install docker", + file=sys.stderr + ) + sys.exit(1) +except ImportError: + # pip is not available, which indicates it's probably the binary + # distribution of Compose which is not affected + pass + + from . import errors from . import signals from .. import __version__
`AttributeError: 'module' object has no attribute 'get_config_header'` after upgrading to 1.10 I had to manually remove `docker-py` and then reinstall `docker` and `docker-compose`: ``` ubuntu@ip-10-3-0-103:~$ docker-compose --version docker-compose version 1.9.0, build 2585387 ubuntu@ip-10-3-0-103:~$ docker-compose pull Pulling moo (ubuntu:latest)... latest: Pulling from library/ubuntu b3e1c725a85f: Pull complete 4daad8bdde31: Pull complete 63fe8c0068a8: Pull complete 4a70713c436f: Pull complete bd842a2105a8: Pull complete Digest: sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a Status: Downloaded newer image for ubuntu:latest ubuntu@ip-10-3-0-103:~$ sudo pip install -U docker-compose The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. SNIMissingWarning /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Collecting docker-compose Downloading docker_compose-1.10.0-py2.py3-none-any.whl (81kB) 100% |████████████████████████████████| 81kB 6.0MB/s Requirement already up-to-date: PyYAML<4,>=3.10 in /usr/local/lib/python2.7/dist-packages (from docker-compose) Requirement already up-to-date: websocket-client<1.0,>=0.32.0 in /usr/local/lib/python2.7/dist-packages (from docker-compose) Requirement already up-to-date: backports.ssl-match-hostname>=3.5; python_version < "3.5" in /usr/local/lib/python2.7/dist-packages (from docker-compose) Collecting docker<3.0,>=2.0.1 (from docker-compose) Downloading docker-2.0.1-py2.py3-none-any.whl (95kB) 100% |████████████████████████████████| 102kB 9.5MB/s Requirement already up-to-date: cached-property<2,>=1.2.0 in /usr/local/lib/python2.7/dist-packages (from docker-compose) Requirement already up-to-date: dockerpty<0.5,>=0.4.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose) Requirement already up-to-date: requests!=2.11.0,<2.12,>=2.6.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose) Requirement already up-to-date: ipaddress>=1.0.16; python_version < "3.3" in /usr/local/lib/python2.7/dist-packages (from docker-compose) Requirement already up-to-date: colorama<0.4,>=0.3.7 in /usr/local/lib/python2.7/dist-packages (from docker-compose) Requirement already up-to-date: enum34<2,>=1.0.4; python_version < "3.4" in /usr/local/lib/python2.7/dist-packages (from docker-compose) Requirement already up-to-date: six<2,>=1.3.0 in /usr/local/lib/python2.7/dist-packages (from docker-compose) Requirement already up-to-date: texttable<0.9,>=0.8.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose) Requirement already up-to-date: jsonschema<3,>=2.5.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose) Requirement already up-to-date: docopt<0.7,>=0.6.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose) Requirement already up-to-date: docker-pycreds>=0.2.1 in /usr/local/lib/python2.7/dist-packages (from docker<3.0,>=2.0.1->docker-compose) Requirement already up-to-date: functools32; python_version == "2.7" in /usr/local/lib/python2.7/dist-packages (from jsonschema<3,>=2.5.1->docker-compose) Installing collected packages: docker, docker-compose Found existing installation: docker-compose 1.9.0 Uninstalling docker-compose-1.9.0: Successfully uninstalled docker-compose-1.9.0 Successfully installed docker-2.0.1 docker-compose-1.10.0 /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning You are using pip version 8.1.2, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. ubuntu@ip-10-3-0-103:~$ docker-compose pull Pulling moo (ubuntu:latest)... Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 64, in main command() File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 116, in perform_command handler(command, command_options) File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 607, in pull ignore_pull_failures=options.get('--ignore-pull-failures') File "/usr/local/lib/python2.7/dist-packages/compose/project.py", line 453, in pull service.pull(ignore_pull_failures) File "/usr/local/lib/python2.7/dist-packages/compose/service.py", line 878, in pull output = self.client.pull(repo, tag=tag, stream=True) File "/usr/local/lib/python2.7/dist-packages/docker/api/image.py", line 333, in pull header = auth.get_config_header(self, registry) AttributeError: 'module' object has no attribute 'get_config_header' ubuntu@ip-10-3-0-103:~$ pip freeze | grep docker /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. SNIMissingWarning /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning You are using pip version 8.1.2, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. docker==2.0.1 docker-compose==1.10.0 docker-py==1.10.6 docker-pycreds==0.2.1 dockerpty==0.4.1 ubuntu@ip-10-3-0-103:~$ sudo pip uninstall docker-py The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Uninstalling docker-py-1.10.6: /usr/local/lib/python2.7/dist-packages/docker/__init__.py /usr/local/lib/python2.7/dist-packages/docker/__init__.pyc /usr/local/lib/python2.7/dist-packages/docker/api/__init__.py /usr/local/lib/python2.7/dist-packages/docker/api/__init__.pyc /usr/local/lib/python2.7/dist-packages/docker/api/build.py /usr/local/lib/python2.7/dist-packages/docker/api/build.pyc /usr/local/lib/python2.7/dist-packages/docker/api/container.py /usr/local/lib/python2.7/dist-packages/docker/api/container.pyc /usr/local/lib/python2.7/dist-packages/docker/api/daemon.py /usr/local/lib/python2.7/dist-packages/docker/api/daemon.pyc /usr/local/lib/python2.7/dist-packages/docker/api/exec_api.py /usr/local/lib/python2.7/dist-packages/docker/api/exec_api.pyc /usr/local/lib/python2.7/dist-packages/docker/api/image.py /usr/local/lib/python2.7/dist-packages/docker/api/image.pyc /usr/local/lib/python2.7/dist-packages/docker/api/network.py /usr/local/lib/python2.7/dist-packages/docker/api/network.pyc /usr/local/lib/python2.7/dist-packages/docker/api/service.py /usr/local/lib/python2.7/dist-packages/docker/api/service.pyc /usr/local/lib/python2.7/dist-packages/docker/api/swarm.py /usr/local/lib/python2.7/dist-packages/docker/api/swarm.pyc /usr/local/lib/python2.7/dist-packages/docker/api/volume.py /usr/local/lib/python2.7/dist-packages/docker/api/volume.pyc /usr/local/lib/python2.7/dist-packages/docker/auth/__init__.py /usr/local/lib/python2.7/dist-packages/docker/auth/__init__.pyc /usr/local/lib/python2.7/dist-packages/docker/auth/auth.py /usr/local/lib/python2.7/dist-packages/docker/auth/auth.pyc /usr/local/lib/python2.7/dist-packages/docker/client.py /usr/local/lib/python2.7/dist-packages/docker/client.pyc /usr/local/lib/python2.7/dist-packages/docker/constants.py /usr/local/lib/python2.7/dist-packages/docker/constants.pyc /usr/local/lib/python2.7/dist-packages/docker/errors.py /usr/local/lib/python2.7/dist-packages/docker/errors.pyc /usr/local/lib/python2.7/dist-packages/docker/ssladapter/__init__.py /usr/local/lib/python2.7/dist-packages/docker/ssladapter/__init__.pyc /usr/local/lib/python2.7/dist-packages/docker/ssladapter/ssladapter.py /usr/local/lib/python2.7/dist-packages/docker/ssladapter/ssladapter.pyc /usr/local/lib/python2.7/dist-packages/docker/tls.py /usr/local/lib/python2.7/dist-packages/docker/tls.pyc /usr/local/lib/python2.7/dist-packages/docker/transport/__init__.py /usr/local/lib/python2.7/dist-packages/docker/transport/__init__.pyc /usr/local/lib/python2.7/dist-packages/docker/transport/npipeconn.py /usr/local/lib/python2.7/dist-packages/docker/transport/npipeconn.pyc /usr/local/lib/python2.7/dist-packages/docker/transport/npipesocket.py /usr/local/lib/python2.7/dist-packages/docker/transport/npipesocket.pyc /usr/local/lib/python2.7/dist-packages/docker/transport/unixconn.py /usr/local/lib/python2.7/dist-packages/docker/transport/unixconn.pyc /usr/local/lib/python2.7/dist-packages/docker/types/__init__.py /usr/local/lib/python2.7/dist-packages/docker/types/__init__.pyc /usr/local/lib/python2.7/dist-packages/docker/types/base.py /usr/local/lib/python2.7/dist-packages/docker/types/base.pyc /usr/local/lib/python2.7/dist-packages/docker/types/containers.py /usr/local/lib/python2.7/dist-packages/docker/types/containers.pyc /usr/local/lib/python2.7/dist-packages/docker/types/services.py /usr/local/lib/python2.7/dist-packages/docker/types/services.pyc /usr/local/lib/python2.7/dist-packages/docker/types/swarm.py /usr/local/lib/python2.7/dist-packages/docker/types/swarm.pyc /usr/local/lib/python2.7/dist-packages/docker/utils/__init__.py /usr/local/lib/python2.7/dist-packages/docker/utils/__init__.pyc /usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py /usr/local/lib/python2.7/dist-packages/docker/utils/decorators.pyc /usr/local/lib/python2.7/dist-packages/docker/utils/ports/__init__.py /usr/local/lib/python2.7/dist-packages/docker/utils/ports/__init__.pyc /usr/local/lib/python2.7/dist-packages/docker/utils/ports/ports.py /usr/local/lib/python2.7/dist-packages/docker/utils/ports/ports.pyc /usr/local/lib/python2.7/dist-packages/docker/utils/socket.py /usr/local/lib/python2.7/dist-packages/docker/utils/socket.pyc /usr/local/lib/python2.7/dist-packages/docker/utils/types.py /usr/local/lib/python2.7/dist-packages/docker/utils/types.pyc /usr/local/lib/python2.7/dist-packages/docker/utils/utils.py /usr/local/lib/python2.7/dist-packages/docker/utils/utils.pyc /usr/local/lib/python2.7/dist-packages/docker/version.py /usr/local/lib/python2.7/dist-packages/docker/version.pyc /usr/local/lib/python2.7/dist-packages/docker_py-1.10.6.dist-info/DESCRIPTION.rst /usr/local/lib/python2.7/dist-packages/docker_py-1.10.6.dist-info/INSTALLER /usr/local/lib/python2.7/dist-packages/docker_py-1.10.6.dist-info/METADATA /usr/local/lib/python2.7/dist-packages/docker_py-1.10.6.dist-info/RECORD /usr/local/lib/python2.7/dist-packages/docker_py-1.10.6.dist-info/WHEEL /usr/local/lib/python2.7/dist-packages/docker_py-1.10.6.dist-info/metadata.json /usr/local/lib/python2.7/dist-packages/docker_py-1.10.6.dist-info/top_level.txt Proceed (y/n)? y Successfully uninstalled docker-py-1.10.6 The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. You are using pip version 8.1.2, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. ubuntu@ip-10-3-0-103:~$ sudo pip install --force -U docker-compose docker The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting docker-compose /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. SNIMissingWarning /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Downloading docker_compose-1.10.0-py2.py3-none-any.whl (81kB) 100% |████████████████████████████████| 81kB 6.9MB/s Collecting docker Downloading docker-2.0.1-py2.py3-none-any.whl (95kB) 100% |████████████████████████████████| 102kB 10.3MB/s Collecting PyYAML<4,>=3.10 (from docker-compose) Downloading PyYAML-3.12.tar.gz (253kB) 100% |████████████████████████████████| 256kB 4.6MB/s Collecting websocket-client<1.0,>=0.32.0 (from docker-compose) Downloading websocket_client-0.40.0.tar.gz (196kB) 100% |████████████████████████████████| 204kB 6.0MB/s Collecting backports.ssl-match-hostname>=3.5; python_version < "3.5" (from docker-compose) Downloading backports.ssl_match_hostname-3.5.0.1.tar.gz Collecting cached-property<2,>=1.2.0 (from docker-compose) Downloading cached_property-1.3.0-py2.py3-none-any.whl Collecting dockerpty<0.5,>=0.4.1 (from docker-compose) Downloading dockerpty-0.4.1.tar.gz Collecting requests!=2.11.0,<2.12,>=2.6.1 (from docker-compose) Downloading requests-2.11.1-py2.py3-none-any.whl (514kB) 100% |████████████████████████████████| 522kB 2.5MB/s Collecting ipaddress>=1.0.16; python_version < "3.3" (from docker-compose) Downloading ipaddress-1.0.18-py2-none-any.whl Collecting colorama<0.4,>=0.3.7 (from docker-compose) Downloading colorama-0.3.7-py2.py3-none-any.whl Collecting enum34<2,>=1.0.4; python_version < "3.4" (from docker-compose) Downloading enum34-1.1.6-py2-none-any.whl Collecting six<2,>=1.3.0 (from docker-compose) Downloading six-1.10.0-py2.py3-none-any.whl Collecting texttable<0.9,>=0.8.1 (from docker-compose) Downloading texttable-0.8.7.tar.gz Collecting jsonschema<3,>=2.5.1 (from docker-compose) Downloading jsonschema-2.5.1-py2.py3-none-any.whl Collecting docopt<0.7,>=0.6.1 (from docker-compose) Downloading docopt-0.6.2.tar.gz Collecting docker-pycreds>=0.2.1 (from docker) Downloading docker_pycreds-0.2.1-py2.py3-none-any.whl Collecting functools32; python_version == "2.7" (from jsonschema<3,>=2.5.1->docker-compose) Downloading functools32-3.2.3-2.zip Installing collected packages: PyYAML, six, backports.ssl-match-hostname, websocket-client, ipaddress, requests, docker-pycreds, docker, cached-property, dockerpty, colorama, enum34, texttable, functools32, jsonschema, docopt, docker-compose Found existing installation: PyYAML 3.12 Uninstalling PyYAML-3.12: Successfully uninstalled PyYAML-3.12 Running setup.py install for PyYAML ... done Found existing installation: six 1.10.0 Uninstalling six-1.10.0: Successfully uninstalled six-1.10.0 Found existing installation: backports.ssl-match-hostname 3.5.0.1 Uninstalling backports.ssl-match-hostname-3.5.0.1: Successfully uninstalled backports.ssl-match-hostname-3.5.0.1 Running setup.py install for backports.ssl-match-hostname ... done Found existing installation: websocket-client 0.40.0 Uninstalling websocket-client-0.40.0: Successfully uninstalled websocket-client-0.40.0 Running setup.py install for websocket-client ... done Found existing installation: ipaddress 1.0.18 Uninstalling ipaddress-1.0.18: Successfully uninstalled ipaddress-1.0.18 Found existing installation: requests 2.11.1 Uninstalling requests-2.11.1: Successfully uninstalled requests-2.11.1 Found existing installation: docker-pycreds 0.2.1 Uninstalling docker-pycreds-0.2.1: Successfully uninstalled docker-pycreds-0.2.1 Found existing installation: docker 2.0.1 Uninstalling docker-2.0.1: Successfully uninstalled docker-2.0.1 Found existing installation: cached-property 1.3.0 Uninstalling cached-property-1.3.0: Successfully uninstalled cached-property-1.3.0 Found existing installation: dockerpty 0.4.1 Uninstalling dockerpty-0.4.1: Successfully uninstalled dockerpty-0.4.1 Running setup.py install for dockerpty ... done Found existing installation: colorama 0.3.7 Uninstalling colorama-0.3.7: Successfully uninstalled colorama-0.3.7 Found existing installation: enum34 1.1.6 Uninstalling enum34-1.1.6: Successfully uninstalled enum34-1.1.6 Found existing installation: texttable 0.8.7 Uninstalling texttable-0.8.7: Successfully uninstalled texttable-0.8.7 Running setup.py install for texttable ... done Found existing installation: functools32 3.2.3.post2 Uninstalling functools32-3.2.3.post2: Successfully uninstalled functools32-3.2.3.post2 Running setup.py install for functools32 ... done Found existing installation: jsonschema 2.5.1 Uninstalling jsonschema-2.5.1: Successfully uninstalled jsonschema-2.5.1 Found existing installation: docopt 0.6.2 Uninstalling docopt-0.6.2: Successfully uninstalled docopt-0.6.2 Running setup.py install for docopt ... done Found existing installation: docker-compose 1.10.0 Uninstalling docker-compose-1.10.0: Successfully uninstalled docker-compose-1.10.0 Successfully installed PyYAML-3.12 backports.ssl-match-hostname-3.5.0.1 cached-property-1.3.0 colorama-0.3.7 docker-2.0.1 docker-compose-1.10.0 docker-pycreds-0.2.1 dockerpty-0.4.1 docopt-0.6.2 enum34-1.1.6 functools32-3.2.3.post2 ipaddress-1.0.18 jsonschema-2.5.1 requests-2.11.1 six-1.10.0 texttable-0.8.7 websocket-client-0.40.0 You are using pip version 8.1.2, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. ubuntu@ip-10-3-0-103:~$ docker-compose pull Pulling moo (ubuntu:latest)... latest: Pulling from library/ubuntu Digest: sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a Status: Image is up to date for ubuntu:latest ubuntu@ip-10-3-0-103:~$ ```
I should note that this is on Ubuntu 14.04 You'll have to uninstall `docker-py` to avoid name conflict issues. For people in need of a solution: ``` pip uninstall docker docker-py ; pip install docker==2.0.1 ``` We should have a fix coming in the next few days.
2017-01-24T23:05:34Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 64, in main command() File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 116, in perform_command handler(command, command_options) File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 607, in pull ignore_pull_failures=options.get('--ignore-pull-failures') File "/usr/local/lib/python2.7/dist-packages/compose/project.py", line 453, in pull service.pull(ignore_pull_failures) File "/usr/local/lib/python2.7/dist-packages/compose/service.py", line 878, in pull output = self.client.pull(repo, tag=tag, stream=True) File "/usr/local/lib/python2.7/dist-packages/docker/api/image.py", line 333, in pull header = auth.get_config_header(self, registry) AttributeError: 'module' object has no attribute 'get_config_header'
4,887
docker/compose
docker__compose-442
6dab8c1b8932ec1a9de3c2fb22d97bc0aae0d9c4
diff --git a/fig/cli/formatter.py b/fig/cli/formatter.py --- a/fig/cli/formatter.py +++ b/fig/cli/formatter.py @@ -9,7 +9,7 @@ def get_tty_width(): if len(tty_size) != 2: return 80 _, width = tty_size - return width + return int(width) class Formatter(object): diff --git a/fig/service.py b/fig/service.py --- a/fig/service.py +++ b/fig/service.py @@ -1,5 +1,6 @@ from __future__ import unicode_literals from __future__ import absolute_import +from collections import namedtuple from .packages.docker.errors import APIError import logging import re @@ -39,6 +40,9 @@ class ConfigError(ValueError): pass +VolumeSpec = namedtuple('VolumeSpec', 'external internal mode') + + class Service(object): def __init__(self, name, client=None, project='default', links=None, volumes_from=None, **options): if not re.match('^%s+$' % VALID_NAME_CHARS, name): @@ -214,37 +218,22 @@ def start_container_if_stopped(self, container, **options): return self.start_container(container, **options) def start_container(self, container=None, intermediate_container=None, **override_options): - if container is None: - container = self.create_container(**override_options) - - options = self.options.copy() - options.update(override_options) - - port_bindings = {} + container = container or self.create_container(**override_options) + options = dict(self.options, **override_options) + ports = dict(split_port(port) for port in options.get('ports') or []) - if options.get('ports', None) is not None: - for port in options['ports']: - internal_port, external_port = split_port(port) - port_bindings[internal_port] = external_port - - volume_bindings = {} - - if options.get('volumes', None) is not None: - for volume in options['volumes']: - if ':' in volume: - external_dir, internal_dir = volume.split(':') - volume_bindings[os.path.abspath(external_dir)] = { - 'bind': internal_dir, - 'ro': False, - } + volume_bindings = dict( + build_volume_binding(parse_volume_spec(volume)) + for volume in options.get('volumes') or [] + if ':' in volume) privileged = options.get('privileged', False) net = options.get('net', 'bridge') dns = options.get('dns', None) container.start( - links=self._get_links(link_to_self=override_options.get('one_off', False)), - port_bindings=port_bindings, + links=self._get_links(link_to_self=options.get('one_off', False)), + port_bindings=ports, binds=volume_bindings, volumes_from=self._get_volumes_from(intermediate_container), privileged=privileged, @@ -256,7 +245,7 @@ def start_container(self, container=None, intermediate_container=None, **overrid def start_or_create_containers(self): containers = self.containers(stopped=True) - if len(containers) == 0: + if not containers: log.info("Creating %s..." % self.next_container_name()) new_container = self.create_container() return [self.start_container(new_container)] @@ -338,7 +327,9 @@ def _get_container_create_options(self, override_options, one_off=False): container_options['ports'] = ports if 'volumes' in container_options: - container_options['volumes'] = dict((split_volume(v)[1], {}) for v in container_options['volumes']) + container_options['volumes'] = dict( + (parse_volume_spec(v).internal, {}) + for v in container_options['volumes']) if 'environment' in container_options: if isinstance(container_options['environment'], list): @@ -433,32 +424,47 @@ def get_container_name(container): return name[1:] -def split_volume(v): - """ - If v is of the format EXTERNAL:INTERNAL, returns (EXTERNAL, INTERNAL). - If v is of the format INTERNAL, returns (None, INTERNAL). - """ - if ':' in v: - return v.split(':', 1) - else: - return (None, v) +def parse_volume_spec(volume_config): + parts = volume_config.split(':') + if len(parts) > 3: + raise ConfigError("Volume %s has incorrect format, should be " + "external:internal[:mode]" % volume_config) + + if len(parts) == 1: + return VolumeSpec(None, parts[0], 'rw') + + if len(parts) == 2: + parts.append('rw') + + external, internal, mode = parts + if mode not in ('rw', 'ro'): + raise ConfigError("Volume %s has invalid mode (%s), should be " + "one of: rw, ro." % (volume_config, mode)) + + return VolumeSpec(external, internal, mode) + + +def build_volume_binding(volume_spec): + internal = {'bind': volume_spec.internal, 'ro': volume_spec.mode == 'ro'} + external = os.path.expanduser(volume_spec.external) + return os.path.abspath(os.path.expandvars(external)), internal def split_port(port): - port = str(port) - external_ip = None - if ':' in port: - external_port, internal_port = port.rsplit(':', 1) - if ':' in external_port: - external_ip, external_port = external_port.split(':', 1) - else: - external_port, internal_port = (None, port) - if external_ip: - if external_port: - external_port = (external_ip, external_port) - else: - external_port = (external_ip,) - return internal_port, external_port + parts = str(port).split(':') + if not 1 <= len(parts) <= 3: + raise ConfigError('Invalid port "%s", should be ' + '[[remote_ip:]remote_port:]port[/protocol]' % port) + + if len(parts) == 1: + internal_port, = parts + return internal_port, None + if len(parts) == 2: + external_port, internal_port = parts + return internal_port, external_port + + external_ip, external_port, internal_port = parts + return internal_port, (external_ip, external_port or None) def split_env(env):
Error when specifying permission in volume ``` root@dev-stats-web:~# fig up Recreating root_statssymfony_1... Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==0.4.2', 'console_scripts', 'fig')() File "/usr/local/lib/python2.7/dist-packages/fig/cli/main.py", line 39, in main command.sys_dispatch() File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/lib/python2.7/dist-packages/fig/cli/command.py", line 31, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/lib/python2.7/dist-packages/fig/cli/command.py", line 50, in perform_command return super(Command, self).perform_command(options, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 27, in perform_command handler(command_options) File "/usr/local/lib/python2.7/dist-packages/fig/cli/main.py", line 306, in up to_attach = self.project.up(service_names=options['SERVICE']) File "/usr/local/lib/python2.7/dist-packages/fig/project.py", line 131, in up for (_, new) in service.recreate_containers(): File "/usr/local/lib/python2.7/dist-packages/fig/service.py", line 173, in recreate_containers tuples.append(self.recreate_container(c, **override_options)) File "/usr/local/lib/python2.7/dist-packages/fig/service.py", line 195, in recreate_container self.start_container(new_container, volumes_from=intermediate_container.id) File "/usr/local/lib/python2.7/dist-packages/fig/service.py", line 225, in start_container external_dir, internal_dir = volume.split(':') ValueError: too many values to unpack ``` Took me a while to figure out I'd added `:rw` to the fig.yml ``` volumes: - stats-symfony/logs:/var/log/nginx:rw ``` Would be good idea to add a warning, or support it.
Added to #129. How do we specify :ro to the fig.yml for volumes How do we specify :ro to the fig.yml for volumes http://stackoverflow.com/questions/25385164/how-to-specify-write-access-to-volume-with-fig +1
2014-08-24T23:05:39Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==0.4.2', 'console_scripts', 'fig')() File "/usr/local/lib/python2.7/dist-packages/fig/cli/main.py", line 39, in main command.sys_dispatch() File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/usr/local/lib/python2.7/dist-packages/fig/cli/command.py", line 31, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/usr/local/lib/python2.7/dist-packages/fig/cli/command.py", line 50, in perform_command return super(Command, self).perform_command(options, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 27, in perform_command handler(command_options) File "/usr/local/lib/python2.7/dist-packages/fig/cli/main.py", line 306, in up to_attach = self.project.up(service_names=options['SERVICE']) File "/usr/local/lib/python2.7/dist-packages/fig/project.py", line 131, in up for (_, new) in service.recreate_containers(): File "/usr/local/lib/python2.7/dist-packages/fig/service.py", line 173, in recreate_containers tuples.append(self.recreate_container(c, **override_options)) File "/usr/local/lib/python2.7/dist-packages/fig/service.py", line 195, in recreate_container self.start_container(new_container, volumes_from=intermediate_container.id) File "/usr/local/lib/python2.7/dist-packages/fig/service.py", line 225, in start_container external_dir, internal_dir = volume.split(':') ValueError: too many values to unpack
4,892
docker/compose
docker__compose-4469
1fe24437350d11a9e1b6483839cb72a6f8f2fbf2
diff --git a/compose/config/config.py b/compose/config/config.py --- a/compose/config/config.py +++ b/compose/config/config.py @@ -763,6 +763,11 @@ def finalize_service(service_config, service_names, version, environment): if 'restart' in service_dict: service_dict['restart'] = parse_restart_spec(service_dict['restart']) + if 'secrets' in service_dict: + service_dict['secrets'] = [ + types.ServiceSecret.parse(s) for s in service_dict['secrets'] + ] + normalize_build(service_dict, service_config.working_dir, environment) service_dict['name'] = service_config.name diff --git a/compose/config/types.py b/compose/config/types.py --- a/compose/config/types.py +++ b/compose/config/types.py @@ -253,3 +253,11 @@ def parse(cls, spec): @property def merge_field(self): return self.source + + def repr(self): + return dict( + source=self.source, + target=self.target, + uid=self.uid, + gid=self.gid, + mode=self.mode) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import +from __future__ import print_function from __future__ import unicode_literals import codecs -import logging import os import re import sys @@ -64,11 +64,9 @@ def find_version(*file_paths): for key, value in extras_require.items(): if key.startswith(':') and pkg_resources.evaluate_marker(key[1:]): install_requires.extend(value) -except Exception: - logging.getLogger(__name__).exception( - 'Failed to compute platform dependencies. All dependencies will be ' - 'installed as a result.' - ) +except Exception as e: + print("Failed to compute platform dependencies: {}. ".format(e) + + "All dependencies will be installed as a result.", file=sys.stderr) for key, value in extras_require.items(): if key.startswith(':'): install_requires.extend(value)
docker-compose fails if using secrets file ## Environment ``` $ docker --version Docker version 1.13.1, build 092cba3 $ docker-compose --version docker-compose version 1.11.1, build 7c5d5e4 ``` ## Steps to reproduce ``` $ ls docker-compose.yml my_file_secret.txt $ cat my_file_secret.txt This is a file secret. $ cat docker-compose.yml version: '3.1' services: a: image: tutum/hello-world b: image: tutum/hello-world secrets: - my_file_secret secrets: my_file_secret: file: my_file_secret.txt ``` ``` $ docker-compose up Traceback (most recent call last): File "docker-compose", line 3, in <module> File "compose/cli/main.py", line 88, in main File "compose/cli/main.py", line 137, in perform_command File "compose/cli/command.py", line 36, in project_from_options File "compose/cli/command.py", line 115, in get_project File "compose/project.py", line 110, in from_config File "compose/project.py", line 566, in get_secrets AttributeError: 'str' object has no attribute 'source' Failed to execute script docker-compose ```
@arielelkin Does it work if you rewrite `b` as below? ```yaml b: image: tutum/hello-world secrets: - source: my_file_secret ``` cc @dnephin
2017-02-10T22:13:04Z
[]
[]
Traceback (most recent call last): File "docker-compose", line 3, in <module> File "compose/cli/main.py", line 88, in main File "compose/cli/main.py", line 137, in perform_command File "compose/cli/command.py", line 36, in project_from_options File "compose/cli/command.py", line 115, in get_project File "compose/project.py", line 110, in from_config File "compose/project.py", line 566, in get_secrets AttributeError: 'str' object has no attribute 'source'
4,893
docker/compose
docker__compose-4480
bb5d7b2433eec26c1bbd0880648cedfb903d45ad
diff --git a/compose/config/serialize.py b/compose/config/serialize.py --- a/compose/config/serialize.py +++ b/compose/config/serialize.py @@ -102,4 +102,7 @@ def denormalize_service_dict(service_dict, version): service_dict['healthcheck']['timeout'] ) + if 'secrets' in service_dict: + service_dict['secrets'] = map(lambda s: s.repr(), service_dict['secrets']) + return service_dict diff --git a/compose/config/types.py b/compose/config/types.py --- a/compose/config/types.py +++ b/compose/config/types.py @@ -256,8 +256,5 @@ def merge_field(self): def repr(self): return dict( - source=self.source, - target=self.target, - uid=self.uid, - gid=self.gid, - mode=self.mode) + [(k, v) for k, v in self._asdict().items() if v is not None] + )
Secrets combined with override file results in stacktrace I have a `docker-compose.yml` and `docker-compose.override.yml` both using the `3.1` compose format. Adding secrets to the first yml seems to break the yaml interpolation so any attempt to bring up the stack or check the config results in a stack trace ``` $ docker-compose config Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/site-packages/compose/cli/main.py", line 88, in main command() File "/usr/local/lib/python2.7/site-packages/compose/cli/main.py", line 134, in perform_command handler(command, options, command_options) File "/usr/local/lib/python2.7/site-packages/compose/cli/main.py", line 330, in config compose_config = get_config_from_options(self.project_dir, config_options) File "/usr/local/lib/python2.7/site-packages/compose/cli/command.py", line 46, in get_config_from_options config.find(base_dir, config_path, environment) File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 333, in load service_dicts = load_services(config_details, main_file) File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 455, in load_services service_config = merge_services(service_config, next_config) File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 446, in merge_services for name in all_service_names File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 446, in <dictcomp> for name in all_service_names File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 797, in merge_service_dicts_from_files new_service = merge_service_dicts(base, override, version) File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 856, in merge_service_dicts md.merge_sequence('secrets', types.ServiceSecret.parse) File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 839, in merge_sequence self[field] = [item.repr() for item in sorted(merged.values())] AttributeError: 'ServiceSecret' object has no attribute 'repr' $ ``` I am running `docker-compose version 1.11.1, build 7c5d5e4`
cc @dnephin
2017-02-14T00:07:11Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/site-packages/compose/cli/main.py", line 88, in main command() File "/usr/local/lib/python2.7/site-packages/compose/cli/main.py", line 134, in perform_command handler(command, options, command_options) File "/usr/local/lib/python2.7/site-packages/compose/cli/main.py", line 330, in config compose_config = get_config_from_options(self.project_dir, config_options) File "/usr/local/lib/python2.7/site-packages/compose/cli/command.py", line 46, in get_config_from_options config.find(base_dir, config_path, environment) File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 333, in load service_dicts = load_services(config_details, main_file) File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 455, in load_services service_config = merge_services(service_config, next_config) File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 446, in merge_services for name in all_service_names File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 446, in <dictcomp> for name in all_service_names File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 797, in merge_service_dicts_from_files new_service = merge_service_dicts(base, override, version) File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 856, in merge_service_dicts md.merge_sequence('secrets', types.ServiceSecret.parse) File "/usr/local/lib/python2.7/site-packages/compose/config/config.py", line 839, in merge_sequence self[field] = [item.repr() for item in sorted(merged.values())] AttributeError: 'ServiceSecret' object has no attribute 'repr'
4,894
docker/compose
docker__compose-4484
40c26ca6766cc78ac0f4d24f3faa3c8f9e89a7ba
diff --git a/compose/cli/__init__.py b/compose/cli/__init__.py --- a/compose/cli/__init__.py +++ b/compose/cli/__init__.py @@ -0,0 +1,37 @@ +from __future__ import absolute_import +from __future__ import print_function +from __future__ import unicode_literals + +import subprocess +import sys + +# Attempt to detect https://github.com/docker/compose/issues/4344 +try: + # We don't try importing pip because it messes with package imports + # on some Linux distros (Ubuntu, Fedora) + # https://github.com/docker/compose/issues/4425 + # https://github.com/docker/compose/issues/4481 + # https://github.com/pypa/pip/blob/master/pip/_vendor/__init__.py + s_cmd = subprocess.Popen( + ['pip', 'freeze'], stderr=subprocess.PIPE, stdout=subprocess.PIPE + ) + packages = s_cmd.communicate()[0].splitlines() + dockerpy_installed = len( + list(filter(lambda p: p.startswith(b'docker-py=='), packages)) + ) > 0 + if dockerpy_installed: + from .colors import red + print( + red('ERROR:'), + "Dependency conflict: an older version of the 'docker-py' package " + "is polluting the namespace. " + "Run the following command to remedy the issue:\n" + "pip uninstall docker docker-py; pip install docker", + file=sys.stderr + ) + sys.exit(1) + +except OSError: + # pip command is not available, which indicates it's probably the binary + # distribution of Compose which is not affected + pass diff --git a/compose/cli/main.py b/compose/cli/main.py --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -14,30 +14,6 @@ from inspect import getdoc from operator import attrgetter - -# Attempt to detect https://github.com/docker/compose/issues/4344 -try: - # A regular import statement causes PyInstaller to freak out while - # trying to load pip. This way it is simply ignored. - pip = __import__('pip') - pip_packages = pip.get_installed_distributions() - if 'docker-py' in [pkg.project_name for pkg in pip_packages]: - from .colors import red - print( - red('ERROR:'), - "Dependency conflict: an older version of the 'docker-py' package " - "is polluting the namespace. " - "Run the following command to remedy the issue:\n" - "pip uninstall docker docker-py; pip install docker", - file=sys.stderr - ) - sys.exit(1) -except ImportError: - # pip is not available, which indicates it's probably the binary - # distribution of Compose which is not affected - pass - - from . import errors from . import signals from .. import __version__
Exception on 404 when using the HTTP interface directly Hi guys. I've been struggling with a weird issue: ``` compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- (u'mytest_default') Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 88, in main command() File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 140, in perform_command handler(command, command_options) File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 900, in up remove_orphans=remove_orphans) File "/usr/local/lib/python2.7/dist-packages/compose/project.py", line 387, in up self.initialize() File "/usr/local/lib/python2.7/dist-packages/compose/project.py", line 431, in initialize self.networks.initialize() File "/usr/local/lib/python2.7/dist-packages/compose/network.py", line 203, in initialize network.ensure() File "/usr/local/lib/python2.7/dist-packages/compose/network.py", line 59, in ensure data = self.inspect() File "/usr/local/lib/python2.7/dist-packages/compose/network.py", line 91, in inspect return self.client.inspect_network(self.full_name) File "/usr/local/lib/python2.7/dist-packages/compose/cli/verbose_proxy.py", line 55, in proxy_callable result = getattr(self.obj, call_name)(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 35, in wrapper return f(self, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/docker/api/network.py", line 158, in inspect_network return self._result(res, json=True) File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 216, in _result self._raise_for_status(response) File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 210, in _raise_for_status response.raise_for_status() File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/models.py", line 840, in raise_for_status requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://docker:2375/v1.25/networks/baseagent_default ``` From the looks of it, the client fails to recover from a 404 (an expected one, the network `mytest_default` doesn't exist yet. I have been able to create a more self-contained test to reproduce the error (spoiler alert it relies on dind, but that should be irrelevant): https://github.com/ColinHebert/compose-404 It may sound a bit convoluted but here is what's happening: - docker-compose.yaml starts two containers, the first one is dind (the one we're going to test against through http). It uses privileges to run docker properly. - The second container runs a docker container "client" which is an ubuntu box with docker-compose installed. The client container is linked to dind container and has the env variable `DOCKER_HOST=docker:2375` (meaning that docker commands run inside this container are going straight to dind - When starting the client container, we attempt to run docker-compose which ends up failing on the 404. I'm not 100% across the reason why the HTTP 404 bubbles up in my case. When running against a socket (albeit a different environment), the 404 gets caught properly ending with: ```pip._vendor.requests.packages.urllib3.connectionpool._make_request: "GET /v1.25/networks/mytest_default HTTP/1.1" 404 50```
After more testing, it seems that the problem was introduce between `1.10.0` and `1.10.1`. (Tested changing `RUN pip install docker-compose` into `RUN pip install docker-compose==1.10.0` in the Dockerfile) which is when docker-py 2.0.2 was introduced... The search continues... EDIT: checking the dependencies when it works and when it doesn't docker-py's version doesn't have any effect. Actually the version of the dependencies are the same between 1.10.0 and 1.10.1 (due to the use of ranges). That was a red herring. So something else in https://github.com/docker/compose/compare/1.10.0...1.10.1 is the cause of this :/ @ColinHebert If you use 1.10.0 in combination with `docker==2.0.2`, you don't get the issue? Indeed, I thought it was docker-py 2.0.2 as well, but it clearly isn't the case. I've been staring at the diff between 1.10.0 and 1.10.1 in github and nothing in there seems to be relevant to the problem Here's a pip freeze with 1.10.1 (failing with 404): ``` client_1 | backports.ssl-match-hostname==3.5.0.1 client_1 | cached-property==1.3.0 client_1 | colorama==0.3.7 client_1 | docker==2.0.2 client_1 | docker-compose==1.10.1 client_1 | docker-pycreds==0.2.1 client_1 | dockerpty==0.4.1 client_1 | docopt==0.6.2 client_1 | enum34==1.1.6 client_1 | functools32==3.2.3.post2 client_1 | ipaddress==1.0.18 client_1 | jsonschema==2.6.0 client_1 | PyYAML==3.12 client_1 | requests==2.11.1 client_1 | six==1.10.0 client_1 | texttable==0.8.7 client_1 | websocket-client==0.40.0 ``` And with 1.10.0 (successfully running): ``` client_1 | backports.ssl-match-hostname==3.5.0.1 client_1 | cached-property==1.3.0 client_1 | colorama==0.3.7 client_1 | docker==2.0.2 client_1 | docker-compose==1.10.0 client_1 | docker-pycreds==0.2.1 client_1 | dockerpty==0.4.1 client_1 | docopt==0.6.2 client_1 | enum34==1.1.6 client_1 | functools32==3.2.3.post2 client_1 | ipaddress==1.0.18 client_1 | jsonschema==2.6.0 client_1 | PyYAML==3.12 client_1 | requests==2.11.1 client_1 | six==1.10.0 client_1 | texttable==0.8.7 client_1 | websocket-client==0.40.0 ``` Okay, after attempts to reintroduce the problem by adding changes one by one, it seems that the cause is this: ``` # Attempt to detect https://github.com/docker/compose/issues/4344 try: # A regular import statement causes PyInstaller to freak out while # trying to load pip. This way it is simply ignored. pip = __import__('pip') pip_packages = pip.get_installed_distributions() if 'docker-py' in [pkg.project_name for pkg in pip_packages]: from .colors import red print( red('ERROR:'), "Dependency conflict: an older version of the 'docker-py' package " "is polluting the namespace. " "Run the following command to remedy the issue:\n" "pip uninstall docker docker-py; pip install docker", file=sys.stderr ) sys.exit(1) except ImportError: # pip is not available, which indicates it's probably the binary # distribution of Compose which is not affected pass ``` EDIT: Attempted to add this change and only that change. Indeed this is the bit of code causing trouble. I narrowed it down to the `pip = __import__('pip')` alone. This is outside of my domain of expertise now, but this line alone is causing some trouble :/ I found a temporary "fix" submitted to your reproduction case: ColinHebert/compose-404#1 It looks like the pip import confuses things, and this issue looks like another symptom of the one described in #4425 If you have a chance, please test the potential fix in #4484 The fix doesn't seem to work. I tried to reduce it to just running ``` original_sys_path = sys.path[:] print(sys.path[:]) pip = __import__('pip') print(sys.path[:]) sys.path[:] = original_sys_path print(sys.path[:]) ``` And it prints out the following: ``` ['/usr/local/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages'] ['/usr/share/python-wheels/ipaddress-0.0.0-py2.py3-none-any.whl', '/usr/share/python-wheels/pyparsing-2.0.3-py2.py3-none-any.whl', '/usr/share/python-wheels/packaging-16.6-py2.py3-none-any.whl', '/usr/share/python-wheels/chardet-2.3.0-py2.py3-none-any.whl', '/usr/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl', '/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl', '/usr/share/python-wheels/setuptools-20.7.0-py2.py3-none-any.whl', '/usr/share/python-wheels/wheel-0.29.0-py2.py3-none-any.whl', '/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl', '/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl', '/usr/share/python-wheels/progress-1.2-py2.py3-none-any.whl', '/usr/share/python-wheels/colorama-0.3.7-py2.py3-none-any.whl', '/usr/share/python-wheels/distlib-0.2.2-py2.py3-none-any.whl', '/usr/share/python-wheels/six-1.10.0-py2.py3-none-any.whl', '/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl', '/usr/share/python-wheels/html5lib-0.999-py2.py3-none-any.whl', '/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl', '/usr/share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl', '/usr/local/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages'] ['/usr/local/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages'] ``` I think we're on the right tracks, but there might be another side effect.
2017-02-14T23:51:05Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 88, in main command() File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 140, in perform_command handler(command, command_options) File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 900, in up remove_orphans=remove_orphans) File "/usr/local/lib/python2.7/dist-packages/compose/project.py", line 387, in up self.initialize() File "/usr/local/lib/python2.7/dist-packages/compose/project.py", line 431, in initialize self.networks.initialize() File "/usr/local/lib/python2.7/dist-packages/compose/network.py", line 203, in initialize network.ensure() File "/usr/local/lib/python2.7/dist-packages/compose/network.py", line 59, in ensure data = self.inspect() File "/usr/local/lib/python2.7/dist-packages/compose/network.py", line 91, in inspect return self.client.inspect_network(self.full_name) File "/usr/local/lib/python2.7/dist-packages/compose/cli/verbose_proxy.py", line 55, in proxy_callable result = getattr(self.obj, call_name)(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 35, in wrapper return f(self, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/docker/api/network.py", line 158, in inspect_network return self._result(res, json=True) File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 216, in _result self._raise_for_status(response) File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 210, in _raise_for_status response.raise_for_status() File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/models.py", line 840, in raise_for_status requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://docker:2375/v1.25/networks/baseagent_default
4,895
docker/compose
docker__compose-4504
aa8fb8f708a96ba9415cd657d8ac1b1808d63615
diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ def find_version(*file_paths): 'requests >= 2.6.1, != 2.11.0, < 2.12', 'texttable >= 0.8.1, < 0.9', 'websocket-client >= 0.32.0, < 1.0', - 'docker >= 2.0.2, < 3.0', + 'docker >= 2.1.0, < 3.0', 'dockerpty >= 0.4.1, < 0.5', 'six >= 1.3.0, < 2', 'jsonschema >= 2.5.1, < 3',
AttributeError: 'NoneType' object has no attribute 'tobuf' I upgraded to the latest docker version (1.13) for mac os x and when I try to run docker-compose I get the following error: Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 64, in main File "compose/cli/main.py", line 116, in perform_command File "compose/cli/main.py", line 848, in up File "compose/project.py", line 389, in up File "compose/service.py", line 302, in ensure_image_exists File "compose/service.py", line 786, in build File "site-packages/docker/api/build.py", line 139, in build File "site-packages/docker/utils/utils.py", line 105, in tar File "tarfile.py", line 2046, in addfile AttributeError: 'NoneType' object has no attribute 'tobuf' Everything was working fine on all previous versions of docker for osx until this recent upgrade
I encountered this in my projects today. It turned out to be something compose didn't like in the`tmp/sockets` directory of my rails application. Adding it to my .dockerignore has resolved the issue so far. Got the same error message for any docker-compose command, just after the update. (centos image with nginx and php) I am also getting this error after updating to Docker for Mac 1.13.0. **Update:** I could build other projects just fine. I looked in the non-working project, there was a `uwsgi.sock` file left over that didn't need to be there. I deleted it, now I can build images again. So the workaround seems to be, find socket files that are lying around in the project, and either delete or add to `.dockerignore`. I had to downgrade to 1.12.5 to get it working again. I have the same problem here. And there is no socket file inside my project. I will make a downgrade to make it work again. This happened to me after update to Docker for Mac 1.13.0 too. **Update:** fixed removing my project and git cloning again. Maybe could be a socket file in any node package, I am not sure, I know that on my project there were not socket files that's why I am guessing it was in some node package. I had the same issue for composing a Python project after upgrading to 1.13.0 on a Mac. It got resolved by cloning the project directory again. Thanks for the report everyone. For those who have encountered the bug, could you provide your OS (It seems like everyone here is on OSX?) as well as the output of `docker-compose version`? Thanks again. ``` Mac OS X El Capitan 10.11.6 docker-compose version 1.10.0, build 4bd6f1a docker-py version: 2.0.1 CPython version: 2.7.12 OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016 ``` For my project, it seems to dislike the socket I have under `tmp/sockets` ``` ls -la tmp/sockets total 0 drwxr-xr-x 4 me staff 136 Dec 12 12:37 . drwxr-xr-x 7 me staff 238 Jan 23 08:15 .. srwxrwxrwx 1 me staff 0 Oct 3 09:40 server.sock ``` OSX Sierra docker-compose version 1.9.0, build 2585387 docker-py version: 1.10.6 CPython version: 2.7.12 OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016 ``` MacOS 10.11.6 docker-compose version 1.10.0, build 4bd6f1a docker-py version: 2.0.1 CPython version: 2.7.12 OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016 ``` ```Shell macOS Sierra: version 10.12.2 docker-compose version 1.10.0, build 4bd6f1a docker-py version: 2.0.1 CPython version: 2.7.12 OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016 ``` The issue came back for me. It happens when `docker-compose up` is trying to rebuild an image. I get it when I try `docker-compose up --build` or `docker-compose build`. Any other solution instead of cloning again every time?!? @atamahjoubfar Do you have any socket file in your build context? What does `find . -name '*.sock'` output? What about `find -type s` ? @shin- Yes, I do have a socket file in my build. Both of the outputs are the same socket file: ```shell ata@macbook:~$ find . -type s ./socket/mysocket.sock ata@macbook:~$ find . -name '*.sock' ./socket/mysocket.sock ``` @atamahjoubfar Add it to your `.dockerignore`, that should solve the issue for the time being. Had the same issue on OSX with Docker 1.13.0, `docker-compose version`: ```docker-compose version 1.10.0, build 4bd6f1a docker-py version: 2.0.1 CPython version: 2.7.12 OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016 ``` There was indeed a stray `stats.socket` file in the build directory; removing it fixed the issue. 👍 > Linux 4.7.0-0.bpo.1-amd64 x86_64 GNU/Linux > docker-compose version 1.11.1, build 7c5d5e4 > docker-py version: 2.0.2 > CPython version: 2.7.13 > OpenSSL version: OpenSSL 1.0.1t 3 May 2016 There was also a socket in ``.ppm/run/controller.sock``, also in my case after removing it fixed the issue. Thanks all, the issue was identified, a fix is in `docker-py`'s master branch https://github.com/docker/docker-py/pull/1408 and will be part of an upcoming release.
2017-02-17T01:06:13Z
[]
[]
Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/main.py", line 64, in main File "compose/cli/main.py", line 116, in perform_command File "compose/cli/main.py", line 848, in up File "compose/project.py", line 389, in up File "compose/service.py", line 302, in ensure_image_exists File "compose/service.py", line 786, in build File "site-packages/docker/api/build.py", line 139, in build File "site-packages/docker/utils/utils.py", line 105, in tar File "tarfile.py", line 2046, in addfile AttributeError: 'NoneType' object has no attribute 'tobuf'
4,896
docker/compose
docker__compose-4621
a1823007068b734a0a50229ff2e91e8ddf544f12
diff --git a/compose/cli/main.py b/compose/cli/main.py --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -61,6 +61,7 @@ def main(): + signals.ignore_sigpipe() try: command = dispatch() command() diff --git a/compose/cli/signals.py b/compose/cli/signals.py --- a/compose/cli/signals.py +++ b/compose/cli/signals.py @@ -3,6 +3,8 @@ import signal +from ..const import IS_WINDOWS_PLATFORM + class ShutdownException(Exception): pass @@ -19,3 +21,10 @@ def set_signal_handler(handler): def set_signal_handler_to_shutdown(): set_signal_handler(shutdown) + + +def ignore_sigpipe(): + # Restore default behavior for SIGPIPE instead of raising + # an exception when encountered. + if not IS_WINDOWS_PLATFORM: + signal.signal(signal.SIGPIPE, signal.SIG_DFL)
piping data out of Docker crash I have a log file inside a container ``` $ sudo docker-compose exec syslog ls -lh /var/log/messages -rw-r--r-- 1 root root 80.8M Jan 26 18:49 /var/log/messages ``` its about 600k lines ``` $ sudo docker-compose exec syslog wc -l /var/log/messages 639629 /var/log/messages ``` The following command works: ``` sudo docker-compose exec syslog cat /var/log/messages ``` Also the following (there are few results for this command): ``` sudo docker-compose exec syslog cat /var/log/messages | grep "asdfasdf" ``` But greping for http (almost all the lines), crash after printing a few hundred lines ``` sudo docker-compose exec syslog cat /var/log/messages | grep "http" ``` ``` Traceback (most recent call last):.1 <redacted. just a random line from messages file> File "<string>", line 3, in <module> File "compose/cli/main.py", line 64, in main File "compose/cli/main.py", line 116, in perform_command File "compose/cli/main.py", line 461, in exec_command File "site-packages/dockerpty/pty.py", line 334, in start File "site-packages/dockerpty/pty.py", line 370, in _hijack_tty File "site-packages/dockerpty/io.py", line 164, in do_write OSError: [Errno 32] Broken pipe docker-compose returned -1 ``` - I can reproduce the bug everytime. - Yes, I can avoid the bug using grep http messages instead of the useless use of cat. But this is just for the sake of reporting the bug. - Seems related to #1509 #3352 # Info ``` $ sudo docker-compose --version docker-compose version 1.10.0, build 4bd6f1a ``` ``` $ sudo docker version Client: Version: 1.12.3 API version: 1.24 Go version: go1.6.3 Git commit: 6b644ec Built: Wed Oct 26 21:44:32 2016 OS/Arch: linux/amd64 Server: Version: 1.12.3 API version: 1.24 Go version: go1.6.3 Git commit: 6b644ec Built: Wed Oct 26 21:44:32 2016 OS/Arch: linux/amd64 ``` ``` $ uname -a Linux codexServer 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux ``` ``` $ grep -i desc /etc/lsb-release DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS" ```
I'm not able to reproduce this locally with a similar setup (I don't have a 600k lines syslog file, so I wrote a quick python script that continuously output random message lines). Do you have `ndg-httpsclient` installed? Can you reproduce with `docker-compose 1.11.2`? ```ndg-httpsclient``` not installed. I just found out a way to reproduce this 100% of the time, instantly. Tested with latest docker-engine and docker-compose across 3 different environments. ``` docker-compose exec alpine sh -c "cat /dev/urandom | tr -dc "[:alnum:][:punct:]" | tr '[:digits:]' '\n' | head -c 10000000" | xargs -0 ``` ``` # cat docker-compose.yml version: '2' services: alpine: image: alpine:latest command: sleep 3600 ``` With the container running: ```docker-compose up -d```. Some thoughts: If instead of ```head -c 10000000``` I execute it with ```head -c 1000``` it never crashes. With 120925 it crash about 50% of the time. The other 50% either prints lots of chars, or prints: ``` xargs: argument line too long ``` It seems to me that xargs it exiting or crashing and that makes the compose command crash. So in my original post, its probably grep that is crashing and not compose. The strange thing is that if I place the ```xargs``` inside the command, it does not crash, like this: ``` docker-compose exec alpine sh -c "cat /dev/urandom | tr -dc "[:alnum:][:punct:]" | tr '[:digits:]' '\n' | head -c 1000000 | xargs -0" ``` So piping out from ```docker-compose exec``` large amounts of data makes some gnu utils crash. The easiest workaround is doing ```docker exec -ti``` instead of ```docker-compose exec```. Ok - I can indeed reproduce consistently with that command. I'm not 100% sure what we can do about it though. Just catch the OSError and print out a nice message I guess? I'm not sure either. But a good start would be finding out why this command never crash: ``` docker exec -ti composetest_alpine_1 sh -c "cat /dev/urandom | tr -dc "[:alnum:][:punct:]" | tr '[:digits:]' '\n' | head -c 100000000" | grep -E -e "^." ``` while this one crashes in about 10-20 seconds (in my setup): ``` docker-compose exec alpine sh -c "cat /dev/urandom | tr -dc "[:alnum:][:punct:]" | tr '[:digits:]' '\n' | head -c 100000000" | grep -E -e "^." ```
2017-03-14T21:23:20Z
[]
[]
Traceback (most recent call last):.1 <redacted. just a random line from messages file> File "<string>", line 3, in <module> File "compose/cli/main.py", line 64, in main File "compose/cli/main.py", line 116, in perform_command File "compose/cli/main.py", line 461, in exec_command File "site-packages/dockerpty/pty.py", line 334, in start File "site-packages/dockerpty/pty.py", line 370, in _hijack_tty File "site-packages/dockerpty/io.py", line 164, in do_write OSError: [Errno 32] Broken pipe
4,911
docker/compose
docker__compose-4714
7aa55120db74ef79c8ba4e1c5dee0abaf98224ed
diff --git a/compose/config/serialize.py b/compose/config/serialize.py --- a/compose/config/serialize.py +++ b/compose/config/serialize.py @@ -111,9 +111,9 @@ def denormalize_service_dict(service_dict, version, image_digest=None): ) if 'ports' in service_dict and version not in (V3_2,): - service_dict['ports'] = map( - lambda p: p.legacy_repr() if isinstance(p, types.ServicePort) else p, - service_dict['ports'] - ) + service_dict['ports'] = [ + p.legacy_repr() if isinstance(p, types.ServicePort) else p + for p in service_dict['ports'] + ] return service_dict
`config` doesn't work with extended `ports` with Python3 With these files: `base.yml`: ```yaml version: '2' services: _nginx: image: nginx:1.11.12 ``` `docker-compose.yml`: ```yaml version: '2' services: nginx: extends: file: base.yml service: _nginx ports: - "8080:80" ``` Running `config`: ```text $ docker-compose config Traceback (most recent call last): File "/home/ken/.virtualenvs/compose3_clean/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/compose/cli/main.py", line 67, in main command() File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/compose/cli/main.py", line 111, in perform_command handler(command, options, command_options) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/compose/cli/main.py", line 306, in config print(serialize_config(compose_config, image_digests)) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/compose/config/serialize.py", line 62, in serialize_config width=80) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/__init__.py", line 216, in safe_dump return dump_all([data], stream, Dumper=SafeDumper, **kwds) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/__init__.py", line 188, in dump_all dumper.represent(data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 26, in represent node = self.represent_data(data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 47, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 205, in represent_dict return self.represent_mapping('tag:yaml.org,2002:map', data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 116, in represent_mapping node_value = self.represent_data(item_value) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 47, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 205, in represent_dict return self.represent_mapping('tag:yaml.org,2002:map', data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 116, in represent_mapping node_value = self.represent_data(item_value) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 47, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 205, in represent_dict return self.represent_mapping('tag:yaml.org,2002:map', data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 116, in represent_mapping node_value = self.represent_data(item_value) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 57, in represent_data node = self.yaml_representers[None](self, data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 229, in represent_undefined raise RepresenterError("cannot represent an object: %s" % data) yaml.representer.RepresenterError: cannot represent an object: <map object at 0x7f3caace4470> ``` ```txt $ docker-compose --version docker-compose version 1.12.0, build b31ff33 $ python -V Python 3.5.2 $ pip list 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. appdirs (1.4.3) cached-property (1.3.0) click (6.7) colorama (0.3.7) docker (2.2.1) docker-compose (1.12.0) docker-pycreds (0.2.1) dockerpty (0.4.1) docopt (0.6.2) first (2.0.1) jsonschema (2.6.0) packaging (16.8) pip (9.0.1) pip-tools (1.8.2) pyparsing (2.2.0) PyYAML (3.12) requests (2.11.1) setuptools (34.3.3) six (1.10.0) texttable (0.8.8) websocket-client (0.40.0) wheel (0.29.0) $ docker info Containers: 3 Running: 0 Paused: 0 Stopped: 3 Images: 181 Server Version: 17.04.0-ce Storage Driver: aufs Root Dir: /media/r0/var/lib/docker/aufs Backing Filesystem: extfs Dirs: 577 Dirperm1 Supported: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: containerd version: 422e31ce907fd9c3833a38d7b8fdd023e5a76e73 runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228 init version: 949e6fa Security Options: apparmor seccomp Profile: default Kernel Version: 4.4.0-71-generic Operating System: Ubuntu 16.04.2 LTS OSType: linux Architecture: x86_64 CPUs: 8 Total Memory: 15.56GiB Name: oblako ID: V6CL:5652:TVAP:Z4Q2:DOBE:CHDS:G3MY:Y6TU:BWGK:5B6E:REYP:PNGR Docker Root Dir: /media/r0/var/lib/docker Debug Mode (client): false Debug Mode (server): false Username: oeuftete Registry: https://index.docker.io/v1/ Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false WARNING: No swap limit support ```
Similar cases that do work for me: * Same files as above, compose 1.11.2 * Same files as above, python 2.7.12 * Single file definition of `nginx` with `ports` (no `extends`) There is also a case where extended `ports` also ends up being `None` when using `up`, but I haven't been able to narrow that one down: `ERROR: for nginx Cannot create container for service nginx: b'invalid port specification: "None"'` Maybe #4653 is related, although it sounds like the opposite case where already defined `ports` go away when using `extends`, whereas here something is wrong with `ports` when being extended. Thank you for the report. We'll take a look ASAP This seems to do the trick: ```diff diff --git a/compose/config/serialize.py b/compose/config/serialize.py index 5b36124..b06922a 100644 --- a/compose/config/serialize.py +++ b/compose/config/serialize.py @@ -111,9 +111,9 @@ def denormalize_service_dict(service_dict, version, image_digest=None): ) if 'ports' in service_dict and version not in (V3_2,): - service_dict['ports'] = map( + service_dict['ports'] = list(map( lambda p: p.legacy_repr() if isinstance(p, types.ServicePort) else p, service_dict['ports'] - ) + )) return service_dict ```
2017-04-07T23:55:04Z
[]
[]
Traceback (most recent call last): File "/home/ken/.virtualenvs/compose3_clean/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/compose/cli/main.py", line 67, in main command() File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/compose/cli/main.py", line 111, in perform_command handler(command, options, command_options) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/compose/cli/main.py", line 306, in config print(serialize_config(compose_config, image_digests)) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/compose/config/serialize.py", line 62, in serialize_config width=80) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/__init__.py", line 216, in safe_dump return dump_all([data], stream, Dumper=SafeDumper, **kwds) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/__init__.py", line 188, in dump_all dumper.represent(data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 26, in represent node = self.represent_data(data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 47, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 205, in represent_dict return self.represent_mapping('tag:yaml.org,2002:map', data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 116, in represent_mapping node_value = self.represent_data(item_value) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 47, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 205, in represent_dict return self.represent_mapping('tag:yaml.org,2002:map', data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 116, in represent_mapping node_value = self.represent_data(item_value) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 47, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 205, in represent_dict return self.represent_mapping('tag:yaml.org,2002:map', data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 116, in represent_mapping node_value = self.represent_data(item_value) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 57, in represent_data node = self.yaml_representers[None](self, data) File "/home/ken/.virtualenvs/compose3_clean/lib/python3.5/site-packages/yaml/representer.py", line 229, in represent_undefined raise RepresenterError("cannot represent an object: %s" % data) yaml.representer.RepresenterError: cannot represent an object: <map object at 0x7f3caace4470>
4,921
docker/compose
docker__compose-4721
94defc159a2dcdc548f2c5295f29acfad6122684
diff --git a/compose/cli/command.py b/compose/cli/command.py --- a/compose/cli/command.py +++ b/compose/cli/command.py @@ -49,14 +49,17 @@ def get_config_from_options(base_dir, options): def get_config_path_from_options(base_dir, options, environment): + def unicode_paths(paths): + return [p.decode('utf-8') if isinstance(p, six.binary_type) else p for p in paths] + file_option = options.get('--file') if file_option: - return file_option + return unicode_paths(file_option) config_files = environment.get('COMPOSE_FILE') if config_files: pathsep = environment.get('COMPOSE_PATH_SEPARATOR', os.pathsep) - return config_files.split(pathsep) + return unicode_paths(config_files.split(pathsep)) return None
Support unicode characters in -f paths On Ubuntu 16.04: ``` $ docker-compose -f 就吃饭/docker-compose.yml config/home/joffrey/work/compose/compose/config/config.py:234: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal if filenames == ['-']: Traceback (most recent call last): File "/home/joffrey/.envs/compose/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.11.0.dev0', 'console_scripts', 'docker-compose')() File "/home/joffrey/work/compose/compose/cli/main.py", line 64, in main command() File "/home/joffrey/work/compose/compose/cli/main.py", line 110, in perform_command handler(command, options, command_options) File "/home/joffrey/work/compose/compose/cli/main.py", line 305, in config compose_config = get_config_from_options(self.project_dir, config_options) File "/home/joffrey/work/compose/compose/cli/command.py", line 46, in get_config_from_options config.find(base_dir, config_path, environment) File "/home/joffrey/work/compose/compose/config/config.py", line 242, in find filenames = [os.path.join(base_dir, f) for f in filenames] File "/home/joffrey/.envs/compose/lib/python2.7/posixpath.py", line 73, in join path += '/' + b UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 1: ordinal not in range(128) ``` On Windows: ``` docker-compose -f "C:\Users\husun\documents\visual studio 2017\Projects\测试中文\docker-compose.yml" up -d --build ERROR: compose.cli.main.main: .IOError: [Errno 22] invalid mode ('r') or filename: 'C:\\Users\\husun\\documents\\visual studio 2017\\Projects\\????\\docker-compose.yml' ```
2017-04-11T00:40:02Z
[]
[]
Traceback (most recent call last): File "/home/joffrey/.envs/compose/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.11.0.dev0', 'console_scripts', 'docker-compose')() File "/home/joffrey/work/compose/compose/cli/main.py", line 64, in main command() File "/home/joffrey/work/compose/compose/cli/main.py", line 110, in perform_command handler(command, options, command_options) File "/home/joffrey/work/compose/compose/cli/main.py", line 305, in config compose_config = get_config_from_options(self.project_dir, config_options) File "/home/joffrey/work/compose/compose/cli/command.py", line 46, in get_config_from_options config.find(base_dir, config_path, environment) File "/home/joffrey/work/compose/compose/config/config.py", line 242, in find filenames = [os.path.join(base_dir, f) for f in filenames] File "/home/joffrey/.envs/compose/lib/python2.7/posixpath.py", line 73, in join path += '/' + b UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 1: ordinal not in range(128)
4,924
docker/compose
docker__compose-4770
59dbeac4c1f4941e631df2ab02ae2a2c4958008f
diff --git a/compose/network.py b/compose/network.py --- a/compose/network.py +++ b/compose/network.py @@ -158,8 +158,8 @@ def check_remote_ipam_config(remote, local): if sorted(lc.get('AuxiliaryAddresses')) != sorted(rc.get('AuxiliaryAddresses')): raise NetworkConfigChangedError(local.full_name, 'IPAM config aux_addresses') - remote_opts = remote_ipam.get('Options', {}) - local_opts = local.ipam.get('options', {}) + remote_opts = remote_ipam.get('Options') or {} + local_opts = local.ipam.get('options') or {} for k in set.union(set(remote_opts.keys()), set(local_opts.keys())): if remote_opts.get(k) != local_opts.get(k): raise NetworkConfigChangedError(local.full_name, 'IPAM option "{}"'.format(k))
AttributeError: 'NoneType' object has no attribute 'keys' hey, i want to install mailcow-dockerized on my debian jessie machine and after `docker pull` I need to run `docker-compose up -d` but it throws following error: ```sh Traceback (most recent call last): File "bin/docker-compose", line 3, in <module> File "compose/cli/main.py", line 68, in main File "compose/cli/main.py", line 118, in perform_command File "compose/cli/main.py", line 924, in up File "compose/project.py", line 389, in up File "compose/project.py", line 437, in initialize File "compose/network.py", line 252, in initialize File "compose/network.py", line 60, in ensure File "compose/network.py", line 180, in check_remote_network_config File "compose/network.py", line 163, in check_remote_ipam_config AttributeError: 'NoneType' object has no attribute 'keys' Failed to execute script docker-compose ``` since I dont know python I dont know wheres the problem.
What version of the Docker Engine are you using - can you share the output of `docker version`? Sure! Look here: ``` Client: Version: 17.03.1-ce API version: 1.27 Go version: go1.7.5 Git commit: c6d412e Built: Mon Mar 27 17:07:28 2017 OS/Arch: linux/amd64 Server: Version: 17.03.1-ce API version: 1.27 (minimum version 1.12) Go version: go1.7.5 Git commit: c6d412e Built: Mon Mar 27 17:07:28 2017 OS/Arch: linux/amd64 Experimental: false ``` Thanks - I believe I identified the issue as a bug in Compose. As a workaround, you might want to try running `docker-compose down && docker-compose up -d` instead. That worked! Thanks!
2017-04-26T20:35:32Z
[]
[]
Traceback (most recent call last): File "bin/docker-compose", line 3, in <module> File "compose/cli/main.py", line 68, in main File "compose/cli/main.py", line 118, in perform_command File "compose/cli/main.py", line 924, in up File "compose/project.py", line 389, in up File "compose/project.py", line 437, in initialize File "compose/network.py", line 252, in initialize File "compose/network.py", line 60, in ensure File "compose/network.py", line 180, in check_remote_network_config File "compose/network.py", line 163, in check_remote_ipam_config AttributeError: 'NoneType' object has no attribute 'keys'
4,930
docker/compose
docker__compose-4955
c38eaeaba342d586c8986482b745006efb801665
diff --git a/compose/config/config.py b/compose/config/config.py --- a/compose/config/config.py +++ b/compose/config/config.py @@ -959,7 +959,7 @@ def parse_sequence_func(seq): merged = parse_sequence_func(md.base.get(field, [])) merged.update(parse_sequence_func(md.override.get(field, []))) - md[field] = [item for item in sorted(merged.values())] + md[field] = [item for item in sorted(merged.values(), key=lambda x: x.target)] def merge_build(output, base, override):
TypeError: unorderable types: NoneType() < str() Hi guys! I just updated to version 1.14 via pip and got error: ``` (master) hexlet$ make compose-bash docker-compose run web bash Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python3.5/dist-packages/compose/cli/main.py", line 68, in main command() File "/usr/local/lib/python3.5/dist-packages/compose/cli/main.py", line 115, in perform_command project = project_from_options('.', options) File "/usr/local/lib/python3.5/dist-packages/compose/cli/command.py", line 37, in project_from_options override_dir=options.get('--project-directory'), File "/usr/local/lib/python3.5/dist-packages/compose/cli/command.py", line 91, in get_project config_data = config.load(config_details) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 379, in load service_dicts = load_services(config_details, main_file) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 475, in load_services service_config = merge_services(service_config, next_config) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 466, in merge_services for name in all_service_names File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 466, in <dictcomp> for name in all_service_names File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 853, in merge_service_dicts_from_files new_service = merge_service_dicts(base, override, version) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 929, in merge_service_dicts merge_ports(md, base, override) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 962, in merge_ports md[field] = [item for item in sorted(merged.values())] TypeError: unorderable types: NoneType() < str() Makefile:72: recipe for target 'compose-bash' failed make: *** [compose-bash] Error 1 (master) hexlet$ cat ^C (master) hexlet$ docker-compose --version docker-compose version 1.14.0, build c7bdf9e ```
Thanks for the report, can you share your Compose file? Sure! ``` version: '3.1' services: web-nginx: build: context: services/web_nginx dockerfile: Dockerfile.production ports: - "80:80" depends_on: - web web: dns: - 169.254.1.1 - 8.8.8.8 user: internal build: context: services/web dockerfile: Dockerfile.production command: bin/rails s -b 0.0.0.0 volumes: - ./.irb_history:/home/internal/.irb_history ports: - "3000:3000" consul: network_mode: host build: context: services/consul dockerfile: Dockerfile environment: CONSUL_LOCAL_CONFIG: '{ "node_name": "exercise.hexlet.dev" }' registrator: image: gliderlabs/registrator network_mode: host command: consul://localhost:8500 volumes: - '/var/run/docker.sock:/tmp/docker.sock' depends_on: - consul evaluator-nginx: build: context: services/evaluator_nginx dockerfile: Dockerfile environment: SERVICE_TAGS: evaluator ports: - "443:443" dnsmasq: network_mode: host build: context: services/dnsmasq dockerfile: Dockerfile ports: - "53:53/udp" - "53:53" cap_add: - NET_ADMIN ``` Hm, I can't reproduce locally. Do you have a `docker-compose.override.yml` as well, or do you provide multiple files using the `-f` option? If so, having the content of those files would be useful as well. docker-compose.override.yml ``` version: '3.1' services: spring: user: internal build: context: services/web dockerfile: Dockerfile.development volumes: - ./services/web:/usr/src/app env_file: .env.development command: bin/spring server pid: host web-nginx: build: context: services/web_nginx dockerfile: Dockerfile.development frontend: build: context: services/web dockerfile: Dockerfile.development command: make frontend_watch # ports: # - '8080:80' volumes: - ./services/web:/usr/src/app web: build: context: services/web dockerfile: Dockerfile.development env_file: .env.development volumes: - ~/.bash_history:/internal/.bash_history - ./services/web:/usr/src/app command: sh -c "rm -f tmp/pids/server.pid && bin/rails s -b 0.0.0.0" activejob-web: build: context: services/web dockerfile: Dockerfile.development env_file: .env.development volumes: - ~/.bash_history:/internal/.bash_history - ./services/web:/usr/src/app command: bundle exec shoryuken -R -C config/shoryuken.web.yml activejob-fast: build: context: services/web dockerfile: Dockerfile.development env_file: .env.development volumes: - ~/.bash_history:/internal/.bash_history - ./services/web:/usr/src/app command: bundle exec shoryuken -R -C config/shoryuken.fast.yml activejob-slow: build: context: services/web dockerfile: Dockerfile.development env_file: .env.development volumes: - ~/.bash_history:/internal/.bash_history - ./services/web:/usr/src/app command: bundle exec shoryuken -R -C config/shoryuken.slow.yml ``` any docker-compose calls throws the same error... ``` (feature/consul-template) hexlet$ make compose-build docker-compose build Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python3.5/dist-packages/compose/cli/main.py", line 68, in main command() File "/usr/local/lib/python3.5/dist-packages/compose/cli/main.py", line 115, in perform_command project = project_from_options('.', options) File "/usr/local/lib/python3.5/dist-packages/compose/cli/command.py", line 37, in project_from_options override_dir=options.get('--project-directory'), File "/usr/local/lib/python3.5/dist-packages/compose/cli/command.py", line 91, in get_project config_data = config.load(config_details) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 379, in load service_dicts = load_services(config_details, main_file) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 475, in load_services service_config = merge_services(service_config, next_config) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 466, in merge_services for name in all_service_names File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 466, in <dictcomp> for name in all_service_names File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 853, in merge_service_dicts_from_files new_service = merge_service_dicts(base, override, version) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 929, in merge_service_dicts merge_ports(md, base, override) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 962, in merge_ports md[field] = [item for item in sorted(merged.values())] TypeError: unorderable types: str() < NoneType() Makefile:57: recipe for target 'compose-build' failed make: *** [compose-build] Error 1 ```
2017-06-23T22:05:14Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python3.5/dist-packages/compose/cli/main.py", line 68, in main command() File "/usr/local/lib/python3.5/dist-packages/compose/cli/main.py", line 115, in perform_command project = project_from_options('.', options) File "/usr/local/lib/python3.5/dist-packages/compose/cli/command.py", line 37, in project_from_options override_dir=options.get('--project-directory'), File "/usr/local/lib/python3.5/dist-packages/compose/cli/command.py", line 91, in get_project config_data = config.load(config_details) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 379, in load service_dicts = load_services(config_details, main_file) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 475, in load_services service_config = merge_services(service_config, next_config) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 466, in merge_services for name in all_service_names File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 466, in <dictcomp> for name in all_service_names File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 853, in merge_service_dicts_from_files new_service = merge_service_dicts(base, override, version) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 929, in merge_service_dicts merge_ports(md, base, override) File "/usr/local/lib/python3.5/dist-packages/compose/config/config.py", line 962, in merge_ports md[field] = [item for item in sorted(merged.values())] TypeError: unorderable types: NoneType() < str()
4,944
docker/compose
docker__compose-4990
e33041582fc7dda54a1412f1e56209aa8671c280
diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -56,6 +56,7 @@ def find_version(*file_paths): ':python_version < "3.4"': ['enum34 >= 1.0.4, < 2'], ':python_version < "3.5"': ['backports.ssl_match_hostname >= 3.5'], ':python_version < "3.3"': ['ipaddress >= 1.0.16'], + 'socks': ['PySocks >= 1.5.6, != 1.5.7, < 2'], }
Compose exits with "Missing dependencies for SOCKS support" Hi there! Ran into a bit of an issue with docker-compose 1.13.0, build 1719ceb. In my test the issue goes back to at least 1.11.0. A script I'm running does `docker-compose down`, which results in an uncaught exception that ends with the line: "requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.": ``` Traceback (most recent call last): File "docker-compose", line 3, in <module> File "compose/cli/main.py", line 68, in main File "compose/cli/main.py", line 118, in perform_command File "compose/cli/main.py", line 358, in down File "compose/project.py", line 286, in down File "compose/project.py", line 252, in stop File "compose/project.py", line 498, in containers File "compose/project.py", line 489, in _labeled_containers File "site-packages/docker/api/container.py", line 189, in containers File "site-packages/docker/utils/decorators.py", line 47, in inner File "site-packages/docker/api/client.py", line 183, in _get File "site-packages/requests/sessions.py", line 488, in get File "site-packages/requests/sessions.py", line 475, in request File "site-packages/requests/sessions.py", line 596, in send File "site-packages/requests/adapters.py", line 390, in send File "site-packages/docker/transport/ssladapter.py", line 56, in get_connection File "site-packages/requests/adapters.py", line 290, in get_connection File "site-packages/requests/adapters.py", line 184, in proxy_manager_for File "site-packages/requests/adapters.py", line 43, in SOCKSProxyManager requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support. ``` I'm running through docker machine and nothing in the docker compose yaml even mentions socks. The script that wraps the docker-compose does set `ALL_PROXY`, which I think may be causing `requests` or some other library to eagerly load socks support. My recommendation would be to add `requests[socks]` to the setup.py and call it good.
Thanks for the report! The majority of people do not need those additional dependencies - adding extra dependencies indiscriminately seems like a poor solution. The onus is on the script provider to ensure additional requirements are included, or at least properly advertised. docker-compose is being distributed as a frozen binary, which means adding requirements after the fact is not really possible. Yeah, this is for the frozen command, not the pip installed version. And this would affect anyone with the rather innocuous `ALL_PROXY` environment variable configured. In any case the PySocks module is the only dependency required, and it is really very tiny ([literally one file](https://github.com/Anorov/PySocks)). The version is managed automatically by simply using the socks requests extra (`requests[socks]`). It seems unfriendly for users to have to figure out what extra packages they need to use the features supported by `docker-compose` - maybe `setup.py` can have a `extras` option that includes all of these packages, and the distribution channels for the frozen version of `docker-compose` can install `docker-compose` with that option instead? That would be a reasonable addition.
2017-07-03T22:36:09Z
[]
[]
Traceback (most recent call last): File "docker-compose", line 3, in <module> File "compose/cli/main.py", line 68, in main File "compose/cli/main.py", line 118, in perform_command File "compose/cli/main.py", line 358, in down File "compose/project.py", line 286, in down File "compose/project.py", line 252, in stop File "compose/project.py", line 498, in containers File "compose/project.py", line 489, in _labeled_containers File "site-packages/docker/api/container.py", line 189, in containers File "site-packages/docker/utils/decorators.py", line 47, in inner File "site-packages/docker/api/client.py", line 183, in _get File "site-packages/requests/sessions.py", line 488, in get File "site-packages/requests/sessions.py", line 475, in request File "site-packages/requests/sessions.py", line 596, in send File "site-packages/requests/adapters.py", line 390, in send File "site-packages/docker/transport/ssladapter.py", line 56, in get_connection File "site-packages/requests/adapters.py", line 290, in get_connection File "site-packages/requests/adapters.py", line 184, in proxy_manager_for File "site-packages/requests/adapters.py", line 43, in SOCKSProxyManager requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.
4,946
docker/compose
docker__compose-5113
390ba801a3299b1a73d31e739afb0992115a3901
diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ def find_version(*file_paths): 'requests >= 2.6.1, != 2.11.0, < 2.12', 'texttable >= 0.9.0, < 0.10', 'websocket-client >= 0.32.0, < 1.0', - 'docker >= 2.4.2, < 3.0', + 'docker >= 2.5.0, < 3.0', 'dockerpty >= 0.4.1, < 0.5', 'six >= 1.3.0, < 2', 'jsonschema >= 2.5.1, < 3',
Up a service cause MemoryError I am consistently getting a MemoryError on container: ``` bdhameli@debian:~/Docker$ docker-compose up openvpn Starting dmzpi_openvpn_1 Attaching to dmzpi_openvpn_1 Traceback (most recent call last): File "bin/docker-compose", line 3, in <module> File "compose/cli/main.py", line 67, in main File "compose/cli/main.py", line 117, in perform_command File "compose/cli/main.py", line 937, in up File "compose/cli/log_printer.py", line 87, in run File "compose/cli/log_printer.py", line 235, in consume_queue MemoryError ``` At this point, the container is running normally. The docker-compose.yml file contains: ``` services: openvpn: build: ./openvpn cap_add: - net_admin dns: - 8.8.4.4 - 8.8.8.8 read_only: true tmpfs: - /tmp restart: unless-stopped stdin_open: true tty: true volumes: - ./openvpn/vpn:/vpn devices: - /dev/net/tun:/dev/net/tun ``` Docker and Docker-Compose versions are: ``` :~/Docker$ docker --version Docker version 17.03.1-ce, build c6d412e :~/Docker/$ docker-compose version docker-compose version 1.12.0, build b31ff33 docker-py version: 2.2.1 CPython version: 2.7.13 OpenSSL version: OpenSSL 1.0.1t 3 May 2016 ``` Compose ignores .dockerignore when containing exclusion Following on from this comment, https://github.com/docker/compose/issues/1607#issuecomment-190654346 I've created a repository demonstrating the issue, https://github.com/multimac/compose-dockerignore When including a file already excluded by a prior rule in a .dockerignore file, Compose stops ignoring any other files. **Expected Results** ``` ignore_1 | /context/ ignore_1 | /context/.dockerignore ignore_1 | /context/docker-compose.yml ignore_1 | /context/Dockerfile ignore_1 | /context/folder ignore_1 | /context/folder/included ``` **Actual Results** - (/context/folder/ignored shouldn't be there) ``` ignore_1 | /context/ ignore_1 | /context/.dockerignore ignore_1 | /context/docker-compose.yml ignore_1 | /context/Dockerfile ignore_1 | /context/folder ignore_1 | /context/folder/included ignore_1 | /context/folder/ignored ``` **Versions** ``` Windows 10 Pro Docker version 1.12.0, build 8eab29e docker-compose version 1.8.0, build d988a55 ```
Thanks for the report. Do you get the same error if you run `docker-compose logs -f openvpn`? What about `docker-compose logs --tail=20 -f openvpn`? Hi, These two commands (`docker-compose logs -f openvpn` and `docker-compose logs --tail=20 -f openvpn`) return the same content: ``` openvpn_1 | Wed Apr 26 07:55:26 2017 OpenVPN 2.3.4 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Nov 12 2015 openvpn_1 | Wed Apr 26 07:55:26 2017 library versions: OpenSSL 1.0.1t 3 May 2016, LZO 2.08 openvpn_1 | Wed Apr 26 07:55:26 2017 Control Channel Authentication: tls-auth using INLINE static key file openvpn_1 | Wed Apr 26 07:55:26 2017 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication openvpn_1 | Wed Apr 26 07:55:26 2017 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication openvpn_1 | Wed Apr 26 07:55:26 2017 Socket Buffers: R=[212992->131072] S=[212992->131072] openvpn_1 | Wed Apr 26 07:55:46 2017 RESOLVE: Cannot resolve host address: #####.########.###: Temporary failure in name resolution openvpn_1 | Wed Apr 26 07:56:06 2017 RESOLVE: Cannot resolve host address: #####.########.###: Temporary failure in name resolution openvpn_1 | Wed Apr 26 07:56:06 2017 SIGUSR1[soft,init_instance] received, process restarting openvpn_1 | Wed Apr 26 07:56:06 2017 Restart pause, 2 second(s) ``` If helping, the DNS server define in `docker-compose.yml` for openvpn service can't be reached. I've got the same problem. It is working when I run docker-compose in daemon mode. // not working `docker-compose up` // working `docker-compose up -d` ``` ubuntu@myuser:~/api $ docker version Client: Version: 1.13.0 API version: 1.25 Go version: go1.7.3 Git commit: 49bf474 Built: Tue Jan 17 09:58:26 2017 OS/Arch: linux/amd64 Server: Version: 1.13.0 API version: 1.25 (minimum version 1.12) Go version: go1.7.3 Git commit: 49bf474 Built: Tue Jan 17 09:58:26 2017 OS/Arch: linux/amd64 Experimental: false ubuntu@myuser:~/api $ docker-compose -v docker-compose version 1.11.2, build dfed245 ``` I'm also getting the same error in running `docker-compose -f docker-compose-1.yml -f docker-compose-2.yml up` in a gcloud server. But, on my local system, it is running just fine. ``` Traceback (most recent call last): File "bin/docker-compose", line 3, in <module> File "compose/cli/main.py", line 64, in main File "compose/cli/main.py", line 116, in perform_command File "compose/cli/main.py", line 889, in up File "compose/cli/log_printer.py", line 87, in run File "compose/cli/log_printer.py", line 229, in consume_queue MemoryError Failed to execute script docker-compose ``` docker-compose-1.yml ``` version: '2' services: drupal: build: context: . dockerfile: Dockerfile.drupal ports: - "3700:80" restart: always networks: main: aliases: - drupal networks: main: ``` docker-compose-2.yml ``` version: '2' services: redisMain: image: redis:alpine command: redis-server /usr/local/etc/redis/redis.conf volumes: - "./redis/redisMain.conf:/usr/local/etc/redis/redis.conf" restart: always networks: main: aliases: - redisMain rabbitmq: image: rabbitmq:management-alpine restart: always hostname: rabbitmq environment: RABBITMQ_DEFAULT_USER: app RABBITMQ_DEFAULT_PASS: app ports: - "15672:15672" networks: main: aliases: - rabbitmq mongodbMain: image: mongo:latest restart: always networks: main: aliases: - mongodbMain mysqlMain: image: mysql:latest volumes: - "~/Office/app-db/mysql-data/db:/var/lib/mysql" restart: always environment: MYSQL_ROOT_PASSWORD: app MYSQL_DATABASE: test_db MYSQL_USER: app MYSQL_PASSWORD: app networks: main: aliases: - mysqlMain haproxymain: image: haproxy:alpine volumes: - "./haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg" links: - app ports: - "9000:80" restart: always networks: main: aliases: - haproxymain app: depends_on: - redisMain - mysqlMain - mongodbMain - rabbitmq build: context: . dockerfile: Dockerfile args: branch: ${BRANCH} # expire: ${EXPIRE} tty: true restart: always networks: main: aliases: - app networks: main: ``` I'm trying to clone a git repository and do `npm install` inside it as an entrypoint script in one of my containers. Also, I tried running it with `-d` flag. But that doesn't seemed to clone the repo in my container. Docker version: ``` dev@dev:~$ docker --version Docker version 17.03.1-ce, build c6d412e dev@dev:~$ docker-compose --version docker-compose version 1.11.2, build dfed245 ``` Could it be the same issue as #409 ? What is the output of `ulimit -m` in your different environments? I don't think so : ``` ubuntu@myuser:~$ ulimit -m unlimited ``` Idem: ``` :~/Docker/dmz-pi$ ulimit -m unlimited ``` Output of `ulimit -m` is same on both environments - glcoud server and my local system. ``` dev@dev:~$ ulimit -m unlimited ``` Also, if run `docker-compose up` again without doing `docker-compose down`, then I'm getting a `COMPOSE_HTTP_TIMEOUT` error and not the `MemoryError`. What could be the reason behind this? ``` ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information. If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60). ``` i'm also getting the same error. is there any workaround to this problem? edit: I just removed tty:true and it worked +1 Anyone have an update on this one? This bug is making it impossible to tune the context size of my monolithic repository. +1 EDIT: im using docker-compose version 1.11.2 I have same issue on mac. ``` Containers: 3 Running: 0 Paused: 0 Stopped: 3 Images: 30 Server Version: 17.06.0-ce Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs Dirs: 44 Dirperm1 Supported: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4 init version: 949e6fa Security Options: seccomp Profile: default Kernel Version: 4.9.36-moby Operating System: Alpine Linux v3.5 OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 3.855GiB Name: moby ID: LE4E:ZN7A:OKB5:G65M:Y25C:LDQ4:MNNF:E6JR:TJ7D:CX7T:32EN:SJY2 Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): true File Descriptors: 18 Goroutines: 30 System Time: 2017-07-21T12:59:47.84242558Z EventsListeners: 1 No Proxy: *.local, 169.254/16 Registry: https://index.docker.io/v1/ Experimental: true Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false ```
2017-08-17T21:33:18Z
[]
[]
Traceback (most recent call last): File "bin/docker-compose", line 3, in <module> File "compose/cli/main.py", line 67, in main File "compose/cli/main.py", line 117, in perform_command File "compose/cli/main.py", line 937, in up File "compose/cli/log_printer.py", line 87, in run File "compose/cli/log_printer.py", line 235, in consume_queue MemoryError
4,960
docker/compose
docker__compose-5217
432dffc7106849b4d143f99059ee284f5afaacf6
diff --git a/compose/config/validation.py b/compose/config/validation.py --- a/compose/config/validation.py +++ b/compose/config/validation.py @@ -325,7 +325,6 @@ def _parse_oneof_validator(error): """ types = [] for context in error.context: - if context.validator == 'oneOf': _, error_msg = _parse_oneof_validator(context) return path_string(context.path), error_msg @@ -337,6 +336,13 @@ def _parse_oneof_validator(error): invalid_config_key = parse_key_from_error_msg(context) return (None, "contains unsupported option: '{}'".format(invalid_config_key)) + if context.validator == 'uniqueItems': + return ( + path_string(context.path) if context.path else None, + "contains non-unique items, please remove duplicates from {}".format( + context.instance), + ) + if context.path: return ( path_string(context.path), @@ -345,13 +351,6 @@ def _parse_oneof_validator(error): _parse_valid_types_from_validator(context.validator_value)), ) - if context.validator == 'uniqueItems': - return ( - None, - "contains non unique items, please remove duplicates from {}".format( - context.instance), - ) - if context.validator == 'type': types.append(context.validator_value)
compose crashes on duplicates in cache_from when a compose file has duplicate entries in `build.cache_from` section any interaction with compose crashes on reporting validation error. Example compose file: ```yml version: '3.3' services: nginx: build: context: nginx cache_from: - "example/my-nginx:develop" - "example/my-nginx:master" - "example/my-nginx:develop" image: example/my-nginx:new ``` Example output: ``` $ docker-compose -f example.yml build Traceback (most recent call last): File "/home/pupssman/venv/py2/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/cli/main.py", line 68, in main command() File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/cli/main.py", line 118, in perform_command project = project_from_options('.', options) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/cli/command.py", line 37, in project_from_options override_dir=options.get('--project-directory'), File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/cli/command.py", line 91, in get_project config_data = config.load(config_details) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/config.py", line 368, in load for config_file in config_details.config_files File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/config.py", line 534, in process_config_file validate_against_config_schema(config_file) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 393, in validate_against_config_schema config_file.filename) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 454, in handle_errors error_msg = '\n'.join(format_error_func(error) for error in errors) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 454, in <genexpr> error_msg = '\n'.join(format_error_func(error) for error in errors) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 380, in process_config_schema_errors return handle_generic_error(error, path) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 252, in handle_generic_error config_key, error_msg = _parse_oneof_validator(error) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 335, in _parse_oneof_validator _parse_valid_types_from_validator(context.validator_value)), File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 300, in _parse_valid_types_from_validator return anglicize_json_type(validator) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 216, in anglicize_json_type if json_type.startswith(('a', 'e', 'i', 'o', 'u')): AttributeError: 'bool' object has no attribute 'startswith' ``` Versions: ``` $ pip freeze | grep docker docker==2.5.1 docker-compose==1.16.1 ``` Expected behaviour: * do not crash on error reporting * extra credit: actually allow duplicates there as: * that should not pose any trouble * it is convenient to have one of those parametrized and one default to something (like `develop` here`) and pass the var from build script
Thank you for the report!
2017-09-26T23:27:15Z
[]
[]
Traceback (most recent call last): File "/home/pupssman/venv/py2/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/cli/main.py", line 68, in main command() File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/cli/main.py", line 118, in perform_command project = project_from_options('.', options) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/cli/command.py", line 37, in project_from_options override_dir=options.get('--project-directory'), File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/cli/command.py", line 91, in get_project config_data = config.load(config_details) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/config.py", line 368, in load for config_file in config_details.config_files File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/config.py", line 534, in process_config_file validate_against_config_schema(config_file) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 393, in validate_against_config_schema config_file.filename) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 454, in handle_errors error_msg = '\n'.join(format_error_func(error) for error in errors) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 454, in <genexpr> error_msg = '\n'.join(format_error_func(error) for error in errors) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 380, in process_config_schema_errors return handle_generic_error(error, path) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 252, in handle_generic_error config_key, error_msg = _parse_oneof_validator(error) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 335, in _parse_oneof_validator _parse_valid_types_from_validator(context.validator_value)), File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 300, in _parse_valid_types_from_validator return anglicize_json_type(validator) File "/home/pupssman/venv/py2/local/lib/python2.7/site-packages/compose/config/validation.py", line 216, in anglicize_json_type if json_type.startswith(('a', 'e', 'i', 'o', 'u')): AttributeError: 'bool' object has no attribute 'startswith'
4,967
docker/compose
docker__compose-5224
7f82a2857264b4d0929c931c0ae6d6d318ce4bbd
diff --git a/compose/config/config.py b/compose/config/config.py --- a/compose/config/config.py +++ b/compose/config/config.py @@ -762,7 +762,10 @@ def process_blkio_config(service_dict): for field in ['device_read_bps', 'device_write_bps']: if field in service_dict['blkio_config']: for v in service_dict['blkio_config'].get(field, []): - v['rate'] = parse_bytes(v.get('rate', 0)) + rate = v.get('rate', 0) + v['rate'] = parse_bytes(rate) + if v['rate'] is None: + raise ConfigurationError('Invalid format for bytes value: "{}"'.format(rate)) for field in ['device_read_iops', 'device_write_iops']: if field in service_dict['blkio_config']: diff --git a/compose/utils.py b/compose/utils.py --- a/compose/utils.py +++ b/compose/utils.py @@ -12,7 +12,6 @@ from docker.errors import DockerException from docker.utils import parse_bytes as sdk_parse_bytes -from .config.errors import ConfigurationError from .errors import StreamParseError from .timeparse import MULTIPLIERS from .timeparse import timeparse @@ -143,4 +142,4 @@ def parse_bytes(n): try: return sdk_parse_bytes(n) except DockerException: - raise ConfigurationError('Invalid format for bytes value: {}'.format(n)) + return None
splitdrive import issue on docker-compose==1.16.0 Using `Python 2.7.5` with `docker-compose==1.16.0` through `pip install --upgrade docker-compose==1.16.0` ``` Python 2.7.5 (default, Nov 20 2015, 02:00:19) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from compose.utils import splitdrive Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/site-packages/compose/utils.py", line 15, in <module> from .config.errors import ConfigurationError File "/usr/lib/python2.7/site-packages/compose/config/__init__.py", line 6, in <module> from .config import ConfigurationError File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 15, in <module> from . import types File "/usr/lib/python2.7/site-packages/compose/config/types.py", line 17, in <module> from compose.utils import splitdrive ``` Whereas using `docker-compose==1.15.0` through `pip install --upgrade docker-compose==1.15.0` **(tested using `docker-compose==1.15.0` and `docker-compose==1.14.0` both are working)** ``` Python 2.7.5 (default, Nov 20 2015, 02:00:19) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from compose.utils import splitdrive >>> ``` --- PS: I'm not using `docker-compose` python by myself, but it used by [_Ansible_](https://github.com/ansible/ansible) [docker-service module](http://docs.ansible.com/ansible/latest/docker_service_module.html) and with `docker-compose==1.16.0` I got that message ``` "msg": "Unable to load docker-compose. Try `pip install docker-compose`. Error: cannot import name splitdrive" ```
[As I said before](https://github.com/docker/compose/issues/4542#issuecomment-283191533), we make no guarantee of a stable API for developers attempting to use Compose as a library. For those of you who are trying to use boot2docker image (docker-machine, Tiny Core Linux) on macos with ansible through its docker module... Downgrade docker-compose pip library to 1.9.0. If you're only downgrading to 1.15.0, you'll hit #4401. @shin- This isn't about importing from Ansible, I don't think. That traceback is a circular import. Importing `compose.utils` begins an import series that breaks when it tries to import `compose.utils` again. Looking to see if I can identify the breaking change.... The import that kicks off the chain was introduced recently: https://github.com/docker/compose/commit/6e802df80948696739d6aaf721d8bcf8c3bbe6a1#diff-7345a7e448db63ef1a5b786900e2b7b4R15 For those in Ansible land, this issue does not manifest in devel or the 2.4 rc's. So either limit yourself to Docker Compose <1.16 or upgrade from Ansible 2.3.x into 2.4/devel. I'm aware it is a circular import. It just does not affect the software when used as intended. I'll work on a fix when I return from vacation. Thank you for your patience. Enjoy your time off! Thanks!
2017-09-28T01:26:00Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/site-packages/compose/utils.py", line 15, in <module> from .config.errors import ConfigurationError File "/usr/lib/python2.7/site-packages/compose/config/__init__.py", line 6, in <module> from .config import ConfigurationError File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 15, in <module> from . import types File "/usr/lib/python2.7/site-packages/compose/config/types.py", line 17, in <module> from compose.utils import splitdrive ``` Whereas using `docker-compose==1.15.0` through `pip install --upgrade docker-compose==1.15.0`
4,969
docker/compose
docker__compose-5274
f855ed405b8497718dcbd4e0b9a84c87bd9d8a32
diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ def find_version(*file_paths): ':python_version < "3.4"': ['enum34 >= 1.0.4, < 2'], ':python_version < "3.5"': ['backports.ssl_match_hostname >= 3.5'], ':python_version < "3.3"': ['ipaddress >= 1.0.16'], - ':sys_platform == "win32"': ['colorama >= 0.3.7, < 0.4'], + ':sys_platform == "win32"': ['colorama >= 0.3.9, < 0.4'], 'socks': ['PySocks >= 1.5.6, != 1.5.7, < 2'], }
Unable to mount volumes on Windows 10: UnboundLocalError: local variable 'cells_to_erase' referenced before assignment I am getting a persistent error on `docker-compose up`. I am getting the same error on two different Windows 10 Pro machines. ``` Traceback (most recent call last): File "docker-compose", line 6, in <module> File "compose\cli\main.py", line 68, in main File "compose\cli\main.py", line 121, in perform_command File "compose\cli\main.py", line 954, in up File "compose\cli\log_printer.py", line 105, in run File "compose\cli\log_printer.py", line 109, in write File "codecs.py", line 370, in write File "site-packages\colorama\ansitowin32.py", line 40, in write File "site-packages\colorama\ansitowin32.py", line 141, in write File "site-packages\colorama\ansitowin32.py", line 167, in write_and_convert File "site-packages\colorama\ansitowin32.py", line 181, in convert_ansi File "site-packages\colorama\ansitowin32.py", line 212, in call_win32 File "site-packages\colorama\winterm.py", line 132, in erase_screen UnboundLocalError: local variable 'cells_to_erase' referenced before assignment Failed to execute script docker-compose ``` After the error the port is open and the application is running, but the volumes are not mounted. Here is my setup: - Edition: Windows 10 Pro - Version: 1703 - OS Build 15063.674 - Docker version 17.09.0-ce, build afdb6d4 - docker-compose version 1.16.1, build 6d1ac219 **Dockerfile** ``` # Use an official Ubuntu Xenial as a parent image FROM ubuntu:16.04 # Install Node.js 8 and npm 5 RUN apt-get update RUN apt-get -qq upgrade RUN apt-get install -y build-essential RUN apt-get install -y curl RUN curl -sL https://deb.nodesource.com/setup_8.x | bash RUN apt-get install -y nodejs # Set the working directory to /pretty-prism WORKDIR /pretty-prism # Copy the package.json into the container at /pretty-prism COPY package.json /pretty-prism # Install any needed packages specified in package.json RUN npm install # Define environment variable # Make port 8080 available to the world outside this container EXPOSE 8080 # Run `npm start` when the container launches CMD ["npm", "start"] ``` **docker-compose.yml** ``` version: '3' services: preact: build: . command: npm start ports: - "8080:8080" volumes: - .:/pretty-prism ```
This looks to be a bug in one of our dependencies. I created an [issue report](https://github.com/tartley/colorama/issues/147) upstream. In the meantime, You might be able to circumvent the issue using the `--no-ansi` flag. Let me know if that helps! Thanks, @shin- ! Nope, getting the same error with the flag. First, the application in the container starts and the exposed port works fine too. But then after any change in files, I get that error.
2017-10-16T23:57:47Z
[]
[]
Traceback (most recent call last): File "docker-compose", line 6, in <module> File "compose\cli\main.py", line 68, in main File "compose\cli\main.py", line 121, in perform_command File "compose\cli\main.py", line 954, in up File "compose\cli\log_printer.py", line 105, in run File "compose\cli\log_printer.py", line 109, in write File "codecs.py", line 370, in write File "site-packages\colorama\ansitowin32.py", line 40, in write File "site-packages\colorama\ansitowin32.py", line 141, in write File "site-packages\colorama\ansitowin32.py", line 167, in write_and_convert File "site-packages\colorama\ansitowin32.py", line 181, in convert_ansi File "site-packages\colorama\ansitowin32.py", line 212, in call_win32 File "site-packages\colorama\winterm.py", line 132, in erase_screen UnboundLocalError: local variable 'cells_to_erase' referenced before assignment
4,979
docker/compose
docker__compose-5341
2780559a14796ff7c34e4ce6edb6afffaccc0bf1
diff --git a/compose/config/config.py b/compose/config/config.py --- a/compose/config/config.py +++ b/compose/config/config.py @@ -709,14 +709,7 @@ def process_service(service_config): ] if 'build' in service_dict: - if isinstance(service_dict['build'], six.string_types): - service_dict['build'] = resolve_build_path(working_dir, service_dict['build']) - elif isinstance(service_dict['build'], dict): - if 'context' in service_dict['build']: - path = service_dict['build']['context'] - service_dict['build']['context'] = resolve_build_path(working_dir, path) - if 'labels' in service_dict['build']: - service_dict['build']['labels'] = parse_labels(service_dict['build']['labels']) + process_build_section(service_dict, working_dir) if 'volumes' in service_dict and service_dict.get('volume_driver') is None: service_dict['volumes'] = resolve_volume_paths(working_dir, service_dict) @@ -724,6 +717,9 @@ def process_service(service_config): if 'sysctls' in service_dict: service_dict['sysctls'] = build_string_dict(parse_sysctls(service_dict['sysctls'])) + if 'labels' in service_dict: + service_dict['labels'] = parse_labels(service_dict['labels']) + service_dict = process_depends_on(service_dict) for field in ['dns', 'dns_search', 'tmpfs']: @@ -737,6 +733,17 @@ def process_service(service_config): return service_dict +def process_build_section(service_dict, working_dir): + if isinstance(service_dict['build'], six.string_types): + service_dict['build'] = resolve_build_path(working_dir, service_dict['build']) + elif isinstance(service_dict['build'], dict): + if 'context' in service_dict['build']: + path = service_dict['build']['context'] + service_dict['build']['context'] = resolve_build_path(working_dir, path) + if 'labels' in service_dict['build']: + service_dict['build']['labels'] = parse_labels(service_dict['build']['labels']) + + def process_ports(service_dict): if 'ports' not in service_dict: return service_dict
Unable to create container with label With the following container we are getting an error creating the container: ``` dynamodb: image: instructure/dynamo-local-admin labels: - "com.acuris.service.group=companyhub" ports: - "8000:8000" ``` When we run the command: ``` docker-compose run dynamodb ``` We get the error: ``` Traceback (most recent call last): File "/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 68, in main command() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 121, in perform_command handler(command, command_options) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 768, in run run_one_off_container(container_options, self.project, service, options) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 1178, in run_one_off_container **container_options) File "/usr/lib/python2.7/site-packages/compose/service.py", line 288, in create_container previous_container=previous_container, File "/usr/lib/python2.7/site-packages/compose/service.py", line 795, in _get_container_create_options self.config_hash if add_config_hash else None) File "/usr/lib/python2.7/site-packages/compose/service.py", line 1338, in build_container_labels labels = dict(label_options or {}) ValueError: dictionary update sequence element #0 has length 35; 2 is required ``` However, if we change the container definition to the following then it works: ``` dynamodb: image: instructure/dynamo-local-admin labels: com.acuris.service.group: companyhub ports: - "8000:8000" ``` This has only started failing since we upgraded to docker-compose version 1.17.0, build ac53b73.
Same problem here with latest release (1.17.0) ``` ubuntu@master:~$ docker-compose up ubuntu_traefik_1 is up-to-date Creating ubuntu_rancher-server_1 ... ERROR: for ubuntu_rancher-server_1 dictionary update sequence element #0 has length 23; 2 is required ERROR: for rancher-server dictionary update sequence element #0 has length 23; 2 is required Traceback (most recent call last): File "bin/docker-compose", line 6, in <module> File "compose/cli/main.py", line 68, in main File "compose/cli/main.py", line 121, in perform_command File "compose/cli/main.py", line 952, in up File "compose/project.py", line 455, in up File "compose/parallel.py", line 70, in parallel_execute ValueError: dictionary update sequence element #0 has length 23; 2 is required Failed to execute script docker-compose ``` Thanks for the report! I'll look into it asap.
2017-11-03T21:05:45Z
[]
[]
Traceback (most recent call last): File "/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 68, in main command() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 121, in perform_command handler(command, command_options) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 768, in run run_one_off_container(container_options, self.project, service, options) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 1178, in run_one_off_container **container_options) File "/usr/lib/python2.7/site-packages/compose/service.py", line 288, in create_container previous_container=previous_container, File "/usr/lib/python2.7/site-packages/compose/service.py", line 795, in _get_container_create_options self.config_hash if add_config_hash else None) File "/usr/lib/python2.7/site-packages/compose/service.py", line 1338, in build_container_labels labels = dict(label_options or {}) ValueError: dictionary update sequence element #0 has length 35; 2 is required
4,987
docker/compose
docker__compose-5356
7208aeb002c9ecb1668729064681872481499f25
diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ def find_version(*file_paths): 'requests >= 2.6.1, != 2.11.0, != 2.12.2, != 2.18.0, < 2.19', 'texttable >= 0.9.0, < 0.10', 'websocket-client >= 0.32.0, < 1.0', - 'docker >= 2.6.0, < 3.0', + 'docker >= 2.6.1, < 3.0', 'dockerpty >= 0.4.1, < 0.5', 'six >= 1.3.0, < 2', 'jsonschema >= 2.5.1, < 3',
AttributeError: 'SocketIO' object has no attribute 'raw' docker-composeup redis Creating procensus_redis_1 ... Creating procensus_redis_1 ERROR: for procensus_redis_1 'SocketIO' object has no attribute 'raw' ERROR: for redis 'SocketIO' object has no attribute 'raw' ```pytb Traceback (most recent call last): File "/home/graingert/.virtualenvs/gitlab/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/cli/main.py", line 68, in main command() File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/cli/main.py", line 121, in perform_command handler(command, command_options) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/cli/main.py", line 952, in up start=not no_start File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/project.py", line 455, in up get_deps, File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/parallel.py", line 70, in parallel_execute raise error_to_reraise File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/parallel.py", line 168, in producer result = func(obj) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/project.py", line 441, in do start=start File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/service.py", line 471, in execute_convergence_plan scale, detached, start File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/service.py", line 396, in _execute_convergence_create "Creating", File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/parallel.py", line 70, in parallel_execute raise error_to_reraise File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/parallel.py", line 168, in producer result = func(obj) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/service.py", line 394, in <lambda> lambda n: create_and_start(self, n), File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/service.py", line 387, in create_and_start container.attach_log_stream() File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/container.py", line 177, in attach_log_stream self.log_stream = self.attach(stdout=True, stderr=True, stream=True) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/container.py", line 254, in attach return self.client.attach(self.id, *args, **kwargs) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/docker/utils/decorators.py", line 19, in wrapped return f(self, resource_id, *args, **kwargs) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/docker/api/container.py", line 56, in attach response, stream, self._check_is_tty(container) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/docker/api/client.py", line 368, in _read_from_socket socket = self._get_raw_response_socket(response) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/docker/api/client.py", line 276, in _get_raw_response_socket sock = response.raw._fp.fp.raw AttributeError: 'SocketIO' object has no attribute 'raw' ```
probably an issue with docker==2.6.0 Issue raised over there: https://github.com/docker/docker-py/issues/1799
2017-11-09T00:42:17Z
[]
[]
Traceback (most recent call last): File "/home/graingert/.virtualenvs/gitlab/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/cli/main.py", line 68, in main command() File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/cli/main.py", line 121, in perform_command handler(command, command_options) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/cli/main.py", line 952, in up start=not no_start File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/project.py", line 455, in up get_deps, File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/parallel.py", line 70, in parallel_execute raise error_to_reraise File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/parallel.py", line 168, in producer result = func(obj) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/project.py", line 441, in do start=start File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/service.py", line 471, in execute_convergence_plan scale, detached, start File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/service.py", line 396, in _execute_convergence_create "Creating", File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/parallel.py", line 70, in parallel_execute raise error_to_reraise File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/parallel.py", line 168, in producer result = func(obj) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/service.py", line 394, in <lambda> lambda n: create_and_start(self, n), File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/service.py", line 387, in create_and_start container.attach_log_stream() File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/container.py", line 177, in attach_log_stream self.log_stream = self.attach(stdout=True, stderr=True, stream=True) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/compose/container.py", line 254, in attach return self.client.attach(self.id, *args, **kwargs) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/docker/utils/decorators.py", line 19, in wrapped return f(self, resource_id, *args, **kwargs) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/docker/api/container.py", line 56, in attach response, stream, self._check_is_tty(container) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/docker/api/client.py", line 368, in _read_from_socket socket = self._get_raw_response_socket(response) File "/home/graingert/.virtualenvs/gitlab/lib/python3.6/site-packages/docker/api/client.py", line 276, in _get_raw_response_socket sock = response.raw._fp.fp.raw AttributeError: 'SocketIO' object has no attribute 'raw'
4,989
docker/compose
docker__compose-5476
e8d4616723dce3946bb323314547d51f8c84d298
diff --git a/compose/cli/main.py b/compose/cli/main.py --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -511,7 +511,10 @@ def images(self, options): rows = [] for container in containers: image_config = container.image_config - repo_tags = image_config['RepoTags'][0].rsplit(':', 1) + repo_tags = ( + image_config['RepoTags'][0].rsplit(':', 1) if image_config['RepoTags'] + else ('<none>', '<none>') + ) image_id = image_config['Id'].split(':')[1][:12] size = human_readable_file_size(image_config['Size']) rows.append([
Stacktrace / traceback on `sudo docker-compose images` sudo docker-compose images Traceback (most recent call last): File "/usr/bin/docker-compose", line 11, in <module> load_entry_point('docker-compose==1.17.1', 'console_scripts', 'docker-compose')() File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 68, in main command() File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 121, in perform_command handler(command, command_options) File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 517, in images repo_tags = image_config['RepoTags'][0].rsplit(':', 1) IndexError: list index out of range
Thanks for the report! Could you share your Compose file as well? I've got this too, going to see if I can make a minimal compose file that'll trigger it e: Hmm It's not immediately obvious whats triggering this from my end ok the offending container has a RepoTags entry in its dict that's empty. I don't know if thats out of spec or? `u'RepoTags': []` Yeah, that makes sense given the error, but I'm curious because pulled images should be tagged, and Compose automatically tags images it builds. So there's a scenario I must be missing. Are you using a sha ID as the `image` value? I'm not using a sha as the image value. it's built by compose I'm pretty sure though I'm having some difficulties locating the container outside of inspect https://gist.github.com/jrabbit/dab888257a06656f0f6e0fd7d4e8327e
2017-12-12T22:46:19Z
[]
[]
Traceback (most recent call last): File "/usr/bin/docker-compose", line 11, in <module> load_entry_point('docker-compose==1.17.1', 'console_scripts', 'docker-compose')() File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 68, in main command() File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 121, in perform_command handler(command, command_options) File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 517, in images repo_tags = image_config['RepoTags'][0].rsplit(':', 1) IndexError: list index out of range
5,007
docker/compose
docker__compose-548
6580c5609c11cf90253a8a71088586c161916564
diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def find_version(*file_paths): 'requests >= 2.2.1, < 3', 'texttable >= 0.8.1, < 0.9', 'websocket-client >= 0.11.0, < 0.12', - 'docker-py >= 0.5, < 0.6', + 'docker-py >= 0.5.3, < 0.6', 'six >= 1.3.0, < 2', ]
fig can not start with tls env I have installed fig 1.0.0 on my mac, but I can not start fig now. My env: Boot2Docker 1.3 on Mac ➜ figtest env |grep DOCKER DOCKER_HOST=tcp://192.168.59.103:2376 DOCKER_CERT_PATH=/Users/linux_china/.boot2docker/certs/boot2docker-vm DOCKER_TLS_VERIFY=1 ➜ figtest fig up Traceback (most recent call last): File "/usr/local/bin/fig", line 8, in <module> load_entry_point('fig==1.0.0', 'console_scripts', 'fig')() File "/Library/Python/2.7/site-packages/fig/cli/main.py", line 31, in main command.sys_dispatch() File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 28, in dispatch super(Command, self).dispatch(_args, *_kwargs) File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 49, in perform_command verbose=options.get('--verbose')) File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 78, in get_project self.get_client(verbose=verbose)) File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 54, in get_client client = docker_client() File "/Library/Python/2.7/site-packages/fig/cli/docker_client.py", line 31, in docker_client ca_cert=ca_cert, TypeError: **init**() got an unexpected keyword argument 'assert_hostname' ➜ figtest
This looks like it's using an older version of `docker-py` somehow. This feature required `docker-py>=0.5.3` How did you install fig? with pip or the binary ? What is the version in `/Library/Python/2.7/site-packages/docker/version.py` ? I think we need to bump the minimum version in setup.py to be docker-py==0.5.3. @dnephin you are right. I installed fig 1.0.0 with pip and found 0.5.3 is absent on https://pypi.python.org/pypi . Now I install the docker-py manually and fig is ok with tls support.
2014-10-17T10:21:00Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/fig", line 8, in <module> load_entry_point('fig==1.0.0', 'console_scripts', 'fig')() File "/Library/Python/2.7/site-packages/fig/cli/main.py", line 31, in main command.sys_dispatch() File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 28, in dispatch super(Command, self).dispatch(_args, *_kwargs) File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 49, in perform_command verbose=options.get('--verbose')) File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 78, in get_project self.get_client(verbose=verbose)) File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 54, in get_client client = docker_client() File "/Library/Python/2.7/site-packages/fig/cli/docker_client.py", line 31, in docker_client ca_cert=ca_cert, TypeError: **init**() got an unexpected keyword argument 'assert_hostname'
5,008
docker/compose
docker__compose-5490
9355d35c6bbdfce7e35260bad091f97bb0ae0c0a
diff --git a/compose/service.py b/compose/service.py --- a/compose/service.py +++ b/compose/service.py @@ -785,6 +785,35 @@ def _get_container_create_options( self.options.get('labels'), override_options.get('labels')) + container_options, override_options = self._build_container_volume_options( + previous_container, container_options, override_options + ) + + container_options['image'] = self.image_name + + container_options['labels'] = build_container_labels( + container_options.get('labels', {}), + self.labels(one_off=one_off), + number, + self.config_hash if add_config_hash else None) + + # Delete options which are only used in HostConfig + for key in HOST_CONFIG_KEYS: + container_options.pop(key, None) + + container_options['host_config'] = self._get_container_host_config( + override_options, + one_off=one_off) + + networking_config = self.build_default_networking_config() + if networking_config: + container_options['networking_config'] = networking_config + + container_options['environment'] = format_environment( + container_options['environment']) + return container_options + + def _build_container_volume_options(self, previous_container, container_options, override_options): container_volumes = [] container_mounts = [] if 'volumes' in container_options: @@ -801,7 +830,11 @@ def _get_container_create_options( container_options['environment'].update(affinity) container_options['volumes'] = dict((v.internal, {}) for v in container_volumes or {}) - override_options['mounts'] = [build_mount(v) for v in container_mounts] or None + if version_gte(self.client.api_version, '1.30'): + override_options['mounts'] = [build_mount(v) for v in container_mounts] or None + else: + override_options['binds'].extend(m.legacy_repr() for m in container_mounts) + container_options['volumes'].update((m.target, {}) for m in container_mounts) secret_volumes = self.get_secret_volumes() if secret_volumes: @@ -814,29 +847,7 @@ def _get_container_create_options( override_options['mounts'] = override_options.get('mounts') or [] override_options['mounts'].extend([build_mount(v) for v in secret_volumes]) - container_options['image'] = self.image_name - - container_options['labels'] = build_container_labels( - container_options.get('labels', {}), - self.labels(one_off=one_off), - number, - self.config_hash if add_config_hash else None) - - # Delete options which are only used in HostConfig - for key in HOST_CONFIG_KEYS: - container_options.pop(key, None) - - container_options['host_config'] = self._get_container_host_config( - override_options, - one_off=one_off) - - networking_config = self.build_default_networking_config() - if networking_config: - container_options['networking_config'] = networking_config - - container_options['environment'] = format_environment( - container_options['environment']) - return container_options + return container_options, override_options def _get_container_host_config(self, override_options, one_off=False): options = dict(self.options, **override_options)
API Version mismatch between docker-compose and system docker-ce **Relevant `docker-compose --verbose up` output** ``` urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/images/ormuco-vpn:compose-build/json HTTP/1.1" 200 2041 ``` Then a little bit later... ``` compose.cli.verbose_proxy.proxy_callable: docker create_host_config <- (device_read_iops=None, mem_swappiness=None, links=[], oom_score_adj=None, blkio_weight=None, cpu_count=None, cpuset_cpus=None, dns_search=None, pid_mode=None, init_path=None, log_config={'Type': u'', 'Config': {}}, cpu_quota=None, read_only=None, cpu_percent=None, device_read_bps=None, storage_opt=None, init=None, dns=None, volumes_from=[], ipc_mode=None, mem_reservation=None, security_opt=None, shm_size=None, device_write_iops=None, dns_opt=None, cgroup_parent=None, group_add=None, network_mode=u'cerebrom_default', volume_driver=None, oom_kill_disable=None, userns_mode=None, tmpfs=None, nano_cpus=None, port_bindings={'9600/tcp': [None]}, isolation=None, memswap_limit=None, restart_policy=None, blkio_weight_device=None, devices=None, extra_hosts=None, binds=[], sysctls=None, pids_limit=None, device_write_bps=None, cap_add=None, mounts=[{'Source': u'/home/wayne/projects/ormuco/cerebrom/docker/ormuco-vpn/credentials/vpnc', 'ReadOnly': None, 'Type': 'bind', 'Target': '/etc/vpnc'}, {'Source': u'/home/wayne/projects/ormuco/cerebrom/docker/ormuco-vpn/credentials/ssh', 'ReadOnly': None, 'Type': 'bind', 'Target': '/ssh'}], mem_limit=None, cap_drop=None, privileged=False, ulimits=None, cpu_shares=None) compose.parallel.parallel_execute_iter: Failed: <Container: 21d4214f35f5_cerebrom_ormuco-vpn_1 (21d421)> compose.parallel.feed_queue: Pending: set([]) ERROR: for 21d4214f35f5_cerebrom_ormuco-vpn_1 mounts param is not supported in API versions < 1.30 compose.parallel.parallel_execute_iter: Failed: <Service: ormuco-vpn> compose.parallel.feed_queue: Pending: set([<Service: proctor>]) compose.parallel.feed_queue: <Service: proctor> has upstream errors - not processing compose.parallel.parallel_execute_iter: Failed: <Service: proctor> compose.parallel.feed_queue: Pending: set([]) ERROR: for ormuco-vpn mounts param is not supported in API versions < 1.30 Traceback (most recent call last): File "/home/wayne/.virtualenvs/cerebrom-5qiep0Vx/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/home/wayne/.virtualenvs/cerebrom-5qiep0Vx/local/lib/python2.7/site-packages/compose/cli/main.py", line 71, in main command() File "/home/wayne/.virtualenvs/cerebrom-5qiep0Vx/local/lib/python2.7/site-packages/compose/cli/main.py", line 124, in perform_command handler(command, command_options) File "/home/wayne/.virtualenvs/cerebrom-5qiep0Vx/local/lib/python2.7/site-packages/compose/cli/main.py", line 956, in up start=not no_start File "/home/wayne/.virtualenvs/cerebrom-5qiep0Vx/local/lib/python2.7/site-packages/compose/project.py", line 479, in up get_deps, File "/home/wayne/.virtualenvs/cerebrom-5qiep0Vx/local/lib/python2.7/site-packages/compose/parallel.py", line 80, in parallel_execute raise error_to_reraise docker.errors.InvalidVersion: mounts param is not supported in API versions < 1.30 ``` **`docker version` output** ``` Client: Version: 17.09.0-ce API version: 1.32 Go version: go1.8.3 Git commit: afdb6d4 Built: Tue Sep 26 22:42:09 2017 OS/Arch: linux/amd64 Server: Version: 17.09.0-ce API version: 1.32 (minimum version 1.12) Go version: go1.8.3 Git commit: afdb6d4 Built: Tue Sep 26 22:40:48 2017 OS/Arch: linux/amd64 Experimental: false ``` **`docker info` output** ``` Containers: 13 Running: 4 Paused: 0 Stopped: 9 Images: 245 Server Version: 17.09.0-ce Storage Driver: overlay Backing Filesystem: extfs Supports d_type: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0 runc version: 3f2f8b84a77f73d38244dd690525642a72156c64 init version: 949e6fa Security Options: seccomp Profile: default Kernel Version: 4.9.0-3-amd64 Operating System: Debian GNU/Linux 9 (stretch) OSType: linux Architecture: x86_64 CPUs: 12 Total Memory: 23.5GiB Name: agora ID: UW3Z:67B4:Y2UM:YQS6:RD6G:7IMS:NE5R:3P32:27YZ:ZJQD:44ZA:QVX5 Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false ``` **`docker-compose --version` output** ``` docker-compose version 1.18.0-rc2, build 189468b ``` **my thoughts** It seems strange to me that `docker-compose` attempts to use API version `1.25` rather than `1.32` as reported by `docker version` (see above). Is it because `docker-compose` `1.18.0-rc2` simply doesn't support API version `1.32`? Or am I doing something incorrectly that causes `docker-compose` to use API version `1.25`? Also it's worth mentioning that I am attempting to use https://docs.docker.com/compose/compose-file/#long-syntax-3; whenever I exclude the `volumes` key from the service this problem affects the api version conflict doesn't occur. I guess the next thing I'll try is https://docs.docker.com/compose/compose-file/#short-syntax-3.
Thanks for the report - do you mind sharing your Compose file as well? @shin- I don't think I'm allowed to share the compose file i've been working with but here is a minimal reproduction case: ``` version: "3.2" services: mysql: image: "mysql:5.7" volumes: - type: bind source: ./mysql_data target: /var/lib/mysql environment: - MYSQL_USER=whatever - MYSQL_PASSWORD=changeme - MYSQL_ROOT_PASSWORD=changeme - MYSQL_DATABASE=dbname ``` However, the following does not reproduce: ``` version: "3.2" services: mysql: image: "mysql:5.7" volumes: - './mysql_data:/var/lib/mysql' environment: - MYSQL_USER=whatever - MYSQL_PASSWORD=changeme - MYSQL_ROOT_PASSWORD=changeme - MYSQL_DATABASE=dbname ``` So in other words, using the short-syntax as I mentioned in my original comment solves the problem I was seeing. Thanks! I'll make sure to get that fixed in time for GA. I'd also be happy to take a stab at it after work some night this week if you think it's something a new contributor could take on with a few pointers. Thanks @waynr - I really appreciate the offer! We're a bit far into the release cycle this time around and with the holiday coming up, I want to take care of this ASAP, but in general I'm always elated to see bugfix PRs coming in :+1: Also, as a workaround, the error you're seeing should clear up if you use version `3.3` or `3.4` instead. HTH!
2017-12-18T20:41:23Z
[]
[]
Traceback (most recent call last): File "/home/wayne/.virtualenvs/cerebrom-5qiep0Vx/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/home/wayne/.virtualenvs/cerebrom-5qiep0Vx/local/lib/python2.7/site-packages/compose/cli/main.py", line 71, in main command() File "/home/wayne/.virtualenvs/cerebrom-5qiep0Vx/local/lib/python2.7/site-packages/compose/cli/main.py", line 124, in perform_command handler(command, command_options) File "/home/wayne/.virtualenvs/cerebrom-5qiep0Vx/local/lib/python2.7/site-packages/compose/cli/main.py", line 956, in up start=not no_start File "/home/wayne/.virtualenvs/cerebrom-5qiep0Vx/local/lib/python2.7/site-packages/compose/project.py", line 479, in up get_deps, File "/home/wayne/.virtualenvs/cerebrom-5qiep0Vx/local/lib/python2.7/site-packages/compose/parallel.py", line 80, in parallel_execute raise error_to_reraise docker.errors.InvalidVersion: mounts param is not supported in API versions < 1.30
5,009
docker/compose
docker__compose-5537
bcc13d7fae223c49322bb1218e62c9bcecc2f35d
diff --git a/compose/cli/command.py b/compose/cli/command.py --- a/compose/cli/command.py +++ b/compose/cli/command.py @@ -10,6 +10,7 @@ from . import errors from . import verbose_proxy from .. import config +from .. import parallel from ..config.environment import Environment from ..const import API_VERSIONS from ..project import Project @@ -23,6 +24,8 @@ def project_from_options(project_dir, options): environment = Environment.from_env_file(project_dir) + set_parallel_limit(environment) + host = options.get('--host') if host is not None: host = host.lstrip('=') @@ -38,6 +41,22 @@ def project_from_options(project_dir, options): ) +def set_parallel_limit(environment): + parallel_limit = environment.get('COMPOSE_PARALLEL_LIMIT') + if parallel_limit: + try: + parallel_limit = int(parallel_limit) + except ValueError: + raise errors.UserError( + 'COMPOSE_PARALLEL_LIMIT must be an integer (found: "{}")'.format( + environment.get('COMPOSE_PARALLEL_LIMIT') + ) + ) + if parallel_limit <= 1: + raise errors.UserError('COMPOSE_PARALLEL_LIMIT can not be less than 2') + parallel.GlobalLimit.set_global_limit(parallel_limit) + + def get_config_from_options(base_dir, options): environment = Environment.from_env_file(base_dir) config_path = get_config_path_from_options( diff --git a/compose/const.py b/compose/const.py --- a/compose/const.py +++ b/compose/const.py @@ -18,6 +18,7 @@ LABEL_VOLUME = 'com.docker.compose.volume' LABEL_CONFIG_HASH = 'com.docker.compose.config-hash' NANOCPUS_SCALE = 1000000000 +PARALLEL_LIMIT = 64 SECRETS_PATH = '/run/secrets' diff --git a/compose/parallel.py b/compose/parallel.py --- a/compose/parallel.py +++ b/compose/parallel.py @@ -15,6 +15,7 @@ from compose.cli.colors import green from compose.cli.colors import red from compose.cli.signals import ShutdownException +from compose.const import PARALLEL_LIMIT from compose.errors import HealthCheckFailed from compose.errors import NoHealthCheckConfigured from compose.errors import OperationFailedError @@ -26,6 +27,20 @@ STOP = object() +class GlobalLimit(object): + """Simple class to hold a global semaphore limiter for a project. This class + should be treated as a singleton that is instantiated when the project is. + """ + + global_limiter = Semaphore(PARALLEL_LIMIT) + + @classmethod + def set_global_limit(cls, value): + if value is None: + value = PARALLEL_LIMIT + cls.global_limiter = Semaphore(value) + + def parallel_execute(objects, func, get_name, msg, get_deps=None, limit=None, parent_objects=None): """Runs func on objects in parallel while ensuring that func is ran on object only after it is ran on all its dependencies. @@ -173,7 +188,7 @@ def producer(obj, func, results, limiter): The entry point for a producer thread which runs func on a single object. Places a tuple on the results queue once func has either returned or raised. """ - with limiter: + with limiter, GlobalLimit.global_limiter: try: result = func(obj) results.put((obj, result, None))
Using "scale" exhausts system limits and then errors out # Problem Its possible to exhaust system resources by doing something like ``` $ docker-compose scale web=1000 ``` It appears that we try to execute this request in parallel, causing the system limit of open files (in this case) to be exceed. ``` Exception in thread Thread-5: Traceback (most recent call last): File "/compose/build/docker-compose/out00-PYZ.pyz/threading", line 810, in __bootstrap_inner File "/compose/build/docker-compose/out00-PYZ.pyz/threading", line 763, in run File "/compose/build/docker-compose/out00-PYZ.pyz/compose.utils", line 31, in inner_execute_function File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 220, in <lambda> File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 173, in create_and_start File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 268, in create_container File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 579, in _get_container_create_options File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 464, in config_hash File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 469, in config_dict File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 295, in image File "/compose/build/docker-compose/out00-PYZ.pyz/docker.utils.decorators", line 20, in wrapped File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 489, in inspect_image File "/compose/build/docker-compose/out00-PYZ.pyz/docker.clientbase", line 86, in _get File "/compose/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 477, in get File "/compose/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 465, in request File "/compose/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 573, in send File "/compose/build/docker-compose/out00-PYZ.pyz/requests.adapters", line 370, in send File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.connectionpool", line 544, in urlopen File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.connectionpool", line 341, in _make_request File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.connectionpool", line 761, in _validate_conn File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.connection", line 238, in connect File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.util.ssl_", line 277, in ssl_wrap_socket IOError: [Errno 24] Too many open files ``` # Solution Possible solutions - inspect the system limits and work within those limits - limit the parallelization that compose uses # Workaround Batch the scaling from the command line e.g. `docker-compose scale web=10` # Environment ``` $ docker-compose --version docker-compose version: 1.4.0rc3 ``` ``` $ uname -a Darwin vero.local 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64 ``` ``` $ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) 256 pipe size (512 bytes, -p) 1 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 709 virtual memory (kbytes, -v) unlimited ```
Rather than dynamically pick a limit, it'd be simpler to arbitrarily hardcode one (with an environment variable to override it, as was done in an older implementation). 64 concurrent operations should be enough for anyone. As per #5422, I have another use case: when a developer is starting all these containers on a laptop. In that case, it makes sense to stagger the spawning of the containers so they don't thrash competing for resources.
2018-01-04T20:20:29Z
[]
[]
Traceback (most recent call last): File "/compose/build/docker-compose/out00-PYZ.pyz/threading", line 810, in __bootstrap_inner File "/compose/build/docker-compose/out00-PYZ.pyz/threading", line 763, in run File "/compose/build/docker-compose/out00-PYZ.pyz/compose.utils", line 31, in inner_execute_function File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 220, in <lambda> File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 173, in create_and_start File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 268, in create_container File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 579, in _get_container_create_options File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 464, in config_hash File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 469, in config_dict File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 295, in image File "/compose/build/docker-compose/out00-PYZ.pyz/docker.utils.decorators", line 20, in wrapped File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 489, in inspect_image File "/compose/build/docker-compose/out00-PYZ.pyz/docker.clientbase", line 86, in _get File "/compose/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 477, in get File "/compose/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 465, in request File "/compose/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 573, in send File "/compose/build/docker-compose/out00-PYZ.pyz/requests.adapters", line 370, in send File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.connectionpool", line 544, in urlopen File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.connectionpool", line 341, in _make_request File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.connectionpool", line 761, in _validate_conn File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.connection", line 238, in connect File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.util.ssl_", line 277, in ssl_wrap_socket IOError: [Errno 24] Too many open files
5,014
docker/compose
docker__compose-554
2efb4f5be0e4f0df9340b4769524cd470e53017c
diff --git a/fig/cli/docker_client.py b/fig/cli/docker_client.py --- a/fig/cli/docker_client.py +++ b/fig/cli/docker_client.py @@ -11,7 +11,7 @@ def docker_client(): """ cert_path = os.environ.get('DOCKER_CERT_PATH', '') if cert_path == '': - cert_path = os.path.join(os.environ.get('HOME'), '.docker') + cert_path = os.path.join(os.environ.get('HOME', ''), '.docker') base_url = os.environ.get('DOCKER_HOST') tls_config = None diff --git a/fig/progress_stream.py b/fig/progress_stream.py --- a/fig/progress_stream.py +++ b/fig/progress_stream.py @@ -19,7 +19,9 @@ def stream_output(output, stream): all_events.append(event) if 'progress' in event or 'progressDetail' in event: - image_id = event['id'] + image_id = event.get('id') + if not image_id: + continue if image_id in lines: diff = len(lines) - lines[image_id]
Error in stream_output during ADD command in Dockerfile ``` Step 5 : ADD https://rtdata.dtcc.com/payload.tgz /tmp/ Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==0.5.2', 'console_scripts', 'fig')() File "/home/vagrant/src/fig/fig/cli/main.py", line 31, in main command.sys_dispatch() File "/home/vagrant/src/fig/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/home/vagrant/src/fig/fig/cli/command.py", line 28, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/home/vagrant/src/fig/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/home/vagrant/src/fig/fig/cli/command.py", line 49, in perform_command handler(project, command_options) File "/home/vagrant/src/fig/fig/cli/main.py", line 119, in build project.build(service_names=options['SERVICE'], no_cache=no_cache) File "/home/vagrant/src/fig/fig/project.py", line 166, in build service.build(no_cache) File "/home/vagrant/src/fig/fig/service.py", line 404, in build all_events = stream_output(build_output, sys.stdout) File "/home/vagrant/src/fig/fig/progress_stream.py", line 22, in stream_output image_id = event['id'] KeyError: 'id' ``` branch master More details available or forthcoming (still investigating).
It looks like the output from the docker remote is not what fig expected. What version of Docker are you using? I believe fig expects 1.0 or later. Docker version 1.3.0, build c78088f I tried an `ADD https://...tar.gz` and fig build worked with both docker 1.0 and 1.2. It's possible the api changed in 1.3 (this part of the api is not well documented). Would it be possible to add a `print event` before this line (line 22) to get some more debug information? ``` event is: {u'status': u'Downloading', u'progressDetail': {u'current': 15988, u'start': 1413495811, u'total': 1545876}, u'progress': u'[> ] 15.99 kB/1.546 MB 8s'} ``` Other idea, maybe it's docker-py's fault? Further idea: switch to `RUN wget`. I think the reason I can't reproduce is because the tarball I was using was small enough that it never send a "status: downloading" line. I will have to try again with a larger file, it may not be docker 1.3 related at all I can confirm this is a change in behaviour with docker 1.3. I tried with a large `.tar.gz` on docker 1.2, and there was no crash. In 1.3 the API for this endpoint has changed, and it's sending back a different response. I think there are actually two things to do here: 1. prevent the crash 2. actually use the new output to display a progress status bar for these downloads (possibly create a new issue for this)
2014-10-18T17:57:53Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/fig", line 9, in <module> load_entry_point('fig==0.5.2', 'console_scripts', 'fig')() File "/home/vagrant/src/fig/fig/cli/main.py", line 31, in main command.sys_dispatch() File "/home/vagrant/src/fig/fig/cli/docopt_command.py", line 21, in sys_dispatch self.dispatch(sys.argv[1:], None) File "/home/vagrant/src/fig/fig/cli/command.py", line 28, in dispatch super(Command, self).dispatch(*args, **kwargs) File "/home/vagrant/src/fig/fig/cli/docopt_command.py", line 24, in dispatch self.perform_command(*self.parse(argv, global_options)) File "/home/vagrant/src/fig/fig/cli/command.py", line 49, in perform_command handler(project, command_options) File "/home/vagrant/src/fig/fig/cli/main.py", line 119, in build project.build(service_names=options['SERVICE'], no_cache=no_cache) File "/home/vagrant/src/fig/fig/project.py", line 166, in build service.build(no_cache) File "/home/vagrant/src/fig/fig/service.py", line 404, in build all_events = stream_output(build_output, sys.stdout) File "/home/vagrant/src/fig/fig/progress_stream.py", line 22, in stream_output image_id = event['id'] KeyError: 'id'
5,015
docker/compose
docker__compose-5552
c4fda0834d0fd70d9a9f4334ce94b8d88f8eb03c
diff --git a/compose/config/interpolation.py b/compose/config/interpolation.py --- a/compose/config/interpolation.py +++ b/compose/config/interpolation.py @@ -137,6 +137,8 @@ def convert(mo): if named is not None: val = mapping[named] + if isinstance(val, six.binary_type): + val = val.decode('utf-8') return '%s' % (val,) if mo.group('escaped') is not None: return self.delimiter diff --git a/compose/config/serialize.py b/compose/config/serialize.py --- a/compose/config/serialize.py +++ b/compose/config/serialize.py @@ -27,6 +27,9 @@ def serialize_string(dumper, data): """ Ensure boolean-like strings are quoted in the output and escape $ characters """ representer = dumper.represent_str if six.PY3 else dumper.represent_unicode + if isinstance(data, six.binary_type): + data = data.decode('utf-8') + data = data.replace('$', '$$') if data.lower() in ('y', 'n', 'yes', 'no', 'on', 'off', 'true', 'false'): @@ -90,7 +93,8 @@ def serialize_config(config, image_digests=None): denormalize_config(config, image_digests), default_flow_style=False, indent=2, - width=80 + width=80, + allow_unicode=True )
docker-compose config fails with stack trace It works on my machine (docker-compose version 1.17.1, build 6d101fb) but not on my CI (docker-compose version 1.18.0, build 8dd22a9). `docker-compose -f docker-compose.yml -f docker-compose.env.yml config > docker-compose.deploy.yml` `docker-compose.yml` ``` version: '3.3' services: botrouter: environment: - BOTS image: ${IMAGE:-botrouter}:${TAG:-latest} labels: - "traefik.backend=production-bot-router" - "traefik.enable=true" - "traefik.frontend.rule=Host: bot.domain.com" - "traefik.port=80" restart: always ``` `docker-compose.env.yml` ``` version: '3.3' services: botrouter: labels: traefik.backend: "${ENV}-bot-router" traefik.frontend.rule: "Host: ${ENV}.bot.domain.com" ``` Output: ``` Traceback (most recent call last): File "/usr/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 71, in main command() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 118, in perform_command handler(command, options, command_options) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 322, in config print(serialize_config(compose_config, image_digests)) File "/usr/lib/python2.7/site-packages/compose/config/serialize.py", line 93, in serialize_config width=80 File "/usr/lib/python2.7/site-packages/yaml/__init__.py", line 218, in safe_dump return dump_all([data], stream, Dumper=SafeDumper, **kwds) File "/usr/lib/python2.7/site-packages/yaml/__init__.py", line 190, in dump_all dumper.represent(data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 28, in represent node = self.represent_data(data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 225, in represent_dict return self.represent_mapping(u'tag:yaml.org,2002:map', data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 123, in represent_mapping node_value = self.represent_data(item_value) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 225, in represent_dict return self.represent_mapping(u'tag:yaml.org,2002:map', data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 123, in represent_mapping node_value = self.represent_data(item_value) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 225, in represent_dict return self.represent_mapping(u'tag:yaml.org,2002:map', data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 123, in represent_mapping node_value = self.represent_data(item_value) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 225, in represent_dict return self.represent_mapping(u'tag:yaml.org,2002:map', data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 123, in represent_mapping node_value = self.represent_data(item_value) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/usr/lib/python2.7/site-packages/compose/config/serialize.py", line 30, in serialize_string data = data.replace('$', '$$') UnicodeDecodeError: ‘ascii’ codec can't decode byte 0xe2 in position 1: ordinal not in range(128) ```
@yangm97 thanks! have you tried downgrading to 1.17.1 on your CI? Do you still see the issue? Downgrading to 1.171 fixes the issue indeed.
2018-01-10T00:51:00Z
[]
[]
Traceback (most recent call last): File "/usr/bin/docker-compose", line 11, in <module> sys.exit(main()) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 71, in main command() File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 118, in perform_command handler(command, options, command_options) File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 322, in config print(serialize_config(compose_config, image_digests)) File "/usr/lib/python2.7/site-packages/compose/config/serialize.py", line 93, in serialize_config width=80 File "/usr/lib/python2.7/site-packages/yaml/__init__.py", line 218, in safe_dump return dump_all([data], stream, Dumper=SafeDumper, **kwds) File "/usr/lib/python2.7/site-packages/yaml/__init__.py", line 190, in dump_all dumper.represent(data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 28, in represent node = self.represent_data(data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 225, in represent_dict return self.represent_mapping(u'tag:yaml.org,2002:map', data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 123, in represent_mapping node_value = self.represent_data(item_value) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 225, in represent_dict return self.represent_mapping(u'tag:yaml.org,2002:map', data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 123, in represent_mapping node_value = self.represent_data(item_value) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 225, in represent_dict return self.represent_mapping(u'tag:yaml.org,2002:map', data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 123, in represent_mapping node_value = self.represent_data(item_value) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 225, in represent_dict return self.represent_mapping(u'tag:yaml.org,2002:map', data) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 123, in represent_mapping node_value = self.represent_data(item_value) File "/usr/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data node = self.yaml_representers[data_types[0]](self, data) File "/usr/lib/python2.7/site-packages/compose/config/serialize.py", line 30, in serialize_string data = data.replace('$', '$$') UnicodeDecodeError: ‘ascii’ codec can't decode byte 0xe2 in position 1: ordinal not in range(128)
5,017