repo
stringclasses
856 values
pull_number
int64
3
127k
instance_id
stringlengths
12
58
issue_numbers
sequencelengths
1
5
base_commit
stringlengths
40
40
patch
stringlengths
67
1.54M
test_patch
stringlengths
0
107M
problem_statement
stringlengths
3
307k
hints_text
stringlengths
0
908k
created_at
timestamp[s]
conda/conda
6,723
conda__conda-6723
[ "6684" ]
cc54f5b5ca84cbe10224f57800202e7aee70e161
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 @@ -988,8 +988,7 @@ def add_parser_create_install_update(p): '-f', "--force", action="store_true", default=NULL, - help="Force install (even when package already installed), " - "implies --no-deps.", + help="Force install (even when package already installed).", ) add_parser_pscheck(p) # Add the file kwarg. We don't use {action="store", nargs='*'} as we don't
--force does NOT imply --no-deps (anymore?) Using conda 4.4.7, `conda install --force` does not seem to imply `--no-deps`, even so it says in the docstring: ```bash -f, --force Force install (even when package already installed), implies --no-deps. ``` Here I try only `--force`: ```bash (stable) └─❱❱❱ conda install -f hdf5=1.8 +8947 16:46 ❰─┘ Solving environment: done ## Package Plan ## environment location: /Users/klay6683/miniconda3/envs/stable added / updated specs: - hdf5=1.8 The following packages will be UPDATED: libdap4: 3.18.3-2 conda-forge --> 3.19.2-1 conda-forge libpq: 9.6.3-0 conda-forge --> 9.6.6-h77f6c7a_0 The following packages will be DOWNGRADED: gdal: 2.2.3-py36_0 conda-forge --> 2.2.2-py36hd505dc6_1 h5py: 2.7.1-py36_2 conda-forge --> 2.7.1-py36_1 conda-forge hdf5: 1.10.1-1 conda-forge --> 1.8.18-2 conda-forge kealib: 1.4.7-4 conda-forge --> 1.4.7-3 conda-forge libgdal: 2.2.3-2 conda-forge --> 2.2.2-hc3eca24_1 libnetcdf: 4.4.1.1-10 conda-forge --> 4.4.1.1-9 conda-forge netcdf4: 1.3.1-py36_1 conda-forge --> 1.3.1-py36_0 conda-forge pytables: 3.4.2-py36_7 conda-forge --> 3.4.2-py36_6 conda-forge ``` As you can see, it tries to downgrade the dependencies. Using `--no-deps`, things work as expected: ```bash (stable) └─❱❱❱ conda install --no-deps hdf5=1.8 +8949 16:47 ❰─┘ Solving environment: done ## Package Plan ## environment location: /Users/klay6683/miniconda3/envs/stable added / updated specs: - hdf5=1.8 The following packages will be DOWNGRADED: hdf5: 1.10.1-1 conda-forge --> 1.8.18-2 conda-forge ``` Running on macOS 10.12.6.
Up through conda 4.3, `--force` has had several different conflated meanings. We disentangled a lot of that in conda 4.4. I think there's still more to do though. The help message there should be updated. The correct solution now is to use `--no-deps` if you want no-deps, as you've discovered.
2018-01-13T05:17:12
conda/conda
6,724
conda__conda-6724
[ "6628" ]
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:
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -1568,6 +1568,7 @@ def test_conda_downgrade(self): stdout, stderr = run_command(Commands.LIST, prefix, "--revisions") print(stdout) + PrefixData._cache_.clear() run_command(Commands.INSTALL, prefix, "--rev 3") PrefixData._cache_.clear() assert package_is_installed(prefix, "conda-4.3.27")
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:39
conda/conda
6,741
conda__conda-6741
[ "6733" ]
d6d3ec3f8546ced1e803f5c232d39ec8da028057
diff --git a/conda/common/configuration.py b/conda/common/configuration.py --- a/conda/common/configuration.py +++ b/conda/common/configuration.py @@ -206,14 +206,12 @@ class EnvRawParameter(RawParameter): def value(self, parameter_obj): if hasattr(parameter_obj, 'string_delimiter'): + assert isinstance(self._raw_value, string_types) string_delimiter = getattr(parameter_obj, 'string_delimiter') # TODO: add stripping of !important, !top, and !bottom - raw_value = self._raw_value - if string_delimiter in raw_value: - value = raw_value.split(string_delimiter) - else: - value = [raw_value] - return tuple(v.strip() for v in value) + return tuple(v for v in ( + vv.strip() for vv in self._raw_value.split(string_delimiter) + ) if v) else: return self.__important_split_value[0].strip()
diff --git a/tests/common/test_configuration.py b/tests/common/test_configuration.py --- a/tests/common/test_configuration.py +++ b/tests/common/test_configuration.py @@ -241,6 +241,21 @@ def make_key(appname, key): finally: [environ.pop(key) for key in test_dict] + def test_env_var_config_empty_sequence(self): + def make_key(appname, key): + return "{0}_{1}".format(appname.upper(), key.upper()) + appname = "myapp" + test_dict = {} + test_dict[make_key(appname, 'channels')] = '' + + try: + environ.update(test_dict) + assert 'MYAPP_CHANNELS' in environ + config = SampleConfiguration()._set_env_vars(appname) + assert config.channels == () + finally: + [environ.pop(key) for key in test_dict] + def test_load_raw_configs(self): try: tempdir = mkdtemp()
Empty sequences for configuration parameters cannot be expressed in environment variables <!-- 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...** - [ ] bug report - [x] feature request ### Current Behavior <!-- What actually happens? --> For a configuration parameter that accepts sequences, an empty value in the corresponding environment variable gets interpreted as an one-element sequence containing an empty string, i.e., `[""]`. Thus there is no way to specify an empty sequence via an environment variable. ### 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. --> ```bash $ export CONDA_CHANNELS= $ conda config --show channels channels: - $ export CONDA_CHANNELS=defaults, $ conda config --show channels channels: - defaults - $ export CONDA_CHANNELS=defaults,, $ conda config --show channels channels: - defaults - ``` ### Expected Behavior <!-- What do you think should happen? --> One possibility to allow empty sequences would be to allow and ignore trailing separator, i.e., interpret * `,` as `[]`, * `,,` as `[""]`, * `,,,` as `["", ""]`, * `defaults,` as `["defaults"]`, * `defaults,,` as `["defaults", ""]`. The commands given above would then yield: ```bash $ export CONDA_CHANNELS= $ conda config --show channels channels: [] $ export CONDA_CHANNELS=defaults, $ conda config --show channels channels: - defaults $ export CONDA_CHANNELS=defaults,, $ conda config --show channels channels: - defaults - ``` ##### `conda info` <!-- between the ticks below, paste the output of 'conda info' --> ``` active environment : base active env location : /home/maba/code/conda/conda-4.4 shell level : 1 user config file : /home/maba/.condarc populated config files : /home/maba/code/conda/conda-4.4/.condarc conda version : 4.4.7 conda-build version : not installed python version : 3.6.4.final.0 base environment : /home/maba/code/conda/conda-4.4 (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 : /home/maba/code/conda/conda-4.4/pkgs /home/maba/.conda/pkgs envs directories : /home/maba/code/conda/conda-4.4/envs /home/maba/.conda/envs platform : linux-64 user-agent : conda/4.4.7 requests/2.18.4 CPython/3.6.4 Linux/4.14.12-1-MANJARO manjaro/17.1-dev glibc/2.26 UID:GID : 1000:1000 netrc file : None offline mode : False ``` ##### `conda config --show-sources` <!-- between the ticks below, paste the output of 'conda config --show-sources' --> (not needed) ##### `conda list --show-channel-urls` <!-- between the ticks below, paste the output of 'conda list --show-channel-urls' --> (not needed)
I think this is the first template we’ve actually had filled out. Like, wow, this is awesome! 👍 Sent from my iPhone > On Jan 14, 2018, at 5:00 PM, Marcel Bargull <[email protected]> wrote: > > I'm submitting a... > > bug report > feature request > Current Behavior > > For a configuration parameter that accepts sequences, an empty value in the corresponding environment variable gets interpreted as an one-element sequence containing an empty string, i.e., [""]. Thus there is no way to specify an empty sequence via an environment variable. > > Steps to Reproduce > > $ export CONDA_CHANNELS= > $ conda config --show channels > channels: > - > $ export CONDA_CHANNELS=defaults, > $ conda config --show channels > channels: > - defaults > - > $ export CONDA_CHANNELS=defaults,, > $ conda config --show channels > channels: > - defaults > - > Expected Behavior > > One possibility to allow empty sequences would be to allow and ignore trailing separator, i.e., interpret > > , as [], > ,, as [""], > ,,, as ["", ""], > defaults, as ["defaults"], > defaults,, as ["defaults", ""]. > The commands given above would then yield: > > $ export CONDA_CHANNELS= > $ conda config --show channels > channels: [] > $ export CONDA_CHANNELS=defaults, > $ conda config --show channels > channels: > - defaults > $ export CONDA_CHANNELS=defaults,, > $ conda config --show channels > channels: > - defaults > - > conda info > > active environment : base > active env location : /home/maba/code/conda/conda-4.4 > shell level : 1 > user config file : /home/maba/.condarc > populated config files : /home/maba/code/conda/conda-4.4/.condarc > conda version : 4.4.7 > conda-build version : not installed > python version : 3.6.4.final.0 > base environment : /home/maba/code/conda/conda-4.4 (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 : /home/maba/code/conda/conda-4.4/pkgs > /home/maba/.conda/pkgs > envs directories : /home/maba/code/conda/conda-4.4/envs > /home/maba/.conda/envs > platform : linux-64 > user-agent : conda/4.4.7 requests/2.18.4 CPython/3.6.4 Linux/4.14.12-1-MANJARO manjaro/17.1-dev glibc/2.26 > UID:GID : 1000:1000 > netrc file : None > offline mode : False > conda config --show-sources > > (not needed) > > conda list --show-channel-urls > > (not needed) > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub, or mute the thread. >
2018-01-17T19:29:33
conda/conda
6,746
conda__conda-6746
[ "6745" ]
c97895ce02b9cd38a4fa854088e4dd88c24badd9
diff --git a/conda_env/installers/conda.py b/conda_env/installers/conda.py --- a/conda_env/installers/conda.py +++ b/conda_env/installers/conda.py @@ -28,8 +28,7 @@ def install(prefix, specs, args, env, *_, **kwargs): channel_urls.extend(context.channels) _channel_priority_map = prioritize_channels(channel_urls) - channel_names = IndexedSet(Channel(url).canonical_name for url in _channel_priority_map) - channels = IndexedSet(Channel(cn) for cn in channel_names) + channels = IndexedSet(Channel(url) for url in _channel_priority_map) subdirs = IndexedSet(basename(url) for url in _channel_priority_map) solver = Solver(prefix, channels, subdirs, specs_to_add=specs)
Bug: Authenticated channels broken when using conda_env create. <!-- 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 Found two issues in Conda 4.4.x, which I believe are related so I've included them in the same ticket: * `conda env create` ignores the authentication component of channels (as well as other components). * When `conda env create` is run, the authentication component is skipped, causing `PackageNotFound` errors to be generated for private packages. * `conda env create` does not respect the channel priority flag available in the context (based off of expected behavior defined here: https://conda.io/docs/user-guide/tasks/manage-channels.html#after-conda-4-1-0) * When `conda env create` is run, channels with the same name are truncated before they reach the `Solver`; the `Solver` only receives the highest priority channel. This is not consistent with the channel priority behavior outlined above. The problem appears to be happening with these 3 lines of code in the `conda` installer in the `conda_env`package: https://github.com/conda/conda/blob/master/conda_env/installers/conda.py#L31-L33 In that code, all of the channels retrieved from the `_channel_priority_map` are instantiated to `Channel` classes and then immediately truncated based on canonical name (for authed channels, this is only the channel name, with the token excluded). ### Steps to Reproduce For the first issue, using this environment file (`authed.yaml`, NOTE: that you will need to replace the channel with a private channel you control): ```yaml name: authed_env channels: - https://conda.anaconda.org/t/<TOKEN>/<CHANNEL> dependencies: - private_package ``` Run the following command and get: ```bash $ conda env create -n authed_env -f authed.yaml Solving environment: failed ResolvePackageNotFound: - private_package ``` For the second issue, using this environment file (`priority.yaml`) ```yaml name: priority_env channels: - nextdoor - https://conda.anaconda.org/t/<TOKEN>/<CHANNEL> dependencies: - private_package ``` And this `.condarc` ```yaml channel_priority: false ``` Run this command and get. ```bash $ conda env create -n priority_env -f priority.yaml Solving environment: failed ResolvePackageNotFound: - private_package ``` This second is a little hidden because of the authenticated channel issue, but it's again caused by the `canonical_name` truncation. ### Expected Behavior <!-- What do you think should happen? --> * `conda env create` should allow environment files and `condarc` files to use authenticated channels (by respecting the full URL). * The command should also not truncate channels that it passes to the `Solver`. This is not behavior that is exhibited in other areas where `Solver` is instantiated. As a note, the expected behavior did successfully occur in the latest 4.3.x release. ##### `conda info` <!-- between the ticks below, paste the output of 'conda info' --> ``` active environment : nextdoor active env location : /var/lib/conda/envs/nextdoor shell level : 1 user config file : /home/vagrant/.condarc populated config files : /home/vagrant/.condarc conda version : 4.4.7 conda-build version : not installed python version : 3.6.3.final.0 base environment : /var/lib/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 : /var/lib/conda/pkgs /home/vagrant/.conda/pkgs envs directories : /var/lib/conda/envs /home/vagrant/.conda/envs platform : linux-64 user-agent : conda/4.4.7 requests/2.18.4 CPython/3.6.3 Linux/3.8.0-44-generic ubuntu/12.04 glibc/2.19 UID:GID : 1000:1000 netrc file : None offline mode : False ``` ##### `conda config --show-sources` <!-- between the ticks below, paste the output of 'conda config --show-sources' --> ``` ==> /home/vagrant/.condarc <== channel_priority: False channels: - defaults ``` ##### `conda list --show-channel-urls` <!-- between the ticks below, paste the output of 'conda list --show-channel-urls' --> ``` # packages in environment at /var/lib/conda: # asn1crypto 0.23.0 py36h4639342_0 defaults ca-certificates 2017.08.26 h1d4fec5_0 defaults certifi 2017.11.5 py36hf29ccca_0 defaults cffi 1.11.2 py36h2825082_0 defaults chardet 3.0.4 py36h0f667ec_1 defaults conda 4.4.7 py36_0 defaults conda-env 2.6.0 h36134e3_1 defaults cryptography 2.1.4 py36hd09be54_0 defaults idna 2.6 py36h82fb2a8_1 defaults libedit 3.1 heed3624_0 defaults libffi 3.2.1 hd88cf55_4 defaults libgcc-ng 7.2.0 h7cc24e2_2 defaults libstdcxx-ng 7.2.0 h7a57d05_2 defaults ncurses 6.0 h9df7e31_2 defaults openssl 1.0.2n hb7f436b_0 defaults pip 9.0.1 py36h6c6f9ce_4 defaults pycosat 0.6.3 py36h0a5515d_0 defaults pycparser 2.18 py36hf9f622e_1 defaults pyopenssl 17.5.0 py36h20ba746_0 defaults pysocks 1.6.7 py36hd97a5b1_1 defaults python 3.6.3 h6c0c0dc_5 defaults readline 7.0 ha6073c6_4 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.11.0 py36h372c433_1 defaults sqlite 3.20.1 hb898158_2 defaults tk 8.6.7 hc745277_3 defaults urllib3 1.22 py36hbe7ace6_0 defaults wheel 0.30.0 py36hfd4bba0_1 defaults xz 5.2.3 h55aa19d_2 defaults yaml 0.1.7 had09818_2 defaults zlib 1.2.11 ha838bed_2 defaults ```
2018-01-17T21:53:29
conda/conda
6,752
conda__conda-6752
[ "6748" ]
fa6526110300f241a41610894fbce34ff4341fdd
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 @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals +from errno import EACCES from logging import getLogger from os import listdir from os.path import dirname, isdir, isfile, join, normpath, split as path_split @@ -29,9 +30,17 @@ def register_env(location): # Nothing to do. Location is already recorded in a known environments.txt file. return - with open(USER_ENVIRONMENTS_TXT_FILE, 'a') as fh: - fh.write(ensure_text_type(location)) - fh.write('\n') + try: + with open(USER_ENVIRONMENTS_TXT_FILE, 'a') as fh: + fh.write(ensure_text_type(location)) + fh.write('\n') + except EnvironmentError as e: + if e.errno == EACCES: + log.warn("Unable to register environment. Path not writable.\n" + " environment location: %s\n" + " registry file: %s", location, USER_ENVIRONMENTS_TXT_FILE) + else: + raise def unregister_env(location): @@ -111,6 +120,6 @@ def _rewrite_environments_txt(environments_txt_file, prefixes): with open(environments_txt_file, 'w') as fh: fh.write('\n'.join(prefixes)) fh.write('\n') - except (IOError, OSError) as e: + except EnvironmentError as e: log.info("File not cleaned: %s", environments_txt_file) log.debug('%r', e, exc_info=True)
conda is broken if your home directory is read-only Conda currently requires the user's home directory to be writable. If the directory conda is installed into is writable (say a tmpfs) then you can get along way by using ```shell ./Miniconda3-latest-Linux-x86_64.sh -p $CONDA_DIR -b -f conda config --system --set always_yes yes conda config --system --set changeps1 no conda config --system --add envs_dirs $CONDA_DIR/envs conda config --system --add pkgs_dirs $CONDA_DIR/pkgs ``` However, this is foiled by the following line -> https://github.com/conda/conda/blob/7616b87ad87b80da16b8263011c9c708be98147c/conda/core/envs_manager.py#L18 ```python USER_ENVIRONMENTS_TXT_FILE = expand(join('~', '.conda', 'environments.txt')) ``` I'm not sure if this would even work on Windows?
Could we have an environment variable to override where conda stores any user files? The environment variables you want are `CONDA_PKGS_DIRS` and `CONDA_ENVS_DIRS`. Look at the output of `conda config --describe`. Any configuration parameter is also accessible as an environment variable by prepending `CONDA_` and making the key all-caps. Since those two config parameters are sequences, there's a string delimiter that probably depends on platform. `conda config --describe` should tell you what you need to know. Ohhhhhh. I see the problem now. I'm waffling back-and-forth on whether we should just swallow `EACCES` when we try to write to that file. I'm not sure we want to make its location configurable. The reason is that, especially on unix, when you're UID `0`, `conda info --envs` (which should really be `conda list --envs` 😖) will look for that file in all known user home directories. That way a sysadmin can discover all environments on a machine and scan environments for outdated packages (like e.g. openssl). > I'm not sure if this would even work on Windows? Python's `os.path.expanduser('~')` has no issues on Windows.
2018-01-18T22:53:06
conda/conda
6,754
conda__conda-6754
[ "6537" ]
fa6526110300f241a41610894fbce34ff4341fdd
diff --git a/conda/models/index_record.py b/conda/models/index_record.py --- a/conda/models/index_record.py +++ b/conda/models/index_record.py @@ -122,11 +122,8 @@ def __get__(self, instance, instance_type): try: return super(ChannelField, self).__get__(instance, instance_type) except AttributeError: - try: - url = instance.url - return self.unbox(instance, instance_type, Channel(url)) - except AttributeError: - return Channel(None) + url = instance.url + return self.unbox(instance, instance_type, Channel(url)) class SubdirField(StringField): @@ -224,7 +221,7 @@ class PackageRef(BasePackageRef): fn = FilenameField(aliases=('filename',)) md5 = StringField(default=None, required=False, nullable=True, default_in_dump=False) - url = StringField(required=False, nullable=True) + url = StringField(default=None, required=False, nullable=True, default_in_dump=False) @property def schannel(self):
Cannot install conda-build 3.2.0 @AntoineD commented on [Fri Dec 22 2017](https://github.com/conda/conda-build/issues/2600) Hello, I am on a REHL 5.5 with anaconda 4.4, I was able to install recent version of conda-build by [hand ](https://github.com/conda/conda-build/issues/2450#issuecomment-337625349) but with the version 3.2.0 it fails: ``` conda install /scratch/xxx/anaconda/pkgs/conda-build-3.2.0-py27_0.tar.bz2 An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : linux-64 conda version : 4.3.25 conda is private : False conda-env version : 4.3.25 conda-build version : 3.1.3 python version : 2.7.13.final.0 requests version : 2.14.2 root environment : /scratch/xxx/anaconda (writable) default environment : /scratch/xxx/anaconda envs directories : /scratch/xxx/conda-envs /scratch/xxx/anaconda/envs /home/xxx/.conda/envs package cache : /scratch/xxx/anaconda/pkgs /home/xxx/.conda/pkgs channel URLs : file:///scratch/xxx/conda-bld/linux-64 file:///scratch/xxx/conda-bld/noarch https://repo.continuum.io/pkgs/free/linux-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-64 https://repo.continuum.io/pkgs/pro/noarch https://conda.anaconda.org/conda-forge/linux-64 https://conda.anaconda.org/conda-forge/noarch config file : /home/xxx/.condarc netrc file : None offline mode : False user-agent : conda/4.3.25 requests/2.14.2 CPython/2.7.13 Linux/2.6.18-422.el5 Red Hat Enterprise Linux Server/5.11 glibc/2.5 UID:GID : 7679:107679 `$ /scratch/xxx/anaconda/bin/conda install /scratch/xxx/anaconda/pkgs/conda-build-3.2.0-py27_0.tar.bz2` Traceback (most recent call last): File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 640, in conda_exception_handler return_value = func(*args, **kwargs) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 140, in _main exit_code = args.func(args, p) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 210, in install explicit(args_packages, prefix, verbose=not context.quiet) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/misc.py", line 110, in explicit execute_actions(actions, index, verbose=verbose) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/plan.py", line 830, in execute_actions execute_instructions(plan, index, verbose) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 247, in execute_instructions cmd(state, arg) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/instructions.py", line 107, in UNLINKLINKTRANSACTION_CMD txn = UnlinkLinkTransaction.create_from_dists(index, prefix, unlink_dists, link_dists) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/core/link.py", line 125, in create_from_dists for dist, pkg_dir in zip(link_dists, pkg_dirs_to_link)) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/core/link.py", line 125, in <genexpr> for dist, pkg_dir in zip(link_dists, pkg_dirs_to_link)) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/gateways/disk/read.py", line 95, in read_package_info paths_data=paths_data, File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 702, in __call__ instance = super(EntityType, cls).__call__(*args, **kwargs) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 719, in __init__ setattr(self, key, kwargs[key]) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 831, in __setattr__ super(ImmutableEntity, self).__setattr__(attribute, value) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 424, in __set__ instance.__dict__[self.name] = self.validate(instance, self.box(instance, val)) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 465, in validate raise ValidationError(getattr(self, 'name', 'undefined name'), val) ValidationError: Value for url cannot be None. ``` Is it expected? --- @msarahan commented on [Fri Dec 22 2017](https://github.com/conda/conda-build/issues/2600#issuecomment-353633731) This is a conda issue. Installing packages from files as you are doing makes the installation much less standard - it doesn't install dependencies, for example. Something is definitely going wrong, but the conda issue tracker is the better place to discuss what it might be. I'll move this issue for you.
Not sure what the problem is yet. Something isn't quite right. Even if we do come up with a patch, after conda 4.3.27, you're going to pull in https://repo.continuum.io/pkgs/main by default, which is NOT compatible with CentOS 5. To stay compatible with CentOS 5, in a condarc file, you're going to want: ``` default_channels: - https://repo.continumm.io/pkgs/free - https://repo.continumm.io/pkgs/pro - https://repo.continumm.io/pkgs/r ``` After you do that, try in your condarc ``` channels: - conda-canary - defaults - conda-forge ``` and `conda update conda`. See if it's still a problem in the latest conda. Hello, I followed your instructions (this has updated to conda 4.4.6 and pycosat 0.6.3) and then get the error when installing manually conda-build: ``` # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 173, in install explicit(args_packages, prefix, verbose=not context.quiet) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/misc.py", line 69, in explicit pfe.execute() File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 553, in execute self.prepare() File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/common/io.py", line 415, in decorated return f(*args, **kwds) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 540, in prepare for prec in self.link_precs) File "/scratch/xxx/anaconda/lib/python2.7/_abcoll.py", line 571, in update for key, value in other: File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 540, in <genexpr> for prec in self.link_precs) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 449, in make_actions_for_record ), None) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 446, in <genexpr> pcrec for pcrec in concat(pcache.query(pref_or_spec) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/core/package_cache.py", line 115, in <genexpr> if param.match(pcrec)) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/models/match_spec.py", line 207, in match if not self._match_individual(rec, field_name, v): File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/models/match_spec.py", line 212, in _match_individual val = getattr(record, field_name) File "/scratch/xxx/anaconda/lib/python2.7/site-packages/conda/_vendor/auxlib/entity.py", line 414, in __get__ raise AttributeError("A value for {0} has not been set".format(self.name)) AttributeError: A value for url has not been set``` ``` Thanks. I tried from brand new anaconda installation ( 4.4 installation + your .condarc modification + conda update --all): there is no error in this situation. You may close this issue. The error came back while trying to update another package, it turned out that conda-build was the culprit. From the error report I felt like hand installing it implied a lack of information (such as channel and plaftorm) for this installed package. So I created a local channel with the downloaded conda-build archive (and with `conda index /path/to/local/channel/{noarch,linux-64}`), re-installed it and apparently all is OK now. Is hand installation (`conda install /path/to/package.tar.bz2`) still supported? > Is hand installation (`conda install /path/to/package.tar.bz2`) still supported? Yes. If that's not working for you, definitely give more details. Also though, please make sure you're using 4.4.7 (just released today). It has one fix that may be applicable. My issue looks like #6665, I will check conda 4.4.7 but I do not know when. Anyway I prefer using a local channel for this because the dependencies are installed. You may close that issue. Thanks for your help. @AntoineD even with conda 4.4.7, I'm still seeing some KeyError reports. See https://github.com/conda/conda/issues/6698 If you still have your issue with conda 4.4.7, I want to make sure we get it resolved. #6665 is closed as fixed, but there must be something else that's related going on. Maybe we have a way to reproduce it with something you're doing. I've just tested: issue is gone with conda 4.4.7. @kalefranz I've hit the same problem today (edit: this one: https://github.com/conda/conda/issues/6537#issuecomment-354992368; `AttributeError: A value for url has not been set`), after debugging into conda it turns out for me this is due to what seems to me a packaging glitch in an old `ssl_match_hostname` package that I had lying around in my `anaconda/pkgs` directory: Looks like for whatever reason that package has the `url` field in the `repodata_record.json` missing: `ssl_match_hostname-3.4.0.2-py27_1/info/repodata_record.json` ```json { "arch": "x86_64", "build": "py27_0", "build_number": 0, "channel": "", "constrains": [], "depends": [ "python 2.7*" ], "fn": "ssl_match_hostname-3.4.0.2-py27_0", "name": "ssl_match_hostname", "platform": "linux", "subdir": "linux-64", "version": "3.4.0.2" } ``` This is comparing it with build no. 1: ```diff --- ssl_match_hostname-3.4.0.2-py27_0/info/repodata_record.json 2018-01-18 17:50:07.533885592 +0100 +++ ssl_match_hostname-3.4.0.2-py27_1/info/repodata_record.json 2018-01-18 17:50:07.533885592 +0100 @@ -1,15 +1,18 @@ { "arch": "x86_64", - "build": "py27_0", - "build_number": 0, - "channel": "", + "build": "py27_1", + "build_number": 1, + "channel": "https://repo.continuum.io/pkgs/free", "constrains": [], "depends": [ + "backports", "python 2.7*" ], - "fn": "ssl_match_hostname-3.4.0.2-py27_0", + "fn": "ssl_match_hostname-3.4.0.2-py27_1.tar.bz2", + "license": "PSF", "name": "ssl_match_hostname", "platform": "linux", "subdir": "linux-64", + "url": "https://repo.continuum.io/pkgs/free/linux-64/ssl_match_hostname-3.4.0.2-py27_1.tar.bz2", "version": "3.4.0.2" } \ No newline at end of file ``` After moving those (unpacked) packages out from `../pkgs/` I can run the failing `$ conda install <path_to_local_conda_package>` without problems. So I guess maybe there should be a more friendly warning message about what package is causing the problem, so that users can get rid of the offending malformed package.
2018-01-19T18:42:25
conda/conda
6,764
conda__conda-6764
[ "6514" ]
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:42
conda/conda
6,766
conda__conda-6766
[ "6765" ]
ad07eba8949e998728c8041af4fc76c34f6bb9ee
diff --git a/conda/resolve.py b/conda/resolve.py --- a/conda/resolve.py +++ b/conda/resolve.py @@ -628,7 +628,14 @@ def generate_feature_metric(self, C): for name, group in iteritems(self.groups): nf = [len(self.features(dist)) for dist in group] maxf = max(nf) - eq.update({dist.full_name: maxf-fc for dist, fc in zip(group, nf) if fc < maxf}) + if maxf > 0: + eq.update({dist.full_name: maxf-fc for dist, fc in zip(group, nf) if maxf > fc}) + # This entry causes conda to weight the absence of a package the same + # as if a non-featured version were instaslled. If this were not here, + # conda will sometimes select an earlier build of a requested package + # if doing so can eliminate this package as a dependency. + # https://github.com/conda/conda/issues/6765 + eq['!' + self.push_MatchSpec(C, name)] = maxf total += maxf return eq, total
diff --git a/tests/test_resolve.py b/tests/test_resolve.py --- a/tests/test_resolve.py +++ b/tests/test_resolve.py @@ -766,6 +766,28 @@ def test_install_package_with_feature(): r.install(['mypackage','feature 1.0']) +def test_unintentional_feature_downgrade(): + # See https://github.com/conda/conda/issues/6765 + # With the bug in place, this bad build of scipy + # will be selected for install instead of a later + # build of scipy 0.11.0. + good_rec = index[Dist('scipy-0.11.0-np17py33_3.tar.bz2')] + bad_deps = tuple(d for d in good_rec.depends + if not d.startswith('numpy')) + bad_rec = IndexRecord.from_objects(good_rec, + build=good_rec.build.replace('_3','_x0'), + build_number=0, depends=bad_deps, + fn=good_rec.fn.replace('_3','_x0'), + url=good_rec.url.replace('_3','_x0')) + bad_dist = Dist(bad_rec) + index2 = index.copy() + index2[bad_dist] = bad_rec + r = Resolve(index2) + install = r.install(['scipy 0.11.0']) + assert bad_dist not in install + assert any(d.name == 'numpy' for d in install) + + def test_circular_dependencies(): index2 = index.copy() index2['package1-1.0-0.tar.bz2'] = IndexRecord(**{
Unintentional build downgrades in mixed feature settings Under certain limited circumstances involving features, `conda` unexpectedly downgrades to an earlier build of a package. The conditions are as follows: - The current version of a package `foo` has multiple builds with distinct build numbers. - Newer builds depend on a second package `bar`, while older builds do not. - Some of the valid choices for the `bar` dependency have features, and some do not. When those conditions are met, the command ``` conda create -n errtest foo ``` will select an older build of `foo`, without the `bar` dependency, instead of the latest build. (Contact me or @msarahan for a specific test case.) Currently, this is not occurring with conda 4.4. The reasons for this are not fully clear, because the bug has been located and exists in 4.3 and 4.4. Bug fix coming.
To help illustrate the issue, here is a preliminary version of the test that should fail with the current version of `Resolve`, and which will be fixed. ``` def test_unintentional_feature_downgrade(): # With the bug in place, this bad build of scipy # will be selected for install instead of a later # build of scipy 0.11.0. index2 = index.copy() bad_dist = Dist('scipy-0.11.0-np17py33_x0.tar.bz2') index2[bad_dist] = IndexRecord(**{ 'build': 'np17py33_x0', 'build_number': 0, 'depends': ['python 3.3*'], 'name': 'scipy', 'version': '0.11.0', }) r = Resolve(index2) install = r.install(['scipy 0.11.0']) assert bad_dist not in install assert any(d.name == 'numpy' for d in install) ```
2018-01-23T02:24:30
conda/conda
6,773
conda__conda-6773
[ "6672" ]
c1af02bb4fcfb8c962bb52d040ba705174345889
diff --git a/conda_env/cli/main.py b/conda_env/cli/main.py --- a/conda_env/cli/main.py +++ b/conda_env/cli/main.py @@ -79,6 +79,7 @@ def main(): initialize_logging() parser = create_parser() args = parser.parse_args() + os.environ["CONDA_AUTO_UPDATE_CONDA"] = "false" context.__init__(argparse_args=args) init_loggers(context) return conda_exception_handler(do_call, args, parser)
conda-env may update conda while it's still in use (cc @levy5674, @patricksnape) Issue reported in https://github.com/conda/conda/issues/6606#issuecomment-355149329: `conda-env` can update `conda` (either explicitly or by `auto_update_conda = True`) while it's still using it and thus makes the current process get into an inconsistent state (using parts of the old as well as updated `conda`). `conda-env` loops over the different dependency types in https://github.com/conda/conda/blob/4.4.6/conda_env/cli/main_update.py#L104. If it updates `conda`, other subsequent updates, e.g., using `conda_env.installers.pip`, may already introduce parts of the updated `conda` into the current process, see: ```yaml # environment.yaml dependencies: - conda - pip: - bumpversion ``` ```bash (ins)$ cat environment.yml dependencies: - conda - pip: - bumpversion (ins)$ bash Miniconda3-4.3.31-Linux-x86_64.sh -bp ./mc PREFIX=/home/maba/code/conda/mc installing: python-3.6.3-h6c0c0dc_5 ... Python 3.6.3 :: Anaconda, Inc. installing: ca-certificates-2017.08.26-h1d4fec5_0 ... installing: conda-env-2.6.0-h36134e3_1 ... installing: libgcc-ng-7.2.0-h7cc24e2_2 ... installing: libstdcxx-ng-7.2.0-h7a57d05_2 ... installing: libffi-3.2.1-hd88cf55_4 ... installing: ncurses-6.0-h9df7e31_2 ... installing: openssl-1.0.2n-hb7f436b_0 ... installing: tk-8.6.7-hc745277_3 ... installing: xz-5.2.3-h55aa19d_2 ... installing: yaml-0.1.7-had09818_2 ... installing: zlib-1.2.11-ha838bed_2 ... installing: libedit-3.1-heed3624_0 ... installing: readline-7.0-ha6073c6_4 ... installing: sqlite-3.20.1-hb898158_2 ... installing: asn1crypto-0.23.0-py36h4639342_0 ... installing: certifi-2017.11.5-py36hf29ccca_0 ... installing: chardet-3.0.4-py36h0f667ec_1 ... installing: idna-2.6-py36h82fb2a8_1 ... installing: pycosat-0.6.3-py36h0a5515d_0 ... installing: pycparser-2.18-py36hf9f622e_1 ... installing: pysocks-1.6.7-py36hd97a5b1_1 ... installing: ruamel_yaml-0.11.14-py36ha2fb22d_2 ... installing: six-1.11.0-py36h372c433_1 ... installing: cffi-1.11.2-py36h2825082_0 ... installing: setuptools-36.5.0-py36he42e2e1_0 ... installing: cryptography-2.1.4-py36hd09be54_0 ... installing: wheel-0.30.0-py36hfd4bba0_1 ... installing: pip-9.0.1-py36h6c6f9ce_4 ... installing: pyopenssl-17.5.0-py36h20ba746_0 ... installing: urllib3-1.22-py36hbe7ace6_0 ... installing: requests-2.18.4-py36he2e5f8d_1 ... installing: conda-4.3.31-py36_0 ... installation finished. (ins)$ source mc/bin/activate (ins)(root) $ conda env update -n root Fetching package metadata ........... Solving package specifications: . conda-4.4.6-py 100% |################################################################################################################################################################################| Time: 0:00:01 669.69 kB/s An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Traceback (most recent call last): File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda/exceptions.py", line 640, in conda_exception_handler original data Length: %(original_data_length)d File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda_env/cli/main_update.py", line 106, in execute installer = get_installer(installer_type) File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda_env/installers/pip.py", line 40, in _pip_install_via_requirements args, pip_version = pip_args(prefix) ValueError: too many values to unpack (expected 2) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/maba/code/conda/mc/bin/conda-env", line 11, in <module> sys.exit(main()) File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda_env/cli/main.py", line 76, in main File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda/exceptions.py", line 644, in conda_exception_handler 'path': path, File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda/exceptions.py", line 634, in handle_exception def __init__(self, path, placeholder, new_prefix, original_data_length, new_data_length): File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda/exceptions.py", line 595, in print_unexpected_error_message File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda/cli/main_info.py", line 19, in <module> from .common import print_envs_list, stdout_json ImportError: cannot import name 'print_envs_list' ``` This of course affects `conda 4.4` as well: <details><summary> logs for conda 4.4.x (using 4.4.0rc2 to let it trip at the same changed import as 4.3.31 did) </summary><p> ```bash (ins)$ cat environment.yml dependencies: - conda - pip: - bumpversion (ins)$ bash Miniconda3-4.3.31-Linux-x86_64.sh -bp ./mc PREFIX=/home/maba/code/conda/mc installing: python-3.6.3-h6c0c0dc_5 ... Python 3.6.3 :: Anaconda, Inc. installing: ca-certificates-2017.08.26-h1d4fec5_0 ... installing: conda-env-2.6.0-h36134e3_1 ... installing: libgcc-ng-7.2.0-h7cc24e2_2 ... installing: libstdcxx-ng-7.2.0-h7a57d05_2 ... installing: libffi-3.2.1-hd88cf55_4 ... installing: ncurses-6.0-h9df7e31_2 ... installing: openssl-1.0.2n-hb7f436b_0 ... installing: tk-8.6.7-hc745277_3 ... installing: xz-5.2.3-h55aa19d_2 ... installing: yaml-0.1.7-had09818_2 ... installing: zlib-1.2.11-ha838bed_2 ... installing: libedit-3.1-heed3624_0 ... installing: readline-7.0-ha6073c6_4 ... installing: sqlite-3.20.1-hb898158_2 ... installing: asn1crypto-0.23.0-py36h4639342_0 ... installing: certifi-2017.11.5-py36hf29ccca_0 ... installing: chardet-3.0.4-py36h0f667ec_1 ... installing: idna-2.6-py36h82fb2a8_1 ... installing: pycosat-0.6.3-py36h0a5515d_0 ... installing: pycparser-2.18-py36hf9f622e_1 ... installing: pysocks-1.6.7-py36hd97a5b1_1 ... installing: ruamel_yaml-0.11.14-py36ha2fb22d_2 ... installing: six-1.11.0-py36h372c433_1 ... installing: cffi-1.11.2-py36h2825082_0 ... installing: setuptools-36.5.0-py36he42e2e1_0 ... installing: cryptography-2.1.4-py36hd09be54_0 ... installing: wheel-0.30.0-py36hfd4bba0_1 ... installing: pip-9.0.1-py36h6c6f9ce_4 ... installing: pyopenssl-17.5.0-py36h20ba746_0 ... installing: urllib3-1.22-py36hbe7ace6_0 ... installing: requests-2.18.4-py36he2e5f8d_1 ... installing: conda-4.3.31-py36_0 ... installation finished. (ins)$ source mc/bin/activate (ins)(root) $ conda install -yc conda-canary conda=4.4.0rc2 Fetching package metadata ............. Solving package specifications: . Package plan for installation in environment /home/maba/code/conda/mc: The following packages will be UPDATED: conda: 4.3.31-py36_0 --> 4.4.0rc2-py36h7fbbb7a_0 conda-canary conda-4.4.0rc2 100% |################################################################################################################################################################################| Time: 0:00:00 707.92 kB/s (ins)(root) $ conda env update -n root Solving environment: done Downloading and Extracting Packages conda 4.4.6: ########################################################################################################################################################################################################### | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done Traceback (most recent call last): File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda/exceptions.py", line 683, in __call__ elif isinstance(error, SafetyError): File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda_env/cli/main.py", line 74, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda_env/cli/main_update.py", line 107, in execute installer.install(prefix, specs, args, env) File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda_env/installers/pip.py", line 40, in _pip_install_via_requirements args, pip_version = pip_args(prefix) ValueError: too many values to unpack (expected 2) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/maba/code/conda/mc/bin/conda-env", line 11, in <module> sys.exit(main()) File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda_env/cli/main.py", line 84, in main return conda_exception_handler(do_call, args, parser) File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda/exceptions.py", line 907, in conda_exception_handler url = response.headers['Location'] File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda/exceptions.py", line 686, in __call__ elif context.safety_checks == SafetyChecks.warn: File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda/exceptions.py", line 720, in handle_exception class ExceptionHandler(object): File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda/exceptions.py", line 732, in handle_unexpected_exception return sys.stdout if context.json else sys.stderr File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda/exceptions.py", line 783, in print_error_report command = ' '.join(ensure_text_type(s) for s in sys.argv) File "/home/maba/code/conda/mc/lib/python3.6/site-packages/conda/cli/main_info.py", line 19, in <module> from .common import print_envs_list, stdout_json ImportError: cannot import name 'print_envs_list' ``` </p></details>
Ok that's just awful. Thanks for elucidating what's actually happening @mbargull I'm facing the same problem. Is there a workaround for this? You can work around this issue by updating `conda` separately, before updating the rest of the environment: ```sh conda update -y conda conda env update -n root ``` YMMV, but this may help as a work-around: ``` conda config --set auto_update_conda False ``` It prevents `conda` from automatically updating itself when creating environments.
2018-01-23T21:44:53
conda/conda
6,775
conda__conda-6775
[ "6770" ]
c1af02bb4fcfb8c962bb52d040ba705174345889
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -87,7 +87,7 @@ def __init__(self, shell, arguments=None): self.script_extension = '.bat' self.tempfile_extension = '.bat' self.shift_args = 1 - self.command_join = '\n' + self.command_join = '\r\n' if on_win else '\n' self.unset_var_tmpl = '@SET %s=' self.export_var_tmpl = '@SET "%s=%s"' @@ -125,7 +125,9 @@ def _finalize(self, commands, ext): if ext is None: return self.command_join.join(commands) elif ext: - with NamedTemporaryFile(suffix=ext, delete=False) as tf: + 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 + # command_join should account for that tf.write(ensure_binary(self.command_join.join(commands))) return tf.name else:
Anaconda Prompt doesn't work in conda 4.4.7 after 'conda update --all' <!-- 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. --> Anaconda Prompt in windows doesn't work after an latest update. It showes errors below. ![default](https://user-images.githubusercontent.com/11899660/35289944-bd9b33a4-00a3-11e8-930c-09f9b2950e02.png) ### 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. --> I just click the 'Anaconda Prompt' in the start menu. It has worked well until my latest update by excute 'conda update --all'. I guess that it's a LF & CRLF problem in the windows but I could not make sure. I has test for several times and finally found code excute to here correctly as the picture below. ![default](https://user-images.githubusercontent.com/11899660/35289975-cea65a02-00a3-11e8-8495-96f78f8027dd.png) Actually it turns out running this. ![default](https://user-images.githubusercontent.com/11899660/35289308-ecff1586-00a1-11e8-8274-001bfa4bb5e1.png) See 'LF' bottom right. When I choose CLRF it works without errors. Does conda.exe produce the file with wrong line break? And sorry for my poor English. ## Expected Behavior <!-- What do you think should happen? --> It should work as well as before. ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` PS D:\Anaconda3\Scripts> ./conda info active environment : None user config file : C:\Users\xxx\.condarc populated config files : C:\Users\xxx\.condarc conda version : 4.4.7 conda-build version : 3.2.2 python version : 3.6.4.final.0 base environment : D:\Anaconda3 (writable) channel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch https://repo.continuum.io/pkgs/main/win-64 https://repo.continuum.io/pkgs/main/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 package cache : D:\Anaconda3\pkgs C:\Users\xxx\AppData\Local\conda\conda\pkgs envs directories : D:\Anaconda3\envs C:\Users\xxx\AppData\Local\conda\conda\envs C:\Users\xxx\.conda\envs platform : win-64 user-agent : conda/4.4.7 requests/2.18.4 CPython/3.6.4 Windows/10 Windows/10.0.16299 administrator : False 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\xxx\.condarc <== ssl_verify: True channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ - defaults show_channel_urls: True ``` </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 D:\Anaconda3: # _ipyw_jlab_nb_ext_conf 0.1.0 py36he6757f0_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main alabaster 0.7.10 py36hcd07829_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main anaconda custom py36h363777c_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main anaconda-client 1.6.6 py36ha174c20_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main anaconda-navigator 1.6.12 py36hdad2993_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main anaconda-project 0.8.2 py36hfad2e28_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main asn1crypto 0.24.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main astroid 1.6.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main astropy 2.0.3 py36hfa6e2cd_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main attrs 17.3.0 py36hc87868e_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main babel 2.5.3 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main backports 1.0 py36h81696a8_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main backports.shutil_get_terminal_size 1.0.0 py36h79ab834_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main beautifulsoup4 4.6.0 py36hd4cc5e8_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main bitarray 0.8.1 py36h6af124b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main bkcharts 0.2 py36h7e685f7_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main blaze 0.11.3 py36h8a29ca5_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main bleach 2.1.2 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main bokeh 0.12.13 py36h047fa9f_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main boto 2.48.0 py36h1a776d2_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main bottleneck 1.2.1 py36hd119dfa_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main bzip2 1.0.6 haa5b126_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main ca-certificates 2017.08.26 h94faf87_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main cachecontrol 0.12.3 py36hfe50d7b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main certifi 2017.11.5 py36hb8ac631_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main cffi 1.11.4 py36hfa6e2cd_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main chardet 3.0.4 py36h420ce6e_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main click 6.7 py36hec8c647_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main cloudpickle 0.5.2 py36h6b1d831_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main clyent 1.2.2 py36hb10d595_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main colorama 0.3.9 py36h029ae33_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main comtypes 1.1.4 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main conda 4.4.7 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main conda-build 3.2.2 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main conda-env 2.6.0 h36134e3_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main conda-verify 2.0.0 py36h065de53_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main console_shortcut 0.1.1 h6bb2dd7_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main contextlib2 0.5.5 py36he5d52c0_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main coverage 4.4.2 py36hd32d05b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main cryptography 2.1.4 py36he1d7878_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main curl 7.55.1 h3b839b5_4 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main cycler 0.10.0 py36h009560c_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main cython 0.27.3 py36h22f4c84_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main cytoolz 0.9.0 py36hfa6e2cd_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main dask 0.16.1 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main dask-core 0.16.1 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main datashape 0.5.4 py36h5770b85_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main decorator 4.2.1 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main distlib 0.2.5 py36h51371be_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main distributed 1.20.2 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main docutils 0.14 py36h6012d8f_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main entrypoints 0.2.3 py36hfd66bb0_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main et_xmlfile 1.0.1 py36h3d2d736_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main fastcache 1.0.2 py36hffdae1b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main filelock 2.0.13 py36h20000bf_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main flask 0.12.2 py36h98b5e8f_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main flask-cors 3.0.3 py36h8a3855d_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main freetype 2.8 h51f8f2c_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main get_terminal_size 1.0.0 h38e98db_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main gevent 1.2.2 py36h342a76c_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main glob2 0.6 py36hdf76b57_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main greenlet 0.4.12 py36ha00ad21_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main h5py 2.7.1 py36he54a1c3_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main hdf5 1.10.1 h98b8871_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main heapdict 1.0.0 py36h21fa5f4_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main html5lib 1.0.1 py36h047fa9f_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main hypothesis 3.38.5 py36h987501d_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main icc_rt 2017.0.4 h97af966_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main icu 58.2 ha66f8fd_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main idna 2.6 py36h148d497_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main imageio 2.2.0 py36had6c2d2_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main imagesize 0.7.1 py36he29f638_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main intel-openmp 2018.0.0 hd92c6cd_8 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main ipykernel 4.7.0 py36h2f9c1c0_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main ipython 6.2.1 py36h9cf0123_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main ipython_genutils 0.2.0 py36h3c5d0ee_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main ipywidgets 7.1.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main isort 4.2.15 py36h6198cc5_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main itsdangerous 0.24 py36hb6c5a24_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jdcal 1.3 py36h64a5255_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jedi 0.11.1 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jinja2 2.10 py36h292fed1_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jpeg 9b hb83a4c4_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jsonschema 2.6.0 py36h7636477_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jupyter 1.0.0 py36h422fd7e_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jupyter_client 5.2.1 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jupyter_console 5.2.0 py36h6d89b47_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jupyter_core 4.4.0 py36h56e9d50_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jupyterlab 0.31.1 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main jupyterlab_launcher 0.10.2 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main lazy-object-proxy 1.3.1 py36hd1c21d2_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libiconv 1.15 h1df5818_7 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libpng 1.6.32 h140d38e_4 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libssh2 1.8.0 h75d9407_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libtiff 4.0.9 h0f13578_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libxml2 2.9.4 h41ea7b2_6 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main libxslt 1.1.29 h0037b19_6 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main llvmlite 0.21.0 py36he0b0552_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main locket 0.2.0 py36hfed976d_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main lockfile 0.12.2 py36h0468280_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main lxml 4.1.1 py36he0adb16_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main lzo 2.10 h6df0209_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main markupsafe 1.0 py36h0e26971_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main matplotlib 2.1.1 py36h2062329_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main mccabe 0.6.1 py36hb41005a_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main menuinst 1.4.10 py36h42196fb_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main mistune 0.8.3 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main mkl 2018.0.1 h2108138_4 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main mkl-service 1.1.2 py36h57e144c_4 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main mpmath 1.0.0 py36hacc8adf_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main msgpack-python 0.5.1 py36he980bc4_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main multipledispatch 0.4.9 py36he44c36e_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main navigator-updater 0.1.0 py36h8a7b86b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main nbconvert 5.3.1 py36h8dc0fde_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main nbformat 4.4.0 py36h3a5bc1b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main networkx 2.0 py36hff991e3_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main nltk 3.2.5 py36h76d52bb_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main nose 1.3.7 py36h1c3779e_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main notebook 5.3.1 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main numba 0.36.2 np113py36h0128aa7_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main numexpr 2.6.4 py36h30784b8_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main numpy 1.13.3 py36ha320f96_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main numpydoc 0.7.0 py36ha25429e_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main odo 0.5.1 py36h7560279_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main olefile 0.44 py36h0a7bdd2_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main openpyxl 2.4.9 py36h6c6577a_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main openssl 1.0.2n h74b6da3_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main packaging 16.8 py36ha0986f6_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pandas 0.22.0 py36h6538335_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pandoc 1.19.2.1 hb2460c7_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pandocfilters 1.4.2 py36h3ef6317_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main parso 0.1.1 py36hae3edee_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main partd 0.3.8 py36hc8e763b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main path.py 10.5 py36h2b94a8f_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pathlib2 2.3.0 py36h7bfb78b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main patsy 0.5.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pep8 1.7.1 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pickleshare 0.7.4 py36h9de030f_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pillow 5.0.0 py36h0738816_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pip 9.0.1 py36h226ae91_4 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pkginfo 1.4.1 py36hb0f9cfa_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pluggy 0.6.0 py36hc7daf1e_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main ply 3.10 py36h1211beb_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main progress 1.3 py36hbeca8d3_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main prompt_toolkit 1.0.15 py36h60b8f86_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main psutil 5.4.3 py36hfa6e2cd_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main py 1.5.2 py36hbcfbabc_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pycodestyle 2.3.1 py36h7cc55cd_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pycosat 0.6.3 py36h413d8a4_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pycparser 2.18 py36hd053e01_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pycrypto 2.6.1 py36he68e6e2_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pycurl 7.43.0.1 py36h74b6da3_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pyflakes 1.6.0 py36h0b975d6_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pygments 2.2.0 py36hb010967_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pylint 1.8.1 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pympler 0.5 py36h863af32_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pyodbc 4.0.21 py36h82c9817_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pyopenssl 17.5.0 py36h5b7d817_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pyparsing 2.2.0 py36h785a196_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pyqt 5.6.0 py36hb5ed885_5 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pysocks 1.6.7 py36h698d350_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pytables 3.4.2 py36h71138e3_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pytest 3.3.2 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main python 3.6.4 h6538335_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main python-dateutil 2.6.1 py36h509ddcb_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pytz 2017.3 py36h1d3fa6b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pywavelets 0.5.2 py36hc649158_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pywin32 221 py36h9c10281_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pyyaml 3.12 py36h1d1928f_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main pyzmq 16.0.3 py36he714bf5_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main qt 5.6.2 vc14h6f8c307_12 [vc14] https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main qtawesome 0.4.4 py36h5aa48f6_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main qtconsole 4.3.1 py36h99a29a9_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main qtpy 1.3.1 py36hb8717c5_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main requests 2.18.4 py36h4371aae_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main rope 0.10.7 py36had63a69_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main ruamel_yaml 0.15.35 py36hfa6e2cd_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main scikit-image 0.13.1 py36hfa6e2cd_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main scikit-learn 0.19.1 py36h53aea1b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main scipy 1.0.0 py36h1260518_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main seaborn 0.8.1 py36h9b69545_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main send2trash 1.4.2 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main setuptools 38.4.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main simplegeneric 0.8.1 py36heab741f_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main singledispatch 3.4.0.3 py36h17d0c80_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main sip 4.18.1 py36h9c25514_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main six 1.11.0 py36h4db2310_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main snowballstemmer 1.2.1 py36h763602f_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main sortedcollections 0.5.3 py36hbefa0ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main sortedcontainers 1.5.9 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main sphinx 1.6.6 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main sphinxcontrib 1.0 py36hbbac3d2_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main sphinxcontrib-websupport 1.0.1 py36hb5e5916_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main spyder 3.2.6 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main sqlalchemy 1.2.1 py36hfa6e2cd_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main sqlite 3.20.1 h9eeafa9_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main statsmodels 0.8.0 py36h6189b4c_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main sympy 1.1.1 py36h96708e0_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main tblib 1.3.2 py36h30f5020_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main testpath 0.3.1 py36h2698cfe_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main tk 8.6.7 hcb92d03_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main toolz 0.9.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main tornado 4.5.3 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main traitlets 4.3.2 py36h096827d_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main typing 3.6.2 py36hb035bda_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main unicodecsv 0.14.1 py36h6450c06_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main urllib3 1.22 py36h276f60a_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main vc 14 h0510ff6_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main vs2015_runtime 14.0.25123 3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main wcwidth 0.1.7 py36h3d5aa90_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main webencodings 0.5.1 py36h67c50ae_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main werkzeug 0.14.1 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main wheel 0.30.0 py36h6c3ec14_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main widgetsnbextension 3.1.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main win_inet_pton 1.0.1 py36he67d7fd_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main win_unicode_console 0.5 py36hcdbd4b5_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main wincertstore 0.2 py36h7fe50ca_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main wrapt 1.10.11 py36he5f5981_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main xlrd 1.1.0 py36h1cb58dc_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main xlsxwriter 1.0.2 py36hf723b7d_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main xlwings 0.11.5 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main xlwt 1.3.0 py36h1a4751e_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main yaml 0.1.7 hc54c509_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main zict 0.1.3 py36h2d8e73e_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main zlib 1.2.11 h8395fce_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main zope 1.0 py36_0 defaults zope.interface 4.4.3 py36h56cab3c_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main ``` </p></details>
I thought python was supposed to take care of CRLF for us on windows in most cases. Possible that's not the case, but then confused how more people haven't reported this issue so far. Looking into it though... For reference, if we end up making a modification, it may be in this line: https://github.com/conda/conda/blob/4.4.7/conda/activate.py#L90 The bat file generated in temp directory contains only LF. When I change '\n' into '\r\n' at https://github.com/conda/conda/blob/4.4.7/conda/activate.py#L90, the prompt works! But I'm still not sure because others haven't reported this issue.
2018-01-24T10:18:52
conda/conda
6,776
conda__conda-6776
[ "6699" ]
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:59
conda/conda
6,777
conda__conda-6777
[ "6739" ]
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
diff --git a/tests/test_activate.py b/tests/test_activate.py --- a/tests/test_activate.py +++ b/tests/test_activate.py @@ -471,6 +471,7 @@ def test_posix_basic(self): 'CONDA_SHLVL': '1', 'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))), }): + activator = Activator('posix') with captured() as c: rc = activate_main(('', 'shell.posix', 'reactivate')) assert not c.stderr @@ -549,6 +550,7 @@ def test_cmd_exe_basic(self): 'CONDA_SHLVL': '1', 'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))), }): + activator = Activator('cmd.exe') with captured() as c: assert activate_main(('', 'shell.cmd.exe', 'reactivate')) == 0 assert not c.stderr @@ -626,6 +628,7 @@ def test_csh_basic(self): 'CONDA_SHLVL': '1', 'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))), }): + activator = Activator('csh') with captured() as c: rc = activate_main(('', 'shell.csh', 'reactivate')) assert not c.stderr @@ -701,6 +704,7 @@ def test_xonsh_basic(self): 'CONDA_SHLVL': '1', 'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))), }): + activator = Activator('xonsh') with captured() as c: assert activate_main(('', 'shell.xonsh', 'reactivate')) == 0 assert not c.stderr @@ -776,6 +780,7 @@ def test_fish_basic(self): 'CONDA_SHLVL': '1', 'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))), }): + activator = Activator('fish') with captured() as c: rc = activate_main(('', 'shell.fish', 'reactivate')) assert not c.stderr @@ -845,6 +850,7 @@ def test_powershell_basic(self): 'CONDA_SHLVL': '1', 'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))), }): + activator = Activator('powershell') with captured() as c: rc = activate_main(('', 'shell.powershell', 'reactivate')) assert not c.stderr
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:29
conda/conda
6,778
conda__conda-6778
[ "6390" ]
c1af02bb4fcfb8c962bb52d040ba705174345889
diff --git a/conda/core/linked_data.py b/conda/core/linked_data.py --- a/conda/core/linked_data.py +++ b/conda/core/linked_data.py @@ -7,10 +7,11 @@ from ..base.constants import CONDA_TARBALL_EXTENSION from ..base.context import context -from ..common.compat import itervalues, with_metaclass +from ..common.compat import JSONDecodeError, itervalues, with_metaclass from ..common.constants import NULL from ..common.serialize import json_load -from ..exceptions import BasicClobberError, CondaDependencyError, maybe_raise +from ..exceptions import BasicClobberError, CondaDependencyError, maybe_raise, \ + CorruptedEnvironmentError from ..gateways.disk.create import write_as_json_to_file from ..gateways.disk.delete import rm_rf from ..models.dist import Dist @@ -112,7 +113,11 @@ def _prefix_records(self): def _load_single_record(self, prefix_record_json_path): log.trace("loading prefix record %s", prefix_record_json_path) with open(prefix_record_json_path) as fh: - json_data = json_load(fh.read()) + try: + json_data = json_load(fh.read()) + except JSONDecodeError: + raise CorruptedEnvironmentError(self.prefix_path, prefix_record_json_path) + prefix_record = PrefixRecord(**json_data) self.__prefix_records[prefix_record.name] = prefix_record diff --git a/conda/exceptions.py b/conda/exceptions.py --- a/conda/exceptions.py +++ b/conda/exceptions.py @@ -570,6 +570,23 @@ def __init__(self, expected_type, received_type, optional_message): super(CondaTypeError, self).__init__(msg) +class CorruptedEnvironmentError(CondaError): + def __init__(self, environment_location, corrupted_file, **kwargs): + message = dals(""" + The target environment has been corrupted. Corrupted environments most commonly + occur when the conda process is force-terminated while in an unlink-link + transaction. + environment location: %(environment_location)s + corrupted file: %(corrupted_file)s + """) + super(CorruptedEnvironmentError, self).__init__( + message, + environment_location=environment_location, + corrupted_file=corrupted_file, + **kwargs + ) + + class CondaHistoryError(CondaError): def __init__(self, message): msg = '%s' % message
Problem in conda list Current conda install: platform : linux-32 conda version : 4.3.30 conda is private : False conda-env version : 4.3.30 conda-build version : 3.0.27 python version : 3.6.3.final.0 requests version : 2.18.4 root environment : /home/dhj/anaconda3-5.0.1 (writable) default environment : /home/dhj/anaconda3-5.0.1 envs directories : /home/dhj/anaconda3-5.0.1/envs /home/dhj/.conda/envs package cache : /home/dhj/anaconda3-5.0.1/pkgs /home/dhj/.conda/pkgs channel URLs : https://repo.continuum.io/pkgs/main/linux-32 https://repo.continuum.io/pkgs/main/noarch https://repo.continuum.io/pkgs/free/linux-32 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/linux-32 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/linux-32 https://repo.continuum.io/pkgs/pro/noarch config file : None netrc file : None offline mode : False user-agent : conda/4.3.30 requests/2.18.4 CPython/3.6.3 Linux/4.10.0-40-generic debian/stretch/sid glibc/2.23 UID:GID : 1000:1000 `$ /home/dhj/anaconda3-5.0.1/bin/conda list` Traceback (most recent call last): File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/exceptions.py", line 640, in conda_exception_handler return_value = func(*args, **kwargs) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main.py", line 140, in _main exit_code = args.func(args, p) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main_list.py", line 242, in execute show_channel_urls=context.show_channel_urls) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main_list.py", line 172, in print_packages installed = linked(prefix) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/core/linked_data.py", line 123, in linked return set(linked_data(prefix, ignore_channels=ignore_channels).keys()) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/core/linked_data.py", line 115, in linked_data load_linked_data(prefix, dist_name, ignore_channels=ignore_channels) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/site-packages/conda/core/linked_data.py", line 36, in load_linked_data rec = json.load(fi) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/json/__init__.py", line 299, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/json/__init__.py", line 354, in loads return _default_decoder.decode(s) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/dhj/anaconda3-5.0.1/lib/python3.6/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2018-01-24T13:10:05
conda/conda
6,779
conda__conda-6779
[ "6645" ]
c1af02bb4fcfb8c962bb52d040ba705174345889
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 @@ -19,7 +19,8 @@ # duplicated code in the interest of import efficiency on_win = bool(sys.platform == "win32") user_rc_path = abspath(expanduser('~/.condarc')) -sys_rc_path = join(sys.prefix, '.condarc') +escaped_user_rc_path = user_rc_path.replace("%", "%%") +escaped_sys_rc_path = abspath(join(sys.prefix, '.condarc')).replace("%", "%%") def generate_parser(): @@ -297,7 +298,7 @@ def configure_parser_config(sub_parsers): Modify configuration values in .condarc. This is modeled after the git config command. Writes to the user .condarc file (%s) by default. - """) % user_rc_path + """) % escaped_user_rc_path # Note, the extra whitespace in the list keys is on purpose. It's so the # formatting from help2man is still valid YAML (otherwise it line wraps the @@ -357,22 +358,25 @@ def configure_parser_config(sub_parsers): "--system", action="store_true", help="""Write to the system .condarc file ({system}). Otherwise writes to the user - config file ({user}).""".format(system=sys_rc_path, - user=user_rc_path), + config file ({user}).""".format(system=escaped_sys_rc_path, + user=escaped_user_rc_path), ) location.add_argument( "--env", action="store_true", help="Write to the active conda environment .condarc file (%s). " "If no environment is active, write to the user config file (%s)." - "" % (os.getenv('CONDA_PREFIX', "<no active environment>"), user_rc_path), + "" % ( + os.getenv('CONDA_PREFIX', "<no active environment>").replace("%", "%%"), + escaped_user_rc_path, + ), ) location.add_argument( "--file", action="store", help="""Write to the given file. Otherwise writes to the user config file ({user}) or the file path given by the 'CONDARC' environment variable, if it is set -(default: %(default)s).""".format(user=user_rc_path), +(default: %(default)s).""".format(user=escaped_user_rc_path), default=os.environ.get('CONDARC', user_rc_path) )
conda -h => ValueError: unsupported format character (jupyterlab) C:\Users\scuba>conda -h # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "E:\Miniconda3\lib\site-packages\conda\exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "E:\Miniconda3\lib\site-packages\conda\cli\main.py", line 71, in _main args = p.parse_args(args[1:]) File "E:\Miniconda3\lib\argparse.py", line 1730, in parse_args args, argv = self.parse_known_args(args, namespace) File "E:\Miniconda3\lib\argparse.py", line 1762, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "E:\Miniconda3\lib\argparse.py", line 1968, in _parse_known_args start_index = consume_optional(start_index) File "E:\Miniconda3\lib\argparse.py", line 1908, in consume_optional take_action(action, args, option_string) File "E:\Miniconda3\lib\argparse.py", line 1836, in take_action action(self, namespace, argument_values, option_string) File "E:\Miniconda3\lib\argparse.py", line 1020, in __call__ parser.print_help() File "E:\Miniconda3\lib\site-packages\conda\cli\conda_argparse.py", line 149, in print_help super(ArgumentParser, self).print_help() File "E:\Miniconda3\lib\argparse.py", line 2362, in print_help self._print_message(self.format_help(), file) File "E:\Miniconda3\lib\argparse.py", line 2346, in format_help return formatter.format_help() File "E:\Miniconda3\lib\argparse.py", line 282, in format_help help = self._root_section.format_help() File "E:\Miniconda3\lib\argparse.py", line 213, in format_help item_help = join([func(*args) for func, args in self.items]) File "E:\Miniconda3\lib\argparse.py", line 213, in <listcomp> item_help = join([func(*args) for func, args in self.items]) File "E:\Miniconda3\lib\argparse.py", line 213, in format_help item_help = join([func(*args) for func, args in self.items]) File "E:\Miniconda3\lib\argparse.py", line 213, in <listcomp> item_help = join([func(*args) for func, args in self.items]) File "E:\Miniconda3\lib\argparse.py", line 531, in _format_action parts.append(self._format_action(subaction)) File "E:\Miniconda3\lib\argparse.py", line 519, in _format_action help_text = self._expand_help(action) File "E:\Miniconda3\lib\argparse.py", line 606, in _expand_help return self._get_help_string(action) % params ValueError: unsupported format character 'U' (0x55) at index 140 is there a fix for this?
What is the output of `conda info`? (base) C:\Users\scuba>conda info active environment : base active env location : E:\Miniconda3 shell level : 1 user config file : C:\Users\scuba\%USERPROFILE%\.condarc populated config files : C:\Users\scuba\%USERPROFILE%\.condarc conda version : 4.4.6 conda-build version : not installed python version : 3.6.3.final.0 base environment : E:\Miniconda3 (writable) channel URLs : https://repo.continuum.io/pkgs/main/win-64 https://repo.continuum.io/pkgs/main/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 package cache : E:\Miniconda3\pkgs C:\Users\scuba\AppData\Local\conda\conda\pkgs envs directories : E:\Miniconda3\envs C:\Users\scuba\AppData\Local\conda\conda\envs C:\Users\scuba\%USERPROFILE%\.conda\envs platform : win-64 user-agent : conda/4.4.6 requests/2.18.4 CPython/3.6.3 Windows/10 Windows/10.0.15063 administrator : False netrc file : None offline mode : False %USERPROFILE% appears to be the problem (windows 10) but how to solve it?
2018-01-24T14:08:23
conda/conda
6,782
conda__conda-6782
[ "5884", "5884" ]
33731c68637acb2b5cac46f122b50add46c10490
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -95,9 +95,10 @@ def default_python_validation(value): def ssl_verify_validation(value): if isinstance(value, string_types): - if not isfile(value): - return ("ssl_verify value '%s' must be a boolean or a path to a " - "certificate bundle." % value) + if not isfile(value) and not isdir(value): + return ("ssl_verify value '%s' must be a boolean, a path to a " + "certificate bundle file, or a path to a directory containing " + "certificates of trusted CAs." % value) return True @@ -147,7 +148,7 @@ class Context(Configuration): # remote connection details ssl_verify = PrimitiveParameter(True, element_type=string_types + (bool,), - aliases=('insecure', 'verify_ssl',), + aliases=('verify_ssl',), validation=ssl_verify_validation) client_ssl_cert = PrimitiveParameter(None, aliases=('client_cert',), element_type=string_types + (NoneType,)) 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 @@ -1265,6 +1265,7 @@ def add_parser_insecure(p): p.add_argument( "-k", "--insecure", action="store_false", + dest="ssl_verify", default=NULL, help="Allow conda to perform \"insecure\" SSL connections and transfers. " "Equivalent to setting 'ssl_verify' to 'false'."
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -869,7 +869,7 @@ def test_conda_config_validate(self): run_command(Commands.CONFIG, prefix, "--validate") assert len(exc.value.errors) == 2 - assert "must be a boolean or a path to a certificate bundle" in str(exc.value) + assert "must be a boolean, a path to a certificate bundle file, or a path to a directory containing certificates of trusted CAs" in str(exc.value) assert "default_python value 'anaconda' not of the form '[23].[0-9]'" in str(exc.value) finally: reset_context()
ssl_verify functionality doesn't match description Was experimenting to see if I could use a cert directory on Windows 7: ``` > conda config --set ssl_verify C:\Users\HarmerS\certs ``` However it seems like the description of `ssl_verify` doesn't agree with the implementation. ``` > conda config --describe [...] ssl_verify (basestring, bool) default: true aliases: insecure, verify_ssl Conda verifies SSL certificates for HTTPS requests, just like a web browser. By default, SSL verification is enabled, and conda operations will fail if a required url's certificate cannot be verified. Setting ssl_verify to False disables certification verificaiton. The value for ssl_verify can also be (1) a path to a CA bundle file, or (2) a path to a directory containing certificates of trusted CA. [...] > conda install -c conda-forge pydicom CustomValidationError: Parameter ssl_verify = 'C:\\Users\\HarmerS\\certs' declared in <<merged>> is invalid. ssl_verify value 'C:\Users\HarmerS\certs' must be a boolean or a path to a certificate bundle. ``` ``` > conda --version conda 4.3.25 ``` Via Miniconda 4.3.21 [installer](https://repo.continuum.io/miniconda/Miniconda2-latest-Windows-x86.exe) Python 2.7 32-bit + `conda update conda` on Windows 7 64-bit. I would prefer to have the feature of using a cert directory (much easier to manage) so I raised the issue here rather than under conda-docs. ssl_verify functionality doesn't match description Was experimenting to see if I could use a cert directory on Windows 7: ``` > conda config --set ssl_verify C:\Users\HarmerS\certs ``` However it seems like the description of `ssl_verify` doesn't agree with the implementation. ``` > conda config --describe [...] ssl_verify (basestring, bool) default: true aliases: insecure, verify_ssl Conda verifies SSL certificates for HTTPS requests, just like a web browser. By default, SSL verification is enabled, and conda operations will fail if a required url's certificate cannot be verified. Setting ssl_verify to False disables certification verificaiton. The value for ssl_verify can also be (1) a path to a CA bundle file, or (2) a path to a directory containing certificates of trusted CA. [...] > conda install -c conda-forge pydicom CustomValidationError: Parameter ssl_verify = 'C:\\Users\\HarmerS\\certs' declared in <<merged>> is invalid. ssl_verify value 'C:\Users\HarmerS\certs' must be a boolean or a path to a certificate bundle. ``` ``` > conda --version conda 4.3.25 ``` Via Miniconda 4.3.21 [installer](https://repo.continuum.io/miniconda/Miniconda2-latest-Windows-x86.exe) Python 2.7 32-bit + `conda update conda` on Windows 7 64-bit. I would prefer to have the feature of using a cert directory (much easier to manage) so I raised the issue here rather than under conda-docs.
Conda just uses requests under the hood. Is what you're proposing compatible with http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification ? If so, we can absolutely update all associated docs. For reference, the documentation shown by `conda config --describe` is at https://github.com/conda/conda/blob/4.3.x/conda/base/context.py#L686 Conda just uses requests under the hood. Is what you're proposing compatible with http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification ? If so, we can absolutely update all associated docs. For reference, the documentation shown by `conda config --describe` is at https://github.com/conda/conda/blob/4.3.x/conda/base/context.py#L686
2018-01-24T18:33:16
conda/conda
6,784
conda__conda-6784
[ "6208" ]
d503c26e0a9165f21b758238cdf08c3f1b81d20f
diff --git a/conda_env/installers/pip.py b/conda_env/installers/pip.py --- a/conda_env/installers/pip.py +++ b/conda_env/installers/pip.py @@ -38,6 +38,8 @@ def _pip_install_via_requirements(prefix, specs, args, *_, **kwargs): requirements.close() # pip command line... args, pip_version = pip_args(prefix) + if args is None: + return pip_cmd = args + ['install', '-r', requirements.name] # ...run it process = subprocess.Popen(pip_cmd,
Conda DAND Udacity yaml file error snadar@ubuntu-desktop:~$ conda env create -f dand-env-linux.yaml Using Anaconda API: https://api.anaconda.org Fetching package metadata ........... Solving package specifications: . icu-54.1-0.tar 100% |################################| Time: 0:01:11 165.48 kB/s jpeg-8d-2.tar. 100% |################################| Time: 0:00:06 122.05 kB/s libgcc-ng-7.2. 100% |################################| Time: 0:00:47 133.59 kB/s libgfortran-3. 100% |################################| Time: 0:00:02 127.21 kB/s libstdcxx-ng-7 100% |################################| Time: 0:00:18 140.57 kB/s mkl-11.3.3-0.t 100% |################################| Time: 0:08:42 245.18 kB/s openssl-1.0.2j 100% |################################| Time: 0:00:06 496.81 kB/s pixman-0.32.6- 100% |################################| Time: 0:00:06 413.05 kB/s readline-6.2-2 100% |################################| Time: 0:00:01 333.28 kB/s sqlite-3.13.0- 100% |################################| Time: 0:00:08 497.93 kB/s tk-8.5.18-0.ta 100% |################################| Time: 0:00:03 529.07 kB/s yaml-0.1.6-0.t 100% |################################| Time: 0:00:00 532.09 kB/s zlib-1.2.8-3.t 100% |################################| Time: 0:00:00 548.04 kB/s libgcc-7.2.0-h 100% |################################| Time: 0:00:00 523.41 kB/s libiconv-1.15- 100% |################################| Time: 0:00:03 606.23 kB/s libpng-1.6.22- 100% |################################| Time: 0:00:00 579.81 kB/s libxcb-1.12-h8 100% |################################| Time: 0:00:00 638.65 kB/s pcre-8.39-1.ta 100% |################################| Time: 0:00:01 619.63 kB/s python-2.7.12- 100% |################################| Time: 0:00:18 677.69 kB/s backports-1.0- 100% |################################| Time: 0:00:00 953.06 kB/s backports_abc- 100% |################################| Time: 0:00:00 1.20 MB/s beautifulsoup4 100% |################################| Time: 0:00:00 458.56 kB/s dbus-1.10.20-0 100% |################################| Time: 0:00:02 555.57 kB/s decorator-4.0. 100% |################################| Time: 0:00:00 2.49 MB/s enum34-1.1.6-p 100% |################################| Time: 0:00:00 921.07 kB/s freetype-2.5.5 100% |################################| Time: 0:00:06 433.13 kB/s functools32-3. 100% |################################| Time: 0:00:00 1.26 MB/s glib-2.50.2-1. 100% |################################| Time: 0:00:16 361.10 kB/s ipython_genuti 100% |################################| Time: 0:00:00 326.48 kB/s libxml2-2.9.4- 100% |################################| Time: 0:00:13 294.28 kB/s markupsafe-0.2 100% |################################| Time: 0:00:00 376.16 kB/s mistune-0.7.4- 100% |################################| Time: 0:00:01 393.87 kB/s nltk-3.2.1-py2 100% |################################| Time: 0:00:06 295.22 kB/s numpy-1.11.2-p 100% |################################| Time: 0:00:18 346.04 kB/s path.py-8.2.1- 100% |################################| Time: 0:00:00 132.93 kB/s ptyprocess-0.5 100% |################################| Time: 0:00:00 305.77 kB/s pygments-2.1.3 100% |################################| Time: 0:00:04 289.69 kB/s pymongo-3.3.0- 100% |################################| Time: 0:00:02 171.89 kB/s pyparsing-2.1. 100% |################################| Time: 0:00:00 153.55 kB/s pytz-2016.10-p 100% |################################| Time: 0:00:01 147.06 kB/s pyyaml-3.12-py 100% |################################| Time: 0:00:01 195.65 kB/s requests-2.12. 100% |################################| Time: 0:00:02 309.94 kB/s setuptools-27. 100% |################################| Time: 0:00:01 337.28 kB/s simplegeneric- 100% |################################| Time: 0:00:00 5.86 MB/s sip-4.18-py27_ 100% |################################| Time: 0:00:00 489.63 kB/s six-1.10.0-py2 100% |################################| Time: 0:00:00 10.14 MB/s unicodecsv-0.1 100% |################################| Time: 0:00:00 15.37 MB/s wcwidth-0.1.7- 100% |################################| Time: 0:00:00 5.09 MB/s wheel-0.29.0-p 100% |################################| Time: 0:00:00 565.34 kB/s xlrd-1.0.0-py2 100% |################################| Time: 0:00:00 419.97 kB/s zeromq-4.1.5-0 100% |################################| Time: 0:00:16 270.52 kB/s backports.shut 100% |################################| Time: 0:00:00 510.08 kB/s clyent-1.2.2-p 100% |################################| Time: 0:00:00 613.19 kB/s configparser-3 100% |################################| Time: 0:00:00 559.03 kB/s cycler-0.10.0- 100% |################################| Time: 0:00:00 4.23 MB/s fontconfig-2.1 100% |################################| Time: 0:00:01 351.49 kB/s get_terminal_s 100% |################################| Time: 0:00:00 4.24 MB/s gstreamer-1.8. 100% |################################| Time: 0:00:07 368.44 kB/s jinja2-2.8-py2 100% |################################| Time: 0:00:01 185.39 kB/s jsonschema-2.5 100% |################################| Time: 0:00:00 135.51 kB/s pathlib2-2.1.0 100% |################################| Time: 0:00:00 498.12 kB/s pexpect-4.0.1- 100% |################################| Time: 0:00:00 83.23 kB/s pip-9.0.1-py27 100% |################################| Time: 0:00:09 174.59 kB/s prompt_toolkit 100% |################################| Time: 0:00:01 172.84 kB/s python-dateuti 100% |################################| Time: 0:00:00 373.96 kB/s pyzmq-16.0.2-p 100% |################################| Time: 0:00:02 322.33 kB/s scipy-0.18.1-n 100% |################################| Time: 0:01:29 363.25 kB/s singledispatch 100% |################################| Time: 0:00:00 449.26 kB/s ssl_match_host 100% |################################| Time: 0:00:00 1.53 MB/s traitlets-4.3. 100% |################################| Time: 0:00:00 133.42 kB/s anaconda-clien 100% |################################| Time: 0:00:01 100.87 kB/s cairo-1.12.18- 100% |################################| Time: 0:00:02 296.19 kB/s entrypoints-0. 100% |################################| Time: 0:00:00 2.84 MB/s gst-plugins-ba 100% |################################| Time: 0:00:07 449.87 kB/s jupyter_core-4 100% |################################| Time: 0:00:00 167.95 kB/s pandas-0.19.1- 100% |################################| Time: 0:01:03 246.90 kB/s pickleshare-0. 100% |################################| Time: 0:00:00 579.01 kB/s scikit-learn-0 100% |################################| Time: 0:00:38 232.56 kB/s tornado-4.4.2- 100% |################################| Time: 0:00:04 140.01 kB/s ipython-5.1.0- 100% |################################| Time: 0:00:05 189.17 kB/s jupyter_client 100% |################################| Time: 0:00:00 114.47 kB/s nbformat-4.2.0 100% |################################| Time: 0:00:01 99.19 kB/s pycairo-1.10.0 100% |################################| Time: 0:00:00 207.15 kB/s qt-5.6.2-0.tar 100% |################################| Time: 0:02:43 277.77 kB/s terminado-0.6- 100% |################################| Time: 0:00:00 325.08 kB/s ipykernel-4.5. 100% |################################| Time: 0:00:02 59.41 kB/s nbconvert-4.2. 100% |################################| Time: 0:00:02 156.67 kB/s pyqt-5.6.0-py2 100% |################################| Time: 0:00:11 471.43 kB/s jupyter_consol 100% |################################| Time: 0:00:00 698.52 kB/s matplotlib-1.5 100% |################################| Time: 0:00:22 373.96 kB/s notebook-4.3.0 100% |################################| Time: 0:00:16 338.69 kB/s qtconsole-4.2. 100% |################################| Time: 0:00:01 133.56 kB/s seaborn-0.7.1- 100% |################################| Time: 0:00:00 347.93 kB/s widgetsnbexten 100% |################################| Time: 0:00:04 254.80 kB/s ipywidgets-5.2 100% |################################| Time: 0:00:00 79.79 kB/s jupyter-1.0.0- 100% |################################| Time: 0:00:00 2.42 MB/s nb_anacondaclo 100% |################################| Time: 0:00:00 1.02 MB/s nb_conda_kerne 100% |################################| Time: 0:00:00 46.93 kB/s nb_conda-2.0.0 100% |################################| Time: 0:00:00 88.22 kB/s _nb_ext_conf-0 100% |################################| Time: 0:00:00 632.75 kB/s nbpresent-3.0. 100% |################################| Time: 0:00:02 190.61 kB/s An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : linux-64 conda version : 4.3.30 conda is private : False conda-env version : 4.3.30 conda-build version : 3.0.27 python version : 3.6.2.final.0 requests version : 2.18.4 root environment : /home/snadar/anaconda3 (writable) default environment : /home/snadar/anaconda3 envs directories : /home/snadar/anaconda3/envs /home/snadar/.conda/envs package cache : /home/snadar/anaconda3/pkgs /home/snadar/.conda/pkgs 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 config file : None netrc file : None offline mode : False user-agent : conda/4.3.30 requests/2.18.4 CPython/3.6.2 Linux/4.13.0-16-generic debian/stretch/sid glibc/2.26 UID:GID : 1000:1000 `$ /home/snadar/anaconda3/bin/conda-env create -f dand-env-linux.yaml` Traceback (most recent call last): File "/home/snadar/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 640, in conda_exception_handler return_value = func(*args, **kwargs) File "/home/snadar/anaconda3/lib/python3.6/site-packages/conda_env/cli/main_create.py", line 108, in execute installer.install(prefix, pkg_specs, args, env) File "/home/snadar/anaconda3/lib/python3.6/site-packages/conda_env/installers/pip.py", line 8, in install pip_cmd = pip_args(prefix) + ['install', ] + specs TypeError: can only concatenate list (not "NoneType") to list
Could you please share the contents of `dand-env-linux.yaml`? Pretty hard to help without all the information. ``` name: DAND channels: !!python/tuple - defaults dependencies: - _nb_ext_conf=0.3.0=py27_0 - anaconda-client=1.6.0=py27_0 #- appnope=0.1.0=py27_0 - backports=1.0=py27_0 - backports_abc=0.5=py27_0 - beautifulsoup4=4.5.1=py27_0 - clyent=1.2.2=py27_0 - configparser=3.5.0=py27_0 - cycler=0.10.0=py27_0 - decorator=4.0.10=py27_1 - entrypoints=0.2.2=py27_0 - enum34=1.1.6=py27_0 - freetype=2.5.5=1 - functools32=3.2.3.2=py27_0 - get_terminal_size=1.0.0=py27_0 - icu=54.1=0 - ipykernel=4.5.2=py27_0 - ipython=5.1.0=py27_0 - ipython_genutils=0.1.0=py27_0 - ipywidgets=5.2.2=py27_0 - jinja2=2.8=py27_1 - jsonschema=2.5.1=py27_0 - jupyter=1.0.0=py27_3 - jupyter_client=4.4.0=py27_0 - jupyter_console=5.0.0=py27_0 - jupyter_core=4.2.1=py27_0 - libpng=1.6.22=0 - markupsafe=0.23=py27_2 - matplotlib=1.5.3=np111py27_1 - mistune=0.7.4=py27_0 - mkl=11.3.3=0 - nb_anacondacloud=1.2.0=py27_0 - nb_conda=2.0.0=py27_0 - nb_conda_kernels=2.0.0=py27_0 - nbconvert=4.2.0=py27_0 - nbformat=4.2.0=py27_0 - nbpresent=3.0.2=py27_0 - nltk=3.2.1=py27_0 - notebook=4.3.0=py27_0 - numpy=1.11.2=py27_0 - openssl=1.0.2j=0 - pandas=0.19.1=np111py27_0 - path.py=8.2.1=py27_0 - pathlib2=2.1.0=py27_0 - pexpect=4.0.1=py27_0 - pickleshare=0.7.4=py27_0 - pip=9.0.1=py27_1 - prompt_toolkit=1.0.9=py27_0 - ptyprocess=0.5.1=py27_0 - pygments=2.1.3=py27_0 - pymongo=3.3.0=py27_0 - pyparsing=2.1.4=py27_0 - pyqt=5.6.0=py27_1 - python=2.7.12=1 - python-dateutil=2.6.0=py27_0 #- python.app=1.2=py27_4 - pytz=2016.10=py27_0 - pyyaml=3.12=py27_0 - pyzmq=16.0.2=py27_0 - qt=5.6.2=0 - qtconsole=4.2.1=py27_1 - readline=6.2=2 - requests=2.12.3=py27_0 - scikit-learn=0.17.1=np111py27_2 - scipy=0.18.1=np111py27_0 - seaborn=0.7.1=py27_0 - setuptools=27.2.0=py27_0 - simplegeneric=0.8.1=py27_1 - singledispatch=3.4.0.3=py27_0 - sip=4.18=py27_0 - six=1.10.0=py27_0 - sqlite=3.13.0=0 - ssl_match_hostname=3.4.0.2=py27_1 - terminado=0.6=py27_0 - tk=8.5.18=0 - tornado=4.4.2=py27_0 - traitlets=4.3.1=py27_0 - unicodecsv=0.14.1=py27_0 - wcwidth=0.1.7=py27_0 - wheel=0.29.0=py27_0 - widgetsnbextension=1.2.6=py27_0 - xlrd=1.0.0=py27_0 - yaml=0.1.6=0 - zlib=1.2.8=3 - pip: - backports_abc==0.5 - backports.shutil_get_terminal_size==1.0.0 - ssl_match_hostname==3.4.0.2 - ipython_genutils==0.1.0 - jupyter_client==4.4.0 - jupyter_console==5.0.0 - jupyter_core==4.2.1 - nb_anacondacloud==1.2.0 - nb_conda==2.0.0 - nb_conda_kernels==2.0.0 - prompt_toolkit==1.0.9 prefix: /Users/mat/anaconda/envs/DAND ``` Have the same issue on my circle_ci, except having ``` pip_cmd = pip_args(prefix) + ['install', ] + specs TypeError: can only concatenate tuple (not "list") to tuple ``` @Casyfill Which version of Conda are you using? Could you try with 4.4.4? This change should have probably fixed this issue: https://github.com/conda/conda/pull/6535/files Yeah, have this issue on 4.4.4. ‌ <https://mailtrack.io/> Sent with Mailtrack <https://chrome.google.com/webstore/detail/mailtrack-for-gmail-inbox/ndnaehgpjlnokgebbaldlmgkapkpjkkb?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality> On Wed, Dec 27, 2017 at 5:39 AM Nehal J Wani <[email protected]> wrote: > @Casyfill <https://github.com/casyfill> Which version of Conda are you > using? Could you try with 4.4.4? This change should have probably fixed > this issue: https://github.com/conda/conda/pull/6535/files > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <https://github.com/conda/conda/issues/6208#issuecomment-354093910>, or mute > the thread > <https://github.com/notifications/unsubscribe-auth/ACjTpYdfT8_SL1W0BNUUg72RPrTZQ4a4ks5tEh5tgaJpZM4QB6Zl> > . >
2018-01-24T23:16:01
conda/conda
6,790
conda__conda-6790
[ "6457" ]
d503c26e0a9165f21b758238cdf08c3f1b81d20f
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 @@ -195,25 +195,29 @@ def get_info_dict(system=False): info_dict['UID'] = os.geteuid() info_dict['GID'] = os.getegid() - evars = { + env_var_keys = { 'CIO_TEST', 'REQUESTS_CA_BUNDLE', 'SSL_CERT_FILE', } # add all relevant env vars, e.g. startswith('CONDA') or endswith('PATH') - evars.update(v for v in os.environ if v.upper().startswith('CONDA')) - evars.update(v for v in os.environ if v.upper().startswith('PYTHON')) - evars.update(v for v in os.environ if v.upper().endswith('PROXY')) - evars.update(v for v in os.environ if v.upper().endswith('PATH')) - evars.update(v for v in os.environ if v.upper().startswith('SUDO')) + env_var_keys.update(v for v in os.environ if v.upper().startswith('CONDA')) + env_var_keys.update(v for v in os.environ if v.upper().startswith('PYTHON')) + env_var_keys.update(v for v in os.environ if v.upper().endswith('PATH')) + env_var_keys.update(v for v in os.environ if v.upper().startswith('SUDO')) + + env_vars = {ev: os.getenv(ev, os.getenv(ev.lower(), '<not set>')) for ev in env_var_keys} + + proxy_keys = (v for v in os.environ if v.upper().endswith('PROXY')) + env_vars.update({ev: '<set>' for ev in proxy_keys}) info_dict.update({ 'sys.version': sys.version, 'sys.prefix': sys.prefix, 'sys.executable': sys.executable, 'site_dirs': get_user_site(), - 'env_vars': {ev: os.getenv(ev, os.getenv(ev.lower(), '<not set>')) for ev in evars}, + 'env_vars': env_vars, }) return info_dict
Sanitize env vars to remove secrets (e.g credentials for PROXY) For operations like `conda info -a` and error report uploads.
2018-01-25T17:57:44
conda/conda
6,795
conda__conda-6795
[ "5792" ]
33731c68637acb2b5cac46f122b50add46c10490
diff --git a/conda_env/pip_util.py b/conda_env/pip_util.py --- a/conda_env/pip_util.py +++ b/conda_env/pip_util.py @@ -87,7 +87,7 @@ def installed(prefix, output=True): # version. We still include the conda version, though, because it # is still installed. - version, path = kwargs['version'].split(', ') + version, path = kwargs['version'].split(', ', 1) # We do this because the code below uses rsplit('-', 2) version = version.replace('-', ' ') kwargs['version'] = version
conda env export error with setup.py develop packages conda 4.3.23, Anaconda 4.4.0 Environment export fails if there is a comma in the file path for the package. These paths are valid on Windows. See attached dump. [conda_export_error.txt](https://github.com/conda/conda/files/1208700/conda_export_error.txt) Fix is to change line 95 in ..\conda_env\pip_util.py to only split on the first comma: version, path = version.split(', ', 1)
``` |52> conda env export An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : win-64 conda version : 4.3.23 conda is private : False conda-env version : 4.3.23 conda-build version : not installed python version : 3.6.2.final.0 requests version : 2.14.2 root environment : C:\apps\anaconda3-440 (writable) default environment : C:\apps\anaconda3-440\envs\dlwin36 envs directories : C:\apps\anaconda3-440\envs C:\Users\knorthover\AppData\Local\conda\conda\envs C:\Users\knorthover\.conda\envs package cache : C:\apps\anaconda3-440\pkgs C:\Users\knorthover\AppData\Local\conda\conda\pkgs channel URLs : https://repo.continuum.io/pkgs/free/win-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/win-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/win-64 https://repo.continuum.io/pkgs/pro/noarch https://repo.continuum.io/pkgs/msys2/win-64 https://repo.continuum.io/pkgs/msys2/noarch config file : None netrc file : None offline mode : False user-agent : conda/4.3.23 requests/2.14.2 CPython/3.6.2 Windows/10 Windows/10.0.14393 administrator : False `$ C:\apps\anaconda3-440\Scripts\conda-env-script.py export` Traceback (most recent call last): File "C:\apps\anaconda3-440\lib\site-packages\conda\exceptions.py", line 634, in conda_exception_handler return_value = func(*args, **kwargs) File "C:\apps\anaconda3-440\lib\site-packages\conda_env\cli\main_export.py", line 90, in execute ignore_channels=args.ignore_channels) File "C:\apps\anaconda3-440\lib\site-packages\conda_env\env.py", line 46, in from_environment add_pip_installed(prefix, installed, json=True) File "C:\apps\anaconda3-440\lib\site-packages\conda_env\pip_util.py", line 114, in add_pip_installed for pip_pkg in installed(prefix, output=output): File "C:\apps\anaconda3-440\lib\site-packages\conda_env\pip_util.py", line 95, in installed version, path = version.split(', ') ValueError: too many values to unpack (expected 2) The version string being split was: 2.0.0, c:\users\knorthover\onedrive - kje northover, llc\projects\keraslib Commas are allowed in Windows filenames and in this case are automatically generated by the MS OneDrive setup. ```
2018-01-26T01:19:40
conda/conda
6,798
conda__conda-6798
[ "6531" ]
0ea03a77e4455e49507ef5495171d05115ad6876
diff --git a/conda/plan.py b/conda/plan.py --- a/conda/plan.py +++ b/conda/plan.py @@ -521,11 +521,13 @@ def install_actions(prefix, index, specs, force=False, only_names=None, always_c channels = IndexedSet(Channel(cn) for cn in channel_names) subdirs = IndexedSet(basename(url) for url in channel_priority_map) else: + # a hack for when conda-build calls this function without giving channel_priority_map if LAST_CHANNEL_URLS: channel_priority_map = prioritize_channels(LAST_CHANNEL_URLS) - channel_names = IndexedSet(Channel(url).canonical_name for url in channel_priority_map) - channels = IndexedSet(Channel(cn) for cn in channel_names) - subdirs = IndexedSet(basename(url) for url in channel_priority_map) + channels = IndexedSet(Channel(url) for url in channel_priority_map) + subdirs = IndexedSet( + subdir for subdir in (c.subdir for c in channels) if subdir + ) or context.subdirs else: channels = subdirs = None
Problem: when building a package the http auth credentials are lost in 4.4.2 This is most likely introduced by 4.4.2 - has not existed before! We are using channels that have http auth enabled. Our channel urls look like this: `https://user:[email protected]/path/to/channel/`. Conda in all versions works fine with this. After updating to conda 4.4.2, our conda-build calls fail with: ``` conda.exceptions.CondaHTTPError: HTTP 401 UNAUTHORIZED for url https://host.com/path/to/channel/ ``` Downgrading to 4.4.1 resolves the problem. We saw this error on all platforms (win/linux). There are two interesting observations: - conda still works with auth, just the conda-build process does not - the error message indicates, that the credentials get lost. When a _wrong_ password is specified, then the credentials are usually printed alongside: `conda.exceptions.CondaHTTPError: HTTP 401 UNAUTHORIZED for url https://user:[email protected]/path/to/channel/`. That leaves the impression that the auth info get lost/dropped somewhere @kalefranz @msarahan I'm not 100% sure whether this is a conda or conda-build bug - but i think its introduced by conda 4.4.2...
> Downgrading to 4.4.1 resolves the problem. Can you confirm that 4.4.1 indeed works for you, or is it the latest in 4.3, 4.3.31, that works? I explicitly tried well combinations with 4.4.2, 4.4.1 and 4.3.31 with CB 3.1.3 and 3.2.0. The result is that all 4.4.2 do work with the above problem, all the others work. The CB version has no influence on the result. correction: The result is that all 4.4.2 do **not** work with the above problem, all the others are fine. The CB version has no influence on the result... ... this problem still persists, the last working conda version was 4.4.1... Is there anything we could do to assist in solving this bug? Confirming this problem still exists on conda 4.4.7. @kalefranz any update on this? I have the same problem. I found out that the problem is in https://github.com/conda/conda/blob/7cb5f66dd46727ce8f16b969e084555e6221cfc5/conda/plan.py#L524-L528, which was introduced after 4.4.1. `Channel(url).canonical_name` (line 526) strips away the credentials, and a new channel is created using the stripped url (line 527). Btw., this is probably an issue in the code lines 519 to 523 as well. As far as I can see it, `Channel.canonical_name` needs to be updated to include credentials (after all, they appear to be part of the channel name as defined in condarc). Indeed, replacing https://github.com/conda/conda/blob/7cb5f66dd46727ce8f16b969e084555e6221cfc5/conda/models/channel.py#L160-L161 with ```python if self.scheme: if self.auth: return "%s://%s@%s" % (self.scheme, self.auth, join_url(self.location, self.name)) else: return "%s://%s" % (self.scheme, join_url(self.location, self.name)) ``` gets rid of the problem, at least in a quick test. I hope, this does not leak the credentials anywhere now.
2018-01-26T17:49:12
conda/conda
6,801
conda__conda-6801
[ "6632", "6632" ]
f28fc46de85ce6b11ffedfcdf245f1dd0ed61039
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 @@ -19,7 +19,7 @@ from ..gateways.disk.test import is_conda_environment from ..instructions import PREFIX from ..models.match_spec import MatchSpec -from ..plan import (add_unlink) +from ..plan import (add_unlink, display_actions) log = logging.getLogger(__name__) @@ -62,6 +62,7 @@ def execute(args, parser): action_groups = (actions, index), if not context.json: + display_actions(actions, index) confirm_yn() rm_rf(prefix) unregister_env(prefix)
Conda env remove doesn't list packages in that env With Conda 4.3: ``` (root) [root@2e532c56ecac ~]# conda list -n test # packages in environment at /opt/conda/envs/test: # ca-certificates 2017.08.26 h1d4fec5_0 libedit 3.1 heed3624_0 libffi 3.2.1 hd88cf55_4 libgcc-ng 7.2.0 h7cc24e2_2 libstdcxx-ng 7.2.0 h7a57d05_2 ncurses 6.0 h9df7e31_2 openssl 1.0.2n hb7f436b_0 python 3.6.4 hc3d631a_0 readline 7.0 ha6073c6_4 sqlite 3.20.1 hb898158_2 tk 8.6.7 hc745277_3 xz 5.2.3 h55aa19d_2 zlib 1.2.11 ha838bed_2 (root) [root@2e532c56ecac ~]# conda env remove -n test Package plan for package removal in environment /opt/conda/envs/test: The following packages will be REMOVED: ca-certificates: 2017.08.26-h1d4fec5_0 libedit: 3.1-heed3624_0 libffi: 3.2.1-hd88cf55_4 libgcc-ng: 7.2.0-h7cc24e2_2 libstdcxx-ng: 7.2.0-h7a57d05_2 ncurses: 6.0-h9df7e31_2 openssl: 1.0.2n-hb7f436b_0 python: 3.6.4-hc3d631a_0 readline: 7.0-ha6073c6_4 sqlite: 3.20.1-hb898158_2 tk: 8.6.7-hc745277_3 xz: 5.2.3-h55aa19d_2 zlib: 1.2.11-ha838bed_2 Proceed ([y]/n)? ``` With Conda 4.4: ``` (base) [root@ead34697ba5f ~]# conda list -n test # packages in environment at /opt/conda/envs/test: # ca-certificates 2017.08.26 h1d4fec5_0 libedit 3.1 heed3624_0 libffi 3.2.1 hd88cf55_4 libgcc-ng 7.2.0 h7cc24e2_2 libstdcxx-ng 7.2.0 h7a57d05_2 ncurses 6.0 h9df7e31_2 openssl 1.0.2n hb7f436b_0 python 3.6.4 hc3d631a_0 readline 7.0 ha6073c6_4 sqlite 3.20.1 hb898158_2 tk 8.6.7 hc745277_3 xz 5.2.3 h55aa19d_2 zlib 1.2.11 ha838bed_2 (base) [root@ead34697ba5f ~]# conda env remove -n test Remove all packages in environment /opt/conda/envs/test: Proceed ([y]/n)? ``` Conda env remove doesn't list packages in that env With Conda 4.3: ``` (root) [root@2e532c56ecac ~]# conda list -n test # packages in environment at /opt/conda/envs/test: # ca-certificates 2017.08.26 h1d4fec5_0 libedit 3.1 heed3624_0 libffi 3.2.1 hd88cf55_4 libgcc-ng 7.2.0 h7cc24e2_2 libstdcxx-ng 7.2.0 h7a57d05_2 ncurses 6.0 h9df7e31_2 openssl 1.0.2n hb7f436b_0 python 3.6.4 hc3d631a_0 readline 7.0 ha6073c6_4 sqlite 3.20.1 hb898158_2 tk 8.6.7 hc745277_3 xz 5.2.3 h55aa19d_2 zlib 1.2.11 ha838bed_2 (root) [root@2e532c56ecac ~]# conda env remove -n test Package plan for package removal in environment /opt/conda/envs/test: The following packages will be REMOVED: ca-certificates: 2017.08.26-h1d4fec5_0 libedit: 3.1-heed3624_0 libffi: 3.2.1-hd88cf55_4 libgcc-ng: 7.2.0-h7cc24e2_2 libstdcxx-ng: 7.2.0-h7a57d05_2 ncurses: 6.0-h9df7e31_2 openssl: 1.0.2n-hb7f436b_0 python: 3.6.4-hc3d631a_0 readline: 7.0-ha6073c6_4 sqlite: 3.20.1-hb898158_2 tk: 8.6.7-hc745277_3 xz: 5.2.3-h55aa19d_2 zlib: 1.2.11-ha838bed_2 Proceed ([y]/n)? ``` With Conda 4.4: ``` (base) [root@ead34697ba5f ~]# conda list -n test # packages in environment at /opt/conda/envs/test: # ca-certificates 2017.08.26 h1d4fec5_0 libedit 3.1 heed3624_0 libffi 3.2.1 hd88cf55_4 libgcc-ng 7.2.0 h7cc24e2_2 libstdcxx-ng 7.2.0 h7a57d05_2 ncurses 6.0 h9df7e31_2 openssl 1.0.2n hb7f436b_0 python 3.6.4 hc3d631a_0 readline 7.0 ha6073c6_4 sqlite 3.20.1 hb898158_2 tk 8.6.7 hc745277_3 xz 5.2.3 h55aa19d_2 zlib 1.2.11 ha838bed_2 (base) [root@ead34697ba5f ~]# conda env remove -n test Remove all packages in environment /opt/conda/envs/test: Proceed ([y]/n)? ```
2018-01-27T17:17:45
conda/conda
6,828
conda__conda-6828
[ "6796" ]
158599161fcfcce024bf8257c7278a10fb3085e2
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -361,11 +361,16 @@ def build_reactivate(self): 'activate_scripts': (), } conda_default_env = self.environ.get('CONDA_DEFAULT_ENV', self._default_env(conda_prefix)) + new_path = self.pathsep_join(self._replace_prefix_in_path(conda_prefix, conda_prefix)) + set_vars = {} + conda_prompt_modifier = self._prompt_modifier(conda_default_env) + self._update_prompt(set_vars, conda_prompt_modifier) # environment variables are set only to aid transition from conda 4.3 to conda 4.4 return { 'unset_vars': (), - 'set_vars': {}, + 'set_vars': set_vars, 'export_vars': { + 'PATH': new_path, 'CONDA_SHLVL': conda_shlvl, 'CONDA_PROMPT_MODIFIER': self._prompt_modifier(conda_default_env), },
diff --git a/tests/test_activate.py b/tests/test_activate.py --- a/tests/test_activate.py +++ b/tests/test_activate.py @@ -295,14 +295,23 @@ def test_activate_same_environment(self): with env_var('CONDA_SHLVL', '1'): with env_var('CONDA_PREFIX', old_prefix): activator = Activator('posix') + builder = activator.build_activate(td) + new_path_parts = activator._replace_prefix_in_path(old_prefix, old_prefix) + conda_prompt_modifier = "(%s) " % old_prefix + ps1 = conda_prompt_modifier + os.environ.get('PS1', '') + + set_vars = { + 'PS1': ps1, + } export_vars = { + 'PATH': activator.pathsep_join(new_path_parts), 'CONDA_PROMPT_MODIFIER': "(%s) " % td, 'CONDA_SHLVL': 1, } assert builder['unset_vars'] == () - assert builder['set_vars'] == {} + assert builder['set_vars'] == set_vars assert builder['export_vars'] == export_vars assert builder['activate_scripts'] == (activator.path_conversion(activate_d_1),) assert builder['deactivate_scripts'] == (activator.path_conversion(deactivate_d_1),) @@ -478,15 +487,20 @@ def test_posix_basic(self): assert rc == 0 reactivate_data = c.stdout + new_path_parts = activator._replace_prefix_in_path(self.prefix, self.prefix) assert reactivate_data == dals(""" . "%(deactivate1)s" + PS1='%(ps1)s' export CONDA_PROMPT_MODIFIER='(%(native_prefix)s) ' export CONDA_SHLVL='1' + export PATH='%(new_path)s' . "%(activate1)s" """) % { 'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.sh')), 'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.sh')), 'native_prefix': self.prefix, + 'new_path': activator.pathsep_join(new_path_parts), + 'ps1': '(%s) ' % self.prefix + os.environ.get('PS1', ''), } with captured() as c: @@ -560,15 +574,18 @@ def test_cmd_exe_basic(self): reactivate_data = fh.read() rm_rf(reactivate_result) + new_path_parts = activator._replace_prefix_in_path(self.prefix, self.prefix) assert reactivate_data == dals(""" @CALL "%(deactivate1)s" @SET "CONDA_PROMPT_MODIFIER=(%(native_prefix)s) " @SET "CONDA_SHLVL=1" + @SET "PATH=%(new_path)s" @CALL "%(activate1)s" """) % { 'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.bat')), 'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.bat')), 'native_prefix': self.prefix, + 'new_path': activator.pathsep_join(new_path_parts), } with captured() as c: @@ -635,12 +652,17 @@ def test_csh_basic(self): assert rc == 0 reactivate_data = c.stdout + new_path_parts = activator._replace_prefix_in_path(self.prefix, self.prefix) assert reactivate_data == dals(""" source "%(deactivate1)s"; + set prompt='%(prompt)s'; setenv CONDA_PROMPT_MODIFIER "(%(native_prefix)s) "; setenv CONDA_SHLVL "1"; + setenv PATH "%(new_path)s"; source "%(activate1)s"; """) % { + 'prompt': '(%s) ' % self.prefix + os.environ.get('prompt', ''), + 'new_path': activator.pathsep_join(new_path_parts), 'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.csh')), 'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.csh')), 'native_prefix': self.prefix, @@ -714,15 +736,18 @@ def test_xonsh_basic(self): reactivate_data = fh.read() rm_rf(reactivate_result) + new_path_parts = activator._replace_prefix_in_path(self.prefix, self.prefix) assert reactivate_data == dals(""" source "%(deactivate1)s" $CONDA_PROMPT_MODIFIER = '(%(native_prefix)s) ' $CONDA_SHLVL = '1' + $PATH = '%(new_path)s' source "%(activate1)s" """) % { 'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.xsh')), 'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.xsh')), 'native_prefix': self.prefix, + 'new_path': activator.pathsep_join(new_path_parts), } with captured() as c: @@ -787,12 +812,15 @@ def test_fish_basic(self): assert rc == 0 reactivate_data = c.stdout + new_path_parts = activator._replace_prefix_in_path(self.prefix, self.prefix) assert reactivate_data == dals(""" source "%(deactivate1)s"; set -gx CONDA_PROMPT_MODIFIER "(%(native_prefix)s) "; set -gx CONDA_SHLVL "1"; + set -gx PATH "%(new_path)s"; source "%(activate1)s"; """) % { + 'new_path': activator.pathsep_join(new_path_parts), 'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.fish')), 'deactivate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.fish')), 'native_prefix': self.prefix, @@ -857,15 +885,18 @@ def test_powershell_basic(self): assert rc == 0 reactivate_data = c.stdout + new_path_parts = activator._replace_prefix_in_path(self.prefix, self.prefix) assert reactivate_data == dals(""" . "%(deactivate1)s" $env:CONDA_PROMPT_MODIFIER = "(%(prefix)s) " $env:CONDA_SHLVL = "1" + $env:PATH = "%(new_path)s" . "%(activate1)s" """) % { 'activate1': join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.ps1'), 'deactivate1': join(self.prefix, 'etc', 'conda', 'deactivate.d', 'deactivate1.ps1'), 'prefix': self.prefix, + 'new_path': activator.pathsep_join(new_path_parts), } with captured() as c:
Base environment PATH is not set when transitioning to tmux <!-- 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. --> After a clean installation of anaconda and an update to conda 4.4.7 everything seemed to be working nicely. On restarting, I have found that the base environment is not activated correctly. The PATH is not being set, so only the system python installation is on the path. Activating any other environment sets the PATH correctly, but the base environment does not. I'm running Ubuntu 16.04. ### 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. --> ``` conda activate base which python > /usr/bin/python conda activate other-environment which python > /home/me/anaconda3/envs/other-environment/bin/python ``` ## Expected Behavior <!-- What do you think should happen? --> ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> 'conda info': ``` active environment : service.thickener.pde active env location : /home/me/anaconda3/envs/service.thickener.pde shell level : 2 user config file : /home/me/.condarc populated config files : conda version : 4.4.7 conda-build version : 3.0.27 python version : 3.6.2.final.0 base environment : /home/me/anaconda3 (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 : /home/me/anaconda3/pkgs /home/me/.conda/pkgs envs directories : /home/me/anaconda3/envs /home/me/.conda/envs platform : linux-64 user-agent : conda/4.4.7 requests/2.18.4 CPython/3.6.2 Linux/4.4.0-112-generic ubuntu/16.04 glibc/2.23 UID:GID : 1001:1001 netrc file : None offline mode : False ``` </p></details>
For now I've just cloned the base environment and put an `activate` command in my shell rc file What shell are you using, and what version is it? Can you give me the output of `echo $PATH` after `conda activate base` and `conda activate other-environment`? zsh 5.1.1 I have just noticed that the issue only shows up within tmux — a "bare" terminal works ok but in tmux the base environment (only) doesn't activate properly. this is `PATH` after `conda activate base` in tmux: ``` /home/me/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/me/.config/nvim/dein/repos/github.com/junegunn/fzf/bin:/home/me/texlive/2016/bin/x86_64-linux:/home/me/work/tools/bin:/usr/local/cuda/bin:/home/me/.hugh/vimfiles/dein/repos/github.com/junegunn/fzf/bin ``` and after `conda activate other-environment`: ``` /home/me/anaconda3/envs/other-environment/bin:/home/me/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/me/.config/nvim/dein/repos/github.com/junegunn/fzf/bin:/home/me/texlive/2016/bin/x86_64-linux:/home/me/work/tools/bin:/usr/local/cuda/bin:/home/me/.hugh/vimfiles/dein/repos/github.com/junegunn/fzf/bin ``` and after `conda activate base` outside tmux (which works as it should): ``` /home/me/anaconda3/bin:/home/me/anaconda3/envs/hugh/bin:/home/me/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/me/.config/nvim/dein/repos/github.com/junegunn/fzf/bin:/home/me/texlive/2016/bin/x86_64-linux:/home/me/work/tools/bin:/usr/local/cuda/bin:/home/me/.hugh/vimfiles/dein/repos/github.com/junegunn/fzf/bin ``` As part of `conda activate`, `source activate`, etc, we need to run `rehash` or `hash -r` to reset the shell's cache for stuff found on PATH. Is that perhaps what's not working correctly in tmux for some reason? Scratch that. PATH is clearly not correct in your example above for tmux. Can you do the following and see what we get... 1. open clean, new shell under tmux 2. `echo $PATH` 3. `type -a conda` 4. `conda shell.posix activate base` # won't actually activate; just show you what should be eval'd by the shell 5. `set -x` 6. `conda activate base` This is from a new shell, with `base` activated `echo $PATH`: ``` /home/me/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/me/.config/nvim/dein/repos/github.com/junegunn/fzf/bin:/home/me/texlive/2016/bin/x86_64-linux:/home/me/work/tools/bin:/usr/local/cuda/bin:/home/me/.hugh/vimfiles/dein/repos/github.com/junegunn/fzf/bin ``` `type -a conda`: ``` conda is a shell function from /home/me/anaconda3/etc/profile.d/conda.sh ``` `conda shell.posix activate base`: ``` export CONDA_PROMPT_MODIFIER='(base) ' export CONDA_SHLVL='1' ``` `set -x` ``` +omz_termsupport_preexec:1> emulate -L zsh +omz_termsupport_preexec:2> setopt extended_glob +omz_termsupport_preexec:4> [[ '' == true ]] +omz_termsupport_preexec:9> local CMD=set +omz_termsupport_preexec:10> local LINE='set -x' +omz_termsupport_preexec:12> title '$CMD' '%100>...>$LINE%<<' +title:1> emulate -L zsh +title:2> setopt prompt_subst +title:4> [[ '' == *term* ]] +title:8> : '%100>...>$LINE%<<' +title:10> case screen-256color (cygwin | xterm* | putty* | rxvt* | ansi) +title:10> case screen-256color (screen*) +title:16> print -Pn '\ek\$CMD\e\' +prompt_geometry_set_cmd_title:1> prompt_geometry_print_title 'set -x @ %m' +prompt_geometry_print_title:1> print -n '\e]0;' +-zsh:15> set -x +omz_termsupport_precmd:1> emulate -L zsh +omz_termsupport_precmd:3> [[ '' == true ]] +omz_termsupport_precmd:7> title '%15<..<%~%<<' '%n@%m: %~' +title:1> emulate -L zsh +title:2> setopt prompt_subst +title:4> [[ '' == *term* ]] +title:8> : '%n@%m: %~' +title:10> case screen-256color (cygwin | xterm* | putty* | rxvt* | ansi) +title:10> case screen-256color (screen*) +title:16> print -Pn '\ek%15\<..\<%~%\<\<\e\' +prompt_geometry_set_title:1> prompt_geometry_print_title '%~' +prompt_geometry_print_title:1> print -n '\e]0;' +prompt_geometry_render:1> [ 0 -eq 0 ']' +prompt_geometry_render:2> PROMPT_SYMBOL=▲ +prompt_geometry_render:7> PROMPT=' %F{blue}%3~%f %1{%(?.%F{white}▲%f.%F{magenta}△%f)%} ' +prompt_geometry_render:11> PROMPT2=' ◇ ' +prompt_geometry_render:12> RPROMPT=+prompt_geometry_render:12> echotc UP 1 +prompt_geometry_render:12> RPROMPT=+prompt_geometry_render:12> prompt_hugh_conda_env_info +prompt_hugh_conda_env_info:1> env_name=base +prompt_hugh_conda_env_info:2> [ base '!=' root ']' +prompt_hugh_conda_env_info:2> [ base '!=' '' ']' +prompt_hugh_conda_env_info:3> git rev-parse --git-dir +prompt_hugh_conda_env_info:6> prompt_geometry_colorize 242 base +prompt_geometry_colorize:1> echo '%F{242}base%f' +prompt_hugh_conda_env_info:6> echo '%F{242}base%f' +prompt_geometry_render:12> RPROMPT=+prompt_geometry_render:12> prompt_geometry_git_info +prompt_geometry_git_info:1> git rev-parse --git-dir +prompt_geometry_render:12> RPROMPT=+pr%}%F{242}base%f%f%{r:12> echotc DO 1 +prompt_geometry_render:12> RPROMPT='%{ %}' ``` `conda activate base`: ``` +omz_termsupport_preexec:1> emulate -L zsh +omz_termsupport_preexec:2> setopt extended_glob +omz_termsupport_preexec:4> [[ '' == true ]] +omz_termsupport_preexec:9> local CMD=conda +omz_termsupport_preexec:10> local LINE='conda activate base' +omz_termsupport_preexec:12> title '$CMD' '%100>...>$LINE%<<' +title:1> emulate -L zsh +title:2> setopt prompt_subst +title:4> [[ '' == *term* ]] +title:8> : '%100>...>$LINE%<<' +title:10> case screen-256color (cygwin | xterm* | putty* | rxvt* | ansi) +title:10> case screen-256color (screen*) +title:16> print -Pn '\ek\$CMD\e\' +prompt_geometry_set_cmd_title:1> prompt_geometry_print_title 'conda activate base @ %m' +prompt_geometry_print_title:1> print -n '\e]0;' +-zsh:16> conda activate base +conda:1> [ 2 -ge 1 ']' +conda:2> local cmd=activate +conda:3> shift +conda:7> case activate (activate) +conda:9> _conda_activate base +_conda_activate:1> [ -n '' ']' +_conda_activate:8> local ask_conda +_conda_activate:9> ask_conda=+_conda_activate:9> PS1=' %F{blue}%3~%f %1{%(?.%F{white}▲%f.%F{magenta}△%f)%} ' /home/me/anaconda3/bin/conda shell.posix activate base +_conda_activate:9> ask_conda='export CONDA_PROMPT_MODIFIER='\''(base) '\'' export CONDA_SHLVL='\''1'\' +_conda_activate:10> eval 'export CONDA_PROMPT_MODIFIER='\''(base) '\'' export CONDA_SHLVL='\''1'\' +(eval):1> export CONDA_PROMPT_MODIFIER='(base) ' +(eval):2> export CONDA_SHLVL=1 +_conda_activate:12> _conda_hashr +_conda_hashr:1> case zsh (zsh) +_conda_hashr:2> rehash +omz_termsupport_precmd:1> emulate -L zsh +omz_termsupport_precmd:3> [[ '' == true ]] +omz_termsupport_precmd:7> title '%15<..<%~%<<' '%n@%m: %~' +title:1> emulate -L zsh +title:2> setopt prompt_subst +title:4> [[ '' == *term* ]] +title:8> : '%n@%m: %~' +title:10> case screen-256color (cygwin | xterm* | putty* | rxvt* | ansi) +title:10> case screen-256color (screen*) +title:16> print -Pn '\ek%15\<..\<%~%\<\<\e\' +prompt_geometry_set_title:1> prompt_geometry_print_title '%~' +prompt_geometry_print_title:1> print -n '\e]0;' +prompt_geometry_render:1> [ 0 -eq 0 ']' +prompt_geometry_render:2> PROMPT_SYMBOL=▲ +prompt_geometry_render:7> PROMPT=' %F{blue}%3~%f %1{%(?.%F{white}▲%f.%F{magenta}△%f)%} ' +prompt_geometry_render:11> PROMPT2=' ◇ ' +prompt_geometry_render:12> RPROMPT=+prompt_geometry_render:12> echotc UP 1 +prompt_geometry_render:12> RPROMPT=+prompt_geometry_render:12> prompt_hugh_conda_env_info +prompt_hugh_conda_env_info:1> env_name=base +prompt_hugh_conda_env_info:2> [ base '!=' root ']' +prompt_hugh_conda_env_info:2> [ base '!=' '' ']' +prompt_hugh_conda_env_info:3> git rev-parse --git-dir +prompt_hugh_conda_env_info:6> prompt_geometry_colorize 242 base +prompt_geometry_colorize:1> echo '%F{242}base%f' +prompt_hugh_conda_env_info:6> echo '%F{242}base%f' +prompt_geometry_render:12> RPROMPT=+prompt_geometry_render:12> prompt_geometry_git_info +prompt_geometry_git_info:1> git rev-parse --git-dir +prompt_geometry_render:12> RPROMPT=+pr%}%F{242}base%f%f%{r:12> echotc DO 1 +prompt_geometry_render:12> RPROMPT='%{ %}' ``` there's lots of zsh prompt stuff in there, but it just looks like there's no path setting command at all for some reason... Also, and this is a bit odd, tmux seems to activate the base environment even though I removed the `conda activate base` command from my zshrc A bare shell doesn't activate anything, but as soon as I load tmux I get the `base` prompt showing up That last comment seems to be part of the problem: if I load tmux, and _deactivate_ the `base` environment (so there's no environment active), then `conda shell.posix activate base` looks good, and `conda activate base` alters the path as expected So for some reason tmux is improperly activating the base environment when it starts Ok problem starts with `conda shell.posix activate base`: ``` export CONDA_PROMPT_MODIFIER='(base) ' export CONDA_SHLVL='1' ``` So, one more request for information... 1. open clean, new shell under tmux 2. `env | sort` 3. `conda shell.posix activate base` As I said, this is starting tmux without any `conda activate` anything in my zshrc. `env | sort`: ```BROWSER=google-chrome CLUTTER_IM_MODULE=xim CONDA_DEFAULT_ENV=base CONDA_PREFIX=/home/me/anaconda3 CONDA_PROMPT_MODIFIER=(base) CONDA_PYTHON_EXE=/home/me/anaconda3/bin/python CONDA_SHLVL=1 CPATH=/home/me/cuda/include:/home/me/cuda/include: DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-hxf9qZRlyl DEFAULTS_PATH=/usr/share/gconf/gnome.default.path DESKTOP_MODE=1 DESKTOP_SESSION=gnome DISPLAY=:0 EDITOR=nvim EVENT_NOEPOLL=1 FZF_ALT_C_COMMAND=find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune -o -type d -name -print 2> /dev/null | sed 1d | cut -b3- FZF_CTRL_T_COMMAND=find -L . \( -fstype 'dev' -o -fstype 'proc' \) -prune -o -type f -print -o -type d -print -o -type l -print 2> /dev/null | sed 1d | cut -b3- FZF_DEFAULT_COMMAND=ag -l --hidden -g "" GDM_LANG=en_GB GDMSESSION=gnome GNOME_DESKTOP_SESSION_ID=this-is-deprecated GNOME_KEYRING_CONTROL= GNOME_KEYRING_PID= GPG_AGENT_INFO=/home/me/.gnupg/S.gpg-agent:0:1 GTK2_MODULES=overlay-scrollbar GTK_IM_MODULE=ibus GTK_MODULES=gail:atk-bridge HOME=/home/me IM_CONFIG_PHASE=1 INSTANCE=GNOME JOB=gnome-session KEYTIMEOUT=1 LANG=en_GB.UTF-8 LANGUAGE=en_GB:en LC_CTYPE=en_GB.UTF-8 LD_LIBRARY_PATH=/usr/local/cuda/lib64:/home/me/cuda/lib64:/usr/local/cuda/lib64:/home/me/cuda/lib64: LESS=-R LIBRARY_PATH=/usr/local/cuda/lib64:/home/me/cuda/lib64:/usr/local/cuda/lib64:/home/me/cuda/lib64: LIBVIRT_DEFAULT_URI=qemu:///system LOGNAME=me LSCOLORS=Gxfxcxdxbxegedabagacad LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path MYZSH=/home/me/.hugh/general NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript OLDPWD=/home/me PAGER=less PAM_KWALLET5_LOGIN=/tmp/kwallet5_me.socket PATH=/home/me/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/me/.config/nvim/dein/repos/github.com/junegunn/fzf/bin:/home/me/texlive/2016/bin/x86_64-linux:/home/me/work/tools/bin:/usr/local/cuda/bin:/home/me/.hugh/vimfiles/dein/repos/github.com/junegunn/fzf/bin PWD=/home/me QT4_IM_MODULE=xim QT_ACCESSIBILITY=1 QT_IM_MODULE=ibus QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1 QT_QPA_PLATFORMTHEME=appmenu-qt5 SESSIONTYPE=gnome-session SHELL=/usr/bin/zsh SHLVL=2 SSH_AUTH_SOCK=/run/user/1001/keyring/ssh TERM=screen-256color TMUX_PANE=%30 TMUX=/tmp/tmux-1001/default,16045,7 UPDATE_ZSH_DAYS=7 UPSTART_EVENTS=started starting UPSTART_INSTANCE= UPSTART_JOB=gnome-settings-daemon UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1001/2610 USER=me _=/usr/bin/env VTE_VERSION=4205 WINDOWID=67170133 XAUTHORITY=/home/me/.Xauthority XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/usr/share/upstart/xdg:/etc/xdg XDG_CURRENT_DESKTOP=GNOME XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/var/lib/snapd/desktop XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/me XDG_RUNTIME_DIR=/run/user/1001 XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 XDG_SEAT=seat0 XDG_SESSION_DESKTOP=gnome XDG_SESSION_ID=c2 XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0 XDG_SESSION_TYPE=x11 XDG_VTNR=7 XMODIFIERS=@im=ibus ZSH=/home/me/.oh-my-zsh ``` `conda shell.posix activate base`: ``` export CONDA_PROMPT_MODIFIER='(base) ' export CONDA_SHLVL='1' ``` Ok so the `CONDA_` environment variables you have there... all of those are indicating that you have your base env activated. Which is the case before you start tmux. After you start tmux, you’re carrying over some of those environment variables, but also doing something to PATH. Probably resetting it to a hardcoded value that doesn’t respect previous state. I thought that, so I tried starting tmux without any env activated and it stayed the same... Haha well those `CONDA_` environment variables aren’t going to set themselves ¯\\\_(ツ)\_/¯ Ok, so that last comment was because I had a tmux session left running. I stopped every tmux session, started a fresh shell with base env active, and now when I run tmux I get the problem. It seems that tmux holds the environment variables over, so the new shell isn't "bare" when `conda activate base` is encountered in .zshrc `env | sort`: ``` BROWSER=google-chrome CLUTTER_IM_MODULE=xim CONDA_DEFAULT_ENV=base CONDA_PREFIX=/home/me/anaconda3 CONDA_PROMPT_MODIFIER=(base) CONDA_PYTHON_EXE=/home/me/anaconda3/bin/python CONDA_SHLVL=1 CPATH=/home/me/cuda/include:/home/me/cuda/include: DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-zGJ7TsNLxt DEFAULTS_PATH=/usr/share/gconf/gnome.default.path DESKTOP_MODE=1 DESKTOP_SESSION=gnome DISPLAY=:0 EDITOR=nvim EVENT_NOEPOLL=1 FZF_ALT_C_COMMAND=find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune -o -type d -name -print 2> /dev/null | sed 1d | cut -b3- FZF_CTRL_T_COMMAND=find -L . \( -fstype 'dev' -o -fstype 'proc' \) -prune -o -type f -print -o -type d -print -o -type l -print 2> /dev/null | sed 1d | cut -b3- FZF_DEFAULT_COMMAND=ag -l --hidden -g "" GDM_LANG=en_GB GDMSESSION=gnome GNOME_DESKTOP_SESSION_ID=this-is-deprecated GNOME_KEYRING_CONTROL= GNOME_KEYRING_PID= GPG_AGENT_INFO=/home/me/.gnupg/S.gpg-agent:0:1 GTK2_MODULES=overlay-scrollbar GTK_IM_MODULE=ibus GTK_MODULES=gail:atk-bridge HOME=/home/me IM_CONFIG_PHASE=1 INSTANCE=GNOME JOB=gnome-session KEYTIMEOUT=1 LANG=en_GB.UTF-8 LANGUAGE=en_GB:en LC_CTYPE=en_GB.UTF-8 LD_LIBRARY_PATH=/usr/local/cuda/lib64:/home/me/cuda/lib64:/usr/local/cuda/lib64:/home/me/cuda/lib64: LESS=-R LIBRARY_PATH=/usr/local/cuda/lib64:/home/me/cuda/lib64:/usr/local/cuda/lib64:/home/me/cuda/lib64: LIBVIRT_DEFAULT_URI=qemu:///system LOGNAME=me LSCOLORS=Gxfxcxdxbxegedabagacad LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path MYZSH=/home/me/.hugh/general NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript OLDPWD=/home/me PAGER=less PAM_KWALLET5_LOGIN=/tmp/kwallet5_me.socket PATH=/home/me/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/me/.config/nvim/dein/repos/github.com/junegunn/fzf/bin:/home/me/texlive/2016/bin/x86_64-linux:/home/me/work/tools/bin:/usr/local/cuda/bin:/home/me/.hugh/vimfiles/dein/repos/github.com/junegunn/fzf/bin PWD=/home/me QT4_IM_MODULE=xim QT_ACCESSIBILITY=1 QT_IM_MODULE=ibus QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1 QT_QPA_PLATFORMTHEME=appmenu-qt5 SESSIONTYPE=gnome-session SHELL=/usr/bin/zsh SHLVL=2 SSH_AUTH_SOCK=/run/user/1001/keyring/ssh TERM=screen-256color TMUX_PANE=%13 TMUX=/tmp/tmux-1001/default,5914,1 UPDATE_ZSH_DAYS=7 UPSTART_EVENTS=started starting UPSTART_INSTANCE= UPSTART_JOB=gnome-settings-daemon UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1001/2794 USER=me _=/usr/bin/env VTE_VERSION=4205 WINDOWID=54531185 XAUTHORITY=/home/me/.Xauthority XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/usr/share/upstart/xdg:/etc/xdg XDG_CURRENT_DESKTOP=GNOME XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/var/lib/snapd/desktop XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/me XDG_RUNTIME_DIR=/run/user/1001 XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 XDG_SEAT=seat0 XDG_SESSION_DESKTOP=gnome XDG_SESSION_ID=c2 XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0 XDG_SESSION_TYPE=x11 XDG_VTNR=7 XMODIFIERS=@im=ibus ZSH=/home/me/.oh-my-zsh ``` `conda shell.posix activate base`: ``` export CONDA_PROMPT_MODIFIER='(base) ' export CONDA_SHLVL='1' ``` For now I've added a check in `.zshrc`, if it detects that the shell is running in tmux then it does a `conda deactivate` before the `conda activate base` line. That works fine, I'm happy enough with the results
2018-02-01T22:51:36
conda/conda
6,847
conda__conda-6847
[ "6401" ]
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:23
conda/conda
6,849
conda__conda-6849
[ "6824", "6824" ]
2af7d601371c5e0398f869271c0b8e27ab3058b4
diff --git a/conda_env/cli/main_update.py b/conda_env/cli/main_update.py --- a/conda_env/cli/main_update.py +++ b/conda_env/cli/main_update.py @@ -101,11 +101,15 @@ def execute(args, parser): # common.ensure_override_channels_requires_channel(args) # channel_urls = args.channel or () - for installer_type, specs in env.dependencies.items(): + # create installers before running any of them + # to avoid failure to import after the file being deleted + # e.g. due to conda_env being upgraded or Python version switched. + installers = {} + + for installer_type in env.dependencies: try: - installer = get_installer(installer_type) - installer.install(prefix, specs, args, env) - except InvalidInstaller: + installers[installer_type] = get_installer(installer_type) + except InvalidInstaller as e: sys.stderr.write(textwrap.dedent(""" Unable to install package for {0}. @@ -117,5 +121,9 @@ def execute(args, parser): ) return -1 + for installer_type, specs in env.dependencies.items(): + installer = installers[installer_type] + installer.install(prefix, specs, args, env) + touch_nonadmin(prefix) cli_install.print_activate(args.name if args.name else prefix)
conda env update fails with pip dependencies if Python version changes **I'm submitting a...** - [x] bug report - [ ] feature request **update:** only the root env appears to be affected ## Current Behavior `conda env update -f environment.yml` fails if both of these conditions are met: 1. The Python version changes 2. There is at least one dependency to be installed with pip The error looks like: ``` Unable to install package for pip. Please double check and ensure you dependencies file has the correct spelling. You might also try installing the conda-env-pip package to see if provides the required installer. ``` This is the same error but not the same bug as #4985. pip is installed and specified as a dependency, but switching Python version in the same transaction results in conda failing to find pip. ### Steps to Reproduce Create an environment.yml that contains Python and at least one pip dependency (doesn't matter if it's already installed or not): ```yaml # environment.yml dependencies: - python=3.5 - pip - pip: - wheel ``` Setup a root env with a *different* Python: ``` conda install python=3.6 pip ``` and then try to update it with the environment file ``` conda env update -n root -f environment.yml ``` ## Expected Behavior `conda env update` should succeed. <!-- What do you think should happen? --> ## Environment Information Run in docker with [these files](https://gist.github.com/7d234cbcf69df2c7cd68523c9327db71). <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 : /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.9.75-linuxkit-aufs debian/8 glibc/2.19 UID:GID : 0:0 netrc file : None offline mode : False ``` </p></details> conda env update fails with pip dependencies if Python version changes **I'm submitting a...** - [x] bug report - [ ] feature request **update:** only the root env appears to be affected ## Current Behavior `conda env update -f environment.yml` fails if both of these conditions are met: 1. The Python version changes 2. There is at least one dependency to be installed with pip The error looks like: ``` Unable to install package for pip. Please double check and ensure you dependencies file has the correct spelling. You might also try installing the conda-env-pip package to see if provides the required installer. ``` This is the same error but not the same bug as #4985. pip is installed and specified as a dependency, but switching Python version in the same transaction results in conda failing to find pip. ### Steps to Reproduce Create an environment.yml that contains Python and at least one pip dependency (doesn't matter if it's already installed or not): ```yaml # environment.yml dependencies: - python=3.5 - pip - pip: - wheel ``` Setup a root env with a *different* Python: ``` conda install python=3.6 pip ``` and then try to update it with the environment file ``` conda env update -n root -f environment.yml ``` ## Expected Behavior `conda env update` should succeed. <!-- What do you think should happen? --> ## Environment Information Run in docker with [these files](https://gist.github.com/7d234cbcf69df2c7cd68523c9327db71). <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 : /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.9.75-linuxkit-aufs debian/8 glibc/2.19 UID:GID : 0:0 netrc file : None offline mode : False ``` </p></details>
Inspecting the code a bit, I assume that the issue is that the imported `conda_env` has been deleted and the `get_installer` call imports `conda_env.installers.pip` *after* the conda installer has removed the files (by switching from 3.5/site-packages to 3.6/site-packages). I *think* if the installer were imported before applying the transaction, it would be okay. Unfortunately, this is very difficult to test because it only affects the root environment, and cannot affect dev-installs (since imported conda_env is not removed during the upgrade in those cases). Inspecting the code a bit, I assume that the issue is that the imported `conda_env` has been deleted and the `get_installer` call imports `conda_env.installers.pip` *after* the conda installer has removed the files (by switching from 3.5/site-packages to 3.6/site-packages). I *think* if the installer were imported before applying the transaction, it would be okay. Unfortunately, this is very difficult to test because it only affects the root environment, and cannot affect dev-installs (since imported conda_env is not removed during the upgrade in those cases).
2018-02-06T18:01:51
conda/conda
6,853
conda__conda-6853
[ "6833" ]
01cec212c8ec28274cf464c61380e72bc70dc3d0
diff --git a/conda/resolve.py b/conda/resolve.py --- a/conda/resolve.py +++ b/conda/resolve.py @@ -566,13 +566,21 @@ def get_dists_for_spec(self, ms, emptyok=False): return sorted(dists, key=self.version_key) @staticmethod - def ms_to_v(ms): + def to_ms_clause_id(ms): ms = MatchSpec(ms) return '@s@' + ms.spec + ('?' if ms.optional else '') + @staticmethod + def to_notd_ms_clause_id(ms): + return '!@s@'+ms.name + + @staticmethod + def to_feature_metric_id(dist, feat): + return '@fm@%s@%s' % (dist, feat) + def push_MatchSpec(self, C, ms): ms = MatchSpec(ms) - name = self.ms_to_v(ms) + name = self.to_ms_clause_id(ms) m = C.from_name(name) if m is not None: return name @@ -588,7 +596,7 @@ def push_MatchSpec(self, C, ms): if m is None: libs = [dist.full_name for dist in libs] if ms.optional: - libs.append('!@s@'+ms.name) + libs.append(self.to_notd_ms_clause_id(ms)) m = C.Any(libs) C.name_var(m, name) return name @@ -601,7 +609,7 @@ def gen_clauses(self): for fkey in group: C.new_var(fkey) # Create one variable for the group - m = C.new_var(self.ms_to_v(name)) + m = C.new_var(self.to_ms_clause_id(name)) # Exactly one of the package variables, OR # the negation of the group variable, is true C.Require(C.ExactlyOne, group + [C.Not(m)]) @@ -624,20 +632,22 @@ def generate_update_count(self, C, specs): def generate_feature_metric(self, C): eq = {} # a C.minimize() objective: Dict[varname, coeff] - total = 0 + # Given a pair (dist, feature), assign a "1" score IF: + # - The dist is installed + # - The dist does NOT require the feature + # - At least one package in the group DOES require the feature + # - A package that tracks the feature is installed for name, group in iteritems(self.groups): - nf = [len(self.features(dist)) for dist in group] - maxf = max(nf) - if maxf > 0: - eq.update({dist.full_name: maxf-fc for dist, fc in zip(group, nf) if maxf > fc}) - # This entry causes conda to weight the absence of a package the same - # as if a non-featured version were instaslled. If this were not here, - # conda will sometimes select an earlier build of a requested package - # if doing so can eliminate this package as a dependency. - # https://github.com/conda/conda/issues/6765 - eq['!' + self.push_MatchSpec(C, name)] = maxf - total += maxf - return eq, total + dist_feats = {dist.full_name: self.features(dist) for dist in group} + active_feats = set.union(*dist_feats.values()).intersection(self.trackers) + for feat in active_feats: + clause_id_for_feature = self.push_MatchSpec(C, '@' + feat) + for dist, features in dist_feats.items(): + if feat not in features: + feature_metric_id = self.to_feature_metric_id(dist, feat) + C.name_var(C.And(dist, clause_id_for_feature), feature_metric_id) + eq[feature_metric_id] = 1 + return eq def generate_removal_count(self, C, specs): return {'!'+self.push_MatchSpec(C, ms.name): 1 for ms in specs} @@ -935,11 +945,16 @@ def mysat(specs, add_if=False): solution, obj1 = C.minimize(eq_feature_count, solution) log.debug('Track feature count: %d', obj1) - # Featured packages: maximize featured package count - eq_feature_metric, ftotal = r2.generate_feature_metric(C) + # Featured packages: minimize number of featureless packages + # installed when a featured alternative is feasible. + # For example, package name foo exists with two built packages. One with + # 'track_features: 'feat1', and one with 'track_features': 'feat2'. + # The previous "Track features" minimization pass has chosen 'feat1' for the + # environment, but not 'feat2'. In this case, the 'feat2' version of foo is + # considered "featureless." + eq_feature_metric = r2.generate_feature_metric(C) solution, obj2 = C.minimize(eq_feature_metric, solution) - obj2 = ftotal - obj2 - log.debug('Package feature count: %d', obj2) + log.debug('Package misfeature count: %d', obj2) # Requested packages: maximize builds solution, obj4 = C.minimize(eq_req_b, solution)
diff --git a/tests/test_resolve.py b/tests/test_resolve.py --- a/tests/test_resolve.py +++ b/tests/test_resolve.py @@ -1395,3 +1395,77 @@ def test_update_deps(): 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ]]] + + +def test_surplus_features_1(): + index = { + 'feature-1.0-0.tar.bz2': IndexRecord(**{ + 'name': 'feature', + 'version': '1.0', + 'build': '0', + 'build_number': 0, + 'track_features': 'feature', + }), + 'package1-1.0-0.tar.bz2': IndexRecord(**{ + 'name': 'package1', + 'version': '1.0', + 'build': '0', + 'build_number': 0, + 'features': 'feature', + }), + 'package2-1.0-0.tar.bz2': IndexRecord(**{ + 'name': 'package2', + 'version': '1.0', + 'build': '0', + 'build_number': 0, + 'depends': ['package1'], + 'features': 'feature', + }), + 'package2-2.0-0.tar.bz2': IndexRecord(**{ + 'name': 'package2', + 'version': '2.0', + 'build': '0', + 'build_number': 0, + 'features': 'feature', + }), + } + r = Resolve({Dist(key): value for key, value in iteritems(index)}) + install = r.install(['package2', 'feature']) + assert 'package1' not in set(d.name for d in install) + + +def test_surplus_features_2(): + index = { + 'feature-1.0-0.tar.bz2': IndexRecord(**{ + 'name': 'feature', + 'version': '1.0', + 'build': '0', + 'build_number': 0, + 'track_features': 'feature', + }), + 'package1-1.0-0.tar.bz2': IndexRecord(**{ + 'name': 'package1', + 'version': '1.0', + 'build': '0', + 'build_number': 0, + 'features': 'feature', + }), + 'package2-1.0-0.tar.bz2': IndexRecord(**{ + 'name': 'package2', + 'version': '1.0', + 'build': '0', + 'build_number': 0, + 'depends': ['package1'], + 'features': 'feature', + }), + 'package2-1.0-1.tar.bz2': IndexRecord(**{ + 'name': 'package2', + 'version': '1.0', + 'build': '1', + 'build_number': 1, + 'features': 'feature', + }), + } + r = Resolve({Dist(key): value for key, value in iteritems(index)}) + install = r.install(['package2', 'feature']) + assert 'package1' not in set(d.name for d in install)
Regression in conda 4.3.33 regarding build features It seems that `conda 4.3.33` installs packages that have a build feature when installing any package that has the same build feature. From a fresh miniconda, with conda pinned at `4.3.32`: ```sh scorlay@mbp ~]$ conda install cryptopp -c QuantStack -c conda-forge Fetching package metadata ............... Solving package specifications: . Package plan for installation in environment /Users/scorlay/miniconda3: The following NEW packages will be INSTALLED: cling-patches: 1-0 QuantStack cryptopp: 5.6.5-cling_0 QuantStack [cling] ``` With `conda 4.3.33` ```sh [scorlay@mbp ~]$ conda install cryptopp -c QuantStack -c conda-forge Fetching package metadata ............... Solving package specifications: . Package plan for installation in environment /Users/scorlay/miniconda3: The following NEW packages will be INSTALLED: clangdev: 5.0.0-cling_1 QuantStack [cling] cling-patches: 1-0 QuantStack cryptopp: 5.6.5-cling_0 QuantStack [cling] icu: 58.2-0 conda-forge libiconv: 1.15-0 conda-forge libxml2: 2.9.7-0 conda-forge llvmdev: 5.0.0-cling_1 QuantStack [cling] ``` The only package tracking the `cling` build feature is `cling-patches`. Notice in the second case that `clangdev` gets installed while it is not a dependency.
As per @jjhelmus 's comment, this might be due to #6766. cc @mcg1969 . Cannot reproduce thiswith a fresh `Miniconda3-4.3.31-Linux-x86_64.sh` installation updated to `conda 4.3.32`: ```bash $ conda --version conda 4.3.32 $ conda create -qnx --dry-run -c QuantStack -c conda-forge cryptopp cling@ Package plan for installation in environment /home/maba/code/conda/mc4332/envs/x: The following NEW packages will be INSTALLED: cling-patches: 1-0 QuantStack cryptopp: 5.6.5-cling_0 QuantStack [cling] libgcc-7: 7.2.0-0 QuantStack $ conda install -qy conda=4.3.33 Package plan for installation in environment /home/maba/code/conda/mc4332: The following packages will be UPDATED: conda: 4.3.32-py36_0 --> 4.3.33-py36_0 $ conda create -qnx --dry-run -c QuantStack -c conda-forge cryptopp cling@ Package plan for installation in environment /home/maba/code/conda/mc4332/envs/x: The following NEW packages will be INSTALLED: cling-patches: 1-0 QuantStack cryptopp: 5.6.5-cling_0 QuantStack [cling] libgcc-7: 7.2.0-0 QuantStack ``` Can you give more information on your environment? (E.g., fill out the issue template.) This is something I am seeing on OS X. Locally, and also on Travis. This is impacting our conda-forge style builds. Features need to die a fiery death. They simply are not SAT representable as conceived :-( I will see what I can do. > Features need to die a fiery death. They simply are not SAT representable as conceived :-( > I will see what I can do. What should I use instead. @SylvainCorlay can we get a `conda create` recipe from you that can reproduce the problem, so that it can be reliably reproduced? > What should I used instead. It depends exactly what you are trying to do. > @SylvainCorlay can we get a conda create recipe from you that can reproduce the problem, so that it can be reliably reproduced? I don't understand what you would like here, but I would be happy to help. Your examples involve `conda install` commands --- I wonder if you can give us a `conda create` command instead that reveals the issue. With `conda install`, it assumes an existing envrionment with a set of packages that might be influencing the solution. ok will do. FYI, I produced this from the root environment of a newly installed miniconda. Note: I am not reproducing with `conda create`. Only `conda install`. `conda create` reproducer: ``` |$ conda --version conda 4.3.32 |$ CONDA_SUBDIR=osx-64 conda create -qnx --dry-run -c QuantStack -c conda-forge cryptopp icu Package plan for installation in environment /home/maba/code/conda/conda-4.3/envs/x: The following NEW packages will be INSTALLED: cling-patches: 1-0 QuantStack cryptopp: 5.6.5-cling_0 QuantStack [cling] icu: 58.2-0 conda-forge |$ conda install -qy conda=4.3.33 Package plan for installation in environment /home/maba/code/conda/conda-4.3: The following packages will be UPDATED: conda: 4.3.32-py36_0 --> 4.3.33-py36_0 |$ CONDA_SUBDIR=osx-64 conda create -qnx --dry-run -c QuantStack -c conda-forge cryptopp icu Package plan for installation in environment /home/maba/code/conda/conda-4.3/envs/x: The following NEW packages will be INSTALLED: clangdev: 5.0.0-cling_1 QuantStack [cling] cling-patches: 1-0 QuantStack cryptopp: 5.6.5-cling_0 QuantStack [cling] icu: 58.2-0 conda-forge libiconv: 1.15-0 conda-forge libxml2: 2.9.7-0 conda-forge llvmdev: 5.0.0-cling_1 QuantStack [cling] xz: 5.2.3-0 conda-forge zlib: 1.2.11-0 conda-forge ``` (uses `CONDA_SUBDIR=osx-64` as I'm on Linux). To reproduce it, all parts of `-c QuantStack -c conda-forge cryptopp icu` are needed. @mcg1969 has told me that he probably supports reverting #6766 in a conda 4.3.34 release. Do you agree @mbargull? That breaks my heart 😢. That PR improved the situation on previously failing cases a lot. Reverting that #6766 would mean we are back to square one for https://github.com/conda/conda/issues/6269#issuecomment-344077631. I still agree with https://github.com/conda/conda/issues/6833#issuecomment-362604480: > Features need to die a fiery death. They simply are not SAT representable as conceived :-( https://github.com/conda/conda/pull/6296#issuecomment-347257443: > We have discussed this at length internally. @mcg1969 is very hesitant to change anything about how features work. There's a lot of pain there, and his opinion is that it's very hard to anticipate any potential breakage from this PR. But still, I had hoped those latest changes were to stay 😞. Well, for a short time, people who experienced regressions can pin conda to an earlier version. But we need to figure something out soon. We did just discover something useful that may help us form a solution. It turns out that just using a `track_feature` _with no corresponding `feature` packages_ has a useful interpretation for establishing preferences. I'm trying to see if we can reproduce that useful quality. conda-forge relies a lot on build featutes for MSVC flavors. We do a lot at QuantStack for flavors of builds of llvm (for cling which requires patches). In another case, we have used it to overcome problems with channel priorities not being respected, ehich appears to have been solved since but a lot of our builds still have the features. Maybe a compromise would be to revert it in 4.3 but leave it in 4.4? Idk. Sent from my iPhone > On Feb 7, 2018, at 7:32 AM, Sylvain Corlay <[email protected]> wrote: > > conda-forge relies a lot on build featutes for MSVC flavors. We do a lot at QuantStack for flavors of builds of llvm (for cling which requires patches). > > In another case, we have used it to overcome problems with channel priorities not being respected, ehich appears to have been solved since but a lot of our builds still have the features. > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub, or mute the thread. > May be @mwcraig @isuruf @pelson @jakirkham have an opinion on this. If it is a backward incompatible change, it would probably deserve a `5.0`. Is there a good alternative to build features at the moment? > Maybe a compromise would be to revert it in 4.3 but leave it in 4.4? Idk. `conda-forge` and `bioconda` both benefit from `4.3.33` in some cases (and still need some time to update to 4.4)... > If it is a backward incompatible change, it would probably deserve a `5.0`. In regards to solver logic, there were already some changes in 4.x (channel priority, timestamps) -- so it's not the case that 4.x was stable in that regard anyway... (That's just mean as an objective and *not* suggestive comment.) @SylvainCorlay, I haven't yet completely assessed the severity of the issue `4.3.33` introduced for you. Would that be a workflow-breaking change or could it be (in a broader sense) seen as an "inconvenience". I know that the introduction of additional packages (esp. during build) is undesirable, but the question is if that is workflow breaking or not. This is not to downplay the issue, just to put it into perspective to the issues #6766 helped with (some of them were workflow-breaking), so we can decide, based on severity, what we should do.
2018-02-07T17:09:53
conda/conda
6,855
conda__conda-6855
[ "6837" ]
fcc29968afaafe343ba30e68da245c44516e69f0
diff --git a/conda/core/index.py b/conda/core/index.py --- a/conda/core/index.py +++ b/conda/core/index.py @@ -182,7 +182,7 @@ def get_reduced_index(prefix, channels, subdirs, specs): pending_track_features = set() def query_all(spec): - futures = (executor.submit(sd.query, spec) for sd in subdir_datas) + futures = tuple(executor.submit(sd.query, spec) for sd in subdir_datas) return tuple(concat(future.result() for future in as_completed(futures))) def push_spec(spec): diff --git a/conda/core/repodata.py b/conda/core/repodata.py --- a/conda/core/repodata.py +++ b/conda/core/repodata.py @@ -80,7 +80,7 @@ def query_all(channels, subdirs, package_ref_or_match_spec): channel_urls = all_channel_urls(channels, subdirs=subdirs) check_whitelist(channel_urls) with ThreadLimitedThreadPoolExecutor() as executor: - futures = (executor.submit( + futures = tuple(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)))
Cannot install packages <!-- 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. --> I can no longer install any packages, neither from command line using conda install, nor from the anaconda navigator. This issue occurs since I uninstalled spyder yesterday (I wanted to reinstall it to try to fix a different issue). Uninstallation was done via Anaconda navigator. ### 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. --> Here is one example, but happens with any package I've tried so far. ``` conda install python=2.7 Solving environment: failed PackagesNotFoundError: The following packages are not available from current channels: - python=2.7 Current channels: - 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 ``` ## Environment Information Happens on all my environments, but here is one example <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 : /Applications/anaconda shell level : 2 user config file : /Users/dkleindienst/.condarc populated config files : /Users/dkleindienst/.condarc conda version : 4.4.8 conda-build version : 1.8.2 python version : 2.7.12.final.0 base environment : /Applications/anaconda (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 : /Applications/anaconda/pkgs /Users/dkleindienst/.conda/pkgs envs directories : /Applications/anaconda/envs /Users/dkleindienst/.conda/envs platform : osx-64 user-agent : conda/4.4.8 requests/2.14.2 CPython/2.7.12 Darwin/17.4.0 OSX/10.13.3 UID:GID : 501:20 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' --> ``` ==> /Users/dkleindienst/.condarc <== ssl_verify: True channels: - 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 /Applications/anaconda: # # Name Version Build Channel _license 1.1 py27_1 defaults abstract-rendering 0.5.1 np19py27_0 <unknown> alabaster 0.7.3 py27_0 defaults anaconda-client 1.6.3 py27_0 defaults anaconda-navigator 1.6.4 py27_0 defaults anaconda-project 0.6.0 py27_0 defaults appnope 0.1.0 py27_0 defaults appscript 1.0.1 py27_0 defaults argcomplete 0.8.4 py27_0 defaults asn1crypto 0.22.0 py27_0 defaults astroid 1.4.7 py27_0 defaults astropy 1.0.1 np19py27_0 defaults atom 0.3.9 py27_0 <unknown> babel 1.3 py27_0 defaults backports 1.0 py27_0 defaults bcolz 0.8.1 np19py27_0 defaults beautiful-soup 4.3.2 py27_0 <unknown> beautifulsoup4 4.6.0 py27_0 defaults binstar 0.10.1 py27_3 defaults bitarray 0.8.1 py27_0 <unknown> blaze 0.6.3 np19py27_0 <unknown> blaze-core 0.7.3 np19py27_0 defaults blz 0.6.2 np19py27_0 <unknown> bokeh 0.8.1 np19py27_1 defaults boto 2.36.0 py27_0 defaults casuarius 1.1 py27_0 <unknown> cdecimal 2.3 py27_0 <unknown> certifi 14.05.14 py27_0 defaults cffi 1.10.0 py27_0 defaults chaco 4.4.1 np19py27_0 <unknown> chardet 3.0.4 py27_0 defaults clize 3.0a2 <pip> cloudpickle 0.5.2 py27_1 defaults clyent 1.2.2 py27_0 defaults colorama 0.3.3 py27_0 defaults conda 4.4.8 py27_0 defaults conda-build 1.8.2 py27_0 <unknown> conda-env 2.6.0 h36134e3_0 defaults configobj 5.0.6 py27_0 <unknown> configparser 3.5.0 py27_0 defaults cryptography 1.8.1 py27_0 defaults curl 7.38.0 0 <unknown> cycler 0.10.0 py27_0 defaults cycler 0.10.0 <pip> cython 0.22 py27_0 defaults cytoolz 0.7.2 py27_0 defaults datashape 0.4.4 np19py27_1 defaults dateutil 2.1 py27_2 <unknown> decorator 3.4.0 py27_0 <unknown> docutils 0.12 py27_0 <unknown> dynd-python 0.6.5 np19py27_0 <unknown> enable 4.3.0 np19py27_2 <unknown> enaml 0.9.8 py27_0 <unknown> entrypoints 0.2.2 py27_0 defaults enum34 1.1.6 py27_0 defaults fastcache 1.0.2 py27_0 defaults flask 0.10.1 py27_1 <unknown> freetype 2.5.5 1 defaults funcsigs 0.4 py27_0 defaults funcsigs 0.4 <pip> future 0.13.1 py27_0 <unknown> futures 2.2.0 py27_0 defaults get_terminal_size 1.0.0 py27_0 defaults gevent 1.0.1 py27_0 <unknown> gevent-websocket 0.9.3 py27_0 <unknown> glueviz 0.4.0 np19py27_1 defaults greenlet 0.4.5 py27_0 defaults grin 1.2.1 py27_1 <unknown> h5py 2.4.0 np19py27_0 defaults hdf5 1.8.14 0 defaults icu 54.1 0 defaults idna 2.5 py27_0 defaults ipaddress 1.0.18 py27_0 defaults ipykernel 4.5.0 py27_0 defaults ipython 5.1.0 py27_0 defaults ipython-qtconsole 3.0.0 py27_0 defaults ipython_genutils 0.1.0 py27_0 defaults itsdangerous 0.24 py27_0 <unknown> jbig 2.1 0 defaults jdcal 1.0 py27_0 <unknown> jedi 0.10.2 py27_2 defaults jinja2 2.8 py27_1 defaults jpeg 8d 2 defaults jsonschema 2.4.0 py27_0 defaults jupyter_client 4.4.0 py27_0 defaults jupyter_core 4.2.0 py27_0 defaults kiwisolver 0.1.3 py27_0 <unknown> lazy-object-proxy 1.2.1 py27_0 defaults lcms 1.19 0 <unknown> libdynd 0.6.5 0 <unknown> libpng 1.6.22 0 defaults libsodium 0.4.5 0 <unknown> libtiff 4.0.6 2 defaults libxml2 2.9.0 1 <unknown> libxslt 1.1.28 2 <unknown> llvm 3.3 0 <unknown> llvmlite 0.2.2 py27_1 defaults llvmpy 0.12.7 py27_0 <unknown> lxml 3.4.2 py27_0 defaults markupsafe 0.23 py27_0 <unknown> matplotlib 1.5.3 <pip> matplotlib 1.5.3 np111py27_1 defaults mistune 0.5.1 py27_0 defaults mkl 11.3.3 0 defaults mock 1.0.1 py27_0 <unknown> multipledispatch 0.4.7 py27_0 <unknown> nbconvert 4.2.0 py27_0 defaults nbformat 4.1.0 py27_0 defaults networkx 1.9.1 py27_0 <unknown> networkx 1.9.1 <pip> NEURON 7.4 <pip> nltk 3.0.2 np19py27_0 defaults node-webkit 0.10.1 0 <unknown> nose 1.3.4 py27_1 defaults numba 0.17.0 np19py27_0 defaults numexpr 2.6.1 np111py27_1 defaults numpy 1.11.2 py27_0 defaults numpydoc 0.6.0 py27_0 defaults oct2py 3.1.0 <pip> odo 0.3.1 np19py27_0 defaults openpyxl 1.8.5 py27_0 <unknown> openssl 1.0.2j 0 defaults packaging 16.8 py27_0 defaults pandas 0.15.2 np19py27_1 defaults path.py 8.2.1 py27_0 defaults pathlib2 2.1.0 py27_0 defaults patsy 0.3.0 np19py27_0 <unknown> pep8 1.6.2 py27_0 defaults pexpect 3.3 py27_0 defaults pickleshare 0.7.4 py27_0 defaults pil 1.1.7 py27_1 <unknown> pillow 3.4.1 py27_0 defaults pip 7.1.2 <pip> pip 8.1.2 py27_0 defaults pip 9.0.1 <pip> plotly 1.6.17 <pip> ply 3.4 py27_0 <unknown> prompt_toolkit 1.0.3 py27_0 defaults psutil 2.2.1 py27_0 defaults ptyprocess 0.4 py27_0 defaults py 1.4.26 py27_0 defaults pyasn1 0.1.7 py27_0 defaults pyaudio 0.2.7 py27_0 <unknown> pyclips-1.0.7.348 clips_6.24 <pip> pycodestyle 2.3.1 py27_0 defaults pycosat 0.6.3 py27h6c51c7e_0 defaults pycparser 2.10 py27_0 <unknown> pycrypto 2.6.1 py27_0 <unknown> pycurl 7.19.5.1 py27_0 defaults pyface 4.4.0 py27_0 <unknown> pyflakes 0.8.1 py27_0 defaults pygments 2.0.2 py27_0 defaults pylint 1.5.4 py27_1 defaults pyopenssl 17.0.0 py27_0 defaults pyparsing 2.0.3 py27_0 defaults pyqt 5.6.0 py27_0 defaults pytables 3.1.1 np19py27_2 defaults pytest 2.6.4 py27_0 defaults python 2.7.12 1 defaults python-dateutil 2.5.3 py27_0 defaults python.app 1.2 py27_3 <unknown> pytz 2015.4 <pip> pytz 2016.7 py27_0 defaults pyyaml 3.12 py27_0 defaults pyzmq 14.5.0 py27_0 defaults qt 5.6.0 0 defaults qtawesome 0.4.4 py27_0 defaults qtconsole 4.2.1 py27_1 defaults qtpy 1.3.1 py27_0 defaults readline 6.2 2 defaults redis 2.6.9 0 <unknown> redis-py 2.10.3 py27_0 defaults requests 2.7.0 <pip> requests 2.14.2 py27_0 defaults rope 0.9.4 py27_1 <unknown> rpy2 2.5.6 <pip> ruamel_yaml 0.11.14 py27_0 defaults runipy 0.1.3 py27_0 defaults scikit-image 0.11.2 np19py27_0 defaults scikit-learn 0.18 np111py27_0 defaults scipy 0.18.1 np111py27_0 defaults setuptools 27.2.0 py27_0 defaults Shapely 1.4.1 <pip> simplegeneric 0.8.1 py27_1 defaults simpleitk 0.10.0 py27_0 simpleitk sip 4.18 py27_0 defaults six 1.10.0 py27_0 defaults snowballstemmer 1.2.0 py27_0 defaults sockjs-tornado 1.0.1 py27_0 <unknown> sphinx 1.2.3 py27_0 defaults sphinx_rtd_theme 0.1.7 py27_0 defaults sqlalchemy 0.9.9 py27_0 defaults sqlite 3.13.0 0 defaults ssl_match_hostname 3.4.0.2 py27_0 <unknown> statsmodels 0.6.1 np19py27_0 defaults supreme 0.9 <pip> sympy 0.7.6 py27_0 defaults terminado 0.5 py27_0 defaults TiffCapture 0.1.4 <pip> tk 8.5.18 0 defaults toolz 0.7.1 py27_0 defaults tornado 4.1 py27_0 defaults traitlets 4.3.1 py27_0 defaults traits 4.4.0 py27_0 <unknown> traitsui 4.4.0 py27_0 <unknown> ujson 1.33 py27_0 <unknown> unicodecsv 0.9.4 py27_0 <unknown> wcwidth 0.1.7 py27_0 defaults werkzeug 0.10.1 py27_0 defaults wheel 0.29.0 py27_0 defaults wrapt 1.10.8 py27_0 defaults xlrd 0.9.3 py27_0 <unknown> xlsxwriter 0.6.7 py27_0 defaults xlwings 0.3.4 py27_0 defaults xlwt 0.7.5 py27_0 <unknown> xz 5.2.2 0 defaults yaml 0.1.6 0 defaults zeromq 4.0.4 0 defaults zlib 1.2.8 3 defaults ``` </p></details>
I am also having the exact same problem. It just started this morning. ``` bash-4.2$ conda create -p /tmp/foobar python=3.6 Solving environment: failed PackagesNotFoundError: The following packages are not available from current channels: - python=3.6 Current channels: - 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 ``` Can you provide the output of the command you're running, along with `-vv` ? Same problem here (macOS high sierra, conda 4.4.6) just noticed it today (as far as I can remember I didn't do any conda installs/uninstalls recently) ``` $ conda info active environment : None user config file : /Users/stefaan/.condarc populated config files : /Users/stefaan/.condarc conda version : 4.4.6 conda-build version : 1.3.1 python version : 2.7.12.final.0 base environment : /Users/stefaan/usr/anaconda (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/stefaan/usr/anaconda/pkgs /Users/stefaan/.conda/pkgs envs directories : /Users/stefaan/usr/anaconda/envs /Users/stefaan/.conda/envs platform : osx-64 user-agent : conda/4.4.6 requests/2.13.0 CPython/2.7.12 Darwin/17.4.0 OSX/10.13.3 UID:GID : 501:20 netrc file : None offline mode : False ``` even search doesn't work anymore: ``` $ conda search pandas Loading channels: done PackagesNotFoundError: The following packages are not available from current channels: - pandas Current channels: - 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 ``` trying to create new env with `-vv`: ``` $ conda create -vv -n tmp27 python=2.7 DEBUG conda.gateways.logging:set_verbosity(148): verbosity set to 2 DEBUG conda.core.package_cache:_check_writable(226): package cache directory '/Users/stefaan/usr/anaconda/pkgs' writable: True Solving environment: ...working... DEBUG conda.core.solve:solve_final_state(140): solving prefix /Users/stefaan/usr/anaconda/envs/tmp27 specs_to_remove: frozenset([]) specs_to_add: frozenset([MatchSpec(name=LowerStrMatch('python'), version=VersionSpec('2.7.*'))]) prune: False DEBUG conda.core.package_cache:_check_writable(226): package cache directory '/Users/stefaan/.conda/pkgs' writable: True DEBUG conda.resolve:bad_installed(707): Checking if the current environment is consistent DEBUG conda.core.solve:solve_final_state(222): inconsistent dists: None DEBUG conda.resolve:get_reduced_index(252): Retrieving packages for: - python=2.7 failed Traceback (most recent call last): File "/Users/stefaan/usr/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 724, in __call__ return func(*args, **kwargs) File "/Users/stefaan/usr/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/Users/stefaan/usr/anaconda/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "/Users/stefaan/usr/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 11, in execute install(args, parser, 'create') File "/Users/stefaan/usr/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 247, in install raise PackagesNotFoundError(e.bad_deps, channels_urls) PackagesNotFoundError: The following packages are not available from current channels: - python=2.7 Current channels: - 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``` ok, I took a debugger and this is what I found on my setup after some digging around: in `conda/core/repodata.py` around line 85 (`SubdirData.query_all`): ``` from concurrent.futures import ThreadPoolExecutor, as_completed executor = ThreadPoolExecutor(10) futures = (executor.submit( SubdirData(Channel(url)).query, package_ref_or_match_spec ) for url in channel_urls) return tuple(concat(future.result() for future in as_completed(futures))) ``` Note that `futures` here is a generator expression. On my setup, `concurrent.futures.as_completed(fs)` assumes that `fs` is a sequence that can be iterated over multiple times, which does not work with a generator expression obviously. `concurrent.futures` is since version 3.0.0 (https://github.com/agronholm/pythonfutures/commit/f3d2563b4345b108a6197a36411aec19064ee15f) is more flexible about this, but apparently my `conda` uses version 2.2.0 (I think, not completely sure about this) The hack that fixes the situation for me is as follows. In `${anaconda_install_dir}/lib/python2.7/site-packages/concurrent/futures/_base.py`, I updated (based on https://github.com/agronholm/pythonfutures/commit/f3d2563b4345b108a6197a36411aec19064ee15f) the `as_completed` function around line 200 so that `fs` is a set that can be iterated over multiple times: ``` def as_completed(fs, timeout=None): # ... fs = set(fs) with _AcquireFutures(fs): # ... ``` Now, `conda search pandas` and `conda create` work again for me as expected Note: now that conda works again for me, I updated it to currently latest version 4.4.9 (`conda update conda`) Also, I updated the `futures` package manually in my base install to properly get rid of my manual workaround ``` $ conda install futures ... The following packages will be downloaded: package | build ---------------------------|----------------- futures-3.2.0 | py27h1b80678_0 24 KB defaults The following packages will be UPDATED: futures: 2.2.0-py27_0 defaults --> 3.2.0-py27h1b80678_0 defaults ```
2018-02-08T00:36:37
conda/conda
6,856
conda__conda-6856
[ "6852" ]
75d7c612ff7398761618a107f9f7c21362b511e3
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -29,6 +29,7 @@ create_link, create_python_entry_point, extract_tarball, make_menu, write_as_json_to_file) from ..gateways.disk.delete import rm_rf, try_rmdir_all_empty +from ..gateways.disk.permissions import make_writable from ..gateways.disk.read import (compute_md5sum, compute_sha256sum, islink, lexists, read_index_json) from ..gateways.disk.update import backoff_rename, touch @@ -401,6 +402,7 @@ def verify(self): log.trace("copying %s => %s", self.source_full_path, self.intermediate_path) create_link(self.source_full_path, self.intermediate_path, LinkType.copy) + make_writable(self.intermediate_path) try: log.trace("rewriting prefixes in %s", self.target_full_path)
PermissionError in /tmp on `conda create` `conda create -n myenv python` fails with a PermissionError. I updated conda recently to 4.4.8 (python 3.6.4.final.0). Conda root is installed on a read-only file system, so I expect it to install the env in my home dir. There is plenty of space left. ``` Traceback (most recent call last): File "/miniconda/lib/python3.6/site-packages/conda/exceptions.py", line 772, in __call__ return func(*args, **kwargs) File "/miniconda/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/miniconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 77, in do_call exit_code = getattr(module, func_name)(args, parser) File "/miniconda/lib/python3.6/site-packages/conda/cli/main_create.py", line 11, in execute install(args, parser, 'create') File "/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv) File "/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 285, in handle_txn unlink_link_transaction.execute() File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 220, in execute self.verify() File "/miniconda/lib/python3.6/site-packages/conda/common/io.py", line 441, in decorated return f(*args, **kwds) File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 207, in verify exceptions = self._verify(self.prefix_setups, self.prefix_action_groups) File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 460, in _verify cls._verify_transaction_level(prefix_setups), File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 455, in <genexpr> exceptions = tuple(exc for exc in concatv( File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 323, in _verify_individual_level error_result = axn.verify() File "/miniconda/lib/python3.6/site-packages/conda/core/path_actions.py", line 410, in verify self.file_mode) File "/miniconda/lib/python3.6/site-packages/conda/core/portability.py", line 57, in update_prefix update_file_in_place_as_binary(realpath(path), _update_prefix) File "/miniconda/lib/python3.6/site-packages/conda/gateways/disk/update.py", line 33, in update_file_in_place_as_binary fh = exp_backoff_fn(open, file_full_path, 'rb+') File "/miniconda/lib/python3.6/site-packages/conda/gateways/disk/__init__.py", line 23, in exp_backoff_fn return fn(*args, **kwargs) PermissionError: [Errno 13] Permission denied: '/tmp/tmpp4kwvm4j/be616029-6651-4227-a448-4e595cd8e473' ``` That file was created during package installation by conda. Oddly it is missing write permissions: ``` $ ls -l /tmp/tmpp4kwvm4j/be616029-6651-4227-a448-4e595cd8e473 -r-xr-xr-x. 1 joostk wheel 932 Nov 8 22:42 /tmp/tmpp4kwvm4j/be616029-6651-4227-a448-4e595cd8e473 ``` How can I resolve this, without going through conda's code, making sure it sets the permissions correctly?
I am able to create a new env without installing packages: ``` $ conda create -n myenv Solving environment: done ## Package Plan ## environment location: /home/joostk/.conda/envs/myenv Proceed ([y]/n)? y Preparing transaction: done Verifying transaction: done Executing transaction: done # # To activate this environment, use: # > source activate myenv # # To deactivate an active environment, use: # > source deactivate # ``` But installation of packages fails from then. ``` $ source activate myenv (myenv) $ conda install python Solving environment: done ## Package Plan ## environment location: /home/joostk/.conda/envs/myenv added / updated specs: - python The following NEW packages will be INSTALLED: ca-certificates: 2017.08.26-h1d4fec5_0 certifi: 2018.1.18-py36_0 libedit: 3.1-heed3624_0 libffi: 3.2.1-hd88cf55_4 libgcc-ng: 7.2.0-h7cc24e2_2 libstdcxx-ng: 7.2.0-h7a57d05_2 ncurses: 6.0-h9df7e31_2 openssl: 1.0.2n-hb7f436b_0 pip: 9.0.1-py36h6c6f9ce_4 python: 3.6.4-hc3d631a_1 readline: 7.0-ha6073c6_4 setuptools: 38.4.0-py36_0 sqlite: 3.22.0-h1bed415_0 tk: 8.6.7-hc745277_3 wheel: 0.30.0-py36hfd4bba0_1 xz: 5.2.3-h55aa19d_2 zlib: 1.2.11-ha838bed_2 Proceed ([y]/n)? y Preparing transaction: done Verifying transaction: failed # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< ``` Same here. Does python's `tempfile.mkdtemp()` function return a non-writable location on your system? I just tried here and it created a folder with the following permissions: `drwx------` with my username and group. So the answer is no. I believe I found the problem. Conda is likely creating some files in that temporary folder with the same permissions as the files from anaconda folder, which in my case no-writable. Doing a `chmod -R 755 /path/to/anaconda/folder` fixes the issue. However, that is not a solution as some people will have (to prevent accidental file removal, for example) anaconda folder non-writable. It was possible with old conda versions. It seems to happen only when conda is ran from a mount (hard-links fail). I have inspected `strace` of conda just after confirming downloading packages and installation. It writes the file, then chmods it to 555 and tries opening it in 'rb+': ``` open("/tmp/tmpjhgo25ir/929e78c1-07f9-4100-8fa1-7de08e0a1e2d", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 8 fstat(8, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 ioctl(8, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffe450d5e70) = -1 ENOTTY (Inappropriate ioctl for device) lseek(8, 0, SEEK_CUR) = 0 brk(0x7ff1f9d83000) = 0x7ff1f9d83000 read(7, "# libffi.la - a libtool library "..., 4194304) = 932 read(7, "", 3145728) = 0 read(7, "", 4194304) = 0 write(8, "# libffi.la - a libtool library "..., 932) = 932 close(8) = 0 close(7) = 0 stat("/miniconda/pkgs/libffi-3.2.1-hd88cf55_4/lib/libffi.la", {st_mode=S_IFREG|0555, st_size=932, ...}) = 0 utimensat(AT_FDCWD, "/tmp/tmpjhgo25ir/929e78c1-07f9-4100-8fa1-7de08e0a1e2d", {{1518024073, 468838246}, {1510177337, 0}}, 0) = 0 chmod("/tmp/tmpjhgo25ir/929e78c1-07f9-4100-8fa1-7de08e0a1e2d", 0555) = 0 listxattr("/miniconda/pkgs/libffi-3.2.1-hd88cf55_4/lib/libffi.la", "", 256) = 0 lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=36864, ...}) = 0 lstat("/tmp/tmpjhgo25ir", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 lstat("/tmp/tmpjhgo25ir/929e78c1-07f9-4100-8fa1-7de08e0a1e2d", {st_mode=S_IFREG|0555, st_size=932, ...}) = 0 open("/tmp/tmpjhgo25ir/929e78c1-07f9-4100-8fa1-7de08e0a1e2d", O_RDWR|O_CLOEXEC) = -1 EACCES (Permission denied) futex(0x7ff1d4000c10, FUTEX_WAIT_PRIVATE, 0, NULL) = 0 write(1, "\10\10failed\n", 9) = 9 ``` Why the chmod 555???? Likely because it mimics the permission result of `stat("/miniconda/pkgs/libffi-3.2.1-hd88cf55_4/lib/libffi.la", {st_mode=S_IFREG|0555, st_size=932, ...}) = 0` humm There might be a quick fix: remove all files from `/miniconda/pkgs` I will try it here. Ah! conda was copying that file and setting the permissions as such. `/miniconda/*` is (again) a read-only tree and owned by root. So, `chmod` the files there as 'u+x', which would fix the problem as well.. ``` sudo chown -R root:root /miniconda/pkgs # optional sudo chmod -R ug+w /miniconda/pkgs ``` Which fixed the problem! Edit: I was in the middle of writing this up when @hzpc-joostk made his latest comment. There's probably more detail than necessary here, but I'm going to go ahead and post it anyway, and probably come back again in the future to use for other situations. --- Let me explain for you guys what's happening in this part of the code--give you some background and context--and then maybe we can figure it out together. Probably should start by focusing on what's happening in https://github.com/conda/conda/blob/4.4.9/conda/core/path_actions.py#L389-L425 ```python def verify(self): validation_error = super(PrefixReplaceLinkAction, self).verify() if validation_error: return validation_error if islink(self.source_full_path): log.trace("ignoring prefix update for symlink with source path %s", self.source_full_path) # return assert False, "I don't think this is the right place to ignore this" self.intermediate_path = join(self.transaction_context['temp_dir'], text_type(uuid4())) log.trace("copying %s => %s", self.source_full_path, self.intermediate_path) create_link(self.source_full_path, self.intermediate_path, LinkType.copy) try: log.trace("rewriting prefixes in %s", self.target_full_path) update_prefix(self.intermediate_path, context.target_prefix_override or self.target_prefix, self.prefix_placeholder, self.file_mode) except _PaddingError: raise PaddingError(self.target_full_path, self.prefix_placeholder, len(self.prefix_placeholder)) sha256_in_prefix = compute_sha256sum(self.intermediate_path) self.prefix_path_data = PathDataV1.from_objects( self.prefix_path_data, file_mode=self.file_mode, path_type=PathType.hardlink, prefix_placeholder=self.prefix_placeholder, sha256_in_prefix=sha256_in_prefix, ) ``` When we get here, conda's solver has already ran to decide what needs to be uninstalled and installed into an environment, and all the packages have been downloaded and extracted into the package cache. The uninstall-install process is done in what we call an [`UnlinkLinkTransaction`](https://github.com/conda/conda/blob/4.4.9/conda/core/link.py#L142), which has three stages: (1) prepare, (2) verify, (3) execute. During the prepare stage, for *every single* path we're going to modify, we instantiate some flavor of [`PathAction`](https://github.com/conda/conda/blob/4.4.9/conda/core/path_actions.py#L59), which itself has four required methods: (1) verify, (2) execute, (3) reverse, (4) cleanup. So in theory, we should have full knowledge of every disk mutation we're going to make after we're done with the prepare stage. During the verify stage, we do verification of certain things at the [whole transaction level](https://github.com/conda/conda/blob/4.4.9/conda/core/link.py#L400) and at the [per-prefix level](https://github.com/conda/conda/blob/4.4.9/conda/core/link.py#L330) (transactions are designed with the capability to be multi-prefix transactions, for the anticipated future feature addition of [private application environments](https://github.com/conda/conda/issues/3912)), and then we also call the `verify()` method for every `PathAction` we've instantiated during the prepare phase. More specifics on this last part in a bit, because that's where we're getting tripped up. After the verify stage is done, we actually *begin* the transaction, where we start to call the `execute()` method for every `PathAction`. If we get through them all without an unexpected exception happening, the transaction has completed successfully, and we finish by calling the `cleanup()` method for every `PathAction`. However, if anything unexpected happens during the transaction, we roll back the transaction by calling `reverse()` on every `PathAction` that had been executed so far. Okay back to details of the `verify()` step for individual `PathAction`s. By far the most used is `LinkPathAction`, and the [`verify()`](https://github.com/conda/conda/blob/4.4.9/conda/core/path_actions.py#L257-L358) method there. `LinkPathAction` takes a specific path in the package cache, and correctly links it into the target prefix. Depending on configuration, the type of the path being linked, etc., we might be hard-linking, soft-linking, copying, just creating a directory, creating a new relative soft link, etc. That's all taken care of by `LinkPathAction`. The `verify()` method makes sure the path we're going to be linking *actually exists* in the package cache, and makes sure it hasn't been modified from what's expected by checking the sha256. There's a variant of `LinkPathAction` that we also use a lot, `PrefixReplaceLinkAction`, which we use when we'd ideally like to just hard-link the path into the prefix, but instead we have to copy it, because we also have to do prefix rewrites within the content of the file. Here during the `verify()` step, we're copying the content of the path in the package cache to a temporary location on disk, and doing the prefix rewriting on the file in that temporary location. The `execute()` method then uses the content of that temporary location to link into the prefix, and `cleanup()` removes that temporary location. Write permissions of this temporary location is where we're having problem here. I'm also not comfortable with forcing users and admins to manually make what should be a read-only package cache (i.e. `/miniconda/pkgs`) user- and group-writable. In general, I don't consider that an acceptable solution to this problem. We can do better on the conda side. So I'm going to re-open the issue. I do think it's a pretty simple fix though. We just need to be more careful with permissions for the file in that temporary location. @kalefranz many thanks for your extensive description of the problem, explanation of the (un)installing/(un)linking process and verifications involved in them. All in all these seems to be complex, but sophisticated and well-designed processes. Good job devs! My apologies for closing this issue too early. I agree, setting the permissions to group writable is a bit overkill and I haven't tried only setting them user (root) writable. It is fixed, as conda copies the file's stats as well ([create_link](https://github.com/conda/conda/blob/4.4.9/conda/core/path_actions.py#L403) > [copy](https://github.com/conda/conda/blob/4.4.9/conda/gateways/disk/create.py#L309) > [_do_copy](https://github.com/conda/conda/blob/4.4.9/conda/gateways/disk/create.py#L247) > [copystat](https://github.com/conda/conda/blob/4.4.9/conda/gateways/disk/create.py#L264)). Letting conda set its own permissions in the temporary location seems to be a simple yet effective fix. 👍
2018-02-09T14:28:39
conda/conda
6,867
conda__conda-6867
[ "6811" ]
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:42
conda/conda
6,881
conda__conda-6881
[ "6880" ]
31a52a8a8771aafb0582822dd2e00b3274e1ffba
diff --git a/conda/models/version.py b/conda/models/version.py --- a/conda/models/version.py +++ b/conda/models/version.py @@ -545,10 +545,13 @@ def __new__(cls, spec): return self def exact_match_(self, vspec): - return self.spec == vspec + try: + return int(self.spec) == int(vspec) + except ValueError: + return False def veval_match_(self, vspec): - return self.op(VersionOrder(vspec), self.cmp) + return self.op(VersionOrder(text_type(vspec)), self.cmp) def triv_match_(self, vspec): return True
diff --git a/tests/models/test_match_spec.py b/tests/models/test_match_spec.py --- a/tests/models/test_match_spec.py +++ b/tests/models/test_match_spec.py @@ -395,6 +395,24 @@ def test_key_value_features_match(self): assert c.match(DPkg(dst, track_features='nomkl')) assert c.match(DPkg(dst, track_features='blas=nomkl debug')) + def test_bracket_matches(self): + record = { + 'name': 'numpy', + 'version': '1.11.0', + 'build': 'py34_7', + 'build_number': 7, + } + + assert MatchSpec("numpy<2").match(record) + assert MatchSpec("numpy[version<2]").match(record) + assert not MatchSpec("numpy>2").match(record) + assert not MatchSpec("numpy[version='>2']").match(record) + + assert MatchSpec("numpy[build_number='7']").match(record) + assert MatchSpec("numpy[build_number='<8']").match(record) + assert not MatchSpec("numpy[build_number='>7']").match(record) + assert MatchSpec("numpy[build_number='>=7']").match(record) + class TestArg2Spec(TestCase): @@ -642,3 +660,47 @@ def test_parse_parens(self): # "target": "blarg", # suppressing these for now # "optional": True, } + + def test_parse_build_number_brackets(self): + assert _parse_spec_str("python[build_number=3]") == { + "name": "python", + "build_number": '3', + } + assert _parse_spec_str("python[build_number='>3']") == { + "name": "python", + "build_number": '>3', + } + assert _parse_spec_str("python[build_number='>=3']") == { + "name": "python", + "build_number": '>=3', + } + + assert _parse_spec_str("python[build_number='<3']") == { + "name": "python", + "build_number": '<3', + } + assert _parse_spec_str("python[build_number='<=3']") == { + "name": "python", + "build_number": '<=3', + } + + # # these don't work right now, should they? + # assert _parse_spec_str("python[build_number<3]") == { + # "name": "python", + # "build_number": '<3', + # } + # assert _parse_spec_str("python[build_number<=3]") == { + # "name": "python", + # "build_number": '<=3', + # } + + # # these don't work right now, should they? + # assert _parse_spec_str("python[build_number>3]") == { + # "name": "python", + # "build_number": '>3', + # } + # assert _parse_spec_str("python[build_number>=3]") == { + # "name": "python", + # "build_number": '>=3', + # } +
build_number comparison not functional in match_spec Version comparisons work. conda search 'python[version="<3"]' Seems that build_number comparisons do not. conda search 'python[build_number="<5"]'
2018-02-14T14:56:27
conda/conda
6,887
conda__conda-6887
[ "6886" ]
b5f1309be0b8aadefbe82c16a921a72d34695c93
diff --git a/conda/base/constants.py b/conda/base/constants.py --- a/conda/base/constants.py +++ b/conda/base/constants.py @@ -64,18 +64,18 @@ DEFAULT_CHANNELS_UNIX = ( - 'https://repo.continuum.io/pkgs/main', - 'https://repo.continuum.io/pkgs/free', - 'https://repo.continuum.io/pkgs/r', - 'https://repo.continuum.io/pkgs/pro', + 'https://repo.anaconda.com/pkgs/main', + 'https://repo.anaconda.com/pkgs/free', + 'https://repo.anaconda.com/pkgs/r', + 'https://repo.anaconda.com/pkgs/pro', ) DEFAULT_CHANNELS_WIN = ( - 'https://repo.continuum.io/pkgs/main', - 'https://repo.continuum.io/pkgs/free', - 'https://repo.continuum.io/pkgs/r', - 'https://repo.continuum.io/pkgs/pro', - 'https://repo.continuum.io/pkgs/msys2', + 'https://repo.anaconda.com/pkgs/main', + 'https://repo.anaconda.com/pkgs/free', + 'https://repo.anaconda.com/pkgs/r', + 'https://repo.anaconda.com/pkgs/pro', + 'https://repo.anaconda.com/pkgs/msys2', ) # use the bool(sys.platform == "win32") definition here so we don't import .compat.on_win diff --git a/conda/core/subdir_data.py b/conda/core/subdir_data.py --- a/conda/core/subdir_data.py +++ b/conda/core/subdir_data.py @@ -390,7 +390,7 @@ def fetch_repodata_remote_request(url, etag, mod_stamp): if mod_stamp: headers["If-Modified-Since"] = mod_stamp - if 'repo.continuum.io' in url: + if 'repo.anaconda.com' in url: filename = 'repodata.json.bz2' headers['Accept-Encoding'] = 'identity' else: diff --git a/conda/models/channel.py b/conda/models/channel.py --- a/conda/models/channel.py +++ b/conda/models/channel.py @@ -114,7 +114,7 @@ def from_value(value): return Channel.from_url(value) else: # at this point assume we don't have a bare (non-scheme) url - # e.g. this would be bad: repo.continuum.io/pkgs/free + # e.g. this would be bad: repo.anaconda.com/pkgs/free _stripped, platform = split_platform(value, context.known_subdirs) if _stripped in context.custom_multichannels: return MultiChannel(_stripped, context.custom_multichannels[_stripped], platform)
diff --git a/tests/build-index2-json.py b/tests/build-index2-json.py --- a/tests/build-index2-json.py +++ b/tests/build-index2-json.py @@ -3,7 +3,7 @@ def main(): - r1 = requests.get('https://repo.continuum.io/pkgs/free/linux-64/repodata.json') + r1 = requests.get('https://repo.anaconda.com/pkgs/free/linux-64/repodata.json') r1.raise_for_status() r2 = requests.get('https://conda.anaconda.org/conda-test/noarch/repodata.json') r2.raise_for_status() diff --git a/tests/build-index4-json.py b/tests/build-index4-json.py --- a/tests/build-index4-json.py +++ b/tests/build-index4-json.py @@ -3,7 +3,7 @@ def main(): - r1 = requests.get('https://repo.continuum.io/pkgs/main/linux-64/repodata.json') + r1 = requests.get('https://repo.anaconda.com/pkgs/main/linux-64/repodata.json') r1.raise_for_status() r1json = r1.json() diff --git a/tests/cli/test_config.py b/tests/cli/test_config.py --- a/tests/cli/test_config.py +++ b/tests/cli/test_config.py @@ -22,7 +22,7 @@ # pass # unset CIO_TEST. This is a Continuum-internal variable that draws packages from an internal server instead of -# repo.continuum.io +# repo.anaconda.com @contextmanager def make_temp_condarc(value=None): diff --git a/tests/core/test_index.py b/tests/core/test_index.py --- a/tests/core/test_index.py +++ b/tests/core/test_index.py @@ -36,7 +36,7 @@ def test_check_whitelist(): get_index(("conda-canary",)) with pytest.raises(OperationNotAllowed): - get_index(("https://repo.continuum.io/pkgs/denied",)) + get_index(("https://repo.anaconda.com/pkgs/denied",)) check_whitelist(("defaults",)) check_whitelist((DEFAULT_CHANNELS[0], DEFAULT_CHANNELS[1])) diff --git a/tests/core/test_repodata.py b/tests/core/test_repodata.py --- a/tests/core/test_repodata.py +++ b/tests/core/test_repodata.py @@ -35,7 +35,7 @@ def test_get_index_no_platform_with_offline_cache(self): with env_var('CONDA_REPODATA_TIMEOUT_SECS', '0', reset_context): with patch.object(conda.core.subdir_data, 'read_mod_and_etag') as read_mod_and_etag: read_mod_and_etag.return_value = {} - channel_urls = ('https://repo.continuum.io/pkgs/pro',) + channel_urls = ('https://repo.anaconda.com/pkgs/pro',) with env_var('CONDA_REPODATA_TIMEOUT_SECS', '0', reset_context): this_platform = context.subdir index = get_index(channel_urls=channel_urls, prepend=False) @@ -91,7 +91,7 @@ def test_read_mod_and_etag_mod_only(self): def test_read_mod_and_etag_etag_only(self): etag_only_str = """ { - "_url": "https://repo.continuum.io/pkgs/r/noarch", + "_url": "https://repo.anaconda.com/pkgs/r/noarch", "info": {}, "_etag": "\"569c0ecb-48\"", "packages": {} @@ -107,7 +107,7 @@ def test_read_mod_and_etag_etag_mod(self): { "_etag": "\"569c0ecb-48\"", "_mod": "Sun, 17 Jan 2016 21:59:39 GMT", - "_url": "https://repo.continuum.io/pkgs/r/noarch", + "_url": "https://repo.anaconda.com/pkgs/r/noarch", "info": {}, "packages": {} } @@ -121,7 +121,7 @@ def test_read_mod_and_etag_mod_etag(self): mod_etag_str = """ { "_mod": "Sun, 17 Jan 2016 21:59:39 GMT", - "_url": "https://repo.continuum.io/pkgs/r/noarch", + "_url": "https://repo.anaconda.com/pkgs/r/noarch", "info": {}, "_etag": "\"569c0ecb-48\"", "packages": {} @@ -132,7 +132,7 @@ def test_read_mod_and_etag_mod_etag(self): assert mod_etag_dict["_mod"] == "Sun, 17 Jan 2016 21:59:39 GMT" assert mod_etag_dict["_etag"] == "\"569c0ecb-48\"" - def test_cache_fn_url(self): + def test_cache_fn_url_repo_continuum_io(self): hash1 = cache_fn_url("http://repo.continuum.io/pkgs/free/osx-64/") hash2 = cache_fn_url("http://repo.continuum.io/pkgs/free/osx-64") assert "aa99d924.json" == hash1 == hash2 @@ -147,6 +147,21 @@ def test_cache_fn_url(self): hash6 = cache_fn_url("https://repo.continuum.io/pkgs/r/osx-64") assert hash4 != hash6 + def test_cache_fn_url_repo_anaconda_com(self): + hash1 = cache_fn_url("http://repo.anaconda.com/pkgs/free/osx-64/") + hash2 = cache_fn_url("http://repo.anaconda.com/pkgs/free/osx-64") + assert "1e817819.json" == hash1 == hash2 + + hash3 = cache_fn_url("https://repo.anaconda.com/pkgs/free/osx-64/") + hash4 = cache_fn_url("https://repo.anaconda.com/pkgs/free/osx-64") + assert "3ce78580.json" == hash3 == hash4 != hash1 + + hash5 = cache_fn_url("https://repo.anaconda.com/pkgs/free/linux-64/") + assert hash4 != hash5 + + hash6 = cache_fn_url("https://repo.anaconda.com/pkgs/r/osx-64") + assert hash4 != hash6 + # @pytest.mark.integration # class SubdirDataTests(TestCase): diff --git a/tests/models/test_channel.py b/tests/models/test_channel.py --- a/tests/models/test_channel.py +++ b/tests/models/test_channel.py @@ -33,17 +33,17 @@ class DefaultConfigChannelTests(TestCase): def setUpClass(cls): reset_context() cls.platform = context.subdir - cls.DEFAULT_URLS = ['https://repo.continuum.io/pkgs/main/%s' % cls.platform, - 'https://repo.continuum.io/pkgs/main/noarch', - 'https://repo.continuum.io/pkgs/free/%s' % cls.platform, - 'https://repo.continuum.io/pkgs/free/noarch', - 'https://repo.continuum.io/pkgs/r/%s' % cls.platform, - 'https://repo.continuum.io/pkgs/r/noarch', - 'https://repo.continuum.io/pkgs/pro/%s' % cls.platform, - 'https://repo.continuum.io/pkgs/pro/noarch'] + cls.DEFAULT_URLS = ['https://repo.anaconda.com/pkgs/main/%s' % cls.platform, + 'https://repo.anaconda.com/pkgs/main/noarch', + 'https://repo.anaconda.com/pkgs/free/%s' % cls.platform, + 'https://repo.anaconda.com/pkgs/free/noarch', + 'https://repo.anaconda.com/pkgs/r/%s' % cls.platform, + 'https://repo.anaconda.com/pkgs/r/noarch', + 'https://repo.anaconda.com/pkgs/pro/%s' % cls.platform, + 'https://repo.anaconda.com/pkgs/pro/noarch'] if on_win: - cls.DEFAULT_URLS.extend(['https://repo.continuum.io/pkgs/msys2/%s' % cls.platform, - 'https://repo.continuum.io/pkgs/msys2/noarch']) + cls.DEFAULT_URLS.extend(['https://repo.anaconda.com/pkgs/msys2/%s' % cls.platform, + 'https://repo.anaconda.com/pkgs/msys2/noarch']) def test_channel_alias_channels(self): channel = Channel('binstar/label/dev') @@ -103,24 +103,24 @@ def test_default_channel(self): dc = Channel('defaults/win-32') assert dc.canonical_name == 'defaults' assert dc.subdir == 'win-32' - assert dc.urls()[0] == 'https://repo.continuum.io/pkgs/main/win-32' - assert dc.urls()[1] == 'https://repo.continuum.io/pkgs/main/noarch' + assert dc.urls()[0] == 'https://repo.anaconda.com/pkgs/main/win-32' + assert dc.urls()[1] == 'https://repo.anaconda.com/pkgs/main/noarch' assert dc.urls()[2].endswith('/win-32') def test_url_channel_w_platform(self): - channel = Channel('https://repo.continuum.io/pkgs/free/osx-64') + channel = Channel('https://repo.anaconda.com/pkgs/free/osx-64') assert channel.scheme == "https" - assert channel.location == "repo.continuum.io" + assert channel.location == "repo.anaconda.com" assert channel.platform == 'osx-64' == channel.subdir assert channel.name == 'pkgs/free' - assert channel.base_url == 'https://repo.continuum.io/pkgs/free' + assert channel.base_url == 'https://repo.anaconda.com/pkgs/free' assert channel.canonical_name == 'defaults' - assert channel.url() == 'https://repo.continuum.io/pkgs/free/osx-64' + assert channel.url() == 'https://repo.anaconda.com/pkgs/free/osx-64' assert channel.urls() == [ - 'https://repo.continuum.io/pkgs/free/osx-64', - 'https://repo.continuum.io/pkgs/free/noarch', + 'https://repo.anaconda.com/pkgs/free/osx-64', + 'https://repo.anaconda.com/pkgs/free/noarch', ] def test_bare_channel(self): @@ -293,7 +293,7 @@ def setUp(cls): migrated_custom_channels: darwin: s3://just/cant chuck: file:///var/lib/repo/ - pkgs/anaconda: https://repo.continuum.io + pkgs/anaconda: https://repo.anaconda.com migrated_channel_aliases: - https://conda.anaconda.org channel_alias: ftp://new.url:8082 @@ -331,7 +331,7 @@ def test_pkgs_free(self): 'http://192.168.0.15:8080/pkgs/anaconda/noarch', ] - channel = Channel('https://repo.continuum.io/pkgs/anaconda') + channel = Channel('https://repo.anaconda.com/pkgs/anaconda') assert channel.channel_name == "pkgs/anaconda" assert channel.channel_location == "192.168.0.15:8080" assert channel.canonical_name == "defaults" @@ -340,7 +340,7 @@ def test_pkgs_free(self): 'http://192.168.0.15:8080/pkgs/anaconda/noarch', ] - channel = Channel('https://repo.continuum.io/pkgs/anaconda/noarch') + channel = Channel('https://repo.anaconda.com/pkgs/anaconda/noarch') assert channel.channel_name == "pkgs/anaconda" assert channel.channel_location == "192.168.0.15:8080" assert channel.canonical_name == "defaults" @@ -348,7 +348,7 @@ def test_pkgs_free(self): 'http://192.168.0.15:8080/pkgs/anaconda/noarch', ] - channel = Channel('https://repo.continuum.io/pkgs/anaconda/label/dev') + channel = Channel('https://repo.anaconda.com/pkgs/anaconda/label/dev') assert channel.channel_name == "pkgs/anaconda/label/dev" assert channel.channel_location == "192.168.0.15:8080" assert channel.canonical_name == "pkgs/anaconda/label/dev" @@ -357,7 +357,7 @@ def test_pkgs_free(self): 'http://192.168.0.15:8080/pkgs/anaconda/label/dev/noarch', ] - channel = Channel('https://repo.continuum.io/pkgs/anaconda/noarch/flask-1.0.tar.bz2') + channel = Channel('https://repo.anaconda.com/pkgs/anaconda/noarch/flask-1.0.tar.bz2') assert channel.channel_name == "pkgs/anaconda" assert channel.channel_location == "192.168.0.15:8080" assert channel.platform == "noarch" @@ -377,40 +377,40 @@ def test_pkgs_pro(self): 'http://192.168.0.15:8080/pkgs/pro/noarch', ] - channel = Channel('https://repo.continuum.io/pkgs/pro') + channel = Channel('https://repo.anaconda.com/pkgs/pro') assert channel.channel_name == "pkgs/pro" - assert channel.channel_location == "repo.continuum.io" + assert channel.channel_location == "repo.anaconda.com" assert channel.canonical_name == "defaults" assert channel.urls() == [ - 'https://repo.continuum.io/pkgs/pro/%s' % self.platform, - 'https://repo.continuum.io/pkgs/pro/noarch', + 'https://repo.anaconda.com/pkgs/pro/%s' % self.platform, + 'https://repo.anaconda.com/pkgs/pro/noarch', ] - channel = Channel('https://repo.continuum.io/pkgs/pro/noarch') + channel = Channel('https://repo.anaconda.com/pkgs/pro/noarch') assert channel.channel_name == "pkgs/pro" - assert channel.channel_location == "repo.continuum.io" + assert channel.channel_location == "repo.anaconda.com" assert channel.canonical_name == "defaults" assert channel.urls() == [ - 'https://repo.continuum.io/pkgs/pro/noarch', + 'https://repo.anaconda.com/pkgs/pro/noarch', ] - channel = Channel('https://repo.continuum.io/pkgs/pro/label/dev') + channel = Channel('https://repo.anaconda.com/pkgs/pro/label/dev') assert channel.channel_name == "pkgs/pro/label/dev" - assert channel.channel_location == "repo.continuum.io" + assert channel.channel_location == "repo.anaconda.com" assert channel.canonical_name == "pkgs/pro/label/dev" assert channel.urls() == [ - 'https://repo.continuum.io/pkgs/pro/label/dev/%s' % self.platform, - 'https://repo.continuum.io/pkgs/pro/label/dev/noarch', + 'https://repo.anaconda.com/pkgs/pro/label/dev/%s' % self.platform, + 'https://repo.anaconda.com/pkgs/pro/label/dev/noarch', ] - channel = Channel('https://repo.continuum.io/pkgs/pro/noarch/flask-1.0.tar.bz2') + channel = Channel('https://repo.anaconda.com/pkgs/pro/noarch/flask-1.0.tar.bz2') assert channel.channel_name == "pkgs/pro" - assert channel.channel_location == "repo.continuum.io" + assert channel.channel_location == "repo.anaconda.com" assert channel.platform == "noarch" assert channel.package_filename == "flask-1.0.tar.bz2" assert channel.canonical_name == "defaults" assert channel.urls() == [ - 'https://repo.continuum.io/pkgs/pro/noarch', + 'https://repo.anaconda.com/pkgs/pro/noarch', ] def test_custom_channels(self): @@ -976,21 +976,21 @@ def test_multichannel_priority(): ('https://conda.anaconda.org/conda-test/new-optimized-subdir', ('conda-test', 0)), ('https://conda.anaconda.org/conda-test/linux-32', ('conda-test', 0)), ('https://conda.anaconda.org/conda-test/noarch', ('conda-test', 0)), - ('https://repo.continuum.io/pkgs/main/new-optimized-subdir', ('defaults', 1)), - ('https://repo.continuum.io/pkgs/main/linux-32', ('defaults', 1)), - ('https://repo.continuum.io/pkgs/main/noarch', ('defaults', 1)), - ('https://repo.continuum.io/pkgs/free/new-optimized-subdir', ('defaults', 2)), - ('https://repo.continuum.io/pkgs/free/linux-32', ('defaults', 2)), - ('https://repo.continuum.io/pkgs/free/noarch', ('defaults', 2)), - ('https://repo.continuum.io/pkgs/r/new-optimized-subdir', ('defaults', 3)), - ('https://repo.continuum.io/pkgs/r/linux-32', ('defaults', 3)), - ('https://repo.continuum.io/pkgs/r/noarch', ('defaults', 3)), - ('https://repo.continuum.io/pkgs/pro/new-optimized-subdir', ('defaults', 4)), - ('https://repo.continuum.io/pkgs/pro/linux-32', ('defaults', 4)), - ('https://repo.continuum.io/pkgs/pro/noarch', ('defaults', 4)), - ('https://repo.continuum.io/pkgs/msys2/new-optimized-subdir', ('defaults', 5)), - ('https://repo.continuum.io/pkgs/msys2/linux-32', ('defaults', 5)), - ('https://repo.continuum.io/pkgs/msys2/noarch', ('defaults', 5)), + ('https://repo.anaconda.com/pkgs/main/new-optimized-subdir', ('defaults', 1)), + ('https://repo.anaconda.com/pkgs/main/linux-32', ('defaults', 1)), + ('https://repo.anaconda.com/pkgs/main/noarch', ('defaults', 1)), + ('https://repo.anaconda.com/pkgs/free/new-optimized-subdir', ('defaults', 2)), + ('https://repo.anaconda.com/pkgs/free/linux-32', ('defaults', 2)), + ('https://repo.anaconda.com/pkgs/free/noarch', ('defaults', 2)), + ('https://repo.anaconda.com/pkgs/r/new-optimized-subdir', ('defaults', 3)), + ('https://repo.anaconda.com/pkgs/r/linux-32', ('defaults', 3)), + ('https://repo.anaconda.com/pkgs/r/noarch', ('defaults', 3)), + ('https://repo.anaconda.com/pkgs/pro/new-optimized-subdir', ('defaults', 4)), + ('https://repo.anaconda.com/pkgs/pro/linux-32', ('defaults', 4)), + ('https://repo.anaconda.com/pkgs/pro/noarch', ('defaults', 4)), + ('https://repo.anaconda.com/pkgs/msys2/new-optimized-subdir', ('defaults', 5)), + ('https://repo.anaconda.com/pkgs/msys2/linux-32', ('defaults', 5)), + ('https://repo.anaconda.com/pkgs/msys2/noarch', ('defaults', 5)), ('https://conda.anaconda.org/conda-forge/new-optimized-subdir', ('conda-forge', 6)), ('https://conda.anaconda.org/conda-forge/linux-32', ('conda-forge', 6)), ('https://conda.anaconda.org/conda-forge/noarch', ('conda-forge', 6)), @@ -1000,18 +1000,18 @@ def test_multichannel_priority(): ('https://conda.anaconda.org/conda-test/new-optimized-subdir', ('conda-test', 0)), ('https://conda.anaconda.org/conda-test/linux-32', ('conda-test', 0)), ('https://conda.anaconda.org/conda-test/noarch', ('conda-test', 0)), - ('https://repo.continuum.io/pkgs/main/new-optimized-subdir', ('defaults', 1)), - ('https://repo.continuum.io/pkgs/main/linux-32', ('defaults', 1)), - ('https://repo.continuum.io/pkgs/main/noarch', ('defaults', 1)), - ('https://repo.continuum.io/pkgs/free/new-optimized-subdir', ('defaults', 2)), - ('https://repo.continuum.io/pkgs/free/linux-32', ('defaults', 2)), - ('https://repo.continuum.io/pkgs/free/noarch', ('defaults', 2)), - ('https://repo.continuum.io/pkgs/r/new-optimized-subdir', ('defaults', 3)), - ('https://repo.continuum.io/pkgs/r/linux-32', ('defaults', 3)), - ('https://repo.continuum.io/pkgs/r/noarch', ('defaults', 3)), - ('https://repo.continuum.io/pkgs/pro/new-optimized-subdir', ('defaults', 4)), - ('https://repo.continuum.io/pkgs/pro/linux-32', ('defaults', 4)), - ('https://repo.continuum.io/pkgs/pro/noarch', ('defaults', 4)), + ('https://repo.anaconda.com/pkgs/main/new-optimized-subdir', ('defaults', 1)), + ('https://repo.anaconda.com/pkgs/main/linux-32', ('defaults', 1)), + ('https://repo.anaconda.com/pkgs/main/noarch', ('defaults', 1)), + ('https://repo.anaconda.com/pkgs/free/new-optimized-subdir', ('defaults', 2)), + ('https://repo.anaconda.com/pkgs/free/linux-32', ('defaults', 2)), + ('https://repo.anaconda.com/pkgs/free/noarch', ('defaults', 2)), + ('https://repo.anaconda.com/pkgs/r/new-optimized-subdir', ('defaults', 3)), + ('https://repo.anaconda.com/pkgs/r/linux-32', ('defaults', 3)), + ('https://repo.anaconda.com/pkgs/r/noarch', ('defaults', 3)), + ('https://repo.anaconda.com/pkgs/pro/new-optimized-subdir', ('defaults', 4)), + ('https://repo.anaconda.com/pkgs/pro/linux-32', ('defaults', 4)), + ('https://repo.anaconda.com/pkgs/pro/noarch', ('defaults', 4)), ('https://conda.anaconda.org/conda-forge/new-optimized-subdir', ('conda-forge', 5)), ('https://conda.anaconda.org/conda-forge/linux-32', ('conda-forge', 5)), ('https://conda.anaconda.org/conda-forge/noarch', ('conda-forge', 5)), diff --git a/tests/models/test_dist.py b/tests/models/test_dist.py --- a/tests/models/test_dist.py +++ b/tests/models/test_dist.py @@ -56,7 +56,7 @@ class UrlDistTests(TestCase): def test_dist_with_channel_url(self): # standard named channel - url = "https://repo.continuum.io/pkgs/free/win-64/spyder-app-2.3.8-py27_0.tar.bz2" + url = "https://repo.anaconda.com/pkgs/free/win-64/spyder-app-2.3.8-py27_0.tar.bz2" d = Dist(url) assert d.channel == 'defaults' assert d.name == 'spyder-app' @@ -120,7 +120,7 @@ def test_dist_with_channel_url(self): def test_dist_with_non_channel_url(self): # contrived url - url = "https://repo.continuum.io/pkgs/anaconda/cffi-1.9.1-py34_0.tar.bz2" + url = "https://repo.anaconda.com/pkgs/anaconda/cffi-1.9.1-py34_0.tar.bz2" d = Dist(url) assert d.channel == '<unknown>' assert d.name == 'cffi' diff --git a/tests/models/test_index_record.py b/tests/models/test_index_record.py --- a/tests/models/test_index_record.py +++ b/tests/models/test_index_record.py @@ -21,23 +21,23 @@ def test_prefix_record_no_channel(self): version='1.2.3', build_string='py34_2', build_number=2, - url="https://repo.continuum.io/pkgs/free/win-32/austin-1.2.3-py34_2.tar.bz2", + url="https://repo.anaconda.com/pkgs/free/win-32/austin-1.2.3-py34_2.tar.bz2", subdir="win-32", md5='0123456789', files=(), ) - assert pr.url == "https://repo.continuum.io/pkgs/free/win-32/austin-1.2.3-py34_2.tar.bz2" + assert pr.url == "https://repo.anaconda.com/pkgs/free/win-32/austin-1.2.3-py34_2.tar.bz2" assert pr.channel.canonical_name == 'defaults' assert pr.subdir == "win-32" assert pr.fn == "austin-1.2.3-py34_2.tar.bz2" - channel_str = text_type(Channel("https://repo.continuum.io/pkgs/free/win-32/austin-1.2.3-py34_2.tar.bz2")) - assert channel_str == "https://repo.continuum.io/pkgs/free/win-32" + channel_str = text_type(Channel("https://repo.anaconda.com/pkgs/free/win-32/austin-1.2.3-py34_2.tar.bz2")) + assert channel_str == "https://repo.anaconda.com/pkgs/free/win-32" assert dict(pr.dump()) == dict( name='austin', version='1.2.3', build='py34_2', build_number=2, - url="https://repo.continuum.io/pkgs/free/win-32/austin-1.2.3-py34_2.tar.bz2", + url="https://repo.anaconda.com/pkgs/free/win-32/austin-1.2.3-py34_2.tar.bz2", md5='0123456789', files=(), channel=channel_str, diff --git a/tests/models/test_match_spec.py b/tests/models/test_match_spec.py --- a/tests/models/test_match_spec.py +++ b/tests/models/test_match_spec.py @@ -178,17 +178,17 @@ def test_canonical_string_forms(self): assert m("numpy=1.7=py3*_2") == "numpy==1.7[build=py3*_2]" assert m("numpy=1.7.*=py3*_2") == "numpy=1.7[build=py3*_2]" - assert m("https://repo.continuum.io/pkgs/free::numpy") == "defaults::numpy" - assert m("numpy[channel=https://repo.continuum.io/pkgs/free]") == "defaults::numpy" + assert m("https://repo.anaconda.com/pkgs/free::numpy") == "defaults::numpy" + assert m("numpy[channel=https://repo.anaconda.com/pkgs/free]") == "defaults::numpy" assert m("defaults::numpy") == "defaults::numpy" assert m("numpy[channel=defaults]") == "defaults::numpy" assert m("conda-forge::numpy") == "conda-forge::numpy" assert m("numpy[channel=conda-forge]") == "conda-forge::numpy" assert m("numpy[channel=defaults,subdir=osx-64]") == "defaults/osx-64::numpy" - assert m("numpy[channel=https://repo.continuum.io/pkgs/free/osx-64, subdir=linux-64]") == "defaults/linux-64::numpy" - assert m("https://repo.continuum.io/pkgs/free/win-32::numpy") == "defaults/win-32::numpy" - assert m("numpy[channel=https://repo.continuum.io/pkgs/free/osx-64]") == "defaults/osx-64::numpy" + assert m("numpy[channel=https://repo.anaconda.com/pkgs/free/osx-64, subdir=linux-64]") == "defaults/linux-64::numpy" + assert m("https://repo.anaconda.com/pkgs/free/win-32::numpy") == "defaults/win-32::numpy" + assert m("numpy[channel=https://repo.anaconda.com/pkgs/free/osx-64]") == "defaults/osx-64::numpy" assert m("defaults/win-32::numpy") == "defaults/win-32::numpy" assert m("conda-forge/linux-64::numpy") == "conda-forge/linux-64::numpy" assert m("numpy[channel=conda-forge,subdir=noarch]") == "conda-forge/noarch::numpy" @@ -198,8 +198,8 @@ def test_canonical_string_forms(self): assert m("*/win-32::numpy[subdir=\"osx-64\"]") == 'numpy[subdir=osx-64]' # TODO: should the result in these example pull out subdir? - assert m("https://repo.continuum.io/pkgs/free/linux-32::numpy") == "defaults/linux-32::numpy" - assert m("numpy[channel=https://repo.continuum.io/pkgs/free/linux-32]") == "defaults/linux-32::numpy" + assert m("https://repo.anaconda.com/pkgs/free/linux-32::numpy") == "defaults/linux-32::numpy" + assert m("numpy[channel=https://repo.anaconda.com/pkgs/free/linux-32]") == "defaults/linux-32::numpy" assert m("numpy=1.10=py38_0") == "numpy==1.10=py38_0" assert m("numpy==1.10=py38_0") == "numpy==1.10=py38_0" @@ -280,13 +280,13 @@ def test_channel_matching(self): # it might have to for backward compatibility # but more ideally, the first would be true, and the second would be false # (or maybe it's the other way around) - assert ChannelMatch("https://repo.continuum.io/pkgs/free").match('defaults') is True - assert ChannelMatch("defaults").match("https://repo.continuum.io/pkgs/free") is True + assert ChannelMatch("https://repo.anaconda.com/pkgs/free").match('defaults') is True + assert ChannelMatch("defaults").match("https://repo.anaconda.com/pkgs/free") is True assert ChannelMatch("https://conda.anaconda.org/conda-forge").match('conda-forge') is True assert ChannelMatch("conda-forge").match("https://conda.anaconda.org/conda-forge") is True - assert ChannelMatch("https://repo.continuum.io/pkgs/free").match('conda-forge') is False + assert ChannelMatch("https://repo.anaconda.com/pkgs/free").match('conda-forge') is False def test_matchspec_errors(self): with pytest.raises(ValueError): @@ -335,13 +335,13 @@ def test_dist(self): depends=('openssl 1.0.2*', 'readline 6.2*', 'sqlite', 'tk 8.5*', 'xz 5.0.5', 'zlib 1.2*', 'pip'), channel=Channel(scheme='https', auth=None, - location='repo.continuum.io', token=None, + location='repo.anaconda.com', token=None, name='pkgs/free', platform='osx-64', package_filename=None), subdir='osx-64', fn='python-3.5.1-0.tar.bz2', md5='a813bc0a32691ab3331ac9f37125164c', size=14678857, priority=0, - url='https://repo.continuum.io/pkgs/free/osx-64/python-3.5.1-0.tar.bz2')) + url='https://repo.anaconda.com/pkgs/free/osx-64/python-3.5.1-0.tar.bz2')) def test_index_record(self): dst = Dist('defaults::foo-1.2.3-4.tar.bz2') @@ -452,7 +452,7 @@ def test_pip_style(self): class SpecStrParsingTests(TestCase): def test_parse_spec_str_tarball_url(self): - url = "https://repo.continuum.io/pkgs/free/linux-64/_license-1.1-py27_1.tar.bz2" + url = "https://repo.anaconda.com/pkgs/free/linux-64/_license-1.1-py27_1.tar.bz2" assert _parse_spec_str(url) == { "channel": "defaults", "subdir": "linux-64", @@ -502,7 +502,7 @@ def test_parse_spec_str_no_brackets(self): "channel": "defaults", "name": "numpy", } - assert _parse_spec_str("https://repo.continuum.io/pkgs/free::numpy") == { + assert _parse_spec_str("https://repo.anaconda.com/pkgs/free::numpy") == { "channel": "defaults", "name": "numpy", } diff --git a/tests/test_cli.py b/tests/test_cli.py --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -118,7 +118,7 @@ def test_search_3(self): result = stdout.replace("Loading channels: ...working... done", "") assert "file name : nose-1.3.7-py36_1.tar.bz2" in result assert "name : nose" in result - assert "url : https://repo.continuum.io/pkgs/free/linux-64/nose-1.3.7-py36_1.tar.bz2" in result + assert "url : https://repo.anaconda.com/pkgs/free/linux-64/nose-1.3.7-py36_1.tar.bz2" in result assert "md5 : f4f697f5ad4df9c8fe35357d269718a5" in result @pytest.mark.integration diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -280,7 +280,7 @@ def test_install_python2_and_search(self): assert_package_is_installed(prefix, 'python-2') # regression test for #4513 - run_command(Commands.CONFIG, prefix, "--add channels https://repo.continuum.io/pkgs/not-a-channel") + run_command(Commands.CONFIG, prefix, "--add channels https://repo.anaconda.com/pkgs/not-a-channel") stdout, stderr = run_command(Commands.SEARCH, prefix, "python --json") packages = json.loads(stdout) assert len(packages) >= 1 @@ -883,7 +883,7 @@ def test_conda_config_validate(self): def test_rpy_search(self): with make_temp_env("python=3.5") as prefix: - run_command(Commands.CONFIG, prefix, "--add channels https://repo.continuum.io/pkgs/free") + run_command(Commands.CONFIG, prefix, "--add channels https://repo.anaconda.com/pkgs/free") run_command(Commands.CONFIG, prefix, "--remove channels defaults") stdout, stderr = run_command(Commands.CONFIG, prefix, "--show", "--json") json_obj = json_loads(stdout) @@ -909,7 +909,7 @@ def test_rpy_search(self): def test_clone_offline_multichannel_with_untracked(self): with make_temp_env("python=3.5") as prefix: - run_command(Commands.CONFIG, prefix, "--add channels https://repo.continuum.io/pkgs/free") + run_command(Commands.CONFIG, prefix, "--add channels https://repo.anaconda.com/pkgs/free") run_command(Commands.CONFIG, prefix, "--remove channels defaults") run_command(Commands.INSTALL, prefix, "-c conda-test flask") @@ -1174,7 +1174,7 @@ def test_search_gawk_not_win_filter(self): with make_temp_env() as prefix: stdout, stderr = run_command( Commands.SEARCH, prefix, "*gawk", "--platform", "win-64", "--json", - "-c", "https://repo.continuum.io/pkgs/msys2 --json", + "-c", "https://repo.anaconda.com/pkgs/msys2 --json", use_exception_handler=True, ) json_obj = json_loads(stdout.replace("Fetching package metadata ...", "").strip()) diff --git a/tests/test_fetch.py b/tests/test_fetch.py --- a/tests/test_fetch.py +++ b/tests/test_fetch.py @@ -42,7 +42,7 @@ def test_tmpDownload(self): with env_var('CONDA_REMOTE_CONNECT_TIMEOUT_SECS', 1, reset_context): with env_var('CONDA_REMOTE_READ_TIMEOUT_SECS', 1, reset_context): with env_var('CONDA_REMOTE_MAX_RETRIES', 1, reset_context): - url = "https://repo.continuum.io/pkgs/free/osx-64/appscript-1.0.1-py27_0.tar.bz2" + url = "https://repo.anaconda.com/pkgs/free/osx-64/appscript-1.0.1-py27_0.tar.bz2" with TmpDownload(url) as dst: assert exists(dst) assert isfile(dst) diff --git a/tests/test_misc.py b/tests/test_misc.py --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -11,6 +11,8 @@ class TestMisc(unittest.TestCase): def test_cache_fn_url(self): url = "http://repo.continuum.io/pkgs/pro/osx-64/" self.assertEqual(cache_fn_url(url), '7618c8b6.json') + url = "http://repo.anaconda.com/pkgs/pro/osx-64/" + self.assertEqual(cache_fn_url(url), 'e42afea8.json') def test_url_pat_1(self): m = url_pat.match('http://www.cont.io/pkgs/linux-64/foo.tar.bz2'
repo.continuum.io is transitioning to repo.anaconda.com There is currently no plan to stop service at repo.continuum.io. However, at some point in the distant future, repo.continuum.io might redirect to repo.anaconda.com. This issue tracks the change for the `defaults` channel urls from repo.continuum.io to repo.anaconda.com.
2018-02-15T14:53:10
conda/conda
6,892
conda__conda-6892
[ "6882" ]
d7fd1accc4abdc084550800e71a0f620c63dad0b
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -587,7 +587,6 @@ def list_parameters(self): 'error_upload_url', # should remain undocumented 'force_32bit', 'ignore_pinned', - 'max_shlvl', 'migrated_custom_channels', 'only_dependencies', 'prune', @@ -773,6 +772,9 @@ def get_help_dict(): header. Any other positive integer values is the number of seconds to locally cache repodata before checking the remote server for an update. """), + 'max_shlvl': dals(""" + The maximum number of stacked active conda environments. + """), 'migrated_channel_aliases': dals(""" A list of previously-used channel_alias values, useful for example when switching between different Anaconda Repository instances.
Misfeature with non-installed ipython **I'm submitting a...** - [X] bug report - [ ] feature request ## Current Behavior In an environment that does not have `ipython` installed, the base version of `ipython` is still available. However, this runs in the base environment, and does not see packages specific to the local environment. This has bitten me **many** times by wasting time figuring out why an import isn't working (or why the package doesn't match the API of the version in the current environment, but rather of the version in the base environment). ### Steps to Reproduce ``` % conda create -n no-ipython humidity -c davidmertz -y # Silly example package [... creating ...] % conda activate no-ipython (no-ipython) % ipython Python 3.6.4 |Anaconda custom (64-bit)| (default, Jan 16 2018, 12:04:33) Type 'copyright', 'credits' or 'license' for more information IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: import humidity --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) <ipython-input-1-5cdf29aced62> in <module>() ----> 1 import humidity ModuleNotFoundError: No module named 'humidity' In [2]: Do you really want to exit ([y]/n)? y (no-ipython) % which ipython /Users/dmertz/anaconda3/bin/ipython (no-ipython) % conda install ipython -y [... installing ...] (no-ipython) % which ipython /Users/dmertz/anaconda3/envs/no-ipython/bin/ipython (no-ipython) % ipython Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33) Type 'copyright', 'credits' or 'license' for more information IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. In [1]: import humidity In [2]: ``` ## Expected Behavior ``` (no-ipython) % ipython # When ipython is not installed in the environment -bash: ipython: command not found ``` ## Environment Information As created in sample code... or any other environment without ipython installed.
You can do conda config --set max_shlvl 1 The default value in conda 4.4 is `2` for `max_shlvl` because it emulates what had effectively been the behavior in conda 4.3 and below, where the base environment is put on `PATH` by manually setting e.g. `export PATH="/opt/conda/bin:$PATH"` rather than `source /opt/conda/bin/activate root`. After that, `source activate` would add one additional environment on top of the base environment, but not more. That behavior was preserved in conda 4.4. `max_shlvl=1` could under certain situations (i.e. cmd.exe shell) run into issues until we have https://github.com/conda/conda/issues/6810 I guess this is more of a "mis-feature" than a bug per se. Thanks for the info on how I can fix it for myself. But I'm sure I'm not the only person to encounter this. I wonder if there's any way we could make a warning be emitted when users run a tool (but especially `ipython`) in a path in a non-local environment. I know the tool itself is just on the path, but it feels like some bash magic might be possible... something along the lines of creating an "emulated root" that spat out something to STDERR when it was accessed. Of course, I can see immediately that this is tricky. For standalone executables that don't themselves provide environment-specific shells the warning would be distracting. But even then, it's *possible* I actually mean to be using a different version of e.g. `curl` or `dot` (tools that have nothing to do with Python that are conda packages, but whose behavior might change subtly between versions), but missed that I'm actually running the "non-local" version. The intermediate situation is with `my_command_util.py` that doesn't interpret arbitrary Python statements, but *is* written in Python with imports of modules with different versions. My initial expectation would still be that I would import the "local environment" version, but that might be wrong if I forgot to include `my_command_util` in my `environment.yml` or my `conda create` line. Actually, I *cannot* do what you suggest: ```bash % conda --version; conda config --set max_shlvl 1 conda 4.4.10 CondaValueError: Key 'max_shlvl' is not a known primitive parameter. ``` Is there a typo in your command or something? Ohhh maybe I never documented that parameter. Which means you can't use `conda config --set` with it. That's for sure a bug.
2018-02-15T18:45:05
conda/conda
6,908
conda__conda-6908
[ "6900" ]
70ef29117690193a92181f2bd4e7e0ab845158ba
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 @@ -22,7 +22,7 @@ def register_env(location): location = normpath(location) - if "placehold_pl" in location: + if "placehold_pl" in location or "skeleton_" in location: # Don't record envs created by conda-build. return
don't record conda skeleton environments in environments.txt ## Current Behavior I was checking my environments by doing `conda env list` and I getting following ``` # conda environments: # base * C:\Users\aksha\Anaconda3 C:\Users\aksha\Anaconda3\conda-bld\skeleton_1516066110828\_h_env C:\Users\aksha\Anaconda3\conda-bld\skeleton_1516068338359\_h_env dj2 C:\Users\aksha\Anaconda3\envs\dj2 ml35 C:\Users\aksha\Anaconda3\envs\ml35 spikes C:\Users\aksha\Anaconda3\envs\spikes test C:\Users\aksha\Anaconda3\envs\test ``` I am not sure what `C:\Users\aksha\Anaconda3\conda-bld\skeleton_1516066110828\_h_env` and `C:\Users\aksha\Anaconda3\conda-bld\skeleton_1516068338359\_h_env`. No idea how this was created. What are they? ## Environment Information <details open><summary><code>`conda info`</code></summary><p> ``` active environment : None user config file : C:\Users\aksha\.condarc populated config files : conda version : 4.4.10 conda-build version : 3.2.2 python version : 3.6.4.final.0 base environment : C:\Users\aksha\Anaconda3 (writable) channel URLs : https://repo.continuum.io/pkgs/main/win-64 https://repo.continuum.io/pkgs/main/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 package cache : C:\Users\aksha\Anaconda3\pkgs C:\Users\aksha\AppData\Local\conda\conda\pkgs envs directories : C:\Users\aksha\Anaconda3\envs C:\Users\aksha\AppData\Local\conda\conda\envs C:\Users\aksha\.conda\envs platform : win-64 user-agent : conda/4.4.10 requests/2.18.4 CPython/3.6.4 Windows/10 Windows/10.0.16299 administrator : False 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' --> ``` None ``` </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\aksha\Anaconda3: # # Name Version Build Channel _ipyw_jlab_nb_ext_conf 0.1.0 py36he6757f0_0 defaults alabaster 0.7.10 py36hcd07829_0 defaults anaconda-navigator 1.6.9 py36hc720852_0 defaults asn1crypto 0.24.0 py36_0 defaults astroid 1.6.1 py36_0 defaults astropy 2.0.3 py36hfa6e2cd_0 defaults attrs 17.4.0 py36_0 defaults authy 2.1.5 <pip> autopep8 1.3.3 <pip> babel 2.5.3 py36_0 defaults backports 1.0 py36h81696a8_1 defaults backports.shutil_get_terminal_size 1.0.0 py36h79ab834_2 defaults beautifulsoup4 4.6.0 py36hd4cc5e8_1 defaults bitarray 0.8.1 py36hfa6e2cd_1 defaults bkcharts 0.2 py36h7e685f7_0 defaults blaze 0.11.3 py36h8a29ca5_0 defaults bleach 2.1.2 py36_0 defaults bokeh 0.12.13 py36h047fa9f_0 defaults boto 2.48.0 py36h1a776d2_1 defaults boto3 1.4.7 <pip> botocore 1.7.32 <pip> bottleneck 1.2.1 py36hd119dfa_0 defaults bzip2 1.0.6 hbe05fcf_4 defaults ca-certificates 2017.08.26 h94faf87_0 defaults cachecontrol 0.12.3 py36hfe50d7b_0 defaults certifi 2018.1.18 py36_0 defaults cffi 1.11.4 py36hfa6e2cd_0 defaults chardet 3.0.4 py36h420ce6e_1 defaults click 6.7 py36hec8c647_0 defaults cloudinary 1.8.0 <pip> cloudpickle 0.5.2 py36_1 defaults clyent 1.2.2 py36hb10d595_1 defaults colorama 0.3.9 py36h029ae33_0 defaults comtypes 1.1.4 py36_0 defaults conda 4.4.10 py36_0 defaults conda-build 3.2.2 py36_0 defaults conda-env 2.6.0 h36134e3_1 defaults conda-verify 2.0.0 py36h065de53_0 defaults console_shortcut 0.1.1 h6bb2dd7_3 defaults contextlib2 0.5.5 py36he5d52c0_0 defaults coverage 4.4.2 <pip> cryptography 2.1.4 py36he1d7878_0 defaults curl 7.58.0 h7602738_0 defaults cycler 0.10.0 py36h009560c_0 defaults cython 0.27.3 py36h22f4c84_0 defaults cytoolz 0.9.0 py36hfa6e2cd_0 defaults dask 0.16.1 py36_0 defaults dask-core 0.16.1 py36_0 defaults datashape 0.5.4 py36h5770b85_0 defaults decorator 4.2.1 py36_0 defaults distlib 0.2.5 py36h51371be_0 defaults distributed 1.20.2 py36_0 defaults Django 2.0.1 <pip> django-filer 1.2.8 <pip> django-mptt 0.8.7 <pip> django-phonenumber-field 1.3.0 <pip> django-polymorphic 1.0.2 <pip> django-storages 1.6.5 <pip> docutils 0.14 py36h6012d8f_0 defaults easy-thumbnails 2.4.2 <pip> entrypoints 0.2.3 py36hfd66bb0_2 defaults et_xmlfile 1.0.1 py36h3d2d736_0 defaults fastcache 1.0.2 py36hfa6e2cd_2 defaults feedparser 5.2.1 <pip> filelock 2.0.13 py36h20000bf_0 defaults flask 0.12.2 py36h98b5e8f_0 defaults flask-cors 3.0.3 py36h8a3855d_0 defaults freetype 2.8 vc14h17c9bdf_0 [vc14] defaults futures 3.1.1 <pip> get_terminal_size 1.0.0 h38e98db_0 defaults gevent 1.2.2 py36h342a76c_0 defaults git-url-parse 1.0.2 <pip> glob2 0.6 py36hdf76b57_0 defaults graphene 2.0.1 <pip> graphene-django 2.0.0 <pip> graphql-core 2.0 <pip> graphql-relay 0.4.5 <pip> greenlet 0.4.12 py36ha00ad21_0 defaults h5py 2.7.1 py36he54a1c3_0 defaults hdf5 1.10.1 h98b8871_1 defaults heapdict 1.0.0 py36_2 defaults html5lib 1.0.1 py36h047fa9f_0 defaults icc_rt 2017.0.4 h97af966_0 defaults icu 58.2 ha66f8fd_1 defaults idna 2.6 py36h148d497_1 defaults imageio 2.2.0 py36had6c2d2_0 defaults imagesize 0.7.1 py36he29f638_0 defaults intel-openmp 2018.0.0 hd92c6cd_8 defaults ipython 6.2.1 py36h9cf0123_1 defaults ipython_genutils 0.2.0 py36h3c5d0ee_0 defaults iso8601 0.1.12 <pip> isort 4.2.15 py36h6198cc5_0 defaults itsdangerous 0.24 py36hb6c5a24_1 defaults jdcal 1.3 py36h64a5255_0 defaults jedi 0.11.1 py36_0 defaults jinja2 2.10 py36h292fed1_0 defaults jmespath 0.9.3 <pip> jpeg 9b vc14h4d7706e_1 [vc14] defaults jsonschema 2.6.0 py36h7636477_0 defaults jupyter_client 5.2.2 py36_0 defaults jupyter_console 5.2.0 py36h6d89b47_1 defaults jupyter_core 4.4.0 py36h56e9d50_0 defaults lazy-object-proxy 1.3.1 py36hd1c21d2_0 defaults libcurl 7.58.0 h7602738_0 defaults libiconv 1.15 h1df5818_7 defaults libpng 1.6.34 h79bbb47_0 defaults libssh2 1.8.0 vc14hcf584a9_2 [vc14] defaults libtiff 4.0.9 h0f13578_0 defaults libxml2 2.9.7 h79bbb47_0 defaults libxslt 1.1.32 hf6f1972_0 defaults llvmlite 0.21.0 py36he0b0552_0 defaults locket 0.2.0 py36hfed976d_1 defaults lockfile 0.12.2 py36h0468280_0 defaults lxml 4.1.1 py36hef2cd61_1 defaults lzo 2.10 h6df0209_2 defaults m2-msys2-runtime 2.5.0.17080.65c939c 3 defaults m2-patch 2.7.5 2 defaults Markdown 2.6.9 <pip> markupsafe 1.0 py36h0e26971_1 defaults matplotlib 2.1.2 py36h016c42a_0 defaults mccabe 0.6.1 py36hb41005a_1 defaults menuinst 1.4.11 py36hfa6e2cd_0 defaults mistune 0.8.3 py36_0 defaults mkl 2018.0.1 h2108138_4 defaults mkl-service 1.1.2 py36h57e144c_4 defaults mock 2.0.0 <pip> mpmath 1.0.0 py36hacc8adf_2 defaults msgpack-python 0.5.1 py36he980bc4_0 defaults msys2-conda-epoch 20160418 1 defaults multipledispatch 0.4.9 py36he44c36e_0 defaults navigator-updater 0.1.0 py36h8a7b86b_0 defaults nbconvert 5.3.1 py36h8dc0fde_0 defaults nbformat 4.4.0 py36h3a5bc1b_0 defaults networkx 2.1 py36_0 defaults nltk 3.2.5 py36h76d52bb_0 defaults nose 1.3.7 py36h1c3779e_2 defaults numba 0.36.2 np114py36h12cb543_0 defaults numexpr 2.6.4 py36h30784b8_0 defaults numpy 1.14.0 py36h4a99626_1 defaults numpydoc 0.7.0 py36ha25429e_0 defaults odo 0.5.1 py36h7560279_0 defaults olefile 0.45.1 py36_0 defaults openpyxl 2.4.10 py36_0 defaults openssl 1.0.2n h74b6da3_0 defaults packaging 16.8 py36ha0986f6_1 defaults pandas 0.22.0 py36h6538335_0 defaults pandoc 1.19.2.1 hb2460c7_1 defaults pandocfilters 1.4.2 py36h3ef6317_1 defaults parso 0.1.1 py36hae3edee_0 defaults partd 0.3.8 py36hc8e763b_0 defaults path.py 10.5 py36h2b94a8f_0 defaults pathlib2 2.3.0 py36h7bfb78b_0 defaults patsy 0.5.0 py36_0 defaults pbr 3.1.1 <pip> pep8 1.7.1 py36_0 defaults phonenumberslite 8.8.4 <pip> pickleshare 0.7.4 py36h9de030f_0 defaults Pillow 4.3.0 <pip> pillow 5.0.0 py36h0738816_0 defaults pip 9.0.1 py36h226ae91_4 defaults pkginfo 1.4.1 py36hb0f9cfa_1 defaults pluggy 0.6.0 py36hc7daf1e_0 defaults ply 3.10 py36h1211beb_0 defaults progress 1.3 py36hbeca8d3_0 defaults promise 2.1 <pip> prompt_toolkit 1.0.15 py36h60b8f86_0 defaults psutil 5.4.3 py36hfa6e2cd_0 defaults psycopg2 2.7.3.1 <pip> py 1.5.2 py36hbcfbabc_0 defaults pycodestyle 2.3.1 py36h7cc55cd_0 defaults pycosat 0.6.3 py36h413d8a4_0 defaults pycparser 2.18 py36hd053e01_1 defaults pycrypto 2.6.1 py36hfa6e2cd_7 defaults pycurl 7.43.0.1 py36h74b6da3_0 defaults pyflakes 1.6.0 py36h0b975d6_0 defaults pygments 2.2.0 py36hb010967_0 defaults pylint 1.8.2 py36_0 defaults pyodbc 4.0.22 py36h6538335_0 defaults pyopenssl 17.5.0 py36h5b7d817_0 defaults pypandoc 1.4 py36_0 defaults pypandoc 1.4 <pip> pyparsing 2.2.0 py36h785a196_1 defaults pyqt 5.6.0 py36hb5ed885_5 defaults pysocks 1.6.7 py36h698d350_1 defaults pyspin 1.1.1 <pip> pytables 3.4.2 py36h71138e3_2 defaults pytest 3.3.2 py36_0 defaults pytest-cov 2.5.1 <pip> pytest-mock 1.6.3 <pip> pytest-runner 3.0 <pip> python 3.6.4 h6538335_1 defaults python-dateutil 2.6.1 py36h509ddcb_1 defaults pytz 2017.3 py36h1d3fa6b_0 defaults pytz 2017.3 <pip> pywavelets 0.5.2 py36hc649158_0 defaults pywin32 222 py36hfa6e2cd_0 defaults pywinpty 0.5 py36h6538335_1 defaults pyyaml 3.12 py36h1d1928f_1 defaults pyzmq 16.0.3 py36he714bf5_0 defaults qt 5.6.2 vc14h6f8c307_12 [vc14] defaults qtawesome 0.4.4 py36h5aa48f6_0 defaults qtconsole 4.3.1 py36h99a29a9_0 defaults qtpy 1.3.1 py36hb8717c5_0 defaults release-exporter 1.0.3 <pip> requests 2.18.4 py36h4371aae_1 defaults requests-toolbelt 0.8.0 <pip> restructuredtext-lint 1.1.2 <pip> rope 0.10.7 py36had63a69_0 defaults rstcheck 3.1 <pip> ruamel_yaml 0.15.35 py36hfa6e2cd_1 defaults Rx 1.6.0 <pip> s3transfer 0.1.11 <pip> scikit-learn 0.19.1 py36h53aea1b_0 defaults scipy 1.0.0 py36h1260518_0 defaults seaborn 0.8.1 py36h9b69545_0 defaults send2trash 1.4.2 py36_0 defaults setuptools 38.4.0 py36_0 defaults simplegeneric 0.8.1 py36_2 defaults simplejson 3.11.1 <pip> singledispatch 3.4.0.3 py36h17d0c80_0 defaults singlemodeladmin 0.7 <pip> sip 4.18.1 py36h9c25514_2 defaults six 1.11.0 <pip> six 1.11.0 py36h4db2310_1 defaults snowballstemmer 1.2.1 py36h763602f_0 defaults sortedcollections 0.5.3 py36hbefa0ab_0 defaults sortedcontainers 1.5.9 py36_0 defaults sphinxcontrib 1.0 py36hbbac3d2_1 defaults sphinxcontrib-websupport 1.0.1 py36hb5e5916_1 defaults sqlalchemy 1.2.1 py36hfa6e2cd_0 defaults sqlite 3.22.0 h9d3ae62_0 defaults statsmodels 0.8.0 py36h6189b4c_0 defaults sympy 1.1.1 py36h96708e0_0 defaults tabulate 0.8.2 <pip> tblib 1.3.2 py36h30f5020_0 defaults terminado 0.8.1 py36_1 defaults testpath 0.3.1 py36h2698cfe_0 defaults tk 8.6.7 hcb92d03_3 defaults toolz 0.9.0 py36_0 defaults tornado 4.5.3 py36_0 defaults tqdm 4.19.4 <pip> traitlets 4.3.2 py36h096827d_0 defaults twine 1.9.1 <pip> typing 3.6.2 py36hb035bda_0 defaults unicodecsv 0.14.1 py36h6450c06_0 defaults Unidecode 0.04.21 <pip> urllib3 1.22 py36h276f60a_0 defaults vc 14 h0510ff6_3 defaults vs2015_runtime 14.0.25123 3 defaults wcwidth 0.1.7 py36h3d5aa90_0 defaults webencodings 0.5.1 py36h67c50ae_1 defaults werkzeug 0.14.1 py36_0 defaults wheel 0.30.0 py36h6c3ec14_1 defaults whitenoise 3.3.1 <pip> win_inet_pton 1.0.1 py36he67d7fd_1 defaults win_unicode_console 0.5 py36hcdbd4b5_0 defaults wincertstore 0.2 py36h7fe50ca_0 defaults winpty 0.4.3 4 defaults wrapt 1.10.11 py36he5f5981_0 defaults xlrd 1.1.0 py36h1cb58dc_1 defaults xlsxwriter 1.0.2 py36hf723b7d_0 defaults xlwings 0.11.5 py36_0 defaults xlwt 1.3.0 py36h1a4751e_0 defaults yaml 0.1.7 vc14hb31d195_1 [vc14] defaults zict 0.1.3 py36h2d8e73e_0 defaults zlib 1.2.11 h8395fce_2 defaults ``` </p></details>
They're created with the `conda skeleton` command I'm guessing.
2018-02-21T17:36:21
conda/conda
6,911
conda__conda-6911
[ "6910" ]
70ef29117690193a92181f2bd4e7e0ab845158ba
diff --git a/conda/models/index_record.py b/conda/models/index_record.py --- a/conda/models/index_record.py +++ b/conda/models/index_record.py @@ -229,7 +229,8 @@ def schannel(self): @property def _pkey(self): - return self.channel.canonical_name, self.subdir, self.name, self.version, self.build + return (self.channel.canonical_name, self.subdir, self.name, self.version, + self.build_number, self.build) def __hash__(self): return hash(self._pkey)
conda 4.4 sort key prioritizes build string over build number
2018-02-21T21:42:11
conda/conda
6,918
conda__conda-6918
[ "6192" ]
b5f1309be0b8aadefbe82c16a921a72d34695c93
diff --git a/conda/cli/main_help.py b/conda/cli/main_help.py --- a/conda/cli/main_help.py +++ b/conda/cli/main_help.py @@ -5,7 +5,6 @@ # Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause. from __future__ import absolute_import, division, print_function, unicode_literals -import subprocess import sys @@ -13,4 +12,7 @@ def execute(args, parser): if not args.command: parser.print_help() return - subprocess.call([sys.executable, sys.argv[0], args.command, '-h']) # pragma: no cover + print("ERROR: The 'conda help' command is deprecated.\n" + "Instead use 'conda %s --help'." % args.command, + file=sys.stderr) + return 1
deprecate 'conda help' in favor of --help CLI flag With the install on Windows 10: _platform : win-64 conda version : 4.3.30 conda is private : False conda-env version : 4.3.30 conda-build version : 3.0.22 python version : 3.6.3.final.0 requests version : 2.18.4 root environment : C:\Anaconda3 (writable)_ the command: `conda help install` (or other similar, say, conda help create, etc.) produces the message `C:\Anaconda3\python.exe: can't open file 'C:\Anaconda3\Scripts\conda': [Errno 2] No such file or directory` This syntax works under Linux (Ubuntu), but of course, there is no just "conda" file in Windows Anaconda Scripts.
I also noticed this issue today. It is very annoying, hope it gets solved soon. ``` Current conda install: platform : win-64 conda version : 4.3.30 conda is private : False conda-env version : 4.3.30 conda-build version : 3.0.27 python version : 3.6.3.final.0 requests version : 2.18.4 user-agent : conda/4.3.30 requests/2.18.4 CPython/3.6.3 Windows/10 Windows/10.0.15063 ```
2018-02-22T13:28:38
conda/conda
6,921
conda__conda-6921
[ "6920" ]
70ef29117690193a92181f2bd4e7e0ab845158ba
diff --git a/conda/core/index.py b/conda/core/index.py --- a/conda/core/index.py +++ b/conda/core/index.py @@ -4,7 +4,7 @@ from itertools import chain from logging import getLogger -from .linked_data import linked_data +from .linked_data import PrefixData, linked_data from .package_cache import PackageCache from .repodata import SubdirData, make_feature_record from .._vendor.boltons.setutils import IndexedSet @@ -196,12 +196,16 @@ def push_spec(spec): pending_track_features.add(ftr_name) def push_record(record): + push_spec(MatchSpec(record.name)) for _spec in record.combined_depends: push_spec(_spec) if record.track_features: for ftr_name in record.track_features: push_spec(MatchSpec(track_features=ftr_name)) + if prefix: + for prefix_rec in PrefixData(prefix).iter_records(): + push_record(prefix_rec) for spec in specs: push_spec(spec)
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -683,10 +683,22 @@ def test_tarball_install_and_bad_metadata(self): assert not package_is_installed(prefix, 'flask', exact=True) assert_package_is_installed(prefix, 'flask-0.') + def test_update_with_pinned_packages(self): + # regression test for #6914 + with make_temp_env("python=2.7.12") as prefix: + assert package_is_installed(prefix, "readline-6.2") + rm_rf(join(prefix, 'conda-meta', 'history')) + PrefixData._cache_.clear() + run_command(Commands.UPDATE, prefix, "readline") + assert package_is_installed(prefix, "readline") + assert not package_is_installed(prefix, "readline-6.2") + assert package_is_installed(prefix, "python-2.7") + assert not package_is_installed(prefix, "python-2.7.12") + def test_remove_all(self): - with make_temp_env("python=2") as prefix: + with make_temp_env("python") as prefix: assert exists(join(prefix, PYTHON_BINARY)) - assert_package_is_installed(prefix, 'python-2') + assert_package_is_installed(prefix, 'python') run_command(Commands.REMOVE, prefix, '--all') assert not exists(prefix)
conda 4.4 can fail to update packages For example, start with a fresh install of Anaconda3, and then `conda update anaconda-client` doesn't update, even though a new anaconda-client package exists.
2018-02-22T19:08:48
conda/conda
6,923
conda__conda-6923
[ "6810" ]
7e8cb610b1463d7532a88649c740635aaa8fd0c4
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -244,6 +244,7 @@ def build_activate(self, env_name_or_prefix): new_path = self.pathsep_join(self._add_prefix_to_path(prefix)) export_vars = { 'CONDA_PYTHON_EXE': self.path_conversion(sys.executable), + 'CONDA_EXE': self.path_conversion(context.conda_exe), 'PATH': new_path, 'CONDA_PREFIX': prefix, 'CONDA_SHLVL': old_conda_shlvl + 1, @@ -313,6 +314,7 @@ def build_deactivate(self): 'CONDA_PREFIX', 'CONDA_DEFAULT_ENV', 'CONDA_PYTHON_EXE', + 'CONDA_EXE', 'CONDA_PROMPT_MODIFIER', ) export_vars = { diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -479,6 +479,12 @@ def root_prefix(self): def conda_prefix(self): return normpath(sys.prefix) + @property + def conda_exe(self): + bin_dir = 'Scripts' if on_win else 'bin' + exe = 'conda.exe' if on_win else 'conda' + return join(self.conda_prefix, bin_dir, exe) + @memoizedproperty def channel_alias(self): from ..models.channel import Channel
diff --git a/tests/test_activate.py b/tests/test_activate.py --- a/tests/test_activate.py +++ b/tests/test_activate.py @@ -189,6 +189,7 @@ def test_build_activate_shlvl_0(self): } export_vars = { 'CONDA_PYTHON_EXE': activator.path_conversion(sys.executable), + 'CONDA_EXE': activator.path_conversion(context.conda_exe), 'PATH': new_path, 'CONDA_PREFIX': td, 'CONDA_SHLVL': 1, @@ -380,6 +381,7 @@ def test_build_deactivate_shlvl_1(self): 'CONDA_PREFIX', 'CONDA_DEFAULT_ENV', 'CONDA_PYTHON_EXE', + 'CONDA_EXE', 'CONDA_PROMPT_MODIFIER', ) @@ -460,6 +462,7 @@ def test_posix_basic(self): assert activate_data == dals(""" PS1='%(ps1)s' \\export CONDA_DEFAULT_ENV='%(native_prefix)s' + \\export CONDA_EXE='%(conda_exe)s' \\export CONDA_PREFIX='%(native_prefix)s' \\export CONDA_PROMPT_MODIFIER='(%(native_prefix)s) ' \\export CONDA_PYTHON_EXE='%(sys_executable)s' @@ -472,7 +475,8 @@ def test_posix_basic(self): 'new_path': activator.pathsep_join(new_path_parts), 'sys_executable': activator.path_conversion(sys.executable), 'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.sh')), - 'ps1': '(%s) ' % self.prefix + os.environ.get('PS1', '') + 'ps1': '(%s) ' % self.prefix + os.environ.get('PS1', ''), + 'conda_exe': activator.path_conversion(context.conda_exe), } with env_vars({ @@ -513,6 +517,7 @@ def test_posix_basic(self): assert deactivate_data == dals(""" \\. "%(deactivate1)s" \\unset CONDA_DEFAULT_ENV + \\unset CONDA_EXE \\unset CONDA_PREFIX \\unset CONDA_PROMPT_MODIFIER \\unset CONDA_PYTHON_EXE @@ -543,6 +548,7 @@ def test_cmd_exe_basic(self): new_path_parts = activator._add_prefix_to_path(self.prefix) assert activate_data == dals(""" @SET "CONDA_DEFAULT_ENV=%(native_prefix)s" + @SET "CONDA_EXE=%(conda_exe)s" @SET "CONDA_PREFIX=%(converted_prefix)s" @SET "CONDA_PROMPT_MODIFIER=(%(native_prefix)s) " @SET "CONDA_PYTHON_EXE=%(sys_executable)s" @@ -557,6 +563,7 @@ def test_cmd_exe_basic(self): 'sys_executable': activator.path_conversion(sys.executable), 'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.bat')), 'PYTHONIOENCODING': PYTHONIOENCODING, + 'conda_exe': activator.path_conversion(context.conda_exe), } with env_vars({ @@ -601,6 +608,7 @@ def test_cmd_exe_basic(self): assert deactivate_data == dals(""" @CALL "%(deactivate1)s" @SET CONDA_DEFAULT_ENV= + @SET CONDA_EXE= @SET CONDA_PREFIX= @SET CONDA_PROMPT_MODIFIER= @SET CONDA_PYTHON_EXE= @@ -625,6 +633,7 @@ def test_csh_basic(self): assert activate_data == dals(""" set prompt='%(prompt)s'; setenv CONDA_DEFAULT_ENV "%(native_prefix)s"; + setenv CONDA_EXE "%(conda_exe)s"; setenv CONDA_PREFIX "%(native_prefix)s"; setenv CONDA_PROMPT_MODIFIER "(%(native_prefix)s) "; setenv CONDA_PYTHON_EXE "%(sys_executable)s"; @@ -637,7 +646,8 @@ def test_csh_basic(self): 'new_path': activator.pathsep_join(new_path_parts), 'sys_executable': activator.path_conversion(sys.executable), 'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.csh')), - 'prompt': '(%s) ' % self.prefix + os.environ.get('prompt', '') + 'prompt': '(%s) ' % self.prefix + os.environ.get('prompt', ''), + 'conda_exe': activator.path_conversion(context.conda_exe), } with env_vars({ @@ -678,6 +688,7 @@ def test_csh_basic(self): assert deactivate_data == dals(""" source "%(deactivate1)s"; unset CONDA_DEFAULT_ENV; + unset CONDA_EXE; unset CONDA_PREFIX; unset CONDA_PROMPT_MODIFIER; unset CONDA_PYTHON_EXE; @@ -707,6 +718,7 @@ def test_xonsh_basic(self): new_path_parts = activator._add_prefix_to_path(self.prefix) assert activate_data == dals(""" $CONDA_DEFAULT_ENV = '%(native_prefix)s' + $CONDA_EXE = '%(conda_exe)s' $CONDA_PREFIX = '%(native_prefix)s' $CONDA_PROMPT_MODIFIER = '(%(native_prefix)s) ' $CONDA_PYTHON_EXE = '%(sys_executable)s' @@ -719,6 +731,7 @@ def test_xonsh_basic(self): 'new_path': activator.pathsep_join(new_path_parts), 'sys_executable': activator.path_conversion(sys.executable), 'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.xsh')), + 'conda_exe': activator.path_conversion(context.conda_exe), } with env_vars({ @@ -763,6 +776,7 @@ def test_xonsh_basic(self): assert deactivate_data == dals(""" source "%(deactivate1)s" del $CONDA_DEFAULT_ENV + del $CONDA_EXE del $CONDA_PREFIX del $CONDA_PROMPT_MODIFIER del $CONDA_PYTHON_EXE @@ -786,6 +800,7 @@ def test_fish_basic(self): new_path_parts = activator._add_prefix_to_path(self.prefix) assert activate_data == dals(""" set -gx CONDA_DEFAULT_ENV "%(native_prefix)s"; + set -gx CONDA_EXE "%(conda_exe)s"; set -gx CONDA_PREFIX "%(native_prefix)s"; set -gx CONDA_PROMPT_MODIFIER "(%(native_prefix)s) "; set -gx CONDA_PYTHON_EXE "%(sys_executable)s"; @@ -798,6 +813,7 @@ def test_fish_basic(self): 'new_path': activator.pathsep_join(new_path_parts), 'sys_executable': activator.path_conversion(sys.executable), 'activate1': activator.path_conversion(join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.fish')), + 'conda_exe': activator.path_conversion(context.conda_exe), } with env_vars({ @@ -836,6 +852,7 @@ def test_fish_basic(self): assert deactivate_data == dals(""" source "%(deactivate1)s"; set -e CONDA_DEFAULT_ENV; + set -e CONDA_EXE; set -e CONDA_PREFIX; set -e CONDA_PROMPT_MODIFIER; set -e CONDA_PYTHON_EXE; @@ -860,6 +877,7 @@ def test_powershell_basic(self): new_path_parts = activator._add_prefix_to_path(self.prefix) assert activate_data == dals(""" $env:CONDA_DEFAULT_ENV = "%(prefix)s" + $env:CONDA_EXE = "%(conda_exe)s" $env:CONDA_PREFIX = "%(prefix)s" $env:CONDA_PROMPT_MODIFIER = "(%(prefix)s) " $env:CONDA_PYTHON_EXE = "%(sys_executable)s" @@ -870,7 +888,8 @@ def test_powershell_basic(self): 'prefix': self.prefix, 'new_path': activator.pathsep_join(new_path_parts), 'sys_executable': sys.executable, - 'activate1': join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.ps1') + 'activate1': join(self.prefix, 'etc', 'conda', 'activate.d', 'activate1.ps1'), + 'conda_exe': context.conda_exe, } with env_vars({ @@ -909,6 +928,7 @@ def test_powershell_basic(self): assert deactivate_data == dals(""" . "%(deactivate1)s" Remove-Variable CONDA_DEFAULT_ENV + Remove-Variable CONDA_EXE Remove-Variable CONDA_PREFIX Remove-Variable CONDA_PROMPT_MODIFIER Remove-Variable CONDA_PYTHON_EXE
Conda (4.4): 'No such file or directory' in a new environment using non-shell process <!-- 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...** (I don't know whether it is a bug or feature) - [x] bug report - [x] feature request ## Current Behavior <!-- What actually happens? If you want to include console output, please use "Steps to Reproduce" below. --> ### 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. --> Create an environment, 'test' using Conda 4.4, open a new tab and directly activate that environment. Now try to invoke conda commands using any non shell program (lua/python/java/....) it will error out saying `conda: command not found` or `No such file or directory` since they can't `exec()` that. ## Expected Behavior <!-- What do you think should happen? --> The program invoking conda should not error out, or should have a way to figure out where the conda program resides, so that it can exec the full `/path/to/conda`. Currently the only thing close to this is `$_CONDA_EXE`, but it is not documented, and also not exported, so not available to child processes and no guarantee whether it will be available in future releases. The current work around is to first activate the base environment and then activate the non-base environment in the same shell session, which for whatever reason, retains the root environment's bin directory in the PATH.
In conda 4.4, posix shells should be initialized via `. <CONDA_BASE_PREFIX>/etc/profile.d/conda.sh` in a `~/.bashrc` file, etc. One way to do this right now, is to exec(): ``` os.environ['CONDA_PYTHON_EXE'] -m conda <conda arguments> ``` I think we just need to add a `CONDA_EXE` environment variable alongside the `CONDA_PYTHON_EXE` environment variable management in `conda/activate.py`. I didn't get at first, what was requested, but essentially it's the following difference: ```bash $ (. etc/profile.d/conda.sh && conda activate base && conda --version) conda 4.4.9 $ (. etc/profile.d/conda.sh && conda activate env && conda --version) conda 4.4.9 $ (. etc/profile.d/conda.sh && conda activate base && bash -c 'conda --version') conda 4.4.9 $ (. etc/profile.d/conda.sh && conda activate env && bash -c 'conda --version') bash: conda: command not found ``` In the last case the `base` environment (and thus `conda`) isn't on `PATH` (which is a nice `4.4` feature, IMHO!) and we're not trying to run `conda` in a `bash` instance that has the `conda` shell function available; i.e. that `bash -c` represents one arbitrary program that tries to run `conda`. To me it would make sense to have a `$PREFIX/bin/conda` script in each environment which would `exec` the `base` `conda`. Those scripts could be made into a package, e.g., called something like `conda-launcher`/`conda-scripts`/???. The problem with that would be that, as of know, non-`base` environment have (on their own) no knowledge of the `base` prefix. So you'd either have to use that `CONDA_PYTHON_EXE` workaround with something like: ```bash #!/bin/bash exec "$CONDA_PYTHON_EXE" -m conda "${@}" ``` or hardcode the base prefix at install time. As for the former, I don't think there are guarantees that `CONDA_PYTHON_EXE` must be available (and I would rather have `conda` be called instead of that "Python implementation detail"). For the latter, I don't think the base prefix is exposed to post-link scripts or the like. A third possibility would to always put some directory from `base` on `PATH` that contains some `conda` even if a non-`base` environment is activated. Preferably (to retain that `4.4` feature) this wouldn't be `$CONDA_ROOT/bin` so that only `conda` but nothing else pollutes `PATH`. In any case (and if I'm not mistaken -- which could very well be) I think a change `conda` would be needed for this feature. \[EDIT: Just to clarify, I'm with @mingwandroid regarding that third possibility; it's a possibility, but definitely not a good one!\] > I think we just need to add a `CONDA_EXE` environment variable That would be much preferred in lieu of `CONDA_PYTHON_EXE`, yes! > To me it would make sense to have a $PREFIX/bin/conda script in each environment which would exec the base conda. I hadn't thought of that option. I'm going to think more about it. > A third possibility would to always put some directory from base on PATH that contains some conda even if a non-base environment is activated. I *had* thought of that option. And was thinking about implementing it as part of https://github.com/conda/conda/pull/6518. It would be similar to what the GitBash installer does on Windows. It's been a while, and I don't remember the exact details, but there's an option in the installer that ends up putting the GitBash executables in a separate `cmd` directory, and then adds that directory to the system-configured `PATH`. So, when a shell is at `CONDA_SHLVL` `0`, e.g. right after `conda.sh` is sourced, we'd at that point modify PATH with only that special directory. > A third possibility would to always put some directory from base on PATH that contains some conda even if a non-base environment is activated Please, no. I think having a smart conda executable in every conda environment probably makes the most sense. I think we're going to run into unanticipated problems with that though too. For example, I had a problem with `os.execv()` on Windows. See https://github.com/conda/conda/issues/6607 I guess one edge case would be users expecting to have `conda activate` available when hitting this executable, which it wouldn't be, because we're hitting the executable rather than the shell function. We probably just need to have clear messaging there explaining the problem. > because we're hitting the executable rather than the shell function At least in `bash` I think the shell function takes precedence. The way to implement this is to create a new `PathAction` that creates this stub executable if it doesn't exist. We need to watch out for a gotcha with the `reverse()` method, because something that triggers `reverse()` on `conda create` should remove the file, while something that triggers `reverse()` on `conda install` probably shouldn't. Basically, we need a flag in the `execute()` method to indicate whether the file was created, or whether it already existed. If it was newly created, `reverse()` should just remove it. > At least in bash I think the shell function takes precedence. I think it always does for all shells I know of that support functions and aliases. The problem will be encountered when you're not interacting with conda through a shell though. If all we're doing is adding a new environment variable to be managed alongside `CONDA_PYTHON_EXE`, I consider that an enhancement, which can go into any patch release. If we're adding a new `PathAction`, I consider that a feature which will need to wait for a feature release. > The problem will be encountered when you're not interacting with conda through a shell though. Since `conda activate`'s job is to modify the shell's environment in currently runs in, a user should *not* \[/EDIT\] expect anything if they run it in a non-shell context 😉 -- but outputting an appropriate error message never hurts. > If we're adding a new `PathAction`, I consider that a feature which will need to wait for a feature release. Yes, please. If such a change will be added at some time, I'll have to remember to ping @bgruening about this; in Bioconda, for each package a Docker [Biocontainer](https://biocontainers.pro/) is created -- so this would be a use case where we would *not* \[/EDIT\] want such a launcher. Well, I think I'm already too much in the `4.4.x` mindset and only now realize/remember that with `4.3.x` we have ```bash $ . bin/activate (root) $ conda --version conda 4.3.34 (root) $ conda create -qynempty Package plan for installation in environment /home/maba/code/conda/conda-forge/envs/empty: (root) $ ls -la envs/empty/bin/ total 8 drwx------ 2 maba maba 4096 Feb 14 20:00 . drwx------ 4 maba maba 4096 Feb 14 20:00 .. lrwxrwxrwx 1 maba maba 46 Feb 14 20:00 activate -> /home/maba/code/conda/conda-forge/bin/activate lrwxrwxrwx 1 maba maba 43 Feb 14 20:00 conda -> /home/maba/code/conda/conda-forge/bin/conda lrwxrwxrwx 1 maba maba 48 Feb 14 20:00 deactivate -> /home/maba/code/conda/conda-forge/bin/deactivate ``` . So bringing back the `conda` symlink wouldn't be such an unexpected thing. Some could even categorize its absence as a regression in 4.4, I guess. I think I favor a specific directory containing only a conda executable that we add to PATH when we first initialize the shell (e.g. source `conda.sh`), rather than making some type of brittle pointer to where conda is supposed to live in the environment at environment creation time. However I know Ray prefers the latter. Another thing to be aware of here... Conda 4.4 lifted the restriction that conda could only be installed in the base environment. That restriction came about because of the symlinking behavior on activate, and now that we're not doing that, we also don't need the restriction. Since there's been a strong driver for conda to be both an *application* and a *library* (with the push to have stable internal APIs), lifting the restriction makes sense. As a future improvement, it might make sense for conda *not* to include the `bin/conda` entry point when conda isn't installed into the base environment, to further enforce it's use as a library in non-base envs. The only solution I like so far: >I think we just need to add a CONDA_EXE environment variable I can't think of any any downsides with it. It's agnostic of: - Whether it is going to be used by a shell or a non-shell program - Whether conda is implemented in python or rust or go or whatever - What platform is going to use it Plus, it is probably easier to maintain across future releases and we'll also need to guarantee that we don't break it.
2018-02-22T22:43:47
conda/conda
6,928
conda__conda-6928
[ "6860" ]
34b41dd8f397796c3f9b3c290022aa703f28b7e1
diff --git a/conda/models/index_record.py b/conda/models/index_record.py --- a/conda/models/index_record.py +++ b/conda/models/index_record.py @@ -96,6 +96,7 @@ def __init__(self, **kwargs): def box(self, instance, instance_type, val): if isinstance(val, string_types): val = val.replace(' ', ',').split(',') + val = tuple(f for f in (ff.strip() for ff in val) if f) return super(_FeaturesField, self).box(instance, instance_type, val) def dump(self, instance, instance_type, val): 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 @@ -680,14 +680,14 @@ def __init__(self, value): super(FeatureMatch, self).__init__(self._convert(value)) def _convert(self, value): - if isinstance(value, frozenset): - return value - elif not value: + if not value: return frozenset() elif isinstance(value, string_types): - return frozenset(value.replace(' ', ',').split(',')) + return frozenset(f for f in ( + ff.strip() for ff in value.replace(' ', ',').split(',') + ) if f) else: - return frozenset(value) + return frozenset(f for f in (ff.strip() for ff in value) if f) def match(self, other): other = self._convert(other) diff --git a/conda/resolve.py b/conda/resolve.py --- a/conda/resolve.py +++ b/conda/resolve.py @@ -460,7 +460,9 @@ def push_MatchSpec(self, C, spec): simple = spec._is_single() nm = spec.get_exact_value('name') - tf = spec.get_exact_value('track_features') + tf = frozenset(_tf for _tf in ( + f.strip() for f in spec.get_exact_value('track_features') or () + ) if _tf) if nm: tgroup = libs = self.groups.get(nm, [])
diff --git a/tests/models/test_match_spec.py b/tests/models/test_match_spec.py --- a/tests/models/test_match_spec.py +++ b/tests/models/test_match_spec.py @@ -368,32 +368,43 @@ def test_build_number_and_filename(self): assert ms.get_exact_value('build') == '0' assert ms._to_filename_do_not_use() == 'zlib-1.2.7-0.tar.bz2' - @pytest.mark.skip(reason="key-value features interface disabled in conda 4.4") - def test_key_value_features_match(self): + def test_track_features_match(self): dst = Dist('defaults::foo-1.2.3-4.tar.bz2') a = MatchSpec(features='test') - assert text_type(a) == "*[provides_features='test=true']" + assert text_type(a) == "*[features=test]" assert not a.match(DPkg(dst)) assert not a.match(DPkg(dst, track_features='')) + + a = MatchSpec(track_features='test') assert a.match(DPkg(dst, track_features='test')) assert not a.match(DPkg(dst, track_features='test2')) - assert a.match(DPkg(dst, track_features='test me')) - assert a.match(DPkg(dst, track_features='you test')) - assert a.match(DPkg(dst, track_features='you test me')) - assert a.get_exact_value('provides_features') == frozendict({'test': 'true'}) + assert not a.match(DPkg(dst, track_features='test me')) + assert not a.match(DPkg(dst, track_features='you test')) + assert not a.match(DPkg(dst, track_features='you test me')) + assert a.get_exact_value('track_features') == frozenset(('test',)) - b = MatchSpec(features='mkl') + b = MatchSpec(track_features='mkl') assert not b.match(DPkg(dst)) assert b.match(DPkg(dst, track_features='mkl')) - assert b.match(DPkg(dst, track_features='blas=mkl')) - assert b.match(DPkg(dst, track_features='blas=mkl debug')) + assert b.match(DPkg(dst, track_features='mkl')) + assert not b.match(DPkg(dst, track_features='mkl debug')) assert not b.match(DPkg(dst, track_features='debug')) - c = MatchSpec(features='nomkl') + c = MatchSpec(track_features='nomkl') assert not c.match(DPkg(dst)) assert not c.match(DPkg(dst, track_features='mkl')) assert c.match(DPkg(dst, track_features='nomkl')) - assert c.match(DPkg(dst, track_features='blas=nomkl debug')) + assert not c.match(DPkg(dst, track_features='nomkl debug')) + + # regression test for #6860 + d = MatchSpec(track_features='') + assert d.get_exact_value('track_features') == frozenset() + d = MatchSpec(track_features=' ') + assert d.get_exact_value('track_features') == frozenset() + d = MatchSpec(track_features=('', '')) + assert d.get_exact_value('track_features') == frozenset() + d = MatchSpec(track_features=('', '', 'test')) + assert d.get_exact_value('track_features') == frozenset(('test',)) def test_bracket_matches(self): record = {
Infinite recursion in solver with blank string in features I stumbled over this accidentally. <!-- 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. --> ``` (base) [nwani@centos7-nwani scratch]$ conda install scratch -c local Solving environment: failed # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/home/nwani/m2/lib/python2.7/site-packages/conda/exceptions.py", line 789, in __call__ return func(*args, **kwargs) File "/home/nwani/m2/lib/python2.7/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/home/nwani/m2/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 77, in do_call exit_code = getattr(module, func_name)(args, parser) File "/home/nwani/m2/lib/python2.7/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/home/nwani/m2/lib/python2.7/site-packages/conda/cli/install.py", line 236, in install force_reinstall=context.force, File "/home/nwani/m2/lib/python2.7/site-packages/conda/core/solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "/home/nwani/m2/lib/python2.7/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/nwani/m2/lib/python2.7/site-packages/conda/core/solve.py", line 317, in solve_final_state conflicting_specs = r.get_conflicting_specs(tuple(final_environment_specs)) File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 705, in get_conflicting_specs C = r2.gen_clauses() File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 505, in gen_clauses C.Require(C.Or, nkey, self.push_MatchSpec(C, ms)) File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 477, in push_MatchSpec m = C.from_name(self.push_MatchSpec(C, ms2)) File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 477, in push_MatchSpec m = C.from_name(self.push_MatchSpec(C, ms2)) ...yada... ...yada... ...yada... File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 477, in push_MatchSpec m = C.from_name(self.push_MatchSpec(C, ms2)) File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 477, in push_MatchSpec m = C.from_name(self.push_MatchSpec(C, ms2)) File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 477, in push_MatchSpec m = C.from_name(self.push_MatchSpec(C, ms2)) File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 476, in push_MatchSpec ms2 = MatchSpec(track_features=tf) if tf else MatchSpec(nm) File "/home/nwani/m2/lib/python2.7/site-packages/conda/models/match_spec.py", line 76, in __call__ return super(MatchSpecType, cls).__call__(**kwargs) File "/home/nwani/m2/lib/python2.7/site-packages/conda/models/match_spec.py", line 178, in __init__ self._match_components = self._build_components(**kwargs) File "/home/nwani/m2/lib/python2.7/site-packages/conda/models/match_spec.py", line 365, in _build_components return frozendict(_make(key, value) for key, value in iteritems(kwargs)) File "/home/nwani/m2/lib/python2.7/collections.py", line 69, in __init__ self.__update(*args, **kwds) File "/home/nwani/m2/lib/python2.7/_abcoll.py", line 564, in update if isinstance(other, Mapping): File "/home/nwani/m2/lib/python2.7/abc.py", line 141, in __instancecheck__ subtype in cls._abc_negative_cache): File "/home/nwani/m2/lib/python2.7/_weakrefset.py", line 75, in __contains__ return wr in self.data RuntimeError: maximum recursion depth exceeded in cmp `$ /home/nwani/m2/bin/conda install scratch -c local` environment variables: CIO_TEST=<not set> CONDA_DEFAULT_ENV=base CONDA_PREFIX=/home/nwani/m2 CONDA_PROMPT_MODIFIER=(base) CONDA_PYTHON_EXE=/home/nwani/m2/bin/python CONDA_ROOT=/home/nwani/m2 CONDA_SHLVL=1 PATH=/home/nwani/m2/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/ home/nwani/.local/bin:/home/nwani/bin REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> active environment : base active env location : /home/nwani/m2 shell level : 1 user config file : /home/nwani/.condarc populated config files : conda version : 4.4.9 conda-build version : 3.4.1 python version : 2.7.14.final.0 base environment : /home/nwani/m2 (writable) channel URLs : file:///home/nwani/m2/conda-bld/linux-64 file:///home/nwani/m2/conda-bld/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/nwani/m2/pkgs /home/nwani/.conda/pkgs envs directories : /home/nwani/m2/envs /home/nwani/.conda/envs platform : linux-64 user-agent : conda/4.4.9 requests/2.18.4 CPython/2.7.14 Linux/3.10.0-693.5.2.el7.x86_64 centos/7 glibc/2.17 UID:GID : 1001:1001 netrc file : None offline mode : False An unexpected error has occurred. Conda has prepared the above report. If submitted, this report will be used by core maintainers to improve future releases of conda. Would you like conda to send this report to the core maintainers? [y/N]: y Upload did not complete. Thank you for helping to improve conda. Opt-in to always sending reports (and not see this message again) by running $ conda config --set report_errors true ``` ### 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. --> Create a conda package with the following recipe (although the recipe is incorrect, nothing complained): ``` package: name: scratch version: 1.0.0 build: features: - ``` ## Expected Behavior <!-- What do you think should happen? --> 1. conda-build should complain that value of a feature can't be blank 2. conda shouldn't go into infinite recursion The issue happens because somehow conda passes `*[track_features=]` to `push_MatchSpec()` in resolve.py, which leads to infinite recursion with `push_MatchSpec()` being passed '*' again and again. FWIW, conda 4.3* doesn't suffer from this problem and happily installs the package.
Oh that's bad.
2018-02-23T17:46:06
conda/conda
6,931
conda__conda-6931
[ "6930", "6930" ]
370e05969595a7821e27ce1fdf5190490d5f9e01
diff --git a/conda/gateways/connection/adapters/s3.py b/conda/gateways/connection/adapters/s3.py --- a/conda/gateways/connection/adapters/s3.py +++ b/conda/gateways/connection/adapters/s3.py @@ -116,3 +116,5 @@ def _send_boto(self, boto, resp, request): resp.close = resp.raw.close else: resp.status_code = 404 + + return resp
Exception when accessing S3 custom channel via boto (rather than boto3) <!-- 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.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! --> **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. --> conda search fails and produces an exception. ### 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. --> ``` 1. Ensure you have boto installed, but *not* boto3 2. Add an s3:// URL to your channel list in .condarc or specify the s3:// URL manually on the command line 3. Execute conda search conda (or any other package) ``` ## Expected Behavior <!-- What do you think should happen? --> The search would work. ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` $ conda info active environment : None user config file : /Users/blake/.condarc populated config files : /Users/blake/.condarc conda version : 4.4.10 conda-build version : 3.4.1 python version : 3.6.4.final.0 base environment : /usr/local/anaconda3 (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 s3://<redacted>/osx-64 s3://<redacted>/noarch package cache : /usr/local/anaconda3/pkgs /Users/blake/.conda/pkgs envs directories : /usr/local/anaconda3/envs /Users/blake/.conda/envs platform : osx-64 user-agent : conda/4.4.10 requests/2.18.4 CPython/3.6.4 Darwin/17.4.0 OSX/10.13.3 UID:GID : 501:20 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' --> ``` ==> /Users/blake/.condarc <== channels: - defaults - s3://<redacted> ``` </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' --> ``` ``` </p></details> Exception when accessing S3 custom channel via boto (rather than boto3) <!-- 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.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! --> **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. --> conda search fails and produces an exception. ### 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. --> ``` 1. Ensure you have boto installed, but *not* boto3 2. Add an s3:// URL to your channel list in .condarc or specify the s3:// URL manually on the command line 3. Execute conda search conda (or any other package) ``` ## Expected Behavior <!-- What do you think should happen? --> The search would work. ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` $ conda info active environment : None user config file : /Users/blake/.condarc populated config files : /Users/blake/.condarc conda version : 4.4.10 conda-build version : 3.4.1 python version : 3.6.4.final.0 base environment : /usr/local/anaconda3 (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 s3://<redacted>/osx-64 s3://<redacted>/noarch package cache : /usr/local/anaconda3/pkgs /Users/blake/.conda/pkgs envs directories : /usr/local/anaconda3/envs /Users/blake/.conda/envs platform : osx-64 user-agent : conda/4.4.10 requests/2.18.4 CPython/3.6.4 Darwin/17.4.0 OSX/10.13.3 UID:GID : 501:20 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' --> ``` ==> /Users/blake/.condarc <== channels: - defaults - s3://<redacted> ``` </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' --> ``` ``` </p></details>
2018-02-23T22:03:40
conda/conda
6,935
conda__conda-6935
[ "6695", "6695" ]
d4bb154c04555ef25923deaed7e7bbd1ff0c533b
diff --git a/conda/core/solve.py b/conda/core/solve.py --- a/conda/core/solve.py +++ b/conda/core/solve.py @@ -508,7 +508,7 @@ def solve_for_transaction(self, deps_modifier=NULL, prune=NULL, ignore_pinned=NU # TODO: Only explicitly requested remove and update specs are being included in # History right now. Do we need to include other categories from the solve? - if context.notify_outdated_conda: + if context.notify_outdated_conda and not context.quiet: conda_newer_spec = MatchSpec('conda >%s' % CONDA_VERSION) if not any(conda_newer_spec.match(prec) for prec in link_precs): conda_newer_records = sorted(
Outdated conda notification does not respect `-q` arg The notify_outdated_conda warning checks only `if context.notify_outdated_conda`, but I think it should check `if context.notify_outdated_conda and not context.quiet`. If I specify the `-q` flag, I don't want to see this warning. Outdated conda notification does not respect `-q` arg The notify_outdated_conda warning checks only `if context.notify_outdated_conda`, but I think it should check `if context.notify_outdated_conda and not context.quiet`. If I specify the `-q` flag, I don't want to see this warning.
Seems reasonable to me. I am a beginner and would like to work on this issue. Can i take it up and be guided along? Yup. Go for it. Just change if context.notify_outdated_conda: to if context.notify_outdated_conda and not context.quiet: and submit a PR Seems reasonable to me. I am a beginner and would like to work on this issue. Can i take it up and be guided along? Yup. Go for it. Just change if context.notify_outdated_conda: to if context.notify_outdated_conda and not context.quiet: and submit a PR
2018-02-24T06:42:57
conda/conda
6,957
conda__conda-6957
[ "6952" ]
88f8d2fe5e3d89ca87756a7332165a9ec8fb0014
diff --git a/conda/core/package_cache_data.py b/conda/core/package_cache_data.py --- a/conda/core/package_cache_data.py +++ b/conda/core/package_cache_data.py @@ -8,6 +8,8 @@ from os.path import basename, dirname, join from tarfile import ReadError +from conda._vendor.auxlib.decorators import memoizemethod + from .path_actions import CacheUrlAction, ExtractPackageAction from .. import CondaError, CondaMultiError, conda_signal_handler from .._vendor.auxlib.collection import first @@ -349,7 +351,7 @@ def _make_single_record(self, package_filename): else: md5 = None - url = first(self._urls_data, lambda x: basename(x) == package_filename) + url = self._urls_data.get_url(package_filename) package_cache_record = PackageCacheRecord.from_objects( index_json_record, url=url, @@ -417,6 +419,7 @@ def add_url(self, url): fh.write(url + '\n') self._urls_data.insert(0, url) + @memoizemethod def get_url(self, package_path): # package path can be a full path or just a basename # can be either an extracted directory or tarball
In conda 4.3, look at basename usage in core/package_cache.py Probably need to memoize something a level or two up from the basename call.
2018-02-28T02:20:49
conda/conda
7,041
conda__conda-7041
[ "6919" ]
deb16ee5dbfa68ae3433f1cc2766999613914b20
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -70,7 +70,7 @@ def __init__(self, shell, arguments=None): self.shift_args = 0 self.command_join = ';\n' - self.unset_var_tmpl = 'unset %s' + self.unset_var_tmpl = 'unsetenv %s' self.export_var_tmpl = 'setenv %s "%s"' self.set_var_tmpl = "set %s='%s'" self.run_script_tmpl = 'source "%s"' @@ -227,7 +227,7 @@ def build_activate(self, env_name_or_prefix): old_conda_prefix = self.environ.get('CONDA_PREFIX') max_shlvl = context.max_shlvl - if old_conda_prefix == prefix: + if old_conda_prefix == prefix and old_conda_shlvl > 0: return self.build_reactivate() if self.environ.get('CONDA_PREFIX_%s' % (old_conda_shlvl-1)) == prefix: # in this case, user is attempting to activate the previous environment, @@ -291,9 +291,10 @@ def build_activate(self, env_name_or_prefix): def build_deactivate(self): # query environment + old_conda_prefix = self.environ.get('CONDA_PREFIX') 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: + if not old_conda_prefix or old_conda_shlvl < 1: + # no active environment, so cannot deactivate; do nothing return { 'unset_vars': (), 'set_vars': {}, @@ -351,7 +352,7 @@ def build_deactivate(self): def build_reactivate(self): conda_prefix = self.environ.get('CONDA_PREFIX') - conda_shlvl = int(self.environ.get('CONDA_SHLVL', -1)) + conda_shlvl = int(self.environ.get('CONDA_SHLVL', 0)) if not conda_prefix or conda_shlvl < 1: # no active environment, so cannot reactivate; do nothing return {
diff --git a/tests/test_activate.py b/tests/test_activate.py --- a/tests/test_activate.py +++ b/tests/test_activate.py @@ -687,11 +687,11 @@ def test_csh_basic(self): new_path = activator.pathsep_join(activator._remove_prefix_from_path(self.prefix)) assert deactivate_data == dals(""" source "%(deactivate1)s"; - unset CONDA_DEFAULT_ENV; - unset CONDA_EXE; - unset CONDA_PREFIX; - unset CONDA_PROMPT_MODIFIER; - unset CONDA_PYTHON_EXE; + unsetenv CONDA_DEFAULT_ENV; + unsetenv CONDA_EXE; + unsetenv CONDA_PREFIX; + unsetenv CONDA_PROMPT_MODIFIER; + unsetenv CONDA_PYTHON_EXE; set prompt='%(prompt)s'; setenv CONDA_SHLVL "0"; setenv PATH "%(new_path)s"; @@ -1146,7 +1146,7 @@ def basic_csh(self, shell): shell.assert_env_var('CONDA_SHLVL', '0') @pytest.mark.skipif(not which('csh'), reason='csh not installed') - @pytest.mark.xfail(reason="csh needs work apparently; but at least tcsh works") + @pytest.mark.xfail(reason="pure csh doesn't support argument passing to sourced scripts") def test_csh_basic_integration(self): with InteractiveShell('csh') as shell: self.basic_csh(shell)
csh prompt handling & deactivate broken <!-- 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. --> In a csh shell, after sourcing the '~/miniconda3/etc/profile.d/conda.csh' When activating the environment the original prompt is not a part of the new prompt. Neither is it reverted to the original prompt when deactivating. Additionally, when deactivating the 'CONDA' specific env vars are not removed from the environment. ### 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. --> ``` $> echo "'$prompt'" '$> ' $> conda activate test_env (test_env) echo "'$prompt'" '(test_env) ' (test_env) conda deactivate env | grep CONDA _CONDA_EXE=/home/jrevans/miniconda3/bin/conda _CONDA_ROOT=/home/jrevans/miniconda3 CONDA_SHLVL=0 CONDA_DEFAULT_ENV=test_env CONDA_PREFIX=/home/jrevans/miniconda3/envs/test_env CONDA_PROMPT_MODIFIER=(test_env) CONDA_PYTHON_EXE=/home/jrevans/miniconda3/bin/python ``` ## Expected Behavior <!-- What do you think should happen? --> The prompt needs to be preserved throughout and the conda env vars need to be removed from the environment. I have attached a version of the '.../etc/profile.d/conda.csh' script that fixes the prompt problem. The env var problem can be fixed by changing the results of 'conda shell.csh deactivate' to use 'unsetenv' instead of 'unset' [conda.csh.txt](https://github.com/conda/conda/files/1748844/conda.csh.txt)
2018-03-15T19:46:10
conda/conda
7,049
conda__conda-7049
[ "6595" ]
27157ddcec0fefbccd168b6b5be7258f03115b05
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -9,7 +9,7 @@ from tempfile import NamedTemporaryFile from .base.context import ROOT_ENV_NAME, context, locate_prefix_by_name -context.__init__() # oOn import, context does not include SEARCH_PATH. This line fixes that. +context.__init__() # On import, context does not include SEARCH_PATH. This line fixes that. try: from cytoolz.itertoolz import concatv, drop @@ -17,7 +17,7 @@ from ._vendor.toolz.itertoolz import concatv, drop # NOQA -class Activator(object): +class _Activator(object): # Activate and deactivate have three tasks # 1. Set and unset environment variables # 2. Execute/source activate.d/deactivate.d scripts @@ -39,8 +39,21 @@ class Activator(object): # To implement support for a new shell, ideally one would only need to add shell-specific # information to the __init__ method of this class. - def __init__(self, shell, arguments=None): - self.shell = shell + # The following instance variables must be defined by each implementation. + shell = None + pathsep_join = None + path_conversion = None + script_extension = None + tempfile_extension = None # None means write instructions to stdout rather than a temp file + shift_args = None + command_join = None + + unset_var_tmpl = None + export_var_tmpl = None + set_var_tmpl = None + run_script_tmpl = None + + def __init__(self, arguments=None): self._raw_arguments = arguments if PY2: @@ -49,83 +62,6 @@ def __init__(self, shell, arguments=None): else: self.environ = os.environ.copy() - if shell == 'posix': - self.pathsep_join = ':'.join - self.path_conversion = native_path_to_unix - self.script_extension = '.sh' - self.tempfile_extension = None # write instructions to stdout rather than a temp file - self.shift_args = 0 - self.command_join = '\n' - - self.unset_var_tmpl = '\\unset %s' - self.export_var_tmpl = "\\export %s='%s'" - self.set_var_tmpl = "%s='%s'" - self.run_script_tmpl = '\\. "%s"' - - elif shell == 'csh': - self.pathsep_join = ':'.join - self.path_conversion = native_path_to_unix - self.script_extension = '.csh' - self.tempfile_extension = None # write instructions to stdout rather than a temp file - self.shift_args = 0 - self.command_join = ';\n' - - self.unset_var_tmpl = 'unsetenv %s' - self.export_var_tmpl = 'setenv %s "%s"' - self.set_var_tmpl = "set %s='%s'" - self.run_script_tmpl = 'source "%s"' - - elif shell == 'xonsh': - self.pathsep_join = ':'.join - self.path_conversion = native_path_to_unix - self.script_extension = '.xsh' - self.tempfile_extension = '.xsh' - self.shift_args = 0 - self.command_join = '\n' - - self.unset_var_tmpl = 'del $%s' - self.export_var_tmpl = "$%s = '%s'" - self.run_script_tmpl = 'source "%s"' - - elif shell == 'cmd.exe': - self.pathsep_join = ';'.join - self.path_conversion = path_identity - self.script_extension = '.bat' - self.tempfile_extension = '.bat' - self.shift_args = 1 - self.command_join = '\r\n' if on_win else '\n' - - self.unset_var_tmpl = '@SET %s=' - self.export_var_tmpl = '@SET "%s=%s"' - self.run_script_tmpl = '@CALL "%s"' - - elif shell == 'fish': - self.pathsep_join = '" "'.join - self.path_conversion = native_path_to_unix - self.script_extension = '.fish' - self.tempfile_extension = None # write instructions to stdout rather than a temp file - self.shift_args = 0 - self.command_join = ';\n' - - self.unset_var_tmpl = 'set -e %s' - self.export_var_tmpl = 'set -gx %s "%s"' - self.run_script_tmpl = 'source "%s"' - - elif shell == 'powershell': - self.pathsep_join = ';'.join - self.path_conversion = path_identity - self.script_extension = '.ps1' - self.tempfile_extension = None # write instructions to stdout rather than a temp file - self.shift_args = 0 - self.command_join = '\n' - - self.unset_var_tmpl = 'Remove-Variable %s' - self.export_var_tmpl = '$env:%s = "%s"' - self.run_script_tmpl = '. "%s"' - - else: - raise NotImplementedError() - def _finalize(self, commands, ext): commands = concatv(commands, ('',)) # add terminating newline if ext is None: @@ -273,13 +209,10 @@ def build_activate(self, env_name_or_prefix): } deactivate_scripts = () - self._update_prompt(set_vars, conda_prompt_modifier) + if context.changeps1: + self._update_prompt(set_vars, conda_prompt_modifier) - if on_win and self.shell == 'cmd.exe': - import ctypes - export_vars.update({ - "PYTHONIOENCODING": ctypes.cdll.kernel32.GetACP(), - }) + self._build_activate_shell_custom(export_vars) return { 'unset_vars': (), @@ -340,7 +273,8 @@ def build_deactivate(self): } activate_scripts = self._get_activate_scripts(new_prefix) - self._update_prompt(set_vars, conda_prompt_modifier) + if context.changeps1: + self._update_prompt(set_vars, conda_prompt_modifier) return { 'unset_vars': unset_vars, @@ -366,7 +300,8 @@ def build_reactivate(self): new_path = self.pathsep_join(self._replace_prefix_in_path(conda_prefix, conda_prefix)) set_vars = {} conda_prompt_modifier = self._prompt_modifier(conda_default_env) - self._update_prompt(set_vars, conda_prompt_modifier) + if context.changeps1: + self._update_prompt(set_vars, conda_prompt_modifier) # environment variables are set only to aid transition from conda 4.3 to conda 4.4 return { 'unset_vars': (), @@ -457,30 +392,13 @@ def _replace_prefix_in_path(self, old_prefix, new_prefix, starting_path_dirs=Non path_list.insert(idx, join(new_prefix, 'bin')) return self.path_conversion(path_list) + def _build_activate_shell_custom(self, export_vars): + # A method that can be overriden by shell-specific implementations. + # The signature of this method may change in the future. + pass + def _update_prompt(self, set_vars, conda_prompt_modifier): - if not context.changeps1: - return - - if self.shell == 'posix': - ps1 = self.environ.get('PS1', '') - current_prompt_modifier = self.environ.get('CONDA_PROMPT_MODIFIER') - if current_prompt_modifier: - ps1 = re.sub(re.escape(current_prompt_modifier), r'', ps1) - # Because we're using single-quotes to set shell variables, we need to handle the - # proper escaping of single quotes that are already part of the string. - # Best solution appears to be https://stackoverflow.com/a/1250279 - ps1 = ps1.replace("'", "'\"'\"'") - set_vars.update({ - 'PS1': conda_prompt_modifier + ps1, - }) - elif self.shell == 'csh': - prompt = self.environ.get('prompt', '') - current_prompt_modifier = self.environ.get('CONDA_PROMPT_MODIFIER') - if current_prompt_modifier: - prompt = re.sub(re.escape(current_prompt_modifier), r'', prompt) - set_vars.update({ - 'prompt': conda_prompt_modifier + prompt, - }) + pass def _default_env(self, prefix): if prefix == context.root_prefix: @@ -570,6 +488,153 @@ def iteritems(d, **kw): return iter(d.items(**kw)) +class PosixActivator(_Activator): + + def __init__(self, arguments=None): + self.pathsep_join = ':'.join + self.path_conversion = native_path_to_unix + self.script_extension = '.sh' + self.tempfile_extension = None # write instructions to stdout rather than a temp file + self.shift_args = 0 + self.command_join = '\n' + + self.unset_var_tmpl = '\\unset %s' + self.export_var_tmpl = "\\export %s='%s'" + self.set_var_tmpl = "%s='%s'" + self.run_script_tmpl = '\\. "%s"' + + super(PosixActivator, self).__init__(arguments) + + def _update_prompt(self, set_vars, 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 + # proper escaping of single quotes that are already part of the string. + # Best solution appears to be https://stackoverflow.com/a/1250279 + ps1 = ps1.replace("'", "'\"'\"'") + set_vars.update({ + 'PS1': conda_prompt_modifier + ps1, + }) + + +class CshActivator(_Activator): + + def __init__(self, arguments=None): + self.pathsep_join = ':'.join + self.path_conversion = native_path_to_unix + self.script_extension = '.csh' + self.tempfile_extension = None # write instructions to stdout rather than a temp file + self.shift_args = 0 + self.command_join = ';\n' + + self.unset_var_tmpl = 'unsetenv %s' + self.export_var_tmpl = 'setenv %s "%s"' + self.set_var_tmpl = "set %s='%s'" + self.run_script_tmpl = 'source "%s"' + + super(CshActivator, self).__init__(arguments) + + def _update_prompt(self, set_vars, 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({ + 'prompt': conda_prompt_modifier + prompt, + }) + + +class XonshActivator(_Activator): + + def __init__(self, arguments=None): + self.pathsep_join = ':'.join + self.path_conversion = native_path_to_unix + self.script_extension = '.xsh' + self.tempfile_extension = '.xsh' + self.shift_args = 0 + self.command_join = '\n' + + self.unset_var_tmpl = 'del $%s' + self.export_var_tmpl = "$%s = '%s'" + self.set_var_tmpl = "$%s = '%s'" # TODO: determine if different than export_var_tmpl + self.run_script_tmpl = 'source "%s"' + + super(XonshActivator, self).__init__(arguments) + + +class CmdExeActivator(_Activator): + + def __init__(self, arguments=None): + self.pathsep_join = ';'.join + self.path_conversion = path_identity + self.script_extension = '.bat' + self.tempfile_extension = '.bat' + self.shift_args = 1 + self.command_join = '\r\n' if on_win else '\n' + + self.unset_var_tmpl = '@SET %s=' + self.export_var_tmpl = '@SET "%s=%s"' + self.set_var_tmpl = '@SET "%s=%s"' # TODO: determine if different than export_var_tmpl + self.run_script_tmpl = '@CALL "%s"' + + super(CmdExeActivator, self).__init__(arguments) + + def _build_activate_shell_custom(self, export_vars): + if on_win: + import ctypes + export_vars.update({ + "PYTHONIOENCODING": ctypes.cdll.kernel32.GetACP(), + }) + + +class FishActivator(_Activator): + + def __init__(self, arguments=None): + self.pathsep_join = '" "'.join + self.path_conversion = native_path_to_unix + self.script_extension = '.fish' + self.tempfile_extension = None # write instructions to stdout rather than a temp file + self.shift_args = 0 + self.command_join = ';\n' + + self.unset_var_tmpl = 'set -e %s' + self.export_var_tmpl = 'set -gx %s "%s"' + self.set_var_tmpl = 'set -gx %s "%s"' # TODO: determine if different than export_var_tmpl + self.run_script_tmpl = 'source "%s"' + + super(FishActivator, self).__init__(arguments) + + +class PowershellActivator(_Activator): + + def __init__(self, arguments=None): + self.pathsep_join = ';'.join + self.path_conversion = path_identity + self.script_extension = '.ps1' + self.tempfile_extension = None # write instructions to stdout rather than a temp file + self.shift_args = 0 + self.command_join = '\n' + + self.unset_var_tmpl = 'Remove-Variable %s' + self.export_var_tmpl = '$env:%s = "%s"' + self.set_var_tmpl = '$env:%s = "%s"' # TODO: determine if different than export_var_tmpl + self.run_script_tmpl = '. "%s"' + + super(PowershellActivator, self).__init__(arguments) + + +activator_map = { + 'posix': PosixActivator, + 'csh': CshActivator, + 'xonsh': XonshActivator, + 'cmd.exe': CmdExeActivator, + 'fish': FishActivator, + 'powershell': PowershellActivator, +} + + def main(argv=None): from .common.compat import init_std_stream_encoding @@ -579,7 +644,12 @@ def main(argv=None): assert argv[1].startswith('shell.') shell = argv[1].replace('shell.', '', 1) activator_args = argv[2:] - activator = Activator(shell, activator_args) + try: + activator_cls = activator_map[shell] + except KeyError: + from . import CondaError + raise CondaError("%s is not a supported shell." % shell) + activator = activator_cls(activator_args) try: print(activator.execute(), end='') return 0
diff --git a/tests/test_activate.py b/tests/test_activate.py --- a/tests/test_activate.py +++ b/tests/test_activate.py @@ -3,7 +3,7 @@ from logging import getLogger import os -from os.path import basename, dirname, isdir, join +from os.path import dirname, isdir, join import sys from tempfile import gettempdir from unittest import TestCase @@ -14,7 +14,8 @@ from conda import CONDA_PACKAGE_ROOT from conda._vendor.auxlib.ish import dals from conda._vendor.toolz.itertoolz import concatv -from conda.activate import Activator, main as activate_main, native_path_to_unix +from conda.activate import CmdExeActivator, CshActivator, FishActivator, PosixActivator, \ + PowershellActivator, XonshActivator, activator_map, main as activate_main, native_path_to_unix from conda.base.constants import ROOT_ENV_NAME from conda.base.context import context, reset_context from conda.common.compat import iteritems, on_win, string_types @@ -63,7 +64,7 @@ def tearDown(self): os.environ.update(self.hold_environ) def test_activate_environment_not_found(self): - activator = Activator('posix') + activator = PosixActivator() with tempdir() as td: with pytest.raises(EnvironmentLocationNotFound): @@ -83,7 +84,7 @@ def test_activate_help(self): def test_PS1(self): with env_var("CONDA_CHANGEPS1", "yes", reset_context): - activator = Activator('posix') + activator = PosixActivator() assert activator._prompt_modifier(ROOT_ENV_NAME) == '(%s) ' % ROOT_ENV_NAME instructions = activator.build_activate("base") @@ -91,14 +92,14 @@ def test_PS1(self): def test_PS1_no_changeps1(self): with env_var("CONDA_CHANGEPS1", "no", reset_context): - activator = Activator('posix') + activator = PosixActivator() assert activator._prompt_modifier('root') == '' instructions = activator.build_activate("base") assert instructions['export_vars']['CONDA_PROMPT_MODIFIER'] == '' def test_add_prefix_to_path(self): - activator = Activator('posix') + activator = PosixActivator() path_dirs = activator.path_conversion(['/path1/bin', '/path2/bin', '/usr/local/bin', '/usr/bin', '/bin']) assert len(path_dirs) == 5 @@ -111,7 +112,7 @@ def test_add_prefix_to_path(self): assert new_path == added_paths + path_dirs def test_remove_prefix_from_path_1(self): - activator = Activator('posix') + activator = PosixActivator() original_path = tuple(activator._get_starting_path_list()) keep_path = activator.path_conversion('/keep/this/path') final_path = (keep_path,) + original_path @@ -125,7 +126,7 @@ def test_remove_prefix_from_path_1(self): def test_remove_prefix_from_path_2(self): # this time prefix doesn't actually exist in path - activator = Activator('posix') + activator = PosixActivator() original_path = tuple(activator._get_starting_path_list()) keep_path = activator.path_conversion('/keep/this/path') final_path = (keep_path,) + original_path @@ -138,7 +139,7 @@ def test_remove_prefix_from_path_2(self): assert final_path == new_path def test_replace_prefix_in_path_1(self): - activator = Activator('posix') + activator = PosixActivator() original_path = tuple(activator._get_starting_path_list()) new_prefix = join(os.getcwd(), 'mytestpath-new') new_paths = activator.path_conversion(activator._get_path_dirs(new_prefix)) @@ -156,7 +157,7 @@ def test_replace_prefix_in_path_1(self): assert final_path == new_path def test_default_env(self): - activator = Activator('posix') + activator = PosixActivator() assert ROOT_ENV_NAME == activator._default_env(context.root_prefix) with tempdir() as td: @@ -176,7 +177,7 @@ def test_build_activate_shlvl_0(self): with env_var('CONDA_SHLVL', '0'): with env_var('CONDA_PREFIX', ''): - activator = Activator('posix') + activator = PosixActivator() builder = activator.build_activate(td) new_path = activator.pathsep_join(activator._add_prefix_to_path(td)) conda_prompt_modifier = "(%s) " % td @@ -213,7 +214,7 @@ def test_build_activate_shlvl_1(self): old_prefix = '/old/prefix' with env_var('CONDA_SHLVL', '1'): with env_var('CONDA_PREFIX', old_prefix): - activator = Activator('posix') + activator = PosixActivator() builder = activator.build_activate(td) new_path = activator.pathsep_join(activator._add_prefix_to_path(td)) conda_prompt_modifier = "(%s) " % td @@ -255,7 +256,7 @@ def test_build_activate_shlvl_2(self): with env_var('CONDA_SHLVL', '2'): with env_var('CONDA_PREFIX', old_prefix): - activator = Activator('posix') + activator = PosixActivator() builder = activator.build_activate(td) new_path = activator.pathsep_join(activator._add_prefix_to_path(td)) conda_prompt_modifier = "(%s) " % td @@ -295,7 +296,7 @@ def test_activate_same_environment(self): with env_var('CONDA_SHLVL', '1'): with env_var('CONDA_PREFIX', old_prefix): - activator = Activator('posix') + activator = PosixActivator() builder = activator.build_activate(td) @@ -336,7 +337,7 @@ def test_build_deactivate_shlvl_2(self): with env_var('CONDA_SHLVL', '2'): with env_var('CONDA_PREFIX_1', old_prefix): with env_var('CONDA_PREFIX', td): - activator = Activator('posix') + activator = PosixActivator() original_path = tuple(activator._get_starting_path_list()) builder = activator.build_deactivate() @@ -373,7 +374,7 @@ def test_build_deactivate_shlvl_1(self): with env_var('CONDA_SHLVL', '1'): with env_var('CONDA_PREFIX', td): - activator = Activator('posix') + activator = PosixActivator() original_path = tuple(activator._get_starting_path_list()) builder = activator.build_deactivate() @@ -449,7 +450,7 @@ def assert_unix_path(path): assert native_path_to_unix(paths) == paths def test_posix_basic(self): - activator = Activator('posix') + activator = PosixActivator() self.make_dot_d_files(activator.script_extension) with captured() as c: @@ -484,7 +485,7 @@ def test_posix_basic(self): 'CONDA_SHLVL': '1', 'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))), }): - activator = Activator('posix') + activator = PosixActivator() with captured() as c: rc = activate_main(('', 'shell.posix', 'reactivate')) assert not c.stderr @@ -532,7 +533,7 @@ def test_posix_basic(self): @pytest.mark.skipif(not on_win, reason="cmd.exe only on Windows") def test_cmd_exe_basic(self): - activator = Activator('cmd.exe') + activator = CmdExeActivator() self.make_dot_d_files(activator.script_extension) with captured() as c: @@ -571,7 +572,7 @@ def test_cmd_exe_basic(self): 'CONDA_SHLVL': '1', 'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))), }): - activator = Activator('cmd.exe') + activator = CmdExeActivator() with captured() as c: assert activate_main(('', 'shell.cmd.exe', 'reactivate')) == 0 assert not c.stderr @@ -620,7 +621,7 @@ def test_cmd_exe_basic(self): } def test_csh_basic(self): - activator = Activator('csh') + activator = CshActivator() self.make_dot_d_files(activator.script_extension) with captured() as c: @@ -655,7 +656,7 @@ def test_csh_basic(self): 'CONDA_SHLVL': '1', 'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))), }): - activator = Activator('csh') + activator = CshActivator() with captured() as c: rc = activate_main(('', 'shell.csh', 'reactivate')) assert not c.stderr @@ -702,7 +703,7 @@ def test_csh_basic(self): } def test_xonsh_basic(self): - activator = Activator('xonsh') + activator = XonshActivator() self.make_dot_d_files(activator.script_extension) with captured() as c: @@ -739,7 +740,7 @@ def test_xonsh_basic(self): 'CONDA_SHLVL': '1', 'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))), }): - activator = Activator('xonsh') + activator = XonshActivator() with captured() as c: assert activate_main(('', 'shell.xonsh', 'reactivate')) == 0 assert not c.stderr @@ -788,7 +789,7 @@ def test_xonsh_basic(self): } def test_fish_basic(self): - activator = Activator('fish') + activator = FishActivator() self.make_dot_d_files(activator.script_extension) with captured() as c: @@ -821,7 +822,7 @@ def test_fish_basic(self): 'CONDA_SHLVL': '1', 'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))), }): - activator = Activator('fish') + activator = FishActivator() with captured() as c: rc = activate_main(('', 'shell.fish', 'reactivate')) assert not c.stderr @@ -865,7 +866,7 @@ def test_fish_basic(self): } def test_powershell_basic(self): - activator = Activator('powershell') + activator = PowershellActivator() self.make_dot_d_files(activator.script_extension) with captured() as c: @@ -897,7 +898,7 @@ def test_powershell_basic(self): 'CONDA_SHLVL': '1', 'PATH': os.pathsep.join(concatv(new_path_parts, (os.environ['PATH'],))), }): - activator = Activator('powershell') + activator = PowershellActivator() with captured() as c: rc = activate_main(('', 'shell.powershell', 'reactivate')) assert not c.stderr @@ -998,7 +999,7 @@ def __init__(self, shell_name): shell_vals.update(self.shells[shell_name]) for key, value in iteritems(shell_vals): setattr(self, key, value) - self.activator = Activator(shell_vals['activator']) + self.activator = activator_map[shell_vals['activator']]() def __enter__(self): from pexpect.popen_spawn import PopenSpawn
Clean up activate.py using proper OO inheritence See * https://github.com/conda/conda/pull/6585#issuecomment-354178822 * https://github.com/conda/conda/pull/6585#issuecomment-354303897
Good first issue for someone comfortable with object oriented programming.
2018-03-17T15:54:00
conda/conda
7,064
conda__conda-7064
[ "7063" ]
3b86094690b0da16eff3c44c7cbd361953dd73b0
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 @@ -172,6 +172,8 @@ class MatchSpec(object): 'features', 'url', 'md5', + 'license', + 'license_family', ) def __init__(self, optional=False, target=None, **kwargs): @@ -769,7 +771,8 @@ def __init__(self, value): if value.startswith('^') and value.endswith('$'): self._re_match = re.compile(value).match elif '*' in value: - self._re_match = re.compile(r'^(?:%s)$' % value.replace('*', r'.*')).match + value = re.escape(value).replace('\\*', r'.*') + self._re_match = re.compile(r'^(?:%s)$' % value).match def match(self, other): try: @@ -860,6 +863,21 @@ def __init__(self, value): super(LowerStrMatch, self).__init__(value.lower()) +class CaseInsensitiveStrMatch(LowerStrMatch): + + def match(self, other): + try: + _other_val = other._raw_value + except AttributeError: + _other_val = text_type(other) + + _other_val = _other_val.lower() + if self._re_match: + return self._re_match(_other_val) + else: + return self._raw_value == _other_val + + _implementors = { 'name': LowerStrMatch, 'track_features': FeatureMatch, @@ -867,4 +885,6 @@ def __init__(self, value): 'version': VersionSpec, 'build_number': BuildNumberMatch, 'channel': ChannelMatch, + 'license': CaseInsensitiveStrMatch, + 'license_family': CaseInsensitiveStrMatch, } diff --git a/conda/models/records.py b/conda/models/records.py --- a/conda/models/records.py +++ b/conda/models/records.py @@ -262,8 +262,9 @@ class IndexJsonRecord(BasePackageRef): default_in_dump=False) # TODO: rename to package_type preferred_env = StringField(required=False, nullable=True, default=None, default_in_dump=False) - license = StringField(required=False) - license_family = StringField(required=False) + license = StringField(required=False, nullable=True, default=None, default_in_dump=False) + license_family = StringField(required=False, nullable=True, default=None, + default_in_dump=False) timestamp = TimestampField(required=False)
diff --git a/tests/models/test_match_spec.py b/tests/models/test_match_spec.py --- a/tests/models/test_match_spec.py +++ b/tests/models/test_match_spec.py @@ -426,6 +426,25 @@ def test_bracket_matches(self): assert not MatchSpec("numpy[build_number='>7']").match(record) assert MatchSpec("numpy[build_number='>=7']").match(record) + def test_license_match(self): + record = { + 'name': 'numpy', + 'version': '1.11.0', + 'build': 'py34_7', + 'build_number': 7, + 'license': 'LGPLv3+', + 'license_family': 'LGPL', + } + assert MatchSpec("*[license_family='LGPL']").match(record) + assert MatchSpec("*[license_family='lgpl']").match(record) + assert MatchSpec("*[license_family='*GP*']").match(record) + assert MatchSpec("*[license_family='*gp*']").match(record) + assert MatchSpec("*[license_family='*GPL*']").match(record) + assert MatchSpec("*[license_family='*gpl*']").match(record) + + assert MatchSpec("*[license='*gpl*']").match(record) + assert MatchSpec("*[license='*v3+']").match(record) + class TestArg2Spec(TestCase):
Add license and license_family to MatchSpec for `conda search`
2018-03-21T05:58:10
conda/conda
7,067
conda__conda-7067
[ "7087" ]
e8073535db35677724a54a6d11be4eb05a45132b
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 @@ -27,12 +27,10 @@ def print_export_header(subdir): def get_packages(installed, regex): pat = re.compile(regex, re.I) if regex else None - for dist in sorted(installed, key=lambda x: x.quad[0].lower()): - name = dist.quad[0] - if pat and pat.search(name) is None: + for prefix_rec in sorted(installed, key=lambda x: x.name.lower()): + if pat and pat.search(str(prefix_rec)) is None: continue - - yield dist + yield prefix_rec def list_packages(prefix, installed, regex=None, format='human', @@ -85,12 +83,14 @@ def print_packages(prefix, regex=None, format='human', piplist=False, if format == 'export': print_export_header(context.subdir) - installed = linked(prefix) - log.debug("installed conda packages:\n%s", installed) - if piplist and context.use_pip and format == 'human': - other_python = get_egg_info(prefix) - log.debug("other installed python packages:\n%s", other_python) - installed.update(other_python) + # installed = linked(prefix) + # log.debug("installed conda packages:\n%s", installed) + # if piplist and context.use_pip and format == 'human': + # other_python = get_egg_info(prefix) + # log.debug("other installed python packages:\n%s", other_python) + # installed.update(other_python) + + installed = tuple(PrefixData(prefix).iter_records()) exitcode, output = list_packages(prefix, installed, regex, format=format, show_channel_urls=show_channel_urls) 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 @@ -3,21 +3,33 @@ from glob import glob from logging import getLogger -from os.path import isfile, join, lexists +from os import listdir +from os.path import basename, isfile, join, lexists from ..base.constants import CONDA_TARBALL_EXTENSION, PREFIX_MAGIC_FILE from ..base.context import context from ..common.compat import JSONDecodeError, itervalues, string_types, with_metaclass from ..common.constants import NULL +from ..common.path import get_python_site_packages_short_path, win_path_ok from ..common.serialize import json_load from ..exceptions import (BasicClobberError, CondaDependencyError, CorruptedEnvironmentError, maybe_raise) from ..gateways.disk.create import write_as_json_to_file from ..gateways.disk.delete import rm_rf from ..gateways.disk.test import file_path_is_writable +from ..models.channel import Channel from ..models.dist import Dist +from ..models.enums import PackageType, PathType from ..models.match_spec import MatchSpec -from ..models.records import PackageRef, PrefixRecord +from ..models.prefix_graph import PrefixGraph +from ..models.records import (ComposableField, EnumField, ListField, PackageRef, PathDataV1, + PathsData, PrefixRecord) + +try: + from cytoolz.itertoolz import concat, concatv +except ImportError: # pragma: no cover + from .._vendor.toolz.itertoolz import concat, concatv # NOQA + log = getLogger(__name__) @@ -48,6 +60,7 @@ def load(self): self.__prefix_records = {} for meta_file in glob(join(self.prefix_path, 'conda-meta', '*.json')): self._load_single_record(meta_file) + self._load_site_packages() def reload(self): self.load() @@ -135,8 +148,8 @@ def _load_single_record(self, prefix_record_json_path): except JSONDecodeError: raise CorruptedEnvironmentError(self.prefix_path, prefix_record_json_path) - prefix_record = PrefixRecord(**json_data) - self.__prefix_records[prefix_record.name] = prefix_record + prefix_record = PrefixRecord(**json_data) + self.__prefix_records[prefix_record.name] = prefix_record @property def is_writable(self): @@ -145,6 +158,142 @@ def is_writable(self): return None return file_path_is_writable(test_path) + def _has_python(self): + return 'python' in self._prefix_records + + def _load_site_packages(self): + # 1. identify all package names in site-packages + # 2. determine if they are conda packages + # 3. load as pip packages if not + python_record = next( + (prefix_rec for prefix_rec in itervalues(self.__prefix_records) if prefix_rec.name == 'python'), + None + ) + if not python_record: + return + prefix_graph = PrefixGraph(self.iter_records()) + known_python_records = prefix_graph.all_descendants(python_record) + + def norm_package_name(name): + return name.replace('.', '-').replace('_', '-').lower() + + marker_file_endings = ('.egg-info/PKG-INFO', '.dist-info/RECORD', '.egg-info') + conda_python_packages = dict( + ((mf, prefix_rec) + for prefix_rec in known_python_records + for mf in prefix_rec.files + if mf.endswith(marker_file_endings)) + ) + + non_conda_python_package_markers = [] + site_packages_dir = get_python_site_packages_short_path(python_record.version) + sp_dir_full_path = join(self.prefix_path, win_path_ok(site_packages_dir)) + sp_marker_endings = ('.dist-info', '.egg-info') + for fn in listdir(sp_dir_full_path): + if fn.endswith(sp_marker_endings): + if fn.endswith('.dist-info'): + marker_file = "%s/%s/%s" % (site_packages_dir, fn, 'RECORD') + elif fn.endswith(".egg-info"): + if isfile(join(sp_dir_full_path, fn)): + marker_file = "%s/%s" % (site_packages_dir, fn) + else: + marker_file = "%s/%s/%s" % (site_packages_dir, fn, "PKG-INFO") + elif fn.endswith('.egg-link'): + continue + elif fn.endswith('.pth'): + continue + else: + continue + + if marker_file not in conda_python_packages: + non_conda_python_package_markers.append(marker_file) + + from pip._vendor.distlib.database import EggInfoDistribution, InstalledDistribution # TODO: only compatible with pip 9.0 + from pip._vendor.distlib.metadata import MetadataConflictError + from pip._vendor.distlib.util import parse_requirement + + def get_pydist(marker_file): + if ".dist-info" in marker_file: + dist_file = join(self.prefix_path, win_path_ok(marker_file.rsplit('/', 1)[0])) + dist_cls = InstalledDistribution + elif marker_file.endswith(".egg-info"): + dist_file = join(self.prefix_path, win_path_ok(marker_file)) + dist_cls = EggInfoDistribution + elif ".egg-info" in marker_file: + dist_file = join(self.prefix_path, win_path_ok(marker_file.rsplit('/', 1)[0])) + dist_cls = EggInfoDistribution + else: + raise NotImplementedError() + try: + pydist = dist_cls(dist_file) + except MetadataConflictError: + print("MetadataConflictError:", marker_file) + pydist = None + return pydist + + python_recs = [] + for marker_file in non_conda_python_package_markers: + pydist = get_pydist(marker_file) + if pydist is None: + continue + # x.provides => [u'skdata (0.0.4)'] + # x.run_requires => set([u'joblib', u'scikit-learn', u'lockfile', u'numpy', u'nose (>=1.0)']) + # >>> list(x.list_installed_files()) => [(u'skdata/__init__.py', u'sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU', u'0'), (u'skdata/base.py', u'sha256=04MW02dky5T4nZb6Q0M351aRbAwLxd8voCK3nrAU-g0', u'5019'), (u'skdata/brodatz.py', u'sha256=NIPWLawJ59Fr037r0oT_gHe46WCo3UivuQ-cwxRU3ow', u'8492'), (u'skdata/caltech.py', u'sha256=cIfyMMRYggZ3Jkgc15tsYi_ZsZ7NpRqWh7mZ8bl6Fo0', u'8047'), (u'skdata/data_home.py', u'sha256=o5ChOI4v3Jd16JM3qWZlhrs5q-g_0yKa5-Oq44HC_K4', u'1297'), (u'skdata/diabetes.py', u'sha256=ny5Ihpc_eiIRYgzFn3Lm81fV0SZ1nyZQnqEmwb2PrS0', u'995'), (u'skdata/digits.py', u'sha256=DipeWAb3APpjXfmKmSumkfEFzuBW8XJ0 + + # TODO: normalize names against '.', '-', '_' + # TODO: ensure that this dist is *actually* the dist that matches conda-meta + + if marker_file.endswith(".egg-info"): + paths_data = None + else: + _paths_data = [] + for _path, _hash, _size in pydist.list_installed_files(): + if _hash: + assert _hash.startswith('sha256='), (marker_file, _hash) + sha256 = _hash[7:] + else: + sha256 = None + _size = int(_size) if _size else None + _paths_data.append(PathDataV1( + _path=_path, + path_type=PathType.hardlink, # TODO + sha256=sha256, + size_in_bytes=_size + )) + paths_data = PathsData(paths_version=1, paths=_paths_data) + # TODO: need to add entry points, "exports," and other files that might not be in RECORD + + depends = tuple( + req.name for req in + # vars(req) => {'source': u'nose (>=1.0)', 'requirement': u'nose (>= 1.0)', 'extras': None, 'name': u'nose', 'url': None, 'constraints': [(u'>=', u'1.0')]} + (parse_requirement(r) for r in pydist.run_requires) + ) + # TODO: need to add python (with version?) to deps + + package_type = PackageType.SHADOW_PIP_UPDATEABLE if depends else PackageType.SHADOW_PIP_FROZEN + + python_rec = PythonRecord( + package_type=PackageType.SHADOW_PIP_FROZEN, + name=pydist.name.lower(), + version=pydist.version, + channel=Channel('pypi'), + subdir='pypi', + fn=basename(marker_file), + build='pypi_0', + build_number=0, + paths_data=paths_data, + depends=depends + ) + python_recs.append(python_rec) + self.__prefix_records[python_rec.name] = python_rec + + +class PythonRecord(PackageRef): + + depends = ListField(string_types, default=()) + paths_data = ComposableField(PathsData, required=False, nullable=True, default_in_dump=False) + package_type = EnumField(PackageType, required=False, nullable=True) + def get_python_version_for_prefix(prefix): # returns a string e.g. "2.7", "3.4", "3.5" or None @@ -202,3 +351,8 @@ def is_linked(prefix, dist): return prefix_record else: return None + + +if __name__ == '__main__': + pd = PrefixData('/Users/kfranz/anaconda') + pd._load_site_packages() diff --git a/conda/models/enums.py b/conda/models/enums.py --- a/conda/models/enums.py +++ b/conda/models/enums.py @@ -124,7 +124,8 @@ class PackageType(Enum): NOARCH_PYTHON = 'noarch_python' NOARCH_PRELINK_PYTHON = 'noarch_prelink_python' SHADOW_PRIVATE_ENV = 'shadow_private_env' - SHADOW_PIP = 'shadow_pip' + SHADOW_PIP_FROZEN = 'shadow_pip_frozen' # insufficient information to modify the package + SHADOW_PIP_UPDATEABLE = 'shadow_pip_updateable' # sufficient information to fully remove the package on disk (e.g. ALL paths owned by package are known), so that it can be replaced with a conda package class NoarchType(Enum):
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -1237,6 +1237,23 @@ def test_packages_not_found(self): use_exception_handler=True) assert "not-a-real-package" in stderr + def test_conda_pip_interop_dependency_satisfied_by_pip(self): + with make_temp_env("python") as prefix: + check_call(PYTHON_BINARY + " -m pip install itsdangerous", + cwd=prefix, shell=True) + + PrefixData._cache_.clear() + stdout, stderr = run_command(Commands.LIST, prefix) + assert 'itsdangerous' in stdout + assert not stderr + + stdout, stderr = run_command(Commands.INSTALL, prefix, 'flask --dry-run --json', use_exception_handler=True) + json_obj = json.loads(stdout) + print(json_obj) + assert any(rec["name"] == "flask" for rec in json_obj["actions"]["LINK"]) + assert not any(rec["name"] == "itsdangerous" for rec in json_obj["actions"]["LINK"]) + assert not stderr + @pytest.mark.skipif(on_win, reason="gawk is a windows only package") def test_search_gawk_not_win_1(self): with make_temp_env() as prefix:
Add pip shadow packages into PrefixData Epic at #7053 Teach PrefixData to recognize when python is installed in an environment, and then scan site-packages to find packages that don't have metadata in conda-meta. Also replace `conda/egg_info.py` and how it influences `conda list`.
2018-03-21T18:57:20
conda/conda
7,076
conda__conda-7076
[ "7075" ]
21ffc46789c8ba7fdd2fbe39a164bf641a886a63
diff --git a/conda/exceptions.py b/conda/exceptions.py --- a/conda/exceptions.py +++ b/conda/exceptions.py @@ -462,6 +462,13 @@ def __init__(self, packages, channel_urls=()): Current channels: %(channels_formatted)s + + To search for alternate channels that may provide the conda package you're + looking for, navigate to + + https://anaconda.org + + and use the search bar at the top of the page. """) packages_formatted = format_list(packages) channels_formatted = format_list(channel_urls)
Add anaconda.org search message to PackagesNotFoundError
2018-03-23T19:46:51
conda/conda
7,079
conda__conda-7079
[ "7078" ]
21ffc46789c8ba7fdd2fbe39a164bf641a886a63
diff --git a/conda/cli/activate.py b/conda/cli/activate.py --- a/conda/cli/activate.py +++ b/conda/cli/activate.py @@ -218,5 +218,9 @@ def main(): print(path) +print("WARNING: The conda.cli.activate module is deprecated and will be removed in a " + "future release.", file=sys.stderr) + + if __name__ == '__main__': main() diff --git a/conda/compat.py b/conda/compat.py --- a/conda/compat.py +++ b/conda/compat.py @@ -65,3 +65,7 @@ def __exit__(self, exc, value, tb): def __del__(self): # Issue a ResourceWarning if implicit cleanup needed self.cleanup(_warn=True) + + +print("WARNING: The conda.compat module is deprecated and will be removed in a future release.", + file=sys.stderr) diff --git a/conda/install.py b/conda/install.py --- a/conda/install.py +++ b/conda/install.py @@ -24,6 +24,7 @@ import os from os import chmod, makedirs, stat from os.path import dirname, isdir, isfile, join, normcase, normpath +import sys from .base.constants import PREFIX_PLACEHOLDER from .common.compat import on_win, open @@ -137,3 +138,7 @@ def symlink_conda_hlp(prefix, root_dir, where, symlink_fn): # pragma: no cover "another concurrent process." .format(root_file, prefix_file)) else: raise + + +print("WARNING: The conda.install module is deprecated and will be removed in a future release.", + file=sys.stderr)
Add deprecation warnings for conda 4.6 deprecated modules: * `conda.cli.activate` * `conda.compat` * `conda.install`
2018-03-25T03:53:44
conda/conda
7,096
conda__conda-7096
[ "7094" ]
21ffc46789c8ba7fdd2fbe39a164bf641a886a63
diff --git a/conda/misc.py b/conda/misc.py --- a/conda/misc.py +++ b/conda/misc.py @@ -18,12 +18,12 @@ from .core.link import PrefixSetup, UnlinkLinkTransaction from .core.package_cache_data import PackageCacheData, ProgressiveFetchExtract from .core.prefix_data import PrefixData, linked_data -from .exceptions import DisallowedPackageError, PackagesNotFoundError, ParseError +from .exceptions import DisallowedPackageError, DryRunExit, PackagesNotFoundError, ParseError from .gateways.disk.delete import rm_rf from .gateways.disk.link import islink, readlink, symlink from .models.dist import Dist -from .models.records import PackageRecord from .models.match_spec import MatchSpec +from .models.records import PackageRecord from .resolve import Resolve @@ -65,6 +65,9 @@ def explicit(specs, prefix, verbose=False, force_extract=True, index_args=None, fetch_specs.append(MatchSpec(url, md5=md5sum) if md5sum else MatchSpec(url)) + if context.dry_run: + raise DryRunExit() + pfe = ProgressiveFetchExtract(fetch_specs) pfe.execute() @@ -238,6 +241,9 @@ def clone_env(prefix1, prefix2, verbose=True, quiet=False, index_args=None): print('Packages: %d' % len(dists)) print('Files: %d' % len(untracked_files)) + if context.dry_run: + raise DryRunExit() + for f in untracked_files: src = join(prefix1, f) dst = join(prefix2, f)
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -656,6 +656,10 @@ def test_tarball_install_and_bad_metadata(self): assert isfile(tar_old_path) + with pytest.raises(DryRunExit): + run_command(Commands.INSTALL, prefix, tar_old_path, "--dry-run") + assert not package_is_installed(prefix, 'flask-0.') + # regression test for #2886 (part 1 of 2) # install tarball from package cache, default channel run_command(Commands.INSTALL, prefix, tar_old_path)
conda create --dry-run still does work <!-- 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 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.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, and especially if you are submitting a bug report, **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. --> **I'm submitting a...** - [x ] bug report - [ ] feature request ## Current Behavior `conda create --dry-run --clone py35 --prefix /home/amartin/.conda/envs/ml35 ` Creates a 7.5GB folder. ``` (py35) amartin@amartin-ai:~/.conda/envs$ ll total 184 -rw-rw-r-- 1 amartin amartin 183438 Mar 27 20:21 conda_clone_ml35.log drwxrwxr-x 10 amartin amartin 4096 Mar 27 20:20 ml35 (py35) amartin@amartin-ai:~/.conda/envs$ du -sh ml35 7.5G ml35 ``` Also gives an assert error that it apparently doesn't want to be a dry run: ``` # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 812, in __call__ return func(*args, **kwargs) File "/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/anaconda/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 77, in do_call exit_code = getattr(module, func_name)(args, parser) File "/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 11, in execute install(args, parser, 'create') File "/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 211, in install clone(args.clone, prefix, json=context.json, quiet=context.quiet, index_args=index_args) File "/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 72, in clone index_args=index_args) File "/anaconda/lib/python2.7/site-packages/conda/misc.py", line 271, in clone_env force_extract=False, index_args=index_args) File "/anaconda/lib/python2.7/site-packages/conda/misc.py", line 69, in explicit pfe.execute() File "/anaconda/lib/python2.7/site-packages/conda/core/package_cache_data.py", line 578, in execute assert not context.dry_run AssertionError ``` ### 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. --> ``` conda create --dry-run --clone py35 --prefix /home/amartin/.conda/envs/ml35 ``` ## Expected Behavior <!-- What do you think should happen? --> It should report actions to be taken without performing any actions ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` (ml35) amartin@amartin-ai:~/.conda/envs/ml35/lib/python3.5/site-packages$ conda info active environment : ml35 active env location : /home/amartin/.conda/envs/ml35 shell level : 1 user config file : /home/amartin/.condarc populated config files : conda version : 4.5.0 conda-build version : 3.0.23 python version : 2.7.11.final.0 base environment : /anaconda (writable) channel URLs : https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/linux-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /anaconda/pkgs /home/amartin/.conda/pkgs envs directories : /anaconda/envs /home/amartin/.conda/envs platform : linux-64 user-agent : conda/4.5.0 requests/2.18.4 CPython/2.7.11 Linux/4.13.0-1011-azure ubuntu/16.04 glibc/2.23 UID:GID : 1003:1003 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' --> ``` ``` </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' --> ``` ``` </p></details> [conda_clone_ml35.log](https://github.com/conda/conda/files/1853928/conda_clone_ml35.log)
[conda_clone_ml35.log](https://github.com/conda/conda/files/1853929/conda_clone_ml35.log)
2018-03-28T02:10:40
conda/conda
7,131
conda__conda-7131
[ "7107" ]
dc204a6061d95f6c04fd5551acb8b1889c046041
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -5,9 +5,7 @@ from errno import EXDEV from logging import getLogger from os.path import basename, dirname, getsize, join -from random import random import re -from time import sleep from uuid import uuid4 from .envs_manager import USER_ENVIRONMENTS_TXT_FILE, register_env, unregister_env @@ -17,7 +15,7 @@ from .._vendor.auxlib.ish import dals from ..base.constants import CONDA_TARBALL_EXTENSION from ..base.context import context -from ..common.compat import iteritems, on_win, range, text_type +from ..common.compat import iteritems, on_win, text_type from ..common.path import (get_bin_directory_short_path, get_leaf_directories, get_python_noarch_target_path, get_python_short_path, parse_entry_point_def, @@ -255,31 +253,13 @@ def __init__(self, transaction_context, package_info, def verify(self): if self.link_type != LinkType.directory and not lexists(self.source_full_path): # pragma: no cover # NOQA - # This backoff loop is added because of some weird race condition conda-build - # experiences. Would be nice at some point to get to the bottom of why it happens. - - # sum(((2 ** n) + random()) * 0.1 for n in range(2)) - # with max_retries = 2, max total time ~= 0.4 sec - # with max_retries = 3, max total time ~= 0.8 sec - # with max_retries = 6, max total time ~= 6.5 sec - count = self.transaction_context.get('_verify_backoff_count', 0) - max_retries = 6 if count < 4 else 3 - for n in range(max_retries): - sleep_time = ((2 ** n) + random()) * 0.1 - log.trace("retrying lexists(%s) in %g sec", self.source_full_path, sleep_time) - sleep(sleep_time) - if lexists(self.source_full_path): - break - else: - # only run the 6.5 second backoff time once - self.transaction_context['_verify_backoff_count'] = count + 1 - return CondaVerificationError(dals(""" - The package for %s located at %s - appears to be corrupted. The path '%s' - specified in the package manifest cannot be found. - """ % (self.package_info.index_json_record.name, - self.package_info.extracted_package_dir, - self.source_short_path))) + return CondaVerificationError(dals(""" + The package for %s located at %s + appears to be corrupted. The path '%s' + specified in the package manifest cannot be found. + """ % (self.package_info.index_json_record.name, + self.package_info.extracted_package_dir, + self.source_short_path))) source_path_data = self.source_path_data try:
Verify hangs when a package is corrupted **I'm submitting a...** - [x] bug report - [ ] feature request ## Current Behavior When installing a corrupted package, the verify step of conda hangs for a long time without telling anything. When running the same with `-v -v -v` one can see errors of type: ``` TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-1_61.dll) in 0.141842 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-1_61.dll) in 0.272421 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-1_61.dll) in 0.404178 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-1_61.dll) in 0.882638 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-1_61.dll) in 1.67327 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-1_61.dll) in 3.27765 sec DEBUG conda.core.link:_verify_individual_level(337): Verification error in action LinkPathAction(target_prefix='C:\\Miniconda3', target_short_path='Library/bin/boost_atomic-vc140-mt-1_61.dll', source_short_path='Library/bin/boost_atomic-vc140-mt-1_61.dll', source_path_data=PathDataV1(_path='Library/bin/boost_atomic-vc140-mt-1_61.dll', path_type='hardlink', sha256='8b4a03d09a79377afd2a761175341ec9fdb6a13d867b44a2bca243a84541a391', size_in_bytes=10240), source_prefix='C:\\Miniconda3\\pkgs\\boost-1.61.0-vc14h6b12553_2', _execute_successful=False, link_type=<LinkType.hardlink: 1>, prefix_path_data=None) conda.exceptions.CondaVerificationError: The package for boost located at C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2 appears to be corrupted. The path 'Library/bin/boost_atomic-vc140-mt-1_61.dll' specified in the package manifest cannot be found. TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-gd-1_61.dll) in 0.156715 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-gd-1_61.dll) in 0.271798 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-gd-1_61.dll) in 0.462018 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-gd-1_61.dll) in 0.885679 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-gd-1_61.dll) in 1.67949 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-gd-1_61.dll) in 3.26532 sec DEBUG conda.core.link:_verify_individual_level(337): Verification error in action LinkPathAction(target_prefix='C:\\Miniconda3', target_short_path='Library/bin/boost_atomic-vc140-mt-gd-1_61.dll', source_short_path='Library/bin/boost_atomic-vc140-mt-gd-1_61.dll', source_path_data=PathDataV1(_path='Library/bin/boost_atomic-vc140-mt-gd-1_61.dll', path_type='hardlink', sha256='df13333e7f1d40aa29fc0193a62d58d730691b09a0d291c981514206db9d25cd', size_in_bytes=16896), source_prefix='C:\\Miniconda3\\pkgs\\boost-1.61.0-vc14h6b12553_2', _execute_successful=False, link_type=<LinkType.hardlink: 1>, prefix_path_data=None) conda.exceptions.CondaVerificationError: The package for boost located at C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2 appears to be corrupted. The path 'Library/bin/boost_atomic-vc140-mt-gd-1_61.dll' specified in the package manifest cannot be found. ``` So what happens is: conda finds out that the linking doesn't seem to work for a file, it retries this file for 3.2 seconds, fails and then continues with the next file - which also fails. Now as you can see, the package is boost and it has 12475 files. This would go on for about 10-12hours, without saying anything to the user. We could not really reproduce why the package was corrupted in the first place but it seems after we cleaned the cache it worked.. ### Steps to Reproduce ``` conda install <a package with missing files> ``` ## Expected Behavior Conda should stop after the first verification error, maybe rollback and tell the user that verification failed.
I just ran into this last night too. I think we can probably remove all of that backoff code, because I don't think it actually ever helped with its intended purpose. Same goes for me. I think what hit this off for my machine was when I was running a `conda update --all` and realized a mistake and ctrl-c stopped the thing. The problem persisted with clearing the cache, running `conda clean --packages --tarballs` or even `conda clean --all`. What helped was going to the specific package in `/anaconda3/pkgs/` and removing it from there, reinstalling it later.
2018-04-06T07:46:38
conda/conda
7,133
conda__conda-7133
[ "4274", "4274" ]
ab96a967e6c75e67f075fb2899556bce79801c16
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.constants import NULL from ..common.io import swallow_broken_pipe from ..common.path import paths_equal from ..common.serialize import json_dump @@ -43,18 +44,18 @@ def confirm(message="Proceed", choices=('yes', 'no'), default='yes'): return choices[user_choice] -def confirm_yn(message="Proceed", default='yes'): - if context.dry_run: +def confirm_yn(message="Proceed", default='yes', dry_run=NULL): + dry_run = context.dry_run if dry_run is NULL else dry_run + if dry_run: from ..exceptions import DryRunExit raise DryRunExit() if context.always_yes: return True try: - choice = confirm(message=message, choices=('yes', 'no'), - default=default) + choice = confirm(message=message, choices=('yes', 'no')) except KeyboardInterrupt as e: # pragma: no cover from ..exceptions import CondaSystemExit - raise CondaSystemExit("\nOperation aborted. Exiting.", e) + raise CondaSystemExit("\nOperation aborted. Exiting.") if choice == 'no': from ..exceptions import CondaSystemExit raise CondaSystemExit("Exiting.") diff --git a/conda/cli/main_create.py b/conda/cli/main_create.py --- a/conda/cli/main_create.py +++ b/conda/cli/main_create.py @@ -3,10 +3,36 @@ from __future__ import absolute_import, division, print_function, unicode_literals +from logging import getLogger +from os.path import isdir + +from .common import confirm_yn from .install import install -from ..gateways.disk.delete import delete_trash +from ..base.context import context +from ..common.path import paths_equal +from ..exceptions import CondaValueError +from ..gateways.disk.delete import delete_trash, rm_rf +from ..gateways.disk.test import is_conda_environment + +log = getLogger(__name__) def execute(args, parser): + if is_conda_environment(context.target_prefix): + if paths_equal(context.target_prefix, context.root_prefix): + raise CondaValueError("The target prefix is the base prefix. Aborting.") + confirm_yn("WARNING: A conda environment already exists at '%s'\n" + "Removing existing environment" % context.target_prefix, + default='no', + dry_run=False) + log.info("Removing existing environment %s", context.target_prefix) + rm_rf(context.target_prefix) + elif isdir(context.target_prefix): + confirm_yn("WARNING: A directory already exists at the target location '%s'\n" + "but it is not a conda environment.\n" + "Continue creating environment" % context.target_prefix, + default='no', + dry_run=False) + install(args, parser, 'create') delete_trash() diff --git a/conda/exceptions.py b/conda/exceptions.py --- a/conda/exceptions.py +++ b/conda/exceptions.py @@ -285,7 +285,7 @@ def __init__(self, message, *args): class DryRunExit(CondaExitZero): def __init__(self): - msg = 'Dry run exiting' + msg = 'Dry run. Exiting.' super(DryRunExit, self).__init__(msg) @@ -295,11 +295,6 @@ def __init__(self, *args): super(CondaSystemExit, self).__init__(msg) -class SubprocessExit(CondaExitZero): - def __init__(self, *args, **kwargs): - super(SubprocessExit, self).__init__(*args, **kwargs) - - class PaddingError(CondaError): def __init__(self, dist, placeholder, placeholder_length): msg = ("Placeholder of length '%d' too short in package %s.\n" @@ -787,17 +782,25 @@ def maybe_raise(error, context): def print_conda_exception(exc_val, exc_tb=None): from .base.context import context + rc = getattr(exc_val, 'return_code', None) if context.debug or context.verbosity > 0: sys.stderr.write(_format_exc(exc_val, exc_tb)) sys.stderr.write('\n') elif context.json: - import json - stdoutlog = getLogger('conda.stdout') - exc_json = json.dumps(exc_val.dump_map(), indent=2, sort_keys=True, cls=EntityEncoder) - stdoutlog.info("%s\n" % exc_json) + if rc == 0: + # suppress DryRunExit and CondaSystemExit messages + pass + else: + import json + stdoutlog = getLogger('conda.stdout') + exc_json = json.dumps(exc_val.dump_map(), indent=2, sort_keys=True, cls=EntityEncoder) + stdoutlog.info("%s\n" % exc_json) else: stderrlog = getLogger('conda.stderr') - stderrlog.info("\n%r\n", exc_val) + if rc == 0: + stderrlog.info("\n%s\n", exc_val) + else: + stderrlog.info("\n%r\n", exc_val) def _format_exc(exc_val=None, exc_tb=None): @@ -842,9 +845,6 @@ def error_upload_url(self): return context.error_upload_url def handle_exception(self, exc_val, exc_tb): - return_code = getattr(exc_val, 'return_code', None) - if return_code == 0: - return 0 if isinstance(exc_val, CondaHTTPError): return self.handle_reportable_application_exception(exc_val, exc_tb) if isinstance(exc_val, CondaError):
ENH: add --force option to conda env create Both conda env create and conda create need a --force option that will overwrite the environment if it already exists. conda could warn the user and prompt for confirmation but must also allow for --yes option to not prompt so conda can be used effectively in automation scripts that won't have human interaction. ENH: add --force option to conda env create Both conda env create and conda create need a --force option that will overwrite the environment if it already exists. conda could warn the user and prompt for confirmation but must also allow for --yes option to not prompt so conda can be used effectively in automation scripts that won't have human interaction.
FWIW, the `--mkdir` flag on `conda install` creates a new environment if it doesn't already exists. Depending on your use case, it might be a close alternative that will work just as well. +1 on this. In general I've been having a really hard time using conda with automation. * You can't install it via package manager * There are tonnes of prompts you have to -y through (plus the non-obvious `-b` in the install script) * Ubuntu has dash shell by default, which breaks environment activation * Hard to make it work with Fabric * No idempotent way to create environments It seems like provisioning servers should be an important workflow, but using the tool it feels like not much thought has gone into this? FWIW, the `--mkdir` flag on `conda install` creates a new environment if it doesn't already exists. Depending on your use case, it might be a close alternative that will work just as well. +1 on this. In general I've been having a really hard time using conda with automation. * You can't install it via package manager * There are tonnes of prompts you have to -y through (plus the non-obvious `-b` in the install script) * Ubuntu has dash shell by default, which breaks environment activation * Hard to make it work with Fabric * No idempotent way to create environments It seems like provisioning servers should be an important workflow, but using the tool it feels like not much thought has gone into this?
2018-04-06T08:56:29
conda/conda
7,135
conda__conda-7135
[ "2154" ]
dc204a6061d95f6c04fd5551acb8b1889c046041
diff --git a/conda/core/solve.py b/conda/core/solve.py --- a/conda/core/solve.py +++ b/conda/core/solve.py @@ -189,15 +189,30 @@ def solve_final_state(self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, for spec in _track_fts_specs)) graph = PrefixGraph((index[dist] for dist in solution), itervalues(specs_map)) - removed_records = [] + all_removed_records = [] + no_removed_records_specs = [] for spec in specs_to_remove: # If the spec was a track_features spec, then we need to also remove every # package with a feature that matches the track_feature. The # `graph.remove_spec()` method handles that for us. log.trace("using PrefixGraph to remove records for %s", spec) - removed_records.extend(graph.remove_spec(spec)) + removed_records = graph.remove_spec(spec) + if removed_records: + all_removed_records.extend(removed_records) + else: + no_removed_records_specs.append(spec) + + # ensure that each spec in specs_to_remove is actually associated with removed records + unmatched_specs_to_remove = tuple( + spec for spec in no_removed_records_specs + if not any(spec.match(rec) for rec in all_removed_records) + ) + if unmatched_specs_to_remove: + raise PackagesNotFoundError( + tuple(sorted(str(s) for s in unmatched_specs_to_remove)) + ) - for rec in removed_records: + for rec in all_removed_records: # We keep specs (minus the feature part) for the non provides_features packages # if they're in the history specs. Otherwise, we pop them from the specs_map. rec_has_a_feature = set(rec.features or ()) & feature_names @@ -210,9 +225,6 @@ def solve_final_state(self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, solution = tuple(Dist(rec) for rec in graph.records) - if not removed_records and not prune: - raise PackagesNotFoundError(tuple(spec.name for spec in specs_to_remove)) - # We handle as best as possible environments in inconsistent states. To do this, # we remove now from consideration the set of packages causing inconsistencies, # and then we add them back in following the main SAT call.
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -710,6 +710,15 @@ def test_remove_all(self): assert exists(join(prefix, PYTHON_BINARY)) assert_package_is_installed(prefix, 'python') + # regression test for #2154 + with pytest.raises(PackagesNotFoundError) as exc: + run_command(Commands.REMOVE, prefix, 'python', 'foo', 'numpy') + assert repr(exc.value) == dals(""" + PackagesNotFoundError: The following packages are missing from the target environment: + - foo + - numpy + """) + run_command(Commands.REMOVE, prefix, '--all') assert not exists(prefix) @@ -995,13 +1004,14 @@ def test_update_deps_flag_present(self): assert package_is_installed(prefix, 'itsdangerous') assert package_is_installed(prefix, 'flask') + @pytest.mark.skipif(True, reason="Add this test back someday.") # @pytest.mark.skipif(not on_win, reason="shortcuts only relevant on Windows") - # def test_shortcut_in_underscore_env_shows_message(self): - # prefix = make_temp_prefix("_" + str(uuid4())[:7]) - # with make_temp_env(prefix=prefix): - # stdout, stderr = run_command(Commands.INSTALL, prefix, "console_shortcut") - # assert ("Environment name starts with underscore '_'. " - # "Skipping menu installation." in stderr) + def test_shortcut_in_underscore_env_shows_message(self): + prefix = make_temp_prefix("_" + str(uuid4())[:7]) + with make_temp_env(prefix=prefix): + stdout, stderr = run_command(Commands.INSTALL, prefix, "console_shortcut") + assert ("Environment name starts with underscore '_'. " + "Skipping menu installation." in stderr) @pytest.mark.skipif(not on_win, reason="shortcuts only relevant on Windows") def test_shortcut_not_attempted_with_no_shortcuts_arg(self): diff --git a/tests/test_instructions.py b/tests/test_instructions.py --- a/tests/test_instructions.py +++ b/tests/test_instructions.py @@ -41,14 +41,6 @@ def handle(self, record): class TestExecutePlan(unittest.TestCase): - # def test_invalid_instruction(self): - # index = {'This is an index': True} - # - # plan = [('DOES_NOT_EXIST', ())] - # - # with self.assertRaises(exceptions.InvalidInstruction): - # execute_instructions(plan, index, verbose=False) - def test_simple_instruction(self): index = {'This is an index': True} @@ -86,42 +78,6 @@ def simple_cmd(state, arg): execute_instructions(plan, index, verbose=False) self.assertTrue(simple_cmd.called) - # def test_progess(self): - # - # index = {'This is an index': True} - # - # plan = [ - # ('PROGRESS', '2'), - # ('LINK', 'ipython'), - # ('LINK', 'menuinst'), - # ] - # - # def cmd(state, arg): - # pass # NO-OP - # - # _commands = {'PROGRESS': PROGRESS_CMD, 'LINK': cmd, 'UNLINKLINKTRANSACTION': cmd} - # h = LoggingTestHandler() - # - # update_logger = getLogger('progress.update') - # update_logger.setLevel(DEBUG) - # update_logger.addHandler(h) - # - # stop_logger = getLogger('progress.stop') - # stop_logger.setLevel(DEBUG) - # stop_logger.addHandler(h) - # - # execute_instructions(plan, index, _commands=_commands) - # - # update_logger.removeHandler(h) - # stop_logger.removeHandler(h) - # - # expected = [('progress.update', ('ipython', 0)), - # ('progress.update', ('menuinst', 1)), - # ('progress.stop', None) - # ] - # - # self.assertEqual(h.records, expected) - def test_check_files_in_tarball_files_exist(self): source_dir = os.getcwd() files = [__file__] diff --git a/tests/test_plan.py b/tests/test_plan.py --- a/tests/test_plan.py +++ b/tests/test_plan.py @@ -90,52 +90,6 @@ def check(self, specs, added): specs = [s.split(' (')[0] for s in specs] self.assertEqual(specs, new_specs) - # def test_1(self): - # self.linked = solve(['anaconda 1.5.0', 'python 2.7*', 'numpy 1.7*']) - # for specs, added in [ - # (['python 3*'], []), - # (['python'], ['python 2.7*']), - # (['scipy'], ['python 2.7*']), - # ]: - # self.check(specs, added) - # - # def test_2(self): - # self.linked = solve(['anaconda 1.5.0', 'python 2.6*', 'numpy 1.6*']) - # for specs, added in [ - # (['python'], ['python 2.6*']), - # (['numpy'], ['python 2.6*']), - # (['pandas'], ['python 2.6*']), - # # however, this would then be unsatisfiable - # (['python 3*', 'numpy'], []), - # ]: - # self.check(specs, added) - # - # def test_3(self): - # self.linked = solve(['anaconda 1.5.0', 'python 3.3*']) - # for specs, added in [ - # (['python'], ['python 3.3*']), - # (['numpy'], ['python 3.3*']), - # (['scipy'], ['python 3.3*']), - # ]: - # self.check(specs, added) - # - # def test_4(self): - # self.linked = [] - # for dp in ('2.7', '3.5'): - # with env_var('CONDA_DEFAULT_PYTHON', dp, reset_context): - # ps = ['python 2.7*'] if context.default_python == '2.7' else [] - # for specs, added in [ - # (['python'], ps), - # (['numpy'], ps), - # (['scipy'], ps), - # (['anaconda'], ps), - # (['anaconda 1.5.0 np17py27_0'], []), - # (['sympy 0.7.2 py27_0'], []), - # (['scipy 0.12.0 np16py27_0'], []), - # (['anaconda', 'python 3*'], []), - # ]: - # self.check(specs, added) - def test_display_actions_0(): os.environ['CONDA_SHOW_CHANNEL_URLS'] = 'False'
conda remove doesn't complain if only some of the packages don't exist If I do `conda remove foo bar` and neither of them are in the current environment then I get an error. However if I do `conda remove foo bar` and `foo` is present but `bar` is not then `foo` gets removed but there is no error or warning that `bar` wasn't there and was not removed. I discovered this because I misunderstood the behavior of the `--features` flag, so it also applies to removing features. I would suggest that a warning is required as a minimum, and perhaps it should be an error to be "symmetric" with a `conda install foo bar` where `foo` exists to be installed but `bar` does not (which just reports an error, and does not install anything).
2018-04-08T00:08:49
conda/conda
7,146
conda__conda-7146
[ "7145", "7145" ]
9ff2d6763bd02c541c596ac7800d227bccb4756c
diff --git a/conda/common/io.py b/conda/common/io.py --- a/conda/common/io.py +++ b/conda/common/io.py @@ -387,7 +387,8 @@ def __init__(self, description, enabled=True, json=False): elif enabled: bar_format = "{desc}{bar} | {percentage:3.0f}% " try: - self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1) + self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1, + file=sys.stdout) except EnvironmentError as e: if e.errno in (EPIPE, ESHUTDOWN): self.enabled = False
progress bar uses stderr instead of stdout This appears to be a regression of https://github.com/conda/conda/issues/536 conda version : 4.5.0 conda-build version : 3.8.0 python version : 3.5.5.final.0 platform : win-64 Run a command such as follows: conda create --yes -n TestEnv1 requests > stdout.txt 2> stderr.txt Note that all the progress bar output goes into stderr.txt, while the rest goes into stdout.txt, as expected. Here's my stderr.txt: win_inet_pton 1.0.1: | 0% win_inet_pton 1.0.1: ########## | 100% cffi 1.11.5: | 0% cffi 1.11.5: #######5 | 75% cffi 1.11.5: #########6 | 96% cffi 1.11.5: ########## | 100% pycparser 2.18: | 0% pycparser 2.18: #######5 | 75% pycparser 2.18: #########7 | 97% pycparser 2.18: ########## | 100% pip 9.0.3: | 0% pip 9.0.3: #3 | 14% pip 9.0.3: #####7 | 57% pip 9.0.3: #######5 | 75% pip 9.0.3: ########7 | 87% pip 9.0.3: #########6 | 97% pip 9.0.3: ########## | 100% chardet 3.0.4: | 0% chardet 3.0.4: #######5 | 75% chardet 3.0.4: #########5 | 95% chardet 3.0.4: ########## | 100% six 1.11.0: | 0% six 1.11.0: ########1 | 82% six 1.11.0: ########## | 100% vs2015_runtime 14.0.25420: | 0% vs2015_runtime 14.0.25420: ###1 | 31% vs2015_runtime 14.0.25420: #######5 | 75% vs2015_runtime 14.0.25420: ########5 | 86% vs2015_runtime 14.0.25420: #########5 | 95% vs2015_runtime 14.0.25420: ########## | 100% certifi 2018.1.18: | 0% certifi 2018.1.18: ########8 | 88% certifi 2018.1.18: ########## | 100% openssl 1.0.2o: | 0% openssl 1.0.2o: 1 | 2% openssl 1.0.2o: #8 | 18% openssl 1.0.2o: ###6 | 36% openssl 1.0.2o: #####4 | 55% openssl 1.0.2o: #######3 | 73% openssl 1.0.2o: ########5 | 86% openssl 1.0.2o: #########5 | 96% openssl 1.0.2o: ########## | 100% idna 2.6: | 0% idna 2.6: #######8 | 79% idna 2.6: ########## | 100% asn1crypto 0.24.0: | 0% asn1crypto 0.24.0: #######5 | 75% asn1crypto 0.24.0: #########5 | 95% asn1crypto 0.24.0: ########## | 100% pysocks 1.6.8: | 0% pysocks 1.6.8: ########## | 100% cryptography 2.2.2: | 0% cryptography 2.2.2: 2 | 2% cryptography 2.2.2: #######5 | 75% cryptography 2.2.2: #########3 | 93% cryptography 2.2.2: ########## | 100% urllib3 1.22: | 0% urllib3 1.22: #######5 | 75% urllib3 1.22: #########5 | 96% urllib3 1.22: ########## | 100% requests 2.18.4: | 0% requests 2.18.4: #######7 | 77% requests 2.18.4: ########## | 100% python 3.6.5: | 0% python 3.6.5: 2 | 3% python 3.6.5: 7 | 7% python 3.6.5: #2 | 12% python 3.6.5: #6 | 17% python 3.6.5: ##1 | 21% python 3.6.5: ##5 | 26% python 3.6.5: ### | 30% python 3.6.5: ###4 | 35% python 3.6.5: ###9 | 40% python 3.6.5: ####4 | 44% python 3.6.5: ####8 | 48% python 3.6.5: #####2 | 53% python 3.6.5: #####7 | 58% python 3.6.5: ######2 | 62% python 3.6.5: ######6 | 67% python 3.6.5: #######1 | 71% python 3.6.5: #######5 | 76% python 3.6.5: #######8 | 79% python 3.6.5: ########1 | 81% python 3.6.5: ########2 | 83% python 3.6.5: ########4 | 84% python 3.6.5: ########5 | 85% python 3.6.5: ########5 | 86% python 3.6.5: ########6 | 87% python 3.6.5: ########7 | 87% python 3.6.5: ########7 | 88% python 3.6.5: ########8 | 88% python 3.6.5: ########8 | 89% python 3.6.5: ########8 | 89% python 3.6.5: ########9 | 89% python 3.6.5: ########9 | 90% python 3.6.5: ########9 | 90% python 3.6.5: ######### | 90% python 3.6.5: ######### | 91% python 3.6.5: ######### | 91% python 3.6.5: #########1 | 91% python 3.6.5: #########1 | 92% python 3.6.5: #########1 | 92% python 3.6.5: #########2 | 92% python 3.6.5: #########2 | 93% python 3.6.5: #########2 | 93% python 3.6.5: #########3 | 93% python 3.6.5: #########3 | 93% python 3.6.5: #########3 | 94% python 3.6.5: #########4 | 94% python 3.6.5: #########4 | 94% python 3.6.5: #########4 | 95% python 3.6.5: #########4 | 95% python 3.6.5: #########5 | 95% python 3.6.5: #########5 | 95% python 3.6.5: #########5 | 96% python 3.6.5: #########6 | 96% python 3.6.5: #########6 | 96% python 3.6.5: #########6 | 97% python 3.6.5: #########6 | 97% python 3.6.5: #########7 | 97% python 3.6.5: #########7 | 97% python 3.6.5: #########7 | 98% python 3.6.5: #########7 | 98% python 3.6.5: #########8 | 98% python 3.6.5: #########8 | 98% python 3.6.5: #########8 | 99% python 3.6.5: #########8 | 99% python 3.6.5: #########8 | 99% python 3.6.5: #########9 | 99% python 3.6.5: #########9 | 99% python 3.6.5: #########9 | 100% python 3.6.5: #########9 | 100% python 3.6.5: #########9 | 100% python 3.6.5: #########9 | 100% python 3.6.5: ########## | 100% pyopenssl 17.5.0: | 0% pyopenssl 17.5.0: ########5 | 86% pyopenssl 17.5.0: ########## | 100% setuptools 39.0.1: | 0% setuptools 39.0.1: #######5 | 75% setuptools 39.0.1: ########9 | 89% setuptools 39.0.1: ########## | 100% ca-certificates 2018.03.07: | 0% ca-certificates 2018.03.07: #######6 | 77% ca-certificates 2018.03.07: ########## | 100% wincertstore 0.2: | 0% wincertstore 0.2: ########## | 100% wheel 0.31.0: | 0% wheel 0.31.0: ########5 | 86% wheel 0.31.0: ########## | 100% vc 14: | 0% vc 14: ########## | 100% progress bar uses stderr instead of stdout This appears to be a regression of https://github.com/conda/conda/issues/536 conda version : 4.5.0 conda-build version : 3.8.0 python version : 3.5.5.final.0 platform : win-64 Run a command such as follows: conda create --yes -n TestEnv1 requests > stdout.txt 2> stderr.txt Note that all the progress bar output goes into stderr.txt, while the rest goes into stdout.txt, as expected. Here's my stderr.txt: win_inet_pton 1.0.1: | 0% win_inet_pton 1.0.1: ########## | 100% cffi 1.11.5: | 0% cffi 1.11.5: #######5 | 75% cffi 1.11.5: #########6 | 96% cffi 1.11.5: ########## | 100% pycparser 2.18: | 0% pycparser 2.18: #######5 | 75% pycparser 2.18: #########7 | 97% pycparser 2.18: ########## | 100% pip 9.0.3: | 0% pip 9.0.3: #3 | 14% pip 9.0.3: #####7 | 57% pip 9.0.3: #######5 | 75% pip 9.0.3: ########7 | 87% pip 9.0.3: #########6 | 97% pip 9.0.3: ########## | 100% chardet 3.0.4: | 0% chardet 3.0.4: #######5 | 75% chardet 3.0.4: #########5 | 95% chardet 3.0.4: ########## | 100% six 1.11.0: | 0% six 1.11.0: ########1 | 82% six 1.11.0: ########## | 100% vs2015_runtime 14.0.25420: | 0% vs2015_runtime 14.0.25420: ###1 | 31% vs2015_runtime 14.0.25420: #######5 | 75% vs2015_runtime 14.0.25420: ########5 | 86% vs2015_runtime 14.0.25420: #########5 | 95% vs2015_runtime 14.0.25420: ########## | 100% certifi 2018.1.18: | 0% certifi 2018.1.18: ########8 | 88% certifi 2018.1.18: ########## | 100% openssl 1.0.2o: | 0% openssl 1.0.2o: 1 | 2% openssl 1.0.2o: #8 | 18% openssl 1.0.2o: ###6 | 36% openssl 1.0.2o: #####4 | 55% openssl 1.0.2o: #######3 | 73% openssl 1.0.2o: ########5 | 86% openssl 1.0.2o: #########5 | 96% openssl 1.0.2o: ########## | 100% idna 2.6: | 0% idna 2.6: #######8 | 79% idna 2.6: ########## | 100% asn1crypto 0.24.0: | 0% asn1crypto 0.24.0: #######5 | 75% asn1crypto 0.24.0: #########5 | 95% asn1crypto 0.24.0: ########## | 100% pysocks 1.6.8: | 0% pysocks 1.6.8: ########## | 100% cryptography 2.2.2: | 0% cryptography 2.2.2: 2 | 2% cryptography 2.2.2: #######5 | 75% cryptography 2.2.2: #########3 | 93% cryptography 2.2.2: ########## | 100% urllib3 1.22: | 0% urllib3 1.22: #######5 | 75% urllib3 1.22: #########5 | 96% urllib3 1.22: ########## | 100% requests 2.18.4: | 0% requests 2.18.4: #######7 | 77% requests 2.18.4: ########## | 100% python 3.6.5: | 0% python 3.6.5: 2 | 3% python 3.6.5: 7 | 7% python 3.6.5: #2 | 12% python 3.6.5: #6 | 17% python 3.6.5: ##1 | 21% python 3.6.5: ##5 | 26% python 3.6.5: ### | 30% python 3.6.5: ###4 | 35% python 3.6.5: ###9 | 40% python 3.6.5: ####4 | 44% python 3.6.5: ####8 | 48% python 3.6.5: #####2 | 53% python 3.6.5: #####7 | 58% python 3.6.5: ######2 | 62% python 3.6.5: ######6 | 67% python 3.6.5: #######1 | 71% python 3.6.5: #######5 | 76% python 3.6.5: #######8 | 79% python 3.6.5: ########1 | 81% python 3.6.5: ########2 | 83% python 3.6.5: ########4 | 84% python 3.6.5: ########5 | 85% python 3.6.5: ########5 | 86% python 3.6.5: ########6 | 87% python 3.6.5: ########7 | 87% python 3.6.5: ########7 | 88% python 3.6.5: ########8 | 88% python 3.6.5: ########8 | 89% python 3.6.5: ########8 | 89% python 3.6.5: ########9 | 89% python 3.6.5: ########9 | 90% python 3.6.5: ########9 | 90% python 3.6.5: ######### | 90% python 3.6.5: ######### | 91% python 3.6.5: ######### | 91% python 3.6.5: #########1 | 91% python 3.6.5: #########1 | 92% python 3.6.5: #########1 | 92% python 3.6.5: #########2 | 92% python 3.6.5: #########2 | 93% python 3.6.5: #########2 | 93% python 3.6.5: #########3 | 93% python 3.6.5: #########3 | 93% python 3.6.5: #########3 | 94% python 3.6.5: #########4 | 94% python 3.6.5: #########4 | 94% python 3.6.5: #########4 | 95% python 3.6.5: #########4 | 95% python 3.6.5: #########5 | 95% python 3.6.5: #########5 | 95% python 3.6.5: #########5 | 96% python 3.6.5: #########6 | 96% python 3.6.5: #########6 | 96% python 3.6.5: #########6 | 97% python 3.6.5: #########6 | 97% python 3.6.5: #########7 | 97% python 3.6.5: #########7 | 97% python 3.6.5: #########7 | 98% python 3.6.5: #########7 | 98% python 3.6.5: #########8 | 98% python 3.6.5: #########8 | 98% python 3.6.5: #########8 | 99% python 3.6.5: #########8 | 99% python 3.6.5: #########8 | 99% python 3.6.5: #########9 | 99% python 3.6.5: #########9 | 99% python 3.6.5: #########9 | 100% python 3.6.5: #########9 | 100% python 3.6.5: #########9 | 100% python 3.6.5: #########9 | 100% python 3.6.5: ########## | 100% pyopenssl 17.5.0: | 0% pyopenssl 17.5.0: ########5 | 86% pyopenssl 17.5.0: ########## | 100% setuptools 39.0.1: | 0% setuptools 39.0.1: #######5 | 75% setuptools 39.0.1: ########9 | 89% setuptools 39.0.1: ########## | 100% ca-certificates 2018.03.07: | 0% ca-certificates 2018.03.07: #######6 | 77% ca-certificates 2018.03.07: ########## | 100% wincertstore 0.2: | 0% wincertstore 0.2: ########## | 100% wheel 0.31.0: | 0% wheel 0.31.0: ########5 | 86% wheel 0.31.0: ########## | 100% vc 14: | 0% vc 14: ########## | 100%
2018-04-10T17:31:27
conda/conda
7,162
conda__conda-7162
[ "7061" ]
660f35a2f5755f513b32932d400abaa8d944535e
diff --git a/conda/base/constants.py b/conda/base/constants.py --- a/conda/base/constants.py +++ b/conda/base/constants.py @@ -67,17 +67,19 @@ 'https://repo.anaconda.com/pkgs/main', 'https://repo.anaconda.com/pkgs/free', 'https://repo.anaconda.com/pkgs/r', - 'https://repo.anaconda.com/pkgs/pro', ) DEFAULT_CHANNELS_WIN = ( 'https://repo.anaconda.com/pkgs/main', 'https://repo.anaconda.com/pkgs/free', 'https://repo.anaconda.com/pkgs/r', - 'https://repo.anaconda.com/pkgs/pro', 'https://repo.anaconda.com/pkgs/msys2', ) +DEFAULT_CUSTOM_CHANNELS = { + 'pkgs/pro': 'https://repo.anaconda.com', +} + # use the bool(sys.platform == "win32") definition here so we don't import .compat.on_win DEFAULT_CHANNELS = DEFAULT_CHANNELS_WIN if bool(sys.platform == "win32") else DEFAULT_CHANNELS_UNIX diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -10,9 +10,9 @@ import sys from .constants import (APP_NAME, DEFAULTS_CHANNEL_NAME, DEFAULT_AGGRESSIVE_UPDATE_PACKAGES, - DEFAULT_CHANNELS, DEFAULT_CHANNEL_ALIAS, ERROR_UPLOAD_URL, - PLATFORM_DIRECTORIES, PREFIX_MAGIC_FILE, PathConflict, ROOT_ENV_NAME, - SEARCH_PATH, SafetyChecks) + DEFAULT_CHANNELS, DEFAULT_CHANNEL_ALIAS, DEFAULT_CUSTOM_CHANNELS, + ERROR_UPLOAD_URL, PLATFORM_DIRECTORIES, PREFIX_MAGIC_FILE, PathConflict, + ROOT_ENV_NAME, SEARCH_PATH, SafetyChecks) from .. import __version__ as CONDA_VERSION from .._vendor.appdirs import user_data_dir from .._vendor.auxlib.collection import frozendict @@ -173,7 +173,8 @@ class Context(Configuration): channel_priority = PrimitiveParameter(True) _channels = SequenceParameter(string_types, default=(DEFAULTS_CHANNEL_NAME,), aliases=('channels', 'channel',)) # channel for args.channel - _custom_channels = MapParameter(string_types, aliases=('custom_channels',)) + _custom_channels = MapParameter(string_types, DEFAULT_CUSTOM_CHANNELS, + aliases=('custom_channels',)) _custom_multichannels = MapParameter(list, aliases=('custom_multichannels',)) _default_channels = SequenceParameter(string_types, DEFAULT_CHANNELS, aliases=('default_channels',))
diff --git a/tests/models/test_channel.py b/tests/models/test_channel.py --- a/tests/models/test_channel.py +++ b/tests/models/test_channel.py @@ -39,8 +39,7 @@ def setUpClass(cls): 'https://repo.anaconda.com/pkgs/free/noarch', 'https://repo.anaconda.com/pkgs/r/%s' % cls.platform, 'https://repo.anaconda.com/pkgs/r/noarch', - 'https://repo.anaconda.com/pkgs/pro/%s' % cls.platform, - 'https://repo.anaconda.com/pkgs/pro/noarch'] + ] if on_win: cls.DEFAULT_URLS.extend(['https://repo.anaconda.com/pkgs/msys2/%s' % cls.platform, 'https://repo.anaconda.com/pkgs/msys2/noarch']) @@ -1000,15 +999,12 @@ def test_multichannel_priority(): ('https://repo.anaconda.com/pkgs/r/new-optimized-subdir', ('defaults', 3)), ('https://repo.anaconda.com/pkgs/r/linux-32', ('defaults', 3)), ('https://repo.anaconda.com/pkgs/r/noarch', ('defaults', 3)), - ('https://repo.anaconda.com/pkgs/pro/new-optimized-subdir', ('defaults', 4)), - ('https://repo.anaconda.com/pkgs/pro/linux-32', ('defaults', 4)), - ('https://repo.anaconda.com/pkgs/pro/noarch', ('defaults', 4)), - ('https://repo.anaconda.com/pkgs/msys2/new-optimized-subdir', ('defaults', 5)), - ('https://repo.anaconda.com/pkgs/msys2/linux-32', ('defaults', 5)), - ('https://repo.anaconda.com/pkgs/msys2/noarch', ('defaults', 5)), - ('https://conda.anaconda.org/conda-forge/new-optimized-subdir', ('conda-forge', 6)), - ('https://conda.anaconda.org/conda-forge/linux-32', ('conda-forge', 6)), - ('https://conda.anaconda.org/conda-forge/noarch', ('conda-forge', 6)), + ('https://repo.anaconda.com/pkgs/msys2/new-optimized-subdir', ('defaults', 4)), + ('https://repo.anaconda.com/pkgs/msys2/linux-32', ('defaults', 4)), + ('https://repo.anaconda.com/pkgs/msys2/noarch', ('defaults', 4)), + ('https://conda.anaconda.org/conda-forge/new-optimized-subdir', ('conda-forge', 5)), + ('https://conda.anaconda.org/conda-forge/linux-32', ('conda-forge', 5)), + ('https://conda.anaconda.org/conda-forge/noarch', ('conda-forge', 5)), ]) else: assert channel_priority_map == OrderedDict([ @@ -1024,10 +1020,7 @@ def test_multichannel_priority(): ('https://repo.anaconda.com/pkgs/r/new-optimized-subdir', ('defaults', 3)), ('https://repo.anaconda.com/pkgs/r/linux-32', ('defaults', 3)), ('https://repo.anaconda.com/pkgs/r/noarch', ('defaults', 3)), - ('https://repo.anaconda.com/pkgs/pro/new-optimized-subdir', ('defaults', 4)), - ('https://repo.anaconda.com/pkgs/pro/linux-32', ('defaults', 4)), - ('https://repo.anaconda.com/pkgs/pro/noarch', ('defaults', 4)), - ('https://conda.anaconda.org/conda-forge/new-optimized-subdir', ('conda-forge', 5)), - ('https://conda.anaconda.org/conda-forge/linux-32', ('conda-forge', 5)), - ('https://conda.anaconda.org/conda-forge/noarch', ('conda-forge', 5)), + ('https://conda.anaconda.org/conda-forge/new-optimized-subdir', ('conda-forge', 4)), + ('https://conda.anaconda.org/conda-forge/linux-32', ('conda-forge', 4)), + ('https://conda.anaconda.org/conda-forge/noarch', ('conda-forge', 4)), ])
Remove pkgs/pro from defaults in conda 4.6 For the release for conda 4.6.0, remove `https://repo.anaconda.com/pkgs/pro` from the default value for `defaults`.
2018-04-13T15:26:29
conda/conda
7,178
conda__conda-7178
[ "6385" ]
7d34331b2e98ec1bb1e0028d0ea1e1b2829db4d4
diff --git a/conda_env/installers/conda.py b/conda_env/installers/conda.py --- a/conda_env/installers/conda.py +++ b/conda_env/installers/conda.py @@ -11,19 +11,8 @@ def install(prefix, specs, args, env, *_, **kwargs): # TODO: support all various ways this happens # Including 'nodefaults' in the channels list disables the defaults - new_specs = [] - channel_urls = set() - for elem in specs: - if "::" in elem: - channel_urls.add(elem.split("::")[0]) - new_specs.append(elem.split("::")[-1]) - else: - new_specs.append(elem) - specs = new_specs - channel_urls = list(channel_urls) - # TODO: support all various ways this happens - # Including 'nodefaults' in the channels list disables the defaults - channel_urls = channel_urls + [chan for chan in env.channels if chan != 'nodefaults'] + channel_urls = [chan for chan in env.channels if chan != 'nodefaults'] + if 'nodefaults' not in env.channels: channel_urls.extend(context.channels) _channel_priority_map = prioritize_channels(channel_urls)
Channel pins in "environment.yaml" files are not saved to package specs Channel pins specified in environment files are not respected. For example,run ```conda env create``` with this environment file: ```yaml name: channel-not-written-to-user-specs dependencies: - defaults::six ``` If we look at conda-meta/six*.json we can see that the channel pin has not been added to specs. Where we should read ```"requested_spec": "defaults::six"```, we only find ```"requested_spec": "six"```. This is with conda 4.4.0rc2.
@kalefranz This keeps being problematic for us. At the moment, I workaround it by avoiding calling ```conda env create``` at all. Instead I parse the yaml file myself and call ```conda install``` - it is a very simple piece of code. I think a similar approach could be used in the conda-env installer: remove most of that code and make it a very thin wrapper around conda create/install. Would that be the best approach to solve this and other future problem with conda-env not keeping up with changes? Perhaps I do not understand well and there is a reason why this code duplication needs to happen.
2018-04-18T01:22:21
conda/conda
7,191
conda__conda-7191
[ "7189" ]
35c57be3d7bb714b149e435699f832d3ae0c0c81
diff --git a/conda/core/package_cache_data.py b/conda/core/package_cache_data.py --- a/conda/core/package_cache_data.py +++ b/conda/core/package_cache_data.py @@ -31,6 +31,7 @@ from ..models.dist import Dist from ..models.match_spec import MatchSpec from ..models.records import PackageCacheRecord, PackageRecord, PackageRef +from ..utils import human_bytes try: from cytoolz.itertoolz import concat, concatv, groupby @@ -625,7 +626,12 @@ def _execute_actions(prec_or_spec, actions): if cache_axn is None and extract_axn is None: return - desc = "%s %s" % (prec_or_spec.name, prec_or_spec.version) + desc = "%s-%s" % (prec_or_spec.name, prec_or_spec.version) + if len(desc) > 20: + desc = desc[:20] + size = getattr(prec_or_spec, 'size', None) + desc = "%-20s | %7s | " % (desc, size and human_bytes(size) or '') + progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) download_total = 0.75 # fraction of progress for download; the rest goes to extract
Progress bar changes/issues In `conda` 4.3+ the progress bar looks something like this... ``` pycrypto-2.6.1 100% |################################| Time: 0:00:00 6.79 MB/s pytz-2018.4-py 100% |################################| Time: 0:00:00 9.22 MB/s ``` ...it has a nice tabular view and separates out package name, percentage, time, and download speed. In `conda` 4.5+, the progress bar looks like this... ``` ndg-httpsclient 0.4.4################################################### | 100% libffi 3.2.1############################################################ | 100% ``` Here the progress bar starts right near where the version ends. Making it a little hard to read. Also this start point varies depending on package name and the like, which is a bit distracting. Now I'm not sure if this is an intentional change or if I'm running into a bug. Would be great to know either way. If it is an intentional change, would encourage reconsidering.
I agree that the UI here could be improved. Do you know what caused the shift?
2018-04-19T17:50:44
conda/conda
7,211
conda__conda-7211
[ "7210" ]
3fb42140a7fe3c2298e7ffcbadaa7353ab7b4b17
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 @@ -529,6 +529,11 @@ def configure_parser_create(sub_parsers): action="store_true", help='Ignore create_default_packages in the .condarc file.', ) + p.add_argument( + '-m', "--mkdir", + action="store_true", + help=SUPPRESS, + ) p.set_defaults(func='.main_create.execute')
canary: mkdir option removed from conda create on a minor bump On conda 4.5 ```bash $ conda create -n testmkdir --mkdir ``` It works On 4.6 on canary ```bash $ conda create -n testmkdir --mkdir ``` It fails. Removing an option from the CLI in a minor version sounds like a no no. Could we instead deprecate (even if the option does not do anything?)
2018-04-25T14:40:49
conda/conda
7,216
conda__conda-7216
[ "6979" ]
a3b766934a6da0926a7c16eaec69ae5e448f7806
diff --git a/conda/plan.py b/conda/plan.py --- a/conda/plan.py +++ b/conda/plan.py @@ -291,24 +291,24 @@ def _remove_actions(prefix, specs, index, force=False, pinned=True): # pragma: if force: mss = list(map(MatchSpec, specs)) - nlinked = {r.package_name(dist): dist + nlinked = {dist.name: dist for dist in linked_dists if not any(r.match(ms, dist) for ms in mss)} else: add_defaults_to_specs(r, linked_dists, specs, update=True) - nlinked = {r.package_name(dist): dist + nlinked = {dist.name: dist for dist in (Dist(fn) for fn in r.remove(specs, set(linked_dists)))} if pinned: pinned_specs = get_pinned_specs(prefix) log.debug("Pinned specs=%s", pinned_specs) - linked = {r.package_name(dist): dist for dist in linked_dists} + linked = {dist.name: dist for dist in linked_dists} actions = ensure_linked_actions(r.dependency_sort(nlinked), prefix) for old_dist in reversed(r.dependency_sort(linked)): # dist = old_fn + '.tar.bz2' - name = r.package_name(old_dist) + name = old_dist.name if old_dist == nlinked.get(name): continue if pinned and any(r.match(ms, old_dist) for ms in pinned_specs): diff --git a/conda/resolve.py b/conda/resolve.py --- a/conda/resolve.py +++ b/conda/resolve.py @@ -12,11 +12,11 @@ from .common.toposort import toposort from .exceptions import ResolvePackageNotFound, UnsatisfiableError from .models.channel import Channel, MultiChannel -from .models.dist import Dist from .models.enums import NoarchType -from .models.records import PackageRef +from .models.records import PackageRef, PackageRecord from .models.match_spec import MatchSpec from .models.version import VersionOrder +from .core.subdir_data import make_feature_record try: from cytoolz.itertoolz import concat, groupby @@ -38,6 +38,8 @@ def dashlist(iterable, indent=2): class Resolve(object): def __init__(self, index, sort=False, processed=False, channels=()): + assert all(isinstance(prec, PackageRecord) for prec in itervalues(index)) + assert all(isinstance(prec, PackageRecord) for prec in iterkeys(index)) self.index = index self.channels = channels @@ -46,15 +48,15 @@ def __init__(self, index, sort=False, processed=False, channels=()): groups = {} trackers = defaultdict(list) - for dist, info in iteritems(index): - groups.setdefault(info['name'], []).append(dist) + for _, info in iteritems(index): + groups.setdefault(info['name'], []).append(info) for feature_name in info.get('track_features') or (): - trackers[feature_name].append(dist) + trackers[feature_name].append(info) - self.groups = groups # Dict[package_name, List[Dist]] - self.trackers = trackers # Dict[track_feature, List[Dist]] - self.find_matches_ = {} # Dict[MatchSpec, List[Dist]] - self.ms_depends_ = {} # Dict[Dist, List[MatchSpec]] + self.groups = groups # Dict[package_name, List[PackageRecord]] + self.trackers = trackers # Dict[track_feature, List[PackageRecord]] + self.find_matches_ = {} # Dict[MatchSpec, List[PackageRecord]] + self.ms_depends_ = {} # Dict[PackageRecord, List[MatchSpec]] self._reduced_index_cache = {} if sort: @@ -66,17 +68,18 @@ def default_filter(self, features=None, filter=None): filter = {} else: filter.clear() - filter.update({Dist(fstr+'@'): False for fstr in iterkeys(self.trackers)}) + + filter.update({make_feature_record(fstr): False for fstr in iterkeys(self.trackers)}) if features: - filter.update({Dist(fstr+'@'): True for fstr in features}) + filter.update({make_feature_record(fstr): True for fstr in features}) return filter - def valid(self, spec_or_dist, filter, optional=True): + def valid(self, spec_or_prec, filter, optional=True): """Tests if a package, MatchSpec, or a list of both has satisfiable dependencies, assuming cyclic dependencies are always valid. Args: - spec_or_dist: a package key, a MatchSpec, or an iterable of these. + spec_or_prec: a package record, a MatchSpec, or an iterable of these. filter: a dictionary of (fkey,valid) pairs, used to consider a subset of dependencies, and to eliminate repeated searches. optional: if True (default), do not enforce optional specifications @@ -94,14 +97,15 @@ def v_ms_(ms): return ((optional and ms.optional) or any(v_fkey_(fkey) for fkey in self.find_matches(ms))) - def v_fkey_(dist): - val = filter.get(dist) + def v_fkey_(prec): + assert isinstance(prec, PackageRecord) + val = filter.get(prec) if val is None: - filter[dist] = True - val = filter[dist] = all(v_ms_(ms) for ms in self.ms_depends(dist)) + filter[prec] = True + val = filter[prec] = all(v_ms_(ms) for ms in self.ms_depends(prec)) return val - result = v_(spec_or_dist) + result = v_(spec_or_prec) return result def invalid_chains(self, spec, filter, optional=True): @@ -115,7 +119,7 @@ def invalid_chains(self, spec, filter, optional=True): Args: spec: a package key or MatchSpec - filter: a dictionary of (dist, valid) pairs to be used when + filter: a dictionary of (prec, valid) pairs to be used when testing for package validity. optional: if True (default), do not enforce optional specifications when considering validity. If False, enforce them. @@ -129,10 +133,11 @@ def chains_(spec, names): names.add(spec.name) if self.valid(spec, filter, optional): return - dists = self.find_matches(spec) if isinstance(spec, MatchSpec) else [Dist(spec)] + assert isinstance(spec, MatchSpec) + precs = self.find_matches(spec) found = False - for dist in dists: - for m2 in self.ms_depends(dist): + for prec in precs: + for m2 in self.ms_depends(prec): for x in chains_(m2, names): found = True yield (spec,) + x @@ -166,7 +171,7 @@ def verify_specs(self, specs): spec2.append(ms) for ms in spec2: filter = self.default_filter(feats) - # type: Map[Dist, bool] + # type: Map[PackageRecord, bool] bad_deps.extend(self.invalid_chains(ms, filter)) if bad_deps: raise ResolvePackageNotFound(bad_deps) @@ -329,14 +334,14 @@ def filter_group(matches): reduced_index = {} slist = list(specs) for fstr in features: - dist = Dist(fstr + '@') - reduced_index[dist] = self.index[dist] + prec = make_feature_record(fstr) + reduced_index[prec] = prec while slist: this_spec = slist.pop() - for dist in self.find_matches(this_spec): - if reduced_index.get(dist) is None and self.valid(dist, filter): - reduced_index[dist] = self.index[dist] - for ms in self.ms_depends(dist): + for prec in self.find_matches(this_spec): + if reduced_index.get(prec) is None and self.valid(prec, filter): + reduced_index[prec] = prec + for ms in self.ms_depends(prec): # We do not pull packages into the reduced index due # to a track_features dependency. Remember, a feature # specifies a "soft" dependency: it must be in the @@ -348,19 +353,18 @@ def filter_group(matches): if 'track_features' not in ms: slist.append(ms) self._reduced_index_cache[cache_key] = reduced_index + assert all(isinstance(prec, PackageRecord) for prec in reduced_index) return reduced_index - def match_any(self, mss, dist): - rec = self.index[dist] - return any(ms.match(rec) for ms in mss) + def match_any(self, mss, prec): + return any(ms.match(prec) for ms in mss) - def match(self, ms, fkey): - # type: (MatchSpec, Dist) -> bool - rec = self.index[fkey] - return MatchSpec(ms).match(rec) + def match(self, ms, prec): + # type: (MatchSpec, PackageRecord) -> bool + return MatchSpec(ms).match(prec) def find_matches(self, ms): - # type: (MatchSpec) -> List[Dist] + # type: (MatchSpec) -> List[PackageRecord] assert isinstance(ms, MatchSpec) res = self.find_matches_.get(ms, None) if res is None: @@ -372,30 +376,30 @@ def find_matches(self, ms): for feature_name in feature_names if feature_name in self.trackers)) else: - res = self.index.keys() + res = self.index.values() res = [p for p in res if self.match(ms, p)] self.find_matches_[ms] = res + assert all(isinstance(prec, PackageRecord) for prec in res) return res - def ms_depends(self, dist): - # type: (Dist) -> List[MatchSpec] - deps = self.ms_depends_.get(dist) + def ms_depends(self, prec): + # type: (PackageRecord) -> List[MatchSpec] + assert isinstance(prec, PackageRecord) + deps = self.ms_depends_.get(prec) if deps is None: - rec = self.index[dist] - deps = [MatchSpec(d) for d in rec.combined_depends] - deps.extend(MatchSpec(track_features=feat) for feat in self.index[dist].features) - self.ms_depends_[dist] = deps + deps = [MatchSpec(d) for d in prec.combined_depends] + deps.extend(MatchSpec(track_features=feat) for feat in prec.features) + self.ms_depends_[prec] = deps return deps - def version_key(self, dist, vtype=None): - rec = self.index[dist] - channel = rec.channel + def version_key(self, prec, vtype=None): + channel = prec.channel channel_priority = self._channel_priorities_map.get(channel.name, 1) # TODO: ask @mcg1969 why the default value is 1 here # NOQA valid = 1 if channel_priority < MAX_CHANNEL_PRIORITY else 0 - version_comparator = VersionOrder(rec.get('version', '')) - build_number = rec.get('build_number', 0) - build_string = rec.get('build') - ts = rec.get('timestamp', 0) + version_comparator = VersionOrder(prec.get('version', '')) + build_number = prec.get('build_number', 0) + build_string = prec.get('build') + ts = prec.get('timestamp', 0) if context.channel_priority: return valid, -channel_priority, version_comparator, build_number, ts, build_string else: @@ -414,41 +418,27 @@ def _make_channel_priorities(channels): priorities_map[channel_name] = min(priority_counter, MAX_CHANNEL_PRIORITY - 1) return priorities_map - def package_quad(self, dist): - rec = self.index.get(dist, None) - if rec is None: - return dist.quad - else: - channel = rec.get('channel') - channel = channel.canonical_name if channel else DEFAULTS_CHANNEL_NAME - return rec['name'], rec['version'], rec['build'], channel - - def package_name(self, dist): - return self.package_quad(dist)[0] - def get_pkgs(self, ms, emptyok=False): # pragma: no cover # legacy method for conda-build ms = MatchSpec(ms) - dists = self.find_matches(ms) - if not dists and not emptyok: + precs = self.find_matches(ms) + if not precs and not emptyok: raise ResolvePackageNotFound([(ms,)]) - return sorted(dists, key=self.version_key) + return sorted(precs, key=self.version_key) @staticmethod def to_sat_name(val): - # val can be a Dist, PackageRef, or MatchSpec - if isinstance(val, Dist): - return val.full_name + # val can be a PackageRef or MatchSpec + if isinstance(val, PackageRef): + return val.dist_str() elif isinstance(val, MatchSpec): return '@s@' + text_type(val) + ('?' if val.optional else '') - elif isinstance(val, PackageRef): - return val.dist_str() else: raise NotImplementedError() @staticmethod - def to_feature_metric_id(dist, feat): - return '@fm@%s@%s' % (dist, feat) + def to_feature_metric_id(prec_dist_str, feat): + return '@fm@%s@%s' % (prec_dist_str, feat) def push_MatchSpec(self, C, spec): spec = MatchSpec(spec) @@ -482,18 +472,18 @@ def push_MatchSpec(self, C, spec): ms2 = MatchSpec(track_features=tf) if tf else MatchSpec(nm) m = C.from_name(self.push_MatchSpec(C, ms2)) if m is None: - dists = [dist.full_name for dist in libs] + sat_names = [self.to_sat_name(prec) for prec in libs] if spec.optional: ms2 = MatchSpec(track_features=tf) if tf else MatchSpec(nm) - dists.append('!' + self.to_sat_name(ms2)) - m = C.Any(dists) + sat_names.append('!' + self.to_sat_name(ms2)) + m = C.Any(sat_names) C.name_var(m, sat_name) return sat_name def gen_clauses(self): C = Clauses() for name, group in iteritems(self.groups): - group = [self.to_sat_name(dist) for dist in group] + group = [self.to_sat_name(prec) for prec in group] # Create one variable for each package for sat_name in group: C.new_var(sat_name) @@ -505,9 +495,9 @@ def gen_clauses(self): C.Require(C.ExactlyOne, group + [C.Not(m)]) # If a package is installed, its dependencies must be as well - for dist in iterkeys(self.index): - nkey = C.Not(self.to_sat_name(dist)) - for ms in self.ms_depends(dist): + for prec in itervalues(self.index): + nkey = C.Not(self.to_sat_name(prec)) + for ms in self.ms_depends(prec): C.Require(C.Or, nkey, self.push_MatchSpec(C, ms)) log.debug("gen_clauses returning with clause count: %s", len(C.clauses)) @@ -529,20 +519,20 @@ def generate_update_count(self, C, specs): def generate_feature_metric(self, C): eq = {} # a C.minimize() objective: Dict[varname, coeff] - # Given a pair (dist, feature), assign a "1" score IF: - # - The dist is installed - # - The dist does NOT require the feature + # Given a pair (prec, feature), assign a "1" score IF: + # - The prec is installed + # - The prec does NOT require the feature # - At least one package in the group DOES require the feature # - A package that tracks the feature is installed for name, group in iteritems(self.groups): - dist_feats = {dist.full_name: set(self.index[dist].features) for dist in group} - active_feats = set.union(*dist_feats.values()).intersection(self.trackers) + prec_feats = {self.to_sat_name(prec): set(prec.features) for prec in group} + active_feats = set.union(*prec_feats.values()).intersection(self.trackers) for feat in active_feats: clause_id_for_feature = self.push_MatchSpec(C, MatchSpec(track_features=feat)) - for dist, features in dist_feats.items(): + for prec_sat_name, features in prec_feats.items(): if feat not in features: - feature_metric_id = self.to_feature_metric_id(dist, feat) - C.name_var(C.And(dist, clause_id_for_feature), feature_metric_id) + feature_metric_id = self.to_feature_metric_id(prec_sat_name, feat) + C.name_var(C.And(prec_sat_name, clause_id_for_feature), feature_metric_id) eq[feature_metric_id] = 1 return eq @@ -563,16 +553,17 @@ def generate_version_metrics(self, C, specs, include0=False): eqb = {} # build number eqt = {} # timestamp - sdict = {} # Dict[package_name, Dist] + sdict = {} # Dict[package_name, PackageRecord] for s in specs: s = MatchSpec(s) # needed for testing rec = sdict.setdefault(s.name, []) - if s.target: - dist = Dist(s.target) - if dist in self.index: - if self.index[dist].get('priority', 0) < MAX_CHANNEL_PRIORITY: - rec.append(dist) + # # TODO: this block is important! can't leave it commented out + # if s.target: + # dist = Dist(s.target) + # if dist in self.index: + # if self.index[dist].get('priority', 0) < MAX_CHANNEL_PRIORITY: + # rec.append(dist) for name, targets in iteritems(sdict): pkgs = [(self.version_key(p), p) for p in self.groups.get(name, [])] @@ -580,8 +571,9 @@ def generate_version_metrics(self, C, specs, include0=False): # keep in mind that pkgs is already sorted according to version_key (a tuple, # so composite sort key). Later entries in the list are, by definition, # greater in some way, so simply comparing with != suffices. - for version_key, dist in pkgs: - if targets and any(dist == t for t in targets): + for version_key, prec in pkgs: + assert isinstance(prec, PackageRecord) + if targets and any(prec == t for t in targets): continue if pkey is None: ic = iv = ib = it = 0 @@ -600,26 +592,28 @@ def generate_version_metrics(self, C, specs, include0=False): elif pkey[4] != version_key[4]: it += 1 + prec_sat_name = self.to_sat_name(prec) if ic or include0: - eqc[dist.full_name] = ic + eqc[prec_sat_name] = ic if iv or include0: - eqv[dist.full_name] = iv + eqv[prec_sat_name] = iv if ib or include0: - eqb[dist.full_name] = ib + eqb[prec_sat_name] = ib if it or include0: - eqt[dist.full_name] = it + eqt[prec_sat_name] = it pkey = version_key return eqc, eqv, eqb, eqt def dependency_sort(self, must_have): - # type: (Dict[package_name, Dist]) -> List[Dist] + # type: (Dict[package_name, PackageRecord]) -> List[PackageRecord] assert isinstance(must_have, dict) + assert all(isinstance(prec, PackageRecord) for prec in itervalues(must_have)) digraph = {} # Dict[package_name, Set[dependent_package_names]] - for package_name, dist in iteritems(must_have): - if dist in self.index: - digraph[package_name] = set(ms.name for ms in self.ms_depends(dist)) + for package_name, prec in iteritems(must_have): + if prec in self.index: + digraph[package_name] = set(ms.name for ms in self.ms_depends(prec)) # There are currently at least three special cases to be aware of. # 1. The `toposort()` function, called below, contains special case code to remove @@ -635,7 +629,7 @@ def dependency_sort(self, must_have): if on_win and 'conda' in digraph: for package_name, dist in iteritems(must_have): - record = self.index.get(dist) + record = self.index.get(prec) if hasattr(record, 'noarch') and record.noarch == NoarchType.python: digraph[package_name].add('conda') @@ -646,54 +640,20 @@ def dependency_sort(self, must_have): result = [must_have.pop(key) for key in sorted_keys if key in must_have] # Take any key that were not sorted result.extend(must_have.values()) + assert all(isinstance(prec, PackageRecord) for prec in result) return result - # def explicit(self, specs): - # """ - # Given the specifications, return: - # A. if one explicit specification is given, and - # all dependencies of this package are explicit as well -> - # return the filenames of those dependencies (as well as the - # explicit specification) - # B. if not one explicit specifications are given -> - # return the filenames of those (not thier dependencies) - # C. None in all other cases - # """ - # def add_defaults_if_no_channel(string): - # return 'defaults::' + string if '::' not in string else string - # - # specs = list(map(MatchSpec, specs)) - # if len(specs) == 1: - # ms = MatchSpec(specs[0]) - # fn = ms._to_filename_do_not_use() - # if fn is None: - # return None - # fkey = Dist(add_defaults_if_no_channel(fn)) - # if fkey not in self.index: - # return None - # res = [ms2._to_filename_do_not_use() for ms2 in self.ms_depends(fkey)] - # res.append(fn) - # else: - # res = [spec._to_filename_do_not_use() for spec in specs if str(spec) != 'conda'] - # - # if None in res: - # return None - # res = [Dist(add_defaults_if_no_channel(f)) for f in sorted(res)] - # log.debug('explicit(%r) finished', specs) - # return res - def environment_is_consistent(self, installed): + assert all(isinstance(prec, PackageRecord) for prec in installed) log.debug('Checking if the current environment is consistent') if not installed: return None, [] - dists = {} # Dict[Dist, Record] + record_map = {} # Dict[sat_name, PackageRecord] specs = [] - for dist in installed: - dist = Dist(dist) - rec = self.index[dist] - dists[dist] = rec - specs.append(MatchSpec(' '.join(self.package_quad(dist)[:3]))) - r2 = Resolve(dists, True, True, channels=self.channels) + for prec in installed: + record_map[self.to_sat_name(prec)] = prec + specs.append(MatchSpec('%s %s %s' % (prec.name, prec.version, prec.build))) + r2 = Resolve(record_map, True, True, channels=self.channels) C = r2.gen_clauses() constraints = r2.generate_spec_constraints(C, specs) solution = C.sat(constraints) @@ -719,17 +679,17 @@ def mysat(specs, add_if=False): return specs def bad_installed(self, installed, new_specs): + assert all(isinstance(prec, PackageRecord) for prec in installed) log.debug('Checking if the current environment is consistent') if not installed: return None, [] - dists = {} # Dict[Dist, Record] + sat_name_map = {} # Dict[sat_name, PackageRecord] specs = [] - for dist in installed: - dist = Dist(dist) - rec = self.index[dist] - dists[dist] = rec - specs.append(MatchSpec(' '.join(self.package_quad(dist)[:3]))) - r2 = Resolve(dists, True, True, channels=self.channels) + for prec in installed: + sat_name_map[self.to_sat_name(prec)] = prec + specs.append(MatchSpec('%s %s %s' % (prec.name, prec.version, prec.build))) + new_index = {prec: prec for prec in itervalues(sat_name_map)} + r2 = Resolve(new_index, True, True, channels=self.channels) C = r2.gen_clauses() constraints = r2.generate_spec_constraints(C, specs) solution = C.sat(constraints) @@ -747,15 +707,15 @@ def get_(name, snames): snames = set() eq_optional_c = r2.generate_removal_count(C, specs) solution, _ = C.minimize(eq_optional_c, C.sat()) - snames.update(dists[Dist(q)]['name'] - for q in (C.from_index(s) for s in solution) - if q and q[0] != '!' and '@' not in q) + snames.update(sat_name_map[sat_name]['name'] + for sat_name in (C.from_index(s) for s in solution) + if sat_name and sat_name[0] != '!' and '@' not in sat_name) # Existing behavior: keep all specs and their dependencies for spec in new_specs: get_(MatchSpec(spec).name, snames) - if len(snames) < len(dists): + if len(snames) < len(sat_name_map): limit = snames - xtra = [dist for dist, rec in iteritems(dists) if rec['name'] not in snames] + xtra = [rec for sat_name, rec in iteritems(sat_name_map) if rec['name'] not in snames] log.debug('Limiting solver to the following packages: %s', ', '.join(limit)) if xtra: log.debug('Packages to be preserved: %s', xtra) @@ -763,25 +723,30 @@ def get_(name, snames): def restore_bad(self, pkgs, preserve): if preserve: - sdict = {self.package_name(pkg): pkg for pkg in pkgs} - pkgs.extend(p for p in preserve if self.package_name(p) not in sdict) + assert all(isinstance(prec, PackageRecord) for prec in pkgs) + assert all(isinstance(prec, PackageRecord) for prec in preserve) + sdict = {prec.name: prec for prec in pkgs} + pkgs.extend(p for p in preserve if p.name not in sdict) def install_specs(self, specs, installed, update_deps=True): + assert all(isinstance(prec, PackageRecord) for prec in installed) specs = list(map(MatchSpec, specs)) snames = {s.name for s in specs} log.debug('Checking satisfiability of current install') limit, preserve = self.bad_installed(installed, specs) - for pkg in installed: - if pkg not in self.index: + for prec in installed: + if prec not in self.index: continue - name, version, build, schannel = self.package_quad(pkg) + name, version, build = prec.name, prec.version, prec.build + schannel = prec.channel.canonical_name if name in snames or limit is not None and name not in limit: continue # If update_deps=True, set the target package in MatchSpec so that # the solver can minimize the version change. If update_deps=False, # fix the version and build so that no change is possible. if update_deps: - spec = MatchSpec(name=name, target=pkg.full_name) + # TODO: fix target here + spec = MatchSpec(name=name, target=prec.dist_str()) else: spec = MatchSpec(name=name, version=version, build=build, channel=schannel) @@ -789,12 +754,16 @@ def install_specs(self, specs, installed, update_deps=True): return specs, preserve def install(self, specs, installed=None, update_deps=True, returnall=False): + if installed: + assert all(isinstance(prec, PackageRecord) for prec in installed) specs, preserve = self.install_specs(specs, installed or [], update_deps) pkgs = self.solve(specs, returnall=returnall, _remove=False) self.restore_bad(pkgs, preserve) + assert all(isinstance(prec, PackageRecord) for prec in pkgs) return pkgs def remove_specs(self, specs, installed): + assert all(isinstance(prec, PackageRecord) for prec in installed) nspecs = [] # There's an imperfect thing happening here. "specs" nominally contains # a list of package names or track_feature values to be removed. But @@ -812,28 +781,31 @@ def remove_specs(self, specs, installed): snames = set(s.name for s in nspecs if s.name) limit, _ = self.bad_installed(installed, nspecs) preserve = [] - for dist in installed: - nm, ver, build, schannel = self.package_quad(dist) + for prec in installed: + nm, ver, build = prec.name, prec.version, prec.build if nm in snames: continue elif limit is not None: - preserve.append(dist) + preserve.append(prec) else: + # TODO: fix target here nspecs.append(MatchSpec(name=nm, version='>='+ver if ver else None, optional=True, - target=dist.full_name)) + target=prec.dist_str())) return nspecs, preserve def remove(self, specs, installed): + assert all(isinstance(prec, PackageRecord) for prec in installed) specs, preserve = self.remove_specs(specs, installed) pkgs = self.solve(specs, _remove=True) self.restore_bad(pkgs, preserve) + assert all(isinstance(prec, PackageRecord) for prec in pkgs) return pkgs @time_recorder("resolve_solve") def solve(self, specs, returnall=False, _remove=False): - # type: (List[str], bool) -> List[Dist] + # type: (List[str], bool) -> List[PackageRecord] if log.isEnabledFor(DEBUG): log.debug('Solving for: %s', dashlist(sorted(text_type(s) for s in specs))) @@ -967,7 +939,14 @@ def clean(sol): def stripfeat(sol): return sol.split('[')[0] + new_index = {self.to_sat_name(prec): prec for prec in itervalues(self.index)} + if returnall: - return [sorted(Dist(stripfeat(dname)) for dname in psol) for psol in psolutions] - else: - return sorted(Dist(stripfeat(dname)) for dname in psolutions[0]) + if len(psolutions) > 1: + raise RuntimeError() + # TODO: clean up this mess + # return [sorted(Dist(stripfeat(dname)) for dname in psol) for psol in psolutions] + # return [sorted((new_index[sat_name] for sat_name in psol), key=lambda x: x.name) for psol in psolutions] + + # return sorted(Dist(stripfeat(dname)) for dname in psolutions[0]) + return sorted((new_index[sat_name] for sat_name in psolutions[0]), key=lambda x: x.name)
diff --git a/tests/helpers.py b/tests/helpers.py --- a/tests/helpers.py +++ b/tests/helpers.py @@ -23,7 +23,6 @@ from conda.gateways.disk.read import lexists from conda.gateways.logging import initialize_logging from conda.models.channel import Channel -from conda.models.dist import Dist from conda.models.records import PackageRecord from conda.resolve import Resolve @@ -137,8 +136,7 @@ def supplement_index_with_repodata(index, repodata, channel, priority): priority=priority, # url=join_url(channel_url, fn), auth=auth) - dist = Dist(rec) - index[dist] = rec + index[rec] = rec def add_feature_records_legacy(index): @@ -149,7 +147,7 @@ def add_feature_records_legacy(index): for feature_name in all_features: rec = make_feature_record(feature_name) - index[Dist(rec)] = rec + index[rec] = rec @memoize def get_index_r_1(): @@ -171,7 +169,7 @@ def get_index_r_1(): sd._loaded = True SubdirData._cache_[channel.url(with_credentials=True)] = sd - index = {Dist(prec): prec for prec in sd._package_records} + index = {prec: prec for prec in sd._package_records} add_feature_records_legacy(index) r = Resolve(index, channels=(channel,)) return index, r @@ -197,7 +195,7 @@ def get_index_r_2(): sd._loaded = True SubdirData._cache_[channel.url(with_credentials=True)] = sd - index = {Dist(prec): prec for prec in sd._package_records} + index = {prec: prec for prec in sd._package_records} r = Resolve(index, channels=(channel,)) return index, r @@ -222,7 +220,7 @@ def get_index_r_3(): sd._loaded = True SubdirData._cache_[channel.url(with_credentials=True)] = sd - index = {Dist(prec): prec for prec in sd._package_records} + index = {prec: prec for prec in sd._package_records} r = Resolve(index, channels=(channel,)) return index, r @@ -247,7 +245,7 @@ def get_index_r_4(): sd._loaded = True SubdirData._cache_[channel.url(with_credentials=True)] = sd - index = {Dist(prec): prec for prec in sd._package_records} + index = {prec: prec for prec in sd._package_records} r = Resolve(index, channels=(channel,)) return index, r @@ -273,7 +271,7 @@ def get_index_r_5(): sd._loaded = True SubdirData._cache_[channel.url(with_credentials=True)] = sd - index = {Dist(prec): prec for prec in sd._package_records} + index = {prec: prec for prec in sd._package_records} r = Resolve(index, channels=(channel,)) return index, r diff --git a/tests/test_resolve.py b/tests/test_resolve.py --- a/tests/test_resolve.py +++ b/tests/test_resolve.py @@ -2,31 +2,29 @@ import unittest +from datetime import datetime +import pytest + from conda.base.context import context, reset_context -from conda.common.compat import iteritems +from conda.common.compat import iteritems, itervalues from conda.common.io import env_var from conda.exceptions import UnsatisfiableError from conda.models.channel import Channel -from conda.models.dist import Dist from conda.models.records import PackageRecord from conda.resolve import MatchSpec, Resolve, ResolvePackageNotFound + from .helpers import get_index_r_1, get_index_r_3, raises index, r, = get_index_r_1() f_mkl = set(['mkl']) -def add_defaults_if_no_channel(string): - return 'channel-1::' + string if '::' not in string else string - - class TestSolve(unittest.TestCase): - def assert_have_mkl(self, dists, names): - for dist in dists: - if dist.quad[0] in names: - record = index[dist] - assert 'mkl' in record.features + def assert_have_mkl(self, precs, names): + for prec in precs: + if prec.name in names: + assert 'mkl' in prec.features # def test_explicit0(self): # self.assertEqual(r.explicit([]), []) @@ -64,36 +62,36 @@ def test_empty(self): def test_iopro_nomkl(self): installed = r.install(['iopro 1.4*', 'python 2.7*', 'numpy 1.7*'], returnall=True) - installed = [[dist.to_filename() for dist in psol] for psol in installed] - - self.assertEqual(installed, - [['iopro-1.4.3-np17py27_p0.tar.bz2', - 'numpy-1.7.1-py27_0.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'unixodbc-2.3.1-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2']]) + installed = [rec.dist_str() for rec in installed] + assert installed == [ + 'channel-1::iopro-1.4.3-np17py27_p0', + 'channel-1::numpy-1.7.1-py27_0', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-2.7.5-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::unixodbc-2.3.1-0', + 'channel-1::zlib-1.2.7-0', + ] def test_iopro_mkl(self): installed = r.install(['iopro 1.4*', 'python 2.7*', 'numpy 1.7*', MatchSpec(track_features='mkl')], returnall=True) - installed = [[dist.to_filename() for dist in psol] for psol in installed] - - self.assertEqual(installed, - [['iopro-1.4.3-np17py27_p0.tar.bz2', - 'mkl-rt-11.0-p0.tar.bz2', - 'numpy-1.7.1-py27_p0.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'unixodbc-2.3.1-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2']]) + installed = [prec.dist_str() for prec in installed] + assert installed == [ + 'channel-1::iopro-1.4.3-np17py27_p0', + 'channel-1::mkl-rt-11.0-p0', + 'channel-1::numpy-1.7.1-py27_p0', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-2.7.5-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::unixodbc-2.3.1-0', + 'channel-1::zlib-1.2.7-0', + ] def test_mkl(self): a = r.install(['mkl 11*', MatchSpec(track_features='mkl')]) @@ -106,52 +104,57 @@ def test_accelerate(self): r.install(['accelerate', MatchSpec(track_features='mkl')])) def test_scipy_mkl(self): - dists = r.install(['scipy', 'python 2.7*', 'numpy 1.7*', MatchSpec(track_features='mkl')]) - self.assert_have_mkl(dists, ('numpy', 'scipy')) - self.assertTrue(Dist('channel-1::scipy-0.12.0-np17py27_p0.tar.bz2') in dists) + precs = r.install(['scipy', 'python 2.7*', 'numpy 1.7*', MatchSpec(track_features='mkl')]) + self.assert_have_mkl(precs, ('numpy', 'scipy')) + dist_strs = [prec.dist_str() for prec in precs] + assert 'channel-1::scipy-0.12.0-np17py27_p0' in dist_strs def test_anaconda_nomkl(self): - dists = r.install(['anaconda 1.5.0', 'python 2.7*', 'numpy 1.7*']) - self.assertEqual(len(dists), 107) - self.assertTrue(Dist('channel-1::scipy-0.12.0-np17py27_0.tar.bz2') in dists) + precs = r.install(['anaconda 1.5.0', 'python 2.7*', 'numpy 1.7*']) + assert len(precs) == 107 + dist_strs = [prec.dist_str() for prec in precs] + assert 'channel-1::scipy-0.12.0-np17py27_0' in dist_strs def test_pseudo_boolean(): # The latest version of iopro, 1.5.0, was not built against numpy 1.5 - assert r.install(['iopro', 'python 2.7*', 'numpy 1.5*'], returnall=True) == [[ - Dist(add_defaults_if_no_channel(fn)) for fn in [ - 'iopro-1.4.3-np15py27_p0.tar.bz2', - 'numpy-1.5.1-py27_4.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'unixodbc-2.3.1-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]]] - - assert r.install(['iopro', 'python 2.7*', 'numpy 1.5*', MatchSpec(track_features='mkl')], returnall=True) == [[ - Dist(add_defaults_if_no_channel(fn)) for fn in [ - 'iopro-1.4.3-np15py27_p0.tar.bz2', - 'mkl-rt-11.0-p0.tar.bz2', - 'numpy-1.5.1-py27_p4.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'unixodbc-2.3.1-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]]] + installed = r.install(['iopro', 'python 2.7*', 'numpy 1.5*'], returnall=True) + installed = [rec.dist_str() for rec in installed] + assert installed == [ + 'channel-1::iopro-1.4.3-np15py27_p0', + 'channel-1::numpy-1.5.1-py27_4', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-2.7.5-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::unixodbc-2.3.1-0', + 'channel-1::zlib-1.2.7-0', + ] + + installed = r.install(['iopro', 'python 2.7*', 'numpy 1.5*', MatchSpec(track_features='mkl')], returnall=True) + installed = [rec.dist_str() for rec in installed] + assert installed == [ + 'channel-1::iopro-1.4.3-np15py27_p0', + 'channel-1::mkl-rt-11.0-p0', + 'channel-1::numpy-1.5.1-py27_p4', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-2.7.5-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::unixodbc-2.3.1-0', + 'channel-1::zlib-1.2.7-0', + ] def test_get_dists(): - dists = r.get_reduced_index(["anaconda 1.5.0"]) - assert Dist('channel-1::anaconda-1.5.0-np17py27_0.tar.bz2') in dists - assert Dist('channel-1::dynd-python-0.3.0-np17py33_0.tar.bz2') in dists + reduced_index = r.get_reduced_index(["anaconda 1.5.0"]) + dist_strs = [prec.dist_str() for prec in reduced_index] + assert 'channel-1::anaconda-1.5.0-np17py27_0' in dist_strs + assert 'channel-1::dynd-python-0.3.0-np17py33_0' in dist_strs def test_generate_eq_1(): @@ -167,220 +170,220 @@ def test_generate_eq_1(): # - a package that only has one version should not appear, unless # include=True as it will have a 0 coefficient. The same is true of the # latest version of a package. - eqc = {Dist(key).to_filename(): value for key, value in iteritems(eqc)} - eqv = {Dist(key).to_filename(): value for key, value in iteritems(eqv)} - eqb = {Dist(key).to_filename(): value for key, value in iteritems(eqb)} - eqt = {Dist(key).to_filename(): value for key, value in iteritems(eqt)} + eqc = {key: value for key, value in iteritems(eqc)} + eqv = {key: value for key, value in iteritems(eqv)} + eqb = {key: value for key, value in iteritems(eqb)} + eqt = {key: value for key, value in iteritems(eqt)} assert eqc == {} assert eqv == { - 'anaconda-1.4.0-np15py26_0.tar.bz2': 1, - 'anaconda-1.4.0-np15py27_0.tar.bz2': 1, - 'anaconda-1.4.0-np16py26_0.tar.bz2': 1, - 'anaconda-1.4.0-np16py27_0.tar.bz2': 1, - 'anaconda-1.4.0-np17py26_0.tar.bz2': 1, - 'anaconda-1.4.0-np17py27_0.tar.bz2': 1, - 'anaconda-1.4.0-np17py33_0.tar.bz2': 1, - 'astropy-0.2-np15py26_0.tar.bz2': 1, - 'astropy-0.2-np15py27_0.tar.bz2': 1, - 'astropy-0.2-np16py26_0.tar.bz2': 1, - 'astropy-0.2-np16py27_0.tar.bz2': 1, - 'astropy-0.2-np17py26_0.tar.bz2': 1, - 'astropy-0.2-np17py27_0.tar.bz2': 1, - 'astropy-0.2-np17py33_0.tar.bz2': 1, - 'biopython-1.60-np15py26_0.tar.bz2': 1, - 'biopython-1.60-np15py27_0.tar.bz2': 1, - 'biopython-1.60-np16py26_0.tar.bz2': 1, - 'biopython-1.60-np16py27_0.tar.bz2': 1, - 'biopython-1.60-np17py26_0.tar.bz2': 1, - 'biopython-1.60-np17py27_0.tar.bz2': 1, - 'bitarray-0.8.0-py26_0.tar.bz2': 1, - 'bitarray-0.8.0-py27_0.tar.bz2': 1, - 'bitarray-0.8.0-py33_0.tar.bz2': 1, - 'boto-2.8.0-py26_0.tar.bz2': 1, - 'boto-2.8.0-py27_0.tar.bz2': 1, - 'conda-1.4.4-py27_0.tar.bz2': 1, - 'cython-0.18-py26_0.tar.bz2': 1, - 'cython-0.18-py27_0.tar.bz2': 1, - 'cython-0.18-py33_0.tar.bz2': 1, - 'distribute-0.6.34-py26_1.tar.bz2': 1, - 'distribute-0.6.34-py27_1.tar.bz2': 1, - 'distribute-0.6.34-py33_1.tar.bz2': 1, - 'gevent-0.13.7-py26_0.tar.bz2': 1, - 'gevent-0.13.7-py27_0.tar.bz2': 1, - 'ipython-0.13.1-py26_1.tar.bz2': 1, - 'ipython-0.13.1-py27_1.tar.bz2': 1, - 'ipython-0.13.1-py33_1.tar.bz2': 1, - 'llvmpy-0.11.1-py26_0.tar.bz2': 1, - 'llvmpy-0.11.1-py27_0.tar.bz2': 1, - 'llvmpy-0.11.1-py33_0.tar.bz2': 1, - 'lxml-3.0.2-py26_0.tar.bz2': 1, - 'lxml-3.0.2-py27_0.tar.bz2': 1, - 'lxml-3.0.2-py33_0.tar.bz2': 1, - 'matplotlib-1.2.0-np15py26_1.tar.bz2': 1, - 'matplotlib-1.2.0-np15py27_1.tar.bz2': 1, - 'matplotlib-1.2.0-np16py26_1.tar.bz2': 1, - 'matplotlib-1.2.0-np16py27_1.tar.bz2': 1, - 'matplotlib-1.2.0-np17py26_1.tar.bz2': 1, - 'matplotlib-1.2.0-np17py27_1.tar.bz2': 1, - 'matplotlib-1.2.0-np17py33_1.tar.bz2': 1, - 'nose-1.2.1-py26_0.tar.bz2': 1, - 'nose-1.2.1-py27_0.tar.bz2': 1, - 'nose-1.2.1-py33_0.tar.bz2': 1, - 'numba-0.7.0-np16py26_1.tar.bz2': 1, - 'numba-0.7.0-np16py27_1.tar.bz2': 1, - 'numba-0.7.0-np17py26_1.tar.bz2': 1, - 'numba-0.7.0-np17py27_1.tar.bz2': 1, - 'numpy-1.5.1-py26_3.tar.bz2': 3, - 'numpy-1.5.1-py27_3.tar.bz2': 3, - 'numpy-1.6.2-py26_3.tar.bz2': 2, - 'numpy-1.6.2-py26_4.tar.bz2': 2, - # 'numpy-1.6.2-py26_p4.tar.bz2': 2, - 'numpy-1.6.2-py27_3.tar.bz2': 2, - 'numpy-1.6.2-py27_4.tar.bz2': 2, - # 'numpy-1.6.2-py27_p4.tar.bz2': 2, - 'numpy-1.7.0-py26_0.tar.bz2': 1, - 'numpy-1.7.0-py27_0.tar.bz2': 1, - 'numpy-1.7.0-py33_0.tar.bz2': 1, - 'pandas-0.10.0-np16py26_0.tar.bz2': 2, - 'pandas-0.10.0-np16py27_0.tar.bz2': 2, - 'pandas-0.10.0-np17py26_0.tar.bz2': 2, - 'pandas-0.10.0-np17py27_0.tar.bz2': 2, - 'pandas-0.10.1-np16py26_0.tar.bz2': 1, - 'pandas-0.10.1-np16py27_0.tar.bz2': 1, - 'pandas-0.10.1-np17py26_0.tar.bz2': 1, - 'pandas-0.10.1-np17py27_0.tar.bz2': 1, - 'pandas-0.10.1-np17py33_0.tar.bz2': 1, - 'pandas-0.8.1-np16py26_0.tar.bz2': 5, - 'pandas-0.8.1-np16py27_0.tar.bz2': 5, - 'pandas-0.8.1-np17py26_0.tar.bz2': 5, - 'pandas-0.8.1-np17py27_0.tar.bz2': 5, - 'pandas-0.9.0-np16py26_0.tar.bz2': 4, - 'pandas-0.9.0-np16py27_0.tar.bz2': 4, - 'pandas-0.9.0-np17py26_0.tar.bz2': 4, - 'pandas-0.9.0-np17py27_0.tar.bz2': 4, - 'pandas-0.9.1-np16py26_0.tar.bz2': 3, - 'pandas-0.9.1-np16py27_0.tar.bz2': 3, - 'pandas-0.9.1-np17py26_0.tar.bz2': 3, - 'pandas-0.9.1-np17py27_0.tar.bz2': 3, - 'pip-1.2.1-py26_1.tar.bz2': 1, - 'pip-1.2.1-py27_1.tar.bz2': 1, - 'pip-1.2.1-py33_1.tar.bz2': 1, - 'psutil-0.6.1-py26_0.tar.bz2': 1, - 'psutil-0.6.1-py27_0.tar.bz2': 1, - 'psutil-0.6.1-py33_0.tar.bz2': 1, - 'pyflakes-0.6.1-py26_0.tar.bz2': 1, - 'pyflakes-0.6.1-py27_0.tar.bz2': 1, - 'pyflakes-0.6.1-py33_0.tar.bz2': 1, - 'python-2.6.8-6.tar.bz2': 4, - 'python-2.7.3-7.tar.bz2': 3, - 'python-2.7.4-0.tar.bz2': 2, - 'python-3.3.0-4.tar.bz2': 1, - 'pytz-2012j-py26_0.tar.bz2': 1, - 'pytz-2012j-py27_0.tar.bz2': 1, - 'pytz-2012j-py33_0.tar.bz2': 1, - 'requests-0.13.9-py26_0.tar.bz2': 1, - 'requests-0.13.9-py27_0.tar.bz2': 1, - 'requests-0.13.9-py33_0.tar.bz2': 1, - 'scikit-learn-0.13-np15py26_1.tar.bz2': 1, - 'scikit-learn-0.13-np15py27_1.tar.bz2': 1, - 'scikit-learn-0.13-np16py26_1.tar.bz2': 1, - 'scikit-learn-0.13-np16py27_1.tar.bz2': 1, - 'scikit-learn-0.13-np17py26_1.tar.bz2': 1, - 'scikit-learn-0.13-np17py27_1.tar.bz2': 1, - 'scipy-0.11.0-np15py26_3.tar.bz2': 1, - 'scipy-0.11.0-np15py27_3.tar.bz2': 1, - 'scipy-0.11.0-np16py26_3.tar.bz2': 1, - 'scipy-0.11.0-np16py27_3.tar.bz2': 1, - 'scipy-0.11.0-np17py26_3.tar.bz2': 1, - 'scipy-0.11.0-np17py27_3.tar.bz2': 1, - 'scipy-0.11.0-np17py33_3.tar.bz2': 1, - 'six-1.2.0-py26_0.tar.bz2': 1, - 'six-1.2.0-py27_0.tar.bz2': 1, - 'six-1.2.0-py33_0.tar.bz2': 1, - 'spyder-2.1.13-py27_0.tar.bz2': 1, - 'sqlalchemy-0.7.8-py26_0.tar.bz2': 1, - 'sqlalchemy-0.7.8-py27_0.tar.bz2': 1, - 'sqlalchemy-0.7.8-py33_0.tar.bz2': 1, - 'sympy-0.7.1-py26_0.tar.bz2': 1, - 'sympy-0.7.1-py27_0.tar.bz2': 1, - 'tornado-2.4.1-py26_0.tar.bz2': 1, - 'tornado-2.4.1-py27_0.tar.bz2': 1, - 'tornado-2.4.1-py33_0.tar.bz2': 1, - 'xlrd-0.9.0-py26_0.tar.bz2': 1, - 'xlrd-0.9.0-py27_0.tar.bz2': 1, - 'xlrd-0.9.0-py33_0.tar.bz2': 1, - 'xlwt-0.7.4-py26_0.tar.bz2': 1, - 'xlwt-0.7.4-py27_0.tar.bz2': 1, + 'channel-1::anaconda-1.4.0-np15py26_0': 1, + 'channel-1::anaconda-1.4.0-np15py27_0': 1, + 'channel-1::anaconda-1.4.0-np16py26_0': 1, + 'channel-1::anaconda-1.4.0-np16py27_0': 1, + 'channel-1::anaconda-1.4.0-np17py26_0': 1, + 'channel-1::anaconda-1.4.0-np17py27_0': 1, + 'channel-1::anaconda-1.4.0-np17py33_0': 1, + 'channel-1::astropy-0.2-np15py26_0': 1, + 'channel-1::astropy-0.2-np15py27_0': 1, + 'channel-1::astropy-0.2-np16py26_0': 1, + 'channel-1::astropy-0.2-np16py27_0': 1, + 'channel-1::astropy-0.2-np17py26_0': 1, + 'channel-1::astropy-0.2-np17py27_0': 1, + 'channel-1::astropy-0.2-np17py33_0': 1, + 'channel-1::biopython-1.60-np15py26_0': 1, + 'channel-1::biopython-1.60-np15py27_0': 1, + 'channel-1::biopython-1.60-np16py26_0': 1, + 'channel-1::biopython-1.60-np16py27_0': 1, + 'channel-1::biopython-1.60-np17py26_0': 1, + 'channel-1::biopython-1.60-np17py27_0': 1, + 'channel-1::bitarray-0.8.0-py26_0': 1, + 'channel-1::bitarray-0.8.0-py27_0': 1, + 'channel-1::bitarray-0.8.0-py33_0': 1, + 'channel-1::boto-2.8.0-py26_0': 1, + 'channel-1::boto-2.8.0-py27_0': 1, + 'channel-1::conda-1.4.4-py27_0': 1, + 'channel-1::cython-0.18-py26_0': 1, + 'channel-1::cython-0.18-py27_0': 1, + 'channel-1::cython-0.18-py33_0': 1, + 'channel-1::distribute-0.6.34-py26_1': 1, + 'channel-1::distribute-0.6.34-py27_1': 1, + 'channel-1::distribute-0.6.34-py33_1': 1, + 'channel-1::gevent-0.13.7-py26_0': 1, + 'channel-1::gevent-0.13.7-py27_0': 1, + 'channel-1::ipython-0.13.1-py26_1': 1, + 'channel-1::ipython-0.13.1-py27_1': 1, + 'channel-1::ipython-0.13.1-py33_1': 1, + 'channel-1::llvmpy-0.11.1-py26_0': 1, + 'channel-1::llvmpy-0.11.1-py27_0': 1, + 'channel-1::llvmpy-0.11.1-py33_0': 1, + 'channel-1::lxml-3.0.2-py26_0': 1, + 'channel-1::lxml-3.0.2-py27_0': 1, + 'channel-1::lxml-3.0.2-py33_0': 1, + 'channel-1::matplotlib-1.2.0-np15py26_1': 1, + 'channel-1::matplotlib-1.2.0-np15py27_1': 1, + 'channel-1::matplotlib-1.2.0-np16py26_1': 1, + 'channel-1::matplotlib-1.2.0-np16py27_1': 1, + 'channel-1::matplotlib-1.2.0-np17py26_1': 1, + 'channel-1::matplotlib-1.2.0-np17py27_1': 1, + 'channel-1::matplotlib-1.2.0-np17py33_1': 1, + 'channel-1::nose-1.2.1-py26_0': 1, + 'channel-1::nose-1.2.1-py27_0': 1, + 'channel-1::nose-1.2.1-py33_0': 1, + 'channel-1::numba-0.7.0-np16py26_1': 1, + 'channel-1::numba-0.7.0-np16py27_1': 1, + 'channel-1::numba-0.7.0-np17py26_1': 1, + 'channel-1::numba-0.7.0-np17py27_1': 1, + 'channel-1::numpy-1.5.1-py26_3': 3, + 'channel-1::numpy-1.5.1-py27_3': 3, + 'channel-1::numpy-1.6.2-py26_3': 2, + 'channel-1::numpy-1.6.2-py26_4': 2, + # 'channel-1::numpy-1.6.2-py26_p4': 2, + 'channel-1::numpy-1.6.2-py27_3': 2, + 'channel-1::numpy-1.6.2-py27_4': 2, + # 'channel-1::numpy-1.6.2-py27_p4': 2, + 'channel-1::numpy-1.7.0-py26_0': 1, + 'channel-1::numpy-1.7.0-py27_0': 1, + 'channel-1::numpy-1.7.0-py33_0': 1, + 'channel-1::pandas-0.10.0-np16py26_0': 2, + 'channel-1::pandas-0.10.0-np16py27_0': 2, + 'channel-1::pandas-0.10.0-np17py26_0': 2, + 'channel-1::pandas-0.10.0-np17py27_0': 2, + 'channel-1::pandas-0.10.1-np16py26_0': 1, + 'channel-1::pandas-0.10.1-np16py27_0': 1, + 'channel-1::pandas-0.10.1-np17py26_0': 1, + 'channel-1::pandas-0.10.1-np17py27_0': 1, + 'channel-1::pandas-0.10.1-np17py33_0': 1, + 'channel-1::pandas-0.8.1-np16py26_0': 5, + 'channel-1::pandas-0.8.1-np16py27_0': 5, + 'channel-1::pandas-0.8.1-np17py26_0': 5, + 'channel-1::pandas-0.8.1-np17py27_0': 5, + 'channel-1::pandas-0.9.0-np16py26_0': 4, + 'channel-1::pandas-0.9.0-np16py27_0': 4, + 'channel-1::pandas-0.9.0-np17py26_0': 4, + 'channel-1::pandas-0.9.0-np17py27_0': 4, + 'channel-1::pandas-0.9.1-np16py26_0': 3, + 'channel-1::pandas-0.9.1-np16py27_0': 3, + 'channel-1::pandas-0.9.1-np17py26_0': 3, + 'channel-1::pandas-0.9.1-np17py27_0': 3, + 'channel-1::pip-1.2.1-py26_1': 1, + 'channel-1::pip-1.2.1-py27_1': 1, + 'channel-1::pip-1.2.1-py33_1': 1, + 'channel-1::psutil-0.6.1-py26_0': 1, + 'channel-1::psutil-0.6.1-py27_0': 1, + 'channel-1::psutil-0.6.1-py33_0': 1, + 'channel-1::pyflakes-0.6.1-py26_0': 1, + 'channel-1::pyflakes-0.6.1-py27_0': 1, + 'channel-1::pyflakes-0.6.1-py33_0': 1, + 'channel-1::python-2.6.8-6': 4, + 'channel-1::python-2.7.3-7': 3, + 'channel-1::python-2.7.4-0': 2, + 'channel-1::python-3.3.0-4': 1, + 'channel-1::pytz-2012j-py26_0': 1, + 'channel-1::pytz-2012j-py27_0': 1, + 'channel-1::pytz-2012j-py33_0': 1, + 'channel-1::requests-0.13.9-py26_0': 1, + 'channel-1::requests-0.13.9-py27_0': 1, + 'channel-1::requests-0.13.9-py33_0': 1, + 'channel-1::scikit-learn-0.13-np15py26_1': 1, + 'channel-1::scikit-learn-0.13-np15py27_1': 1, + 'channel-1::scikit-learn-0.13-np16py26_1': 1, + 'channel-1::scikit-learn-0.13-np16py27_1': 1, + 'channel-1::scikit-learn-0.13-np17py26_1': 1, + 'channel-1::scikit-learn-0.13-np17py27_1': 1, + 'channel-1::scipy-0.11.0-np15py26_3': 1, + 'channel-1::scipy-0.11.0-np15py27_3': 1, + 'channel-1::scipy-0.11.0-np16py26_3': 1, + 'channel-1::scipy-0.11.0-np16py27_3': 1, + 'channel-1::scipy-0.11.0-np17py26_3': 1, + 'channel-1::scipy-0.11.0-np17py27_3': 1, + 'channel-1::scipy-0.11.0-np17py33_3': 1, + 'channel-1::six-1.2.0-py26_0': 1, + 'channel-1::six-1.2.0-py27_0': 1, + 'channel-1::six-1.2.0-py33_0': 1, + 'channel-1::spyder-2.1.13-py27_0': 1, + 'channel-1::sqlalchemy-0.7.8-py26_0': 1, + 'channel-1::sqlalchemy-0.7.8-py27_0': 1, + 'channel-1::sqlalchemy-0.7.8-py33_0': 1, + 'channel-1::sympy-0.7.1-py26_0': 1, + 'channel-1::sympy-0.7.1-py27_0': 1, + 'channel-1::tornado-2.4.1-py26_0': 1, + 'channel-1::tornado-2.4.1-py27_0': 1, + 'channel-1::tornado-2.4.1-py33_0': 1, + 'channel-1::xlrd-0.9.0-py26_0': 1, + 'channel-1::xlrd-0.9.0-py27_0': 1, + 'channel-1::xlrd-0.9.0-py33_0': 1, + 'channel-1::xlwt-0.7.4-py26_0': 1, + 'channel-1::xlwt-0.7.4-py27_0': 1, } assert eqb == { - 'cairo-1.12.2-0.tar.bz2': 1, - 'cubes-0.10.2-py27_0.tar.bz2': 1, - 'dateutil-2.1-py26_0.tar.bz2': 1, - 'dateutil-2.1-py27_0.tar.bz2': 1, - 'dateutil-2.1-py33_0.tar.bz2': 1, - 'gevent-websocket-0.3.6-py26_1.tar.bz2': 1, - 'gevent-websocket-0.3.6-py27_1.tar.bz2': 1, - 'gevent_zeromq-0.2.5-py26_1.tar.bz2': 1, - 'gevent_zeromq-0.2.5-py27_1.tar.bz2': 1, - 'libnetcdf-4.2.1.1-0.tar.bz2': 1, - 'numexpr-2.0.1-np16py26_1.tar.bz2': 2, - 'numexpr-2.0.1-np16py26_2.tar.bz2': 1, - 'numexpr-2.0.1-np16py26_ce0.tar.bz2': 3, - 'numexpr-2.0.1-np16py26_p1.tar.bz2': 2, - 'numexpr-2.0.1-np16py26_p2.tar.bz2': 1, - 'numexpr-2.0.1-np16py26_pro0.tar.bz2': 3, - 'numexpr-2.0.1-np16py27_1.tar.bz2': 2, - 'numexpr-2.0.1-np16py27_2.tar.bz2': 1, - 'numexpr-2.0.1-np16py27_ce0.tar.bz2': 3, - 'numexpr-2.0.1-np16py27_p1.tar.bz2': 2, - 'numexpr-2.0.1-np16py27_p2.tar.bz2': 1, - 'numexpr-2.0.1-np16py27_pro0.tar.bz2': 3, - 'numexpr-2.0.1-np17py26_1.tar.bz2': 2, - 'numexpr-2.0.1-np17py26_2.tar.bz2': 1, - 'numexpr-2.0.1-np17py26_ce0.tar.bz2': 3, - 'numexpr-2.0.1-np17py26_p1.tar.bz2': 2, - 'numexpr-2.0.1-np17py26_p2.tar.bz2': 1, - 'numexpr-2.0.1-np17py26_pro0.tar.bz2': 3, - 'numexpr-2.0.1-np17py27_1.tar.bz2': 2, - 'numexpr-2.0.1-np17py27_2.tar.bz2': 1, - 'numexpr-2.0.1-np17py27_ce0.tar.bz2': 3, - 'numexpr-2.0.1-np17py27_p1.tar.bz2': 2, - 'numexpr-2.0.1-np17py27_p2.tar.bz2': 1, - 'numexpr-2.0.1-np17py27_pro0.tar.bz2': 3, - 'numpy-1.6.2-py26_3.tar.bz2': 1, - 'numpy-1.6.2-py27_3.tar.bz2': 1, - 'py2cairo-1.10.0-py26_0.tar.bz2': 1, - 'py2cairo-1.10.0-py27_0.tar.bz2': 1, - 'pycurl-7.19.0-py26_0.tar.bz2': 1, - 'pycurl-7.19.0-py27_0.tar.bz2': 1, - 'pysal-1.5.0-np15py27_0.tar.bz2': 1, - 'pysal-1.5.0-np16py27_0.tar.bz2': 1, - 'pysal-1.5.0-np17py27_0.tar.bz2': 1, - 'pytest-2.3.4-py26_0.tar.bz2': 1, - 'pytest-2.3.4-py27_0.tar.bz2': 1, - 'pyzmq-2.2.0.1-py26_0.tar.bz2': 1, - 'pyzmq-2.2.0.1-py27_0.tar.bz2': 1, - 'pyzmq-2.2.0.1-py33_0.tar.bz2': 1, - 'scikit-image-0.8.2-np16py26_0.tar.bz2': 1, - 'scikit-image-0.8.2-np16py27_0.tar.bz2': 1, - 'scikit-image-0.8.2-np17py26_0.tar.bz2': 1, - 'scikit-image-0.8.2-np17py27_0.tar.bz2': 1, - 'scikit-image-0.8.2-np17py33_0.tar.bz2': 1, - 'sphinx-1.1.3-py26_2.tar.bz2': 1, - 'sphinx-1.1.3-py27_2.tar.bz2': 1, - 'sphinx-1.1.3-py33_2.tar.bz2': 1, - 'statsmodels-0.4.3-np16py26_0.tar.bz2': 1, - 'statsmodels-0.4.3-np16py27_0.tar.bz2': 1, - 'statsmodels-0.4.3-np17py26_0.tar.bz2': 1, - 'statsmodels-0.4.3-np17py27_0.tar.bz2': 1, - 'system-5.8-0.tar.bz2': 1, - 'theano-0.5.0-np15py26_0.tar.bz2': 1, - 'theano-0.5.0-np15py27_0.tar.bz2': 1, - 'theano-0.5.0-np16py26_0.tar.bz2': 1, - 'theano-0.5.0-np16py27_0.tar.bz2': 1, - 'theano-0.5.0-np17py26_0.tar.bz2': 1, - 'theano-0.5.0-np17py27_0.tar.bz2': 1, - 'zeromq-2.2.0-0.tar.bz2': 1, + 'channel-1::cairo-1.12.2-0': 1, + 'channel-1::cubes-0.10.2-py27_0': 1, + 'channel-1::dateutil-2.1-py26_0': 1, + 'channel-1::dateutil-2.1-py27_0': 1, + 'channel-1::dateutil-2.1-py33_0': 1, + 'channel-1::gevent-websocket-0.3.6-py26_1': 1, + 'channel-1::gevent-websocket-0.3.6-py27_1': 1, + 'channel-1::gevent_zeromq-0.2.5-py26_1': 1, + 'channel-1::gevent_zeromq-0.2.5-py27_1': 1, + 'channel-1::libnetcdf-4.2.1.1-0': 1, + 'channel-1::numexpr-2.0.1-np16py26_1': 2, + 'channel-1::numexpr-2.0.1-np16py26_2': 1, + 'channel-1::numexpr-2.0.1-np16py26_ce0': 3, + 'channel-1::numexpr-2.0.1-np16py26_p1': 2, + 'channel-1::numexpr-2.0.1-np16py26_p2': 1, + 'channel-1::numexpr-2.0.1-np16py26_pro0': 3, + 'channel-1::numexpr-2.0.1-np16py27_1': 2, + 'channel-1::numexpr-2.0.1-np16py27_2': 1, + 'channel-1::numexpr-2.0.1-np16py27_ce0': 3, + 'channel-1::numexpr-2.0.1-np16py27_p1': 2, + 'channel-1::numexpr-2.0.1-np16py27_p2': 1, + 'channel-1::numexpr-2.0.1-np16py27_pro0': 3, + 'channel-1::numexpr-2.0.1-np17py26_1': 2, + 'channel-1::numexpr-2.0.1-np17py26_2': 1, + 'channel-1::numexpr-2.0.1-np17py26_ce0': 3, + 'channel-1::numexpr-2.0.1-np17py26_p1': 2, + 'channel-1::numexpr-2.0.1-np17py26_p2': 1, + 'channel-1::numexpr-2.0.1-np17py26_pro0': 3, + 'channel-1::numexpr-2.0.1-np17py27_1': 2, + 'channel-1::numexpr-2.0.1-np17py27_2': 1, + 'channel-1::numexpr-2.0.1-np17py27_ce0': 3, + 'channel-1::numexpr-2.0.1-np17py27_p1': 2, + 'channel-1::numexpr-2.0.1-np17py27_p2': 1, + 'channel-1::numexpr-2.0.1-np17py27_pro0': 3, + 'channel-1::numpy-1.6.2-py26_3': 1, + 'channel-1::numpy-1.6.2-py27_3': 1, + 'channel-1::py2cairo-1.10.0-py26_0': 1, + 'channel-1::py2cairo-1.10.0-py27_0': 1, + 'channel-1::pycurl-7.19.0-py26_0': 1, + 'channel-1::pycurl-7.19.0-py27_0': 1, + 'channel-1::pysal-1.5.0-np15py27_0': 1, + 'channel-1::pysal-1.5.0-np16py27_0': 1, + 'channel-1::pysal-1.5.0-np17py27_0': 1, + 'channel-1::pytest-2.3.4-py26_0': 1, + 'channel-1::pytest-2.3.4-py27_0': 1, + 'channel-1::pyzmq-2.2.0.1-py26_0': 1, + 'channel-1::pyzmq-2.2.0.1-py27_0': 1, + 'channel-1::pyzmq-2.2.0.1-py33_0': 1, + 'channel-1::scikit-image-0.8.2-np16py26_0': 1, + 'channel-1::scikit-image-0.8.2-np16py27_0': 1, + 'channel-1::scikit-image-0.8.2-np17py26_0': 1, + 'channel-1::scikit-image-0.8.2-np17py27_0': 1, + 'channel-1::scikit-image-0.8.2-np17py33_0': 1, + 'channel-1::sphinx-1.1.3-py26_2': 1, + 'channel-1::sphinx-1.1.3-py27_2': 1, + 'channel-1::sphinx-1.1.3-py33_2': 1, + 'channel-1::statsmodels-0.4.3-np16py26_0': 1, + 'channel-1::statsmodels-0.4.3-np16py27_0': 1, + 'channel-1::statsmodels-0.4.3-np17py26_0': 1, + 'channel-1::statsmodels-0.4.3-np17py27_0': 1, + 'channel-1::system-5.8-0': 1, + 'channel-1::theano-0.5.0-np15py26_0': 1, + 'channel-1::theano-0.5.0-np15py27_0': 1, + 'channel-1::theano-0.5.0-np16py26_0': 1, + 'channel-1::theano-0.5.0-np16py27_0': 1, + 'channel-1::theano-0.5.0-np17py26_0': 1, + 'channel-1::theano-0.5.0-np17py27_0': 1, + 'channel-1::zeromq-2.2.0-0': 1, } # No timestamps in the current data set @@ -407,9 +410,9 @@ def test_timestamps_and_deps(): # it will force unnecessary changes to dependencies. Timestamp maximization needs # to be done at low priority so that conda is free to consider packages with the # same version and build that are most compatible with the installed environment. - index2 = {Dist(key): value for key, value in iteritems(index)} - index2[Dist('mypackage-1.0-hash12_0.tar.bz2')] = PackageRecord(**{ - 'build': 'hash27_0', + index2 = {key: value for key, value in iteritems(index)} + mypackage1 = PackageRecord(**{ + 'build': 'hash12_0', 'build_number': 0, 'depends': ['libpng 1.2.*'], 'name': 'mypackage', @@ -417,7 +420,8 @@ def test_timestamps_and_deps(): 'version': '1.0', 'timestamp': 1, }) - index2[Dist('mypackage-1.0-hash15_0.tar.bz2')] = PackageRecord(**{ + index2[mypackage1] = mypackage1 + mypackage2 = PackageRecord(**{ 'build': 'hash15_0', 'build_number': 0, 'depends': ['libpng 1.5.*'], @@ -426,9 +430,10 @@ def test_timestamps_and_deps(): 'version': '1.0', 'timestamp': 0, }) + index2[mypackage2] = mypackage2 r = Resolve(index2) installed1 = r.install(['libpng 1.2.*', 'mypackage']) - print([k.dist_name for k in installed1]) + print([prec.dist_str() for prec in installed1]) assert any(k.name == 'libpng' and k.version.startswith('1.2') for k in installed1) assert any(k.name == 'mypackage' and k.build == 'hash12_0' for k in installed1) installed2 = r.install(['libpng 1.5.*', 'mypackage']) @@ -446,7 +451,7 @@ def test_timestamps_and_deps(): def test_nonexistent_deps(): index2 = index.copy() - index2['mypackage-1.0-py33_0.tar.bz2'] = PackageRecord(**{ + p1 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -458,7 +463,7 @@ def test_nonexistent_deps(): 'requires': ['nose 1.2.1', 'python 3.3'], 'version': '1.0', }) - index2['mypackage-1.1-py33_0.tar.bz2'] = PackageRecord(**{ + p2 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -470,7 +475,7 @@ def test_nonexistent_deps(): 'requires': ['nose 1.2.1', 'python 3.3'], 'version': '1.1', }) - index2['anotherpackage-1.0-py33_0.tar.bz2'] = PackageRecord(**{ + p3 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -482,7 +487,7 @@ def test_nonexistent_deps(): 'requires': ['nose', 'mypackage 1.1'], 'version': '1.0', }) - index2['anotherpackage-2.0-py33_0.tar.bz2'] = PackageRecord(**{ + p4 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -494,81 +499,85 @@ def test_nonexistent_deps(): 'requires': ['nose', 'mypackage'], 'version': '2.0', }) - index2 = {Dist(key): value for key, value in iteritems(index2)} + index2.update({p1: p1, p2: p2, p3: p3, p4: p4}) + index2 = {key: value for key, value in iteritems(index2)} r = Resolve(index2) - assert set(r.find_matches(MatchSpec('mypackage'))) == { - Dist('mypackage-1.0-py33_0.tar.bz2'), - Dist('mypackage-1.1-py33_0.tar.bz2'), + assert set(prec.dist_str() for prec in r.find_matches(MatchSpec('mypackage'))) == { + 'defaults::mypackage-1.0-py33_0', + 'defaults::mypackage-1.1-py33_0', + } + assert set(prec.dist_str() for prec in r.get_reduced_index(['mypackage'])) == { + 'defaults::mypackage-1.1-py33_0', + 'channel-1::nose-1.1.2-py33_0', + 'channel-1::nose-1.2.1-py33_0', + 'channel-1::nose-1.3.0-py33_0', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-3.3.0-2', + 'channel-1::python-3.3.0-3', + 'channel-1::python-3.3.0-4', + 'channel-1::python-3.3.0-pro0', + 'channel-1::python-3.3.0-pro1', + 'channel-1::python-3.3.1-0', + 'channel-1::python-3.3.2-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', } - assert set(d.to_filename() for d in r.get_reduced_index(['mypackage']).keys()) == { - 'mypackage-1.1-py33_0.tar.bz2', - 'nose-1.1.2-py33_0.tar.bz2', - 'nose-1.2.1-py33_0.tar.bz2', - 'nose-1.3.0-py33_0.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-3.3.0-2.tar.bz2', - 'python-3.3.0-3.tar.bz2', - 'python-3.3.0-4.tar.bz2', - 'python-3.3.0-pro0.tar.bz2', - 'python-3.3.0-pro1.tar.bz2', - 'python-3.3.1-0.tar.bz2', - 'python-3.3.2-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2'} target_result = r.install(['mypackage']) assert target_result == r.install(['mypackage 1.1']) + target_result = [rec.dist_str() for rec in target_result] assert target_result == [ - Dist(add_defaults_if_no_channel(dname)) for dname in [ - '<unknown>::mypackage-1.1-py33_0.tar.bz2', - 'nose-1.3.0-py33_0.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-3.3.2-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]] + 'defaults::mypackage-1.1-py33_0', + 'channel-1::nose-1.3.0-py33_0', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-3.3.2-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] assert raises(ResolvePackageNotFound, lambda: r.install(['mypackage 1.0'])) assert raises(ResolvePackageNotFound, lambda: r.install(['mypackage 1.0', 'burgertime 1.0'])) - assert r.install(['anotherpackage 1.0']) == [ - Dist(add_defaults_if_no_channel(dname)) for dname in [ - '<unknown>::anotherpackage-1.0-py33_0.tar.bz2', - '<unknown>::mypackage-1.1-py33_0.tar.bz2', - 'nose-1.3.0-py33_0.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-3.3.2-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]] - - assert r.install(['anotherpackage']) == [ - Dist(add_defaults_if_no_channel(dname)) for dname in [ - '<unknown>::anotherpackage-2.0-py33_0.tar.bz2', - '<unknown>::mypackage-1.1-py33_0.tar.bz2', - 'nose-1.3.0-py33_0.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-3.3.2-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]] + target_result = r.install(['anotherpackage 1.0']) + target_result = [rec.dist_str() for rec in target_result] + assert target_result == [ + 'defaults::anotherpackage-1.0-py33_0', + 'defaults::mypackage-1.1-py33_0', + 'channel-1::nose-1.3.0-py33_0', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-3.3.2-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] + + target_result = r.install(['anotherpackage']) + target_result = [rec.dist_str() for rec in target_result] + assert target_result == [ + 'defaults::anotherpackage-2.0-py33_0', + 'defaults::mypackage-1.1-py33_0', + 'channel-1::nose-1.3.0-py33_0', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-3.3.2-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] # This time, the latest version is messed up index3 = index.copy() - index3['mypackage-1.1-py33_0.tar.bz2'] = PackageRecord(**{ + p5 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -580,7 +589,7 @@ def test_nonexistent_deps(): 'requires': ['nose 1.2.1', 'python 3.3'], 'version': '1.1', }) - index3['mypackage-1.0-py33_0.tar.bz2'] = PackageRecord(**{ + p6 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -592,7 +601,7 @@ def test_nonexistent_deps(): 'requires': ['nose 1.2.1', 'python 3.3'], 'version': '1.0', }) - index3['anotherpackage-1.0-py33_0.tar.bz2'] = PackageRecord(**{ + p7 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -604,7 +613,7 @@ def test_nonexistent_deps(): 'requires': ['nose', 'mypackage 1.0'], 'version': '1.0', }) - index3['anotherpackage-2.0-py33_0.tar.bz2'] = PackageRecord(**{ + p8 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -616,81 +625,86 @@ def test_nonexistent_deps(): 'requires': ['nose', 'mypackage'], 'version': '2.0', }) - index3 = {Dist(key): value for key, value in iteritems(index3)} + index3.update({p5: p5, p6: p6, p7: p7, p8: p8}) + index3 = {key: value for key, value in iteritems(index3)} r = Resolve(index3) - assert set(d.to_filename() for d in r.find_matches(MatchSpec('mypackage'))) == { - 'mypackage-1.0-py33_0.tar.bz2', - 'mypackage-1.1-py33_0.tar.bz2', + assert set(prec.dist_str() for prec in r.find_matches(MatchSpec('mypackage'))) == { + 'defaults::mypackage-1.0-py33_0', + 'defaults::mypackage-1.1-py33_0', } - assert set(d.to_filename() for d in r.get_reduced_index(['mypackage']).keys()) == { - 'mypackage-1.0-py33_0.tar.bz2', - 'nose-1.1.2-py33_0.tar.bz2', - 'nose-1.2.1-py33_0.tar.bz2', - 'nose-1.3.0-py33_0.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-3.3.0-2.tar.bz2', - 'python-3.3.0-3.tar.bz2', - 'python-3.3.0-4.tar.bz2', - 'python-3.3.0-pro0.tar.bz2', - 'python-3.3.0-pro1.tar.bz2', - 'python-3.3.1-0.tar.bz2', - 'python-3.3.2-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2'} - - assert r.install(['mypackage']) == r.install(['mypackage 1.0']) == [ - Dist(add_defaults_if_no_channel(dname)) for dname in [ - '<unknown>::mypackage-1.0-py33_0.tar.bz2', - 'nose-1.3.0-py33_0.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-3.3.2-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]] + assert set(prec.dist_str() for prec in r.get_reduced_index(['mypackage']).keys()) == { + 'defaults::mypackage-1.0-py33_0', + 'channel-1::nose-1.1.2-py33_0', + 'channel-1::nose-1.2.1-py33_0', + 'channel-1::nose-1.3.0-py33_0', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-3.3.0-2', + 'channel-1::python-3.3.0-3', + 'channel-1::python-3.3.0-4', + 'channel-1::python-3.3.0-pro0', + 'channel-1::python-3.3.0-pro1', + 'channel-1::python-3.3.1-0', + 'channel-1::python-3.3.2-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + } + + target_result = r.install(['mypackage']) + target_result = [rec.dist_str() for rec in target_result] + assert target_result == [ + 'defaults::mypackage-1.0-py33_0', + 'channel-1::nose-1.3.0-py33_0', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-3.3.2-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] assert raises(ResolvePackageNotFound, lambda: r.install(['mypackage 1.1'])) - assert r.install(['anotherpackage 1.0']) == [ - Dist(add_defaults_if_no_channel(dname))for dname in [ - '<unknown>::anotherpackage-1.0-py33_0.tar.bz2', - '<unknown>::mypackage-1.0-py33_0.tar.bz2', - 'nose-1.3.0-py33_0.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-3.3.2-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]] + target_result = r.install(['anotherpackage 1.0']) + target_result = [rec.dist_str() for rec in target_result] + assert target_result == [ + 'defaults::anotherpackage-1.0-py33_0', + 'defaults::mypackage-1.0-py33_0', + 'channel-1::nose-1.3.0-py33_0', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-3.3.2-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] # If recursive checking is working correctly, this will give # anotherpackage 2.0, not anotherpackage 1.0 - assert r.install(['anotherpackage']) == [ - Dist(add_defaults_if_no_channel(dname))for dname in [ - '<unknown>::anotherpackage-2.0-py33_0.tar.bz2', - '<unknown>::mypackage-1.0-py33_0.tar.bz2', - 'nose-1.3.0-py33_0.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-3.3.2-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]] + target_result = r.install(['anotherpackage']) + target_result = [rec.dist_str() for rec in target_result] + assert target_result == [ + 'defaults::anotherpackage-2.0-py33_0', + 'defaults::mypackage-1.0-py33_0', + 'channel-1::nose-1.3.0-py33_0', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-3.3.2-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] def test_install_package_with_feature(): index2 = index.copy() - index2['mypackage-1.0-featurepy33_0.tar.bz2'] = PackageRecord(**{ + p1 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -702,7 +716,7 @@ def test_install_package_with_feature(): 'version': '1.0', 'features': 'feature', }) - index2['feature-1.0-py33_0.tar.bz2'] = PackageRecord(**{ + p2 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -714,8 +728,8 @@ def test_install_package_with_feature(): 'version': '1.0', 'track_features': 'feature', }) - - index2 = {Dist(key): value for key, value in iteritems(index2)} + index2.update({p1: p1, p2: p2}) + index2 = {key: value for key, value in iteritems(index2)} r = Resolve(index2) # It should not raise @@ -727,7 +741,8 @@ def test_unintentional_feature_downgrade(): # With the bug in place, this bad build of scipy # will be selected for install instead of a later # build of scipy 0.11.0. - good_rec = index[Dist('channel-1::scipy-0.11.0-np17py33_3.tar.bz2')] + good_rec_match = MatchSpec("channel-1::scipy==0.11.0=np17py33_3") + good_rec = next(prec for prec in itervalues(index) if good_rec_match.match(prec)) bad_deps = tuple(d for d in good_rec.depends if not d.startswith('numpy')) bad_rec = PackageRecord.from_objects(good_rec, @@ -735,18 +750,17 @@ def test_unintentional_feature_downgrade(): build_number=0, depends=bad_deps, fn=good_rec.fn.replace('_3','_x0'), url=good_rec.url.replace('_3','_x0')) - bad_dist = Dist(bad_rec) index2 = index.copy() - index2[bad_dist] = bad_rec + index2[bad_rec] = bad_rec r = Resolve(index2) install = r.install(['scipy 0.11.0']) - assert bad_dist not in install + assert bad_rec not in install assert any(d.name == 'numpy' for d in install) def test_circular_dependencies(): index2 = index.copy() - index2['package1-1.0-0.tar.bz2'] = PackageRecord(**{ + package1 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -758,7 +772,8 @@ def test_circular_dependencies(): 'requires': ['package2'], 'version': '1.0', }) - index2['package2-1.0-0.tar.bz2'] = PackageRecord(**{ + index2[package1] = package1 + package2 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -770,26 +785,29 @@ def test_circular_dependencies(): 'requires': ['package1'], 'version': '1.0', }) - index2 = {Dist(key): value for key, value in iteritems(index2)} + index2[package2] = package2 + index2 = {key: value for key, value in iteritems(index2)} r = Resolve(index2) - assert set(r.find_matches(MatchSpec('package1'))) == { - Dist('package1-1.0-0.tar.bz2'), + assert set(prec.dist_str() for prec in r.find_matches(MatchSpec('package1'))) == { + 'defaults::package1-1.0-0', } - assert set(r.get_reduced_index(['package1']).keys()) == { - Dist('package1-1.0-0.tar.bz2'), - Dist('package2-1.0-0.tar.bz2'), + assert set(prec.dist_str() for prec in r.get_reduced_index(['package1']).keys()) == { + 'defaults::package1-1.0-0', + 'defaults::package2-1.0-0', } - assert r.install(['package1']) == r.install(['package2']) == \ - r.install(['package1', 'package2']) == [ - Dist('package1-1.0-0.tar.bz2'), - Dist('package2-1.0-0.tar.bz2'), + result = r.install(['package1', 'package2']) + assert r.install(['package1']) == r.install(['package2']) == result + result = [r.dist_str() for r in result] + assert result == [ + 'defaults::package1-1.0-0', + 'defaults::package2-1.0-0', ] def test_optional_dependencies(): index2 = index.copy() - index2['package1-1.0-0.tar.bz2'] = PackageRecord(**{ + p1 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -801,7 +819,7 @@ def test_optional_dependencies(): 'requires': ['package2'], 'version': '1.0', }) - index2['package2-1.0-0.tar.bz2'] = PackageRecord(**{ + p2 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -813,7 +831,7 @@ def test_optional_dependencies(): 'requires': [], 'version': '1.0', }) - index2['package2-2.0-0.tar.bz2'] = PackageRecord(**{ + p3 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", @@ -825,72 +843,81 @@ def test_optional_dependencies(): 'requires': [], 'version': '2.0', }) - index2 = {Dist(key): value for key, value in iteritems(index2)} + index2.update({p1: p1, p2: p2, p3: p3}) + index2 = {key: value for key, value in iteritems(index2)} r = Resolve(index2) - assert set(r.find_matches(MatchSpec('package1'))) == { - Dist('package1-1.0-0.tar.bz2'), + assert set(prec.dist_str() for prec in r.find_matches(MatchSpec('package1'))) == { + 'defaults::package1-1.0-0', } - assert set(r.get_reduced_index(['package1']).keys()) == { - Dist('package1-1.0-0.tar.bz2'), - Dist('package2-2.0-0.tar.bz2'), + assert set(prec.dist_str() for prec in r.get_reduced_index(['package1']).keys()) == { + 'defaults::package1-1.0-0', + 'defaults::package2-2.0-0', } - assert r.install(['package1']) == [ - Dist('package1-1.0-0.tar.bz2'), + result = r.install(['package1']) + result = [rec.dist_str() for rec in result] + assert result == [ + 'defaults::package1-1.0-0', ] - assert r.install(['package1', 'package2']) == r.install(['package1', 'package2 >1.0']) == [ - Dist('package1-1.0-0.tar.bz2'), - Dist('package2-2.0-0.tar.bz2'), + result = r.install(['package1', 'package2']) + assert result == r.install(['package1', 'package2 >1.0']) + result = [rec.dist_str() for rec in result] + assert result == [ + 'defaults::package1-1.0-0', + 'defaults::package2-2.0-0', ] assert raises(UnsatisfiableError, lambda: r.install(['package1', 'package2 <2.0'])) assert raises(UnsatisfiableError, lambda: r.install(['package1', 'package2 1.0'])) def test_irrational_version(): - assert r.install(['pytz 2012d', 'python 3*'], returnall=True) == [[ - Dist(add_defaults_if_no_channel(fname)) for fname in [ - 'openssl-1.0.1c-0.tar.bz2', - 'python-3.3.2-0.tar.bz2', - 'pytz-2012d-py33_0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2' - ]]] + result = r.install(['pytz 2012d', 'python 3*'], returnall=True) + result = [rec.dist_str() for rec in result] + assert result == [ + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-3.3.2-0', + 'channel-1::pytz-2012d-py33_0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] def test_no_features(): # Without this, there would be another solution including 'scipy-0.11.0-np16py26_p3.tar.bz2'. - assert r.install(['python 2.6*', 'numpy 1.6*', 'scipy 0.11*'], - returnall=True) == [[Dist(add_defaults_if_no_channel(fname)) for fname in [ - 'numpy-1.6.2-py26_4.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-2.6.8-6.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'scipy-0.11.0-np16py26_3.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]]] - - assert r.install(['python 2.6*', 'numpy 1.6*', 'scipy 0.11*', MatchSpec(track_features='mkl')], - returnall=True) == [[Dist(add_defaults_if_no_channel(fname)) for fname in [ - 'mkl-rt-11.0-p0.tar.bz2', # This, - 'numpy-1.6.2-py26_p4.tar.bz2', # this, - 'openssl-1.0.1c-0.tar.bz2', - 'python-2.6.8-6.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'scipy-0.11.0-np16py26_p3.tar.bz2', # and this are different. - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]]] + result = r.install(['python 2.6*', 'numpy 1.6*', 'scipy 0.11*'], returnall=True) + result = [rec.dist_str() for rec in result] + assert result == [ + 'channel-1::numpy-1.6.2-py26_4', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-2.6.8-6', + 'channel-1::readline-6.2-0', + 'channel-1::scipy-0.11.0-np16py26_3', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] + + result = r.install(['python 2.6*', 'numpy 1.6*', 'scipy 0.11*', MatchSpec(track_features='mkl')], returnall=True) + result = [rec.dist_str() for rec in result] + assert result == [ + 'channel-1::mkl-rt-11.0-p0', # This, + 'channel-1::numpy-1.6.2-py26_p4', # this, + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-2.6.8-6', + 'channel-1::readline-6.2-0', + 'channel-1::scipy-0.11.0-np16py26_p3', # and this are different. + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] index2 = index.copy() - index2["channel-1::pandas-0.12.0-np16py27_0.tar.bz2"] = PackageRecord(**{ + pandas = PackageRecord(**{ "channel": "channel-1", "subdir": context.subdir, "md5": "0123456789", @@ -912,8 +939,9 @@ def test_no_features(): ], "version": "0.12.0" }) + index2[pandas] = pandas # Make it want to choose the pro version by having it be newer. - index2["channel-1::numpy-1.6.2-py27_p5.tar.bz2"] = PackageRecord(**{ + numpy = PackageRecord(**{ "channel": "channel-1", "subdir": context.subdir, "md5": "0123456789", @@ -933,46 +961,50 @@ def test_no_features(): ], "version": "1.6.2" }) + index2[numpy] = numpy - index2 = {Dist(key): value for key, value in iteritems(index2)} + index2 = {key: value for key, value in iteritems(index2)} r2 = Resolve(index2) # This should not pick any mkl packages (the difference here is that none # of the specs directly have mkl versions) - assert r2.solve(['pandas 0.12.0 np16py27_0', 'python 2.7*'], - returnall=True) == [[Dist(add_defaults_if_no_channel(fname)) for fname in [ - 'dateutil-2.1-py27_1.tar.bz2', - 'numpy-1.6.2-py27_4.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'pandas-0.12.0-np16py27_0.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'pytz-2013b-py27_0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'six-1.3.0-py27_0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]]] - - assert r2.solve(['pandas 0.12.0 np16py27_0', 'python 2.7*', MatchSpec(track_features='mkl')], - returnall=True)[0] == [[Dist(add_defaults_if_no_channel(fname)) for fname in [ - 'dateutil-2.1-py27_1.tar.bz2', - 'mkl-rt-11.0-p0.tar.bz2', # This - 'numpy-1.6.2-py27_p5.tar.bz2', # and this are different. - 'openssl-1.0.1c-0.tar.bz2', - 'pandas-0.12.0-np16py27_0.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'pytz-2013b-py27_0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'six-1.3.0-py27_0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]]][0] + result = r2.solve(['pandas 0.12.0 np16py27_0', 'python 2.7*'], returnall=True) + result = [rec.dist_str() for rec in result] + assert result == [ + 'channel-1::dateutil-2.1-py27_1', + 'channel-1::numpy-1.6.2-py27_4', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::pandas-0.12.0-np16py27_0', + 'channel-1::python-2.7.5-0', + 'channel-1::pytz-2013b-py27_0', + 'channel-1::readline-6.2-0', + 'channel-1::six-1.3.0-py27_0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] + + result = r2.solve(['pandas 0.12.0 np16py27_0', 'python 2.7*', MatchSpec(track_features='mkl')], returnall=True) + result = [rec.dist_str() for rec in result] + assert result == [ + 'channel-1::dateutil-2.1-py27_1', + 'channel-1::mkl-rt-11.0-p0', # This + 'channel-1::numpy-1.6.2-py27_p5', # and this are different. + 'channel-1::openssl-1.0.1c-0', + 'channel-1::pandas-0.12.0-np16py27_0', + 'channel-1::python-2.7.5-0', + 'channel-1::pytz-2013b-py27_0', + 'channel-1::readline-6.2-0', + 'channel-1::six-1.3.0-py27_0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] [email protected](datetime.now() < datetime(2018, 5, 15), reason="bogus test; talk with @mcg1969") def test_multiple_solution(): index2 = index.copy() fn = 'pandas-0.11.0-np16py27_1.tar.bz2' @@ -984,44 +1016,53 @@ def test_multiple_solution(): index2 = {Dist(key): value for key, value in iteritems(index2)} r = Resolve(index2) res = r.solve(['pandas', 'python 2.7*', 'numpy 1.6*'], returnall=True) - res = set([y for x in res for y in x if r.package_name(y).startswith('pandas')]) + res = set([y for y in res if y.name.startswith('pandas')]) assert len(res) <= len(res1) def test_broken_install(): installed = r.install(['pandas', 'python 2.7*', 'numpy 1.6*']) - assert installed == [Dist(add_defaults_if_no_channel(fname)) for fname in [ - 'dateutil-2.1-py27_1.tar.bz2', - 'numpy-1.6.2-py27_4.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'pandas-0.11.0-np16py27_1.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'pytz-2013b-py27_0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'scipy-0.12.0-np16py27_0.tar.bz2', - 'six-1.3.0-py27_0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2']] + _installed = [rec.dist_str() for rec in installed] + assert _installed == [ + 'channel-1::dateutil-2.1-py27_1', + 'channel-1::numpy-1.6.2-py27_4', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::pandas-0.11.0-np16py27_1', + 'channel-1::python-2.7.5-0', + 'channel-1::pytz-2013b-py27_0', + 'channel-1::readline-6.2-0', + 'channel-1::scipy-0.12.0-np16py27_0', + 'channel-1::six-1.3.0-py27_0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] # Add an incompatible numpy; installation should be untouched installed1 = list(installed) - installed1[1] = Dist('channel-1::numpy-1.7.1-py33_p0.tar.bz2') + incompat_numpy_rec = next( + rec for rec in index.values() if rec['name'] == 'numpy' and rec['version'] == '1.7.1' and rec['build'] == 'py33_p0' + ) + installed1[1] = incompat_numpy_rec assert set(r.install([], installed1)) == set(installed1) assert r.install(['numpy 1.6*'], installed1) == installed # adding numpy spec again snaps the packages back to a consistent state # Add an incompatible pandas; installation should be untouched, then fixed installed2 = list(installed) - installed2[3] = Dist('channel-1::pandas-0.11.0-np17py27_1.tar.bz2') + pandas_matcher_1 = MatchSpec('channel-1::pandas==0.11.0=np17py27_1') + pandas_prec_1 = next(prec for prec in index if pandas_matcher_1.match(prec)) + installed2[3] = pandas_prec_1 assert set(r.install([], installed2)) == set(installed2) assert r.install(['pandas'], installed2) == installed # Removing pandas should fix numpy, since pandas depends on it + numpy_matcher = MatchSpec('channel-1::numpy==1.7.1=py33_p0') + numpy_prec = next(prec for prec in index if numpy_matcher.match(prec)) installed3 = list(installed) - installed3[1] = Dist('channel-1::numpy-1.7.1-py33_p0.tar.bz2') - installed3[3] = Dist('channel-1::pandas-0.11.0-np17py27_1.tar.bz2') - installed4 = r.remove(['pandas'], installed) + installed3[1] = numpy_prec + installed3[3] = pandas_prec_1 + installed4 = r.remove(['pandas'], installed3) assert r.bad_installed(installed4, [])[0] is None # Tests removed involving packages not in the index, because we @@ -1030,49 +1071,55 @@ def test_broken_install(): def test_remove(): installed = r.install(['pandas', 'python 2.7*']) - assert installed == [Dist(add_defaults_if_no_channel(fname)) for fname in [ - 'dateutil-2.1-py27_1.tar.bz2', - 'numpy-1.7.1-py27_0.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'pandas-0.11.0-np17py27_1.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'pytz-2013b-py27_0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'scipy-0.12.0-np17py27_0.tar.bz2', - 'six-1.3.0-py27_0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2']] - - assert r.remove(['pandas'], installed=installed) == [ - Dist(add_defaults_if_no_channel(fname)) for fname in [ - 'dateutil-2.1-py27_1.tar.bz2', - 'numpy-1.7.1-py27_0.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'pytz-2013b-py27_0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'scipy-0.12.0-np17py27_0.tar.bz2', - 'six-1.3.0-py27_0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2']] + _installed = [rec.dist_str() for rec in installed] + assert _installed == [ + 'channel-1::dateutil-2.1-py27_1', + 'channel-1::numpy-1.7.1-py27_0', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::pandas-0.11.0-np17py27_1', + 'channel-1::python-2.7.5-0', + 'channel-1::pytz-2013b-py27_0', + 'channel-1::readline-6.2-0', + 'channel-1::scipy-0.12.0-np17py27_0', + 'channel-1::six-1.3.0-py27_0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] + + result = r.remove(['pandas'], installed=installed) + result = [rec.dist_str() for rec in result] + assert result == [ + 'channel-1::dateutil-2.1-py27_1', + 'channel-1::numpy-1.7.1-py27_0', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-2.7.5-0', + 'channel-1::pytz-2013b-py27_0', + 'channel-1::readline-6.2-0', + 'channel-1::scipy-0.12.0-np17py27_0', + 'channel-1::six-1.3.0-py27_0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] # Pandas requires numpy - assert r.remove(['numpy'], installed=installed) == [ - Dist(add_defaults_if_no_channel(fname)) for fname in [ - 'dateutil-2.1-py27_1.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'pytz-2013b-py27_0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'six-1.3.0-py27_0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2']] + result = r.remove(['numpy'], installed=installed) + result = [rec.dist_str() for rec in result] + assert result == [ + 'channel-1::dateutil-2.1-py27_1', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::python-2.7.5-0', + 'channel-1::pytz-2013b-py27_0', + 'channel-1::readline-6.2-0', + 'channel-1::six-1.3.0-py27_0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] def test_channel_priority_1(): @@ -1083,29 +1130,31 @@ def test_channel_priority_1(): ) index2 = index.copy() - record_0 = index2[Dist('channel-1::pandas-0.11.0-np17py27_1.tar.bz2')] + pandas_matcher_1 = MatchSpec('channel-1::pandas==0.11.0=np17py27_1') + pandas_prec_1 = next(prec for prec in index2 if pandas_matcher_1.match(prec)) + record_0 = pandas_prec_1 - fn1 = 'channel-1::pandas-0.10.1-np17py27_0.tar.bz2' - record_1 = index2[Dist(fn1)] + pandas_matcher_2 = MatchSpec('channel-1::pandas==0.10.1=np17py27_0') + pandas_prec_2 = next(prec for prec in index2 if pandas_matcher_2.match(prec)) + record_1 = pandas_prec_2 record_2 = PackageRecord.from_objects(record_1, channel=Channel("channel-A")) - index2[Dist(record_2)] = record_2 + index2[record_2] = record_2 spec = ['pandas', 'python 2.7*'] r2 = Resolve(index2, channels=channels) - # rec = r2.index[Dist(fn2)] with env_var("CONDA_CHANNEL_PRIORITY", "True", reset_context): # Should select the "record_2" because it has highest channel priority, even though # 'channel-1::pandas-0.11.1-np17py27_0.tar.bz2' would otherwise be preferred - installed1 = [index2[dist] for dist in r2.install(spec)] + installed1 = r2.install(spec) assert record_2 in installed1 assert record_1 not in installed1 assert record_0 not in installed1 r3 = Resolve(index2, channels=reversed(channels)) - installed2 = [index2[dist] for dist in r3.install(spec)] + installed2 = r3.install(spec) assert record_0 in installed2 assert record_2 not in installed2 assert record_1 not in installed2 @@ -1115,7 +1164,7 @@ def test_channel_priority_1(): # Should also select the newer package because we have # turned off channel priority altogether r2._reduced_index_cache.clear() - installed3 = [index2[dist] for dist in r2.install(spec)] + installed3 = r2.install(spec) assert record_0 in installed3 assert record_1 not in installed3 assert record_2 not in installed3 @@ -1137,7 +1186,7 @@ def test_channel_priority_2(): r2 = Resolve(dists, True, True, channels=channels) C = r2.gen_clauses() eqc, eqv, eqb, eqt = r2.generate_version_metrics(C, list(r2.groups.keys())) - eqc = {str(Dist(key)): value for key, value in iteritems(eqc)} + eqc = {key: value for key, value in iteritems(eqc)} assert eqc == { 'channel-3::openssl-1.0.1c-0': 1, 'channel-3::openssl-1.0.1g-0': 1, @@ -1212,7 +1261,7 @@ def test_channel_priority_2(): 'channel-3::zlib-1.2.8-0': 1, 'channel-3::zlib-1.2.8-3': 1, } - installed_w_priority = [str(d) for d in this_r.install(spec)] + installed_w_priority = [prec.dist_str() for prec in this_r.install(spec)] assert installed_w_priority == [ 'channel-1::dateutil-2.1-py27_1', 'channel-1::numpy-1.7.1-py27_0', @@ -1234,7 +1283,7 @@ def test_channel_priority_2(): r2 = Resolve(dists, True, True, channels=channels) C = r2.gen_clauses() eqc, eqv, eqb, eqt = r2.generate_version_metrics(C, list(r2.groups.keys())) - eqc = {str(Dist(key)): value for key, value in iteritems(eqc)} + eqc = {key: value for key, value in iteritems(eqc)} assert eqc == { 'channel-1::dateutil-1.5-py27_0': 1, 'channel-1::nose-1.1.2-py27_0': 2, @@ -1355,7 +1404,7 @@ def test_channel_priority_2(): 'channel-3::zlib-1.2.7-1': 1, 'channel-3::zlib-1.2.7-2': 1, } - installed_wo_priority = set([str(d) for d in this_r.install(spec)]) + installed_wo_priority = set([prec.dist_str() for prec in this_r.install(spec)]) assert installed_wo_priority == { 'channel-3::openssl-1.0.2l-0', 'channel-3::python-2.7.13-0', @@ -1375,100 +1424,104 @@ def test_channel_priority_2(): def test_dependency_sort(): specs = ['pandas','python 2.7*','numpy 1.6*'] installed = r.install(specs) - must_have = {r.package_name(dist): dist for dist in installed} + must_have = {prec.name: prec for prec in installed} installed = r.dependency_sort(must_have) results_should_be = [ - 'openssl-1.0.1c-0', - 'readline-6.2-0', - 'sqlite-3.7.13-0', - 'system-5.8-1', - 'tk-8.5.13-0', - 'zlib-1.2.7-0', - 'python-2.7.5-0', - 'numpy-1.6.2-py27_4', - 'pytz-2013b-py27_0', - 'six-1.3.0-py27_0', - 'dateutil-2.1-py27_1', - 'scipy-0.12.0-np16py27_0', - 'pandas-0.11.0-np16py27_1' + 'channel-1::openssl-1.0.1c-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + 'channel-1::python-2.7.5-0', + 'channel-1::numpy-1.6.2-py27_4', + 'channel-1::pytz-2013b-py27_0', + 'channel-1::six-1.3.0-py27_0', + 'channel-1::dateutil-2.1-py27_1', + 'channel-1::scipy-0.12.0-np16py27_0', + 'channel-1::pandas-0.11.0-np16py27_1' ] assert len(installed) == len(results_should_be) - assert [d.dist_name for d in installed] == results_should_be + assert [prec.dist_str() for prec in installed] == results_should_be def test_update_deps(): installed = r.install(['python 2.7*', 'numpy 1.6*', 'pandas 0.10.1']) - assert installed == [Dist(add_defaults_if_no_channel(fn)) for fn in [ - 'dateutil-2.1-py27_1.tar.bz2', - 'numpy-1.6.2-py27_4.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'pandas-0.10.1-np16py27_0.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'scipy-0.11.0-np16py27_3.tar.bz2', - 'six-1.3.0-py27_0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]] + result = [rec.dist_str() for rec in installed] + assert result == [ + 'channel-1::dateutil-2.1-py27_1', + 'channel-1::numpy-1.6.2-py27_4', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::pandas-0.10.1-np16py27_0', + 'channel-1::python-2.7.5-0', + 'channel-1::readline-6.2-0', + 'channel-1::scipy-0.11.0-np16py27_3', + 'channel-1::six-1.3.0-py27_0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] # scipy, and pandas should all be updated here. pytz is a new # dependency of pandas. But numpy does not _need_ to be updated # to get the latest version of pandas, so it stays put. - assert r.install(['pandas', 'python 2.7*'], installed=installed, - update_deps=True, returnall=True) == [[Dist(add_defaults_if_no_channel(fn)) for fn in [ - 'dateutil-2.1-py27_1.tar.bz2', - 'numpy-1.6.2-py27_4.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'pandas-0.11.0-np16py27_1.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'pytz-2013b-py27_0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'scipy-0.12.0-np16py27_0.tar.bz2', - 'six-1.3.0-py27_0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2']]] + result = r.install(['pandas', 'python 2.7*'], installed=installed, update_deps=True, returnall=True) + result = [rec.dist_str() for rec in result] + assert result == [ + 'channel-1::dateutil-2.1-py27_1', + 'channel-1::numpy-1.6.2-py27_4', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::pandas-0.11.0-np16py27_1', + 'channel-1::python-2.7.5-0', + 'channel-1::pytz-2013b-py27_0', + 'channel-1::readline-6.2-0', + 'channel-1::scipy-0.12.0-np16py27_0', + 'channel-1::six-1.3.0-py27_0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] # pandas should be updated here. However, it's going to try to not update # scipy, so it won't be updated to the latest version (0.11.0). - assert r.install(['pandas', 'python 2.7*'], installed=installed, - update_deps=False, returnall=True) == [[Dist(add_defaults_if_no_channel(fn)) for fn in [ - 'dateutil-2.1-py27_1.tar.bz2', - 'numpy-1.6.2-py27_4.tar.bz2', - 'openssl-1.0.1c-0.tar.bz2', - 'pandas-0.10.1-np16py27_0.tar.bz2', - 'python-2.7.5-0.tar.bz2', - 'readline-6.2-0.tar.bz2', - 'scipy-0.11.0-np16py27_3.tar.bz2', - 'six-1.3.0-py27_0.tar.bz2', - 'sqlite-3.7.13-0.tar.bz2', - 'system-5.8-1.tar.bz2', - 'tk-8.5.13-0.tar.bz2', - 'zlib-1.2.7-0.tar.bz2', - ]]] + result = r.install(['pandas', 'python 2.7*'], installed=installed, update_deps=False, returnall=True) + result = [rec.dist_str() for rec in result] + assert result == [ + 'channel-1::dateutil-2.1-py27_1', + 'channel-1::numpy-1.6.2-py27_4', + 'channel-1::openssl-1.0.1c-0', + 'channel-1::pandas-0.10.1-np16py27_0', + 'channel-1::python-2.7.5-0', + 'channel-1::readline-6.2-0', + 'channel-1::scipy-0.11.0-np16py27_3', + 'channel-1::six-1.3.0-py27_0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::zlib-1.2.7-0', + ] def test_surplus_features_1(): index = { - 'feature-1.0-0.tar.bz2': PackageRecord(**{ + PackageRecord(**{ 'name': 'feature', 'version': '1.0', 'build': '0', 'build_number': 0, 'track_features': 'feature', }), - 'package1-1.0-0.tar.bz2': PackageRecord(**{ + PackageRecord(**{ 'name': 'package1', 'version': '1.0', 'build': '0', 'build_number': 0, 'features': 'feature', }), - 'package2-1.0-0.tar.bz2': PackageRecord(**{ + PackageRecord(**{ 'name': 'package2', 'version': '1.0', 'build': '0', @@ -1476,7 +1529,7 @@ def test_surplus_features_1(): 'depends': ['package1'], 'features': 'feature', }), - 'package2-2.0-0.tar.bz2': PackageRecord(**{ + PackageRecord(**{ 'name': 'package2', 'version': '2.0', 'build': '0', @@ -1484,28 +1537,29 @@ def test_surplus_features_1(): 'features': 'feature', }), } - r = Resolve({Dist(key): value for key, value in iteritems(index)}) + index = {prec: prec for prec in index} + r = Resolve({key: value for key, value in iteritems(index)}) install = r.install(['package2', 'feature']) assert 'package1' not in set(d.name for d in install) def test_surplus_features_2(): index = { - 'feature-1.0-0.tar.bz2': PackageRecord(**{ + PackageRecord(**{ 'name': 'feature', 'version': '1.0', 'build': '0', 'build_number': 0, 'track_features': 'feature', }), - 'package1-1.0-0.tar.bz2': PackageRecord(**{ + PackageRecord(**{ 'name': 'package1', 'version': '1.0', 'build': '0', 'build_number': 0, 'features': 'feature', }), - 'package2-1.0-0.tar.bz2': PackageRecord(**{ + PackageRecord(**{ 'name': 'package2', 'version': '1.0', 'build': '0', @@ -1513,7 +1567,7 @@ def test_surplus_features_2(): 'depends': ['package1'], 'features': 'feature', }), - 'package2-1.0-1.tar.bz2': PackageRecord(**{ + PackageRecord(**{ 'name': 'package2', 'version': '1.0', 'build': '1', @@ -1521,6 +1575,7 @@ def test_surplus_features_2(): 'features': 'feature', }), } - r = Resolve({Dist(key): value for key, value in iteritems(index)}) + index = {prec: prec for prec in index} + r = Resolve({key: value for key, value in iteritems(index)}) install = r.install(['package2', 'feature']) assert 'package1' not in set(d.name for d in install)
remove dist from resolve.py Dist is no longer needed, and it's time to remove it from the code base. The first step is to remove all `dist` references from `resolve.py`, in a way that `py.test tests/test_resolve.py` passes. Once that's done, we can extract `dist` from the remainder of the code base. CC @mcg1969
We'll ultimately end up with a performance improvement here. See e.g. #6976 Could you please give some more details on why dist is technical debt and how conda will represent the information in Dist objects in the future? Pretty simple. Dist is derived from the filename for a package: name-version-build. But that’s all duplicate information, and we want a single source of truth. The source of truth we’ve chosen is what’s actually inside the package, the info/index.json file. That gets exposed as the package record, and that’s what we want to be using in all cases. @mcg1969 has agreed to take a first crack at this
2018-04-26T13:42:35
conda/conda
7,223
conda__conda-7223
[ "7107" ]
6069614f099a3e93e9f5446c240910da488a1697
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -5,9 +5,7 @@ from errno import EXDEV from logging import getLogger from os.path import basename, dirname, getsize, join -from random import random import re -from time import sleep from uuid import uuid4 from .envs_manager import USER_ENVIRONMENTS_TXT_FILE, register_env, unregister_env @@ -17,7 +15,7 @@ from .._vendor.auxlib.ish import dals from ..base.constants import CONDA_TARBALL_EXTENSION from ..base.context import context -from ..common.compat import iteritems, on_win, range, text_type +from ..common.compat import iteritems, on_win, text_type from ..common.path import (get_bin_directory_short_path, get_leaf_directories, get_python_noarch_target_path, get_python_short_path, parse_entry_point_def, @@ -255,31 +253,13 @@ def __init__(self, transaction_context, package_info, def verify(self): if self.link_type != LinkType.directory and not lexists(self.source_full_path): # pragma: no cover # NOQA - # This backoff loop is added because of some weird race condition conda-build - # experiences. Would be nice at some point to get to the bottom of why it happens. - - # sum(((2 ** n) + random()) * 0.1 for n in range(2)) - # with max_retries = 2, max total time ~= 0.4 sec - # with max_retries = 3, max total time ~= 0.8 sec - # with max_retries = 6, max total time ~= 6.5 sec - count = self.transaction_context.get('_verify_backoff_count', 0) - max_retries = 6 if count < 4 else 3 - for n in range(max_retries): - sleep_time = ((2 ** n) + random()) * 0.1 - log.trace("retrying lexists(%s) in %g sec", self.source_full_path, sleep_time) - sleep(sleep_time) - if lexists(self.source_full_path): - break - else: - # only run the 6.5 second backoff time once - self.transaction_context['_verify_backoff_count'] = count + 1 - return CondaVerificationError(dals(""" - The package for %s located at %s - appears to be corrupted. The path '%s' - specified in the package manifest cannot be found. - """ % (self.package_info.index_json_record.name, - self.package_info.extracted_package_dir, - self.source_short_path))) + return CondaVerificationError(dals(""" + The package for %s located at %s + appears to be corrupted. The path '%s' + specified in the package manifest cannot be found. + """ % (self.package_info.index_json_record.name, + self.package_info.extracted_package_dir, + self.source_short_path))) source_path_data = self.source_path_data try:
Verify hangs when a package is corrupted **I'm submitting a...** - [x] bug report - [ ] feature request ## Current Behavior When installing a corrupted package, the verify step of conda hangs for a long time without telling anything. When running the same with `-v -v -v` one can see errors of type: ``` TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-1_61.dll) in 0.141842 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-1_61.dll) in 0.272421 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-1_61.dll) in 0.404178 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-1_61.dll) in 0.882638 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-1_61.dll) in 1.67327 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-1_61.dll) in 3.27765 sec DEBUG conda.core.link:_verify_individual_level(337): Verification error in action LinkPathAction(target_prefix='C:\\Miniconda3', target_short_path='Library/bin/boost_atomic-vc140-mt-1_61.dll', source_short_path='Library/bin/boost_atomic-vc140-mt-1_61.dll', source_path_data=PathDataV1(_path='Library/bin/boost_atomic-vc140-mt-1_61.dll', path_type='hardlink', sha256='8b4a03d09a79377afd2a761175341ec9fdb6a13d867b44a2bca243a84541a391', size_in_bytes=10240), source_prefix='C:\\Miniconda3\\pkgs\\boost-1.61.0-vc14h6b12553_2', _execute_successful=False, link_type=<LinkType.hardlink: 1>, prefix_path_data=None) conda.exceptions.CondaVerificationError: The package for boost located at C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2 appears to be corrupted. The path 'Library/bin/boost_atomic-vc140-mt-1_61.dll' specified in the package manifest cannot be found. TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-gd-1_61.dll) in 0.156715 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-gd-1_61.dll) in 0.271798 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-gd-1_61.dll) in 0.462018 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-gd-1_61.dll) in 0.885679 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-gd-1_61.dll) in 1.67949 sec TRACE conda.core.path_actions:verify(269): retrying lexists(C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2\Library\bin\boost_atomic-vc140-mt-gd-1_61.dll) in 3.26532 sec DEBUG conda.core.link:_verify_individual_level(337): Verification error in action LinkPathAction(target_prefix='C:\\Miniconda3', target_short_path='Library/bin/boost_atomic-vc140-mt-gd-1_61.dll', source_short_path='Library/bin/boost_atomic-vc140-mt-gd-1_61.dll', source_path_data=PathDataV1(_path='Library/bin/boost_atomic-vc140-mt-gd-1_61.dll', path_type='hardlink', sha256='df13333e7f1d40aa29fc0193a62d58d730691b09a0d291c981514206db9d25cd', size_in_bytes=16896), source_prefix='C:\\Miniconda3\\pkgs\\boost-1.61.0-vc14h6b12553_2', _execute_successful=False, link_type=<LinkType.hardlink: 1>, prefix_path_data=None) conda.exceptions.CondaVerificationError: The package for boost located at C:\Miniconda3\pkgs\boost-1.61.0-vc14h6b12553_2 appears to be corrupted. The path 'Library/bin/boost_atomic-vc140-mt-gd-1_61.dll' specified in the package manifest cannot be found. ``` So what happens is: conda finds out that the linking doesn't seem to work for a file, it retries this file for 3.2 seconds, fails and then continues with the next file - which also fails. Now as you can see, the package is boost and it has 12475 files. This would go on for about 10-12hours, without saying anything to the user. We could not really reproduce why the package was corrupted in the first place but it seems after we cleaned the cache it worked.. ### Steps to Reproduce ``` conda install <a package with missing files> ``` ## Expected Behavior Conda should stop after the first verification error, maybe rollback and tell the user that verification failed.
I just ran into this last night too. I think we can probably remove all of that backoff code, because I don't think it actually ever helped with its intended purpose. Same goes for me. I think what hit this off for my machine was when I was running a `conda update --all` and realized a mistake and ctrl-c stopped the thing. The problem persisted with clearing the cache, running `conda clean --packages --tarballs` or even `conda clean --all`. What helped was going to the specific package in `/anaconda3/pkgs/` and removing it from there, reinstalling it later.
2018-04-27T04:59:32
conda/conda
7,224
conda__conda-7224
[ "7094" ]
6069614f099a3e93e9f5446c240910da488a1697
diff --git a/conda/misc.py b/conda/misc.py --- a/conda/misc.py +++ b/conda/misc.py @@ -18,12 +18,12 @@ from .core.link import PrefixSetup, UnlinkLinkTransaction from .core.package_cache_data import PackageCacheData, ProgressiveFetchExtract from .core.prefix_data import PrefixData, linked_data -from .exceptions import DisallowedPackageError, PackagesNotFoundError, ParseError +from .exceptions import DisallowedPackageError, DryRunExit, PackagesNotFoundError, ParseError from .gateways.disk.delete import rm_rf from .gateways.disk.link import islink, readlink, symlink from .models.dist import Dist -from .models.records import PackageRecord from .models.match_spec import MatchSpec +from .models.records import PackageRecord from .resolve import Resolve @@ -65,6 +65,9 @@ def explicit(specs, prefix, verbose=False, force_extract=True, index_args=None, fetch_specs.append(MatchSpec(url, md5=md5sum) if md5sum else MatchSpec(url)) + if context.dry_run: + raise DryRunExit() + pfe = ProgressiveFetchExtract(fetch_specs) pfe.execute() @@ -238,6 +241,9 @@ def clone_env(prefix1, prefix2, verbose=True, quiet=False, index_args=None): print('Packages: %d' % len(dists)) print('Files: %d' % len(untracked_files)) + if context.dry_run: + raise DryRunExit() + for f in untracked_files: src = join(prefix1, f) dst = join(prefix2, f)
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -656,6 +656,10 @@ def test_tarball_install_and_bad_metadata(self): assert isfile(tar_old_path) + with pytest.raises(DryRunExit): + run_command(Commands.INSTALL, prefix, tar_old_path, "--dry-run") + assert not package_is_installed(prefix, 'flask-0.') + # regression test for #2886 (part 1 of 2) # install tarball from package cache, default channel run_command(Commands.INSTALL, prefix, tar_old_path)
conda create --dry-run still does work <!-- 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 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.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, and especially if you are submitting a bug report, **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. --> **I'm submitting a...** - [x ] bug report - [ ] feature request ## Current Behavior `conda create --dry-run --clone py35 --prefix /home/amartin/.conda/envs/ml35 ` Creates a 7.5GB folder. ``` (py35) amartin@amartin-ai:~/.conda/envs$ ll total 184 -rw-rw-r-- 1 amartin amartin 183438 Mar 27 20:21 conda_clone_ml35.log drwxrwxr-x 10 amartin amartin 4096 Mar 27 20:20 ml35 (py35) amartin@amartin-ai:~/.conda/envs$ du -sh ml35 7.5G ml35 ``` Also gives an assert error that it apparently doesn't want to be a dry run: ``` # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 812, in __call__ return func(*args, **kwargs) File "/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/anaconda/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 77, in do_call exit_code = getattr(module, func_name)(args, parser) File "/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 11, in execute install(args, parser, 'create') File "/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 211, in install clone(args.clone, prefix, json=context.json, quiet=context.quiet, index_args=index_args) File "/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 72, in clone index_args=index_args) File "/anaconda/lib/python2.7/site-packages/conda/misc.py", line 271, in clone_env force_extract=False, index_args=index_args) File "/anaconda/lib/python2.7/site-packages/conda/misc.py", line 69, in explicit pfe.execute() File "/anaconda/lib/python2.7/site-packages/conda/core/package_cache_data.py", line 578, in execute assert not context.dry_run AssertionError ``` ### 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. --> ``` conda create --dry-run --clone py35 --prefix /home/amartin/.conda/envs/ml35 ``` ## Expected Behavior <!-- What do you think should happen? --> It should report actions to be taken without performing any actions ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` (ml35) amartin@amartin-ai:~/.conda/envs/ml35/lib/python3.5/site-packages$ conda info active environment : ml35 active env location : /home/amartin/.conda/envs/ml35 shell level : 1 user config file : /home/amartin/.condarc populated config files : conda version : 4.5.0 conda-build version : 3.0.23 python version : 2.7.11.final.0 base environment : /anaconda (writable) channel URLs : https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/linux-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /anaconda/pkgs /home/amartin/.conda/pkgs envs directories : /anaconda/envs /home/amartin/.conda/envs platform : linux-64 user-agent : conda/4.5.0 requests/2.18.4 CPython/2.7.11 Linux/4.13.0-1011-azure ubuntu/16.04 glibc/2.23 UID:GID : 1003:1003 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' --> ``` ``` </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' --> ``` ``` </p></details> [conda_clone_ml35.log](https://github.com/conda/conda/files/1853928/conda_clone_ml35.log)
[conda_clone_ml35.log](https://github.com/conda/conda/files/1853929/conda_clone_ml35.log)
2018-04-27T05:11:05
conda/conda
7,241
conda__conda-7241
[ "7240" ]
c467517ca652371ebc4224f0d49315b7ec225108
diff --git a/conda/exports.py b/conda/exports.py --- a/conda/exports.py +++ b/conda/exports.py @@ -11,6 +11,9 @@ from . import CondaError # NOQA CondaError = CondaError +from .base.context import reset_context # NOQA +reset_context() # initialize context when conda.exports is imported + from . import compat, plan # NOQA compat, plan = compat, plan
conda's configuration context is not initialized in conda.exports root cause of https://github.com/conda-forge/conda-smithy/issues/762
2018-05-02T15:56:17
conda/conda
7,243
conda__conda-7243
[ "7242" ]
9f3072cbf74aad89a37abc262359763981e2726a
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -21,8 +21,8 @@ from .._vendor.boltons.setutils import IndexedSet from .._vendor.frozendict import frozendict from ..common.compat import NoneType, iteritems, itervalues, odict, on_win, string_types -from ..common.configuration import (Configuration, LoadError, MapParameter, PrimitiveParameter, - SequenceParameter, ValidationError) +from ..common.configuration import (Configuration, ConfigurationLoadError, MapParameter, + PrimitiveParameter, SequenceParameter, ValidationError) from ..common.disk import conda_bld_ensure_dir from ..common.path import expand from ..common.os.linux import linux_get_libc_version @@ -1161,7 +1161,7 @@ def get_prefix(ctx, args, search=True): # pragma: no cover try: context = Context((), None) -except LoadError as e: # pragma: no cover - print(e, file=sys.stderr) +except ConfigurationLoadError as e: # pragma: no cover + print(repr(e), file=sys.stderr) # Exception handler isn't loaded so use sys.exit sys.exit(1) diff --git a/conda/common/configuration.py b/conda/common/configuration.py --- a/conda/common/configuration.py +++ b/conda/common/configuration.py @@ -64,9 +64,11 @@ def __call__(self, *args, **kwargs): return self.handler(e) try: # pragma: no cover from ruamel_yaml.comments import CommentedSeq, CommentedMap + from ruamel_yaml.reader import ReaderError from ruamel_yaml.scanner import ScannerError except ImportError: # pragma: no cover from ruamel.yaml.comments import CommentedSeq, CommentedMap # pragma: no cover + from ruamel.yaml.reader import ReaderError from ruamel.yaml.scanner import ScannerError log = getLogger(__name__) @@ -87,19 +89,17 @@ def pretty_map(dictionary, padding=' '): return '\n'.join("%s%s: %s" % (padding, key, value) for key, value in iteritems(dictionary)) -class LoadError(CondaError): - def __init__(self, message, filepath, line, column): - self.line = line - self.filepath = filepath - self.column = column - msg = "Load Error: in %s on line %s, column %s. %s" % (filepath, line, column, message) - super(LoadError, self).__init__(msg) - - class ConfigurationError(CondaError): pass +class ConfigurationLoadError(ConfigurationError): + def __init__(self, path, message_addition='', **kwargs): + message = "Unable to load configuration file.\n path: %(path)s\n" + super(ConfigurationLoadError, self).__init__(message + message_addition, path=path, + **kwargs) + + class ValidationError(ConfigurationError): def __init__(self, parameter_name, parameter_value, source, msg=None, **kwargs): @@ -351,8 +351,17 @@ def make_raw_parameters_from_file(cls, filepath): ruamel_yaml = yaml_load(fh) except ScannerError as err: mark = err.problem_mark - raise LoadError("Invalid YAML", filepath, mark.line, mark.column) - return cls.make_raw_parameters(filepath, ruamel_yaml) or EMPTY_MAP + raise ConfigurationLoadError( + filepath, + " reason: invalid yaml at line %(line)s, column %(column)s", + line=mark.line, + column=mark.column + ) + except ReaderError as err: + raise ConfigurationLoadError(filepath, + " reason: invalid yaml at position %(position)s", + position=err.position) + return cls.make_raw_parameters(filepath, ruamel_yaml) or EMPTY_MAP def load_file_configs(search_path):
diff --git a/tests/cli/test_config.py b/tests/cli/test_config.py --- a/tests/cli/test_config.py +++ b/tests/cli/test_config.py @@ -8,7 +8,7 @@ from conda.base.context import context, reset_context from conda.cli.python_api import Commands, run_command -from conda.common.configuration import LoadError +from conda.common.configuration import ConfigurationLoadError from conda.common.serialize import yaml_load from conda.gateways.disk.delete import rm_rf @@ -54,11 +54,8 @@ def test_invalid_config(): with make_temp_condarc(condarc) as rc: rc_path = rc run_command(Commands.CONFIG, '--file', rc, '--add', 'channels', 'test') - except LoadError as err: - error1 = "Load Error: in " - error2 = "on line 1, column 8. Invalid YAML" - assert error1 in err.message - assert error2 in err.message + except ConfigurationLoadError as err: + assert "reason: invalid yaml at line" in err.message, err.message # Tests for the conda config command # FIXME This shoiuld be multiple individual tests diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -832,7 +832,7 @@ def test_create_only_deps_flag(self): assert package_is_installed(prefix, 'openssl') assert package_is_installed(prefix, 'itsdangerous') - @pytest.mark.skipif(datetime.now() < datetime(2018, 8, 1), reason="TODO") + @pytest.mark.skipif(datetime.now() < datetime(2018, 9, 1), reason="TODO") def test_install_update_deps_only_deps_flags(self): raise NotImplementedError() @@ -1260,7 +1260,7 @@ def test_conda_pip_interop_dependency_satisfied_by_pip(self): assert json_obj['exception_name'] == 'PackagesNotFoundError' assert not len(json_obj.keys()) == 0 - @pytest.mark.skipif(datetime.now() < datetime(2018, 8, 1), reason="TODO") + @pytest.mark.skipif(datetime.now() < datetime(2018, 9, 1), reason="TODO") def test_conda_pip_interop_pip_clobbers_conda(self): # 1. conda install old six # 2. pip install -U six @@ -1268,16 +1268,16 @@ def test_conda_pip_interop_pip_clobbers_conda(self): # 4. probably need to purge something with the history file too? assert False - @pytest.mark.skipif(datetime.now() < datetime(2018, 8, 1), reason="TODO") + @pytest.mark.skipif(datetime.now() < datetime(2018, 9, 1), reason="TODO") def test_conda_pip_interop_conda_updates_pip_package(self): assert False - @pytest.mark.skipif(datetime.now() < datetime(2018, 8, 1), reason="TODO") + @pytest.mark.skipif(datetime.now() < datetime(2018, 9, 1), reason="TODO") def gittest_conda_pip_interop_conda_doesnt_update_ancient_distutils_package(self): # probably easiest just to use a conda package and remove the conda-meta record assert False - @pytest.mark.skipif(datetime.now() < datetime(2018, 8, 1), reason="TODO") + @pytest.mark.skipif(datetime.now() < datetime(2018, 9, 1), reason="TODO") def test_conda_pip_interop_conda_doesnt_update_editable_package(self): assert False diff --git a/tests/test_resolve.py b/tests/test_resolve.py --- a/tests/test_resolve.py +++ b/tests/test_resolve.py @@ -1004,7 +1004,7 @@ def test_no_features(): ] [email protected](datetime.now() < datetime(2018, 8, 1), reason="bogus test; talk with @mcg1969") [email protected](datetime.now() < datetime(2018, 9, 1), reason="bogus test; talk with @mcg1969") def test_multiple_solution(): index2 = index.copy() fn = 'pandas-0.11.0-np16py27_1.tar.bz2'
Conda Not Running _From @sanghaisubham on May 2, 2018 8:24_ <!-- Thanks for opening an issue! A few things to keep in mind: - This issue tracker is for issues with installing Anaconda or Miniconda or with packages built by Anaconda, Inc. like Anaconda Navigator. It is also a place to request packages or other enhancements of the Anaconda Distribution. For conda issues, you should open an issue at https://github.com/conda/conda/issues For conda-build issues, you should open an issue at https://github.com/conda/conda-build For an issue with a particular conda-forge package, you should open an issue on the corresponding feedstock: https://github.com/conda-forge --> ### Actual Behavior # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "C:\Users\Subham\Anaconda3\lib\site-packages\conda\cli\main.py", line 97, in main from ..activate import main as activator_main File "C:\Users\Subham\Anaconda3\lib\site-packages\conda\activate.py", line 12, in <module> context.__init__() # oOn import, context does not include SEARCH_PATH. This line fixes that. File "C:\Users\Subham\Anaconda3\lib\site-packages\conda\base\context.py", line 236, in __init__ argparse_args=argparse_args) File "C:\Users\Subham\Anaconda3\lib\site-packages\conda\common\configuration.py", line 722, in __init__ self._set_search_path(search_path) File "C:\Users\Subham\Anaconda3\lib\site-packages\conda\common\configuration.py", line 728, in _set_search_path self._set_raw_data(load_file_configs(search_path)) File "C:\Users\Subham\Anaconda3\lib\site-packages\conda\common\configuration.py", line 369, in load_file_configs raw_data = odict(kv for kv in chain.from_iterable(load_paths)) File "C:\Users\Subham\Anaconda3\lib\site-packages\conda\common\configuration.py", line 369, in <genexpr> raw_data = odict(kv for kv in chain.from_iterable(load_paths)) File "C:\Users\Subham\Anaconda3\lib\site-packages\conda\common\configuration.py", line 344, in _file_yaml_loader yield fullpath, YamlRawParameter.make_raw_parameters_from_file(fullpath) File "C:\Users\Subham\Anaconda3\lib\site-packages\conda\common\configuration.py", line 332, in make_raw_parameters_from_file ruamel_yaml = yaml_load(fh) File "C:\Users\Subham\Anaconda3\lib\site-packages\conda\common\serialize.py", line 54, in yaml_load return yaml.load(string, Loader=yaml.RoundTripLoader, version="1.2") File "C:\Users\Subham\Anaconda3\lib\site-packages\ruamel_yaml\main.py", line 73, in load loader = Loader(stream, version, preserve_quotes=preserve_quotes) File "C:\Users\Subham\Anaconda3\lib\site-packages\ruamel_yaml\loader.py", line 56, in __init__ Reader.__init__(self, stream) File "C:\Users\Subham\Anaconda3\lib\site-packages\ruamel_yaml\reader.py", line 98, in __init__ self.determine_encoding() File "C:\Users\Subham\Anaconda3\lib\site-packages\ruamel_yaml\reader.py", line 149, in determine_encoding self.update(1) File "C:\Users\Subham\Anaconda3\lib\site-packages\ruamel_yaml\reader.py", line 189, in update self.check_printable(data) File "C:\Users\Subham\Anaconda3\lib\site-packages\ruamel_yaml\reader.py", line 160, in check_printable 'unicode', "special characters are not allowed") ruamel_yaml.reader.ReaderError: unacceptable character #x0000: special characters are not allowed in "C:\Users\Subham\.condarc", position 0 `$ C:\Users\Subham\Anaconda3\Scripts\conda shell.cmd.exe activate activate C:\Users\Subham\Anaconda3` environment variables: CIO_TEST=<not set> CONDA_ROOT=C:\Users\Subham\Anaconda3 HOMEPATH=\Users\Subham PATH=C:\Users\Subham\Anaconda3\Library\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\oracle xe\app\oracle\product\11.2.0\server\bin;C:\ProgramData\Oracle\Java\jav apath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDO WS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\MATLAB\R2017a\runtime\win64;C:\Program Files\MATLAB\R2017a\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Users\Subham\ AppData\Local\Programs\Python\Python35-32\Scripts\;C:\Users\Subham\App Data\Local\Programs\Python\Python35-32\;C:\Users\Subham\AppData\Local\ Microsoft\WindowsApps;C:\Users\Subham\AppData\Local\GitHubDesktop\bin; C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\texlive\2015\bin\win32 PSMODULEPATH=C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> active environment : None user config file : C:\Users\Subham\.condarc populated config files : conda version : 4.5.1 conda-build version : not installed python version : 3.6.1.final.0 base environment : C:\Users\Subham\Anaconda3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/win-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/win-64 https://repo.anaconda.com/pkgs/pro/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Users\Subham\Anaconda3\pkgs C:\Users\Subham\AppData\Local\conda\conda\pkgs envs directories : C:\Users\Subham\Anaconda3\envs C:\Users\Subham\AppData\Local\conda\conda\envs C:\Users\Subham\.conda\envs platform : win-64 user-agent : conda/4.5.1 requests/2.14.2 CPython/3.6.1 Windows/10 Windows/10.0.16299 administrator : False netrc file : None offline mode : False An unexpected error has occurred. Conda has prepared the above report. If submitted, this report will be used by core maintainers to improve future releases of conda. Would you like conda to send this report to the core maintainers? <!-- What actually happens? --> ### Expected Behavior <!-- What do you think should happen? --> ### Steps to Reproduce <!-- Steps to reproduce issue. --> ##### Anaconda or Miniconda version: ##### Operating System: ##### `conda info` <!-- between the ticks below, paste the output of 'conda info' --> ``` ``` ##### `conda list --show-channel-urls` <!-- between the ticks below, paste the output of 'conda list --show-channel-urls' --> ``` ``` _Copied from original issue: ContinuumIO/anaconda-issues#9284_
You have incorrect yaml in one of your configuration files. Probably `C:\Users\Subham\.condarc`. Edit: Yes, it's `C:\Users\Subham\.condarc`. You'll need to manually fix the yaml syntax in that file. Moved here as an open issue so that we can give a proper user error instead of the stack trace.
2018-05-02T16:55:22
conda/conda
7,244
conda__conda-7244
[ "7240" ]
32ebb8a4de3073fb008d0d785fb0712d0d612c54
diff --git a/conda/exports.py b/conda/exports.py --- a/conda/exports.py +++ b/conda/exports.py @@ -11,6 +11,9 @@ from . import CondaError # NOQA CondaError = CondaError +from .base.context import reset_context # NOQA +reset_context() # initialize context when conda.exports is imported + from . import compat, plan # NOQA compat, plan = compat, plan
diff --git a/tests/cli/test_activate.py b/tests/cli/test_activate.py --- a/tests/cli/test_activate.py +++ b/tests/cli/test_activate.py @@ -625,7 +625,7 @@ def test_activate_does_not_leak_echo_setting(shell): assert_equals(stdout, u'ECHO is on.', stderr) [email protected](datetime.now() < datetime(2018, 5, 1), reason="save for later") [email protected](True, reason="save for later") @pytest.mark.installed def test_activate_non_ascii_char_in_path(shell): shell_vars = _format_vars(shell) diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -566,6 +566,7 @@ def test_create_empty_env(self): assert stderr == '' self.assertIsInstance(stdout, str) + @pytest.mark.skipif(True, reason="pip 10 dropped --egg") def test_list_with_pip_egg(self): from conda.exports import rm_rf as _rm_rf with make_temp_env("python=3.5 pip") as prefix: diff --git a/tests/test_export.py b/tests/test_export.py --- a/tests/test_export.py +++ b/tests/test_export.py @@ -31,7 +31,7 @@ def test_basic(self): output2, error= run_command(Commands.LIST, prefix2, "-e") self.assertEqual(output, output2) - @pytest.mark.xfail(datetime.now() < datetime(2018, 5, 1), reason="Bring back `conda list --export` #3445", strict=True) + @pytest.mark.skipif(True, reason="Bring back `conda list --export` #3445", strict=True) def test_multi_channel_export(self): """ When try to import from txt
conda's configuration context is not initialized in conda.exports root cause of https://github.com/conda-forge/conda-smithy/issues/762
2018-05-02T17:00:15
conda/conda
7,269
conda__conda-7269
[ "7253" ]
1d9232d1222c863a421a640c1e1d15f398911e90
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -206,6 +206,7 @@ def make_file_link_action(source_path_data): package_info.extracted_package_dir, source_path_data.path, target_prefix, target_short_path, + requested_link_type, placeholder, fmode, source_path_data) else: return LinkPathAction(transaction_context, package_info, @@ -356,11 +357,14 @@ class PrefixReplaceLinkAction(LinkPathAction): def __init__(self, transaction_context, package_info, extracted_package_dir, source_short_path, target_prefix, target_short_path, + link_type, prefix_placeholder, file_mode, source_path_data): + # This link_type used in execute(). Make sure we always respect LinkType.copy request. + link_type = LinkType.copy if link_type == LinkType.copy else LinkType.hardlink super(PrefixReplaceLinkAction, self).__init__(transaction_context, package_info, extracted_package_dir, source_short_path, target_prefix, target_short_path, - LinkType.copy, source_path_data) + link_type, source_path_data) self.prefix_placeholder = prefix_placeholder self.file_mode = file_mode self.intermediate_path = None @@ -409,7 +413,7 @@ def execute(self): self.verify() source_path = self.intermediate_path or self.source_full_path log.trace("linking %s => %s", source_path, self.target_full_path) - create_link(source_path, self.target_full_path, LinkType.hardlink) + create_link(source_path, self.target_full_path, self.link_type) self._execute_successful = True
problem creating a prefixed environment on a fhgfs filesystem <!-- 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 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.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, and especially if you are submitting a bug report, **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. --> **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. --> Creating a prefixed environment on a fhgfs partition does not work. It generates symbolic links to a temporary folder that doesn't exist. I can install on an ext4 partition without problem. In the example below I used xz, but I have observed this with other packages as well. ### 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. --> ``` bash Miniconda2-latest-Linux-x86_64.sh conda create -p /tmp/conda/xz xz ls -lh /tmp/conda/xz/bin/xz #-rwxrwxr-x 1 user user 97K May 4 16:42 /tmp/conda/xz/bin/xz conda create -p /DEEP_fhgfs/tmp/conda/xz xz #lrwxrwxrwx 1 user user 62 May 4 16:43 /DEEP_fhgfs/tmp/conda/xz/bin/xz -> ../../../../tmp/tmpsl8kMX/23b991ec-39b8-48ac-bc89-79aaaeeef66c df -Th /tmp /DEEP_fhgfs/tmp #Filesystem Type Size Used Avail Use% Mounted on #/dev/md2 ext4 XXX XXX XXX 1% /local #fhgfs_nodev fhgfs XXX XXX XXX 97% /DEEP_fhgfs ``` ## Expected Behavior <!-- What do you think should happen? --> The installation should complete similar to how it does on the ext4 partition ## 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 : /home/karln/.condarc populated config files : conda version : 4.4.10 conda-build version : not installed python version : 2.7.14.final.0 base environment : /home/karln/miniconda2 (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 : /home/karln/miniconda2/pkgs /home/karln/.conda/pkgs envs directories : /home/karln/miniconda2/envs /home/karln/.conda/envs platform : linux-64 user-agent : conda/4.4.10 requests/2.18.4 CPython/2.7.14 Linux/3.18.86.1.amd64-smp debian/7 glibc/2.13 UID:GID : 21748:3370 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' --> ``` Nothing returned ``` </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/karln/miniconda2: # # Name Version Build Channel asn1crypto 0.24.0 py27_0 defaults ca-certificates 2017.08.26 h1d4fec5_0 defaults certifi 2018.1.18 py27_0 defaults cffi 1.11.4 py27h9745a5d_0 defaults chardet 3.0.4 py27hfa10054_1 defaults conda 4.4.10 py27_0 defaults conda-env 2.6.0 h36134e3_1 defaults cryptography 2.1.4 py27h6697b16_0 defaults enum34 1.1.6 py27h99a27e9_1 defaults futures 3.2.0 py27h7b459c0_0 defaults idna 2.6 py27h5722d68_1 defaults ipaddress 1.0.19 py27_0 defaults libedit 3.1 heed3624_0 defaults libffi 3.2.1 hd88cf55_4 defaults libgcc-ng 7.2.0 h7cc24e2_2 defaults libstdcxx-ng 7.2.0 h7a57d05_2 defaults ncurses 6.0 h9df7e31_2 defaults openssl 1.0.2n hb7f436b_0 defaults pip 9.0.1 py27ha730c48_4 defaults pycosat 0.6.3 py27ha4109ae_0 defaults pycparser 2.18 py27hefa08c5_1 defaults pyopenssl 17.5.0 py27hcee3be0_0 defaults pysocks 1.6.7 py27he2db6d2_1 defaults python 2.7.14 h1571d57_29 defaults readline 7.0 ha6073c6_4 defaults requests 2.18.4 py27hc5b0589_1 defaults ruamel_yaml 0.15.35 py27h14c3975_1 defaults setuptools 38.4.0 py27_0 defaults six 1.11.0 py27h5f960f1_1 defaults sqlite 3.22.0 h1bed415_0 defaults tk 8.6.7 hc745277_3 defaults urllib3 1.22 py27ha55213b_0 defaults wheel 0.30.0 py27h2bc6bb2_1 defaults yaml 0.1.7 had09818_2 defaults zlib 1.2.11 ha838bed_2 defaults ``` </p></details>
Can you be more specific on the technical root cause of the problem, and what we need to change in conda code to fix it? From my perspective, the root cause of the problem is the links created, but I'm afraid my experience and understanding of conda is lacking. There might be a reason for it, but that is beyond me. If I'm missing something obvious, please let me know. Why does conda create links to a temporary folder that does not exist? I would understand if the link pointed to the location of the binary, in this case xz. That way I would be able to use the environment. As it is now, I get a natural `command not found` with the fhgfs environment. On Fri, May 4, 2018 at 5:58 PM, Kale Franz <[email protected]> wrote: > Can you be more specific on the technical root cause of the problem, and > what we need to change in conda code to fix it? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/conda/conda/issues/7253#issuecomment-386646008>, or mute > the thread > <https://github.com/notifications/unsubscribe-auth/ADsaNRa0lXZe8UHodG1sIDG9EjdSaQQCks5tvHqRgaJpZM4TyyNj> > . > I don’t have a lot of experience with this file system. Actually, I don’t have any. Maybe we can figure all this out together though with some back-and-forth. As a starting point, see how far you get after doing conda config --set always_copy true That looks like it will do it. Will try it beginning of next week and get back to you. On Fri, May 4, 2018 at 8:00 PM, Kale Franz <[email protected]> wrote: > I don’t have a lot of experience with this file system. Actually, I don’t > have any. Maybe we can figure all this out together though with some > back-and-forth. > > As a starting point, see how far you get after doing > > conda config --set always_copy true > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/conda/conda/issues/7253#issuecomment-386685795>, or mute > the thread > <https://github.com/notifications/unsubscribe-auth/ADsaNXN_COOC5T1nNKSw1fHwUmH5R1-2ks5tvJdBgaJpZM4TyyNj> > . > I'm afraid this didn't work. I activated the setting. Not sure that it makes a difference, but I also tried to remove my conda installation and start from scratch (.conda and .condarc included) I tried to follow the process through the trace file: [xz.conda.trace.txt](https://github.com/conda/conda/files/1979151/xz.conda.trace.txt) This is how I understand it: 1. find packages in cache 1. prepare transaction 1. verifying transaction: During this step a temporary folder is created and files are correctly copied to this location 1. Executing transaction: Here, most files are soft linked and this seems to be correctly translated into a copy action. Still, a few selected files are targeted to be hard linked, but for some reasons they are soft linked. That they are soft linked probably has something to do with the system. The thing is that they should be copied. Or do I understand the option wrong? One thing I noticed trying to understand the code: https://github.com/conda/conda/blob/c54d490419d79d07a618a2c3ddc0729f20560246/conda/core/path_actions.py#L360 was that the super call had one argument less than the init function (the prefix_placeholder is missing). Could this have an impact? Around line 406 of your trace is ``` TRACE conda.gateways.disk.create:_do_copy(252): copying /home/user/miniconda2/pkgs/xz-5.2.3-h5e939de_4/bin/xz => /DEEP_fhgfs/tmp/tmpUAg7af/4ad6953a-3e9e-488f-a59b-c4a708d60584 TRACE conda.core.path_actions:verify(386): rewriting prefixes in /DEEP_fhgfs/tmp/conda/xz/bin/xz TRACE conda.gateways.disk.update:update_file_in_place_as_binary(35): in-place update path locked for /DEEP_fhgfs/tmp/tmpUAg7af/4ad6953a-3e9e-488f-a59b-c4a708d60584 ``` and then around line 636 ``` TRACE conda.core.path_actions:execute(411): linking /DEEP_fhgfs/tmp/tmpUAg7af/4ad6953a-3e9e-488f-a59b-c4a708d60584 => /DEEP_fhgfs/tmp/conda/xz/bin/xz TRACE conda.gateways.disk.create:create_link(298): hard linking /DEEP_fhgfs/tmp/tmpUAg7af/4ad6953a-3e9e-488f-a59b-c4a708d60584 => /DEEP_fhgfs/tmp/conda/xz/bin/xz ``` What's happening here is that the `xz` executable is modified at install time with prefix rewrites. This happens in two phases. During the verification phase of the install process, we detect that the file is going to need prefix rewrites, so we copy it to a temporary location and do the rewrites there. That's so that, before we enter the transaction, we'll know the exact final state of the file, including the sha256 sum for the file with the prefix modification. During the second phase, which occurs *during* the transaction, we link the file from the temporary location into the environment. Here, at least for many filesystems, hard-linking *should* be fine, because what we're hard-linking is the new inode we created in the temporary location. However if the temporary location is on a different mount, then hard-linking will obviously fail, and we should fall back to copying. That's exactly what we do here: https://github.com/conda/conda/blob/c54d490419d79d07a618a2c3ddc0729f20560246/conda/gateways/disk/create.py#L294-L306 (line 306 that github is truncating is `copy(src, dst)`) The log information shows that there's no hard-link failure happening on your system. But conda most definitely thinks what it's created is a hard link and not a symbolic link for `/DEEP_fhgfs/tmp/conda/xz/bin/xz`. Can you poke at `/DEEP_fhgfs/tmp/conda/xz/bin/xz` more and verify that it indeed ends up being a symbolic link once the conda operation is done? This is definitely a puzzle now. Thanks for the explanation, I could see how things happened, but I didn't understand the reasoning behind it. The file looks very much like a symbolic link: ``` file /DEEP_fhgfs/tmp/conda/xz/bin/xz #/DEEP_fhgfs/tmp/conda/xz/bin/xz: broken symbolic link to `../../../../tmp/tmpUAg7af/4ad6953a-3e9e-488f-a59b-c4a708d60584' ``` It was a long time since the system was configured... there is an anecdote, but I skip over it... the file system has a configuration: ``` sysCreateHardlinksAsSymlinks = true ``` I couldn't find a description for it, but as I read it, hardlinks are replaced by symlinks and I can confirm that a `ln` without extra flags generates a symbolic link... no error signal I still don't understand why the always_copy flag doesn't take precedence. Just to discard my earlier suspicions; Is it correct that the create code is called from the PrefixReplaceLinkAction class in path_actions.py? And if so, isn't the functionality of the super call to override the link type with copy? Or is this overridden on L365? (Setting Linktype to copy and then setting it back?) https://github.com/conda/conda/blob/c54d490419d79d07a618a2c3ddc0729f20560246/conda/core/path_actions.py#L356-L365 Does it matter that "prefix_placeholder" is missing although the arguments are given as positional arguments? (My python is to shaky to judge this without setting up a test case.) If the linktype change happens, shouldn't the create section copy instead of hardlink? > I still don't understand why the always_copy flag doesn't take precedence. Before encountering this issue with you, I would have said the hard-link fall-back-to-copy case was just fine for this particular code path dealing with storing prefix-rewritten files in temporary locations. Now I agree that `always_copy` should mean "always copy." The down side is that it's a performance hit for everybody, even though this `sysCreateHardlinksAsSymlinks` situation only applies to a fairly niche group. > Is it correct that the create code is called from the PrefixReplaceLinkAction class in path_actions.py? Yes. > And if so, isn't the functionality of the super call to override the link type with copy? Yes, but that copy applies from to the operation that's going from the package cache to the temporary location. What's problematic now, and needs to be changed per my first comment in this post, is https://github.com/conda/conda/blob/c54d490419d79d07a618a2c3ddc0729f20560246/conda/core/path_actions.py#L412 Should be changed to create_link(source_path, self.target_full_path, LinkType.copy) > Does it matter that "prefix_placeholder" is missing although the arguments are given as positional arguments? The `__init__` method on the parent class does not take `prefix_placeholder`. That argument is specific to `PrefixReplaceLinkAction`. > The down side is that it's a performance hit for everybody, even though this `sysCreateHardlinksAsSymlinks` situation only applies to a fairly niche group. Rather than make the change that'll be the performance hit for everybody, I can probably test if hard links *are* hard links for the filesystem of the target environment. If they end up being symlinks, then we just switch to `always_copy` again. I think that's the correct solution. And in that case the function we make the code change in is https://github.com/conda/conda/blob/c54d490419d79d07a618a2c3ddc0729f20560246/conda/core/link.py#L49-L59 Actually, that function doesn't need a change at all. We just need to make the `hardlink_supported()` function aware of this edge case. https://github.com/conda/conda/blob/c54d490419d79d07a618a2c3ddc0729f20560246/conda/gateways/disk/test.py#L42-L66 Oh, look at that comment... Maybe we have a logic error in that function? We don't run our CI on such a filesystem, so it's possible that an error crept in over time. yes that comment does indeed fit. In determine_link_type, always_copy is the first option. If that option is set, hardlink_supported should never happen? Does all copy/linking actions pass through determine_link_type? I pulled the repository and started to run the tests. I could not place my conda installation on the problematic file system, but the repository is located there. I'll get back when it gotten through Most of the tests run through. [test.log.txt](https://github.com/conda/conda/files/1983654/test.log.txt) but there are four failures. The most obvious one is "test_simple_LinkPathAction_hardlink" which returns a link. Then there are three tests associated with trash that I cannot see the another connection between. I tried to add an assert hardlink_supported to tests/gateways/disk/test_link::test_hard_link and it works properly. Add least it returns false on my system. I tried, but failed to modify simple_LinkPathAction_hardlink to use the PrefixReplaceLinkAction, as I couldn't find a test for this function. I stumble on providing a context object. I made an attempt at a fix. As mentioned, it allows me to create environments on my file system, but I'm unable to judge if it is too naive, inserted at the wrong place, have ugly side effects etc. It doesn't fix the tests, only the symptomatic described in this issue.
2018-05-08T15:19:33
conda/conda
7,274
conda__conda-7274
[ "7189" ]
1d9232d1222c863a421a640c1e1d15f398911e90
diff --git a/conda/core/package_cache_data.py b/conda/core/package_cache_data.py --- a/conda/core/package_cache_data.py +++ b/conda/core/package_cache_data.py @@ -32,6 +32,7 @@ from ..models.dist import Dist from ..models.match_spec import MatchSpec from ..models.records import PackageCacheRecord, PackageRecord, PackageRef +from ..utils import human_bytes try: from cytoolz.itertoolz import concat, concatv, groupby @@ -610,7 +611,12 @@ def _execute_actions(prec_or_spec, actions): if cache_axn is None and extract_axn is None: return - desc = "%s %s" % (prec_or_spec.name, prec_or_spec.version) + desc = "%s-%s" % (prec_or_spec.name, prec_or_spec.version) + if len(desc) > 20: + desc = desc[:20] + size = getattr(prec_or_spec, 'size', None) + desc = "%-20s | %7s | " % (desc, size and human_bytes(size) or '') + progress_bar = ProgressBar(desc, not context.verbosity and not context.quiet, context.json) download_total = 0.75 # fraction of progress for download; the rest goes to extract
Progress bar changes/issues In `conda` 4.3+ the progress bar looks something like this... ``` pycrypto-2.6.1 100% |################################| Time: 0:00:00 6.79 MB/s pytz-2018.4-py 100% |################################| Time: 0:00:00 9.22 MB/s ``` ...it has a nice tabular view and separates out package name, percentage, time, and download speed. In `conda` 4.5+, the progress bar looks like this... ``` ndg-httpsclient 0.4.4################################################### | 100% libffi 3.2.1############################################################ | 100% ``` Here the progress bar starts right near where the version ends. Making it a little hard to read. Also this start point varies depending on package name and the like, which is a bit distracting. Now I'm not sure if this is an intentional change or if I'm running into a bug. Would be great to know either way. If it is an intentional change, would encourage reconsidering.
I agree that the UI here could be improved. Do you know what caused the shift?
2018-05-09T16:28:30
conda/conda
7,289
conda__conda-7289
[ "7165" ]
f3f2fa0eb7a5bcd90a34ea8f06bd546939c0e970
diff --git a/conda/core/solve.py b/conda/core/solve.py --- a/conda/core/solve.py +++ b/conda/core/solve.py @@ -15,6 +15,7 @@ from .. import CondaError, __version__ as CONDA_VERSION from .._vendor.auxlib.ish import dals from .._vendor.boltons.setutils import IndexedSet +from ..base.constants import UNKNOWN_CHANNEL from ..base.context import context from ..common.compat import iteritems, itervalues, odict, string_types, text_type from ..common.constants import NULL @@ -509,25 +510,31 @@ def solve_for_transaction(self, deps_modifier=NULL, prune=NULL, ignore_pinned=NU # History right now. Do we need to include other categories from the solve? if context.notify_outdated_conda and not context.quiet: - conda_newer_spec = MatchSpec('conda >%s' % CONDA_VERSION) - if not any(conda_newer_spec.match(prec) for prec in link_precs): - conda_newer_records = sorted( - SubdirData.query_all(conda_newer_spec, self.channels, self.subdirs), - key=lambda x: VersionOrder(x.version) - ) - if conda_newer_records: - latest_version = conda_newer_records[-1].version - print(dedent(""" + current_conda_prefix_rec = PrefixData(context.conda_prefix).get('conda', None) + if current_conda_prefix_rec: + channel_name = current_conda_prefix_rec.channel.canonical_name + if channel_name == UNKNOWN_CHANNEL: + conda_newer_spec = MatchSpec('conda >%s' % CONDA_VERSION) + else: + conda_newer_spec = MatchSpec('%s::conda >%s' % (channel_name, CONDA_VERSION)) + if not any(conda_newer_spec.match(prec) for prec in link_precs): + conda_newer_records = sorted( + SubdirData.query_all(conda_newer_spec, self.channels, self.subdirs), + key=lambda x: VersionOrder(x.version) + ) + if conda_newer_records: + latest_version = conda_newer_records[-1].version + print(dedent(""" - ==> WARNING: A newer version of conda exists. <== - current version: %s - latest version: %s + ==> WARNING: A newer version of conda exists. <== + current version: %s + latest version: %s - Please update conda by running + Please update conda by running - $ conda update -n base conda + $ conda update -n base conda - """) % (CONDA_VERSION, latest_version), file=sys.stderr) + """) % (CONDA_VERSION, latest_version), file=sys.stderr) return UnlinkLinkTransaction(stp)
Conda checks for newer versions in channels in current context instead of only base channels <!-- 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 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.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, and especially if you are submitting a bug report, **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. --> **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. --> My base environment uses only the default channels. When I attempted to create a new environment using the conda-forge channel, conda found a newer conda version in conda-forge and warned about it. However, there is no newer version in the default channels to install. ### 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. --> ``` (base) λ conda create --name test --channel conda-forge --dry-run Solving environment: done ==> WARNING: A newer version of conda exists. <== current version: 4.5.0 latest version: 4.5.1 Please update conda by running $ conda update -n base conda ## Package Plan ## environment location: C:\Users\stan.west\Programs\Miniconda3-64\envs\test (base) λ conda update conda Solving environment: done # All requested packages already installed. ``` At the moment, conda-forge has conda-4.5.1, but the default channels have only conda-4.5.0: ``` (base) λ conda search --channel conda-forge "conda>=4.5" Loading channels: done # Name Version Build Channel conda 4.5.0 py27_0 conda-forge conda 4.5.0 py27_0 pkgs/main conda 4.5.0 py35_0 conda-forge conda 4.5.0 py35_0 pkgs/main conda 4.5.0 py36_0 conda-forge conda 4.5.0 py36_0 pkgs/main conda 4.5.1 py27_0 conda-forge conda 4.5.1 py35_0 conda-forge conda 4.5.1 py36_0 conda-forge ``` ## Expected Behavior <!-- What do you think should happen? --> Conda seeks newer versions only in channels used in the base environment and ignores newer versions in other channels. ## 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 : C:\Users\stan.west\Programs\Miniconda3-64 shell level : 1 user config file : C:\Users\stan.west\.condarc populated config files : conda version : 4.5.0 conda-build version : not installed python version : 3.6.5.final.0 base environment : C:\Users\stan.west\Programs\Miniconda3-64 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/win-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/win-64 https://repo.anaconda.com/pkgs/pro/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Users\stan.west\Programs\Miniconda3-64\pkgs C:\Users\stan.west\AppData\Local\conda\conda\pkgs envs directories : C:\Users\stan.west\Programs\Miniconda3-64\envs C:\Users\stan.west\AppData\Local\conda\conda\envs C:\Users\stan.west\.conda\envs platform : win-64 user-agent : conda/4.5.0 requests/2.18.4 CPython/3.6.5 Windows/10 Windows/10.0.16299 administrator : False 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' --> (There is no output.) </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\stan.west\Programs\Miniconda3-64: # # Name Version Build Channel asn1crypto 0.24.0 py36_0 defaults ca-certificates 2018.03.07 0 defaults certifi 2018.1.18 py36_0 defaults cffi 1.11.5 py36h945400d_0 defaults chardet 3.0.4 py36h420ce6e_1 defaults conda 4.5.0 py36_0 defaults conda-env 2.6.0 h36134e3_1 defaults console_shortcut 0.1.1 h6bb2dd7_3 defaults cryptography 2.2.2 py36hfa6e2cd_0 defaults idna 2.6 py36h148d497_1 defaults menuinst 1.4.11 py36hfa6e2cd_0 defaults openssl 1.0.2o h8ea7d77_0 defaults pip 9.0.3 py36_0 defaults pycosat 0.6.3 py36h413d8a4_0 defaults pycparser 2.18 py36hd053e01_1 defaults pyopenssl 17.5.0 py36h5b7d817_0 defaults pysocks 1.6.8 py36_0 defaults python 3.6.5 h0c2934d_0 defaults pywin32 223 py36hfa6e2cd_0 defaults requests 2.18.4 py36h4371aae_1 defaults ruamel_yaml 0.15.35 py36hfa6e2cd_1 defaults setuptools 39.0.1 py36_0 defaults six 1.11.0 py36h4db2310_1 defaults urllib3 1.22 py36h276f60a_0 defaults vc 14 h0510ff6_3 defaults vs2015_runtime 14.0.25123 3 defaults wheel 0.31.0 py36_0 defaults win_inet_pton 1.0.1 py36he67d7fd_1 defaults wincertstore 0.2 py36h7fe50ca_0 defaults yaml 0.1.7 hc54c509_2 defaults ``` </p></details>
I don't see why you consider this a bug, can you explain? I see it as a bug for a few reasons: * I found the situation puzzling. Conda instructed me to update conda with `conda update -n base conda`, but that command indicated that conda was current. Also, my initial search for conda packages (before I included the conda-forge channel) found no updates: (base) λ conda search "conda>=4.5" Loading channels: done # Name Version Build Channel conda 4.5.0 py27_0 pkgs/main conda 4.5.0 py35_0 pkgs/main conda 4.5.0 py36_0 pkgs/main * If one doesn't intend to add the extra channel to the base environment, the warning is just noise. One could ignore the noise, but see also the next reason. * If the base environment's channels later acquire the newer conda version, I imagine that the warning wouldn't change to indicate that conda can be updated with the base environment's current channels. I was confused by this as well. ``` $ conda update -n base conda Solving environment: done ==> WARNING: A newer version of conda exists. <== current version: 4.5.0 latest version: 4.5.1 Please update conda by running $ conda update -n base conda # All requested packages already installed. ``` I use conda-forge but I pinned conda to the defaults channel: ``` $ cat /opt/conda/.condarc pinned_packages: - defaults::conda channels: - conda-forge - defaults auto_update_conda: false show_channel_urls: true ``` I'd expect the warning to be raised only when a new version is available in the pinned package channel. Definitely something that needs to be fixed. duplicate report: https://github.com/conda/conda/issues/7236 I'm having a similar issue. Right now ``conda update --all`` is running exceptionally slow (as after an hour it still will not complete). My only channels are defaults and conda-forge, but recently I installed a number of packages directly from the r channel. I recall reading that updating through the r channel takes a very long time, if it updates at all. After reading this bug I'm wondering if conda update is running slow because it's checking r, despite it not being on my channel list. Could that be the case? If so--how would I resolve this? Would I need to uninstall all the packages currently associated with r and then reinstall them from a different channel? You don't need to update or add an r channel, it's part of defaults. It's not known to be slow to update things from that channel either. If you pass `-c r` explicitly then that will be slower than using the default channel location (https://repo.continuum.io/pkgs/r) due to differences in how they are served. Ah, for some reason I thought r was not part of defaults. In that case I have no idea why ``conda update --all`` has decided to run so slowly, because as I said, I am not updating directly from the r channel. I may need to create a new issue. @MattJEM not sure if you've figured out why it's updating so slowly, but in my experience using R packages that are in both the R channel and conda-forge causes environment solving to slow greatly or even fail. I ended up having to remove the R channel from defaults and install all my R packages from conda-forge. R on `defaults` is a *lot* faster than R on `conda-forge` (this is true both MRO and non-MRO variants).
2018-05-14T20:47:40
conda/conda
7,310
conda__conda-7310
[ "7309" ]
b1d47c44d384ddb3e4032a3b21ab9c1da3a7e3d2
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 @@ -301,12 +301,11 @@ def configure_parser_info(sub_parsers): help='Display list of channels with tokens exposed.', ) - # TODO: deprecate 'conda info <PACKAGE>' p.add_argument( 'packages', action="store", nargs='*', - help="Display information about packages.", + help=SUPPRESS, ) p.set_defaults(func='.main_info.execute') 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 @@ -96,6 +96,10 @@ def print_package_info(packages): for prec in result: pretty_package(prec) + print("WARNING: 'conda info package_name' is deprecated.\n" + " Use 'conda search package_name --info'.", + file=sys.stderr) + def get_info_dict(system=False): try:
diff --git a/tests/helpers.py b/tests/helpers.py --- a/tests/helpers.py +++ b/tests/helpers.py @@ -62,13 +62,13 @@ def captured(disallow_stderr=True): raise Exception("Got stderr output: %s" % c.stderr) -def capture_json_with_argv(command, **kwargs): - stdout, stderr, exit_code = run_inprocess_conda_command(command) +def capture_json_with_argv(command, disallow_stderr=True, ignore_stderr=False, **kwargs): + stdout, stderr, exit_code = run_inprocess_conda_command(command, disallow_stderr) if kwargs.get('relaxed'): match = re.match('\A.*?({.*})', stdout, re.DOTALL) if match: stdout = match.groups()[0] - elif stderr: + elif stderr and not ignore_stderr: # TODO should be exception return stderr try: @@ -90,10 +90,10 @@ def assert_in(a, b, output=""): assert a.lower() in b.lower(), "%s %r cannot be found in %r" % (output, a.lower(), b.lower()) -def run_inprocess_conda_command(command): +def run_inprocess_conda_command(command, disallow_stderr=True): # anything that uses this function is an integration test reset_context(()) - with argv(split(command)), captured() as c: + with argv(split(command)), captured(disallow_stderr) as c: initialize_logging() try: exit_code = cli.main() diff --git a/tests/test_cli.py b/tests/test_cli.py --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -52,7 +52,8 @@ def test_info(self): for key in keys: assert key in res - res = capture_json_with_argv('conda info conda --json') + res = capture_json_with_argv('conda info conda --json', disallow_stderr=False, + ignore_stderr=True) self.assertIsInstance(res, dict) self.assertIn('conda', res) self.assertIsInstance(res['conda'], list) diff --git a/tests/test_info.py b/tests/test_info.py --- a/tests/test_info.py +++ b/tests/test_info.py @@ -44,7 +44,6 @@ def test_info(): @pytest.mark.integration def test_info_package_json(): out, err, rc = run_command(Commands.INFO, "--json", "numpy=1.11.0=py35_0") - assert err == "" out = json.loads(out) assert set(out.keys()) == {"numpy=1.11.0=py35_0"} @@ -52,7 +51,6 @@ def test_info_package_json(): assert isinstance(out["numpy=1.11.0=py35_0"], list) out, err, rc = run_command(Commands.INFO, "--json", "numpy") - assert err == "" out = json.loads(out) assert set(out.keys()) == {"numpy"}
deprecate 'conda info package_name' Add deprecation warning for `conda info package_name`. Instead, direct users to `conda search package_name --info`, where they can also use `--channel` or a full MatchSpec.
2018-05-19T00:12:36
conda/conda
7,360
conda__conda-7360
[ "7341" ]
5b85f9d52b6bf27d7c58e7a77ae6f60d11b2405b
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 @@ -132,6 +132,7 @@ def __init__(self, fileobj, progress_update_callback): self.progress_file = fileobj self.progress_update_callback = progress_update_callback self.progress_file_size = max(1, fstat(fileobj.fileno()).st_size) + self.progress_max_pos = 0 def __getattr__(self, name): return getattr(self.progress_file, name) @@ -148,7 +149,10 @@ def read(self, size=-1): return data def progress_update(self): - rel_pos = self.progress_file.tell() / self.progress_file_size + pos = max(self.progress_max_pos, self.progress_file.tell()) + pos = min(pos, self.progress_file_size) + self.progress_max_pos = pos + rel_pos = pos / self.progress_file_size self.progress_update_callback(rel_pos)
diff --git a/tests/test_activate.py b/tests/test_activate.py --- a/tests/test_activate.py +++ b/tests/test_activate.py @@ -1089,7 +1089,7 @@ def basic_posix(self, shell): shell.assert_env_var('CONDA_PREFIX', self.prefix, True) shell.sendline('conda install -yq sqlite openssl') # TODO: this should be a relatively light package, but also one that has activate.d or deactivate.d scripts - shell.expect('Executing transaction: ...working... done.*\n', timeout=25) + shell.expect('Executing transaction: ...working... done.*\n', timeout=35) shell.assert_env_var('?', '0', True) # TODO: assert that reactivate worked correctly diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -1187,11 +1187,10 @@ def test_packages_not_found(self): use_exception_handler=True) assert "not-a-real-package" in stderr - @pytest.mark.skipif(on_win, reason="gawk is a windows only package") - def test_search_gawk_not_win_1(self): - with make_temp_env() as prefix: - stdout, stderr = run_command(Commands.SEARCH, prefix, "gawk", "--json", use_exception_handler=True) - json_obj = json_loads(stdout.replace("Fetching package metadata ...", "").strip()) + stdout, stderr = run_command(Commands.SEARCH, prefix, "not-a-real-package", "--json", + use_exception_handler=True) + assert not stderr + json_obj = json_loads(stdout.strip()) assert json_obj['exception_name'] == 'PackagesNotFoundError' assert not len(json_obj.keys()) == 0
ValueError('n (-0.01026341512318607) cannot be negative',) from downloads <!-- 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 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.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, and especially if you are submitting a bug report, **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. --> **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. --> ### 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. --> ``` $conda install theano Solving environment: done ## Package Plan ## environment location: /Users/aaronmeurer/anaconda3 added / updated specs: - theano The following packages will be downloaded: package | build ---------------------------|----------------- pygpu-0.7.6 | py35_0 681 KB conda-forge theano-1.0.2 | py35_0 3.7 MB conda-forge libgpuarray-0.7.6 | 0 195 KB conda-forge ------------------------------------------------------------ Total: 4.6 MB The following NEW packages will be INSTALLED: libgpuarray: 0.7.6-0 conda-forge pygpu: 0.7.6-py35_0 conda-forge theano: 1.0.2-py35_0 conda-forge Downloading and Extracting Packages pygpu-0.7.6 | 681 KB | ######################################################################################## | 75% theano-1.0.2 | 3.7 MB | #######################################################################################8 | 75% libgpuarray-0.7.6 | 195 KB | ########################################################################################9 | 76% ValueError('n (-0.002934394253603312) cannot be negative',) ValueError('n (-0.0005246194491226319) cannot be negative',) ValueError('n (-0.01026341512318607) cannot be negative',) ``` If I then run `conda install theano` again it succeeds without redownloading, so I guess the download actually worked, but it caused conda to fail. I've already seen this twice since updating to conda 4.5.4. ## Expected Behavior <!-- What do you think should happen? --> ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` active environment : None shell level : 0 user config file : /Users/aaronmeurer/.condarc populated config files : /Users/aaronmeurer/.condarc conda version : 4.5.4 conda-build version : 3.8.0 python version : 3.5.4.final.0 base environment : /Users/aaronmeurer/anaconda3 (writable) channel URLs : https://conda.anaconda.org/conda-forge/osx-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/osx-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/osx-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/osx-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/osx-64 https://repo.anaconda.com/pkgs/pro/noarch https://conda.anaconda.org/asmeurer/osx-64 https://conda.anaconda.org/asmeurer/noarch https://conda.anaconda.org/r/osx-64 https://conda.anaconda.org/r/noarch https://conda.anaconda.org/pyne/osx-64 https://conda.anaconda.org/pyne/noarch package cache : /Users/aaronmeurer/anaconda3/pkgs /Users/aaronmeurer/.conda/pkgs envs directories : /Users/aaronmeurer/anaconda3/envs /Users/aaronmeurer/.conda/envs platform : osx-64 user-agent : conda/4.5.4 requests/2.18.1 CPython/3.5.4 Darwin/16.7.0 OSX/10.12.6 UID:GID : 501:20 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' --> ``` ==> /Users/aaronmeurer/.condarc <== use_pip: True show_channel_urls: True channels: - conda-forge - defaults - asmeurer - r - pyne always_yes: True changeps1: False ``` </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 /Users/aaronmeurer/anaconda3: # # Name Version Build Channel _license 1.1 py35_1 defaults _nb_ext_conf 0.4.0 py35_1 defaults alabaster 0.7.10 py35_0 conda-forge anaconda custom py35hd7b5ba2_0 defaults anaconda-client 1.6.3 py35_0 conda-forge anaconda-navigator 1.6.3 py35_0 defaults anaconda-project 0.6.0 py35_0 defaults antlr-python-runtime 4.7.1 py35_0 conda-forge apipkg 1.4 py35_0 conda-forge appdirs 1.4.3 py35_0 conda-forge appnope 0.1.0 py35_0 conda-forge appscript 1.0.1 py35_0 defaults argcomplete 1.8.2 py35_0 conda-forge args 0.1.0 py35_0 conda-forge arrow 0.10.0 py35_0 conda-forge asn1crypto 0.22.0 py35_0 conda-forge aspell 0.60.7.20110707 5 asmeurer aspell-en 7.1.0 0 asmeurer astcheck 0.2.1 py35_0 asmeurer astroid 1.5.3 py35_0 conda-forge astropy 2.0 np112py35_1 conda-forge astsearch 0.1 py35_0 asmeurer asv 0.2 py35_0 conda-forge attrs 17.4.0 py_0 conda-forge autoconf 2.69 2 conda-forge automake 1.15 0 defaults babel 2.4.0 py35_0 defaults backcall 0.1.0 py_0 conda-forge backports 1.0 py35_0 defaults backports.functools_lru_cache 1.5 py35_0 conda-forge backports.shutil_get_terminal_size 1.0.0 py35_1 conda-forge backports.weakref 1.0rc1 py35_1 conda-forge beautifulsoup4 4.6.0 py35_0 defaults bibtexparser 0.6.2 py35_0 conda-forge bitarray 0.8.1 py35_0 defaults bkcharts 0.2 py35_0 conda-forge blas 1.1 openblas conda-forge bleach 1.5.0 py35_0 conda-forge blinker 1.4 py35_0 conda-forge bokeh 0.12.4 py35_0 defaults boost 1.65.1 py35_0 conda-forge boost-cpp 1.65.1 1 conda-forge boto 2.47.0 py35_0 defaults boto3 1.4.4 py35_0 conda-forge botocore 1.5.67 py35_0 defaults bottleneck 1.2.1 np112py35_0 defaults bzip2 1.0.6 1 conda-forge ca-certificates 2018.4.16 0 conda-forge cachetools 2.0.0 py35_0 conda-forge cairo 1.14.10 0 conda-forge catimg 1.1.1 py35_0 conda-forge certifi 2018.4.16 py35_0 conda-forge cffi 1.10.0 py35_0 conda-forge chardet 3.0.4 py35_0 defaults chest 0.2.3 py35_0 conda-forge click 6.7 py35_0 conda-forge clint 0.5.1 py35_0 conda-forge cloog 0.18.0 0 defaults cloud_sptheme 1.9.4 py35_0 conda-forge cloudpickle 0.5.2 py_0 conda-forge clyent 1.2.2 py35_0 defaults cmake 3.9.3 0 conda-forge colorama 0.3.9 py35_0 conda-forge commonmark 0.7.3 py35_0 conda-forge conda 4.5.4 py35_0 conda-forge conda-build 3.8.0 py35_0 conda-forge conda-build-all 1.1.1 py_2 conda-forge conda-env 2.6.0 0 conda-forge conda-manager 0.4.0 py35_0 defaults conda-smithy 2.4.4 py_0 conda-forge conda-verify 2.0.0 py35_0 conda-forge configobj 5.0.6 py35_0 defaults contextlib2 0.5.5 py35_0 conda-forge control 0.7.0 <pip> coverage 4.4.1 py35_0 conda-forge cryptography 1.9 py35_0 conda-forge curl 7.52.1 0 conda-forge cycler 0.10.0 py35_0 conda-forge cyordereddict 1.0.0 py35_1 conda-forge cython 0.25.2 py35_1 conda-forge cytoolz 0.8.2 py35_0 conda-forge dask 0.15.1 py35_0 conda-forge datashader 0.4.0 py35_0 defaults datashape 0.5.4 py35_0 defaults dbus 1.10.10 3 conda-forge decorator 4.0.11 py35_0 conda-forge dill 0.2.6 py35_0 conda-forge distributed 1.18.0 py35_0 conda-forge docopt 0.6.2 py35_0 conda-forge docrepr 0.1.0 <pip> doct 1.0.2 py35_0 conda-forge doctr 1.7.0 py35_0 conda-forge docutils 0.13.1 py35_0 conda-forge doge 3.5.0 py35_0 asmeurer doit 0.29.0 py35_0 asmeurer doxygen 1.8.13 1 conda-forge dynd-python 0.7.2 py35_0 defaults emacs 25.3 2 conda-forge entrypoints 0.2.3 py35_1 conda-forge epc 0.0.5 py35_0 asmeurer et_xmlfile 1.0.1 py35_0 conda-forge execnet 1.4.1 py35_0 conda-forge expat 2.2.1 0 conda-forge fastcache 1.0.2 py35_0 conda-forge ffmpeg 3.2.4 1 conda-forge fftw 3.3.7 0 conda-forge filelock 2.0.7 py35_0 defaults flake8 3.5.0 py35_0 conda-forge flake8-import-order 0.12 py35_0 conda-forge flask 0.12.2 py35_0 defaults flask-cors 3.0.2 py35_0 conda-forge fontconfig 2.12.6 0 conda-forge fortune 9708 0 asmeurer freetype 2.8.1 0 conda-forge future 0.16.0 py35_0 conda-forge gcc 4.8.5 8 defaults get_terminal_size 1.0.0 py35_0 defaults gettext 0.19.8.1 0 conda-forge gevent 1.2.2 py35_0 defaults ghostscript 9.22 0 conda-forge giflib 5.1.4 0 conda-forge gitdb 0.6.4 py35_1 conda-forge gitdb2 2.0.0 py35_0 defaults github3.py 1.0.0a4 py35_0 conda-forge gitpython 2.1.3 py35_0 defaults glib 2.55.0 0 conda-forge glob2 0.5 py35_0 conda-forge gmp 6.1.2 0 conda-forge gmpy2 2.0.8 py35_1 conda-forge graphite2 1.3.11 0 conda-forge graphviz 2.38.0 7 conda-forge greenlet 0.4.12 py35_0 conda-forge h5netcdf 0.3.1 py35_0 conda-forge h5py 2.7.1 py35_2 conda-forge harfbuzz 1.7.6 0 conda-forge hdf4 4.2.12 0 conda-forge hdf5 1.10.1 1 conda-forge heapdict 1.0.0 py35_0 conda-forge html5lib 0.9999999 py35_0 conda-forge httplib2 0.10.3 py35_0 conda-forge hunspell 1.6.2 0 conda-forge hunspell-en 2017.09.01 0 conda-forge husl 4.0.3 py35_0 asmeurer icu 58.1 1 conda-forge idna 2.5 py35_0 conda-forge imageio 2.2.0 py35_0 conda-forge imagemagick 7.0.7 pl5.22.2.1_2 conda-forge imagesize 0.7.1 py35_0 conda-forge imgurpython 1.1.7 py35_0 conda-forge ipykernel 4.6.1 py35_0 conda-forge ipython 6.3.1 py35_0 conda-forge ipython-notebook 4.0.4 py35_0 defaults ipython_genutils 0.2.0 py35_0 conda-forge ipywidgets 6.0.0 py35_0 conda-forge isl 0.12.2 1 defaults isort 4.2.15 py35_0 defaults iterm2-tools 2.3 py35_0 conda-forge itsdangerous 0.24 py35_1 conda-forge jbig 2.1 0 defaults jdcal 1.3 py35_0 conda-forge jedi 0.12.0 py35_0 conda-forge jinja2 2.9.6 py35_0 defaults jmespath 0.9.3 py35_0 conda-forge jpeg 9b 0 conda-forge jsoncpp 0.10.6 1 conda-forge jsonschema 2.6.0 py35_0 defaults jupyter 1.0.0 py35_0 conda-forge jupyter-emacskeys 0.2.3 <pip> jupyter_client 5.1.0 py35_0 conda-forge jupyter_console 5.1.0 py35_0 conda-forge jupyter_core 4.3.0 py35_0 conda-forge jupyterlab 0.25.2 py35_0 conda-forge jupyterlab_launcher 0.3.1 py35_0 conda-forge kiwisolver 1.0.1 py35_1 conda-forge latexcodec 1.0.4 py35_0 conda-forge lazy-object-proxy 1.3.1 py35_0 defaults lazyasd 0.1.3 py35_0 conda-forge libarchive 3.2.1 2 conda-forge libdynd 0.7.2 0 defaults libevent 2.0.22 0 conda-forge libffi 3.2.1 3 conda-forge libgcc 4.8.5 1 defaults libgfortran 3.0.0 0 conda-forge libgpuarray 0.7.6 0 conda-forge libiconv 1.15 0 conda-forge libnetcdf 4.5.0 3 conda-forge libpng 1.6.34 0 conda-forge libsodium 1.0.10 0 conda-forge libtiff 4.0.9 0 conda-forge libuuid 1.0.3 1 conda-forge libuv 1.11.0 0 conda-forge libwebp 0.5.2 7 conda-forge libxcb 1.13 0 conda-forge libxml2 2.9.4 4 conda-forge libxslt 1.1.29 5 conda-forge livereload 2.5.1 py35_0 conda-forge llvm 3.3 0 defaults llvmlite 0.20.0 py35_0 defaults locket 0.2.0 py35_1 conda-forge logbook 0.11.2 py35_0 asmeurer lxml 3.8.0 py35_0 conda-forge m4 1.4.17 1 conda-forge macfsevents 0.4 py35_0 asmeurer mako 1.0.6 py35_0 conda-forge markdown 2.6.8 py35_0 defaults markdown-checklist 0.4.1 py35_0 conda-forge markupsafe 1.0 py35_0 conda-forge mathjax 2.2 py35_0 defaults matplotlib 2.1.2 py35_0 conda-forge mccabe 0.6.1 py35_0 conda-forge metis 5.1.0 3 conda-forge mistune 0.7.4 py35_0 conda-forge mkdocs 0.16.3 py35_0 conda-forge mkdocs-bootstrap 0.1.1 py35_0 conda-forge mkdocs-bootswatch 0.4.0 py35_0 conda-forge mkl 2017.0.3 0 defaults moab 4.9.1 3 conda-forge mock 2.0.0 py35_0 conda-forge mongodb 3.3.9 0 defaults mpc 1.0.3 4 conda-forge mpfr 3.1.5 0 conda-forge mpich 3.2 4 conda-forge mpmath 1.0.0 py_0 conda-forge msgpack-python 0.4.8 py35_0 conda-forge multipledispatch 0.4.9 py35_0 conda-forge natsort 5.0.3 py35_0 defaults nb_anacondacloud 1.4.0 py35_0 conda-forge nb_conda 2.2.0 py35_0 conda-forge nb_conda_kernels 2.1.0 py35_0 conda-forge nbconvert 5.2.1 py35_1 conda-forge nbformat 4.3.0 py35_0 conda-forge nbpresent 3.0.2 py35_1 conda-forge ncurses 5.9 10 conda-forge netcdf4 1.3.1 py35_2 conda-forge networkx 1.11 py35_0 conda-forge nltk 3.2.4 py35_0 conda-forge nodejs 6.11.0 0 conda-forge nose 1.3.7 py35_2 conda-forge notebook 5.0.0 py35_0 conda-forge numba 0.35.0 np112py35_0 defaults numexpr 2.6.2 np112py35_0 conda-forge numpy 1.12.1 py35_blas_openblas_201 [blas_openblas] conda-forge numpydoc 0.7.0 py35_0 conda-forge oauthlib 2.0.2 py35_0 conda-forge odo 0.5.0 py35_1 defaults olefile 0.44 py35_0 conda-forge openblas 0.2.20 6 conda-forge openjpeg 2.3.0 2 conda-forge openpyxl 2.5.0a1 py35_0 conda-forge openssl 1.0.2o 0 conda-forge oset 0.1.3 py35_0 conda-forge packaging 16.8 py35_0 conda-forge pandas 0.21.0 py35_0 conda-forge pandoc 1.19.2.1 0 defaults pandocfilters 1.4.1 py35_0 conda-forge pango 1.40.14 0 conda-forge parso 0.2.0 py_0 conda-forge partd 0.3.8 py35_0 conda-forge path.py 10.3.1 py35_0 defaults pathlib2 2.3.0 py35_0 conda-forge patsy 0.4.1 py35_0 conda-forge pbr 3.1.1 py35_0 conda-forge pcre 8.41 1 conda-forge pep257 0.7.0 py35_0 conda-forge pep8 1.7.0 py35_0 conda-forge pep8-naming 0.4.1 py35_0 conda-forge perl 5.22.2.1 0 conda-forge pexpect 4.2.1 py35_0 conda-forge pickleshare 0.7.4 py35_0 defaults pillow 5.0.0 py35_0 conda-forge pip 9.0.1 py35_0 conda-forge pixman 0.34.0 1 conda-forge pkg-config 0.29.1 1 conda-forge pkginfo 1.4.1 py35_0 defaults pluggy 0.6.0 py_0 conda-forge ply 3.10 py35_0 conda-forge prefsync 1.2 py35_0 conda-forge prettytable 0.7.2 py35_1 conda-forge prompt_toolkit 1.0.14 py35_0 conda-forge proselint 0.6.0 <pip> protobuf 3.3.2 py35_0 conda-forge psutil 5.2.2 py35_0 defaults ptyprocess 0.5.2 py35_0 conda-forge pudb 2017.1.4 py35_0 conda-forge py 1.5.2 py_0 conda-forge pyasn1 0.2.3 py35_0 conda-forge pybtex 0.21 py35_0 conda-forge pybtex-docutils 0.2.1 py35_0 conda-forge pycodestyle 2.3.1 py35_0 conda-forge pycosat 0.6.3 py35_0 conda-forge pycparser 2.18 py35_0 conda-forge pycrypto 2.6.1 py35_1 conda-forge pycurl 7.43.0 py35_2 defaults pyflakes 1.6.0 py35_0 conda-forge pygithub 1.34 py35_0 conda-forge pyglet 1.2.4 py35_0 conda-forge pygments 2.2.0 py35_0 conda-forge pygpu 0.7.6 py35_0 conda-forge pyinstrument 0.13.2 py35_0 conda-forge pyjwt 1.5.2 py35_0 conda-forge pylint 1.7.1 py35_0 conda-forge pymarkovchain 1.7.5 py35_0 asmeurer pymongo 3.3.0 py35_0 defaults pyne 0.5.10 py35_blas_openblas_0 [blas_openblas] conda-forge pyopenssl 17.0.0 py35_0 defaults pyparsing 2.2.0 py35_0 conda-forge pyphen 0.9.4 py35_0 conda-forge pyqt 5.6.0 py35_4 conda-forge pyrss2gen 1.1 py35_0 asmeurer pytables 3.4.2 py35_7 conda-forge pytest 3.4.0 py35_0 conda-forge pytest-cache 1.0 py35_0 conda-forge pytest-cov 2.5.1 py35_0 conda-forge pytest-flakes 1.0.1 py35_0 conda-forge pytest-mock 1.6.0 py35_0 conda-forge python 3.5.4 0 conda-forge python-dateutil 2.6.0 py35_0 conda-forge python-markdown-math 0.3 py35_0 conda-forge python-symengine 0.2.0 py35_1 conda-forge python.app 1.2 py35_4 defaults pytools 2017.3 py35_0 conda-forge pytz 2017.2 py35_0 conda-forge pywavelets 0.5.2 np112py35_0 conda-forge pyyaml 3.12 py35_1 conda-forge pyzmq 16.0.2 py35_2 conda-forge qt 5.6.2 h9e3eb04_4 conda-forge qtawesome 0.4.4 py35_0 conda-forge qtconsole 4.3.0 py35_0 conda-forge qtpy 1.2.1 py35_0 conda-forge readline 6.2 0 conda-forge redis 3.2.0 0 defaults redis-py 2.10.5 py35_0 conda-forge regolith 0.1 <pip> regolith 0.1.5 py35_0 conda-forge requests 2.18.1 py35_0 conda-forge requests-oauthlib 0.8.0 py35_1 conda-forge requests-toolbelt 0.8.0 py35_0 conda-forge rever 0.1.0 py35_0 conda-forge rhash 1.3.4 0 conda-forge rl 2.4 py35_1 asmeurer rope 0.10.5 py35_0 conda-forge ruamel.yaml 0.15.35 py35_0 conda-forge ruamel_yaml 0.11.14 py35_0 conda-forge s3fs 0.1.1 py35_0 conda-forge s3transfer 0.1.10 py35_1 conda-forge scikit-image 0.13.0 np112py35_0 conda-forge scikit-learn 0.19.1 py35_blas_openblas_201 [blas_openblas] conda-forge scikit-umfpack 0.2.3 py35_blas_openblas_202 [blas_openblas] conda-forge scipy 1.0.0 py35_blas_openblas_201 [blas_openblas] conda-forge seaborn 0.8.0 py35_0 conda-forge setproctitle 1.1.10 py35_0 conda-forge setuptools 39.2.0 py35_0 conda-forge sexpdata 0.0.3 py35_0 asmeurer simplegeneric 0.8.1 py35_0 conda-forge singledispatch 3.4.0.3 py35_0 conda-forge sip 4.18 py35_1 conda-forge six 1.10.0 py35_1 conda-forge smmap 2.0.1 py35_0 conda-forge smmap2 2.0.1 py35_0 defaults snowballstemmer 1.2.1 py35_0 conda-forge sockjs-tornado 1.0.3 py35_0 defaults sortedcontainers 1.5.7 py35_0 defaults sphinx 1.7.0 py35_0 conda-forge sphinx-argparse 0.2.1 py35_1 conda-forge sphinx-bootstrap-theme 0.4.9 py35_0 conda-forge sphinx-issues 0.2.0 py35_0 conda-forge sphinx_rtd_theme 0.2.4 py35_0 conda-forge sphinxcontrib-autoprogram 0.1.3 py35_0 conda-forge sphinxcontrib-bibtex 0.3.6 py35_0 conda-forge sphinxcontrib-websupport 1.0.1 py35_0 conda-forge sphinxjp.themecore 0.2.0 py35_1 conda-forge spoofmac 2.0.6 py35_0 asmeurer spyder 3.1.4 py35_0 conda-forge sqlalchemy 1.1.11 py35_0 conda-forge sqlite 3.13.0 1 conda-forge statprof 0.1.2 py35_2 asmeurer statsmodels 0.8.0 np112py35_0 conda-forge strategies 0.2.3 <pip> suitesparse 4.5.4 blas_openblas_201 [blas_openblas] conda-forge symengine 0.2.0 1 conda-forge sympy 1.1.1 py35_0 conda-forge tbb 2018_20170726 0 conda-forge tblib 1.3.2 py35_0 conda-forge tensorflow 1.3.0 py35_0 conda-forge terminado 0.6 py35_0 conda-forge testdisk 7.0 0 asmeurer testpath 0.3.1 py35_0 defaults theano 1.0.2 py35_0 conda-forge tk 8.5.19 1 conda-forge toolz 0.8.2 py35_0 conda-forge tornado 4.5.1 py35_0 conda-forge tox 2.9.1 py_0 conda-forge traitlets 4.3.2 py35_0 conda-forge twine 1.8.1 py35_1 conda-forge twitter 1.17.1 py35_0 asmeurer twitterapi 2.3.4 py35_0 asmeurer typing 3.6.1 py35_0 conda-forge unicodecsv 0.14.1 py35_0 defaults unidecode 0.04.21 py35_0 conda-forge uritemplate.py 3.0.2 py35_0 conda-forge urllib3 1.21.1 py35_0 conda-forge urwid 1.3.1 py35_0 conda-forge versioneer 0.18 py35_0 conda-forge virtualenv 15.1.0 py35_0 conda-forge wcwidth 0.1.7 py35_0 conda-forge webassets 0.12.1 py35_0 conda-forge webencodings 0.5 py35_0 conda-forge werkzeug 0.12.2 py35_0 conda-forge wget 1.18 0 defaults wheel 0.29.0 py35_0 conda-forge widgetsnbextension 2.0.0 py35_0 conda-forge wrapt 1.10.10 py35_0 defaults x264 20131217 3 conda-forge xarray 0.9.6 py35_0 conda-forge xlrd 1.0.0 py35_1 conda-forge xlsxwriter 0.9.6 py35_0 conda-forge xlwings 0.10.4 py35_0 defaults xlwt 1.2.0 py35_0 defaults xo 0.1.14 py35_0 conda-forge xonda 0.1.6 <pip> xonsh 0.6.1 py35_0 conda-forge xorg-kbproto 1.0.7 1 conda-forge xorg-libice 1.0.9 2 conda-forge xorg-libsm 1.2.2 2 conda-forge xorg-libx11 1.6.5 0 conda-forge xorg-libxau 1.0.8 3 conda-forge xorg-libxdmcp 1.1.2 3 conda-forge xorg-libxext 1.3.3 2 conda-forge xorg-libxrender 0.9.10 0 conda-forge xorg-libxt 1.1.5 0 conda-forge xorg-renderproto 0.11.1 1 conda-forge xorg-xextproto 7.3.0 1 conda-forge xorg-xproto 7.0.31 6 conda-forge xz 5.2.2 0 conda-forge yaml 0.1.6 0 conda-forge yapsy 1.11.223 py35_0 asmeurer z3 4.4.0 py35_0 asmeurer zeromq 4.2.1 1 conda-forge zict 0.1.2 py35_0 conda-forge zlib 1.2.11 0 conda-forge ``` </p></details>
Weird. Can you reproduce with a `-vv` flag and get a full stack trace? Sent from my iPhone > On May 25, 2018, at 8:30 PM, Aaron Meurer <[email protected]> wrote: > > I'm submitting a... > > bug report > feature request > Current Behavior > > Steps to Reproduce > > $conda install theano > Solving environment: done > > ## Package Plan ## > > environment location: /Users/aaronmeurer/anaconda3 > > added / updated specs: > - theano > > > The following packages will be downloaded: > > package | build > ---------------------------|----------------- > pygpu-0.7.6 | py35_0 681 KB conda-forge > theano-1.0.2 | py35_0 3.7 MB conda-forge > libgpuarray-0.7.6 | 0 195 KB conda-forge > ------------------------------------------------------------ > Total: 4.6 MB > > The following NEW packages will be INSTALLED: > > libgpuarray: 0.7.6-0 conda-forge > pygpu: 0.7.6-py35_0 conda-forge > theano: 1.0.2-py35_0 conda-forge > > > Downloading and Extracting Packages > pygpu-0.7.6 | 681 KB | ######################################################################################## | 75% > theano-1.0.2 | 3.7 MB | #######################################################################################8 | 75% > libgpuarray-0.7.6 | 195 KB | ########################################################################################9 | 76% > > ValueError('n (-0.002934394253603312) cannot be negative',) > ValueError('n (-0.0005246194491226319) cannot be negative',) > ValueError('n (-0.01026341512318607) cannot be negative',) > > If I then run conda install theano again it succeeds without redownloading, so I guess the download actually worked, but it caused conda to fail. I've already seen this twice since updating to conda 4.5.4. > > Expected Behavior > > Environment Information > > `conda info` > > active environment : None > shell level : 0 > user config file : /Users/aaronmeurer/.condarc > populated config files : /Users/aaronmeurer/.condarc > conda version : 4.5.4 > conda-build version : 3.8.0 > python version : 3.5.4.final.0 > base environment : /Users/aaronmeurer/anaconda3 (writable) > channel URLs : https://conda.anaconda.org/conda-forge/osx-64 > https://conda.anaconda.org/conda-forge/noarch > https://repo.anaconda.com/pkgs/main/osx-64 > https://repo.anaconda.com/pkgs/main/noarch > https://repo.anaconda.com/pkgs/free/osx-64 > https://repo.anaconda.com/pkgs/free/noarch > https://repo.anaconda.com/pkgs/r/osx-64 > https://repo.anaconda.com/pkgs/r/noarch > https://repo.anaconda.com/pkgs/pro/osx-64 > https://repo.anaconda.com/pkgs/pro/noarch > https://conda.anaconda.org/asmeurer/osx-64 > https://conda.anaconda.org/asmeurer/noarch > https://conda.anaconda.org/r/osx-64 > https://conda.anaconda.org/r/noarch > https://conda.anaconda.org/pyne/osx-64 > https://conda.anaconda.org/pyne/noarch > package cache : /Users/aaronmeurer/anaconda3/pkgs > /Users/aaronmeurer/.conda/pkgs > envs directories : /Users/aaronmeurer/anaconda3/envs > /Users/aaronmeurer/.conda/envs > platform : osx-64 > user-agent : conda/4.5.4 requests/2.18.1 CPython/3.5.4 Darwin/16.7.0 OSX/10.12.6 > UID:GID : 501:20 > netrc file : None > offline mode : False > `conda config --show-sources` > ==> /Users/aaronmeurer/.condarc <== > use_pip: True > show_channel_urls: True > channels: > - conda-forge > - defaults > - asmeurer > - r > - pyne > always_yes: True > changeps1: False > `conda list --show-channel-urls` > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub, or mute the thread. It doesn't happen every time, but I'll run conda with that flag until it happens again. Usually a single `-v` will give you full stack traces when they end up being hidden like that. It’ll be less annoying. I just got this same weird error whilst trying to install numpy using conda: ```bash $ conda install numpy -c conda-forge Solving environment: done ## Package Plan ## environment location: /Users/linwood/anaconda3/envs/test2 added / updated specs: - numpy The following packages will be downloaded: package | build ---------------------------|----------------- numpy-1.14.3 |py27_blas_openblas_200 3.9 MB conda-forge openblas-0.2.20 | 8 20.1 MB conda-forge ------------------------------------------------------------ Total: 24.0 MB The following NEW packages will be INSTALLED: blas: 1.1-openblas conda-forge libgfortran: 3.0.0-0 conda-forge numpy: 1.14.3-py27_blas_openblas_200 conda-forge [blas_openblas] openblas: 0.2.20-8 conda-forge Downloading and Extracting Packages numpy-1.14.3 | 3.9 MB | ############################################################### | 75% openblas-0.2.20 | 20.1 MB | ############################################################### | 75% ValueError('n (-0.0004725617597608478) cannot be negative',) ValueError('n (-9.100623748214964e-05) cannot be negative',) ``` ## My environment info ```bash $ conda info active environment : test2 active env location : /Users/linwood/anaconda3/envs/test2 shell level : 1 user config file : /Users/linwood/.condarc populated config files : /Users/linwood/.condarc conda version : 4.5.4 conda-build version : 2.0.2 python version : 3.5.2.final.0 base environment : /Users/linwood/anaconda3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/osx-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/osx-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/osx-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/osx-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /Users/linwood/anaconda3/pkgs /Users/linwood/.conda/pkgs envs directories : /Users/linwood/anaconda3/envs /Users/linwood/.conda/envs platform : osx-64 user-agent : conda/4.5.4 requests/2.14.2 CPython/3.5.2 Darwin/17.5.0 OSX/10.13.4 UID:GID : 501:20 netrc file : /Users/linwood/.netrc offline mode : False ``` The output when using `-v` tag: ```bash $ conda info active environment : test2 active env location : /Users/linwood/anaconda3/envs/test2 shell level : 1 user config file : /Users/linwood/.condarc populated config files : /Users/linwood/.condarc conda version : 4.5.4 conda-build version : 2.0.2 python version : 3.5.2.final.0 base environment : /Users/linwood/anaconda3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/osx-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/osx-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/osx-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/osx-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /Users/linwood/anaconda3/pkgs /Users/linwood/.conda/pkgs envs directories : /Users/linwood/anaconda3/envs /Users/linwood/.conda/envs platform : osx-64 user-agent : conda/4.5.4 requests/2.14.2 CPython/3.5.2 Darwin/17.5.0 OSX/10.13.4 UID:GID : 501:20 netrc file : /Users/linwood/.netrc offline mode : False linwood at Linwoods-MacBook-Pro in ~/PyICU-2.0.3/dist on master* $ conda install numpy -c conda-forge -v Solving environment: ...working... done ## Package Plan ## environment location: /Users/linwood/anaconda3/envs/test2 added / updated specs: - numpy The following NEW packages will be INSTALLED: blas: 1.1-openblas conda-forge libgfortran: 3.0.0-0 conda-forge numpy: 1.14.3-py27_blas_openblas_200 conda-forge [blas_openblas] openblas: 0.2.20-8 conda-forge Preparing transaction: ...working... done Verifying transaction: ...working... (ClobberError: The package 'conda-forge::libgfortran-3.0.0-0' cannot be installed due to a path collision for 'lib/libgcc_s.1.dylib'. This path already exists in the target prefix, and it won't be removed by an uninstall action in this transaction. The path appears to be coming from the package 'defaults::gcc-4.8.5-8', which is already installed in the prefix. , ClobberError: The package 'conda-forge::libgfortran-3.0.0-0' cannot be installed due to a path collision for 'lib/libgcc_s_ppc64.1.dylib'. This path already exists in the target prefix, and it won't be removed by an uninstall action in this transaction. The path appears to be coming from the package 'defaults::gcc-4.8.5-8', which is already installed in the prefix. , ClobberError: The package 'conda-forge::libgfortran-3.0.0-0' cannot be installed due to a path collision for 'lib/libgcc_s_x86_64.1.dylib'. This path already exists in the target prefix, and it won't be removed by an uninstall action in this transaction. The path appears to be coming from the package 'defaults::gcc-4.8.5-8', which is already installed in the prefix. , ClobberError: The package 'conda-forge::libgfortran-3.0.0-0' cannot be installed due to a path collision for 'lib/libgfortran.3.dylib'. This path already exists in the target prefix, and it won't be removed by an uninstall action in this transaction. The path appears to be coming from the package 'defaults::gcc-4.8.5-8', which is already installed in the prefix. , ClobberError: The package 'conda-forge::libgfortran-3.0.0-0' cannot be installed due to a path collision for 'lib/libgfortran.dylib'. This path already exists in the target prefix, and it won't be removed by an uninstall action in this transaction. The path appears to be coming from the package 'defaults::gcc-4.8.5-8', which is already installed in the prefix. , ClobberError: The package 'conda-forge::libgfortran-3.0.0-0' cannot be installed due to a path collision for 'lib/libquadmath.0.dylib'. This path already exists in the target prefix, and it won't be removed by an uninstall action in this transaction. The path appears to be coming from the package 'defaults::gcc-4.8.5-8', which is already installed in the prefix. , ClobberError: The package 'conda-forge::libgfortran-3.0.0-0' cannot be installed due to a path collision for 'lib/libquadmath.dylib'. This path already exists in the target prefix, and it won't be removed by an uninstall action in this transaction. The path appears to be coming from the package 'defaults::gcc-4.8.5-8', which is already installed in the prefix. ) done Executing transaction: ...working... ===> LINKING PACKAGE: conda-forge::libgfortran-3.0.0-0 <=== prefix=/Users/linwood/anaconda3/envs/test2 source=/Users/linwood/anaconda3/pkgs/libgfortran-3.0.0-0 file exists, but clobbering: '/Users/linwood/anaconda3/envs/test2/lib/libgcc_s.1.dylib' file exists, but clobbering: '/Users/linwood/anaconda3/envs/test2/lib/libgcc_s_ppc64.1.dylib' file exists, but clobbering: '/Users/linwood/anaconda3/envs/test2/lib/libgcc_s_x86_64.1.dylib' file exists, but clobbering: '/Users/linwood/anaconda3/envs/test2/lib/libgfortran.3.dylib' file exists, but clobbering: '/Users/linwood/anaconda3/envs/test2/lib/libgfortran.dylib' file exists, but clobbering: '/Users/linwood/anaconda3/envs/test2/lib/libquadmath.0.dylib' file exists, but clobbering: '/Users/linwood/anaconda3/envs/test2/lib/libquadmath.dylib' ===> LINKING PACKAGE: conda-forge::openblas-0.2.20-8 <=== prefix=/Users/linwood/anaconda3/envs/test2 source=/Users/linwood/anaconda3/pkgs/openblas-0.2.20-8 ===> LINKING PACKAGE: conda-forge::blas-1.1-openblas <=== prefix=/Users/linwood/anaconda3/envs/test2 source=/Users/linwood/anaconda3/pkgs/blas-1.1-openblas ===> LINKING PACKAGE: conda-forge::numpy-1.14.3-py27_blas_openblas_200 <=== prefix=/Users/linwood/anaconda3/envs/test2 source=/Users/linwood/anaconda3/pkgs/numpy-1.14.3-py27_blas_openblas_200 done ``` **Edit** I fixed this by uninstalling `numpy` and reinstalling. I've gotten this same issue trying to reinstall jupyter. Seems to happen every time for me. EDIT: Nope, bug went away on a third try. @elliottmcollins can you run the install command with the `-v` flag and post the output here? Sorry, spoke too soon. Worked on the third try. It's happening for me too when I'm installing RDKit on Docker. It not happens always. I am getting this issue when building a docker image. If I run the image after Conda failure and run the commands manually on the container command line then after some attempts with the same failures, I can install the packages. But I can not get it to run from the docker build script no matter how many times I try. Downloading and Extracting Packages Preparing transaction: ...working... done Verifying transaction: ...working... done Executing transaction: ...working... done Solving environment: ...working... done ca-certificates-2018 | 124 KB | #######5 | 75% html5lib-0.999 | 175 KB | #######5 | 75% libgcc-ng-7.2.0 | 6.1 MB | #######5 | 75% certifi-2018.4.16 | 143 KB | #######5 | 75% openssl-1.0.2o | 3.4 MB | #######5 | 75% ValueError('n (-0.0010031313433305211) cannot be negative',) ValueError('n (-0.0007116504149898839) cannot be negative',) ValueError('n (-1.9964299135644126e-05) cannot be negative',) ValueError('n (-0.000872492866087704) cannot be negative',) ValueError('n (-3.531112563559535e-05) cannot be negative',) Same here, but different packages: ``` $ conda create -n zzz1 -c numba numba icc_rt Solving environment: done ## Package Plan ## environment location: <path>/anaconda3/envs/zzz1 added / updated specs: - icc_rt - numba The following packages will be downloaded: package | build ---------------------------|----------------- certifi-2018.4.16 | py36_0 142 KB numba-0.39.0dev0 |np114py36hf484d3e_54 2.4 MB numba ------------------------------------------------------------ Total: 2.5 MB The following NEW packages will be INSTALLED: blas: 1.0-mkl ca-certificates: 2018.03.07-0 certifi: 2018.4.16-py36_0 icc_rt: 2018.0.2-0 numba intel-openmp: 2018.0.0-8 libedit: 3.1.20170329-h6b74fdf_2 libffi: 3.2.1-hd88cf55_4 libgcc-ng: 7.2.0-hdf63c60_3 libgfortran-ng: 7.2.0-hdf63c60_3 libstdcxx-ng: 7.2.0-hdf63c60_3 llvmlite: 0.23.0-py36hf484d3e_13 numba mkl: 2018.0.2-1 mkl_fft: 1.0.1-py36h3010b51_0 mkl_random: 1.0.1-py36h629b387_0 ncurses: 6.1-hf484d3e_0 numba: 0.39.0dev0-np114py36hf484d3e_54 numba numpy: 1.14.3-py36hcd700cb_1 numpy-base: 1.14.3-py36h9be14a7_1 openssl: 1.0.2o-h20670df_0 pip: 10.0.1-py36_0 python: 3.6.5-hc3d631a_2 readline: 7.0-ha6073c6_4 setuptools: 39.1.0-py36_0 sqlite: 3.23.1-he433501_0 tk: 8.6.7-hc745277_3 wheel: 0.31.1-py36_0 xz: 5.2.4-h14c3975_4 zlib: 1.2.11-ha838bed_2 Proceed ([y]/n)? y Downloading and Extracting Packages certifi-2018.4.16 | 142 KB | ##################################################################4 | 76% numba-0.39.0dev0 | 2.4 MB | #################################################################3 | 75% ValueError('n (-0.014063948895834066) cannot be negative',) ValueError('n (-0.0008155726375479455) cannot be negative',) ``` consistently reproduced until the `certifi-2018.4.16` downloaded. Deleting that and retrying with `-vv` refused to reproduce: ``` for i in `seq 1 20`; do rm -rf <path>/anaconda3/pkgs/certifi-2018.4.16-py36_0*; rm -rf <path>/anaconda3/pkgs/numba-0.39.0dev0-np114py36hf484d3e_54*; conda create -vv -n zzz_tmp -c numba numba icc_rt -y; conda-rm zzz_tmp -y; done 2>&1 |tee conda_log.txt ``` but without `-vv` it did intermittently. That `ValueError('n (...) cannot be negative',)` is emitted by `tqdm`, i.e., the library used for the progress output. With `-vv` no progress bars are output, hence you didn't encounter the error there. I couldn't reproduce, but the most likely thing is that I introduced that bug with https://github.com/conda/conda/pull/7275. I think that error being thrown essentially means that a `fileobj.tell()` (with `fileobj` being an `io.BufferedReader` created by `open(..., 'rb')`) can return negative values!? That's a really strange thing... I'll submit a PR that constrains the values we use to ```python 0 <= v <= max(1, fstat(fileobj.fileno()).st_size) ``` @mbargull ah, thanks. That makes sense.
2018-05-31T17:14:31
conda/conda
7,377
conda__conda-7377
[ "7375" ]
2235faefef09d5c0ed0d975da894a6d7a9ddd3b0
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 @@ -687,7 +687,7 @@ def configure_parser_install(sub_parsers): Conda attempts to install the newest versions of the requested packages. To accomplish this, it may update some packages that are already installed, or install additional packages. To prevent existing packages from updating, - use the --no-update-deps option. This may force conda to install older + use the --freeze-installed option. This may force conda to install older versions of the requested packages, and it does not prevent additional dependency packages from being installed. 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 @@ -12,7 +12,7 @@ from .. import CondaError from .._vendor.auxlib.entity import EntityEncoder -from ..base.constants import PathConflict, SafetyChecks +from ..base.constants import PathConflict, SafetyChecks, DepsModifier, UpdateModifier from ..base.context import context, sys_rc_path, user_rc_path from ..common.compat import isiterable, iteritems, itervalues, string_types from ..common.configuration import pretty_list, pretty_map @@ -349,6 +349,8 @@ def enum_representer(dumper, data): yaml.representer.RoundTripRepresenter.add_representer(SafetyChecks, enum_representer) yaml.representer.RoundTripRepresenter.add_representer(PathConflict, enum_representer) + yaml.representer.RoundTripRepresenter.add_representer(DepsModifier, enum_representer) + yaml.representer.RoundTripRepresenter.add_representer(UpdateModifier, enum_representer) try: with open(rc_path, 'w') as rc:
Pin all packages in a conda environment without listing them all <!-- 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 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.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, and especially if you are submitting a bug report, **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. --> **I'm submitting a...** - [ ] bug report - [X] feature request ## Current Behavior <!-- What actually happens? If you want to include console output, please use "Steps to Reproduce" below. --> According to the [docs](https://conda.io/docs/user-guide/tasks/manage-pkgs.html#preventing-packages-from-updating-pinning) it is possible to pin a list of packages in a conda environment by adding a file named `pinned` to the `conda-meta` directory with a list of the packages that you do not want updated. ### 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. --> ``` N/A ``` ## Expected Behavior <!-- What do you think should happen? --> Is it possible to pin all packages in a conda environment without explicitly mentioning all of them? i.e. just use a keyword like `all` in the `pinned` file inside the `conda-meta` directory.
There's a `--freeze-installed` flag. It's for sure there in the master branch, and might also be available in the latest 4.5 (I don't remember). Does that cover your use case? If it's not available in conda 4.5, you can get conda 4.6.0a2 from the `conda-canary` channel to try it out. Is `--freze-installed` equivalent to `--no-update-deps`? https://github.com/conda/conda/blob/master/conda/cli/conda_argparse.py#L1377 Just to add to my previous comments: * `--no-update-deps` (and presumably `--freeze-installed`) helps when you are installing new packages into an existing environment. However, you need to use `--no-update-deps` every time that you want to install new packages. * regarding my use case: once the environment has been created or updated, I would like to have the option of running a command after which all the dependencies are frozen and you don't have to use `--no-update-deps` every time you want to install a new package into that environment. I guess that's what you currently achieve with the `pinned` file inside the `conda-meta` directory. However, that's only suitable when you only want to pin a small number of packages. For environments where you have a large number of packages and you want to pin them all, it is a bit of a problem.
2018-06-04T23:16:20
conda/conda
7,385
conda__conda-7385
[ "5681", "5681" ]
4489fe6f710d8ecfcc5c7d25aa137cf96f249cc9
diff --git a/conda_env/specs/__init__.py b/conda_env/specs/__init__.py --- a/conda_env/specs/__init__.py +++ b/conda_env/specs/__init__.py @@ -1,11 +1,15 @@ # -*- coding: utf-8 -*- # Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause + +import os + from .binstar import BinstarSpec -from .yaml_file import YamlFileSpec from .notebook import NotebookSpec from .requirements import RequirementsSpec -from ..exceptions import SpecNotFound +from .yaml_file import YamlFileSpec +from ..exceptions import EnvironmentFileNotFound, SpecNotFound + all_specs = [ BinstarSpec, @@ -16,6 +20,12 @@ def detect(**kwargs): + # Check file existence if --file was provided + filename = kwargs.get('filename') + if filename and not os.path.isfile(filename): + raise EnvironmentFileNotFound(filename=filename) + + # Check specifications specs = [] for SpecClass in all_specs: spec = SpecClass(**kwargs)
diff --git a/tests/conda_env/test_cli.py b/tests/conda_env/test_cli.py --- a/tests/conda_env/test_cli.py +++ b/tests/conda_env/test_cli.py @@ -16,7 +16,7 @@ from conda.exceptions import EnvironmentLocationNotFound from conda.install import rm_rf from conda_env.cli.main import create_parser, do_call as do_call_conda_env -from conda_env.exceptions import SpecNotFound +from conda_env.exceptions import EnvironmentFileNotFound from conda_env.yaml import load as yaml_load environment_1 = ''' @@ -40,10 +40,12 @@ test_env_name_2 = "snowflakes" test_env_name_3 = "env_foo" + def escape_for_winpath(p): if p: return p.replace('\\', '\\\\') + class Commands: ENV_CREATE = "create" ENV_REMOVE = "remove" @@ -54,6 +56,7 @@ class Commands: INFO = "info" INSTALL = "install" + def run_env_command(command, prefix, *arguments): """ Run conda env commands @@ -149,7 +152,17 @@ def test_conda_env_create_no_file(self): try: run_env_command(Commands.ENV_CREATE, None) except Exception as e: - self.assertIsInstance(e, SpecNotFound) + self.assertIsInstance(e, EnvironmentFileNotFound) + + def test_conda_env_create_no_existent_file(self): + ''' + Test `conda env create --file=not_a_file.txt` with a file that does not + exist. + ''' + try: + run_env_command(Commands.ENV_CREATE, None, '--file not_a_file.txt') + except Exception as e: + self.assertIsInstance(e, EnvironmentFileNotFound) def test_create_valid_env(self): ''' @@ -164,8 +177,7 @@ def test_create_valid_env(self): o, e = run_conda_command(Commands.INFO, None, "--json") parsed = json.loads(o) self.assertNotEqual( - len([env for env in parsed['envs'] if env.endswith(test_env_name_1)]), - 0 + len([env for env in parsed['envs'] if env.endswith(test_env_name_1)]), 0 ) def test_update(self): @@ -185,7 +197,7 @@ def test_name(self): try: run_env_command(Commands.ENV_CREATE, test_env_name_1, "create") except Exception as e: - self.assertIsInstance(e, SpecNotFound, str(e)) + self.assertIsInstance(e, EnvironmentFileNotFound, str(e)) def env_is_created(env_name): @@ -321,5 +333,6 @@ def test_export_muti_channel(self): check2, e = run_conda_command(Commands.LIST, test_env_name_2, "--explicit") self.assertEqual(check1, check2) + if __name__ == '__main__': unittest.main()
conda env create gives confusing message if environment file does not exist Try executing `conda env create -f does_not_exist.txt`. The output I get is: ``` Using Anaconda API: https://api.anaconda.org SpecNotFound: Can't process without a name ``` That is not super useful or meaningful. I'd suggest it should say something obvious, like: ``` File not found: does_not_exist.txt ``` conda env create gives confusing message if environment file does not exist Try executing `conda env create -f does_not_exist.txt`. The output I get is: ``` Using Anaconda API: https://api.anaconda.org SpecNotFound: Can't process without a name ``` That is not super useful or meaningful. I'd suggest it should say something obvious, like: ``` File not found: does_not_exist.txt ```
Related: https://github.com/conda/conda/issues/5621 From https://github.com/conda/conda/issues/5621#issue-240019026 > IIUC, the function [build_message()](https://github.com/conda/conda/blob/master/conda_env/specs/__init__.py#L26-L31) gives precedence to binstar spec and over others, which is why this happens. Related: https://github.com/conda/conda/issues/5621 From https://github.com/conda/conda/issues/5621#issue-240019026 > IIUC, the function [build_message()](https://github.com/conda/conda/blob/master/conda_env/specs/__init__.py#L26-L31) gives precedence to binstar spec and over others, which is why this happens.
2018-06-05T19:28:51
conda/conda
7,386
conda__conda-7386
[ "7362", "7362" ]
4489fe6f710d8ecfcc5c7d25aa137cf96f249cc9
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 @@ -288,7 +288,7 @@ def configure_parser_info(sub_parsers): p.add_argument( '-l', "--license", action="store_true", - help="Display information about the local conda licenses list.", + help=SUPPRESS, ) p.add_argument( '-s', "--system", diff --git a/conda/cli/main_info.py b/conda/cli/main_info.py --- a/conda/cli/main_info.py +++ b/conda/cli/main_info.py @@ -11,7 +11,6 @@ from os.path import exists, expanduser, isfile, join import re import sys -from textwrap import dedent from .common import print_envs_list, stdout_json from .. import CONDA_PACKAGE_ROOT, __version__ as conda_version @@ -296,7 +295,7 @@ def execute(args, parser): print(json.dumps({"channels": context.channels})) return 0 - options = 'envs', 'system', 'license' + options = 'envs', 'system' if args.all or context.json: for option in options: @@ -334,17 +333,5 @@ def execute(args, parser): print("%s: %s" % (name, value)) print() - if args.license and not context.json: - try: - from _license import show_info - show_info() # pragma: no cover - except ImportError: - print(dedent(""" - WARNING: could not import _license.show_info - # try: - # $ conda install -n root _license""")) - except Exception as e: # pragma: no cover - log.warn('%r', e) - if context.json: stdout_json(info_dict)
Outdated error information regarding license package when running conda info <!-- 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 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.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, and especially if you are submitting a bug report, **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. --> **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. --> ### 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. --> `conda info -a` shows the following at the end: ``` WARNING: could not import _license.show_info # try: # $ conda install -n root _license ``` ## Expected Behavior <!-- What do you think should happen? --> `root` has been renamed to `base` so it should say `conda install -n base _license`. Outdated error information regarding license package when running conda info <!-- 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 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.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, and especially if you are submitting a bug report, **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. --> **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. --> ### 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. --> `conda info -a` shows the following at the end: ``` WARNING: could not import _license.show_info # try: # $ conda install -n root _license ``` ## Expected Behavior <!-- What do you think should happen? --> `root` has been renamed to `base` so it should say `conda install -n base _license`.
We need to remove this `_license` stuff altogether. It no longer applies after Anaconda 5.0 and the `pkgs/main` channel. We need to remove this `_license` stuff altogether. It no longer applies after Anaconda 5.0 and the `pkgs/main` channel.
2018-06-05T20:50:55
conda/conda
7,415
conda__conda-7415
[ "7423", "7423" ]
ad5e49e222cf876301f6e884c5d7bdba333d06b1
diff --git a/conda/core/subdir_data.py b/conda/core/subdir_data.py --- a/conda/core/subdir_data.py +++ b/conda/core/subdir_data.py @@ -26,7 +26,7 @@ from ..common.io import ThreadLimitedThreadPoolExecutor, as_completed from ..common.url import join_url, maybe_unquote from ..core.package_cache_data import PackageCacheData -from ..exceptions import CondaDependencyError, CondaHTTPError, NotWritableError +from ..exceptions import CondaDependencyError, CondaHTTPError, CondaUpgradeError, NotWritableError from ..gateways.connection import (ConnectionError, HTTPError, InsecureRequestWarning, InvalidSchema, SSLError) from ..gateways.connection.session import CondaSession @@ -51,7 +51,8 @@ log = getLogger(__name__) stderrlog = getLogger('conda.stderrlog') -REPODATA_PICKLE_VERSION = 18 +REPODATA_PICKLE_VERSION = 19 +MAX_REPODATA_VERSION = 1 REPODATA_HEADER_RE = b'"(_etag|_mod|_cache_control)":[ ]?"(.*?[^\\\\])"[,\}\s]' @@ -146,6 +147,16 @@ def cache_path_pickle(self): def load(self): _internal_state = self._load() + if _internal_state["repodata_version"] > MAX_REPODATA_VERSION: + raise CondaUpgradeError(dals(""" + The current version of conda is too old to read repodata from + + %s + + (This version only supports repodata_version 1.) + Please update conda to use this channel. + """) % self.url_w_subdir) + self._internal_state = _internal_state self._package_records = _internal_state['_package_records'] self._package_dists = _internal_state['_package_dists'] # only needed as an optimization for conda-build # NOQA @@ -333,7 +344,17 @@ def _process_raw_repodata_str(self, raw_repodata_str): '_add_pip': add_pip, '_pickle_version': REPODATA_PICKLE_VERSION, '_schannel': schannel, + 'repodata_version': json_obj.get('repodata_version', 0), } + if _internal_state["repodata_version"] > MAX_REPODATA_VERSION: + raise CondaUpgradeError(dals(""" + The current version of conda is too old to read repodata from + + %s + + (This version only supports repodata_version 1.) + Please update conda to use this channel. + """) % self.url_w_subdir) meta_in_common = { # just need to make this once, then apply with .update() 'arch': json_obj.get('info', {}).get('arch'), 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 @@ -145,12 +145,14 @@ def _paths(): return None else: with open(path, 'r') as f: - package_metadata = PackageMetadata(**json.loads(f.read())) - if package_metadata.package_metadata_version != 1: + data = json.loads(f.read()) + if data.get('package_metadata_version') != 1: raise CondaUpgradeError(dals(""" The current version of conda is too old to install this package. (This version only supports link.json schema version 1.) Please update conda to install - this package.""")) + this package. + """)) + package_metadata = PackageMetadata(**data) return package_metadata
Add upgrade error message for unsupported repodata_version Going back to the 4.3.x branch, add an exception that gets raised if a field `repodata_version` exists with a value that's greater than 1. Add upgrade error message for unsupported repodata_version Going back to the 4.3.x branch, add an exception that gets raised if a field `repodata_version` exists with a value that's greater than 1.
2018-06-14T00:22:49
conda/conda
7,418
conda__conda-7418
[ "6691", "6691" ]
ad5e49e222cf876301f6e884c5d7bdba333d06b1
diff --git a/conda/history.py b/conda/history.py --- a/conda/history.py +++ b/conda/history.py @@ -72,6 +72,9 @@ def pretty_content(content): class History(object): + com_pat = re.compile(r'#\s*cmd:\s*(.+)') + spec_pat = re.compile(r'#\s*(\w+)\s*specs:\s*(.+)?') + def __init__(self, prefix): self.prefix = prefix self.meta_dir = join(prefix, 'conda-meta') @@ -133,6 +136,69 @@ def parse(self): res[-1][1].add(line) return res + @staticmethod + def _parse_old_format_specs_string(specs_string): + """ + Parse specifications string that use conda<4.5 syntax. + + Examples + -------- + - "param >=1.5.1,<2.0'" + - "python>=3.5.1,jupyter >=1.0.0,<2.0,matplotlib >=1.5.1,<2.0" + """ + specs = [] + for spec in specs_string.split(','): + # See https://github.com/conda/conda/issues/6691 + if spec[0].isalpha(): + # A valid spec starts with a letter since it is a package name + specs.append(spec) + else: + # Otherwise it is a condition and has to be appended to the + # last valid spec on the specs list + specs[-1] = ','.join([specs[-1], spec]) + + return specs + + @classmethod + def _parse_comment_line(cls, line): + """ + Parse comment lines in the history file. + + These lines can be of command type or action type. + + Examples + -------- + - "# cmd: /scratch/mc3/bin/conda install -c conda-forge param>=1.5.1,<2.0" + - "# install specs: python>=3.5.1,jupyter >=1.0.0,<2.0,matplotlib >=1.5.1,<2.0" + """ + item = {} + m = cls.com_pat.match(line) + if m: + argv = m.group(1).split() + if argv[0].endswith('conda'): + argv[0] = 'conda' + item['cmd'] = argv + + m = cls.spec_pat.match(line) + if m: + action, specs_string = m.groups() + specs_string = specs_string or "" + item['action'] = action + + if specs_string.startswith('['): + specs = literal_eval(specs_string) + elif '[' not in specs_string: + specs = History._parse_old_format_specs_string(specs_string) + + specs = [spec for spec in specs if spec and not spec.endswith('@')] + + if specs and action in ('update', 'install', 'create'): + item['update_specs'] = item['specs'] = specs + elif specs and action in ('remove', 'uninstall'): + item['remove_specs'] = item['specs'] = specs + + return item + def get_user_requests(self): """ return a list of user requested items. Each item is a dict with the @@ -143,37 +209,19 @@ def get_user_requests(self): 'specs': the specs being used """ res = [] - com_pat = re.compile(r'#\s*cmd:\s*(.+)') - spec_pat = re.compile(r'#\s*(\w+)\s*specs:\s*(.+)?') for dt, unused_cont, comments in self.parse(): item = {'date': dt} for line in comments: - m = com_pat.match(line) - if m: - argv = m.group(1).split() - if argv[0].endswith('conda'): - argv[0] = 'conda' - item['cmd'] = argv - m = spec_pat.match(line) - if m: - action, specs = m.groups() - item['action'] = action - specs = specs or "" - if specs.startswith('['): - specs = literal_eval(specs) - elif '[' not in specs: - specs = specs.split(',') - specs = [spec for spec in specs if spec and not spec.endswith('@')] - if specs and action in ('update', 'install', 'create'): - item['update_specs'] = item['specs'] = specs - elif specs and action in ('remove', 'uninstall'): - item['remove_specs'] = item['specs'] = specs + comment_items = self._parse_comment_line(line) + item.update(comment_items) if 'cmd' in item: res.append(item) + dists = groupby(itemgetter(0), unused_cont) item['unlink_dists'] = dists.get('-', ()) item['link_dists'] = dists.get('+', ()) + return res def get_requested_specs_map(self):
diff --git a/tests/test_history.py b/tests/test_history.py --- a/tests/test_history.py +++ b/tests/test_history.py @@ -6,6 +6,7 @@ from .test_create import make_temp_prefix from conda import history +from conda.resolve import MatchSpec class HistoryTestCase(unittest.TestCase): @@ -79,3 +80,33 @@ def test_last(self): 'unlink_dists': (), 'link_dists': ['+pyflakes-1.0.0-py27_0'], }) + + def test_conda_comment_version_parsin(self): + test_cases = [ + "# conda version: 4.5.1", + "# conda version: 4.5.1rc1", + "# conda version: 4.5.1dev0", + ] + for line in test_cases: + item = history.History._parse_comment_line(line) + assert not item + + def test_action_command_comment_parsing(self): + test_cases = [ + # New format (>=4.5) + "# update specs: [\"param[version='>=1.5.1,<2.0']\"]", + # Old format (<4.5) + '# install specs: param >=1.5.1,<2.0', + '# install specs: python>=3.5.1,jupyter >=1.0.0,<2.0,matplotlib >=1.5.1,<2.0,numpy >=1.11.0,<2.0,pandas >=0.19.2,<1.0,psycopg2 >=2.6.1,<3.0,pyyaml >=3.12,<4.0,scipy >=0.17.0,<1.0', + ] + for line in test_cases: + item = history.History._parse_comment_line(line) + specs = item.get('specs') + for spec in specs: + try: + MatchSpec(spec) + except Exception as e: + print('Specs item:', item) + print('Specs:', specs) + print('Invalid Spec:', spec) + raise Exception(e)
Upgrading from conda 4.3 to 4.4 with certain dependency specifications in conda's history can lead to a broken conda Conda updated itself from 4.3 to 4.4. Since then, my conda installation appears to be broken. I now get the following for many conda operations (e.g. `conda update conda`, `conda install numpy`, etc): ``` Solving environment: failed CondaValueError: Invalid MatchSpec: <2.0 ``` More info... ``` $ conda --version conda 4.4.7 $ conda install -vvv numpy DEBUG conda.gateways.logging:set_verbosity(148): verbosity set to 3 Solving environment: ...working... DEBUG conda.core.solve:solve_final_state(140): solving prefix /scratch/mc3 specs_to_remove: frozenset() specs_to_add: frozenset({MatchSpec(name=LowerStrMatch('numpy'))}) prune: False TRACE conda.core.linked_data:_load_single_record(113): loading prefix record /scratch/mc3/conda-meta/appnope-0.1.0-py36hf537a9a_0.json TRACE conda.core.linked_data:_load_single_record(113): loading prefix record /scratch/mc3/conda-meta/asn1crypto-0.23.0-py36h782d450_0.json TRACE conda.core.linked_data:_load_single_record(113): loading prefix record /scratch/mc3/conda-meta/bleach-2.1.1-py36h27c13d8_0.json [...] TRACE conda.core.linked_data:_load_single_record(113): loading prefix record /scratch/mc3/conda-meta/zeromq-4.2.2-ha360ad0_2.json TRACE conda.core.linked_data:_load_single_record(113): loading prefix record /scratch/mc3/conda-meta/zlib-1.2.11-hf3cbc9b_2.json failed Traceback (most recent call last): File "/scratch/mc3/lib/python3.6/site-packages/conda/exceptions.py", line 743, in __call__ return func(*args, **kwargs) File "/scratch/mc3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/scratch/mc3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "/scratch/mc3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/scratch/mc3/lib/python3.6/site-packages/conda/cli/install.py", line 236, in install force_reinstall=context.force, File "/scratch/mc3/lib/python3.6/site-packages/conda/core/solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "/scratch/mc3/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 "/scratch/mc3/lib/python3.6/site-packages/conda/core/solve.py", line 146, in solve_final_state specs_from_history_map = History(self.prefix).get_requested_specs_map() File "/scratch/mc3/lib/python3.6/site-packages/conda/history.py", line 187, in get_requested_specs_map spec_map.update(((s.name, s) for s in update_specs)) File "/scratch/mc3/lib/python3.6/site-packages/conda/history.py", line 187, in <genexpr> spec_map.update(((s.name, s) for s in update_specs)) File "/scratch/mc3/lib/python3.6/site-packages/conda/history.py", line 186, in <genexpr> update_specs = (MatchSpec(spec) for spec in request.get('update_specs', ())) File "/scratch/mc3/lib/python3.6/site-packages/conda/models/match_spec.py", line 39, in __call__ parsed = _parse_spec_str(spec_arg) File "/scratch/mc3/lib/python3.6/site-packages/conda/models/match_spec.py", line 556, in _parse_spec_str raise CondaValueError("Invalid MatchSpec: %s" % spec_str) conda.exceptions.CondaValueError: Invalid MatchSpec: <2.0 ``` Upgrading from conda 4.3 to 4.4 with certain dependency specifications in conda's history can lead to a broken conda Conda updated itself from 4.3 to 4.4. Since then, my conda installation appears to be broken. I now get the following for many conda operations (e.g. `conda update conda`, `conda install numpy`, etc): ``` Solving environment: failed CondaValueError: Invalid MatchSpec: <2.0 ``` More info... ``` $ conda --version conda 4.4.7 $ conda install -vvv numpy DEBUG conda.gateways.logging:set_verbosity(148): verbosity set to 3 Solving environment: ...working... DEBUG conda.core.solve:solve_final_state(140): solving prefix /scratch/mc3 specs_to_remove: frozenset() specs_to_add: frozenset({MatchSpec(name=LowerStrMatch('numpy'))}) prune: False TRACE conda.core.linked_data:_load_single_record(113): loading prefix record /scratch/mc3/conda-meta/appnope-0.1.0-py36hf537a9a_0.json TRACE conda.core.linked_data:_load_single_record(113): loading prefix record /scratch/mc3/conda-meta/asn1crypto-0.23.0-py36h782d450_0.json TRACE conda.core.linked_data:_load_single_record(113): loading prefix record /scratch/mc3/conda-meta/bleach-2.1.1-py36h27c13d8_0.json [...] TRACE conda.core.linked_data:_load_single_record(113): loading prefix record /scratch/mc3/conda-meta/zeromq-4.2.2-ha360ad0_2.json TRACE conda.core.linked_data:_load_single_record(113): loading prefix record /scratch/mc3/conda-meta/zlib-1.2.11-hf3cbc9b_2.json failed Traceback (most recent call last): File "/scratch/mc3/lib/python3.6/site-packages/conda/exceptions.py", line 743, in __call__ return func(*args, **kwargs) File "/scratch/mc3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/scratch/mc3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 76, in do_call exit_code = getattr(module, func_name)(args, parser) File "/scratch/mc3/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute install(args, parser, 'install') File "/scratch/mc3/lib/python3.6/site-packages/conda/cli/install.py", line 236, in install force_reinstall=context.force, File "/scratch/mc3/lib/python3.6/site-packages/conda/core/solve.py", line 504, in solve_for_transaction force_remove, force_reinstall) File "/scratch/mc3/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 "/scratch/mc3/lib/python3.6/site-packages/conda/core/solve.py", line 146, in solve_final_state specs_from_history_map = History(self.prefix).get_requested_specs_map() File "/scratch/mc3/lib/python3.6/site-packages/conda/history.py", line 187, in get_requested_specs_map spec_map.update(((s.name, s) for s in update_specs)) File "/scratch/mc3/lib/python3.6/site-packages/conda/history.py", line 187, in <genexpr> spec_map.update(((s.name, s) for s in update_specs)) File "/scratch/mc3/lib/python3.6/site-packages/conda/history.py", line 186, in <genexpr> update_specs = (MatchSpec(spec) for spec in request.get('update_specs', ())) File "/scratch/mc3/lib/python3.6/site-packages/conda/models/match_spec.py", line 39, in __call__ parsed = _parse_spec_str(spec_arg) File "/scratch/mc3/lib/python3.6/site-packages/conda/models/match_spec.py", line 556, in _parse_spec_str raise CondaValueError("Invalid MatchSpec: %s" % spec_str) conda.exceptions.CondaValueError: Invalid MatchSpec: <2.0 ```
Can you either attach here or email to me (kfranz at anaconda com) the file /scratch/mc3/conda-meta/history @nehaljwani figured out the problem, and the fix to get me up and running again was very easy. When I'd previously installed a dependency using an awkward specification, conda 4.3 wrote an entry to conda-meta/history that causes conda 4.4 to fail. The following command ``` $ which conda /scratch/mc3/bin/conda $ conda --version conda 4.3.31 $ conda install -c conda-forge "param>=1.5.1,<2.0" ``` results in the following entry in /scratch/mc3/conda-meta/history: ``` # cmd: /scratch/mc3/bin/conda install -c conda-forge param>=1.5.1,<2.0 [...] # install specs: param >=1.5.1,<2.0 ``` That entry causes no problems for conda 4.3. However, after updating to conda 4.4, there's a problem: ``` $ conda --version conda 4.4.7 $ conda install numpy Solving environment: failed CondaValueError: Invalid MatchSpec: <2.0 ``` Fortunately, removing the `install specs` line in /scratch/mc3/conda-meta/history makes the problem go away. Conda 4.4 writes the history information differently (quoting the matchspec). The following command: ``` $ conda --version conda 4.4.7 $ conda install -c conda-forge "param>=1.5.1,<2.0" ``` appears in /scratch/mc3/conda-meta/history as: ``` # cmd: /scratch/mc3/bin/conda install -c conda-forge param>=1.5.1,<2.0 [...] # update specs: ["param[version='>=1.5.1,<2.0']"] ``` I think this is a bug that we should try to write a test for and solve. Ah, I meant to write an issue for this one some time ago but didn't -- and didn't see this one! Reproducers: ---- ```bash export CONDA_ALWAYS_YES=1 source bin/activate conda --version cconda() { # run conda commands with concise output echo echo '>'conda "${@}" conda "$1" -q "${@:2}" |\ sed -n '/INSTALLED\|UPDATED\|DOWNGRADED\|REMOVED/,${/ done$/ba;H;:a};${x;p}' } cconda create -nz fontconfig source activate z cconda remove fontconfig freetype cd envs cat z/conda-meta/history mv z z-base mkdir z test-case() { printf '%99s\n' | tr ' ' = mkdir z-top z-work sudo mount -t overlay overlay -o lowerdir=z-base,upperdir=z-top,workdir=z-work z if [[ $# -ne 0 ]] ; then "${@}" sed -n '/^==>/{h;d};H;${x;p}' z/conda-meta/history fi cconda install --dry-run 'zlib<1.2.11' sudo umount z sudo rm -r z-top z-work } test-case test-case cconda install fontconfig test-case cconda install -f libpng libxml2 test-case cconda install -f libxml2 test-case cconda install -f libpng test-case cconda remove libpng test-case cconda remove libxml2 rmdir z mv z-base z source deactivate cconda remove -nz --all ) ``` <details><summary>output:</summary><p> ``` conda 4.4.7 >conda create -nz fontconfig The following NEW packages will be INSTALLED: fontconfig: 2.12.4-h88586e7_1 freetype: 2.8-hab7d2ae_1 icu: 58.2-h9c2bf20_1 libgcc-ng: 7.2.0-h7cc24e2_2 libpng: 1.6.34-hb9fc6fc_0 libstdcxx-ng: 7.2.0-h7a57d05_2 libxml2: 2.9.4-h2e8b1d7_6 xz: 5.2.3-h55aa19d_2 zlib: 1.2.11-ha838bed_2 >conda remove fontconfig freetype The following packages will be REMOVED: fontconfig: 2.12.4-h88586e7_1 freetype: 2.8-hab7d2ae_1 ==> 2018-01-24 16:01:04 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda create -q -nz fontconfig +defaults::fontconfig-2.12.4-h88586e7_1 +defaults::freetype-2.8-hab7d2ae_1 +defaults::icu-58.2-h9c2bf20_1 +defaults::libgcc-ng-7.2.0-h7cc24e2_2 +defaults::libpng-1.6.34-hb9fc6fc_0 +defaults::libstdcxx-ng-7.2.0-h7a57d05_2 +defaults::libxml2-2.9.4-h2e8b1d7_6 +defaults::xz-5.2.3-h55aa19d_2 +defaults::zlib-1.2.11-ha838bed_2 # update specs: ['fontconfig'] ==> 2018-01-24 16:01:07 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda remove -q fontconfig freetype -defaults::fontconfig-2.12.4-h88586e7_1 -defaults::freetype-2.8-hab7d2ae_1 # remove specs: ['freetype', 'fontconfig'] =================================================================================================== >conda install --dry-run zlib<1.2.11 UnsatisfiableError: The following specifications were found to be in conflict: - libxml2 -> zlib[version='>=1.2.11,<1.3.0a0'] - zlib[version='<1.2.11'] Use "conda info <package>" to see the dependencies for each package. =================================================================================================== >conda install fontconfig The following NEW packages will be INSTALLED: fontconfig: 2.12.4-h88586e7_1 freetype: 2.8-hab7d2ae_1 ==> 2018-01-24 16:01:13 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda install -q fontconfig +defaults::fontconfig-2.12.4-h88586e7_1 +defaults::freetype-2.8-hab7d2ae_1 # update specs: ['fontconfig'] >conda install --dry-run zlib<1.2.11 The following NEW packages will be INSTALLED: libiconv: 1.15-h63c8f33_5 The following packages will be DOWNGRADED: fontconfig: 2.12.4-h88586e7_1 --> 2.11.1-6 freetype: 2.8-hab7d2ae_1 --> 2.5.5-2 libpng: 1.6.34-hb9fc6fc_0 --> 1.6.30-1 libxml2: 2.9.4-h2e8b1d7_6 --> 2.9.4-0 zlib: 1.2.11-ha838bed_2 --> 1.2.8-3 =================================================================================================== >conda install -f libpng libxml2 The following packages will be UPDATED: libpng: 1.6.34-hb9fc6fc_0 --> 1.6.34-hb9fc6fc_0 libxml2: 2.9.4-h2e8b1d7_6 --> 2.9.4-h2e8b1d7_6 ==> 2018-01-24 16:01:22 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda install -q -f libpng libxml2 # update specs: ['libpng', 'libxml2'] >conda install --dry-run zlib<1.2.11 The following NEW packages will be INSTALLED: libiconv: 1.15-h63c8f33_5 The following packages will be DOWNGRADED: libpng: 1.6.34-hb9fc6fc_0 --> 1.6.30-1 libxml2: 2.9.4-h2e8b1d7_6 --> 2.9.4-0 zlib: 1.2.11-ha838bed_2 --> 1.2.8-3 =================================================================================================== >conda install -f libxml2 The following packages will be UPDATED: libxml2: 2.9.4-h2e8b1d7_6 --> 2.9.4-h2e8b1d7_6 ==> 2018-01-24 16:01:28 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda install -q -f libxml2 # update specs: ['libxml2'] >conda install --dry-run zlib<1.2.11 The following NEW packages will be INSTALLED: libiconv: 1.15-h63c8f33_5 The following packages will be REMOVED: libpng: 1.6.34-hb9fc6fc_0 The following packages will be DOWNGRADED: libxml2: 2.9.4-h2e8b1d7_6 --> 2.9.4-0 zlib: 1.2.11-ha838bed_2 --> 1.2.8-3 =================================================================================================== >conda install -f libpng The following packages will be UPDATED: libpng: 1.6.34-hb9fc6fc_0 --> 1.6.34-hb9fc6fc_0 ==> 2018-01-24 16:01:34 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda install -q -f libpng # update specs: ['libpng'] >conda install --dry-run zlib<1.2.11 The following packages will be REMOVED: libxml2: 2.9.4-h2e8b1d7_6 The following packages will be DOWNGRADED: libpng: 1.6.34-hb9fc6fc_0 --> 1.6.30-1 zlib: 1.2.11-ha838bed_2 --> 1.2.8-3 =================================================================================================== >conda remove libpng The following packages will be REMOVED: libpng: 1.6.34-hb9fc6fc_0 ==> 2018-01-24 16:01:40 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda remove -q libpng -defaults::libpng-1.6.34-hb9fc6fc_0 # remove specs: ['libpng'] >conda install --dry-run zlib<1.2.11 The following packages will be REMOVED: libxml2: 2.9.4-h2e8b1d7_6 The following packages will be DOWNGRADED: zlib: 1.2.11-ha838bed_2 --> 1.2.8-3 =================================================================================================== >conda remove libxml2 The following packages will be REMOVED: libxml2: 2.9.4-h2e8b1d7_6 ==> 2018-01-24 16:01:46 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda remove -q libxml2 -defaults::libxml2-2.9.4-h2e8b1d7_6 # remove specs: ['libxml2'] >conda install --dry-run zlib<1.2.11 The following packages will be REMOVED: libpng: 1.6.34-hb9fc6fc_0 The following packages will be DOWNGRADED: zlib: 1.2.11-ha838bed_2 --> 1.2.8-3 >conda remove -nz --all Remove all packages in environment /home/maba/code/conda/conda-4.4/envs/z: ``` </p></details> [EDIT: fixed copy-pasta error] ---- ```bash _TMPDIR=$(mktemp -d) ; ( set -x show-latest-history() { sed -n '/^==>/{h;d};H;${x;p}' conda-meta/history ; } try-dry-run-install() { conda install -q --dry-run 'zlib<1.2.11' ; } export CONDA_ALWAYS_YES=1 export CONDA_AUTO_UPDATE_CONDA=0 export CONDA__AGGRESSIVE_UPDATE_PACKAGES=none cd $_TMPDIR bash ~/code/conda/Anaconda3-5.0.1-Linux-x86_64.sh -bfp . >/dev/null source bin/activate 2>/dev/null alias conda=bin/conda # use conda directly <- less clutter with "set -x" conda update -q conda cat conda-meta/history try-dry-run-install CONDA_PINNED_PACKAGES=anaconda=custom conda install -qf anaconda show-latest-history try-dry-run-install conda remove -q anaconda show-latest-history try-dry-run-install conda install -q anaconda=custom show-latest-history try-dry-run-install ) ; rm -r $_TMPDIR ``` <details><summary>output:</summary><p> ``` + export CONDA_ALWAYS_YES=1 + CONDA_ALWAYS_YES=1 + export CONDA_AUTO_UPDATE_CONDA=0 + CONDA_AUTO_UPDATE_CONDA=0 + export CONDA__AGGRESSIVE_UPDATE_PACKAGES=none + CONDA__AGGRESSIVE_UPDATE_PACKAGES=none + cd /tmp/tmp.q7Mg5Cd6hm + bash /home/maba/code/conda/Anaconda3-5.0.1-Linux-x86_64.sh -bfp . Python 3.6.3 :: Anaconda, Inc. + source bin/activate + alias conda=bin/conda + conda update -q conda Package plan for installation in environment /tmp/tmp.q7Mg5Cd6hm: The following packages will be UPDATED: anaconda: 5.0.1-py36hd30a520_1 --> custom-py36hbbc8b67_0 conda: 4.3.30-py36h5d9f9f4_0 --> 4.4.7-py36_0 pycosat: 0.6.2-py36h1a0ea17_1 --> 0.6.3-py36h0a5515d_0 + cat conda-meta/history ==> 2018-01-24 16:03:01 <== # cmd: /tmp/tmp.q7Mg5Cd6hm/bin/conda update -q conda +defaults::_ipyw_jlab_nb_ext_conf-0.1.0-py36he11e457_0 +defaults::alabaster-0.7.10-py36h306e16b_0 +defaults::anaconda-5.0.1-py36hd30a520_1 +defaults::anaconda-client-1.6.5-py36h19c0dcd_0 +defaults::anaconda-navigator-1.6.9-py36h11ddaaa_0 +defaults::anaconda-project-0.8.0-py36h29abdf5_0 +defaults::asn1crypto-0.22.0-py36h265ca7c_1 +defaults::astroid-1.5.3-py36hbdb9df2_0 +defaults::astropy-2.0.2-py36ha51211e_4 +defaults::babel-2.5.0-py36h7d14adf_0 +defaults::backports-1.0-py36hfa02d7e_1 +defaults::backports.shutil_get_terminal_size-1.0.0-py36hfea85ff_2 +defaults::beautifulsoup4-4.6.0-py36h49b8c8c_1 +defaults::bitarray-0.8.1-py36h5834eb8_0 +defaults::bkcharts-0.2-py36h735825a_0 +defaults::blaze-0.11.3-py36h4e06776_0 +defaults::bleach-2.0.0-py36h688b259_0 +defaults::bokeh-0.12.10-py36hbb0e44a_0 +defaults::boto-2.48.0-py36h6e4cd66_1 +defaults::bottleneck-1.2.1-py36haac1ea0_0 +defaults::bzip2-1.0.6-h0376d23_1 +defaults::ca-certificates-2017.08.26-h1d4fec5_0 +defaults::cairo-1.14.10-haa5651f_5 +defaults::certifi-2017.7.27.1-py36h8b7b77e_0 +defaults::cffi-1.10.0-py36had8d393_1 +defaults::chardet-3.0.4-py36h0f667ec_1 +defaults::click-6.7-py36h5253387_0 +defaults::cloudpickle-0.4.0-py36h30f8c20_0 +defaults::clyent-1.2.2-py36h7e57e65_1 +defaults::colorama-0.3.9-py36h489cec4_0 +defaults::conda-4.3.30-py36h5d9f9f4_0 +defaults::conda-build-3.0.27-py36h940a66d_0 +defaults::conda-env-2.6.0-h36134e3_1 +defaults::conda-verify-2.0.0-py36h98955d8_0 +defaults::contextlib2-0.5.5-py36h6c84a62_0 +defaults::cryptography-2.0.3-py36ha225213_1 +defaults::curl-7.55.1-hcb0b314_2 +defaults::cycler-0.10.0-py36h93f1223_0 +defaults::cython-0.26.1-py36h21c49d0_0 +defaults::cytoolz-0.8.2-py36h708bfd4_0 +defaults::dask-0.15.3-py36hdc2c8aa_0 +defaults::dask-core-0.15.3-py36h10e6167_0 +defaults::datashape-0.5.4-py36h3ad6b5c_0 +defaults::dbus-1.10.22-h3b5a359_0 +defaults::decorator-4.1.2-py36hd076ac8_0 +defaults::distributed-1.19.1-py36h25f3894_0 +defaults::docutils-0.14-py36hb0f60f5_0 +defaults::entrypoints-0.2.3-py36h1aec115_2 +defaults::et_xmlfile-1.0.1-py36hd6bccc3_0 +defaults::expat-2.2.4-hc00ebd1_1 +defaults::fastcache-1.0.2-py36h5b0c431_0 +defaults::filelock-2.0.12-py36hacfa1f5_0 +defaults::flask-0.12.2-py36hb24657c_0 +defaults::flask-cors-3.0.3-py36h2d857d3_0 +defaults::fontconfig-2.12.4-h88586e7_1 +defaults::freetype-2.8-h52ed37b_0 +defaults::get_terminal_size-1.0.0-haa9412d_0 +defaults::gevent-1.2.2-py36h2fe25dc_0 +defaults::glib-2.53.6-hc861d11_1 +defaults::glob2-0.5-py36h2c1b292_1 +defaults::gmp-6.1.2-hb3b607b_0 +defaults::gmpy2-2.0.8-py36h55090d7_1 +defaults::graphite2-1.3.10-hc526e54_0 +defaults::greenlet-0.4.12-py36h2d503a6_0 +defaults::gst-plugins-base-1.12.2-he3457e5_0 +defaults::gstreamer-1.12.2-h4f93127_0 +defaults::h5py-2.7.0-py36he81ebca_1 +defaults::harfbuzz-1.5.0-h2545bd6_0 +defaults::hdf5-1.10.1-hb0523eb_0 +defaults::heapdict-1.0.0-py36h79797d7_0 +defaults::html5lib-0.999999999-py36h2cfc398_0 +defaults::icu-58.2-h211956c_0 +defaults::idna-2.6-py36h82fb2a8_1 +defaults::imageio-2.2.0-py36he555465_0 +defaults::imagesize-0.7.1-py36h52d8127_0 +defaults::intel-openmp-2018.0.0-h15fc484_7 +defaults::ipykernel-4.6.1-py36hbf841aa_0 +defaults::ipython-6.1.0-py36hc72a948_1 +defaults::ipython_genutils-0.2.0-py36hb52b0d5_0 +defaults::ipywidgets-7.0.0-py36h7b55c3a_0 +defaults::isort-4.2.15-py36had401c0_0 +defaults::itsdangerous-0.24-py36h93cc618_1 +defaults::jbig-2.1-hdba287a_0 +defaults::jdcal-1.3-py36h4c697fb_0 +defaults::jedi-0.10.2-py36h552def0_0 +defaults::jinja2-2.9.6-py36h489bce4_1 +defaults::jpeg-9b-habf39ab_1 +defaults::jsonschema-2.6.0-py36h006f8b5_0 +defaults::jupyter-1.0.0-py36h9896ce5_0 +defaults::jupyter_client-5.1.0-py36h614e9ea_0 +defaults::jupyter_console-5.2.0-py36he59e554_1 +defaults::jupyter_core-4.3.0-py36h357a921_0 +defaults::jupyterlab-0.27.0-py36h86377d0_2 +defaults::jupyterlab_launcher-0.4.0-py36h4d8058d_0 +defaults::lazy-object-proxy-1.3.1-py36h10fcdad_0 +defaults::libedit-3.1-heed3624_0 +defaults::libffi-3.2.1-h4deb6c0_3 +defaults::libgcc-ng-7.2.0-h7cc24e2_2 +defaults::libgfortran-ng-7.2.0-h9f7466a_2 +defaults::libpng-1.6.32-hda9c8bc_2 +defaults::libsodium-1.0.13-h31c71d8_2 +defaults::libssh2-1.8.0-h8c220ad_2 +defaults::libstdcxx-ng-7.2.0-h7a57d05_2 +defaults::libtiff-4.0.8-h90200ff_9 +defaults::libtool-2.4.6-hd50d1a6_0 +defaults::libxcb-1.12-h84ff03f_3 +defaults::libxml2-2.9.4-h6b072ca_5 +defaults::libxslt-1.1.29-hcf9102b_5 +defaults::llvmlite-0.20.0-py36_0 +defaults::locket-0.2.0-py36h787c0ad_1 +defaults::lxml-4.1.0-py36h5b66e50_0 +defaults::lzo-2.10-h1bfc0ba_1 +defaults::markupsafe-1.0-py36hd9260cd_1 +defaults::matplotlib-2.1.0-py36hba5de38_0 +defaults::mccabe-0.6.1-py36h5ad9710_1 +defaults::mistune-0.7.4-py36hbab8784_0 +defaults::mkl-2018.0.0-hb491cac_4 +defaults::mkl-service-1.1.2-py36h17a0993_4 +defaults::mpc-1.0.3-hf803216_4 +defaults::mpfr-3.1.5-h12ff648_1 +defaults::mpmath-0.19-py36h8cc018b_2 +defaults::msgpack-python-0.4.8-py36hec4c5d1_0 +defaults::multipledispatch-0.4.9-py36h41da3fb_0 +defaults::navigator-updater-0.1.0-py36h14770f7_0 +defaults::nbconvert-5.3.1-py36hb41ffb7_0 +defaults::nbformat-4.4.0-py36h31c9010_0 +defaults::ncurses-6.0-h06874d7_1 +defaults::networkx-2.0-py36h7e96fb8_0 +defaults::nltk-3.2.4-py36h1a0979f_0 +defaults::nose-1.3.7-py36hcdf7029_2 +defaults::notebook-5.0.0-py36h0b20546_2 +defaults::numba-0.35.0-np113py36_10 +defaults::numexpr-2.6.2-py36hdd3393f_1 +defaults::numpy-1.13.3-py36ha12f23b_0 +defaults::numpydoc-0.7.0-py36h18f165f_0 +defaults::odo-0.5.1-py36h90ed295_0 +defaults::olefile-0.44-py36h79f9f78_0 +defaults::openpyxl-2.4.8-py36h41dd2a8_1 +defaults::openssl-1.0.2l-h077ae2c_5 +defaults::packaging-16.8-py36ha668100_1 +defaults::pandas-0.20.3-py36h842e28d_2 +defaults::pandoc-1.19.2.1-hea2e7c5_1 +defaults::pandocfilters-1.4.2-py36ha6701b7_1 +defaults::pango-1.40.11-h8191d47_0 +defaults::partd-0.3.8-py36h36fd896_0 +defaults::patchelf-0.9-hf79760b_2 +defaults::path.py-10.3.1-py36he0c6f6d_0 +defaults::pathlib2-2.3.0-py36h49efa8e_0 +defaults::patsy-0.4.1-py36ha3be15e_0 +defaults::pcre-8.41-hc71a17e_0 +defaults::pep8-1.7.0-py36h26ade29_0 +defaults::pexpect-4.2.1-py36h3b9d41b_0 +defaults::pickleshare-0.7.4-py36h63277f8_0 +defaults::pillow-4.2.1-py36h9119f52_0 +defaults::pip-9.0.1-py36h8ec8b28_3 +defaults::pixman-0.34.0-h83dc358_2 +defaults::pkginfo-1.4.1-py36h215d178_1 +defaults::ply-3.10-py36hed35086_0 +defaults::prompt_toolkit-1.0.15-py36h17d85b1_0 +defaults::psutil-5.4.0-py36h84c53db_0 +defaults::ptyprocess-0.5.2-py36h69acd42_0 +defaults::py-1.4.34-py36h0712aa3_1 +defaults::pycodestyle-2.3.1-py36hf609f19_0 +defaults::pycosat-0.6.2-py36h1a0ea17_1 +defaults::pycparser-2.18-py36hf9f622e_1 +defaults::pycrypto-2.6.1-py36h6998063_1 +defaults::pycurl-7.43.0-py36h5e72054_3 +defaults::pyflakes-1.6.0-py36h7bd6a15_0 +defaults::pygments-2.2.0-py36h0d3125c_0 +defaults::pylint-1.7.4-py36hb9d4533_0 +defaults::pyodbc-4.0.17-py36h999153c_0 +defaults::pyopenssl-17.2.0-py36h5cc804b_0 +defaults::pyparsing-2.2.0-py36hee85983_1 +defaults::pyqt-5.6.0-py36h0386399_5 +defaults::pysocks-1.6.7-py36hd97a5b1_1 +defaults::pytables-3.4.2-py36h3b5282a_2 +defaults::pytest-3.2.1-py36h11ad3bb_1 +defaults::python-3.6.3-hc9025b9_1 +defaults::python-dateutil-2.6.1-py36h88d3b88_1 +defaults::pytz-2017.2-py36hc2ccc2a_1 +defaults::pywavelets-0.5.2-py36he602eb0_0 +defaults::pyyaml-3.12-py36hafb9ca4_1 +defaults::pyzmq-16.0.2-py36h3b0cf96_2 +defaults::qt-5.6.2-h974d657_12 +defaults::qtawesome-0.4.4-py36h609ed8c_0 +defaults::qtconsole-4.3.1-py36h8f73b5b_0 +defaults::qtpy-1.3.1-py36h3691cc8_0 +defaults::readline-7.0-hac23ff0_3 +defaults::requests-2.18.4-py36he2e5f8d_1 +defaults::rope-0.10.5-py36h1f8c17e_0 +defaults::ruamel_yaml-0.11.14-py36ha2fb22d_2 +defaults::scikit-image-0.13.0-py36had3c07a_1 +defaults::scikit-learn-0.19.1-py36h7aa7ec6_0 +defaults::scipy-0.19.1-py36h9976243_3 +defaults::seaborn-0.8.0-py36h197244f_0 +defaults::setuptools-36.5.0-py36he42e2e1_0 +defaults::simplegeneric-0.8.1-py36h2cb9092_0 +defaults::singledispatch-3.4.0.3-py36h7a266c3_0 +defaults::sip-4.18.1-py36h51ed4ed_2 +defaults::six-1.11.0-py36h372c433_1 +defaults::snowballstemmer-1.2.1-py36h6febd40_0 +defaults::sortedcollections-0.5.3-py36h3c761f9_0 +defaults::sortedcontainers-1.5.7-py36hdf89491_0 +defaults::sphinx-1.6.3-py36he5f0bdb_0 +defaults::sphinxcontrib-1.0-py36h6d0f590_1 +defaults::sphinxcontrib-websupport-1.0.1-py36hb5cb234_1 +defaults::spyder-3.2.4-py36hbe6152b_0 +defaults::sqlalchemy-1.1.13-py36hfb5efd7_0 +defaults::sqlite-3.20.1-h6d8b0f3_1 +defaults::statsmodels-0.8.0-py36h8533d0b_0 +defaults::sympy-1.1.1-py36hc6d1c1c_0 +defaults::tblib-1.3.2-py36h34cf8b6_0 +defaults::terminado-0.6-py36ha25a19f_0 +defaults::testpath-0.3.1-py36h8cadb63_0 +defaults::tk-8.6.7-h5979e9b_1 +defaults::toolz-0.8.2-py36h81f2dff_0 +defaults::tornado-4.5.2-py36h1283b2a_0 +defaults::traitlets-4.3.2-py36h674d592_0 +defaults::typing-3.6.2-py36h7da032a_0 +defaults::unicodecsv-0.14.1-py36ha668878_0 +defaults::unixodbc-2.3.4-hc36303a_1 +defaults::urllib3-1.22-py36hbe7ace6_0 +defaults::wcwidth-0.1.7-py36hdf4376a_0 +defaults::webencodings-0.5.1-py36h800622e_1 +defaults::werkzeug-0.12.2-py36hc703753_0 +defaults::wheel-0.29.0-py36he7f4e38_1 +defaults::widgetsnbextension-3.0.2-py36hd01bb71_1 +defaults::wrapt-1.10.11-py36h28b7045_0 +defaults::xlrd-1.1.0-py36h1db9f0c_1 +defaults::xlsxwriter-1.0.2-py36h3de1aca_0 +defaults::xlwt-1.3.0-py36h7b00a1f_0 +defaults::xz-5.2.3-h2bcbf08_1 +defaults::yaml-0.1.7-h96e3832_1 +defaults::zeromq-4.2.2-hb0b69da_1 +defaults::zict-0.1.3-py36h3a3bf81_0 +defaults::zlib-1.2.11-hfbfcf68_1 ==> 2018-01-24 16:03:02 <== # cmd: /tmp/tmp.q7Mg5Cd6hm/bin/conda update -q conda -defaults::anaconda-5.0.1-py36hd30a520_1 -defaults::conda-4.3.30-py36h5d9f9f4_0 -defaults::pycosat-0.6.2-py36h1a0ea17_1 +defaults::anaconda-custom-py36hbbc8b67_0 +defaults::conda-4.4.7-py36_0 +defaults::pycosat-0.6.3-py36h0a5515d_0 # update specs: conda + try-dry-run-install + conda install -q --dry-run 'zlib<1.2.11' Solving environment: ...working... failed UnsatisfiableError: The following specifications were found to be in conflict: - hdf5 -> zlib[version='>=1.2.11,<1.3.0a0'] - zlib[version='<1.2.11'] Use "conda info <package>" to see the dependencies for each package. + CONDA_PINNED_PACKAGES=anaconda=custom + conda install -qf anaconda Solving environment: ...working... done ## Package Plan ## environment location: /tmp/tmp.q7Mg5Cd6hm added / updated specs: - anaconda The following packages will be DOWNGRADED: anaconda: custom-py36hbbc8b67_0 --> custom-py36hbbc8b67_0 Preparing transaction: ...working... done Verifying transaction: ...working... done Executing transaction: ...working... done + show-latest-history + sed -n '/^==>/{h;d};H;${x;p}' conda-meta/history ==> 2018-01-24 16:04:21 <== # cmd: /tmp/tmp.q7Mg5Cd6hm/bin/conda install -qf anaconda # update specs: ['anaconda'] + try-dry-run-install + conda install -q --dry-run 'zlib<1.2.11' Solving environment: ...working... done ## Package Plan ## environment location: /tmp/tmp.q7Mg5Cd6hm added / updated specs: - zlib[version='<1.2.11'] The following packages will be downloaded: package | build ---------------------------|----------------- readline-6.2 | 2 606 KB sqlite-3.13.0 | 0 4.0 MB libxslt-1.1.29 | 0 983 KB tk-8.5.18 | 0 1.9 MB fontconfig-2.12.1 | 3 429 KB python-3.6.2 | 0 16.5 MB freetype-2.5.5 | 2 2.5 MB pillow-4.2.1 | py36_0 870 KB libxml2-2.9.4 | 0 3.7 MB dbus-1.10.20 | 0 1.4 MB harfbuzz-0.9.39 | 2 1.2 MB hdf5-1.8.17 | 2 2.0 MB pango-1.40.3 | 1 938 KB pcre-8.39 | 1 656 KB qt-5.6.2 | 5 43.5 MB curl-7.52.1 | 0 558 KB pycurl-7.43.0 | py36_2 139 KB gstreamer-1.8.0 | 0 2.6 MB libtiff-4.0.6 | 3 1.5 MB pyqt-5.6.0 | py36_2 5.4 MB libpng-1.6.30 | 1 220 KB icu-54.1 | 0 11.3 MB glib-2.50.2 | 1 5.6 MB h5py-2.7.0 | np113py36_0 2.9 MB libiconv-1.14 | 0 2.0 MB gst-plugins-base-1.8.0 | 0 3.1 MB cairo-1.14.8 | 0 609 KB matplotlib-2.0.2 | np113py36_0 10.9 MB libgcc-7.2.0 | h69d50b8_2 304 KB zlib-1.2.8 | 3 101 KB pytables-3.4.2 | np113py36_0 6.1 MB ------------------------------------------------------------ Total: 134.1 MB The following NEW packages will be INSTALLED: libgcc: 7.2.0-h69d50b8_2 libiconv: 1.14-0 The following packages will be UPDATED: pillow: 4.2.1-py36h9119f52_0 --> 4.2.1-py36_0 The following packages will be DOWNGRADED: cairo: 1.14.10-haa5651f_5 --> 1.14.8-0 curl: 7.55.1-hcb0b314_2 --> 7.52.1-0 dbus: 1.10.22-h3b5a359_0 --> 1.10.20-0 fontconfig: 2.12.4-h88586e7_1 --> 2.12.1-3 freetype: 2.8-h52ed37b_0 --> 2.5.5-2 glib: 2.53.6-hc861d11_1 --> 2.50.2-1 gst-plugins-base: 1.12.2-he3457e5_0 --> 1.8.0-0 gstreamer: 1.12.2-h4f93127_0 --> 1.8.0-0 h5py: 2.7.0-py36he81ebca_1 --> 2.7.0-np113py36_0 harfbuzz: 1.5.0-h2545bd6_0 --> 0.9.39-2 hdf5: 1.10.1-hb0523eb_0 --> 1.8.17-2 icu: 58.2-h211956c_0 --> 54.1-0 libpng: 1.6.32-hda9c8bc_2 --> 1.6.30-1 libtiff: 4.0.8-h90200ff_9 --> 4.0.6-3 libxml2: 2.9.4-h6b072ca_5 --> 2.9.4-0 libxslt: 1.1.29-hcf9102b_5 --> 1.1.29-0 matplotlib: 2.1.0-py36hba5de38_0 --> 2.0.2-np113py36_0 pango: 1.40.11-h8191d47_0 --> 1.40.3-1 pcre: 8.41-hc71a17e_0 --> 8.39-1 pycurl: 7.43.0-py36h5e72054_3 --> 7.43.0-py36_2 pyqt: 5.6.0-py36h0386399_5 --> 5.6.0-py36_2 pytables: 3.4.2-py36h3b5282a_2 --> 3.4.2-np113py36_0 python: 3.6.3-hc9025b9_1 --> 3.6.2-0 qt: 5.6.2-h974d657_12 --> 5.6.2-5 readline: 7.0-hac23ff0_3 --> 6.2-2 sqlite: 3.20.1-h6d8b0f3_1 --> 3.13.0-0 tk: 8.6.7-h5979e9b_1 --> 8.5.18-0 zlib: 1.2.11-hfbfcf68_1 --> 1.2.8-3 + conda remove -q anaconda Solving environment: ...working... done ## Package Plan ## environment location: /tmp/tmp.q7Mg5Cd6hm removed specs: - anaconda The following packages will be REMOVED: anaconda: custom-py36hbbc8b67_0 Preparing transaction: ...working... done Verifying transaction: ...working... done Executing transaction: ...working... done + show-latest-history + sed -n '/^==>/{h;d};H;${x;p}' conda-meta/history ==> 2018-01-24 16:05:34 <== # cmd: /tmp/tmp.q7Mg5Cd6hm/bin/conda remove -q anaconda +defaults::_ipyw_jlab_nb_ext_conf-0.1.0-py36he11e457_0 +defaults::alabaster-0.7.10-py36h306e16b_0 +defaults::anaconda-client-1.6.5-py36h19c0dcd_0 +defaults::anaconda-navigator-1.6.9-py36h11ddaaa_0 +defaults::anaconda-project-0.8.0-py36h29abdf5_0 +defaults::asn1crypto-0.22.0-py36h265ca7c_1 +defaults::astroid-1.5.3-py36hbdb9df2_0 +defaults::astropy-2.0.2-py36ha51211e_4 +defaults::babel-2.5.0-py36h7d14adf_0 +defaults::backports-1.0-py36hfa02d7e_1 +defaults::backports.shutil_get_terminal_size-1.0.0-py36hfea85ff_2 +defaults::beautifulsoup4-4.6.0-py36h49b8c8c_1 +defaults::bitarray-0.8.1-py36h5834eb8_0 +defaults::bkcharts-0.2-py36h735825a_0 +defaults::blaze-0.11.3-py36h4e06776_0 +defaults::bleach-2.0.0-py36h688b259_0 +defaults::bokeh-0.12.10-py36hbb0e44a_0 +defaults::boto-2.48.0-py36h6e4cd66_1 +defaults::bottleneck-1.2.1-py36haac1ea0_0 +defaults::bzip2-1.0.6-h0376d23_1 +defaults::ca-certificates-2017.08.26-h1d4fec5_0 +defaults::cairo-1.14.10-haa5651f_5 +defaults::certifi-2017.7.27.1-py36h8b7b77e_0 +defaults::cffi-1.10.0-py36had8d393_1 +defaults::chardet-3.0.4-py36h0f667ec_1 +defaults::click-6.7-py36h5253387_0 +defaults::cloudpickle-0.4.0-py36h30f8c20_0 +defaults::clyent-1.2.2-py36h7e57e65_1 +defaults::colorama-0.3.9-py36h489cec4_0 +defaults::conda-4.4.7-py36_0 +defaults::conda-build-3.0.27-py36h940a66d_0 +defaults::conda-env-2.6.0-h36134e3_1 +defaults::conda-verify-2.0.0-py36h98955d8_0 +defaults::contextlib2-0.5.5-py36h6c84a62_0 +defaults::cryptography-2.0.3-py36ha225213_1 +defaults::curl-7.55.1-hcb0b314_2 +defaults::cycler-0.10.0-py36h93f1223_0 +defaults::cython-0.26.1-py36h21c49d0_0 +defaults::cytoolz-0.8.2-py36h708bfd4_0 +defaults::dask-0.15.3-py36hdc2c8aa_0 +defaults::dask-core-0.15.3-py36h10e6167_0 +defaults::datashape-0.5.4-py36h3ad6b5c_0 +defaults::dbus-1.10.22-h3b5a359_0 +defaults::decorator-4.1.2-py36hd076ac8_0 +defaults::distributed-1.19.1-py36h25f3894_0 +defaults::docutils-0.14-py36hb0f60f5_0 +defaults::entrypoints-0.2.3-py36h1aec115_2 +defaults::et_xmlfile-1.0.1-py36hd6bccc3_0 +defaults::expat-2.2.4-hc00ebd1_1 +defaults::fastcache-1.0.2-py36h5b0c431_0 +defaults::filelock-2.0.12-py36hacfa1f5_0 +defaults::flask-0.12.2-py36hb24657c_0 +defaults::flask-cors-3.0.3-py36h2d857d3_0 +defaults::fontconfig-2.12.4-h88586e7_1 +defaults::freetype-2.8-h52ed37b_0 +defaults::get_terminal_size-1.0.0-haa9412d_0 +defaults::gevent-1.2.2-py36h2fe25dc_0 +defaults::glib-2.53.6-hc861d11_1 +defaults::glob2-0.5-py36h2c1b292_1 +defaults::gmp-6.1.2-hb3b607b_0 +defaults::gmpy2-2.0.8-py36h55090d7_1 +defaults::graphite2-1.3.10-hc526e54_0 +defaults::greenlet-0.4.12-py36h2d503a6_0 +defaults::gst-plugins-base-1.12.2-he3457e5_0 +defaults::gstreamer-1.12.2-h4f93127_0 +defaults::h5py-2.7.0-py36he81ebca_1 +defaults::harfbuzz-1.5.0-h2545bd6_0 +defaults::hdf5-1.10.1-hb0523eb_0 +defaults::heapdict-1.0.0-py36h79797d7_0 +defaults::html5lib-0.999999999-py36h2cfc398_0 +defaults::icu-58.2-h211956c_0 +defaults::idna-2.6-py36h82fb2a8_1 +defaults::imageio-2.2.0-py36he555465_0 +defaults::imagesize-0.7.1-py36h52d8127_0 +defaults::intel-openmp-2018.0.0-h15fc484_7 +defaults::ipykernel-4.6.1-py36hbf841aa_0 +defaults::ipython-6.1.0-py36hc72a948_1 +defaults::ipython_genutils-0.2.0-py36hb52b0d5_0 +defaults::ipywidgets-7.0.0-py36h7b55c3a_0 +defaults::isort-4.2.15-py36had401c0_0 +defaults::itsdangerous-0.24-py36h93cc618_1 +defaults::jbig-2.1-hdba287a_0 +defaults::jdcal-1.3-py36h4c697fb_0 +defaults::jedi-0.10.2-py36h552def0_0 +defaults::jinja2-2.9.6-py36h489bce4_1 +defaults::jpeg-9b-habf39ab_1 +defaults::jsonschema-2.6.0-py36h006f8b5_0 +defaults::jupyter-1.0.0-py36h9896ce5_0 +defaults::jupyter_client-5.1.0-py36h614e9ea_0 +defaults::jupyter_console-5.2.0-py36he59e554_1 +defaults::jupyter_core-4.3.0-py36h357a921_0 +defaults::jupyterlab-0.27.0-py36h86377d0_2 +defaults::jupyterlab_launcher-0.4.0-py36h4d8058d_0 +defaults::lazy-object-proxy-1.3.1-py36h10fcdad_0 +defaults::libedit-3.1-heed3624_0 +defaults::libffi-3.2.1-h4deb6c0_3 +defaults::libgcc-ng-7.2.0-h7cc24e2_2 +defaults::libgfortran-ng-7.2.0-h9f7466a_2 +defaults::libpng-1.6.32-hda9c8bc_2 +defaults::libsodium-1.0.13-h31c71d8_2 +defaults::libssh2-1.8.0-h8c220ad_2 +defaults::libstdcxx-ng-7.2.0-h7a57d05_2 +defaults::libtiff-4.0.8-h90200ff_9 +defaults::libtool-2.4.6-hd50d1a6_0 +defaults::libxcb-1.12-h84ff03f_3 +defaults::libxml2-2.9.4-h6b072ca_5 +defaults::libxslt-1.1.29-hcf9102b_5 +defaults::llvmlite-0.20.0-py36_0 +defaults::locket-0.2.0-py36h787c0ad_1 +defaults::lxml-4.1.0-py36h5b66e50_0 +defaults::lzo-2.10-h1bfc0ba_1 +defaults::markupsafe-1.0-py36hd9260cd_1 +defaults::matplotlib-2.1.0-py36hba5de38_0 +defaults::mccabe-0.6.1-py36h5ad9710_1 +defaults::mistune-0.7.4-py36hbab8784_0 +defaults::mkl-2018.0.0-hb491cac_4 +defaults::mkl-service-1.1.2-py36h17a0993_4 +defaults::mpc-1.0.3-hf803216_4 +defaults::mpfr-3.1.5-h12ff648_1 +defaults::mpmath-0.19-py36h8cc018b_2 +defaults::msgpack-python-0.4.8-py36hec4c5d1_0 +defaults::multipledispatch-0.4.9-py36h41da3fb_0 +defaults::navigator-updater-0.1.0-py36h14770f7_0 +defaults::nbconvert-5.3.1-py36hb41ffb7_0 +defaults::nbformat-4.4.0-py36h31c9010_0 +defaults::ncurses-6.0-h06874d7_1 +defaults::networkx-2.0-py36h7e96fb8_0 +defaults::nltk-3.2.4-py36h1a0979f_0 +defaults::nose-1.3.7-py36hcdf7029_2 +defaults::notebook-5.0.0-py36h0b20546_2 +defaults::numba-0.35.0-np113py36_10 +defaults::numexpr-2.6.2-py36hdd3393f_1 +defaults::numpy-1.13.3-py36ha12f23b_0 +defaults::numpydoc-0.7.0-py36h18f165f_0 +defaults::odo-0.5.1-py36h90ed295_0 +defaults::olefile-0.44-py36h79f9f78_0 +defaults::openpyxl-2.4.8-py36h41dd2a8_1 +defaults::openssl-1.0.2l-h077ae2c_5 +defaults::packaging-16.8-py36ha668100_1 +defaults::pandas-0.20.3-py36h842e28d_2 +defaults::pandoc-1.19.2.1-hea2e7c5_1 +defaults::pandocfilters-1.4.2-py36ha6701b7_1 +defaults::pango-1.40.11-h8191d47_0 +defaults::partd-0.3.8-py36h36fd896_0 +defaults::patchelf-0.9-hf79760b_2 +defaults::path.py-10.3.1-py36he0c6f6d_0 +defaults::pathlib2-2.3.0-py36h49efa8e_0 +defaults::patsy-0.4.1-py36ha3be15e_0 +defaults::pcre-8.41-hc71a17e_0 +defaults::pep8-1.7.0-py36h26ade29_0 +defaults::pexpect-4.2.1-py36h3b9d41b_0 +defaults::pickleshare-0.7.4-py36h63277f8_0 +defaults::pillow-4.2.1-py36h9119f52_0 +defaults::pip-9.0.1-py36h8ec8b28_3 +defaults::pixman-0.34.0-h83dc358_2 +defaults::pkginfo-1.4.1-py36h215d178_1 +defaults::ply-3.10-py36hed35086_0 +defaults::prompt_toolkit-1.0.15-py36h17d85b1_0 +defaults::psutil-5.4.0-py36h84c53db_0 +defaults::ptyprocess-0.5.2-py36h69acd42_0 +defaults::py-1.4.34-py36h0712aa3_1 +defaults::pycodestyle-2.3.1-py36hf609f19_0 +defaults::pycosat-0.6.3-py36h0a5515d_0 +defaults::pycparser-2.18-py36hf9f622e_1 +defaults::pycrypto-2.6.1-py36h6998063_1 +defaults::pycurl-7.43.0-py36h5e72054_3 +defaults::pyflakes-1.6.0-py36h7bd6a15_0 +defaults::pygments-2.2.0-py36h0d3125c_0 +defaults::pylint-1.7.4-py36hb9d4533_0 +defaults::pyodbc-4.0.17-py36h999153c_0 +defaults::pyopenssl-17.2.0-py36h5cc804b_0 +defaults::pyparsing-2.2.0-py36hee85983_1 +defaults::pyqt-5.6.0-py36h0386399_5 +defaults::pysocks-1.6.7-py36hd97a5b1_1 +defaults::pytables-3.4.2-py36h3b5282a_2 +defaults::pytest-3.2.1-py36h11ad3bb_1 +defaults::python-3.6.3-hc9025b9_1 +defaults::python-dateutil-2.6.1-py36h88d3b88_1 +defaults::pytz-2017.2-py36hc2ccc2a_1 +defaults::pywavelets-0.5.2-py36he602eb0_0 +defaults::pyyaml-3.12-py36hafb9ca4_1 +defaults::pyzmq-16.0.2-py36h3b0cf96_2 +defaults::qt-5.6.2-h974d657_12 +defaults::qtawesome-0.4.4-py36h609ed8c_0 +defaults::qtconsole-4.3.1-py36h8f73b5b_0 +defaults::qtpy-1.3.1-py36h3691cc8_0 +defaults::readline-7.0-hac23ff0_3 +defaults::requests-2.18.4-py36he2e5f8d_1 +defaults::rope-0.10.5-py36h1f8c17e_0 +defaults::ruamel_yaml-0.11.14-py36ha2fb22d_2 +defaults::scikit-image-0.13.0-py36had3c07a_1 +defaults::scikit-learn-0.19.1-py36h7aa7ec6_0 +defaults::scipy-0.19.1-py36h9976243_3 +defaults::seaborn-0.8.0-py36h197244f_0 +defaults::setuptools-36.5.0-py36he42e2e1_0 +defaults::simplegeneric-0.8.1-py36h2cb9092_0 +defaults::singledispatch-3.4.0.3-py36h7a266c3_0 +defaults::sip-4.18.1-py36h51ed4ed_2 +defaults::six-1.11.0-py36h372c433_1 +defaults::snowballstemmer-1.2.1-py36h6febd40_0 +defaults::sortedcollections-0.5.3-py36h3c761f9_0 +defaults::sortedcontainers-1.5.7-py36hdf89491_0 +defaults::sphinx-1.6.3-py36he5f0bdb_0 +defaults::sphinxcontrib-1.0-py36h6d0f590_1 +defaults::sphinxcontrib-websupport-1.0.1-py36hb5cb234_1 +defaults::spyder-3.2.4-py36hbe6152b_0 +defaults::sqlalchemy-1.1.13-py36hfb5efd7_0 +defaults::sqlite-3.20.1-h6d8b0f3_1 +defaults::statsmodels-0.8.0-py36h8533d0b_0 +defaults::sympy-1.1.1-py36hc6d1c1c_0 +defaults::tblib-1.3.2-py36h34cf8b6_0 +defaults::terminado-0.6-py36ha25a19f_0 +defaults::testpath-0.3.1-py36h8cadb63_0 +defaults::tk-8.6.7-h5979e9b_1 +defaults::toolz-0.8.2-py36h81f2dff_0 +defaults::tornado-4.5.2-py36h1283b2a_0 +defaults::traitlets-4.3.2-py36h674d592_0 +defaults::typing-3.6.2-py36h7da032a_0 +defaults::unicodecsv-0.14.1-py36ha668878_0 +defaults::unixodbc-2.3.4-hc36303a_1 +defaults::urllib3-1.22-py36hbe7ace6_0 +defaults::wcwidth-0.1.7-py36hdf4376a_0 +defaults::webencodings-0.5.1-py36h800622e_1 +defaults::werkzeug-0.12.2-py36hc703753_0 +defaults::wheel-0.29.0-py36he7f4e38_1 +defaults::widgetsnbextension-3.0.2-py36hd01bb71_1 +defaults::wrapt-1.10.11-py36h28b7045_0 +defaults::xlrd-1.1.0-py36h1db9f0c_1 +defaults::xlsxwriter-1.0.2-py36h3de1aca_0 +defaults::xlwt-1.3.0-py36h7b00a1f_0 +defaults::xz-5.2.3-h2bcbf08_1 +defaults::yaml-0.1.7-h96e3832_1 +defaults::zeromq-4.2.2-hb0b69da_1 +defaults::zict-0.1.3-py36h3a3bf81_0 +defaults::zlib-1.2.11-hfbfcf68_1 # remove specs: ['anaconda'] + try-dry-run-install + conda install -q --dry-run 'zlib<1.2.11' Solving environment: ...working... failed UnsatisfiableError: The following specifications were found to be in conflict: - hdf5 -> zlib[version='>=1.2.11,<1.3.0a0'] - zlib[version='<1.2.11'] Use "conda info <package>" to see the dependencies for each package. + conda install -q anaconda=custom Solving environment: ...working... done ## Package Plan ## environment location: /tmp/tmp.q7Mg5Cd6hm added / updated specs: - anaconda=custom The following NEW packages will be INSTALLED: anaconda: custom-py36hbbc8b67_0 Preparing transaction: ...working... done Verifying transaction: ...working... done Executing transaction: ...working... done + show-latest-history + sed -n '/^==>/{h;d};H;${x;p}' conda-meta/history ==> 2018-01-24 16:06:27 <== # cmd: /tmp/tmp.q7Mg5Cd6hm/bin/conda install -q anaconda=custom +defaults::anaconda-custom-py36hbbc8b67_0 # update specs: ['anaconda=custom'] + try-dry-run-install + conda install -q --dry-run 'zlib<1.2.11' Solving environment: ...working... done ## Package Plan ## environment location: /tmp/tmp.q7Mg5Cd6hm added / updated specs: - zlib[version='<1.2.11'] The following packages will be downloaded: package | build ---------------------------|----------------- libxslt-1.1.29 | 0 983 KB dbus-1.10.20 | 0 1.4 MB glib-2.50.2 | 1 5.6 MB libtiff-4.0.6 | 3 1.5 MB harfbuzz-0.9.39 | 2 1.2 MB qt-5.6.2 | 5 43.5 MB icu-54.1 | 0 11.3 MB h5py-2.7.0 | np113py36_0 2.9 MB zlib-1.2.8 | 3 101 KB pytables-3.4.2 | np113py36_0 6.1 MB pcre-8.39 | 1 656 KB hdf5-1.8.17 | 2 2.0 MB gstreamer-1.8.0 | 0 2.6 MB gst-plugins-base-1.8.0 | 0 3.1 MB pycurl-7.43.0 | py36_2 139 KB pyqt-5.6.0 | py36_2 5.4 MB libpng-1.6.30 | 1 220 KB pillow-4.2.1 | py36_0 870 KB libiconv-1.14 | 0 2.0 MB pango-1.40.3 | 1 938 KB tk-8.5.18 | 0 1.9 MB python-3.6.2 | 0 16.5 MB freetype-2.5.5 | 2 2.5 MB matplotlib-2.0.2 | np113py36_0 10.9 MB cairo-1.14.8 | 0 609 KB sqlite-3.13.0 | 0 4.0 MB libgcc-7.2.0 | h69d50b8_2 304 KB curl-7.52.1 | 0 558 KB libxml2-2.9.4 | 0 3.7 MB fontconfig-2.12.1 | 3 429 KB readline-6.2 | 2 606 KB ------------------------------------------------------------ Total: 134.1 MB The following NEW packages will be INSTALLED: libgcc: 7.2.0-h69d50b8_2 libiconv: 1.14-0 The following packages will be UPDATED: pillow: 4.2.1-py36h9119f52_0 --> 4.2.1-py36_0 The following packages will be DOWNGRADED: cairo: 1.14.10-haa5651f_5 --> 1.14.8-0 curl: 7.55.1-hcb0b314_2 --> 7.52.1-0 dbus: 1.10.22-h3b5a359_0 --> 1.10.20-0 fontconfig: 2.12.4-h88586e7_1 --> 2.12.1-3 freetype: 2.8-h52ed37b_0 --> 2.5.5-2 glib: 2.53.6-hc861d11_1 --> 2.50.2-1 gst-plugins-base: 1.12.2-he3457e5_0 --> 1.8.0-0 gstreamer: 1.12.2-h4f93127_0 --> 1.8.0-0 h5py: 2.7.0-py36he81ebca_1 --> 2.7.0-np113py36_0 harfbuzz: 1.5.0-h2545bd6_0 --> 0.9.39-2 hdf5: 1.10.1-hb0523eb_0 --> 1.8.17-2 icu: 58.2-h211956c_0 --> 54.1-0 libpng: 1.6.32-hda9c8bc_2 --> 1.6.30-1 libtiff: 4.0.8-h90200ff_9 --> 4.0.6-3 libxml2: 2.9.4-h6b072ca_5 --> 2.9.4-0 libxslt: 1.1.29-hcf9102b_5 --> 1.1.29-0 matplotlib: 2.1.0-py36hba5de38_0 --> 2.0.2-np113py36_0 pango: 1.40.11-h8191d47_0 --> 1.40.3-1 pcre: 8.41-hc71a17e_0 --> 8.39-1 pycurl: 7.43.0-py36h5e72054_3 --> 7.43.0-py36_2 pyqt: 5.6.0-py36h0386399_5 --> 5.6.0-py36_2 pytables: 3.4.2-py36h3b5282a_2 --> 3.4.2-np113py36_0 python: 3.6.3-hc9025b9_1 --> 3.6.2-0 qt: 5.6.2-h974d657_12 --> 5.6.2-5 readline: 7.0-hac23ff0_3 --> 6.2-2 sqlite: 3.20.1-h6d8b0f3_1 --> 3.13.0-0 tk: 8.6.7-h5979e9b_1 --> 8.5.18-0 zlib: 1.2.11-hfbfcf68_1 --> 1.2.8-3 ``` ---- So, basically `conda 4.4.x` has a problem with "orphan" packages that don't have their specs in `conda-meta/history`. The first reproducer installs `fontconfig`, a package that depends on `libpng` and `libxml2` which both depends on `zlib` (`>=1.2.11` for the versions being installed). If `fontconfig` is installed, `libpng` and `libxml2` remain in the environment but don't have any specs about themselves in `history`. If we now try to install a `zlib <1.2.11`, we get ``` UnsatisfiableError: The following specifications were found to be in conflict: - libxml2 -> zlib[version='>=1.2.11,<1.3.0a0'] - zlib[version='<1.2.11'] ``` . Interestingly this only happens if we have at least two packages depending on `zlib`. If we remove either of `libpng` or `libxml2`, the packages get downgraded as expected. The second reproducer shows that this could be a quite common case for `anaconda` users. If you install `anaconda=5.0.1` this will also install `conda=4.3.30` (due to `pycosat` being downgraded, I think). Now, `conda 4.3.x` doesn't seem to update the specs for `anaconda` when `anaconda=5.0.1` gets replaced by `anaconda=custom` (so, that one is a bug in `conda <4.4`!). If we have updated to `conda 4.4.x`, the history still has the `anaconda=5.0.1` and thus a `zlib <1.2.11` install will fail as it would imply package downgrades and thus `anaconda=custom`. The last commands of the reproducer show that if you install `anaconda=custom`, everything works as expected since the prior conflict is resolved. Now, if you uninstall `anaconda`, you have the same case as with the first reproducer with `fontconfig`: The remaining packages are not (transitively) associated with any specs in `history`. If you reinstall `anaconda`, then again, order is restored. The `anaconda` related issue was reported in https://github.com/bioconda/bioconda-recipes/issues/7202. This bug appears not to have been fully fixed. I just encountered it when upgrading from 4.2 -> 4.5.1 ``` Solving environment: failed CondaValueError: Invalid MatchSpec: <4.0 ``` It took some digging, but I found the offending line: ``` # install specs: python>=3.5.1,jupyter >=1.0.0,<2.0,matplotlib >=1.5.1,<2.0,numpy >=1.11.0,<2.0,pandas >=0.19.2,<1.0,psycopg2 >=2.6.1,<3.0,pyyaml >=3.12,<4.0,scipy >=0.17.0,<1.0 ``` I have just seen the same issue with 4.5.1. Can you either attach here or email to me (kfranz at anaconda com) the file /scratch/mc3/conda-meta/history @nehaljwani figured out the problem, and the fix to get me up and running again was very easy. When I'd previously installed a dependency using an awkward specification, conda 4.3 wrote an entry to conda-meta/history that causes conda 4.4 to fail. The following command ``` $ which conda /scratch/mc3/bin/conda $ conda --version conda 4.3.31 $ conda install -c conda-forge "param>=1.5.1,<2.0" ``` results in the following entry in /scratch/mc3/conda-meta/history: ``` # cmd: /scratch/mc3/bin/conda install -c conda-forge param>=1.5.1,<2.0 [...] # install specs: param >=1.5.1,<2.0 ``` That entry causes no problems for conda 4.3. However, after updating to conda 4.4, there's a problem: ``` $ conda --version conda 4.4.7 $ conda install numpy Solving environment: failed CondaValueError: Invalid MatchSpec: <2.0 ``` Fortunately, removing the `install specs` line in /scratch/mc3/conda-meta/history makes the problem go away. Conda 4.4 writes the history information differently (quoting the matchspec). The following command: ``` $ conda --version conda 4.4.7 $ conda install -c conda-forge "param>=1.5.1,<2.0" ``` appears in /scratch/mc3/conda-meta/history as: ``` # cmd: /scratch/mc3/bin/conda install -c conda-forge param>=1.5.1,<2.0 [...] # update specs: ["param[version='>=1.5.1,<2.0']"] ``` I think this is a bug that we should try to write a test for and solve. Ah, I meant to write an issue for this one some time ago but didn't -- and didn't see this one! Reproducers: ---- ```bash export CONDA_ALWAYS_YES=1 source bin/activate conda --version cconda() { # run conda commands with concise output echo echo '>'conda "${@}" conda "$1" -q "${@:2}" |\ sed -n '/INSTALLED\|UPDATED\|DOWNGRADED\|REMOVED/,${/ done$/ba;H;:a};${x;p}' } cconda create -nz fontconfig source activate z cconda remove fontconfig freetype cd envs cat z/conda-meta/history mv z z-base mkdir z test-case() { printf '%99s\n' | tr ' ' = mkdir z-top z-work sudo mount -t overlay overlay -o lowerdir=z-base,upperdir=z-top,workdir=z-work z if [[ $# -ne 0 ]] ; then "${@}" sed -n '/^==>/{h;d};H;${x;p}' z/conda-meta/history fi cconda install --dry-run 'zlib<1.2.11' sudo umount z sudo rm -r z-top z-work } test-case test-case cconda install fontconfig test-case cconda install -f libpng libxml2 test-case cconda install -f libxml2 test-case cconda install -f libpng test-case cconda remove libpng test-case cconda remove libxml2 rmdir z mv z-base z source deactivate cconda remove -nz --all ) ``` <details><summary>output:</summary><p> ``` conda 4.4.7 >conda create -nz fontconfig The following NEW packages will be INSTALLED: fontconfig: 2.12.4-h88586e7_1 freetype: 2.8-hab7d2ae_1 icu: 58.2-h9c2bf20_1 libgcc-ng: 7.2.0-h7cc24e2_2 libpng: 1.6.34-hb9fc6fc_0 libstdcxx-ng: 7.2.0-h7a57d05_2 libxml2: 2.9.4-h2e8b1d7_6 xz: 5.2.3-h55aa19d_2 zlib: 1.2.11-ha838bed_2 >conda remove fontconfig freetype The following packages will be REMOVED: fontconfig: 2.12.4-h88586e7_1 freetype: 2.8-hab7d2ae_1 ==> 2018-01-24 16:01:04 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda create -q -nz fontconfig +defaults::fontconfig-2.12.4-h88586e7_1 +defaults::freetype-2.8-hab7d2ae_1 +defaults::icu-58.2-h9c2bf20_1 +defaults::libgcc-ng-7.2.0-h7cc24e2_2 +defaults::libpng-1.6.34-hb9fc6fc_0 +defaults::libstdcxx-ng-7.2.0-h7a57d05_2 +defaults::libxml2-2.9.4-h2e8b1d7_6 +defaults::xz-5.2.3-h55aa19d_2 +defaults::zlib-1.2.11-ha838bed_2 # update specs: ['fontconfig'] ==> 2018-01-24 16:01:07 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda remove -q fontconfig freetype -defaults::fontconfig-2.12.4-h88586e7_1 -defaults::freetype-2.8-hab7d2ae_1 # remove specs: ['freetype', 'fontconfig'] =================================================================================================== >conda install --dry-run zlib<1.2.11 UnsatisfiableError: The following specifications were found to be in conflict: - libxml2 -> zlib[version='>=1.2.11,<1.3.0a0'] - zlib[version='<1.2.11'] Use "conda info <package>" to see the dependencies for each package. =================================================================================================== >conda install fontconfig The following NEW packages will be INSTALLED: fontconfig: 2.12.4-h88586e7_1 freetype: 2.8-hab7d2ae_1 ==> 2018-01-24 16:01:13 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda install -q fontconfig +defaults::fontconfig-2.12.4-h88586e7_1 +defaults::freetype-2.8-hab7d2ae_1 # update specs: ['fontconfig'] >conda install --dry-run zlib<1.2.11 The following NEW packages will be INSTALLED: libiconv: 1.15-h63c8f33_5 The following packages will be DOWNGRADED: fontconfig: 2.12.4-h88586e7_1 --> 2.11.1-6 freetype: 2.8-hab7d2ae_1 --> 2.5.5-2 libpng: 1.6.34-hb9fc6fc_0 --> 1.6.30-1 libxml2: 2.9.4-h2e8b1d7_6 --> 2.9.4-0 zlib: 1.2.11-ha838bed_2 --> 1.2.8-3 =================================================================================================== >conda install -f libpng libxml2 The following packages will be UPDATED: libpng: 1.6.34-hb9fc6fc_0 --> 1.6.34-hb9fc6fc_0 libxml2: 2.9.4-h2e8b1d7_6 --> 2.9.4-h2e8b1d7_6 ==> 2018-01-24 16:01:22 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda install -q -f libpng libxml2 # update specs: ['libpng', 'libxml2'] >conda install --dry-run zlib<1.2.11 The following NEW packages will be INSTALLED: libiconv: 1.15-h63c8f33_5 The following packages will be DOWNGRADED: libpng: 1.6.34-hb9fc6fc_0 --> 1.6.30-1 libxml2: 2.9.4-h2e8b1d7_6 --> 2.9.4-0 zlib: 1.2.11-ha838bed_2 --> 1.2.8-3 =================================================================================================== >conda install -f libxml2 The following packages will be UPDATED: libxml2: 2.9.4-h2e8b1d7_6 --> 2.9.4-h2e8b1d7_6 ==> 2018-01-24 16:01:28 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda install -q -f libxml2 # update specs: ['libxml2'] >conda install --dry-run zlib<1.2.11 The following NEW packages will be INSTALLED: libiconv: 1.15-h63c8f33_5 The following packages will be REMOVED: libpng: 1.6.34-hb9fc6fc_0 The following packages will be DOWNGRADED: libxml2: 2.9.4-h2e8b1d7_6 --> 2.9.4-0 zlib: 1.2.11-ha838bed_2 --> 1.2.8-3 =================================================================================================== >conda install -f libpng The following packages will be UPDATED: libpng: 1.6.34-hb9fc6fc_0 --> 1.6.34-hb9fc6fc_0 ==> 2018-01-24 16:01:34 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda install -q -f libpng # update specs: ['libpng'] >conda install --dry-run zlib<1.2.11 The following packages will be REMOVED: libxml2: 2.9.4-h2e8b1d7_6 The following packages will be DOWNGRADED: libpng: 1.6.34-hb9fc6fc_0 --> 1.6.30-1 zlib: 1.2.11-ha838bed_2 --> 1.2.8-3 =================================================================================================== >conda remove libpng The following packages will be REMOVED: libpng: 1.6.34-hb9fc6fc_0 ==> 2018-01-24 16:01:40 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda remove -q libpng -defaults::libpng-1.6.34-hb9fc6fc_0 # remove specs: ['libpng'] >conda install --dry-run zlib<1.2.11 The following packages will be REMOVED: libxml2: 2.9.4-h2e8b1d7_6 The following packages will be DOWNGRADED: zlib: 1.2.11-ha838bed_2 --> 1.2.8-3 =================================================================================================== >conda remove libxml2 The following packages will be REMOVED: libxml2: 2.9.4-h2e8b1d7_6 ==> 2018-01-24 16:01:46 <== # cmd: /home/maba/code/conda/conda-4.4/bin/conda remove -q libxml2 -defaults::libxml2-2.9.4-h2e8b1d7_6 # remove specs: ['libxml2'] >conda install --dry-run zlib<1.2.11 The following packages will be REMOVED: libpng: 1.6.34-hb9fc6fc_0 The following packages will be DOWNGRADED: zlib: 1.2.11-ha838bed_2 --> 1.2.8-3 >conda remove -nz --all Remove all packages in environment /home/maba/code/conda/conda-4.4/envs/z: ``` </p></details> [EDIT: fixed copy-pasta error] ---- ```bash _TMPDIR=$(mktemp -d) ; ( set -x show-latest-history() { sed -n '/^==>/{h;d};H;${x;p}' conda-meta/history ; } try-dry-run-install() { conda install -q --dry-run 'zlib<1.2.11' ; } export CONDA_ALWAYS_YES=1 export CONDA_AUTO_UPDATE_CONDA=0 export CONDA__AGGRESSIVE_UPDATE_PACKAGES=none cd $_TMPDIR bash ~/code/conda/Anaconda3-5.0.1-Linux-x86_64.sh -bfp . >/dev/null source bin/activate 2>/dev/null alias conda=bin/conda # use conda directly <- less clutter with "set -x" conda update -q conda cat conda-meta/history try-dry-run-install CONDA_PINNED_PACKAGES=anaconda=custom conda install -qf anaconda show-latest-history try-dry-run-install conda remove -q anaconda show-latest-history try-dry-run-install conda install -q anaconda=custom show-latest-history try-dry-run-install ) ; rm -r $_TMPDIR ``` <details><summary>output:</summary><p> ``` + export CONDA_ALWAYS_YES=1 + CONDA_ALWAYS_YES=1 + export CONDA_AUTO_UPDATE_CONDA=0 + CONDA_AUTO_UPDATE_CONDA=0 + export CONDA__AGGRESSIVE_UPDATE_PACKAGES=none + CONDA__AGGRESSIVE_UPDATE_PACKAGES=none + cd /tmp/tmp.q7Mg5Cd6hm + bash /home/maba/code/conda/Anaconda3-5.0.1-Linux-x86_64.sh -bfp . Python 3.6.3 :: Anaconda, Inc. + source bin/activate + alias conda=bin/conda + conda update -q conda Package plan for installation in environment /tmp/tmp.q7Mg5Cd6hm: The following packages will be UPDATED: anaconda: 5.0.1-py36hd30a520_1 --> custom-py36hbbc8b67_0 conda: 4.3.30-py36h5d9f9f4_0 --> 4.4.7-py36_0 pycosat: 0.6.2-py36h1a0ea17_1 --> 0.6.3-py36h0a5515d_0 + cat conda-meta/history ==> 2018-01-24 16:03:01 <== # cmd: /tmp/tmp.q7Mg5Cd6hm/bin/conda update -q conda +defaults::_ipyw_jlab_nb_ext_conf-0.1.0-py36he11e457_0 +defaults::alabaster-0.7.10-py36h306e16b_0 +defaults::anaconda-5.0.1-py36hd30a520_1 +defaults::anaconda-client-1.6.5-py36h19c0dcd_0 +defaults::anaconda-navigator-1.6.9-py36h11ddaaa_0 +defaults::anaconda-project-0.8.0-py36h29abdf5_0 +defaults::asn1crypto-0.22.0-py36h265ca7c_1 +defaults::astroid-1.5.3-py36hbdb9df2_0 +defaults::astropy-2.0.2-py36ha51211e_4 +defaults::babel-2.5.0-py36h7d14adf_0 +defaults::backports-1.0-py36hfa02d7e_1 +defaults::backports.shutil_get_terminal_size-1.0.0-py36hfea85ff_2 +defaults::beautifulsoup4-4.6.0-py36h49b8c8c_1 +defaults::bitarray-0.8.1-py36h5834eb8_0 +defaults::bkcharts-0.2-py36h735825a_0 +defaults::blaze-0.11.3-py36h4e06776_0 +defaults::bleach-2.0.0-py36h688b259_0 +defaults::bokeh-0.12.10-py36hbb0e44a_0 +defaults::boto-2.48.0-py36h6e4cd66_1 +defaults::bottleneck-1.2.1-py36haac1ea0_0 +defaults::bzip2-1.0.6-h0376d23_1 +defaults::ca-certificates-2017.08.26-h1d4fec5_0 +defaults::cairo-1.14.10-haa5651f_5 +defaults::certifi-2017.7.27.1-py36h8b7b77e_0 +defaults::cffi-1.10.0-py36had8d393_1 +defaults::chardet-3.0.4-py36h0f667ec_1 +defaults::click-6.7-py36h5253387_0 +defaults::cloudpickle-0.4.0-py36h30f8c20_0 +defaults::clyent-1.2.2-py36h7e57e65_1 +defaults::colorama-0.3.9-py36h489cec4_0 +defaults::conda-4.3.30-py36h5d9f9f4_0 +defaults::conda-build-3.0.27-py36h940a66d_0 +defaults::conda-env-2.6.0-h36134e3_1 +defaults::conda-verify-2.0.0-py36h98955d8_0 +defaults::contextlib2-0.5.5-py36h6c84a62_0 +defaults::cryptography-2.0.3-py36ha225213_1 +defaults::curl-7.55.1-hcb0b314_2 +defaults::cycler-0.10.0-py36h93f1223_0 +defaults::cython-0.26.1-py36h21c49d0_0 +defaults::cytoolz-0.8.2-py36h708bfd4_0 +defaults::dask-0.15.3-py36hdc2c8aa_0 +defaults::dask-core-0.15.3-py36h10e6167_0 +defaults::datashape-0.5.4-py36h3ad6b5c_0 +defaults::dbus-1.10.22-h3b5a359_0 +defaults::decorator-4.1.2-py36hd076ac8_0 +defaults::distributed-1.19.1-py36h25f3894_0 +defaults::docutils-0.14-py36hb0f60f5_0 +defaults::entrypoints-0.2.3-py36h1aec115_2 +defaults::et_xmlfile-1.0.1-py36hd6bccc3_0 +defaults::expat-2.2.4-hc00ebd1_1 +defaults::fastcache-1.0.2-py36h5b0c431_0 +defaults::filelock-2.0.12-py36hacfa1f5_0 +defaults::flask-0.12.2-py36hb24657c_0 +defaults::flask-cors-3.0.3-py36h2d857d3_0 +defaults::fontconfig-2.12.4-h88586e7_1 +defaults::freetype-2.8-h52ed37b_0 +defaults::get_terminal_size-1.0.0-haa9412d_0 +defaults::gevent-1.2.2-py36h2fe25dc_0 +defaults::glib-2.53.6-hc861d11_1 +defaults::glob2-0.5-py36h2c1b292_1 +defaults::gmp-6.1.2-hb3b607b_0 +defaults::gmpy2-2.0.8-py36h55090d7_1 +defaults::graphite2-1.3.10-hc526e54_0 +defaults::greenlet-0.4.12-py36h2d503a6_0 +defaults::gst-plugins-base-1.12.2-he3457e5_0 +defaults::gstreamer-1.12.2-h4f93127_0 +defaults::h5py-2.7.0-py36he81ebca_1 +defaults::harfbuzz-1.5.0-h2545bd6_0 +defaults::hdf5-1.10.1-hb0523eb_0 +defaults::heapdict-1.0.0-py36h79797d7_0 +defaults::html5lib-0.999999999-py36h2cfc398_0 +defaults::icu-58.2-h211956c_0 +defaults::idna-2.6-py36h82fb2a8_1 +defaults::imageio-2.2.0-py36he555465_0 +defaults::imagesize-0.7.1-py36h52d8127_0 +defaults::intel-openmp-2018.0.0-h15fc484_7 +defaults::ipykernel-4.6.1-py36hbf841aa_0 +defaults::ipython-6.1.0-py36hc72a948_1 +defaults::ipython_genutils-0.2.0-py36hb52b0d5_0 +defaults::ipywidgets-7.0.0-py36h7b55c3a_0 +defaults::isort-4.2.15-py36had401c0_0 +defaults::itsdangerous-0.24-py36h93cc618_1 +defaults::jbig-2.1-hdba287a_0 +defaults::jdcal-1.3-py36h4c697fb_0 +defaults::jedi-0.10.2-py36h552def0_0 +defaults::jinja2-2.9.6-py36h489bce4_1 +defaults::jpeg-9b-habf39ab_1 +defaults::jsonschema-2.6.0-py36h006f8b5_0 +defaults::jupyter-1.0.0-py36h9896ce5_0 +defaults::jupyter_client-5.1.0-py36h614e9ea_0 +defaults::jupyter_console-5.2.0-py36he59e554_1 +defaults::jupyter_core-4.3.0-py36h357a921_0 +defaults::jupyterlab-0.27.0-py36h86377d0_2 +defaults::jupyterlab_launcher-0.4.0-py36h4d8058d_0 +defaults::lazy-object-proxy-1.3.1-py36h10fcdad_0 +defaults::libedit-3.1-heed3624_0 +defaults::libffi-3.2.1-h4deb6c0_3 +defaults::libgcc-ng-7.2.0-h7cc24e2_2 +defaults::libgfortran-ng-7.2.0-h9f7466a_2 +defaults::libpng-1.6.32-hda9c8bc_2 +defaults::libsodium-1.0.13-h31c71d8_2 +defaults::libssh2-1.8.0-h8c220ad_2 +defaults::libstdcxx-ng-7.2.0-h7a57d05_2 +defaults::libtiff-4.0.8-h90200ff_9 +defaults::libtool-2.4.6-hd50d1a6_0 +defaults::libxcb-1.12-h84ff03f_3 +defaults::libxml2-2.9.4-h6b072ca_5 +defaults::libxslt-1.1.29-hcf9102b_5 +defaults::llvmlite-0.20.0-py36_0 +defaults::locket-0.2.0-py36h787c0ad_1 +defaults::lxml-4.1.0-py36h5b66e50_0 +defaults::lzo-2.10-h1bfc0ba_1 +defaults::markupsafe-1.0-py36hd9260cd_1 +defaults::matplotlib-2.1.0-py36hba5de38_0 +defaults::mccabe-0.6.1-py36h5ad9710_1 +defaults::mistune-0.7.4-py36hbab8784_0 +defaults::mkl-2018.0.0-hb491cac_4 +defaults::mkl-service-1.1.2-py36h17a0993_4 +defaults::mpc-1.0.3-hf803216_4 +defaults::mpfr-3.1.5-h12ff648_1 +defaults::mpmath-0.19-py36h8cc018b_2 +defaults::msgpack-python-0.4.8-py36hec4c5d1_0 +defaults::multipledispatch-0.4.9-py36h41da3fb_0 +defaults::navigator-updater-0.1.0-py36h14770f7_0 +defaults::nbconvert-5.3.1-py36hb41ffb7_0 +defaults::nbformat-4.4.0-py36h31c9010_0 +defaults::ncurses-6.0-h06874d7_1 +defaults::networkx-2.0-py36h7e96fb8_0 +defaults::nltk-3.2.4-py36h1a0979f_0 +defaults::nose-1.3.7-py36hcdf7029_2 +defaults::notebook-5.0.0-py36h0b20546_2 +defaults::numba-0.35.0-np113py36_10 +defaults::numexpr-2.6.2-py36hdd3393f_1 +defaults::numpy-1.13.3-py36ha12f23b_0 +defaults::numpydoc-0.7.0-py36h18f165f_0 +defaults::odo-0.5.1-py36h90ed295_0 +defaults::olefile-0.44-py36h79f9f78_0 +defaults::openpyxl-2.4.8-py36h41dd2a8_1 +defaults::openssl-1.0.2l-h077ae2c_5 +defaults::packaging-16.8-py36ha668100_1 +defaults::pandas-0.20.3-py36h842e28d_2 +defaults::pandoc-1.19.2.1-hea2e7c5_1 +defaults::pandocfilters-1.4.2-py36ha6701b7_1 +defaults::pango-1.40.11-h8191d47_0 +defaults::partd-0.3.8-py36h36fd896_0 +defaults::patchelf-0.9-hf79760b_2 +defaults::path.py-10.3.1-py36he0c6f6d_0 +defaults::pathlib2-2.3.0-py36h49efa8e_0 +defaults::patsy-0.4.1-py36ha3be15e_0 +defaults::pcre-8.41-hc71a17e_0 +defaults::pep8-1.7.0-py36h26ade29_0 +defaults::pexpect-4.2.1-py36h3b9d41b_0 +defaults::pickleshare-0.7.4-py36h63277f8_0 +defaults::pillow-4.2.1-py36h9119f52_0 +defaults::pip-9.0.1-py36h8ec8b28_3 +defaults::pixman-0.34.0-h83dc358_2 +defaults::pkginfo-1.4.1-py36h215d178_1 +defaults::ply-3.10-py36hed35086_0 +defaults::prompt_toolkit-1.0.15-py36h17d85b1_0 +defaults::psutil-5.4.0-py36h84c53db_0 +defaults::ptyprocess-0.5.2-py36h69acd42_0 +defaults::py-1.4.34-py36h0712aa3_1 +defaults::pycodestyle-2.3.1-py36hf609f19_0 +defaults::pycosat-0.6.2-py36h1a0ea17_1 +defaults::pycparser-2.18-py36hf9f622e_1 +defaults::pycrypto-2.6.1-py36h6998063_1 +defaults::pycurl-7.43.0-py36h5e72054_3 +defaults::pyflakes-1.6.0-py36h7bd6a15_0 +defaults::pygments-2.2.0-py36h0d3125c_0 +defaults::pylint-1.7.4-py36hb9d4533_0 +defaults::pyodbc-4.0.17-py36h999153c_0 +defaults::pyopenssl-17.2.0-py36h5cc804b_0 +defaults::pyparsing-2.2.0-py36hee85983_1 +defaults::pyqt-5.6.0-py36h0386399_5 +defaults::pysocks-1.6.7-py36hd97a5b1_1 +defaults::pytables-3.4.2-py36h3b5282a_2 +defaults::pytest-3.2.1-py36h11ad3bb_1 +defaults::python-3.6.3-hc9025b9_1 +defaults::python-dateutil-2.6.1-py36h88d3b88_1 +defaults::pytz-2017.2-py36hc2ccc2a_1 +defaults::pywavelets-0.5.2-py36he602eb0_0 +defaults::pyyaml-3.12-py36hafb9ca4_1 +defaults::pyzmq-16.0.2-py36h3b0cf96_2 +defaults::qt-5.6.2-h974d657_12 +defaults::qtawesome-0.4.4-py36h609ed8c_0 +defaults::qtconsole-4.3.1-py36h8f73b5b_0 +defaults::qtpy-1.3.1-py36h3691cc8_0 +defaults::readline-7.0-hac23ff0_3 +defaults::requests-2.18.4-py36he2e5f8d_1 +defaults::rope-0.10.5-py36h1f8c17e_0 +defaults::ruamel_yaml-0.11.14-py36ha2fb22d_2 +defaults::scikit-image-0.13.0-py36had3c07a_1 +defaults::scikit-learn-0.19.1-py36h7aa7ec6_0 +defaults::scipy-0.19.1-py36h9976243_3 +defaults::seaborn-0.8.0-py36h197244f_0 +defaults::setuptools-36.5.0-py36he42e2e1_0 +defaults::simplegeneric-0.8.1-py36h2cb9092_0 +defaults::singledispatch-3.4.0.3-py36h7a266c3_0 +defaults::sip-4.18.1-py36h51ed4ed_2 +defaults::six-1.11.0-py36h372c433_1 +defaults::snowballstemmer-1.2.1-py36h6febd40_0 +defaults::sortedcollections-0.5.3-py36h3c761f9_0 +defaults::sortedcontainers-1.5.7-py36hdf89491_0 +defaults::sphinx-1.6.3-py36he5f0bdb_0 +defaults::sphinxcontrib-1.0-py36h6d0f590_1 +defaults::sphinxcontrib-websupport-1.0.1-py36hb5cb234_1 +defaults::spyder-3.2.4-py36hbe6152b_0 +defaults::sqlalchemy-1.1.13-py36hfb5efd7_0 +defaults::sqlite-3.20.1-h6d8b0f3_1 +defaults::statsmodels-0.8.0-py36h8533d0b_0 +defaults::sympy-1.1.1-py36hc6d1c1c_0 +defaults::tblib-1.3.2-py36h34cf8b6_0 +defaults::terminado-0.6-py36ha25a19f_0 +defaults::testpath-0.3.1-py36h8cadb63_0 +defaults::tk-8.6.7-h5979e9b_1 +defaults::toolz-0.8.2-py36h81f2dff_0 +defaults::tornado-4.5.2-py36h1283b2a_0 +defaults::traitlets-4.3.2-py36h674d592_0 +defaults::typing-3.6.2-py36h7da032a_0 +defaults::unicodecsv-0.14.1-py36ha668878_0 +defaults::unixodbc-2.3.4-hc36303a_1 +defaults::urllib3-1.22-py36hbe7ace6_0 +defaults::wcwidth-0.1.7-py36hdf4376a_0 +defaults::webencodings-0.5.1-py36h800622e_1 +defaults::werkzeug-0.12.2-py36hc703753_0 +defaults::wheel-0.29.0-py36he7f4e38_1 +defaults::widgetsnbextension-3.0.2-py36hd01bb71_1 +defaults::wrapt-1.10.11-py36h28b7045_0 +defaults::xlrd-1.1.0-py36h1db9f0c_1 +defaults::xlsxwriter-1.0.2-py36h3de1aca_0 +defaults::xlwt-1.3.0-py36h7b00a1f_0 +defaults::xz-5.2.3-h2bcbf08_1 +defaults::yaml-0.1.7-h96e3832_1 +defaults::zeromq-4.2.2-hb0b69da_1 +defaults::zict-0.1.3-py36h3a3bf81_0 +defaults::zlib-1.2.11-hfbfcf68_1 ==> 2018-01-24 16:03:02 <== # cmd: /tmp/tmp.q7Mg5Cd6hm/bin/conda update -q conda -defaults::anaconda-5.0.1-py36hd30a520_1 -defaults::conda-4.3.30-py36h5d9f9f4_0 -defaults::pycosat-0.6.2-py36h1a0ea17_1 +defaults::anaconda-custom-py36hbbc8b67_0 +defaults::conda-4.4.7-py36_0 +defaults::pycosat-0.6.3-py36h0a5515d_0 # update specs: conda + try-dry-run-install + conda install -q --dry-run 'zlib<1.2.11' Solving environment: ...working... failed UnsatisfiableError: The following specifications were found to be in conflict: - hdf5 -> zlib[version='>=1.2.11,<1.3.0a0'] - zlib[version='<1.2.11'] Use "conda info <package>" to see the dependencies for each package. + CONDA_PINNED_PACKAGES=anaconda=custom + conda install -qf anaconda Solving environment: ...working... done ## Package Plan ## environment location: /tmp/tmp.q7Mg5Cd6hm added / updated specs: - anaconda The following packages will be DOWNGRADED: anaconda: custom-py36hbbc8b67_0 --> custom-py36hbbc8b67_0 Preparing transaction: ...working... done Verifying transaction: ...working... done Executing transaction: ...working... done + show-latest-history + sed -n '/^==>/{h;d};H;${x;p}' conda-meta/history ==> 2018-01-24 16:04:21 <== # cmd: /tmp/tmp.q7Mg5Cd6hm/bin/conda install -qf anaconda # update specs: ['anaconda'] + try-dry-run-install + conda install -q --dry-run 'zlib<1.2.11' Solving environment: ...working... done ## Package Plan ## environment location: /tmp/tmp.q7Mg5Cd6hm added / updated specs: - zlib[version='<1.2.11'] The following packages will be downloaded: package | build ---------------------------|----------------- readline-6.2 | 2 606 KB sqlite-3.13.0 | 0 4.0 MB libxslt-1.1.29 | 0 983 KB tk-8.5.18 | 0 1.9 MB fontconfig-2.12.1 | 3 429 KB python-3.6.2 | 0 16.5 MB freetype-2.5.5 | 2 2.5 MB pillow-4.2.1 | py36_0 870 KB libxml2-2.9.4 | 0 3.7 MB dbus-1.10.20 | 0 1.4 MB harfbuzz-0.9.39 | 2 1.2 MB hdf5-1.8.17 | 2 2.0 MB pango-1.40.3 | 1 938 KB pcre-8.39 | 1 656 KB qt-5.6.2 | 5 43.5 MB curl-7.52.1 | 0 558 KB pycurl-7.43.0 | py36_2 139 KB gstreamer-1.8.0 | 0 2.6 MB libtiff-4.0.6 | 3 1.5 MB pyqt-5.6.0 | py36_2 5.4 MB libpng-1.6.30 | 1 220 KB icu-54.1 | 0 11.3 MB glib-2.50.2 | 1 5.6 MB h5py-2.7.0 | np113py36_0 2.9 MB libiconv-1.14 | 0 2.0 MB gst-plugins-base-1.8.0 | 0 3.1 MB cairo-1.14.8 | 0 609 KB matplotlib-2.0.2 | np113py36_0 10.9 MB libgcc-7.2.0 | h69d50b8_2 304 KB zlib-1.2.8 | 3 101 KB pytables-3.4.2 | np113py36_0 6.1 MB ------------------------------------------------------------ Total: 134.1 MB The following NEW packages will be INSTALLED: libgcc: 7.2.0-h69d50b8_2 libiconv: 1.14-0 The following packages will be UPDATED: pillow: 4.2.1-py36h9119f52_0 --> 4.2.1-py36_0 The following packages will be DOWNGRADED: cairo: 1.14.10-haa5651f_5 --> 1.14.8-0 curl: 7.55.1-hcb0b314_2 --> 7.52.1-0 dbus: 1.10.22-h3b5a359_0 --> 1.10.20-0 fontconfig: 2.12.4-h88586e7_1 --> 2.12.1-3 freetype: 2.8-h52ed37b_0 --> 2.5.5-2 glib: 2.53.6-hc861d11_1 --> 2.50.2-1 gst-plugins-base: 1.12.2-he3457e5_0 --> 1.8.0-0 gstreamer: 1.12.2-h4f93127_0 --> 1.8.0-0 h5py: 2.7.0-py36he81ebca_1 --> 2.7.0-np113py36_0 harfbuzz: 1.5.0-h2545bd6_0 --> 0.9.39-2 hdf5: 1.10.1-hb0523eb_0 --> 1.8.17-2 icu: 58.2-h211956c_0 --> 54.1-0 libpng: 1.6.32-hda9c8bc_2 --> 1.6.30-1 libtiff: 4.0.8-h90200ff_9 --> 4.0.6-3 libxml2: 2.9.4-h6b072ca_5 --> 2.9.4-0 libxslt: 1.1.29-hcf9102b_5 --> 1.1.29-0 matplotlib: 2.1.0-py36hba5de38_0 --> 2.0.2-np113py36_0 pango: 1.40.11-h8191d47_0 --> 1.40.3-1 pcre: 8.41-hc71a17e_0 --> 8.39-1 pycurl: 7.43.0-py36h5e72054_3 --> 7.43.0-py36_2 pyqt: 5.6.0-py36h0386399_5 --> 5.6.0-py36_2 pytables: 3.4.2-py36h3b5282a_2 --> 3.4.2-np113py36_0 python: 3.6.3-hc9025b9_1 --> 3.6.2-0 qt: 5.6.2-h974d657_12 --> 5.6.2-5 readline: 7.0-hac23ff0_3 --> 6.2-2 sqlite: 3.20.1-h6d8b0f3_1 --> 3.13.0-0 tk: 8.6.7-h5979e9b_1 --> 8.5.18-0 zlib: 1.2.11-hfbfcf68_1 --> 1.2.8-3 + conda remove -q anaconda Solving environment: ...working... done ## Package Plan ## environment location: /tmp/tmp.q7Mg5Cd6hm removed specs: - anaconda The following packages will be REMOVED: anaconda: custom-py36hbbc8b67_0 Preparing transaction: ...working... done Verifying transaction: ...working... done Executing transaction: ...working... done + show-latest-history + sed -n '/^==>/{h;d};H;${x;p}' conda-meta/history ==> 2018-01-24 16:05:34 <== # cmd: /tmp/tmp.q7Mg5Cd6hm/bin/conda remove -q anaconda +defaults::_ipyw_jlab_nb_ext_conf-0.1.0-py36he11e457_0 +defaults::alabaster-0.7.10-py36h306e16b_0 +defaults::anaconda-client-1.6.5-py36h19c0dcd_0 +defaults::anaconda-navigator-1.6.9-py36h11ddaaa_0 +defaults::anaconda-project-0.8.0-py36h29abdf5_0 +defaults::asn1crypto-0.22.0-py36h265ca7c_1 +defaults::astroid-1.5.3-py36hbdb9df2_0 +defaults::astropy-2.0.2-py36ha51211e_4 +defaults::babel-2.5.0-py36h7d14adf_0 +defaults::backports-1.0-py36hfa02d7e_1 +defaults::backports.shutil_get_terminal_size-1.0.0-py36hfea85ff_2 +defaults::beautifulsoup4-4.6.0-py36h49b8c8c_1 +defaults::bitarray-0.8.1-py36h5834eb8_0 +defaults::bkcharts-0.2-py36h735825a_0 +defaults::blaze-0.11.3-py36h4e06776_0 +defaults::bleach-2.0.0-py36h688b259_0 +defaults::bokeh-0.12.10-py36hbb0e44a_0 +defaults::boto-2.48.0-py36h6e4cd66_1 +defaults::bottleneck-1.2.1-py36haac1ea0_0 +defaults::bzip2-1.0.6-h0376d23_1 +defaults::ca-certificates-2017.08.26-h1d4fec5_0 +defaults::cairo-1.14.10-haa5651f_5 +defaults::certifi-2017.7.27.1-py36h8b7b77e_0 +defaults::cffi-1.10.0-py36had8d393_1 +defaults::chardet-3.0.4-py36h0f667ec_1 +defaults::click-6.7-py36h5253387_0 +defaults::cloudpickle-0.4.0-py36h30f8c20_0 +defaults::clyent-1.2.2-py36h7e57e65_1 +defaults::colorama-0.3.9-py36h489cec4_0 +defaults::conda-4.4.7-py36_0 +defaults::conda-build-3.0.27-py36h940a66d_0 +defaults::conda-env-2.6.0-h36134e3_1 +defaults::conda-verify-2.0.0-py36h98955d8_0 +defaults::contextlib2-0.5.5-py36h6c84a62_0 +defaults::cryptography-2.0.3-py36ha225213_1 +defaults::curl-7.55.1-hcb0b314_2 +defaults::cycler-0.10.0-py36h93f1223_0 +defaults::cython-0.26.1-py36h21c49d0_0 +defaults::cytoolz-0.8.2-py36h708bfd4_0 +defaults::dask-0.15.3-py36hdc2c8aa_0 +defaults::dask-core-0.15.3-py36h10e6167_0 +defaults::datashape-0.5.4-py36h3ad6b5c_0 +defaults::dbus-1.10.22-h3b5a359_0 +defaults::decorator-4.1.2-py36hd076ac8_0 +defaults::distributed-1.19.1-py36h25f3894_0 +defaults::docutils-0.14-py36hb0f60f5_0 +defaults::entrypoints-0.2.3-py36h1aec115_2 +defaults::et_xmlfile-1.0.1-py36hd6bccc3_0 +defaults::expat-2.2.4-hc00ebd1_1 +defaults::fastcache-1.0.2-py36h5b0c431_0 +defaults::filelock-2.0.12-py36hacfa1f5_0 +defaults::flask-0.12.2-py36hb24657c_0 +defaults::flask-cors-3.0.3-py36h2d857d3_0 +defaults::fontconfig-2.12.4-h88586e7_1 +defaults::freetype-2.8-h52ed37b_0 +defaults::get_terminal_size-1.0.0-haa9412d_0 +defaults::gevent-1.2.2-py36h2fe25dc_0 +defaults::glib-2.53.6-hc861d11_1 +defaults::glob2-0.5-py36h2c1b292_1 +defaults::gmp-6.1.2-hb3b607b_0 +defaults::gmpy2-2.0.8-py36h55090d7_1 +defaults::graphite2-1.3.10-hc526e54_0 +defaults::greenlet-0.4.12-py36h2d503a6_0 +defaults::gst-plugins-base-1.12.2-he3457e5_0 +defaults::gstreamer-1.12.2-h4f93127_0 +defaults::h5py-2.7.0-py36he81ebca_1 +defaults::harfbuzz-1.5.0-h2545bd6_0 +defaults::hdf5-1.10.1-hb0523eb_0 +defaults::heapdict-1.0.0-py36h79797d7_0 +defaults::html5lib-0.999999999-py36h2cfc398_0 +defaults::icu-58.2-h211956c_0 +defaults::idna-2.6-py36h82fb2a8_1 +defaults::imageio-2.2.0-py36he555465_0 +defaults::imagesize-0.7.1-py36h52d8127_0 +defaults::intel-openmp-2018.0.0-h15fc484_7 +defaults::ipykernel-4.6.1-py36hbf841aa_0 +defaults::ipython-6.1.0-py36hc72a948_1 +defaults::ipython_genutils-0.2.0-py36hb52b0d5_0 +defaults::ipywidgets-7.0.0-py36h7b55c3a_0 +defaults::isort-4.2.15-py36had401c0_0 +defaults::itsdangerous-0.24-py36h93cc618_1 +defaults::jbig-2.1-hdba287a_0 +defaults::jdcal-1.3-py36h4c697fb_0 +defaults::jedi-0.10.2-py36h552def0_0 +defaults::jinja2-2.9.6-py36h489bce4_1 +defaults::jpeg-9b-habf39ab_1 +defaults::jsonschema-2.6.0-py36h006f8b5_0 +defaults::jupyter-1.0.0-py36h9896ce5_0 +defaults::jupyter_client-5.1.0-py36h614e9ea_0 +defaults::jupyter_console-5.2.0-py36he59e554_1 +defaults::jupyter_core-4.3.0-py36h357a921_0 +defaults::jupyterlab-0.27.0-py36h86377d0_2 +defaults::jupyterlab_launcher-0.4.0-py36h4d8058d_0 +defaults::lazy-object-proxy-1.3.1-py36h10fcdad_0 +defaults::libedit-3.1-heed3624_0 +defaults::libffi-3.2.1-h4deb6c0_3 +defaults::libgcc-ng-7.2.0-h7cc24e2_2 +defaults::libgfortran-ng-7.2.0-h9f7466a_2 +defaults::libpng-1.6.32-hda9c8bc_2 +defaults::libsodium-1.0.13-h31c71d8_2 +defaults::libssh2-1.8.0-h8c220ad_2 +defaults::libstdcxx-ng-7.2.0-h7a57d05_2 +defaults::libtiff-4.0.8-h90200ff_9 +defaults::libtool-2.4.6-hd50d1a6_0 +defaults::libxcb-1.12-h84ff03f_3 +defaults::libxml2-2.9.4-h6b072ca_5 +defaults::libxslt-1.1.29-hcf9102b_5 +defaults::llvmlite-0.20.0-py36_0 +defaults::locket-0.2.0-py36h787c0ad_1 +defaults::lxml-4.1.0-py36h5b66e50_0 +defaults::lzo-2.10-h1bfc0ba_1 +defaults::markupsafe-1.0-py36hd9260cd_1 +defaults::matplotlib-2.1.0-py36hba5de38_0 +defaults::mccabe-0.6.1-py36h5ad9710_1 +defaults::mistune-0.7.4-py36hbab8784_0 +defaults::mkl-2018.0.0-hb491cac_4 +defaults::mkl-service-1.1.2-py36h17a0993_4 +defaults::mpc-1.0.3-hf803216_4 +defaults::mpfr-3.1.5-h12ff648_1 +defaults::mpmath-0.19-py36h8cc018b_2 +defaults::msgpack-python-0.4.8-py36hec4c5d1_0 +defaults::multipledispatch-0.4.9-py36h41da3fb_0 +defaults::navigator-updater-0.1.0-py36h14770f7_0 +defaults::nbconvert-5.3.1-py36hb41ffb7_0 +defaults::nbformat-4.4.0-py36h31c9010_0 +defaults::ncurses-6.0-h06874d7_1 +defaults::networkx-2.0-py36h7e96fb8_0 +defaults::nltk-3.2.4-py36h1a0979f_0 +defaults::nose-1.3.7-py36hcdf7029_2 +defaults::notebook-5.0.0-py36h0b20546_2 +defaults::numba-0.35.0-np113py36_10 +defaults::numexpr-2.6.2-py36hdd3393f_1 +defaults::numpy-1.13.3-py36ha12f23b_0 +defaults::numpydoc-0.7.0-py36h18f165f_0 +defaults::odo-0.5.1-py36h90ed295_0 +defaults::olefile-0.44-py36h79f9f78_0 +defaults::openpyxl-2.4.8-py36h41dd2a8_1 +defaults::openssl-1.0.2l-h077ae2c_5 +defaults::packaging-16.8-py36ha668100_1 +defaults::pandas-0.20.3-py36h842e28d_2 +defaults::pandoc-1.19.2.1-hea2e7c5_1 +defaults::pandocfilters-1.4.2-py36ha6701b7_1 +defaults::pango-1.40.11-h8191d47_0 +defaults::partd-0.3.8-py36h36fd896_0 +defaults::patchelf-0.9-hf79760b_2 +defaults::path.py-10.3.1-py36he0c6f6d_0 +defaults::pathlib2-2.3.0-py36h49efa8e_0 +defaults::patsy-0.4.1-py36ha3be15e_0 +defaults::pcre-8.41-hc71a17e_0 +defaults::pep8-1.7.0-py36h26ade29_0 +defaults::pexpect-4.2.1-py36h3b9d41b_0 +defaults::pickleshare-0.7.4-py36h63277f8_0 +defaults::pillow-4.2.1-py36h9119f52_0 +defaults::pip-9.0.1-py36h8ec8b28_3 +defaults::pixman-0.34.0-h83dc358_2 +defaults::pkginfo-1.4.1-py36h215d178_1 +defaults::ply-3.10-py36hed35086_0 +defaults::prompt_toolkit-1.0.15-py36h17d85b1_0 +defaults::psutil-5.4.0-py36h84c53db_0 +defaults::ptyprocess-0.5.2-py36h69acd42_0 +defaults::py-1.4.34-py36h0712aa3_1 +defaults::pycodestyle-2.3.1-py36hf609f19_0 +defaults::pycosat-0.6.3-py36h0a5515d_0 +defaults::pycparser-2.18-py36hf9f622e_1 +defaults::pycrypto-2.6.1-py36h6998063_1 +defaults::pycurl-7.43.0-py36h5e72054_3 +defaults::pyflakes-1.6.0-py36h7bd6a15_0 +defaults::pygments-2.2.0-py36h0d3125c_0 +defaults::pylint-1.7.4-py36hb9d4533_0 +defaults::pyodbc-4.0.17-py36h999153c_0 +defaults::pyopenssl-17.2.0-py36h5cc804b_0 +defaults::pyparsing-2.2.0-py36hee85983_1 +defaults::pyqt-5.6.0-py36h0386399_5 +defaults::pysocks-1.6.7-py36hd97a5b1_1 +defaults::pytables-3.4.2-py36h3b5282a_2 +defaults::pytest-3.2.1-py36h11ad3bb_1 +defaults::python-3.6.3-hc9025b9_1 +defaults::python-dateutil-2.6.1-py36h88d3b88_1 +defaults::pytz-2017.2-py36hc2ccc2a_1 +defaults::pywavelets-0.5.2-py36he602eb0_0 +defaults::pyyaml-3.12-py36hafb9ca4_1 +defaults::pyzmq-16.0.2-py36h3b0cf96_2 +defaults::qt-5.6.2-h974d657_12 +defaults::qtawesome-0.4.4-py36h609ed8c_0 +defaults::qtconsole-4.3.1-py36h8f73b5b_0 +defaults::qtpy-1.3.1-py36h3691cc8_0 +defaults::readline-7.0-hac23ff0_3 +defaults::requests-2.18.4-py36he2e5f8d_1 +defaults::rope-0.10.5-py36h1f8c17e_0 +defaults::ruamel_yaml-0.11.14-py36ha2fb22d_2 +defaults::scikit-image-0.13.0-py36had3c07a_1 +defaults::scikit-learn-0.19.1-py36h7aa7ec6_0 +defaults::scipy-0.19.1-py36h9976243_3 +defaults::seaborn-0.8.0-py36h197244f_0 +defaults::setuptools-36.5.0-py36he42e2e1_0 +defaults::simplegeneric-0.8.1-py36h2cb9092_0 +defaults::singledispatch-3.4.0.3-py36h7a266c3_0 +defaults::sip-4.18.1-py36h51ed4ed_2 +defaults::six-1.11.0-py36h372c433_1 +defaults::snowballstemmer-1.2.1-py36h6febd40_0 +defaults::sortedcollections-0.5.3-py36h3c761f9_0 +defaults::sortedcontainers-1.5.7-py36hdf89491_0 +defaults::sphinx-1.6.3-py36he5f0bdb_0 +defaults::sphinxcontrib-1.0-py36h6d0f590_1 +defaults::sphinxcontrib-websupport-1.0.1-py36hb5cb234_1 +defaults::spyder-3.2.4-py36hbe6152b_0 +defaults::sqlalchemy-1.1.13-py36hfb5efd7_0 +defaults::sqlite-3.20.1-h6d8b0f3_1 +defaults::statsmodels-0.8.0-py36h8533d0b_0 +defaults::sympy-1.1.1-py36hc6d1c1c_0 +defaults::tblib-1.3.2-py36h34cf8b6_0 +defaults::terminado-0.6-py36ha25a19f_0 +defaults::testpath-0.3.1-py36h8cadb63_0 +defaults::tk-8.6.7-h5979e9b_1 +defaults::toolz-0.8.2-py36h81f2dff_0 +defaults::tornado-4.5.2-py36h1283b2a_0 +defaults::traitlets-4.3.2-py36h674d592_0 +defaults::typing-3.6.2-py36h7da032a_0 +defaults::unicodecsv-0.14.1-py36ha668878_0 +defaults::unixodbc-2.3.4-hc36303a_1 +defaults::urllib3-1.22-py36hbe7ace6_0 +defaults::wcwidth-0.1.7-py36hdf4376a_0 +defaults::webencodings-0.5.1-py36h800622e_1 +defaults::werkzeug-0.12.2-py36hc703753_0 +defaults::wheel-0.29.0-py36he7f4e38_1 +defaults::widgetsnbextension-3.0.2-py36hd01bb71_1 +defaults::wrapt-1.10.11-py36h28b7045_0 +defaults::xlrd-1.1.0-py36h1db9f0c_1 +defaults::xlsxwriter-1.0.2-py36h3de1aca_0 +defaults::xlwt-1.3.0-py36h7b00a1f_0 +defaults::xz-5.2.3-h2bcbf08_1 +defaults::yaml-0.1.7-h96e3832_1 +defaults::zeromq-4.2.2-hb0b69da_1 +defaults::zict-0.1.3-py36h3a3bf81_0 +defaults::zlib-1.2.11-hfbfcf68_1 # remove specs: ['anaconda'] + try-dry-run-install + conda install -q --dry-run 'zlib<1.2.11' Solving environment: ...working... failed UnsatisfiableError: The following specifications were found to be in conflict: - hdf5 -> zlib[version='>=1.2.11,<1.3.0a0'] - zlib[version='<1.2.11'] Use "conda info <package>" to see the dependencies for each package. + conda install -q anaconda=custom Solving environment: ...working... done ## Package Plan ## environment location: /tmp/tmp.q7Mg5Cd6hm added / updated specs: - anaconda=custom The following NEW packages will be INSTALLED: anaconda: custom-py36hbbc8b67_0 Preparing transaction: ...working... done Verifying transaction: ...working... done Executing transaction: ...working... done + show-latest-history + sed -n '/^==>/{h;d};H;${x;p}' conda-meta/history ==> 2018-01-24 16:06:27 <== # cmd: /tmp/tmp.q7Mg5Cd6hm/bin/conda install -q anaconda=custom +defaults::anaconda-custom-py36hbbc8b67_0 # update specs: ['anaconda=custom'] + try-dry-run-install + conda install -q --dry-run 'zlib<1.2.11' Solving environment: ...working... done ## Package Plan ## environment location: /tmp/tmp.q7Mg5Cd6hm added / updated specs: - zlib[version='<1.2.11'] The following packages will be downloaded: package | build ---------------------------|----------------- libxslt-1.1.29 | 0 983 KB dbus-1.10.20 | 0 1.4 MB glib-2.50.2 | 1 5.6 MB libtiff-4.0.6 | 3 1.5 MB harfbuzz-0.9.39 | 2 1.2 MB qt-5.6.2 | 5 43.5 MB icu-54.1 | 0 11.3 MB h5py-2.7.0 | np113py36_0 2.9 MB zlib-1.2.8 | 3 101 KB pytables-3.4.2 | np113py36_0 6.1 MB pcre-8.39 | 1 656 KB hdf5-1.8.17 | 2 2.0 MB gstreamer-1.8.0 | 0 2.6 MB gst-plugins-base-1.8.0 | 0 3.1 MB pycurl-7.43.0 | py36_2 139 KB pyqt-5.6.0 | py36_2 5.4 MB libpng-1.6.30 | 1 220 KB pillow-4.2.1 | py36_0 870 KB libiconv-1.14 | 0 2.0 MB pango-1.40.3 | 1 938 KB tk-8.5.18 | 0 1.9 MB python-3.6.2 | 0 16.5 MB freetype-2.5.5 | 2 2.5 MB matplotlib-2.0.2 | np113py36_0 10.9 MB cairo-1.14.8 | 0 609 KB sqlite-3.13.0 | 0 4.0 MB libgcc-7.2.0 | h69d50b8_2 304 KB curl-7.52.1 | 0 558 KB libxml2-2.9.4 | 0 3.7 MB fontconfig-2.12.1 | 3 429 KB readline-6.2 | 2 606 KB ------------------------------------------------------------ Total: 134.1 MB The following NEW packages will be INSTALLED: libgcc: 7.2.0-h69d50b8_2 libiconv: 1.14-0 The following packages will be UPDATED: pillow: 4.2.1-py36h9119f52_0 --> 4.2.1-py36_0 The following packages will be DOWNGRADED: cairo: 1.14.10-haa5651f_5 --> 1.14.8-0 curl: 7.55.1-hcb0b314_2 --> 7.52.1-0 dbus: 1.10.22-h3b5a359_0 --> 1.10.20-0 fontconfig: 2.12.4-h88586e7_1 --> 2.12.1-3 freetype: 2.8-h52ed37b_0 --> 2.5.5-2 glib: 2.53.6-hc861d11_1 --> 2.50.2-1 gst-plugins-base: 1.12.2-he3457e5_0 --> 1.8.0-0 gstreamer: 1.12.2-h4f93127_0 --> 1.8.0-0 h5py: 2.7.0-py36he81ebca_1 --> 2.7.0-np113py36_0 harfbuzz: 1.5.0-h2545bd6_0 --> 0.9.39-2 hdf5: 1.10.1-hb0523eb_0 --> 1.8.17-2 icu: 58.2-h211956c_0 --> 54.1-0 libpng: 1.6.32-hda9c8bc_2 --> 1.6.30-1 libtiff: 4.0.8-h90200ff_9 --> 4.0.6-3 libxml2: 2.9.4-h6b072ca_5 --> 2.9.4-0 libxslt: 1.1.29-hcf9102b_5 --> 1.1.29-0 matplotlib: 2.1.0-py36hba5de38_0 --> 2.0.2-np113py36_0 pango: 1.40.11-h8191d47_0 --> 1.40.3-1 pcre: 8.41-hc71a17e_0 --> 8.39-1 pycurl: 7.43.0-py36h5e72054_3 --> 7.43.0-py36_2 pyqt: 5.6.0-py36h0386399_5 --> 5.6.0-py36_2 pytables: 3.4.2-py36h3b5282a_2 --> 3.4.2-np113py36_0 python: 3.6.3-hc9025b9_1 --> 3.6.2-0 qt: 5.6.2-h974d657_12 --> 5.6.2-5 readline: 7.0-hac23ff0_3 --> 6.2-2 sqlite: 3.20.1-h6d8b0f3_1 --> 3.13.0-0 tk: 8.6.7-h5979e9b_1 --> 8.5.18-0 zlib: 1.2.11-hfbfcf68_1 --> 1.2.8-3 ``` ---- So, basically `conda 4.4.x` has a problem with "orphan" packages that don't have their specs in `conda-meta/history`. The first reproducer installs `fontconfig`, a package that depends on `libpng` and `libxml2` which both depends on `zlib` (`>=1.2.11` for the versions being installed). If `fontconfig` is installed, `libpng` and `libxml2` remain in the environment but don't have any specs about themselves in `history`. If we now try to install a `zlib <1.2.11`, we get ``` UnsatisfiableError: The following specifications were found to be in conflict: - libxml2 -> zlib[version='>=1.2.11,<1.3.0a0'] - zlib[version='<1.2.11'] ``` . Interestingly this only happens if we have at least two packages depending on `zlib`. If we remove either of `libpng` or `libxml2`, the packages get downgraded as expected. The second reproducer shows that this could be a quite common case for `anaconda` users. If you install `anaconda=5.0.1` this will also install `conda=4.3.30` (due to `pycosat` being downgraded, I think). Now, `conda 4.3.x` doesn't seem to update the specs for `anaconda` when `anaconda=5.0.1` gets replaced by `anaconda=custom` (so, that one is a bug in `conda <4.4`!). If we have updated to `conda 4.4.x`, the history still has the `anaconda=5.0.1` and thus a `zlib <1.2.11` install will fail as it would imply package downgrades and thus `anaconda=custom`. The last commands of the reproducer show that if you install `anaconda=custom`, everything works as expected since the prior conflict is resolved. Now, if you uninstall `anaconda`, you have the same case as with the first reproducer with `fontconfig`: The remaining packages are not (transitively) associated with any specs in `history`. If you reinstall `anaconda`, then again, order is restored. The `anaconda` related issue was reported in https://github.com/bioconda/bioconda-recipes/issues/7202. This bug appears not to have been fully fixed. I just encountered it when upgrading from 4.2 -> 4.5.1 ``` Solving environment: failed CondaValueError: Invalid MatchSpec: <4.0 ``` It took some digging, but I found the offending line: ``` # install specs: python>=3.5.1,jupyter >=1.0.0,<2.0,matplotlib >=1.5.1,<2.0,numpy >=1.11.0,<2.0,pandas >=0.19.2,<1.0,psycopg2 >=2.6.1,<3.0,pyyaml >=3.12,<4.0,scipy >=0.17.0,<1.0 ``` I have just seen the same issue with 4.5.1.
2018-06-14T14:37:44
conda/conda
7,476
conda__conda-7476
[ "1024" ]
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'
diff --git a/docs/source/user-guide/tutorials/pyslalib/run_test.py b/docs/source/user-guide/tutorials/pyslalib/run_test.py new file mode 100644 --- /dev/null +++ b/docs/source/user-guide/tutorials/pyslalib/run_test.py @@ -0,0 +1,1444 @@ +from pyslalib import slalib as S +import numpy as N +import numpy.testing as T +import math +import unittest + +# +# Note: This file is based on the sla_test.f file that is used +# to test the Fortran version of the code. +# +# Scott M. Ransom <[email protected]>, 2007 +# + +# Copied from https://github.com/scottransom/pyslalib/blob/master/test/test_slalib.py +# stored as run_test.py for automatic test running with conda build +# Edited 2016 by Michael Sarahan for Python 3 string comparison compatibility + +# The Fortran code always returns byte strings. Python 2 is happy with this, +# as it is its default string representation. Python 3 requires more care. + +# The strategy taken here is to force test values that we provide to be +# bytestrings, so that they can be compared with the fortran output. + +# None of the numeric code is affected by Python 2 vs Python 3. + +def safe_str(obj): + """ return the byte string representation of obj """ + if hasattr(obj, "encode"): + obj = obj.encode('unicode_escape') + return obj + +class TestSLALIBFunctions(unittest.TestCase): + + def testaddet(self): + rm = 2.0 + dm = -1.0 + eq = 1975.0 + r1, d1 = S.sla_addet(rm, dm, eq) + T.assert_almost_equal(r1 - rm, 2.983864874295250e-6, 12, 'sla_addet, r1') + T.assert_almost_equal(d1 - dm, 2.379650804185118e-7, 12, 'sla_addet, d1') + r2, d2 = S.sla_subet(r1, d1, eq) + T.assert_almost_equal(r2 - rm, 0, 12, 'sla_subet, r2') + T.assert_almost_equal(d2 - dm, 0, 12, 'sla_subet, d2') + + def testafin(self): + s = '12 34 56.7 |' + i = 1 + i, f, j = S.sla_afin(s, i) + T.assert_equal(i, 12, 'sla_afin, i') + T.assert_almost_equal(f, 0.2196045986911432, 6, 'sla_afin, a') + T.assert_equal(j, 0, 'sla_afin, j') + i = 1 + i, d, j = S.sla_dafin(s, i) + T.assert_equal(i, 12, 'sla_dafin, i') + T.assert_almost_equal(d, 0.2196045986911432, 12, 'sla_dafin, a') + T.assert_equal(j, 0, 'sla_dafin, j') + + def testairmas(self): + T.assert_almost_equal(S.sla_airmas(1.2354), 3.015698990074724, + 12, 'sla_airmas') + + def testaltaz(self): + (az, azd, azdd, el, eld, eldd, pa, pad, padd) = \ + S.sla_altaz(0.7, -0.7, -0.65) + T.assert_almost_equal(az, 4.400560746660174, 12, 'sla_altaz, az') + T.assert_almost_equal(azd, -0.2015438937145421, 13, 'sla_altaz, azd') + T.assert_almost_equal(azdd, -0.4381266949668748, 13, 'sla_altaz, azdd') + T.assert_almost_equal(el, 1.026646506651396, 12, 'sla_altaz, el') + T.assert_almost_equal(eld, -0.7576920683826450, 13, 'sla_altaz, eld') + T.assert_almost_equal(eldd, 0.04922465406857453, 14, 'sla_altaz, eldd') + T.assert_almost_equal(pa, 1.707639969653937, 12, 'sla_altaz, pa') + T.assert_almost_equal(pad, 0.4717832355365627, 13, 'sla_altaz, pad') + T.assert_almost_equal(padd, -0.2957914128185515, 13, 'sla_altaz, padd') + + def testamp(self): + rm, dm = S.sla_amp(2.345, -1.234, 50100.0, 1990.0) + T.assert_almost_equal(rm, 2.344472180027961, 11, 'sla_amp, r') + T.assert_almost_equal(dm, -1.233573099847705, 11, 'sla_amp, d') + + def testaop(self): + ds2r = 7.2722052166430399038487115353692196393452995355905e-5 + dap = -0.1234 + date = 51000.1 + dut = 25.0 + elongm = 2.1 + phim = 0.5 + hm = 3000.0 + xp = -0.5e-6 + yp = 1e-6 + tdk = 280.0 + pmb = 550.0 + rh = 0.6 + tlr = 0.006 + for i in [1, 2, 3]: + if i == 1: + rap = 2.7 + wl = 0.45 + elif i == 2: + rap = 2.345 + else: + wl = 1e6 + aob, zob, hob, dob, rob = S.sla_aop(rap, dap, date, dut, + elongm, phim, hm, xp, yp, + tdk, pmb, rh, wl, tlr) + if i == 1: + T.assert_almost_equal(aob, 1.812817787123283034, 10, 'sla_aop, lo aob') + T.assert_almost_equal(zob, 1.393860816635714034, 10, 'sla_aop, lo zob') + T.assert_almost_equal(hob, -1.297808009092456683, 10, 'sla_aop, lo hob') + T.assert_almost_equal(dob, -0.122967060534561, 10, 'sla_aop, lo dob') + T.assert_almost_equal(rob, 2.699270287872084, 10, 'sla_aop, lo rob') + elif i == 2: + T.assert_almost_equal(aob, 2.019928026670621442, 10, 'sla_aop, aob/o') + T.assert_almost_equal(zob, 1.101316172427482466, 10, 'sla_aop, zob/o') + T.assert_almost_equal(hob, -0.9432923558497740862, 10, 'sla_aop, hob/o') + T.assert_almost_equal(dob, -0.1232144708194224, 10, 'sla_aop, dob/o') + T.assert_almost_equal(rob, 2.344754634629428, 10, 'sla_aop, rob/o') + else: + T.assert_almost_equal(aob, 2.019928026670621442, 10, 'sla_aop, aob/r') + T.assert_almost_equal(zob, 1.101267532198003760, 10, 'sla_aop, zob/r') + T.assert_almost_equal(hob, -0.9432533138143315937, 10, 'sla_aop, hob/r') + T.assert_almost_equal(dob, -0.1231850665614878, 10, 'sla_aop, dob/r') + T.assert_almost_equal(rob, 2.344715592593984, 10, 'sla_aop, rob/r') + date = 48000.3 + wl = 0.45 + aoprms = S.sla_aoppa(date, dut, elongm, phim, hm, xp, yp, tdk, pmb, rh, wl, tlr) + T.assert_almost_equal(aoprms[0], 0.4999993892136306, 13, 'sla_aoppa, 1') + T.assert_almost_equal(aoprms[1], 0.4794250025886467, 13, 'sla_aoppa, 2') + T.assert_almost_equal(aoprms[2], 0.8775828547167932, 13, 'sla_aoppa, 3') + T.assert_almost_equal(aoprms[3], 1.363180872136126e-6, 13, 'sla_aoppa, 4') + T.assert_almost_equal(aoprms[4], 3000.0, 10, 'sla_aoppa, 5') + T.assert_almost_equal(aoprms[5], 280.0, 11, 'sla_aoppa, 6') + T.assert_almost_equal(aoprms[6], 550.0, 11, 'sla_aoppa, 7') + T.assert_almost_equal(aoprms[7], 0.6, 13, 'sla_aoppa, 8') + T.assert_almost_equal(aoprms[8], 0.45, 13, 'sla_aoppa, 9') + T.assert_almost_equal(aoprms[9], 0.006, 15, 'sla_aoppa, 10') + T.assert_almost_equal(aoprms[10], 0.0001562803328459898, 13, 'sla_aoppa, 11') + T.assert_almost_equal(aoprms[11], -1.792293660141e-7, 13, 'sla_aoppa, 12') + T.assert_almost_equal(aoprms[12], 2.101874231495843, 13, 'sla_aoppa, 13') + T.assert_almost_equal(aoprms[13], 7.601916802079765, 8, 'sla_aoppa, 14') + rap, dap = S.sla_oap('r', 1.6, -1.01, date, dut, elongm, phim, + hm, xp, yp, tdk, pmb, rh, wl, tlr) + T.assert_almost_equal(rap, 1.601197569844787, 10, 'sla_oap, rr') + T.assert_almost_equal(dap, -1.012528566544262, 10, 'sla_oap, rd') + rap, dap = S.sla_oap('h', -1.234, 2.34, date, dut, elongm, phim, + hm, xp, yp, tdk, pmb, rh, wl, tlr) + T.assert_almost_equal(rap, 5.693087688154886463, 10, 'sla_oap, hr') + T.assert_almost_equal(dap, 0.8010281167405444, 10, 'sla_oap, hd') + rap, dap = S.sla_oap('a', 6.1, 1.1, date, dut, elongm, phim, + hm, xp, yp, tdk, pmb, rh, wl, tlr) + T.assert_almost_equal(rap, 5.894305175192448940, 10, 'sla_oap, ar') + T.assert_almost_equal(dap, 1.406150707974922, 10, 'sla_oap, ad') + rap, dap = S.sla_oapqk('r', 2.1, -0.345, aoprms) + T.assert_almost_equal(rap, 2.10023962776202, 10, 'sla_oapqk, rr') + T.assert_almost_equal(dap, -0.3452428692888919, 10, 'sla_oapqk, rd') + rap, dap = S.sla_oapqk('h', -0.01, 1.03, aoprms) + T.assert_almost_equal(rap, 1.328731933634564995, 10, 'sla_oapqk, hr') + T.assert_almost_equal(dap, 1.030091538647746, 10, 'sla_oapqk, hd') + rap, dap = S.sla_oapqk('a', 4.321, 0.987, aoprms) + T.assert_almost_equal(rap, 0.4375507112075065923, 10, 'sla_oapqk, ar') + T.assert_almost_equal(dap, -0.01520898480744436, 10, 'sla_oapqk, ad') + S.sla_aoppat(date + ds2r, aoprms) + T.assert_almost_equal(aoprms[13], 7.602374979243502, 8, 'sla_aoppat') + + def testbear(self): + a1 = 1.234 + b1 = -0.123 + a2 = 2.345 + b2 = 0.789 + T.assert_almost_equal(S.sla_bear(a1, b1, a2, b2), + 0.7045970341781791, 6, 'sla_bear') + T.assert_almost_equal(S.sla_dbear(a1, b1, a2, b2), + 0.7045970341781791, 12, 'sla_dbear') + d1 = S.sla_dcs2c(a1, b1) + d2 = S.sla_dcs2c(a2, b2) + T.assert_almost_equal(S.sla_pav(d1, d2), 0.7045970341781791, + 6, 'sla_pav') + T.assert_almost_equal(S.sla_dpav(d1, d2), 0.7045970341781791, + 12, 'sla_dpav') + + def testcaf2r(self): + r, j = S.sla_caf2r(76, 54, 32.1) + T.assert_almost_equal(r, 1.342313819975276, 6, 'sla_caf2r, r') + T.assert_equal(j, 0, 'sla_caf2r, j') + dr, j = S.sla_daf2r(76, 54, 32.1) + T.assert_almost_equal(dr, 1.342313819975276, 12, 'sla_daf2r, r') + T.assert_equal(j, 0, 'sla_caf2r, j') + + def testcaldj(self): + djm, j = S.sla_caldj(1999, 12, 31) + T.assert_almost_equal(djm, 51543.0, 15, 'sla_caldj') + + def testcalyd(self): + ny, nd, j = S.sla_calyd(46, 4, 30) + T.assert_equal(ny, 2046, 'sla_calyd, y') + T.assert_equal(nd, 120, 'sla_calyd, d') + T.assert_equal(j, 0, 'sla_calyd, j') + ny, nd, j = S.sla_clyd(-5000, 1, 1) + T.assert_equal(j, 1, 'sla_clyd, illegal year') + ny, nd, j = S.sla_clyd(1900, 0, 1) + T.assert_equal(j, 2, 'sla_clyd, illegal month') + ny, nd, j = S.sla_clyd(1900, 2, 29) + T.assert_equal(ny, 1900, 'sla_clyd, illegal day (y)') + T.assert_equal(nd, 61, 'sla_clyd, illegal day (d)') + T.assert_equal(j, 3, 'sla_clyd, illegal day (j)') + ny, nd, j = S.sla_clyd(2000, 2, 29) + T.assert_equal(ny, 2000, 'sla_clyd, y') + T.assert_equal(nd, 60, 'sla_clyd, d') + T.assert_equal(j, 0, 'sla_clyd, j') + + def testcc2s(self): + v = N.asarray([100.0, -50.0, 25.0]) + a, b = S.sla_cc2s(v) + T.assert_almost_equal(a, -0.4636476090008061, 6, 'sla_cc2s, a') + T.assert_almost_equal(b, 0.2199879773954594, 6, 'sla_cc2s, b') + da, db = S.sla_dcc2s(v) + T.assert_almost_equal(da, -0.4636476090008061, 12, 'sla_dcc2s, a') + T.assert_almost_equal(db, 0.2199879773954594, 12, 'sla_dcc2s, b') + + def testcc62s(self): + v = N.asarray([100.0, -50.0, 25.0, -0.1, 0.2, 0.7]) + a, b, r, ad, bd, rd = S.sla_cc62s(v) + T.assert_almost_equal(a, -0.4636476090008061, 6, 'sla_cc62s, a') + T.assert_almost_equal(b, 0.2199879773954594, 6, 'sla_cc62s, b') + T.assert_almost_equal(r, 114.564392373896, 3, 'sla_cc62s, r') + T.assert_almost_equal(ad, 0.001200000000000000, 9, 'sla_cc62s, ad') + T.assert_almost_equal(bd, 0.006303582107999407, 8, 'sla_cc62s, bd') + T.assert_almost_equal(rd, -0.02182178902359925, 7, 'sla_cc62s, rd') + da, db, dr, dad, dbd, drd = S.sla_dc62s(v) + T.assert_almost_equal(da, -0.4636476090008061, 6, 'sla_dc62s, a') + T.assert_almost_equal(db, 0.2199879773954594, 6, 'sla_dc62s, b') + T.assert_almost_equal(dr, 114.564392373896, 9, 'sla_dc62s, r') + T.assert_almost_equal(dad, 0.001200000000000000, 15, 'sla_dc62s, ad') + T.assert_almost_equal(dbd, 0.006303582107999407, 14, 'sla_dc62s, bd') + T.assert_almost_equal(drd, -0.02182178902359925, 13, 'sla_dc62s, rd') + + def testcd2tf(self): + s, ihmsf = S.sla_cd2tf(4, -0.987654321) + T.assert_equal(s, safe_str('-'), 'sla_cd2tf, s') + T.assert_equal(ihmsf[0], 23, 'sla_cd2tf, (1)') + T.assert_equal(ihmsf[1], 42, 'sla_cd2tf, (2)') + T.assert_equal(ihmsf[2], 13, 'sla_cd2tf, (3)') + T.assert_almost_equal(ihmsf[3], 3333, -3, 'sla_cd2tf, (4)') + s, ihmsf = S.sla_dd2tf(4, -0.987654321) + T.assert_equal(s, safe_str('-'), 'sla_dd2tf, s') + T.assert_equal(ihmsf[0], 23, 'sla_dd2tf, (1)') + T.assert_equal(ihmsf[1], 42, 'sla_dd2tf, (2)') + T.assert_equal(ihmsf[2], 13, 'sla_dd2tf, (3)') + T.assert_equal(ihmsf[3], 3333, 'sla_dd2tf, (4)') + + def testcldj(self): + d, j = S.sla_cldj(1899, 12, 31) + T.assert_almost_equal(d, 15019.0, 15, 'sla_cldj, d') + T.assert_equal(j, 0, 'sla_cldj, j') + + def testcr2af(self): + s, idmsf = S.sla_cr2af(4, 2.345) + T.assert_equal(s, safe_str('+'), 'sla_cr2af, s') + T.assert_equal(idmsf[0], 134, 'sla_cr2af, (1)') + T.assert_equal(idmsf[1], 21, 'sla_cr2af, (2)') + T.assert_equal(idmsf[2], 30, 'sla_cr2af, (3)') + T.assert_almost_equal(idmsf[3], 9706, -3, 'sla_cr2af, (4)') + s, idmsf = S.sla_dr2af(4, 2.345) + T.assert_equal(s, safe_str('+'), 'sla_dr2af, s') + T.assert_equal(idmsf[0], 134, 'sla_dr2af, (1)') + T.assert_equal(idmsf[1], 21, 'sla_dr2af, (2)') + T.assert_equal(idmsf[2], 30, 'sla_dr2af, (3)') + T.assert_equal(idmsf[3], 9706, 'sla_dr2af, (4)') + + def testcr2tf(self): + s, ihmsf = S.sla_cr2tf(4, -3.01234) + T.assert_equal(s, safe_str('-'), 'sla_cr2tf, s') + T.assert_equal(ihmsf[0], 11, 'sla_cr2tf, (1)') + T.assert_equal(ihmsf[1], 30, 'sla_cr2tf, (2)') + T.assert_equal(ihmsf[2], 22, 'sla_cr2tf, (3)') + T.assert_almost_equal(ihmsf[3], 6484, -3, 'sla_cr2tf, (4)') + s, ihmsf = S.sla_dr2tf(4, -3.01234) + T.assert_equal(s, safe_str('-'), 'sla_dr2tf, s') + T.assert_equal(ihmsf[0], 11, 'sla_dr2tf, (1)') + T.assert_equal(ihmsf[1], 30, 'sla_dr2tf, (2)') + T.assert_equal(ihmsf[2], 22, 'sla_dr2tf, (3)') + T.assert_equal(ihmsf[3], 6484, 'sla_dr2tf, (4)') + + def testcs2c6(self): + v = S.sla_cs2c6(-3.21, 0.123, 0.456, + -7.8e-6, 9.01e-6, -1.23e-5) + ans = N.asarray([-0.4514964673880165, 0.03093394277342585, + 0.05594668105108779, 1.292270850663260e-5, + 2.652814182060692e-6, 2.568431853930293e-6]) + T.assert_array_almost_equal(v, ans, 6, 'sla_cs2c6') + dv = S.sla_ds2c6(-3.21, 0.123, 0.456, + -7.8e-6, 9.01e-6, -1.23e-5) + T.assert_array_almost_equal(dv, ans, 12, 'sla_ds2c6') + + def testctf2d(self): + d, j = S.sla_ctf2d(23, 56, 59.1e0) + T.assert_almost_equal(d, 0.99790625, 6, 'sla_ctf2d, d') + T.assert_equal(j, 0, 'sla_ctf2d, j') + dd, j = S.sla_dtf2d(23, 56, 59.1) + T.assert_almost_equal(dd, 0.99790625, 12, 'sla_dtf2d, d') + T.assert_equal(j, 0, 'sla_dtf2d, j') + + def testctf2r(self): + r, j = S.sla_ctf2r(23, 56, 59.1) + T.assert_almost_equal(r, 6.270029887942679, 6, 'sla_ctf2r, r') + T.assert_equal(j, 0, 'sla_ctf2r, j') + dr, j = S.sla_dtf2r(23, 56, 59.1) + T.assert_almost_equal(dr, 6.270029887942679, 12, 'sla_dtf2r, r') + T.assert_equal(j, 0, 'sla_dtf2r, j') + + def testdat(self): + T.assert_almost_equal(S.sla_dat(43900), 18, 0, 'sla_dat') + T.assert_almost_equal(S.sla_dtt(40404), 39.709746, 12, 'sla_dtt') + T.assert_almost_equal(S.sla_dt(500), 4686.7, 10, 'sla_dt, 500') + T.assert_almost_equal(S.sla_dt(1400), 408, 11, 'sla_dt, 1400') + T.assert_almost_equal(S.sla_dt(1950), 27.99145626, 12, 'sla_dt, 1950') + + def testdbjin(self): + s = ' b1950, , j 2000, b1975 je ' + i = 1 + i, d, ja, jb = S.sla_dbjin(s, i) + T.assert_equal(i, 9, 'sla_dbjin, i1') + T.assert_almost_equal(d, 1950, 15, 'sla_dbjin, d1') + T.assert_equal(ja, 0, 'sla_dbjin, ja1') + T.assert_equal(jb, 1, 'sla_dbjin, jb1') + i, d, ja, jb = S.sla_dbjin(s, i) + T.assert_equal(i, 11, 'sla_dbjin, i2') + # this is different than in slalib_test.f since 'd' + # is output only and the value doesn't pass through + T.assert_almost_equal(d, 0.0, 15, 'sla_dbjin, d2') + T.assert_equal(ja, 1, 'sla_dbjin, ja2') + T.assert_equal(jb, 0, 'sla_dbjin, jb2') + i, d, ja, jb = S.sla_dbjin(s, i) + T.assert_equal(i, 19, 'sla_dbjin, i3') + T.assert_almost_equal(d, 2000, 15, 'sla_dbjin, d3') + T.assert_equal(ja, 0, 'sla_dbjin, ja3') + T.assert_equal(jb, 2, 'sla_dbjin, jb3') + i, d, ja, jb = S.sla_dbjin(s, i) + T.assert_equal(i, 26, 'sla_dbjin, i4') + T.assert_almost_equal(d, 1975, 15, 'sla_dbjin, d4') + T.assert_equal(ja, 0, 'sla_dbjin, ja4') + T.assert_equal(jb, 1, 'sla_dbjin, jb4') + i, d, ja, jb = S.sla_dbjin(s, i) + T.assert_equal(i, 26, 'sla_dbjin, i5') + # this is different than in slalib_test.f since 'd' + # is output only and the value doesn't pass through + T.assert_almost_equal(d, 0.0, 15, 'sla_dbjin, d5') + T.assert_equal(ja, 1, 'sla_dbjin, ja5') + T.assert_equal(jb, 0, 'sla_dbjin, jb5') + + def testdjcal(self): + djm = 50123.9999 + iydmf, j = S.sla_djcal(4, djm) + T.assert_equal(iydmf[0], 1996, 'sla_djcal, y') + T.assert_equal(iydmf[1], 2, 'sla_djcal, m') + T.assert_equal(iydmf[2], 10, 'sla_djcal, d') + T.assert_equal(iydmf[3], 9999, 'sla_djcal, f') + T.assert_equal(j, 0, 'sla_djcal, j') + iy, im, id, f, j = S.sla_djcl(djm) + T.assert_equal(iy, 1996, 'sla_djcl, y') + T.assert_equal(im, 2, 'sla_djcl, m') + T.assert_equal(id, 10, 'sla_djcl, d') + T.assert_almost_equal(f, 0.9999, 7, 'sla_djcl, f') + T.assert_equal(j, 0, 'sla_djcl, j') + + def testdmat(self): + da = N.asarray([[2.22, 1.6578, 1.380522], + [1.6578, 1.380522, 1.22548578], + [1.380522, 1.22548578, 1.1356276122]]) + dv = N.asarray([2.28625, 1.7128825, 1.429432225]) + da, dv, dd, j, iw = S.sla_dmat(da, dv, N.empty(3.0)) + ans = N.asarray([[18.02550629769198, -52.16386644917280607, 34.37875949717850495], + [-52.16386644917280607, 168.1778099099805627, -118.0722869694232670], + [34.37875949717850495, -118.0722869694232670, 86.50307003740151262]]) + T.assert_array_almost_equal(da, ans, 10, 'sla_dmat, a(3,3)') + ans = N.asarray([1.002346480763383, 0.03285594016974583489, 0.004760688414885247309]) + T.assert_array_almost_equal(dv, ans, 12, 'sla_dmat, v(3)') + T.assert_almost_equal(dd, 0.003658344147359863, 12, 'sla_dmat, d') + T.assert_equal(j, 0, 'sla_dmat, j') + + def teste2h(self): + dh = -0.3 + dd = -1.1 + dp = -0.7 + da, de = S.sla_de2h(dh, dd, dp) + T.assert_almost_equal(da, 2.820087515852369, 12, 'sla_de2h, az') + T.assert_almost_equal(de, 1.132711866443304, 12, 'sla_de2h, el') + a, e = S.sla_e2h(dh, dd, dp) + T.assert_almost_equal(a, 2.820087515852369, 6, 'sla_e2h, az') + T.assert_almost_equal(e, 1.132711866443304, 6, 'sla_e2h, el') + dh, dd = S.sla_dh2e(da, de, dp) + T.assert_almost_equal(dh, -0.3, 12, 'sla_dh2e, ha') + T.assert_almost_equal(dd, -1.1, 12, 'sla_dh2e, dec') + h, d = S.sla_h2e(da, de, dp) + T.assert_almost_equal(h, -0.3, 6, 'sla_h2e, ha') + T.assert_almost_equal(d, -1.1, 6, 'sla_h2e, dec') + + def testearth(self): + pv = S.sla_earth(1978, 174, 0.87) + T.assert_almost_equal(pv[0], 3.590867086e-2, 6, 'sla_earth, pv(1)') + T.assert_almost_equal(pv[1], -9.319285116e-1, 6, 'sla_earth, pv(2)') + T.assert_almost_equal(pv[2], -4.041039435e-1, 6, 'sla_earth, pv(3)') + T.assert_almost_equal(pv[3], 1.956930055e-7, 13, 'sla_earth, pv(4)') + T.assert_almost_equal(pv[4], 5.743797400e-9, 13, 'sla_earth, pv(5)') + T.assert_almost_equal(pv[5], 2.512001677e-9, 13, 'sla_earth, pv(6)') + + def testecleq(self): + r, d = S.sla_ecleq(1.234, -0.123, 43210) + T.assert_almost_equal(r, 1.229910118208851, 12, 'sla_ecleq, ra') + T.assert_almost_equal(d, 0.2638461400411088, 12, 'sla_ecleq, dec') + + def testecmat(self): + rm = S.sla_ecmat(41234) + ans = N.asarray([[1.0, 0.0, 0.0], + [0.0, 0.917456575085716, 0.397835937079581], + [0.0, -0.397835937079581, 0.917456575085716]]) + T.assert_array_almost_equal(rm, ans, 12, 'sla_ecmat') + + def testecor(self): + rv, tl = S.sla_ecor(2.345, -0.567, 1995, 306, 0.037) + T.assert_almost_equal(rv, -19.182460, 3, 'sla_ecor, rv') + T.assert_almost_equal(tl, -120.36632, 2, 'sla_ecor, tl') + + def testeg50(self): + dl, db = S.sla_eg50(3.012, 1.234) + T.assert_almost_equal(dl, 2.305557953813397, 12, 'sla_eg50, l') + T.assert_almost_equal(db, 0.7903600886585871, 12, 'sla_eg50, b') + + def testepb(self): + T.assert_almost_equal(S.sla_epb(45123), 1982.419793168669, + 8, 'sla_epb') + + def testepb2d(self): + T.assert_almost_equal(S.sla_epb2d(1975.5), 42595.5995279655, + 7, 'sla_epb2d') + + def testepco(self): + T.assert_almost_equal(S.sla_epco('b', 'j', 2000), + 2000.001277513665, 7, 'sla_epco, bj') + T.assert_almost_equal(S.sla_epco('j', 'b', 1950), + 1949.999790442300, 7, 'sla_epco, jb') + T.assert_almost_equal(S.sla_epco('j', 'j', 2000), + 2000, 7, 'sla_epco, jj') + + def testepj(self): + T.assert_almost_equal(S.sla_epj(42999), 1976.603696098563, + 7, 'sla_epj') + + def testepj2d(self): + T.assert_almost_equal(S.sla_epj2d(2010.077), 55225.124250, + 6, 'sla_epj2d') + + def testeqecl(self): + dl, db = S.sla_eqecl(0.789, -0.123, 46555) + T.assert_almost_equal(dl, 0.7036566430349022, 12, 'sla_eqecl, l') + T.assert_almost_equal(db, -0.4036047164116848, 12, 'sla_eqecl, b') + + def testeqeqx(self): + T.assert_almost_equal(S.sla_eqeqx(41234), 5.376047445838358596e-5, + 17, 'sla_eqeqx') + + def testeqgal(self): + dl, db = S.sla_eqgal(5.67, -1.23) + T.assert_almost_equal(dl, 5.612270780904526, 12, 'sla_eqgal, dl') + T.assert_almost_equal(db, -0.6800521449061520, 12, 'sla_eqgal, db') + + def testetrms(self): + ev = S.sla_etrms(1976.9) + ans = N.asarray([-1.621617102537041e-6, + -3.310070088507914e-7, + -1.435296627515719e-7]) + T.assert_array_almost_equal(ev, ans, 18, 'sla_etrms') + + def testevp(self): + dvb, dpb, dvh, dph = S.sla_evp(50100, 1990) + ans1 = N.asarray([-1.807210068604058436e-7, + -8.385891022440320e-8, + -3.635846882638055e-8]) + T.assert_array_almost_equal(dvb, ans1, 14, 'sla_evp, dvb') + ans2 = N.asarray([-0.4515615297360333, + 0.8103788166239596, + 0.3514505204144827]) + T.assert_array_almost_equal(dpb, ans2, 7, 'sla_evp, dpb') + ans3 = N.asarray([-1.806354061156890855e-7, + -8.383798678086174e-8, + -3.635185843644782e-8]) + T.assert_array_almost_equal(dvh, ans3, 14, 'sla_evp, dvh') + ans4 = N.asarray([-0.4478571659918565, + 0.8036439916076232, + 0.3484298459102053]) + T.assert_array_almost_equal(dph, ans4, 7, 'sla_evp, dph') + dph, dvh, dpb, dvb = S.sla_epv(53411.52501161) + ans1 = N.asarray([-0.7757238809297653, + +0.5598052241363390, + +0.2426998466481708]) + T.assert_array_almost_equal(dph, ans1, 12, 'sla_epv, dph') + ans2 = N.asarray([-0.0109189182414732, + -0.0124718726844084, + -0.0054075694180650]) + T.assert_array_almost_equal(dvh, ans2, 12, 'sla_epv, dvh') + ans3 = N.asarray([-0.7714104440491060, + +0.5598412061824225, + +0.2425996277722475]) + T.assert_array_almost_equal(dpb, ans3, 12, 'sla_epv, dpb') + ans4 = N.asarray([-0.0109187426811683, + -0.0124652546173285, + -0.0054047731809662]) + T.assert_array_almost_equal(dvb, ans4, 12, 'sla_epv, dvb') + + def testfitxy(self): + xye = N.asarray([-23.4, -12.1, 32, -15.3, + 10.9, 23.7, -3, 16.1, + 45, 32.5, 8.6, -17, + 15.3, 10, 121.7, -3.8]) + # The reshaping is necessary due to C/Fortran order + xye = N.reshape(xye, (2, 8), order='Fortran') + xym = N.asarray([-23.41, 12.12, 32.03, 15.34, + 10.93, -23.72, -3.01, -16.10, + 44.90, -32.46, 8.55, 17.02, + 15.31, -10.07, 120.92, 3.81]) + # The reshaping is necessary due to C/Fortran order + xym = N.reshape(xym, (2, 8), order='Fortran') + coeffs, j = S.sla_fitxy(4, xye, xym) + ans1 = N.asarray([-7.938263381515947e-3, 1.004640925187200, + 3.976948048238268e-4, -2.501031681585021e-2, + 3.976948048238268e-4, -1.004640925187200]) + T.assert_array_almost_equal(coeffs, ans1, 12, 'sla_fitxy, 4/coeffs') + T.assert_equal(j, 0, 'sla_fitxy, 4/j') + coeffs, j = S.sla_fitxy(6, xye, xym) + ans2 = N.asarray([-2.617232551841476e-2, 1.005634905041421, + 2.133045023329208e-3, 3.846993364417779909e-3, + 1.301671386431460e-4, -0.9994827065693964]) + T.assert_array_almost_equal(coeffs, ans2, 12, 'sla_fitxy, 6/coeffs') + T.assert_equal(j, 0, 'sla_fitxy, 6/j') + xyp, xrms, yrms, rrms = S.sla_pxy(xye, xym, coeffs) + ans3 = N.asarray([-23.542232946855340, -12.11293062297230597, + 32.217034593616180, -15.324048471959370, + 10.914821358630950, 23.712999520015880, + -3.087475414568693, 16.09512676604438414, + 45.05759626938414666, 32.45290015313210889, + 8.608310538882801, -17.006235743411300, + 15.348618307280820, 10.07063070741086835, + 121.5833272936291482, -3.788442308260240]) + # And another reshaping... + ans3 = N.reshape(ans3, (2, 8), order='Fortran') + T.assert_array_almost_equal(xyp, ans3, 12, 'sla_fitxy, xyp') + T.assert_almost_equal(xrms, 0.1087247110488075, 13, 'sla_pxy, xrms') + T.assert_almost_equal(yrms, 0.03224481175794666, 13, 'sla_pxy, yrms') + T.assert_almost_equal(rrms, 0.1134054261398109, 13, 'sla_pxy, rrms') + bkwds, j = S.sla_invf(coeffs) + ans4 = N.asarray([0.02601750208015891, 0.9943963945040283, + 0.002122190075497872, 0.003852372795357474353, + 0.0001295047252932767, -1.000517284779212]) + T.assert_array_almost_equal(bkwds, ans4, 12, 'sla_invf, 6') + T.assert_equal(j, 0, 'sla_invf, j') + x2, y2 = S.sla_xy2xy(44.5, 32.5, coeffs) + T.assert_almost_equal(x2, 44.793904912083030, 11, 'sla_xy2xy, x') + T.assert_almost_equal(y2, -32.473548532471330, 11, 'sla_xy2xy, y') + xz, yz, xs, ys, perp, orient = S.sla_dcmpf(coeffs) + T.assert_almost_equal(xz, -0.0260175020801628646, 12, 'sla_dcmpf, xz') + T.assert_almost_equal(yz, -0.003852372795357474353, 12, 'sla_dcmpf, yz') + T.assert_almost_equal(xs, -1.00563491346569, 12, 'sla_dcmpf, xs') + T.assert_almost_equal(ys, 0.999484982684761, 12, 'sla_dcmpf, ys') + T.assert_almost_equal(perp, -0.002004707996156263, 12, 'sla_dcmpf, p') + T.assert_almost_equal(orient, 3.14046086182333, 12, 'sla_dcmpf, o') + + def testfk425(self): + r2000, d2000, dr2000, dd2000, p2000, v2000 = \ + S.sla_fk425(1.234, -0.123, -1e-5, 2e-6, 0.5, 20) + T.assert_almost_equal(r2000, 1.244117554618727, 12, 'sla_fk425, r') + T.assert_almost_equal(d2000, -0.1213164254458709, 12, 'sla_fk425, d') + T.assert_almost_equal(dr2000, -9.964265838268711e-6, 17, 'sla_fk425, dr') + T.assert_almost_equal(dd2000, 2.038065265773541e-6, 17, 'sla_fk425, dd') + T.assert_almost_equal(p2000, 0.4997443812415410, 12, 'sla_fk425, p') + T.assert_almost_equal(v2000, 20.010460915421010, 11, 'sla_fk425, v') + + def testfk45z(self): + r2000, d2000 = S.sla_fk45z(1.234, -0.123, 1984) + T.assert_almost_equal(r2000, 1.244616510731691, 12, 'sla_fk45z, r') + T.assert_almost_equal(d2000, -0.1214185839586555, 12, 'sla_fk45z, d') + + def testfk524(self): + r1950, d1950, dr1950, dd1950, p1950, v1950 = \ + S.sla_fk524(4.567, -1.23, -3e-5, 8e-6, 0.29, -35) + T.assert_almost_equal(r1950, 4.543778603272084, 12, 'sla_fk524, r') + T.assert_almost_equal(d1950, -1.229642790187574, 12, 'sla_fk524, d') + T.assert_almost_equal(dr1950, -2.957873121769244e-5, 17, 'sla_fk524, dr') + T.assert_almost_equal(dd1950, 8.117725309659079e-6, 17, 'sla_fk524, dd') + T.assert_almost_equal(p1950, 0.2898494999992917, 12, 'sla_fk524, p') + T.assert_almost_equal(v1950, -35.026862824252680, 11, 'sla_fk524, v') + + def testfk52h(self): + rh, dh, drh, ddh = S.sla_fk52h(1.234, -0.987, 1e-6, -2e-6) + T.assert_almost_equal(rh, 1.234000000272122558, 13, 'sla_fk52h, r') + T.assert_almost_equal(dh, -0.9869999235218543959, 13, 'sla_fk52h, d') + T.assert_almost_equal(drh, 0.000000993178295, 13, 'sla_fk52h, dr') + T.assert_almost_equal(ddh, -0.000001997665915, 13, 'sla_fk52h, dd') + r5, d5, dr5, dd5 = S.sla_h2fk5(rh, dh, drh, ddh) + T.assert_almost_equal(r5, 1.234, 13, 'sla_h2fk5, r') + T.assert_almost_equal(d5, -0.987, 13, 'sla_h2fk5, d') + T.assert_almost_equal(dr5, 1e-6, 13, 'sla_h2fk5, dr') + T.assert_almost_equal(dd5, -2e-6, 13, 'sla_h2fk5, dd') + rh, dh = S.sla_fk5hz(1.234, -0.987, 1980) + T.assert_almost_equal(rh, 1.234000136713611301, 13, 'sla_fk5hz, r') + T.assert_almost_equal(dh, -0.9869999702020807601, 13, 'sla_fk5hz, d') + r5, d5, dr5, dd5 = S.sla_hfk5z(rh, dh, 1980) + T.assert_almost_equal(r5, 1.234, 13, 'sla_hfk5z, r') + T.assert_almost_equal(d5, -0.987, 13, 'sla_hfk5z, d') + T.assert_almost_equal(dr5, 0.000000006822074, 13, 'sla_hfk5z, dr') + T.assert_almost_equal(dd5, -0.000000002334012, 13, 'sla_hfk5z, dd') + + def testfk54z(self): + r1950, d1950, dr1950, dd1950 = S.sla_fk54z(0.001, -1.55, 1900) + T.assert_almost_equal(r1950, 6.271585543439484, 12, 'sla_fk54z, r') + T.assert_almost_equal(d1950, -1.554861715330319, 12, 'sla_fk54z, d') + T.assert_almost_equal(dr1950, -4.175410876044916011e-8, 20, 'sla_fk54z, dr') + T.assert_almost_equal(dd1950, 2.118595098308522e-8, 20, 'sla_fk54z, dd') + + def testflotin(self): + s = ' 12.345, , -0 1e3-4 2000 e ' + i = 1 + fv = 0.0 + i, fv, j = S.sla_flotin(s, i) + T.assert_equal(i, 10, 'sla_flotin, v5') + T.assert_almost_equal(fv, 12.345, 5, 'sla_flotin, v1') + T.assert_equal(j, 0, 'sla_flotin, j1') + i, fv, j = S.sla_flotin(s, i) + T.assert_equal(i, 12, 'sla_flotin, i2') + # this is different than in slalib_test.f since 'fv' + # is output only and the value doesn't pass through + T.assert_almost_equal(fv, 0.0, 15, 'sla_flotin, v2') + T.assert_equal(j, 1, 'sla_flotin, j2') + i, fv, j = S.sla_flotin(s, i) + T.assert_equal(i, 16, 'sla_flotin, i3') + T.assert_almost_equal(fv, 0, 15, 'sla_flotin, v3') + T.assert_equal(j, -1, 'sla_flotin, j3') + i, fv, j = S.sla_flotin(s, i) + T.assert_equal(i, 19, 'sla_flotin, i4') + T.assert_almost_equal(fv, 1000, 15, 'sla_flotin, v4') + T.assert_equal(j, 0, 'sla_flotin, j4') + i, fv, j = S.sla_flotin(s, i) + T.assert_equal(i, 22, 'sla_flotin, i5') + T.assert_almost_equal(fv, -4, 15, 'sla_flotin, v5') + T.assert_equal(j, -1, 'sla_flotin, j5') + i, fv, j = S.sla_flotin(s, i) + T.assert_equal(i, 28, 'sla_flotin, i6') + T.assert_almost_equal(fv, 2000, 15, 'sla_flotin, v6') + T.assert_equal(j, 0, 'sla_flotin, j6') + i, fv, j = S.sla_flotin(s, i) + T.assert_equal(i, 34, 'sla_flotin, i7') + # this is different than in slalib_test.f since 'fv' + # is output only and the value doesn't pass through + T.assert_almost_equal(fv, 0.0, 15, 'sla_flotin, v7') + T.assert_equal(j, 2, 'sla_flotin, j7') + i = 1 + dv = 0 + i, dv, j = S.sla_dfltin(s, i) + T.assert_equal(i, 10, 'sla_dfltin, i1') + T.assert_almost_equal(dv, 12.345, 12, 'sla_dfltin, v1') + T.assert_equal(j, 0, 'sla_dfltin, j1') + i, dv, j = S.sla_dfltin(s, i) + T.assert_equal(i, 12, 'sla_dfltin, i2') + # this is different than in slalib_test.f since 'dv' + # is output only and the value doesn't pass through + T.assert_almost_equal(dv, 0.0, 15, 'sla_dfltin, v2') + T.assert_equal(j, 1, 'sla_dfltin, j2') + i, dv, j = S.sla_dfltin(s, i) + T.assert_equal(i, 16, 'sla_dfltin, i3') + T.assert_almost_equal(dv, 0, 15, 'sla_dfltin, v3') + T.assert_equal(j, -1, 'sla_dfltin, j3') + i, dv, j = S.sla_dfltin(s, i) + T.assert_equal(i, 19, 'sla_dfltin, i4') + T.assert_almost_equal(dv, 1000, 15, 'sla_dfltin, v4') + T.assert_equal(j, 0, 'sla_dfltin, j4') + i, dv, j = S.sla_dfltin(s, i) + T.assert_equal(i, 22, 'sla_dfltin, i5') + T.assert_almost_equal(dv, -4, 15, 'sla_dfltin, v5') + T.assert_equal(j, -1, 'sla_dfltin, j5') + i, dv, j = S.sla_dfltin(s, i) + T.assert_equal(i, 28, 'sla_dfltin, i6') + T.assert_almost_equal(dv, 2000, 15, 'sla_dfltin, v6') + T.assert_equal(j, 0, 'sla_dfltin, j6') + i, dv, j = S.sla_dfltin(s, i) + T.assert_equal(i, 34, 'sla_dfltin, i7') + # this is different than in slalib_test.f since 'dv' + # is output only and the value doesn't pass through + T.assert_almost_equal(dv, 0.0, 15, 'sla_dfltin, v7') + T.assert_equal(j, 2, 'sla_dfltin, j7') + + def testgaleq(self): + dr, dd = S.sla_galeq(5.67, -1.23) + T.assert_almost_equal(dr, 0.04729270418071426, 12, 'sla_galeq, dr') + T.assert_almost_equal(dd, -0.7834003666745548, 12, 'sla_galeq, dd') + + def testgalsup(self): + dsl, dsb = S.sla_galsup(6.1, -1.4) + T.assert_almost_equal(dsl, 4.567933268859171, 12, 'sla_galsup, dsl') + T.assert_almost_equal(dsb, -0.01862369899731829, 12, 'sla_galsup, dsb') + + def testge50(self): + dr, dd = S.sla_ge50(6.1, -1.55) + T.assert_almost_equal(dr, 0.1966825219934508, 12, 'sla_ge50, dr') + T.assert_almost_equal(dd, -0.4924752701678960, 12, 'sla_ge50, dd') + + def testgmst(self): + T.assert_almost_equal(S.sla_gmst(43999.999), 3.9074971356487318, + 9, 'sla_gmst') + T.assert_almost_equal(S.sla_gmsta(43999, 0.999), 3.9074971356487318, + 12, 'sla_gmsta') + + def testintin(self): + s = ' -12345, , -0 2000 + ' + i = 1 + n = 0 + i, n, j = S.sla_intin(s, i) + T.assert_equal(i, 10, 'sla_intin, i1') + T.assert_equal(n, -12345, 'sla_intin, v1') + T.assert_equal(j, -1, 'sla_intin, j1') + i, n, j = S.sla_intin(s, i) + T.assert_equal(i, 12, 'sla_intin, i2') + # this is different than in slalib_test.f since 'n' + # is output only and the value doesn't pass through + T.assert_equal(n, 0, 'sla_intin, v2') + T.assert_equal(j, 1, 'sla_intin, j2') + i, n, j = S.sla_intin(s, i) + T.assert_equal(i, 17, 'sla_intin, i3') + T.assert_equal(n, 0, 'sla_intin, v3') + T.assert_equal(j, -1, 'sla_intin, j3') + i, n, j = S.sla_intin(s, i) + T.assert_equal(i, 23, 'sla_intin, i4') + T.assert_equal(n, 2000, 'sla_intin, v4') + T.assert_equal(j, 0, 'sla_intin, j4') + i, n, j = S.sla_intin(s, i) + T.assert_equal(i, 29, 'sla_intin, i5') + # this is different than in slalib_test.f since 'n' + # is output only and the value doesn't pass through + T.assert_equal(n, 0, 'sla_intin, v5') + T.assert_equal(j, 2, 'sla_intin, j5') + + def testkbj(self): + k = safe_str('?') + e = 1950 + k, j = S.sla_kbj(-1, e) + T.assert_equal(k, safe_str(' '), 'sla_kbj, jb1') + T.assert_equal(j, 1, 'sla_kbj, j1') + k, j = S.sla_kbj(0, e) + T.assert_equal(k, safe_str('B'), 'sla_kbj, jb2') + T.assert_equal(j, 0, 'sla_kbj, j2') + k, j = S.sla_kbj(1, e) + T.assert_equal(k, safe_str('B'), 'sla_kbj, jb3') + T.assert_equal(j, 0, 'sla_kbj, j3') + k, j = S.sla_kbj(2, e) + T.assert_equal(k, safe_str('J'), 'sla_kbj, jb4') + T.assert_equal(j, 0, 'sla_kbj, j4') + k, j = S.sla_kbj(3, e) + T.assert_equal(k, safe_str(' '), 'sla_kbj, jb5') + T.assert_equal(j, 1, 'sla_kbj, j5') + e = 2000 + k, j = S.sla_kbj(0, e) + T.assert_equal(k, safe_str('J'), 'sla_kbj, jb6') + T.assert_equal(j, 0, 'sla_kbj, j6') + k, j = S.sla_kbj(1, e) + T.assert_equal(k, safe_str('B'), 'sla_kbj, jb7') + T.assert_equal(j, 0, 'sla_kbj, j7') + k, j = S.sla_kbj(2, e) + T.assert_equal(k, safe_str('J'), 'sla_kbj, jb8') + T.assert_equal(j, 0, 'sla_kbj, j8') + + def testmap(self): + ra, da = S.sla_map(6.123, -0.999, 1.23e-5, -0.987e-5, + 0.123, 32.1, 1999, 43210.9) + T.assert_almost_equal(ra, 6.117130429775647, 12, 'sla_map, ra') + T.assert_almost_equal(da, -1.000880769038632, 12, 'sla_map, da') + amprms = S.sla_mappa(2020, 45012.3) + T.assert_almost_equal(amprms[0], -37.884188911704310, 11, 'sla_mappa, amprms(1)') + T.assert_almost_equal(amprms[1], -0.7888341859486424, 7, 'sla_mappa, amprms(2)') + T.assert_almost_equal(amprms[2], 0.5405321789059870, 7, 'sla_mappa, amprms(3)') + T.assert_almost_equal(amprms[3], 0.2340784267119091, 7, 'sla_mappa, amprms(4)') + T.assert_almost_equal(amprms[4], -0.8067807553217332071, 7, 'sla_mappa, amprms(5)') + T.assert_almost_equal(amprms[5], 0.5420884771236513880, 7, 'sla_mappa, amprms(6)') + T.assert_almost_equal(amprms[6], 0.2350423277034460899, 7, 'sla_mappa, amprms(7)') + T.assert_almost_equal(amprms[7], 1.999729469227807e-8, 12, 'sla_mappa, amprms(8)') + T.assert_almost_equal(amprms[8], -6.035531043691568494e-5, 12, 'sla_mappa, amprms(9)') + T.assert_almost_equal(amprms[9], -7.381891582591552377e-5, 11, 'sla_mappa, amprms(10)') + T.assert_almost_equal(amprms[10], -3.200897749853207412e-5, 11, 'sla_mappa, amprms(11)') + T.assert_almost_equal(amprms[11], 0.9999999949417148, 11, 'sla_mappa, amprms(12)') + T.assert_almost_equal(amprms[12], 0.9999566751478850, 11, 'sla_mappa, amprms(13)') + T.assert_almost_equal(amprms[13], -8.537361890149777e-3, 11, 'sla_mappa, amprms(14)') + T.assert_almost_equal(amprms[14], -3.709619811228171e-3, 11, 'sla_mappa, amprms(15)') + T.assert_almost_equal(amprms[15], 8.537308717676752e-3, 11, 'sla_mappa, amprms(16)') + T.assert_almost_equal(amprms[16], 0.9999635560607690, 11, 'sla_mappa, amprms(17)') + T.assert_almost_equal(amprms[17], -3.016886324169151e-5, 11, 'sla_mappa, amprms(18)') + T.assert_almost_equal(amprms[18], 3.709742180572510e-3, 11, 'sla_mappa, amprms(19)') + T.assert_almost_equal(amprms[19], -1.502613373498668e-6, 11, 'sla_mappa, amprms(20)') + T.assert_almost_equal(amprms[20], 0.9999931188816729, 11, 'sla_mappa, amprms(21)') + ra, da = S.sla_mapqk(1.234, -0.987, -1.2e-5, -0.99, 0.75, -23.4, amprms) + T.assert_almost_equal(ra, 1.223337584930993, 11, 'sla_mapqk, ra') + T.assert_almost_equal(da, 0.5558838650379129, 11, 'sla_mapqk, da') + ra, da = S.sla_mapqkz(6.012, 1.234, amprms) + T.assert_almost_equal(ra, 6.006091119756597, 11, 'sla_mapqkz, ra') + T.assert_almost_equal(da, 1.23045846622498, 11, 'sla_mapqkz, da') + + def testmoon(self): + pv = S.sla_moon(1999, 365, 0.9) + T.assert_almost_equal(pv[0], -2.155729505970773e-3, 6, 'sla_moon, (1)') + T.assert_almost_equal(pv[1], -1.538107758633427e-3, 6, 'sla_moon, (2)') + T.assert_almost_equal(pv[2], -4.003940552689305e-4, 6, 'sla_moon, (3)') + T.assert_almost_equal(pv[3], 3.629209419071314e-9, 12, 'sla_moon, (4)') + T.assert_almost_equal(pv[4], -4.989667166259157e-9, 12, 'sla_moon, (5)') + T.assert_almost_equal(pv[5], -2.160752457288307e-9, 12, 'sla_moon, (6)') + + def testnut(self): + rmatn = S.sla_nut(46012.34) + ans = N.asarray([[9.999999969492166e-1, 7.166577986249302e-5, 3.107382973077677e-5], + [-7.166503970900504e-5, 9.999999971483732e-1, -2.381965032461830e-5], + [-3.107553669598237e-5, 2.381742334472628e-5, 9.999999992335206818e-1]]) + T.assert_array_almost_equal(rmatn, ans, 12, 'sla_nut, rmatn') + dpsi, deps, eps0 = S.sla_nutc(50123.4) + T.assert_almost_equal(dpsi, 3.523550954747999709e-5, 17, 'sla_nutc, dpsi') + T.assert_almost_equal(deps, -4.143371566683342e-5, 17, 'sla_nutc, deps') + T.assert_almost_equal(eps0, 0.4091014592901651, 12, 'sla_nutc, eps0') + dpsi, deps, eps0 = S.sla_nutc80(50123.4) + T.assert_almost_equal(dpsi, 3.537714281665945321e-5, 17, 'sla_nutc80, dpsi') + T.assert_almost_equal(deps, -4.140590085987148317e-5, 17, 'sla_nutc80, deps') + T.assert_almost_equal(eps0, 0.4091016349007751, 12, 'sla_nutc80, eps0') + + def testobs(self): + n = 0 + c = safe_str('MMT') + c, name, w, p, h = S.sla_obs(n, c) + T.assert_equal(c.strip(), safe_str('MMT'), 'sla_obs, 1/c') + T.assert_equal(name.strip(), safe_str('MMT 6.5m, Mt Hopkins'), 'sla_obs, 1/name') + T.assert_almost_equal(w, 1.935300584055477, 8, 'sla_obs, 1/w') + T.assert_almost_equal(p, 0.5530735081550342238, 10, 'sla_obs, 1/p') + T.assert_almost_equal(h, 2608, 10, 'sla_obs, 1/h') + n = 61 + c = 20*' ' + c, name, w, p, h = S.sla_obs(n, c) + T.assert_equal(c.strip(), safe_str('KECK1'), 'sla_obs, 2/c') + T.assert_equal(name.strip(), safe_str('Keck 10m Telescope #1'), 'sla_obs, 2/name') + T.assert_almost_equal(w, 2.713545757918895, 8, 'sla_obs, 2/w') + T.assert_almost_equal(p, 0.3460280563536619, 8, 'sla_obs, 2/p') + T.assert_almost_equal(h, 4160, 10, 'sla_obs, 2/h') + n = 83 + c = 20*' ' + c, name, w, p, h = S.sla_obs(n, c) + T.assert_equal(c.strip(), safe_str('MAGELLAN2'), 'sla_obs, 3/c') + T.assert_equal(name.strip(), safe_str('Magellan 2, 6.5m, Las Campanas'), 'sla_obs, 3/name') + T.assert_almost_equal(w, 1.233819305534497, 8, 'sla_obs, 3/w') + T.assert_almost_equal(p, -0.506389344359954, 8, 'sla_obs, 3/p') + T.assert_almost_equal(h, 2408, 10, 'sla_obs, 3/h') + n = 84 + c = 20*' ' + c, name, w, p, h = S.sla_obs(n, c) + T.assert_equal(name.strip(), safe_str('?'), 'sla_obs, 4/name') + + def testpa(self): + T.assert_almost_equal(S.sla_pa(-1.567, 1.5123, 0.987), + -1.486288540423851, 12, 'sla_pa') + T.assert_almost_equal(S.sla_pa(0, 0.789, 0.789), + 0, 0, 'sla_pa, zenith') + + def testpcd(self): + disco = 178.585 + x = 0.0123 + y = -0.00987 + x, y = S.sla_pcd(disco, x, y) + T.assert_almost_equal(x, 0.01284630845735895, 14, 'sla_pcd, x') + T.assert_almost_equal(y, -0.01030837922553926, 14, 'sla_pcd, y') + x, y = S.sla_unpcd(disco, x, y) + T.assert_almost_equal(x, 0.0123, 14, 'sla_unpcd, x') + T.assert_almost_equal(y, -0.00987, 14, 'sla_unpcd, y') + + def testpda2h(self): + h1, j1, h2, j2 = S.sla_pda2h(-0.51, -1.31, 3.1) + T.assert_almost_equal(h1, -0.1161784556585304927, 14, 'sla_pda2h, h1') + T.assert_equal(j1, 0, 'sla_pda2h, j1') + T.assert_almost_equal(h2, -2.984787179226459, 13, 'sla_pda2h, h2') + T.assert_equal(j2, 0, 'sla_pda2h, j2') + + def testpdq2h(self): + h1, j1, h2, j2 = S.sla_pdq2h(0.9, 0.2, 0.1) + T.assert_almost_equal(h1, 0.1042809894435257, 14, 'sla_pdq2h, h1') + T.assert_equal(j1, 0, 'sla_pdq2h, j1') + T.assert_almost_equal(h2, 2.997450098818439, 13, 'sla_pdq2h, h2') + T.assert_equal(j2, 0, 'sla_pdq2h, j2') + + def testpercom(self): + inlist = N.zeros(3, N.int32) + for i in range(11): + inlist, j = S.sla_combn(5, inlist) + # print inlist, j + T.assert_equal(j, 1, 'sla_combn, j') + T.assert_equal(inlist[0], 1, 'sla_combn, list(1)') + T.assert_equal(inlist[1], 2, 'sla_combn, list(2)') + T.assert_equal(inlist[2], 3, 'sla_combn, list(3)') + istate = N.zeros(4, N.int32) + iorder = N.zeros(4, N.int32) + istate[0] = -1 + for i in range(25): + istate, iorder, j = S.sla_permut(istate) + # print istate, iorder, j + T.assert_equal(j, 1, 'sla_permut, j') + T.assert_equal(iorder[0], 4, 'sla_permut, iorder(1)') + T.assert_equal(iorder[1], 3, 'sla_permut, iorder(2)') + T.assert_equal(iorder[2], 2, 'sla_permut, iorder(3)') + T.assert_equal(iorder[3], 1, 'sla_permut, iorder(4)') + + def testplanet(self): + u, j = S.sla_el2ue(50000, 1, 49000, 0.1, 2, 0.2, + 3, 0.05, 3, 0.003312) + ans1 = N.asarray([1.000878908362435284, -0.3336263027874777288, + 50000, 2.840425801310305210, 0.1264380368035014224, + -0.2287711835229143197, -0.01301062595106185195, + 0.5657102158104651697, 0.2189745287281794885, + 2.852427310959998500, -0.01552349065435120900, 50000, 0]) + T.assert_array_almost_equal(u, ans1, 12, 'sla_el2ue, u') + T.assert_equal(j, 0, 'sla_el2ue, j') + epoch, orbinc, anode, perih, aorq, e, aorl, j = \ + S.sla_pertel(2, 43000, 43200, 43000, 0.2, 3, 4, 5, 0.02, 6) + T.assert_almost_equal(epoch, 43200, 10, 'sla_pertel, epoch') + T.assert_almost_equal(orbinc, 0.1995661466545422381, 7, 'sla_pertel, orbinc') + T.assert_almost_equal(anode, 2.998052737821591215, 7, 'sla_pertel, anode') + T.assert_almost_equal(perih, 4.009516448441143636, 6, 'sla_pertel, perih') + T.assert_almost_equal(aorq, 5.014216294790922323, 7, 'sla_pertel, aorq') + T.assert_almost_equal(e, 0.02281386258309823607, 7, 'sla_pertel, e') + T.assert_almost_equal(aorl, 0.01735248648779583748, 6, 'sla_pertel, aorl') + T.assert_equal(j, 0, 'sla_pertel, j') + u, j = S.sla_pertue(50100, u) + ans2 = N.asarray([1.000000000000000, -0.3329769417028020949, 50100, + 2.638884303608524597, 1.070994304747824305, + 0.1544112080167568589, -0.2188240619161439344, + 0.5207557453451906385, 0.2217782439275216936, + 2.852118859689216658, 0.01452010174371893229, 50100, 0]) + T.assert_array_almost_equal(u, ans2, 12, 'sla_pertue, u') + T.assert_equal(j, 0, 'sla_pertue, j') + pv, j = S.sla_planel(50600, 2, 50500, 0.1, 3, 5, 2, 0.3, 4, 0) + T.assert_almost_equal(pv[0], 1.947628959288897677, 12, 'sla_planel, pv(1)') + T.assert_almost_equal(pv[1], -1.013736058752235271, 12, 'sla_planel, pv(2)') + T.assert_almost_equal(pv[2], -0.3536409947732733647, 12, 'sla_planel, pv(3)') + T.assert_almost_equal(pv[3], 2.742247411571786194e-8, 19, 'sla_planel, pv(4)') + T.assert_almost_equal(pv[4], 1.170467244079075911e-7, 19, 'sla_planel, pv(5)') + T.assert_almost_equal(pv[5], 3.709878268217564005e-8, 19, 'sla_planel, pv(6)') + T.assert_equal(j, 0, 'sla_planel, j') + pv, j = S.sla_planet(1e6, 0) + T.assert_array_almost_equal(pv, N.zeros(6.0), 15, 'sla_planet, pv 1') + T.assert_equal(j, -1, 'sla_planet, j 1') + pv, j = S.sla_planet(1e6, 10) + T.assert_equal(j, -1, 'sla_planet, j 2') + pv, j = S.sla_planet(-320000, 3) + T.assert_almost_equal(pv[0], 0.9308038666827242603, 11, 'sla_planet, pv(1) 3') + T.assert_almost_equal(pv[1], 0.3258319040252137618, 11, 'sla_planet, pv(2) 3') + T.assert_almost_equal(pv[2], 0.1422794544477122021, 11, 'sla_planet, pv(3) 3') + T.assert_almost_equal(pv[3], -7.441503423889371696e-8, 17, 'sla_planet, pv(4) 3') + T.assert_almost_equal(pv[4], 1.699734557528650689e-7, 17, 'sla_planet, pv(5) 3') + T.assert_almost_equal(pv[5], 7.415505123001430864e-8, 17, 'sla_planet, pv(6) 3') + T.assert_equal(j, 1, 'sla_planet, j 3') + pv, j = S.sla_planet(43999.9, 1) + T.assert_almost_equal(pv[0], 0.2945293959257422246, 11, 'sla_planet, pv(1) 4') + T.assert_almost_equal(pv[1], -0.2452204176601052181, 11, 'sla_planet, pv(2) 4') + T.assert_almost_equal(pv[2], -0.1615427700571978643, 11, 'sla_planet, pv(3) 4') + T.assert_almost_equal(pv[3], 1.636421147459047057e-7, 18, 'sla_planet, pv(4) 4') + T.assert_almost_equal(pv[4], 2.252949422574889753e-7, 18, 'sla_planet, pv(5) 4') + T.assert_almost_equal(pv[5], 1.033542799062371839e-7, 18, 'sla_planet, pv(6) 4') + T.assert_equal(j, 0, 'sla_planet, j 4') + ra, dec, r, j = S.sla_plante(50600, -1.23, 0.456, 2, 50500, + 0.1, 3, 5, 2, 0.3, 4, 0) + T.assert_almost_equal(ra, 6.222958101333794007, 10, 'sla_plante, ra') + T.assert_almost_equal(dec, 0.01142220305739771601, 10, 'sla_plante, dec') + T.assert_almost_equal(r, 2.288902494080167624, 8, 'sla_plante, r') + T.assert_equal(j, 0, 'sla_plante, j') + u = N.asarray([1.0005, -0.3, 55000, 2.8, 0.1, -0.2, -0.01, 0.5, + 0.22, 2.8, -0.015, 55001, 0]) + ra, dec, r, j = S.sla_plantu(55001, -1.23, 0.456, u) + T.assert_almost_equal(ra, 0.3531814831241686647, 9, 'sla_plantu, ra') + T.assert_almost_equal(dec, 0.06940344580567131328, 9, 'sla_plantu, dec') + T.assert_almost_equal(r, 3.031687170873274464, 8, 'sla_plantu, r') + T.assert_equal(j, 0, 'sla_plantu, j') + pv = N.asarray([0.3, -0.2, 0.1, -0.9e-7, 0.8e-7, -0.7e-7]) + jform, epoch, orbinc, anode, perih, aorq, e, aorl, dm, j = \ + S.sla_pv2el(pv, 50000, 0.00006, 1) + T.assert_equal(jform, 1, 'sla_pv2el, jform') + T.assert_almost_equal(epoch, 50000, 10, 'sla_pv2el, epoch') + T.assert_almost_equal(orbinc, 1.52099895268912, 12, 'sla_pv2el, orbinc') + T.assert_almost_equal(anode, 2.720503180538650, 12, 'sla_pv2el, anode') + T.assert_almost_equal(perih, 2.194081512031836, 12, 'sla_pv2el, perih') + T.assert_almost_equal(aorq, 0.2059371035373771, 12, 'sla_pv2el, aorq') + T.assert_almost_equal(e, 0.9866822985810528, 12, 'sla_pv2el, e') + T.assert_almost_equal(aorl, 0.2012758344836794, 12, 'sla_pv2el, aorl') + T.assert_almost_equal(dm, 0.1840740507951820, 12, 'sla_pv2el, dm') + T.assert_equal(j, 0, 'sla_pv2el, j') + u, j = S.sla_pv2ue(pv, 50000, 0.00006) + T.assert_almost_equal(u[0], 1.00006, 12, 'sla_pv2ue, u(1)') + T.assert_almost_equal(u[1], -4.856142884511782, 12, 'sla_pv2ue, u(2)') + T.assert_almost_equal(u[2], 50000, 12, 'sla_pv2ue, u(3)') + T.assert_almost_equal(u[3], 0.3, 12, 'sla_pv2ue, u(4)') + T.assert_almost_equal(u[4], -0.2, 12, 'sla_pv2ue, u(5)') + T.assert_almost_equal(u[5], 0.1, 12, 'sla_pv2ue, u(6)') + T.assert_almost_equal(u[6], -0.4520378601821727, 12, 'sla_pv2ue, u(7)') + T.assert_almost_equal(u[7], 0.4018114312730424, 12, 'sla_pv2ue, u(8)') + T.assert_almost_equal(u[8], -.3515850023639121, 12, 'sla_pv2ue, u(9)') + T.assert_almost_equal(u[9], 0.3741657386773941, 12, 'sla_pv2ue, u(10)') + T.assert_almost_equal(u[10], -0.2511321445456515, 12, 'sla_pv2ue, u(11)') + T.assert_almost_equal(u[11], 50000, 12, 'sla_pv2ue, u(12)') + T.assert_almost_equal(u[12], 0, 12, 'sla_pv2ue, u(13)') + T.assert_equal(j, 0, 'sla_pv2ue, j') + ra, dec, diam = S.sla_rdplan(40999.9, 0, 0.1, -0.9) + T.assert_almost_equal(ra, 5.772270359389275837, 7, 'sla_rdplan, ra 0') + T.assert_almost_equal(dec, -0.2089207338795416192, 7, 'sla_rdplan, dec 0') + T.assert_almost_equal(diam, 9.415338935229717875e-3, 14, 'sla_rdplan, diam 0') + ra, dec, diam = S.sla_rdplan(41999.9, 1, 1.1, -0.9) + T.assert_almost_equal(ra, 3.866363420052936653, 7, 'sla_rdplan, ra 1') + T.assert_almost_equal(dec, -0.2594430577550113130, 7, 'sla_rdplan, dec 1') + T.assert_almost_equal(diam, 4.638468996795023071e-5, 14, 'sla_rdplan, diam 1') + ra, dec, diam = S.sla_rdplan(42999.9, 2, 2.1, 0.9) + T.assert_almost_equal(ra, 2.695383203184077378, 7, 'sla_rdplan, ra 2') + T.assert_almost_equal(dec, 0.2124044506294805126, 7, 'sla_rdplan, dec 2') + T.assert_almost_equal(diam, 4.892222838681000389e-5, 14, 'sla_rdplan, diam 2') + ra, dec, diam = S.sla_rdplan(43999.9, 3, 3.1, 0.9) + T.assert_almost_equal(ra, 2.908326678461540165, 7, 'sla_rdplan, ra 3') + T.assert_almost_equal(dec, 0.08729783126905579385, 7, 'sla_rdplan, dec 3') + T.assert_almost_equal(diam, 8.581305866034962476e-3, 14, 'sla_rdplan, diam 3') + ra, dec, diam = S.sla_rdplan(44999.9, 4, -0.1, 1.1) + T.assert_almost_equal(ra, 3.429840787472851721, 7, 'sla_rdplan, ra 4') + T.assert_almost_equal(dec, -0.06979851055261161013, 7, 'sla_rdplan, dec 4') + T.assert_almost_equal(diam, 4.540536678439300199e-5, 14, 'sla_rdplan, diam 4') + ra, dec, diam = S.sla_rdplan(45999.9, 5, -1.1, 0.1) + T.assert_almost_equal(ra, 4.864669466449422548, 7, 'sla_rdplan, ra 5') + T.assert_almost_equal(dec, -0.4077714497908953354, 7, 'sla_rdplan, dec 5') + T.assert_almost_equal(diam, 1.727945579027815576e-4, 14, 'sla_rdplan, diam 5') + ra, dec, diam = S.sla_rdplan(46999.9, 6, -2.1, -0.1) + T.assert_almost_equal(ra, 4.432929829176388766, 7, 'sla_rdplan, ra 6') + T.assert_almost_equal(dec, -0.3682820877854730530, 7, 'sla_rdplan, dec 6') + T.assert_almost_equal(diam, 8.670829016099083311e-5, 14, 'sla_rdplan, diam 6') + ra, dec, diam = S.sla_rdplan(47999.9, 7, -3.1, -1.1) + T.assert_almost_equal(ra, 4.894972492286818487, 7, 'sla_rdplan, ra 7') + T.assert_almost_equal(dec, -0.4084068901053653125, 7, 'sla_rdplan, dec 7') + T.assert_almost_equal(diam, 1.793916783975974163e-5, 14, 'sla_rdplan, diam 7') + ra, dec, diam = S.sla_rdplan(48999.9, 8, 0, 0) + T.assert_almost_equal(ra, 5.066050284760144000, 7, 'sla_rdplan, ra 8') + T.assert_almost_equal(dec, -0.3744690779683850609, 7, 'sla_rdplan, dec 8') + T.assert_almost_equal(diam, 1.062210086082700563e-5, 14, 'sla_rdplan, diam 8') + ra, dec, diam = S.sla_rdplan(49999.9, 9, 0, 0) + T.assert_almost_equal(ra, 4.179543143097200945, 7, 'sla_rdplan, ra 9') + T.assert_almost_equal(dec, -0.1258021632894033300, 7, 'sla_rdplan, dec 9') + T.assert_almost_equal(diam, 5.034057475664904352e-7, 14, 'sla_rdplan, diam 9') + jform, epoch, orbinc, anode, perih, aorq, e, aorl, dm, j = S.sla_ue2el(u, 1) + T.assert_equal(jform, 1, 'sla_ue2el, jform') + T.assert_almost_equal(epoch, 50000.00000000000, 10, 'sla_pv2el, epoch') + T.assert_almost_equal(orbinc, 1.520998952689120, 12, 'sla_ue2el, orbinc') + T.assert_almost_equal(anode, 2.720503180538650, 12, 'sla_ue2el, anode') + T.assert_almost_equal(perih, 2.194081512031836, 12, 'sla_ue2el, perih') + T.assert_almost_equal(aorq, 0.2059371035373771, 12, 'sla_ue2el, aorq') + T.assert_almost_equal(e, 0.9866822985810528, 12, 'sla_ue2el, e') + T.assert_almost_equal(aorl, 0.2012758344836794, 12, 'sla_ue2el, aorl') + T.assert_equal(j, 0, 'sla_ue2el, j') + u, pv, j = S.sla_ue2pv(50010, u) + T.assert_almost_equal(u[0], 1.00006, 12, 'sla_ue2pv, u(1)') + T.assert_almost_equal(u[1], -4.856142884511782111, 12, 'sla_ue2pv, u(2)') + T.assert_almost_equal(u[2], 50000, 12, 'sla_ue2pv, u(3)') + T.assert_almost_equal(u[3], 0.3, 12, 'sla_ue2pv, u(4)') + T.assert_almost_equal(u[4], -0.2, 12, 'sla_ue2pv, u(5)') + T.assert_almost_equal(u[5], 0.1, 12, 'sla_ue2pv, u(6)') + T.assert_almost_equal(u[6], -0.4520378601821727110, 12, 'sla_ue2pv, u(7)') + T.assert_almost_equal(u[7], 0.4018114312730424097, 12, 'sla_ue2pv, u(8)') + T.assert_almost_equal(u[8], -0.3515850023639121085, 12, 'sla_ue2pv, u(9)') + T.assert_almost_equal(u[9], 0.3741657386773941386, 12, 'sla_ue2pv, u(10)') + T.assert_almost_equal(u[10], -0.2511321445456515061, 12, 'sla_ue2pv, u(11)') + T.assert_almost_equal(u[11], 50010.00000000000, 12, 'sla_ue2pv, u(12)') + T.assert_almost_equal(u[12], 0.7194308220038886856, 12, 'sla_ue2pv, u(13)') + T.assert_almost_equal(pv[0], 0.07944764084631667011, 12, 'sla_ue2pv, pv(1)') + T.assert_almost_equal(pv[1], -0.04118141077419014775, 12, 'sla_ue2pv, pv(2)') + T.assert_almost_equal(pv[2], 0.002915180702063625400, 12, 'sla_ue2pv, pv(3)') + T.assert_almost_equal(pv[3], -0.6890132370721108608e-6, 18, 'sla_ue2pv, pv(4)') + T.assert_almost_equal(pv[4], 0.4326690733487621457e-6, 18, 'sla_ue2pv, pv(5)') + T.assert_almost_equal(pv[5], -0.1763249096254134306e-6, 18, 'sla_ue2pv, pv(6)') + T.assert_equal(j, 0, 'sla_ue2pv, j') + + def testpm(self): + r1, d1 = S.sla_pm(5.43, -0.87, -0.33e-5, 0.77e-5, 0.7, + 50.3*365.2422/365.25, 1899, 1943) + T.assert_almost_equal(r1, 5.429855087793875, 12, 'sla_pm, r') + T.assert_almost_equal(d1, -0.8696617307805072, 12, 'sla_pm, d') + + def testpolmo(self): + elong, phi, daz = S.sla_polmo(0.7, -0.5, 1e-6, -2e-6) + T.assert_almost_equal(elong, 0.7000004837322044, 12, 'sla_polmo, elong') + T.assert_almost_equal(phi, -0.4999979467222241, 12, 'sla_polmo, phi') + T.assert_almost_equal(daz, 1.008982781275728e-6, 12, 'sla_polmo, daz') + + def testprebn(self): + rmatp = S.sla_prebn(1925, 1975) + ans = N.asarray([[9.999257613786738e-1, -1.117444640880939e-2, -4.858341150654265e-3], + [1.117444639746558e-2, 9.999375635561940e-1, -2.714797892626396e-5], + [4.858341176745641e-3, -2.714330927085065e-5, 9.999881978224798e-1]]) + T.assert_array_almost_equal(rmatp, ans, 12, 'sla_prebn, (1,1)') + + def testprec(self): + rmatp = S.sla_prec(1925, 1975) + ans = N.asarray([[9.999257249850045e-1, -1.117719859160180e-2, -4.859500474027002e-3], + [1.117719858025860e-2, 9.999375327960091e-1, -2.716114374174549e-5], + [4.859500500117173e-3, -2.715647545167383e-5, 9.999881921889954e-1]]) + T.assert_array_almost_equal(rmatp, ans, 12, 'sla_prec, (1,1)') + rmatp = S.sla_precl(1925, 1975) + ans = N.asarray([[9.999257331781050e-1, -1.117658038434041e-2, -4.859236477249598e-3], + [1.117658037299592e-2, 9.999375397061558e-1, -2.715816653174189e-5], + [4.859236503342703e-3, -2.715349745834860e-5, 9.999881934719490e-1]]) + T.assert_array_almost_equal(rmatp, ans, 12, 'sla_precl, (1,1)') + + def testpreces(self): + ra = 6.28 + dc = -1.123 + ra, dc = S.sla_preces('fk4', 1925, 1950, ra, dc) + T.assert_almost_equal(ra, 0.002403604864728447, 12, 'sla_preces, r') + T.assert_almost_equal(dc, -1.120570643322045, 12, 'sla_preces, d') + ra = 0.0123 + dc = 1.0987 + ra, dc = S.sla_preces('fk5', 2050, 1990, ra, dc) + T.assert_almost_equal(ra, 6.282003602708382, 12, 'sla_preces, r') + T.assert_almost_equal(dc, 1.092870326188383, 12, 'sla_preces, d') + + def testprenut(self): + rmatpn = S.sla_prenut(1985, 50123.4567) + ans = N.asarray([[9.999962358680738e-1, -2.516417057665452e-3, -1.093569785342370e-3], + [2.516462370370876e-3, 9.999968329010883e-1, 4.006159587358310e-5], + [1.093465510215479e-3, -4.281337229063151e-5, 9.999994012499173e-1]]) + T.assert_array_almost_equal(rmatpn, ans, 12, 'sla_prenut, (3,3)') + + def testpvobs(self): + pv = S.sla_pvobs(0.5123, 3001, -0.567) + T.assert_almost_equal(pv[0], 0.3138647803054939e-4, 16, 'sla_pvobs, (1)') + T.assert_almost_equal(pv[1], -0.1998515596527082e-4, 16, 'sla_pvobs, (2)') + T.assert_almost_equal(pv[2], 0.2078572043443275e-4, 16, 'sla_pvobs, (3)') + T.assert_almost_equal(pv[3], 0.1457340726851264e-8, 20, 'sla_pvobs, (4)') + T.assert_almost_equal(pv[4], 0.2288738340888011e-8, 20, 'sla_pvobs, (5)') + T.assert_almost_equal(pv[5], 0, 0, 'sla_pvobs, (6)') + + def testrange(self): + T.assert_almost_equal(S.sla_range(-4.0), 2.283185307179586, 6, 'sla_range') + T.assert_almost_equal(S.sla_drange(-4.0), 2.283185307179586, 12, 'sla_drange') + + def testranorm(self): + T.assert_almost_equal(S.sla_ranorm(-0.1), 6.183185307179587, 5, 'sla_ranorm, 1') + T.assert_almost_equal(S.sla_dranrm(-0.1), 6.183185307179587, 12, 'sla_dranrm, 2') + + def testrcc(self): + T.assert_almost_equal(S.sla_rcc(48939.123, 0.76543, 5.0123, 5525.242, 3190), + -1.280131613589158e-3, 15, 'sla_rcc') + + def testref(self): + ref = S.sla_refro(1.4, 3456.7, 280, 678.9, 0.9, 0.55, -0.3, 0.006, 1e-9) + T.assert_almost_equal(ref, 0.00106715763018568, 12, 'sla_refro, o') + ref = S.sla_refro(1.4, 3456.7, 280, 678.9, 0.9, 1000, -0.3, 0.006, 1e-9) + T.assert_almost_equal(ref, 0.001296416185295403, 12, 'sla_refro, r') + refa, refb = S.sla_refcoq(275.9, 709.3, 0.9, 101) + T.assert_almost_equal(refa, 2.324736903790639e-4, 12, 'sla_refcoq, a/r') + T.assert_almost_equal(refb, -2.442884551059e-7, 15, 'sla_refcoq, b/r') + refa, refb = S.sla_refco(2111.1, 275.9, 709.3, 0.9, 101, -1.03, 0.0067, 1e-12) + T.assert_almost_equal(refa, 2.324673985217244e-4, 12, 'sla_refco, a/r') + T.assert_almost_equal(refb, -2.265040682496e-7, 15, 'sla_refco, b/r') + refa, refb = S.sla_refcoq(275.9, 709.3, 0.9, 0.77) + T.assert_almost_equal(refa, 2.007406521596588e-4, 12, 'sla_refcoq, a') + T.assert_almost_equal(refb, -2.264210092590e-7, 15, 'sla_refcoq, b') + refa, refb = S.sla_refco(2111.1, 275.9, 709.3, 0.9, 0.77, -1.03, 0.0067, 1e-12) + T.assert_almost_equal(refa, 2.007202720084551e-4, 12, 'sla_refco, a') + T.assert_almost_equal(refb, -2.223037748876e-7, 15, 'sla_refco, b') + refa2, refb2 = S.sla_atmdsp(275.9, 709.3, 0.9, 0.77, refa, refb, 0.5) + T.assert_almost_equal(refa2, 2.034523658888048e-4, 12, 'sla_atmdsp, a') + T.assert_almost_equal(refb2, -2.250855362179e-7, 15, 'sla_atmdsp, b') + vu = S.sla_dcs2c(0.345, 0.456) + vr = S.sla_refv(vu, refa, refb) + T.assert_almost_equal(vr[0], 0.8447487047790478, 12, 'sla_refv, x1') + T.assert_almost_equal(vr[1], 0.3035794890562339, 12, 'sla_refv, y1') + T.assert_almost_equal(vr[2], 0.4407256738589851, 12, 'sla_refv, z1') + vu = S.sla_dcs2c(3.7, 0.03) + vr = S.sla_refv(vu, refa, refb) + T.assert_almost_equal(vr[0], -0.8476187691681673, 12, 'sla_refv, x2') + T.assert_almost_equal(vr[1], -0.5295354802804889, 12, 'sla_refv, y2') + T.assert_almost_equal(vr[2], 0.0322914582168426, 12, 'sla_refv, z2') + zr = S.sla_refz(0.567, refa, refb) + T.assert_almost_equal(zr, 0.566872285910534, 12, 'sla_refz, hi el') + zr = S.sla_refz(1.55, refa, refb) + T.assert_almost_equal(zr, 1.545697350690958, 12, 'sla_refz, lo el') + + def testrv(self): + T.assert_almost_equal(S.sla_rverot(-0.777, 5.67, -0.3, 3.19), + -0.1948098355075913, 6, 'sla_rverot') + T.assert_almost_equal(S.sla_rvgalc(1.11, -0.99), + 158.9630759840254, 3, 'sla_rvgalc') + T.assert_almost_equal(S.sla_rvlg(3.97, 1.09), + -197.818762175363, 3, 'sla_rvlg') + T.assert_almost_equal(S.sla_rvlsrd(6.01, 0.1), + -4.082811335150567, 4, 'sla_rvlsrd') + T.assert_almost_equal(S.sla_rvlsrk(6.01, 0.1), + -5.925180579830265, 4, 'sla_rvlsrk') + + def testsep(self): + d1 = r1 = N.asarray([1.0, 0.1, 0.2]) + d2 = r2 = N.asarray([-3.0, 1e-3, 0.2]) + ad1, bd1 = S.sla_dcc2s(d1) + ad2, bd2 = S.sla_dcc2s(d2) + T.assert_almost_equal(S.sla_dsep(ad1, bd1, ad2, bd2), + 2.8603919190246608, 7, 'sla_dsep') + T.assert_almost_equal((S.sla_sep(ad1, bd1, ad2, bd2)), + 2.8603919190246608, 4, 'sla_sep') + T.assert_almost_equal(S.sla_dsepv(d1, d2), + 2.8603919190246608, 7, 'sla_dsepv') + T.assert_almost_equal((S.sla_sepv(r1, r2)), + 2.8603919190246608, 4, 'sla_sepv') + + def testsmat(self): + a = N.asarray([[2.22, 1.6578, 1.380522], + [1.6578, 1.380522, 1.22548578], + [1.380522, 1.22548578, 1.1356276122]], + order='Fortran') + v = N.asarray([2.28625, 1.7128825, 1.429432225]) + a, v, d, j, iw = S.sla_smat(a, v, N.empty(3.0, dtype=N.float32)) + ans = N.asarray([[18.02550629769198, -52.16386644917280607, 34.37875949717850495], + [-52.16386644917280607, 168.1778099099805627, -118.0722869694232670], + [34.37875949717850495, -118.0722869694232670, 86.50307003740151262]], + order='Fortran') + T.assert_array_almost_equal(a, ans, 2, 'sla_smat, a(3,3)') + ans = N.asarray([1.002346480763383, 0.03285594016974583489, 0.004760688414885247309]) + T.assert_array_almost_equal(v, ans, 4, 'sla_smat, v(3)') + T.assert_almost_equal(d, 0.003658344147359863, 4, 'sla_smat, d') + T.assert_equal(j, 0, 'sla_smat, j') + + def testsupgal(self): + dl, db = S.sla_supgal(6.1, -1.4) + T.assert_almost_equal(dl, 3.798775860769474, 12, 'sla_supgal, dl') + T.assert_almost_equal(db, -0.1397070490669407, 12, 'sla_supgal, db') + + def testsvd(self): + m = 5 + n = 4 + a = N.empty((m, n), order='Fortran') + b = N.empty(m) + for ii in range(m): + val = 0.5 * (ii + 1.0) + b[ii] = 23 - 3.0 * val - 11.0 * math.sin(val) + 13.0 * math.cos(val) + a[ii, 0] = 1.0 + a[ii, 1] = val + a[ii, 2] = math.sin(val) + a[ii, 3] = math.cos(val) + a, w, v, work, j = S.sla_svd(m, n, a) + if a[0, 0] > 0.0: + a = -a + v = -v + ans = N.asarray([ + [-0.21532492989299, 0.67675050651267, -0.37267876361644, 0.58330405917160], + [-0.33693420368121, 0.48011695963936, 0.62656568539705, -0.17479918328198], + [-0.44396825906047, 0.18255923809825, 0.02228154115994, -0.51743308030238], + [-0.53172583816951, -0.16537863535943, -0.61134201569990, -0.28871221824912], + [-0.60022523682867, -0.50081781972404, 0.30706750690326, 0.52736124480318]]) + T.assert_array_almost_equal(a, ans, 12, 'sla_svd, a') + ans = N.asarray([4.57362714220621, 1.64056393111226, 0.03999179717447, 0.37267332634218]) + T.assert_array_almost_equal(w, ans, 12, 'sla_svd, w') + ans = N.asarray([ + [-0.46531525230679, 0.41036514115630, -0.70279526907678, 0.34808185338758], + [-0.80342444002914, -0.29896472833787, 0.46592932810178, 0.21917828721921], + [-0.36564497020801, 0.28066812941896, -0.03324480702665, -0.88680546891402], + [0.06553350971918, 0.81452191085452, 0.53654771808636, 0.21065602782287]]) + T.assert_array_almost_equal(v, ans, 12, 'sla_svd, v') + work, x = S.sla_svdsol(b, a, w, v) + ans = N.asarray([23.0, -3.0, -11.0, 13.0]) + T.assert_array_almost_equal(x, ans, 12, 'sla_svdsol, x') + work, c = S.sla_svdcov(w, v) + ans = N.asarray([ + [309.77269378273270, -204.22043941662150, 12.43704316907477, -235.12299986206710], + [-204.22043941662150, 136.14695961108110, -11.10167446246327, 156.54937371198730], + [12.43704316907477, -11.10167446246327, 6.38909830090602, -12.41424302586736], + [-235.12299986206710, 156.54937371198730, -12.41424302586736, 180.56719842359560]]) + T.assert_array_almost_equal(c, ans, 10, 'sla_svdcov, c') + + def testtp(self): + r0 = 3.1 + d0 = -0.9 + r1 = r0 + 0.2 + d1 = d0 - 0.1 + x, y, j = S.sla_s2tp(r1, d1, r0, d0) + T.assert_almost_equal(x, 0.1086112301590404, 6, 'sla_s2tp, x') + T.assert_almost_equal(y, -0.1095506200711452, 6, 'sla_s2tp, y') + T.assert_equal(j, 0, 'sla_s2tp, j') + r2, d2 = S.sla_tp2s(x, y, r0, d0) + T.assert_almost_equal(((r2 - r1)), 0, 6, 'sla_tp2s, r') + T.assert_almost_equal(((d2 - d1)), 0, 6, 'sla_tp2s, d') + r01, d01, r02, d02, j = S.sla_tps2c(x, y, r2, d2) + T.assert_almost_equal(r01, 3.1, 6, 'sla_tps2c, r1') + T.assert_almost_equal(d01, -0.9, 6, 'sla_tps2c, d1') + T.assert_almost_equal(r02, 0.3584073464102072, 6, 'sla_tps2c, r2') + T.assert_almost_equal(d02, -2.023361658234722, 6, 'sla_tps2c, d2') + T.assert_equal(j, 1, 'sla_tps2c, n') + dr0 = 3.1 + dd0 = -0.9 + dr1 = dr0 + 0.2 + dd1 = dd0 - 0.1 + dx, dy, j = S.sla_ds2tp(dr1, dd1, dr0, dd0) + T.assert_almost_equal(dx, 0.1086112301590404, 12, 'sla_ds2tp, x') + T.assert_almost_equal(dy, -0.1095506200711452, 12, 'sla_ds2tp, y') + T.assert_equal(j, 0, 'sla_ds2tp, j') + dr2, dd2 = S.sla_dtp2s(dx, dy, dr0, dd0) + T.assert_almost_equal(dr2 - dr1, 0, 12, 'sla_dtp2s, r') + T.assert_almost_equal(dd2 - dd1, 0, 12, 'sla_dtp2s, d') + dr01, dd01, dr02, dd02, j = S.sla_dtps2c(dx, dy, dr2, dd2) + T.assert_almost_equal(dr01, 3.1, 12, 'sla_dtps2c, r1') + T.assert_almost_equal(dd01, -0.9, 12, 'sla_dtps2c, d1') + T.assert_almost_equal(dr02, 0.3584073464102072, 12, 'sla_dtps2c, r2') + T.assert_almost_equal(dd02, -2.023361658234722, 12, 'sla_dtps2c, d2') + T.assert_equal(j, 1, 'sla_dtps2c, n') + + def testtpv(self): + xi = -0.1 + eta = 0.055 + rxi = xi + reta = eta + x = -0.7 + y = -0.13 + z = math.sqrt(1.0 - x * x - y * y) + rv = N.asarray([x, y, z]) + v = N.asarray([x, y, z]) + x = -0.72 + y = -0.16 + z = math.sqrt(1.0 - x * x - y * y) + rv0 = N.asarray([x, y, z]) + v0 = N.asarray([x, y, z]) + rtv = S.sla_tp2v(rxi, reta, rv0) + T.assert_almost_equal(rtv[0], -0.700887428128, 6, 'sla_tp2v, v(1)') + T.assert_almost_equal(rtv[1], -0.05397407, 6, 'sla_tp2v, v(2)') + T.assert_almost_equal(rtv[2], 0.711226836562, 6, 'sla_tp2v, v(3)') + tv = S.sla_dtp2v(xi, eta, v0) + T.assert_almost_equal(tv[0], -0.7008874281280771, 13, 'sla_dtp2v, v(1)') + T.assert_almost_equal(tv[1], -0.05397406827952735, 13, 'sla_dtp2v, v(2)') + T.assert_almost_equal(tv[2], 0.7112268365615617, 13, 'sla_dtp2v, v(3)') + rtxi, rteta, j = S.sla_v2tp(rv, rv0) + T.assert_almost_equal(rtxi, -0.02497229197, 6, 'sla_v2tp, xi') + T.assert_almost_equal(rteta, 0.03748140764, 6, 'sla_v2tp, eta') + T.assert_equal(j, 0, 'sla_v2tp, j') + txi, teta, j = S.sla_dv2tp(v, v0) + T.assert_almost_equal(txi, -0.02497229197023852, 13, 'sla_dv2tp, xi') + T.assert_almost_equal(teta, 0.03748140764224765, 13, 'sla_dv2tp, eta') + T.assert_equal(j, 0, 'sla_dv2tp, j') + rtv01, rtv02, j = S.sla_tpv2c(rxi, reta, rv) + T.assert_almost_equal(rtv01[0], -0.7074573732537283, 6, 'sla_tpv2c, v01(1)') + T.assert_almost_equal(rtv01[1], -0.2372965765309941, 6, 'sla_tpv2c, v01(2)') + T.assert_almost_equal(rtv01[2], 0.6657284730245545, 6, 'sla_tpv2c, v01(3)') + T.assert_almost_equal(rtv02[0], -0.6680480104758149, 6, 'sla_tpv2c, v02(1)') + T.assert_almost_equal(rtv02[1], -0.02915588494045333, 6, 'sla_tpv2c, v02(2)') + T.assert_almost_equal(rtv02[2], 0.7435467638774610, 6, 'sla_tpv2c, v02(3)') + T.assert_equal(j, 1, 'sla_tpv2c, n') + tv01, tv02, j = S.sla_dtpv2c(xi, eta, v) + T.assert_almost_equal(tv01[0], -0.7074573732537283, 13, 'sla_dtpv2c, v01(1)') + T.assert_almost_equal(tv01[1], -0.2372965765309941, 13, 'sla_dtpv2c, v01(2)') + T.assert_almost_equal(tv01[2], 0.6657284730245545, 13, 'sla_dtpv2c, v01(3)') + T.assert_almost_equal(tv02[0], -0.6680480104758149, 13, 'sla_dtpv2c, v02(1)') + T.assert_almost_equal(tv02[1], -0.02915588494045333, 13, 'sla_dtpv2c, v02(2)') + T.assert_almost_equal(tv02[2], 0.7435467638774610, 13, 'sla_dtpv2c, v02(3)') + T.assert_equal(j, 1, 'sla_dtpv2c, n') + + def testvecmat(self): + # Single precision + av = N.asarray([-0.123, 0.0987, 0.0654]) + rm1 = S.sla_av2m(av) + ans = N.asarray([[0.9930075842721269, 0.05902743090199868, -0.1022335560329612], + [-0.07113807138648245, 0.9903204657727545, -0.1191836812279541], + [0.09420887631983825, 0.1256229973879967, 0.9875948309655174]]) + T.assert_array_almost_equal(rm1, ans, 6, 'sla_av2m') + rm2 = S.sla_euler('yzy', 2.345, -0.333, 2.222) + ans = N.asarray([[-0.1681574770810878, 0.1981362273264315, 0.9656423242187410], + [-0.2285369373983370, 0.9450659587140423, -0.2337117924378156], + [-0.9589024617479674, -0.2599853247796050, -0.1136384607117296]]) + T.assert_array_almost_equal(rm2, ans, 6, 'sla_euler') + rm = S.sla_mxm(rm2, rm1) + ans = N.asarray([[-0.09010460088585805, 0.3075993402463796, 0.9472400998581048], + [-0.3161868071070688, 0.8930686362478707, -0.3200848543149236], + [-0.9444083141897035, -0.3283459407855694, 0.01678926022795169]]) + T.assert_array_almost_equal(rm, ans, 6, 'sla_mxm') + v1 = S.sla_cs2c(3.0123, -0.999) + ans = N.asarray([-0.5366267667260525, 0.06977111097651444, -0.8409302618566215]) + T.assert_array_almost_equal(v1, ans, 6, 'sla_cs2c') + v2 = S.sla_mxv(rm1, v1) + v3 = S.sla_mxv(rm2, v2) + ans = N.asarray([-0.7267487768696160, 0.5011537352639822, 0.4697671220397141]) + T.assert_array_almost_equal(v3, ans, 6, 'sla_mxv') + v4 = S.sla_imxv(rm, v3) + ans = N.asarray([-0.5366267667260526, 0.06977111097651445, -0.8409302618566215]) + T.assert_array_almost_equal(v4, ans, 6, 'sla_imxv') + v5 = S.sla_m2av(rm) + ans = N.asarray([0.006889040510209034, -1.577473205461961, 0.5201843672856759]) + T.assert_array_almost_equal(v5, ans, 6, 'sla_m2av') + v5 *= 1000.0 + v6, vm = S.sla_vn(v5) + ans = N.asarray([0.004147420704640065, -0.9496888606842218, 0.3131674740355448]) + T.assert_array_almost_equal(v6, ans, 6, 'sla_vn, v') + T.assert_almost_equal(vm, 1661.042127339937, 3, 'sla_vn, m') + T.assert_almost_equal(S.sla_vdv(v6, v1), -0.3318384698006295, 6, 'sla_vdv') + v7 = S.sla_vxv(v6, v1) + ans = N.asarray([0.7767720597123304, -0.1645663574562769, -0.5093390925544726]) + T.assert_array_almost_equal(v7, ans, 6, 'sla_vxv') + # Double precision + av = N.asarray([-0.123, 0.0987, 0.0654]) + rm1 = S.sla_dav2m(av) + ans = N.asarray([[0.9930075842721269, 0.05902743090199868, -0.1022335560329612], + [-0.07113807138648245, 0.9903204657727545, -0.1191836812279541], + [0.09420887631983825, 0.1256229973879967, 0.9875948309655174]]) + T.assert_array_almost_equal(rm1, ans, 12, 'sla_dav2m') + rm2 = S.sla_deuler('yzy', 2.345, -0.333, 2.222) + ans = N.asarray([[-0.1681574770810878, 0.1981362273264315, 0.9656423242187410], + [-0.2285369373983370, 0.9450659587140423, -0.2337117924378156], + [-0.9589024617479674, -0.2599853247796050, -0.1136384607117296]]) + T.assert_array_almost_equal(rm2, ans, 12, 'sla_deuler') + rm = S.sla_dmxm(rm2, rm1) + ans = N.asarray([[-0.09010460088585805, 0.3075993402463796, 0.9472400998581048], + [-0.3161868071070688, 0.8930686362478707, -0.3200848543149236], + [-0.9444083141897035, -0.3283459407855694, 0.01678926022795169]]) + T.assert_array_almost_equal(rm, ans, 12, 'sla_dmxm') + v1 = S.sla_dcs2c(3.0123, -0.999) + ans = N.asarray([-0.5366267667260525, 0.06977111097651444, -0.8409302618566215]) + T.assert_array_almost_equal(v1, ans, 12, 'sla_dcs2c') + v2 = S.sla_dmxv(rm1, v1) + v3 = S.sla_dmxv(rm2, v2) + ans = N.asarray([-0.7267487768696160, 0.5011537352639822, 0.4697671220397141]) + T.assert_array_almost_equal(v3, ans, 12, 'sla_dmxv') + v4 = S.sla_dimxv(rm, v3) + ans = N.asarray([-0.5366267667260526, 0.06977111097651445, -0.8409302618566215]) + T.assert_array_almost_equal(v4, ans, 12, 'sla_dimxv') + v5 = S.sla_dm2av(rm) + ans = N.asarray([0.006889040510209034, -1.577473205461961, 0.5201843672856759]) + T.assert_array_almost_equal(v5, ans, 12, 'sla_dm2av') + v5 *= 1000.0 + v6, vm = S.sla_dvn(v5) + ans = N.asarray([0.004147420704640065, -0.9496888606842218, 0.3131674740355448]) + T.assert_array_almost_equal(v6, ans, 12, 'sla_dvn, v') + T.assert_almost_equal(vm, 1661.042127339937, 3, 'sla_dvn, m') + T.assert_almost_equal(S.sla_dvdv(v6, v1), -0.3318384698006295, 12, 'sla_dvdv') + v7 = S.sla_dvxv(v6, v1) + ans = N.asarray([0.7767720597123304, -0.1645663574562769, -0.5093390925544726]) + T.assert_array_almost_equal(v7, ans, 12, 'sla_dvxv') + + def testzd(self): + T.assert_almost_equal(S.sla_zd(-1.023, -0.876, -0.432), + 0.8963914139430839, 12, 'sla_zd') + + +if __name__ == '__main__': + unittest.main() diff --git a/docs/source/user-guide/tutorials/sep/run_test.py b/docs/source/user-guide/tutorials/sep/run_test.py new file mode 100644 --- /dev/null +++ b/docs/source/user-guide/tutorials/sep/run_test.py @@ -0,0 +1,11 @@ +import numpy as np +import sep + +data = np.random.random((256, 256)) + +# Measure a spatially variable background of some image data +# (a numpy array) +bkg = sep.Background(data) + +# ... or with some optional parameters +# bkg = sep.Background(data, mask=mask, bw=64, bh=64, fw=3, fh=3)
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:22
conda/conda
7,498
conda__conda-7498
[ "7372", "7372" ]
f57432f32151b484656fe66197bfba937043c7f9
diff --git a/conda/__init__.py b/conda/__init__.py --- a/conda/__init__.py +++ b/conda/__init__.py @@ -33,6 +33,7 @@ class CondaError(Exception): return_code = 1 + reportable = False # Exception may be reported to core maintainers def __init__(self, message, caused_by=None, **kwargs): self.message = message diff --git a/conda/exceptions.py b/conda/exceptions.py --- a/conda/exceptions.py +++ b/conda/exceptions.py @@ -790,9 +790,9 @@ def print_conda_exception(exc_val, exc_tb=None): if context.debug or context.verbosity > 0: sys.stderr.write(_format_exc(exc_val, exc_tb)) sys.stderr.write('\n') - elif context.json: + elif context.json and exc_val.return_code: import json - stdoutlog = getLogger('conda.stdout') + stdoutlog = getLogger('conda.stdout' if exc_val.return_code else 'conda.stderr') exc_json = json.dumps(exc_val.dump_map(), indent=2, sort_keys=True, cls=EntityEncoder) stdoutlog.info("%s\n" % exc_json) else: @@ -842,13 +842,11 @@ def error_upload_url(self): return context.error_upload_url def handle_exception(self, exc_val, exc_tb): - return_code = getattr(exc_val, 'return_code', None) - if return_code == 0: - return 0 - if isinstance(exc_val, CondaHTTPError): - return self.handle_reportable_application_exception(exc_val, exc_tb) if isinstance(exc_val, CondaError): - return self.handle_application_exception(exc_val, exc_tb) + if exc_val.reportable: + return self.handle_reportable_application_exception(exc_val, exc_tb) + else: + return self.handle_application_exception(exc_val, exc_tb) if isinstance(exc_val, UnicodeError) and PY2: return self.handle_application_exception(EncodingError(exc_val), exc_tb) if isinstance(exc_val, EnvironmentError): @@ -865,8 +863,7 @@ def handle_exception(self, exc_val, exc_tb): def handle_application_exception(self, exc_val, exc_tb): self._print_conda_exception(exc_val, exc_tb) - rc = getattr(exc_val, 'return_code', None) - return rc if rc is not None else 1 + return exc_val.return_code def _print_conda_exception(self, exc_val, exc_tb): print_conda_exception(exc_val, exc_tb) @@ -893,8 +890,7 @@ def handle_reportable_application_exception(self, exc_val, exc_tb): if do_upload: self._execute_upload(error_report) self.print_upload_confirm(do_upload, ask_for_upload, ask_response) - rc = getattr(exc_val, 'return_code', None) - return rc if rc is not None else 1 + return exc_val.return_code def get_error_report(self, exc_val, exc_tb): command = ' '.join(ensure_text_type(s) for s in sys.argv) diff --git a/conda/gateways/connection/__init__.py b/conda/gateways/connection/__init__.py --- a/conda/gateways/connection/__init__.py +++ b/conda/gateways/connection/__init__.py @@ -1,5 +1,13 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals +from functools import partial + +def should_bypass_proxies_patched(should_bypass_proxies_func, url, no_proxy): + # Monkey patch requests, per https://github.com/requests/requests/pull/4723 + if url.startswith("file://"): + return True + return should_bypass_proxies_func(url, no_proxy) + try: from requests import ConnectionError, HTTPError, Session @@ -12,6 +20,12 @@ from requests.packages.urllib3.exceptions import InsecureRequestWarning from requests.structures import CaseInsensitiveDict from requests.utils import get_auth_from_url, get_netrc_auth + + # monkeypatch requests + from requests.utils import should_bypass_proxies + import requests.utils + requests.utils.should_bypass_proxies = partial(should_bypass_proxies_patched, + should_bypass_proxies) except ImportError: # pragma: no cover from pip._vendor.requests import ConnectionError, HTTPError, Session from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter @@ -24,6 +38,13 @@ from pip._vendor.requests.structures import CaseInsensitiveDict from pip._vendor.requests.utils import get_auth_from_url, get_netrc_auth + # monkeypatch requests + from pip._vendor.requests.utils import should_bypass_proxies + import requests.utils + requests.utils.should_bypass_proxies = partial(should_bypass_proxies_patched, + should_bypass_proxies) + + dispatch_hook = dispatch_hook BaseAdapter = BaseAdapter Response = Response
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -401,7 +401,6 @@ def assert_json_parsable(content): stdout, stderr = run_command(Commands.CREATE, prefix, "python=3.5 --json --dry-run", use_exception_handler=True) assert_json_parsable(stdout) - assert not stderr # regression test for #5825 # contents of LINK and UNLINK is expected to have Dist format @@ -1171,7 +1170,6 @@ def test_create_dry_run_json(self): with pytest.raises(DryRunExit): run_command(Commands.CREATE, prefix, "flask", "--dry-run", "--json") stdout, stderr = run_command(Commands.CREATE, prefix, "flask", "--dry-run", "--json", use_exception_handler=True) - loaded = json.loads(stdout) names = set(d['name'] for d in loaded['actions']['LINK']) assert "python" in names
Typo in channel name generates application error report <!-- 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 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.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, and especially if you are submitting a bug report, **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. --> **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. --> Conda throws CondaHTTPError and also states the problem. ### 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. --> ``` [root@1fd6151b88ea ~]# conda install -c defautls conda-build Solving environment: failed # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< `$ /opt/conda/bin/conda install -c defautls conda-build` environment variables: CIO_TEST=<not set> CONDA_ROOT=/opt/conda PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin :/bin REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> active environment : None user config file : /root/.condarc populated config files : /root/.condarc conda version : 4.5.4 conda-build version : 3.10.2 python version : 3.6.5.final.0 base environment : /opt/conda (writable) channel URLs : https://conda.anaconda.org/defautls/linux-64 https://conda.anaconda.org/defautls/noarch https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/linux-64 https://repo.anaconda.com/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.5.4 requests/2.18.4 CPython/3.6.5 Linux/3.10.0-693.5.2.el7.x86_64 centos/6.9 glibc/2.12 UID:GID : 0:0 netrc file : None offline mode : False V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V CondaHTTPError: HTTP 404 NOT FOUND for url <https://conda.anaconda.org/defautls/noarch/repodata.json> Elapsed: 00:00.063091 CF-RAY: 4258625a0ae3592d-DFW The remote server could not find the noarch directory for the requested channel with url: https://conda.anaconda.org/defautls As of conda 4.3, a valid channel must contain a `noarch/repodata.json` and associated `noarch/repodata.json.bz2` file, even if `noarch/repodata.json` is empty. please request that the channel administrator create `noarch/repodata.json` and associated `noarch/repodata.json.bz2` files. $ mkdir noarch $ echo '{}' > noarch/repodata.json $ bzip2 -k noarch/repodata.json You will need to adjust your conda configuration to proceed. Use `conda config --show channels` to view your configuration's current state. Further configuration help can be found at <https://conda.io/docs/config.html>. A reportable application error has occurred. Conda has prepared the above report. If submitted, this report will be used by core maintainers to improve future releases of conda. Would you like conda to send this report to the core maintainers? [y/N]: No report sent. To permanently opt-out, use $ conda config --set report_errors false ``` ## Expected Behavior <!-- What do you think should happen? --> Conda shouldn't generate a report. It's the end user's fault, not a fault in conda. It should handle the scenario nicely. ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` [root@1fd6151b88ea ~]# conda info active environment : None user config file : /root/.condarc populated config files : /root/.condarc conda version : 4.5.4 conda-build version : 3.10.2 python version : 3.6.5.final.0 base environment : /opt/conda (writable) channel URLs : https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/linux-64 https://repo.anaconda.com/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.5.4 requests/2.18.4 CPython/3.6.5 Linux/3.10.0-693.5.2.el7.x86_64 centos/6.9 glibc/2.12 UID:GID : 0:0 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' --> ``` [root@1fd6151b88ea ~]# conda config --show-sources ==> /root/.condarc <== add_pip_as_python_dependency: False show_channel_urls: True ``` </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' --> ``` [root@1fd6151b88ea ~]# conda list --show-channel-url # packages in environment at /opt/conda: # # Name Version Build Channel anaconda-client 1.6.14 py36_0 defaults asn1crypto 0.24.0 py36_0 defaults beautifulsoup4 4.6.0 py36h49b8c8c_1 defaults binutils_impl_linux-64 2.28.1 had2808c_3 defaults binutils_linux-64 7.2.0 26 defaults ca-certificates 2018.03.07 0 defaults certifi 2018.4.16 py36_0 defaults cffi 1.11.5 py36h9745a5d_0 defaults chardet 3.0.4 py36h0f667ec_1 defaults clyent 1.2.2 py36h7e57e65_1 defaults conda 4.5.4 py36_0 defaults conda-build 3.10.2 py36_0 defaults conda-concourse-ci 0.1.0 <pip> conda-env 2.6.0 h36134e3_1 defaults conda-verify 2.0.0 py36h98955d8_0 defaults cryptography 2.2.2 py36h14c3975_0 defaults curl 7.59.0 h84994c4_0 defaults decorator 4.3.0 py36_0 defaults expat 2.2.5 he0dffb1_0 defaults filelock 3.0.4 py36_0 defaults gcc_impl_linux-64 7.2.0 habb00fd_3 defaults gcc_linux-64 7.2.0 26 defaults git 2.17.0 pl526hb75a9fb_0 defaults glob2 0.6 py36he249c77_0 defaults gxx_impl_linux-64 7.2.0 hdf63c60_3 defaults gxx_linux-64 7.2.0 26 defaults idna 2.6 py36h82fb2a8_1 defaults ipython_genutils 0.2.0 py36hb52b0d5_0 defaults jinja2 2.10 py36ha16c418_0 defaults jsonschema 2.6.0 py36h006f8b5_0 defaults jupyter_core 4.4.0 py36h7c827e3_0 defaults libcurl 7.59.0 h1ad7b7a_0 defaults libedit 3.1.20170329 h6b74fdf_2 defaults libffi 3.2.1 hd88cf55_4 defaults libgcc-ng 7.2.0 hdf63c60_3 defaults libssh2 1.8.0 h9cfc8f7_4 defaults libstdcxx-ng 7.2.0 hdf63c60_3 defaults markupsafe 1.0 py36hd9260cd_1 defaults nbformat 4.4.0 py36h31c9010_0 defaults ncurses 6.1 hf484d3e_0 defaults openssl 1.0.2o h20670df_0 defaults patchelf 0.9 hf79760b_2 defaults perl 5.26.0 hae598fd_0 defaults pip 10.0.1 py36_0 defaults pkginfo 1.4.2 py36_1 defaults psutil 5.4.5 py36h14c3975_0 defaults pycosat 0.6.3 py36h0a5515d_0 defaults pycparser 2.18 py36hf9f622e_1 defaults pyopenssl 17.5.0 py36h20ba746_0 defaults pysocks 1.6.8 py36_0 defaults python 3.6.5 hc3d631a_2 defaults python-dateutil 2.7.2 py36_0 defaults pytz 2018.4 py36_0 defaults pyyaml 3.12 py36hafb9ca4_1 defaults readline 7.0 ha6073c6_4 defaults requests 2.18.4 py36he2e5f8d_1 defaults ruamel_yaml 0.15.35 py36h14c3975_1 defaults setuptools 39.1.0 py36_0 defaults six 1.11.0 py36h372c433_1 defaults sqlite 3.23.1 he433501_0 defaults tk 8.6.7 hc745277_3 defaults traitlets 4.3.2 py36h674d592_0 defaults urllib3 1.22 py36hbe7ace6_0 defaults wheel 0.31.0 py36_0 defaults xz 5.2.3 h5e939de_4 defaults yaml 0.1.7 had09818_2 defaults zlib 1.2.11 ha838bed_2 defaults ``` </p></details> Typo in channel name generates application error report <!-- 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 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.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, and especially if you are submitting a bug report, **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. --> **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. --> Conda throws CondaHTTPError and also states the problem. ### 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. --> ``` [root@1fd6151b88ea ~]# conda install -c defautls conda-build Solving environment: failed # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< `$ /opt/conda/bin/conda install -c defautls conda-build` environment variables: CIO_TEST=<not set> CONDA_ROOT=/opt/conda PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin :/bin REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> active environment : None user config file : /root/.condarc populated config files : /root/.condarc conda version : 4.5.4 conda-build version : 3.10.2 python version : 3.6.5.final.0 base environment : /opt/conda (writable) channel URLs : https://conda.anaconda.org/defautls/linux-64 https://conda.anaconda.org/defautls/noarch https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/linux-64 https://repo.anaconda.com/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.5.4 requests/2.18.4 CPython/3.6.5 Linux/3.10.0-693.5.2.el7.x86_64 centos/6.9 glibc/2.12 UID:GID : 0:0 netrc file : None offline mode : False V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V CondaHTTPError: HTTP 404 NOT FOUND for url <https://conda.anaconda.org/defautls/noarch/repodata.json> Elapsed: 00:00.063091 CF-RAY: 4258625a0ae3592d-DFW The remote server could not find the noarch directory for the requested channel with url: https://conda.anaconda.org/defautls As of conda 4.3, a valid channel must contain a `noarch/repodata.json` and associated `noarch/repodata.json.bz2` file, even if `noarch/repodata.json` is empty. please request that the channel administrator create `noarch/repodata.json` and associated `noarch/repodata.json.bz2` files. $ mkdir noarch $ echo '{}' > noarch/repodata.json $ bzip2 -k noarch/repodata.json You will need to adjust your conda configuration to proceed. Use `conda config --show channels` to view your configuration's current state. Further configuration help can be found at <https://conda.io/docs/config.html>. A reportable application error has occurred. Conda has prepared the above report. If submitted, this report will be used by core maintainers to improve future releases of conda. Would you like conda to send this report to the core maintainers? [y/N]: No report sent. To permanently opt-out, use $ conda config --set report_errors false ``` ## Expected Behavior <!-- What do you think should happen? --> Conda shouldn't generate a report. It's the end user's fault, not a fault in conda. It should handle the scenario nicely. ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` [root@1fd6151b88ea ~]# conda info active environment : None user config file : /root/.condarc populated config files : /root/.condarc conda version : 4.5.4 conda-build version : 3.10.2 python version : 3.6.5.final.0 base environment : /opt/conda (writable) channel URLs : https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/linux-64 https://repo.anaconda.com/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.5.4 requests/2.18.4 CPython/3.6.5 Linux/3.10.0-693.5.2.el7.x86_64 centos/6.9 glibc/2.12 UID:GID : 0:0 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' --> ``` [root@1fd6151b88ea ~]# conda config --show-sources ==> /root/.condarc <== add_pip_as_python_dependency: False show_channel_urls: True ``` </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' --> ``` [root@1fd6151b88ea ~]# conda list --show-channel-url # packages in environment at /opt/conda: # # Name Version Build Channel anaconda-client 1.6.14 py36_0 defaults asn1crypto 0.24.0 py36_0 defaults beautifulsoup4 4.6.0 py36h49b8c8c_1 defaults binutils_impl_linux-64 2.28.1 had2808c_3 defaults binutils_linux-64 7.2.0 26 defaults ca-certificates 2018.03.07 0 defaults certifi 2018.4.16 py36_0 defaults cffi 1.11.5 py36h9745a5d_0 defaults chardet 3.0.4 py36h0f667ec_1 defaults clyent 1.2.2 py36h7e57e65_1 defaults conda 4.5.4 py36_0 defaults conda-build 3.10.2 py36_0 defaults conda-concourse-ci 0.1.0 <pip> conda-env 2.6.0 h36134e3_1 defaults conda-verify 2.0.0 py36h98955d8_0 defaults cryptography 2.2.2 py36h14c3975_0 defaults curl 7.59.0 h84994c4_0 defaults decorator 4.3.0 py36_0 defaults expat 2.2.5 he0dffb1_0 defaults filelock 3.0.4 py36_0 defaults gcc_impl_linux-64 7.2.0 habb00fd_3 defaults gcc_linux-64 7.2.0 26 defaults git 2.17.0 pl526hb75a9fb_0 defaults glob2 0.6 py36he249c77_0 defaults gxx_impl_linux-64 7.2.0 hdf63c60_3 defaults gxx_linux-64 7.2.0 26 defaults idna 2.6 py36h82fb2a8_1 defaults ipython_genutils 0.2.0 py36hb52b0d5_0 defaults jinja2 2.10 py36ha16c418_0 defaults jsonschema 2.6.0 py36h006f8b5_0 defaults jupyter_core 4.4.0 py36h7c827e3_0 defaults libcurl 7.59.0 h1ad7b7a_0 defaults libedit 3.1.20170329 h6b74fdf_2 defaults libffi 3.2.1 hd88cf55_4 defaults libgcc-ng 7.2.0 hdf63c60_3 defaults libssh2 1.8.0 h9cfc8f7_4 defaults libstdcxx-ng 7.2.0 hdf63c60_3 defaults markupsafe 1.0 py36hd9260cd_1 defaults nbformat 4.4.0 py36h31c9010_0 defaults ncurses 6.1 hf484d3e_0 defaults openssl 1.0.2o h20670df_0 defaults patchelf 0.9 hf79760b_2 defaults perl 5.26.0 hae598fd_0 defaults pip 10.0.1 py36_0 defaults pkginfo 1.4.2 py36_1 defaults psutil 5.4.5 py36h14c3975_0 defaults pycosat 0.6.3 py36h0a5515d_0 defaults pycparser 2.18 py36hf9f622e_1 defaults pyopenssl 17.5.0 py36h20ba746_0 defaults pysocks 1.6.8 py36_0 defaults python 3.6.5 hc3d631a_2 defaults python-dateutil 2.7.2 py36_0 defaults pytz 2018.4 py36_0 defaults pyyaml 3.12 py36hafb9ca4_1 defaults readline 7.0 ha6073c6_4 defaults requests 2.18.4 py36he2e5f8d_1 defaults ruamel_yaml 0.15.35 py36h14c3975_1 defaults setuptools 39.1.0 py36_0 defaults six 1.11.0 py36h372c433_1 defaults sqlite 3.23.1 he433501_0 defaults tk 8.6.7 hc745277_3 defaults traitlets 4.3.2 py36h674d592_0 defaults urllib3 1.22 py36hbe7ace6_0 defaults wheel 0.31.0 py36_0 defaults xz 5.2.3 h5e939de_4 defaults yaml 0.1.7 had09818_2 defaults zlib 1.2.11 ha838bed_2 defaults ``` </p></details>
2018-07-06T14:04:14
conda/conda
7,499
conda__conda-7499
[ "7473", "7473" ]
f57432f32151b484656fe66197bfba937043c7f9
diff --git a/conda/_vendor/toolz/functoolz.py b/conda/_vendor/toolz/functoolz.py --- a/conda/_vendor/toolz/functoolz.py +++ b/conda/_vendor/toolz/functoolz.py @@ -498,7 +498,7 @@ def composed_doc(*fs): def __name__(self): try: return '_of_'.join( - f.__name__ for f in reversed((self.first,) + self.funcs), + (f.__name__ for f in reversed((self.first,) + self.funcs)), ) except AttributeError: return type(self).__name__
diff --git a/tests/test_activate.py b/tests/test_activate.py --- a/tests/test_activate.py +++ b/tests/test_activate.py @@ -1030,8 +1030,8 @@ def __exit__(self, exc_type, exc_val, exc_tb): def sendline(self, s): return self.p.sendline(s) - def expect(self, pattern, timeout=-1, searchwindowsize=-1, async=False): - return self.p.expect(pattern, timeout, searchwindowsize, async) + def expect(self, pattern, timeout=-1, searchwindowsize=-1, async_=False): + return self.p.expect(pattern, timeout, searchwindowsize, async_) def assert_env_var(self, env_var, value, use_exact=False): # value is actually a regex
Test failures against Python 3.7 using recipe in https://github.com/AnacondaRecipes/conda-feedstock.git Getting the following test failures, have ignored them for the in-progress build outs, but we should aim to not release the ones that failed. ``` =================================== FAILURES =================================== _________________ test_PackageCacheData_return_value_contract __________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/test_api.py", line 199, in test_PackageCacheData_return_value_contract single_pcrec = next(pc.iter_records()) StopIteration _____________________________ test_check_whitelist _____________________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/core/test_index.py", line 42, in test_check_whitelist check_whitelist((DEFAULT_CHANNELS[0], DEFAULT_CHANNELS[1])) File "/opt/conda/conda-bld/conda_1530271501905/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.7/site-packages/conda/core/index.py", line 41, in check_whitelist % (bad_channel.location, bad_channel.canonical_name)) conda.exceptions.OperationNotAllowed: Channel not included in whitelist: location: repo.anaconda.com canonical name: https://repo.anaconda.com/pkgs/free ___________ DefaultConfigChannelTests.test_channel_name_subdir_only ____________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 145, in test_channel_name_subdir_only assert channel.location == "repo.anaconda.com" AssertionError: assert 'conda.anaconda.org' == 'repo.anaconda.com' - conda.anaconda.org + repo.anaconda.com ________________ DefaultConfigChannelTests.test_default_channel ________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 99, in test_default_channel assert dc.urls() == self.DEFAULT_URLS AssertionError: assert ['https://rep.../main/noarch'] == ['https://repo.../noarch', ...] Right contains more items, first extra item: 'https://repo.anaconda.com/pkgs/free/linux-64' Full diff: ['https://repo.anaconda.com/pkgs/main/linux-64', - 'https://repo.anaconda.com/pkgs/main/noarch'] ? ^ + 'https://repo.anaconda.com/pkgs/main/noarch', ? ^ + 'https://repo.anaconda.com/pkgs/free/linux-64', + 'https://repo.anaconda.com/pkgs/free/noarch', + 'https://repo.anaconda.com/pkgs/r/linux-64', + 'https://repo.anaconda.com/pkgs/r/noarch', + 'https://repo.anaconda.com/pkgs/pro/linux-64', + 'https://repo.anaconda.com/pkgs/pro/noarch'] ____________ DefaultConfigChannelTests.test_url_channel_w_platform _____________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 119, in test_url_channel_w_platform assert channel.canonical_name == 'defaults' AssertionError: assert 'https://repo...com/pkgs/free' == 'defaults' - https://repo.anaconda.com/pkgs/free + defaults ________________ CustomConfigChannelTests.test_defaults_channel ________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 564, in test_defaults_channel assert channel.urls() == self.DEFAULT_URLS AssertionError: assert ['http://192..../noarch', ...] == ['http://192.1...msys2/noarch'] Left contains more items, first extra item: 'https://repo.anaconda.com/pkgs/main/linux-64' Full diff: ['http://192.168.0.15:8080/pkgs/anaconda/linux-64', 'http://192.168.0.15:8080/pkgs/anaconda/noarch', 'http://192.168.0.15:8080/pkgs/pro/linux-64', 'http://192.168.0.15:8080/pkgs/pro/noarch', 'http://192.168.0.15:8080/pkgs/msys2/linux-64', - 'http://192.168.0.15:8080/pkgs/msys2/noarch', ? ^ + 'http://192.168.0.15:8080/pkgs/msys2/noarch'] ? ^ - 'https://repo.anaconda.com/pkgs/main/linux-64', - 'https://repo.anaconda.com/pkgs/main/noarch'] _____________ ChannelAuthTokenPriorityTests.test_default_channels ______________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 774, in test_default_channels assert channel.urls() == [ AssertionError: assert ['http://192..../noarch', ...] == ['http://192.1...kgs/r/noarch'] Left contains more items, first extra item: 'https://repo.anaconda.com/pkgs/main/linux-64' Full diff: ['http://192.168.0.15:8080/pkgs/anaconda/linux-64', 'http://192.168.0.15:8080/pkgs/anaconda/noarch', 'ftp://new.url:8082/donald/label/main/linux-64', 'ftp://new.url:8082/donald/label/main/noarch', 'http://192.168.0.15:8080/pkgs/r/linux-64', - 'http://192.168.0.15:8080/pkgs/r/noarch', ? ^ + 'http://192.168.0.15:8080/pkgs/r/noarch'] ? ^ - 'https://repo.anaconda.com/pkgs/main/linux-64', - 'https://repo.anaconda.com/pkgs/main/noarch'] _____________________ UrlChannelTests.test_subdirs_env_var _____________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 872, in test_subdirs_env_var assert c.urls() == list(_channel_urls()) AssertionError: assert ['https://rep.../main/noarch'] == ['https://repo.../noarch', ...] Right contains more items, first extra item: 'https://repo.anaconda.com/pkgs/free/linux-highest' Full diff: ['https://repo.anaconda.com/pkgs/main/linux-highest', 'https://repo.anaconda.com/pkgs/main/linux-64', - 'https://repo.anaconda.com/pkgs/main/noarch'] ? ^ + 'https://repo.anaconda.com/pkgs/main/noarch', ? ^ + 'https://repo.anaconda.com/pkgs/free/linux-highest', + 'https://repo.anaconda.com/pkgs/free/linux-64', + 'https://repo.anaconda.com/pkgs/free/noarch', + 'https://repo.anaconda.com/pkgs/r/linux-highest', + 'https://repo.anaconda.com/pkgs/r/linux-64', + 'https://repo.anaconda.com/pkgs/r/noarch', + 'https://repo.anaconda.com/pkgs/pro/linux-highest', + 'https://repo.anaconda.com/pkgs/pro/linux-64', + 'https://repo.anaconda.com/pkgs/pro/noarch'] __________________________ test_multichannel_priority __________________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 1014, in test_multichannel_priority assert channel_priority_map == OrderedDict([ AssertionError: assert OrderedDict([...-forge', 2))]) == OrderedDict([(...-forge', 5))]) Common items: {'https://conda.anaconda.org/conda-test/linux-32': ('conda-test', 0), 'https://conda.anaconda.org/conda-test/new-optimized-subdir': ('conda-test', 0), 'https://conda.anaconda.org/conda-test/noarch': ('conda-test', 0), 'https://repo.anaconda.com/pkgs/main/linux-32': ('defaults', 1), 'https://repo.anaconda.com/pkgs/main/new-optimized-subdir': ('defaults', 1), 'https://repo.anaconda.com/pkgs/main/noarch': ('defaults', 1)} Differing items: {'https://conda.anaconda.org/conda-forge/noarch': ('conda-forge', 2)} != {'https://conda.anaconda.org/conda-forge/noarch': ('conda-forge', 5)} {'https://conda.anaconda.org/conda-forge/new-optimized-subdir': ('conda-forge', 2)} != {'https://conda.anaconda.org/conda-forge/new-optimized-subdir': ('conda-forge', 5)} {'https://conda.anaconda.org/conda-forge/linux-32': ('conda-forge', 2)} != {'https://conda.anaconda.org/conda-forge/linux-32': ('conda-forge', 5)} Right contains more items: {'https://repo.anaconda.com/pkgs/free/linux-32': ('defaults', 2), 'https://repo.anaconda.com/pkgs/free/new-optimized-subdir': ('defaults', 2), 'https://repo.anaconda.com/pkgs/free/noarch': ('defaults', 2), 'https://repo.anaconda.com/pkgs/pro/linux-32': ('defaults', 4), 'https://repo.anaconda.com/pkgs/pro/new-optimized-subdir': ('defaults', 4), 'https://repo.anaconda.com/pkgs/pro/noarch': ('defaults', 4), 'https://repo.anaconda.com/pkgs/r/linux-32': ('defaults', 3), 'https://repo.anaconda.com/pkgs/r/new-optimized-subdir': ('defaults', 3), 'https://repo.anaconda.com/pkgs/r/noarch': ('defaults', 3)} Full diff: OrderedDict([('https://conda.anaconda.org/conda-test/new-optimized-subdir', ('conda-test', 0)), ('https://conda.anaconda.org/conda-test/linux-32', ('conda-test', 0)), ('https://conda.anaconda.org/conda-test/noarch', ('conda-test', 0)), ('https://repo.anaconda.com/pkgs/main/new-optimized-subdir', ('defaults', 1)), ('https://repo.anaconda.com/pkgs/main/linux-32', ('defaults', 1)), ('https://repo.anaconda.com/pkgs/main/noarch', ('defaults', 1)), + ('https://repo.anaconda.com/pkgs/free/new-optimized-subdir', + ('defaults', 2)), + ('https://repo.anaconda.com/pkgs/free/linux-32', ('defaults', 2)), + ('https://repo.anaconda.com/pkgs/free/noarch', ('defaults', 2)), + ('https://repo.anaconda.com/pkgs/r/new-optimized-subdir', + ('defaults', 3)), + ('https://repo.anaconda.com/pkgs/r/linux-32', ('defaults', 3)), + ('https://repo.anaconda.com/pkgs/r/noarch', ('defaults', 3)), + ('https://repo.anaconda.com/pkgs/pro/new-optimized-subdir', + ('defaults', 4)), + ('https://repo.anaconda.com/pkgs/pro/linux-32', ('defaults', 4)), + ('https://repo.anaconda.com/pkgs/pro/noarch', ('defaults', 4)), ('https://conda.anaconda.org/conda-forge/new-optimized-subdir', - ('conda-forge', 2)), ? ^ + ('conda-forge', 5)), ? ^ ('https://conda.anaconda.org/conda-forge/linux-32', - ('conda-forge', 2)), ? ^ + ('conda-forge', 5)), ? ^ ('https://conda.anaconda.org/conda-forge/noarch', - ('conda-forge', 2))]) ? ^ + ('conda-forge', 5))]) ? ^ ___________________ UrlDistTests.test_dist_with_channel_url ____________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_dist.py", line 61, in test_dist_with_channel_url assert d.channel == 'defaults' AssertionError: assert 'https://repo...com/pkgs/free' == 'defaults' - https://repo.anaconda.com/pkgs/free + defaults _______________ PrefixRecordTests.test_prefix_record_no_channel ________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_index_record.py", line 29, in test_prefix_record_no_channel assert pr.channel.canonical_name == 'defaults' AssertionError: assert 'https://repo...com/pkgs/free' == 'defaults' - https://repo.anaconda.com/pkgs/free + defaults _____________________ MatchSpecTests.test_channel_matching _____________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_match_spec.py", line 280, in test_channel_matching assert ChannelMatch('defaults').match('pkgs/free') is True AssertionError: assert False is True + where False = <bound method ChannelMatch.match of 'defaults'>('pkgs/free') + where <bound method ChannelMatch.match of 'defaults'> = 'defaults'.match + where 'defaults' = ChannelMatch('defaults') ___________________________ MatchSpecTests.test_dist ___________________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_match_spec.py", line 336, in test_dist assert p.match(PackageRecord(name='python', version='3.5.1', build='0', build_number=0, AssertionError: assert False + where False = <bound method MatchSpec.match of MatchSpec(channel='defaults', name=LowerStrMatch('python'), version=VersionSpec('3.5.*'))>(PackageRecord(name='python', version='3.5.1', build='0', build_number=0, channel=Channel(scheme='https', auth=None, lo...openssl 1.0.2*', 'readline 6.2*', 'sqlite', 'tk 8.5*', 'xz 5.0.5', 'zlib 1.2*', 'pip'), subdir='osx-64', size=14678857)) + where <bound method MatchSpec.match of MatchSpec(channel='defaults', name=LowerStrMatch('python'), version=VersionSpec('3.5.*'))> = MatchSpec(channel='defaults', name=LowerStrMatch('python'), version=VersionSpec('3.5.*')).match + and PackageRecord(name='python', version='3.5.1', build='0', build_number=0, channel=Channel(scheme='https', auth=None, lo...openssl 1.0.2*', 'readline 6.2*', 'sqlite', 'tk 8.5*', 'xz 5.0.5', 'zlib 1.2*', 'pip'), subdir='osx-64', size=14678857) = PackageRecord(name='python', version='3.5.1', build='0', build_number=0, depends=('openssl 1.0.2*', 'readline 6.2*', 'sqlite', 'tk 8.5*', 'xz 5.0.5', 'zlib 1.2*', ...), channel=Channel(scheme='https', auth=None, location='repo.anaconda.com', token=None, name='pkgs/free', platform='osx-64', package_filename=None), subdir='osx-64', fn='python-3.5.1-0.tar.bz2', md5='a813bc0a32691ab3331ac9f37125164c', size=14678857, priority=0, url='https://repo.anaconda.com/pkgs/free/osx-64/python-3.5.1-0.tar.bz2') + where Channel(scheme='https', auth=None, location='repo.anaconda.com', token=None, name='pkgs/free', platform='osx-64', package_filename=None) = Channel(scheme='https', auth=None, location='repo.anaconda.com', token=None, name='pkgs/free', platform='osx-64', package_filename=None) _____________ SpecStrParsingTests.test_parse_spec_str_tarball_url ______________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_match_spec.py", line 487, in test_parse_spec_str_tarball_url assert _parse_spec_str(url) == { AssertionError: assert {'build': 'py...license', ...} == {'build': 'py2...license', ...} Common items: {'build': 'py27_1', 'fn': '_license-1.1-py27_1.tar.bz2', 'name': '_license', 'subdir': 'linux-64', 'url': 'https://repo.anaconda.com/pkgs/free/linux-64/_license-1.1-py27_1.tar.bz2', 'version': '1.1'} Differing items: {'channel': 'https://repo.anaconda.com/pkgs/free'} != {'channel': 'defaults'} Full diff: {'build': 'py27_1', - 'channel': 'https://repo.anaconda.com/pkgs/free', + 'channel': 'defaults', 'fn': '_license-1.1-py27_1.tar.bz2', 'name': '_license', 'subdir': 'linux-64', 'url': 'https://repo.anaconda.com/pkgs/free/linux-64/_license-1.1-py27_1.tar.bz2', 'version': '1.1'} ========================== slowest 16 test durations =========================== 3.41s call tests/core/test_solve.py::test_priority_1 2.26s call tests/core/test_solve.py::test_remove_with_constrained_dependencies 1.89s call tests/models/test_prefix_graph.py::test_prefix_graph_1 1.67s call tests/models/test_prefix_graph.py::test_windows_sort_orders_1 1.47s call tests/core/test_solve.py::test_features_solve_1 1.46s call tests/core/test_solve.py::test_update_deps_1 1.17s call tests/core/test_solve.py::test_install_uninstall_features_2 1.12s call tests/core/test_solve.py::test_pinned_1 1.11s call tests/core/test_solve.py::test_prune_1 1.11s call tests/core/test_solve.py::test_broken_install 1.06s call tests/test_logic.py::test_AMONE 0.87s call tests/models/test_prefix_graph.py::test_deep_cyclical_dependency 0.68s call tests/test_resolve.py::test_generate_eq_1 0.65s call tests/core/test_solve.py::test_no_deps_1 0.63s call tests/core/test_solve.py::test_only_deps_2 0.61s call tests/core/test_solve.py::test_install_uninstall_features_1 = 14 failed, 422 passed, 3 skipped, 144 deselected, 1 xfailed in 35.94 seconds = Tests failed for conda-4.5.2-py37_0.tar.bz2 - moving package to /opt/conda/conda-bld/broken WARNING:conda_build.build:Tests failed for conda-4.5.2-py37_0.tar.bz2 - moving package to /opt/conda/conda-bld/broken removing: conda-4.5.2-py37_0.tar.bz2 TESTS FAILED: conda-4.5.2-py37_0.tar.bz2 ``` Test failures against Python 3.7 using recipe in https://github.com/AnacondaRecipes/conda-feedstock.git Getting the following test failures, have ignored them for the in-progress build outs, but we should aim to not release the ones that failed. ``` =================================== FAILURES =================================== _________________ test_PackageCacheData_return_value_contract __________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/test_api.py", line 199, in test_PackageCacheData_return_value_contract single_pcrec = next(pc.iter_records()) StopIteration _____________________________ test_check_whitelist _____________________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/core/test_index.py", line 42, in test_check_whitelist check_whitelist((DEFAULT_CHANNELS[0], DEFAULT_CHANNELS[1])) File "/opt/conda/conda-bld/conda_1530271501905/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.7/site-packages/conda/core/index.py", line 41, in check_whitelist % (bad_channel.location, bad_channel.canonical_name)) conda.exceptions.OperationNotAllowed: Channel not included in whitelist: location: repo.anaconda.com canonical name: https://repo.anaconda.com/pkgs/free ___________ DefaultConfigChannelTests.test_channel_name_subdir_only ____________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 145, in test_channel_name_subdir_only assert channel.location == "repo.anaconda.com" AssertionError: assert 'conda.anaconda.org' == 'repo.anaconda.com' - conda.anaconda.org + repo.anaconda.com ________________ DefaultConfigChannelTests.test_default_channel ________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 99, in test_default_channel assert dc.urls() == self.DEFAULT_URLS AssertionError: assert ['https://rep.../main/noarch'] == ['https://repo.../noarch', ...] Right contains more items, first extra item: 'https://repo.anaconda.com/pkgs/free/linux-64' Full diff: ['https://repo.anaconda.com/pkgs/main/linux-64', - 'https://repo.anaconda.com/pkgs/main/noarch'] ? ^ + 'https://repo.anaconda.com/pkgs/main/noarch', ? ^ + 'https://repo.anaconda.com/pkgs/free/linux-64', + 'https://repo.anaconda.com/pkgs/free/noarch', + 'https://repo.anaconda.com/pkgs/r/linux-64', + 'https://repo.anaconda.com/pkgs/r/noarch', + 'https://repo.anaconda.com/pkgs/pro/linux-64', + 'https://repo.anaconda.com/pkgs/pro/noarch'] ____________ DefaultConfigChannelTests.test_url_channel_w_platform _____________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 119, in test_url_channel_w_platform assert channel.canonical_name == 'defaults' AssertionError: assert 'https://repo...com/pkgs/free' == 'defaults' - https://repo.anaconda.com/pkgs/free + defaults ________________ CustomConfigChannelTests.test_defaults_channel ________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 564, in test_defaults_channel assert channel.urls() == self.DEFAULT_URLS AssertionError: assert ['http://192..../noarch', ...] == ['http://192.1...msys2/noarch'] Left contains more items, first extra item: 'https://repo.anaconda.com/pkgs/main/linux-64' Full diff: ['http://192.168.0.15:8080/pkgs/anaconda/linux-64', 'http://192.168.0.15:8080/pkgs/anaconda/noarch', 'http://192.168.0.15:8080/pkgs/pro/linux-64', 'http://192.168.0.15:8080/pkgs/pro/noarch', 'http://192.168.0.15:8080/pkgs/msys2/linux-64', - 'http://192.168.0.15:8080/pkgs/msys2/noarch', ? ^ + 'http://192.168.0.15:8080/pkgs/msys2/noarch'] ? ^ - 'https://repo.anaconda.com/pkgs/main/linux-64', - 'https://repo.anaconda.com/pkgs/main/noarch'] _____________ ChannelAuthTokenPriorityTests.test_default_channels ______________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 774, in test_default_channels assert channel.urls() == [ AssertionError: assert ['http://192..../noarch', ...] == ['http://192.1...kgs/r/noarch'] Left contains more items, first extra item: 'https://repo.anaconda.com/pkgs/main/linux-64' Full diff: ['http://192.168.0.15:8080/pkgs/anaconda/linux-64', 'http://192.168.0.15:8080/pkgs/anaconda/noarch', 'ftp://new.url:8082/donald/label/main/linux-64', 'ftp://new.url:8082/donald/label/main/noarch', 'http://192.168.0.15:8080/pkgs/r/linux-64', - 'http://192.168.0.15:8080/pkgs/r/noarch', ? ^ + 'http://192.168.0.15:8080/pkgs/r/noarch'] ? ^ - 'https://repo.anaconda.com/pkgs/main/linux-64', - 'https://repo.anaconda.com/pkgs/main/noarch'] _____________________ UrlChannelTests.test_subdirs_env_var _____________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 872, in test_subdirs_env_var assert c.urls() == list(_channel_urls()) AssertionError: assert ['https://rep.../main/noarch'] == ['https://repo.../noarch', ...] Right contains more items, first extra item: 'https://repo.anaconda.com/pkgs/free/linux-highest' Full diff: ['https://repo.anaconda.com/pkgs/main/linux-highest', 'https://repo.anaconda.com/pkgs/main/linux-64', - 'https://repo.anaconda.com/pkgs/main/noarch'] ? ^ + 'https://repo.anaconda.com/pkgs/main/noarch', ? ^ + 'https://repo.anaconda.com/pkgs/free/linux-highest', + 'https://repo.anaconda.com/pkgs/free/linux-64', + 'https://repo.anaconda.com/pkgs/free/noarch', + 'https://repo.anaconda.com/pkgs/r/linux-highest', + 'https://repo.anaconda.com/pkgs/r/linux-64', + 'https://repo.anaconda.com/pkgs/r/noarch', + 'https://repo.anaconda.com/pkgs/pro/linux-highest', + 'https://repo.anaconda.com/pkgs/pro/linux-64', + 'https://repo.anaconda.com/pkgs/pro/noarch'] __________________________ test_multichannel_priority __________________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_channel.py", line 1014, in test_multichannel_priority assert channel_priority_map == OrderedDict([ AssertionError: assert OrderedDict([...-forge', 2))]) == OrderedDict([(...-forge', 5))]) Common items: {'https://conda.anaconda.org/conda-test/linux-32': ('conda-test', 0), 'https://conda.anaconda.org/conda-test/new-optimized-subdir': ('conda-test', 0), 'https://conda.anaconda.org/conda-test/noarch': ('conda-test', 0), 'https://repo.anaconda.com/pkgs/main/linux-32': ('defaults', 1), 'https://repo.anaconda.com/pkgs/main/new-optimized-subdir': ('defaults', 1), 'https://repo.anaconda.com/pkgs/main/noarch': ('defaults', 1)} Differing items: {'https://conda.anaconda.org/conda-forge/noarch': ('conda-forge', 2)} != {'https://conda.anaconda.org/conda-forge/noarch': ('conda-forge', 5)} {'https://conda.anaconda.org/conda-forge/new-optimized-subdir': ('conda-forge', 2)} != {'https://conda.anaconda.org/conda-forge/new-optimized-subdir': ('conda-forge', 5)} {'https://conda.anaconda.org/conda-forge/linux-32': ('conda-forge', 2)} != {'https://conda.anaconda.org/conda-forge/linux-32': ('conda-forge', 5)} Right contains more items: {'https://repo.anaconda.com/pkgs/free/linux-32': ('defaults', 2), 'https://repo.anaconda.com/pkgs/free/new-optimized-subdir': ('defaults', 2), 'https://repo.anaconda.com/pkgs/free/noarch': ('defaults', 2), 'https://repo.anaconda.com/pkgs/pro/linux-32': ('defaults', 4), 'https://repo.anaconda.com/pkgs/pro/new-optimized-subdir': ('defaults', 4), 'https://repo.anaconda.com/pkgs/pro/noarch': ('defaults', 4), 'https://repo.anaconda.com/pkgs/r/linux-32': ('defaults', 3), 'https://repo.anaconda.com/pkgs/r/new-optimized-subdir': ('defaults', 3), 'https://repo.anaconda.com/pkgs/r/noarch': ('defaults', 3)} Full diff: OrderedDict([('https://conda.anaconda.org/conda-test/new-optimized-subdir', ('conda-test', 0)), ('https://conda.anaconda.org/conda-test/linux-32', ('conda-test', 0)), ('https://conda.anaconda.org/conda-test/noarch', ('conda-test', 0)), ('https://repo.anaconda.com/pkgs/main/new-optimized-subdir', ('defaults', 1)), ('https://repo.anaconda.com/pkgs/main/linux-32', ('defaults', 1)), ('https://repo.anaconda.com/pkgs/main/noarch', ('defaults', 1)), + ('https://repo.anaconda.com/pkgs/free/new-optimized-subdir', + ('defaults', 2)), + ('https://repo.anaconda.com/pkgs/free/linux-32', ('defaults', 2)), + ('https://repo.anaconda.com/pkgs/free/noarch', ('defaults', 2)), + ('https://repo.anaconda.com/pkgs/r/new-optimized-subdir', + ('defaults', 3)), + ('https://repo.anaconda.com/pkgs/r/linux-32', ('defaults', 3)), + ('https://repo.anaconda.com/pkgs/r/noarch', ('defaults', 3)), + ('https://repo.anaconda.com/pkgs/pro/new-optimized-subdir', + ('defaults', 4)), + ('https://repo.anaconda.com/pkgs/pro/linux-32', ('defaults', 4)), + ('https://repo.anaconda.com/pkgs/pro/noarch', ('defaults', 4)), ('https://conda.anaconda.org/conda-forge/new-optimized-subdir', - ('conda-forge', 2)), ? ^ + ('conda-forge', 5)), ? ^ ('https://conda.anaconda.org/conda-forge/linux-32', - ('conda-forge', 2)), ? ^ + ('conda-forge', 5)), ? ^ ('https://conda.anaconda.org/conda-forge/noarch', - ('conda-forge', 2))]) ? ^ + ('conda-forge', 5))]) ? ^ ___________________ UrlDistTests.test_dist_with_channel_url ____________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_dist.py", line 61, in test_dist_with_channel_url assert d.channel == 'defaults' AssertionError: assert 'https://repo...com/pkgs/free' == 'defaults' - https://repo.anaconda.com/pkgs/free + defaults _______________ PrefixRecordTests.test_prefix_record_no_channel ________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_index_record.py", line 29, in test_prefix_record_no_channel assert pr.channel.canonical_name == 'defaults' AssertionError: assert 'https://repo...com/pkgs/free' == 'defaults' - https://repo.anaconda.com/pkgs/free + defaults _____________________ MatchSpecTests.test_channel_matching _____________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_match_spec.py", line 280, in test_channel_matching assert ChannelMatch('defaults').match('pkgs/free') is True AssertionError: assert False is True + where False = <bound method ChannelMatch.match of 'defaults'>('pkgs/free') + where <bound method ChannelMatch.match of 'defaults'> = 'defaults'.match + where 'defaults' = ChannelMatch('defaults') ___________________________ MatchSpecTests.test_dist ___________________________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_match_spec.py", line 336, in test_dist assert p.match(PackageRecord(name='python', version='3.5.1', build='0', build_number=0, AssertionError: assert False + where False = <bound method MatchSpec.match of MatchSpec(channel='defaults', name=LowerStrMatch('python'), version=VersionSpec('3.5.*'))>(PackageRecord(name='python', version='3.5.1', build='0', build_number=0, channel=Channel(scheme='https', auth=None, lo...openssl 1.0.2*', 'readline 6.2*', 'sqlite', 'tk 8.5*', 'xz 5.0.5', 'zlib 1.2*', 'pip'), subdir='osx-64', size=14678857)) + where <bound method MatchSpec.match of MatchSpec(channel='defaults', name=LowerStrMatch('python'), version=VersionSpec('3.5.*'))> = MatchSpec(channel='defaults', name=LowerStrMatch('python'), version=VersionSpec('3.5.*')).match + and PackageRecord(name='python', version='3.5.1', build='0', build_number=0, channel=Channel(scheme='https', auth=None, lo...openssl 1.0.2*', 'readline 6.2*', 'sqlite', 'tk 8.5*', 'xz 5.0.5', 'zlib 1.2*', 'pip'), subdir='osx-64', size=14678857) = PackageRecord(name='python', version='3.5.1', build='0', build_number=0, depends=('openssl 1.0.2*', 'readline 6.2*', 'sqlite', 'tk 8.5*', 'xz 5.0.5', 'zlib 1.2*', ...), channel=Channel(scheme='https', auth=None, location='repo.anaconda.com', token=None, name='pkgs/free', platform='osx-64', package_filename=None), subdir='osx-64', fn='python-3.5.1-0.tar.bz2', md5='a813bc0a32691ab3331ac9f37125164c', size=14678857, priority=0, url='https://repo.anaconda.com/pkgs/free/osx-64/python-3.5.1-0.tar.bz2') + where Channel(scheme='https', auth=None, location='repo.anaconda.com', token=None, name='pkgs/free', platform='osx-64', package_filename=None) = Channel(scheme='https', auth=None, location='repo.anaconda.com', token=None, name='pkgs/free', platform='osx-64', package_filename=None) _____________ SpecStrParsingTests.test_parse_spec_str_tarball_url ______________ Traceback (most recent call last): File "/opt/conda/conda-bld/conda_1530271501905/test_tmp/tests/models/test_match_spec.py", line 487, in test_parse_spec_str_tarball_url assert _parse_spec_str(url) == { AssertionError: assert {'build': 'py...license', ...} == {'build': 'py2...license', ...} Common items: {'build': 'py27_1', 'fn': '_license-1.1-py27_1.tar.bz2', 'name': '_license', 'subdir': 'linux-64', 'url': 'https://repo.anaconda.com/pkgs/free/linux-64/_license-1.1-py27_1.tar.bz2', 'version': '1.1'} Differing items: {'channel': 'https://repo.anaconda.com/pkgs/free'} != {'channel': 'defaults'} Full diff: {'build': 'py27_1', - 'channel': 'https://repo.anaconda.com/pkgs/free', + 'channel': 'defaults', 'fn': '_license-1.1-py27_1.tar.bz2', 'name': '_license', 'subdir': 'linux-64', 'url': 'https://repo.anaconda.com/pkgs/free/linux-64/_license-1.1-py27_1.tar.bz2', 'version': '1.1'} ========================== slowest 16 test durations =========================== 3.41s call tests/core/test_solve.py::test_priority_1 2.26s call tests/core/test_solve.py::test_remove_with_constrained_dependencies 1.89s call tests/models/test_prefix_graph.py::test_prefix_graph_1 1.67s call tests/models/test_prefix_graph.py::test_windows_sort_orders_1 1.47s call tests/core/test_solve.py::test_features_solve_1 1.46s call tests/core/test_solve.py::test_update_deps_1 1.17s call tests/core/test_solve.py::test_install_uninstall_features_2 1.12s call tests/core/test_solve.py::test_pinned_1 1.11s call tests/core/test_solve.py::test_prune_1 1.11s call tests/core/test_solve.py::test_broken_install 1.06s call tests/test_logic.py::test_AMONE 0.87s call tests/models/test_prefix_graph.py::test_deep_cyclical_dependency 0.68s call tests/test_resolve.py::test_generate_eq_1 0.65s call tests/core/test_solve.py::test_no_deps_1 0.63s call tests/core/test_solve.py::test_only_deps_2 0.61s call tests/core/test_solve.py::test_install_uninstall_features_1 = 14 failed, 422 passed, 3 skipped, 144 deselected, 1 xfailed in 35.94 seconds = Tests failed for conda-4.5.2-py37_0.tar.bz2 - moving package to /opt/conda/conda-bld/broken WARNING:conda_build.build:Tests failed for conda-4.5.2-py37_0.tar.bz2 - moving package to /opt/conda/conda-bld/broken removing: conda-4.5.2-py37_0.tar.bz2 TESTS FAILED: conda-4.5.2-py37_0.tar.bz2 ```
Tangentially, is that [recipe](https://github.com/AnacondaRecipes/conda-feedstock/blob/master/recipe/meta.yaml#L2) actively maintained? Who is responsible for that and what is the workflow? Should we periodically copy this repo's own recipe over? Tangentially, is that [recipe](https://github.com/AnacondaRecipes/conda-feedstock/blob/master/recipe/meta.yaml#L2) actively maintained? Who is responsible for that and what is the workflow? Should we periodically copy this repo's own recipe over?
2018-07-06T15:00:34
conda/conda
7,500
conda__conda-7500
[ "7494" ]
c12b3b49e41485383f6114588aa3bdd1eb9e36cd
diff --git a/conda/history.py b/conda/history.py --- a/conda/history.py +++ b/conda/history.py @@ -8,15 +8,17 @@ from os.path import isdir, isfile, join import re import sys -import time import warnings +import time + from .base.constants import DEFAULTS_CHANNEL_NAME from .common.compat import ensure_text_type, iteritems, open, text_type from .core.prefix_data import PrefixData, linked from .exceptions import CondaFileIOError, CondaHistoryError from .gateways.disk.update import touch from .models.dist import Dist +from .models.version import version_relation_re from .resolve import MatchSpec try: @@ -148,15 +150,12 @@ def _parse_old_format_specs_string(specs_string): """ specs = [] for spec in specs_string.split(','): - # See https://github.com/conda/conda/issues/6691 - if spec[0].isalpha(): - # A valid spec starts with a letter since it is a package name - specs.append(spec) - else: - # Otherwise it is a condition and has to be appended to the - # last valid spec on the specs list + # If the spec starts with a version qualifier, then it actually belongs to the + # previous spec. But don't try to join if there was no previous spec. + if version_relation_re.match(spec) and specs: specs[-1] = ','.join([specs[-1], spec]) - + else: + specs.append(spec) return specs @classmethod
diff --git a/tests/test_history.py b/tests/test_history.py --- a/tests/test_history.py +++ b/tests/test_history.py @@ -1,23 +1,24 @@ from os.path import dirname +from pprint import pprint import unittest from .decorators import skip_if_no_mock from .helpers import mock from .test_create import make_temp_prefix -from conda import history +from conda.history import History from conda.resolve import MatchSpec class HistoryTestCase(unittest.TestCase): def test_works_as_context_manager(self): - h = history.History("/path/to/prefix") + h = History("/path/to/prefix") self.assertTrue(getattr(h, '__enter__')) self.assertTrue(getattr(h, '__exit__')) @skip_if_no_mock def test_calls_update_on_exit(self): - h = history.History("/path/to/prefix") + h = History("/path/to/prefix") with mock.patch.object(h, 'init_log_file') as init_log_file: init_log_file.return_value = None with mock.patch.object(h, 'update') as update: @@ -28,7 +29,7 @@ def test_calls_update_on_exit(self): @skip_if_no_mock def test_returns_history_object_as_context_object(self): - h = history.History("/path/to/prefix") + h = History("/path/to/prefix") with mock.patch.object(h, 'init_log_file') as init_log_file: init_log_file.return_value = None with mock.patch.object(h, 'update'): @@ -37,8 +38,8 @@ def test_returns_history_object_as_context_object(self): @skip_if_no_mock def test_empty_history_check_on_empty_env(self): - with mock.patch.object(history.History, 'file_is_empty') as mock_file_is_empty: - with history.History(make_temp_prefix()) as h: + with mock.patch.object(History, 'file_is_empty') as mock_file_is_empty: + with History(make_temp_prefix()) as h: self.assertEqual(mock_file_is_empty.call_count, 0) self.assertEqual(mock_file_is_empty.call_count, 0) assert h.file_is_empty() @@ -47,8 +48,8 @@ def test_empty_history_check_on_empty_env(self): @skip_if_no_mock def test_parse_on_empty_env(self): - with mock.patch.object(history.History, 'parse') as mock_parse: - with history.History(make_temp_prefix()) as h: + with mock.patch.object(History, 'parse') as mock_parse: + with History(make_temp_prefix()) as h: self.assertEqual(mock_parse.call_count, 0) self.assertEqual(len(h.parse()), 0) self.assertEqual(len(h.parse()), 1) @@ -56,7 +57,7 @@ def test_parse_on_empty_env(self): class UserRequestsTestCase(unittest.TestCase): - h = history.History(dirname(__file__)) + h = History(dirname(__file__)) user_requests = h.get_user_requests() def test_len(self): @@ -88,25 +89,97 @@ def test_conda_comment_version_parsin(self): "# conda version: 4.5.1dev0", ] for line in test_cases: - item = history.History._parse_comment_line(line) + item = History._parse_comment_line(line) assert not item - def test_action_command_comment_parsing(self): - test_cases = [ - # New format (>=4.5) - "# update specs: [\"param[version='>=1.5.1,<2.0']\"]", - # Old format (<4.5) - '# install specs: param >=1.5.1,<2.0', - '# install specs: python>=3.5.1,jupyter >=1.0.0,<2.0,matplotlib >=1.5.1,<2.0,numpy >=1.11.0,<2.0,pandas >=0.19.2,<1.0,psycopg2 >=2.6.1,<3.0,pyyaml >=3.12,<4.0,scipy >=0.17.0,<1.0', - ] - for line in test_cases: - item = history.History._parse_comment_line(line) - specs = item.get('specs') - for spec in specs: - try: - MatchSpec(spec) - except Exception as e: - print('Specs item:', item) - print('Specs:', specs) - print('Invalid Spec:', spec) - raise Exception(e) + def test_specs_line_parsing_44(self): + # New format (>=4.4) + item = History._parse_comment_line("# update specs: [\"param[version='>=1.5.1,<2.0']\"]") + pprint(item) + assert item == { + "action": "update", + "specs": [ + "param[version='>=1.5.1,<2.0']", + ], + "update_specs": [ + "param[version='>=1.5.1,<2.0']", + ], + } + + def test_specs_line_parsing_43(self): + # Old format (<4.4) + item = History._parse_comment_line('# install specs: param >=1.5.1,<2.0') + pprint(item) + assert item == { + 'action': 'install', + 'specs': [ + 'param >=1.5.1,<2.0', + ], + 'update_specs': [ + 'param >=1.5.1,<2.0', + ], + } + + item = History._parse_comment_line('# install specs: param >=1.5.1,<2.0,0packagename >=1.0.0,<2.0') + pprint(item) + assert item == { + 'action': 'install', + 'specs': [ + 'param >=1.5.1,<2.0', + '0packagename >=1.0.0,<2.0', + ], + 'update_specs': [ + 'param >=1.5.1,<2.0', + '0packagename >=1.0.0,<2.0', + ], + } + + item = History._parse_comment_line('# install specs: python>=3.5.1,jupyter >=1.0.0,<2.0,matplotlib >=1.5.1,<2.0,numpy >=1.11.0,<2.0,pandas >=0.19.2,<1.0,psycopg2 >=2.6.1,<3.0,pyyaml >=3.12,<4.0,scipy >=0.17.0,<1.0') + pprint(item) + assert item == { + 'action': 'install', + 'specs': [ + 'python>=3.5.1', + 'jupyter >=1.0.0,<2.0', + 'matplotlib >=1.5.1,<2.0', + 'numpy >=1.11.0,<2.0', + 'pandas >=0.19.2,<1.0', + 'psycopg2 >=2.6.1,<3.0', + 'pyyaml >=3.12,<4.0', + 'scipy >=0.17.0,<1.0', + ], + 'update_specs': [ + 'python>=3.5.1', + 'jupyter >=1.0.0,<2.0', + 'matplotlib >=1.5.1,<2.0', + 'numpy >=1.11.0,<2.0', + 'pandas >=0.19.2,<1.0', + 'psycopg2 >=2.6.1,<3.0', + 'pyyaml >=3.12,<4.0', + 'scipy >=0.17.0,<1.0', + ], + } + + item = History._parse_comment_line('# install specs: _license >=1.0.0,<2.0') + pprint(item) + assert item == { + 'action': 'install', + 'specs': [ + '_license >=1.0.0,<2.0', + ], + 'update_specs': [ + '_license >=1.0.0,<2.0', + ], + } + + item = History._parse_comment_line('# install specs: pandas,_license >=1.0.0,<2.0') + pprint(item) + assert item == { + 'action': 'install', + 'specs': [ + 'pandas', '_license >=1.0.0,<2.0', + ], + 'update_specs': [ + 'pandas', '_license >=1.0.0,<2.0', + ], + }
Errors in History spec parsing with conda 4.5.5 Cond 4.5.5 has a problem: P:\>conda update conda Solving environment: failed ERROR REPORT Traceback (most recent call last): File "C:\Anaconda3\lib\site-packages\conda\exceptions.py", line 819, in __ call__ return func(*args, **kwargs) File "C:\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 77 , in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\Anaconda3\lib\site-packages\conda\cli\main_update.py", line 14, i n execute install(args, parser, 'update') File "C:\Anaconda3\lib\site-packages\conda\cli\install.py", line 235, in i nstall force_reinstall=context.force, File "C:\Anaconda3\lib\site-packages\conda\core\solve.py", line 506, in so lve_for_transaction force_remove, force_reinstall) File "C:\Anaconda3\lib\site-packages\conda\core\solve.py", line 439, in so lve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned , force_remove) File "C:\Anaconda3\lib\site-packages\conda\core\solve.py", line 148, in so lve_final_state specs_from_history_map = History(self.prefix).get_requested_specs_map() File "C:\Anaconda3\lib\site-packages\conda\history.py", line 230, in get_r equested_specs_map for request in self.get_user_requests(): File "C:\Anaconda3\lib\site-packages\conda\history.py", line 215, in get_u ser_requests comment_items = self._parse_comment_line(line) File "C:\Anaconda3\lib\site-packages\conda\history.py", line 191, in _pars e_comment_line specs = History._parse_old_format_specs_string(specs_string) File "C:\Anaconda3\lib\site-packages\conda\history.py", line 158, in _pars e_old_format_specs_string specs[-1] = ','.join([specs[-1], spec]) IndexError: list index out of range `$ C:\Anaconda3\Scripts\conda update conda` environment variables: CIO_TEST=<not set> CONDA_ROOT=C:\Anaconda3 HOMEPATH=\ PATH=C:\Anaconda3\Library\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\ImageMagic k-7.0.7-Q16;C:\A naconda3;C:\Anaconda3\Library\mingw-w64\bin;C:\Anacond a3\Library\usr\b in;C:\Anaconda3\Library\bin;C:\Anaconda3\Scripts;C:\Pr ogram Files\ImageMagick-7.0.6-Q16;C:\Program Files (x86)\ImageMagick-7.0.5-Q16;C:\Program Files (x86)\ImageMagick-7.0.4-Q16;C:\Program Files (x86)\ImageMagick-7.0.3-Q16;C:\Program Files (x86)\Ima geMagick-6.8.6-Q 16;C:\Windows\system32;C:\Windows;C:\Windows\System32\ Wbem;C:\Windows\ System32\WindowsPowerShell\v1.0\;C:\Program Files (x86 )\QS QualitySoft GmbH\QS-Barcode OCX 4.9;C:\Windows\System32\WindowsPow erShell\v1.0\;C: \Windows\System32\WindowsPowerShell\v1.0\;C:\Program F iles\MiKTeX 2.9\ miktex\bin\x64\;C:\Windows\System32\WindowsPowerShell\ v1.0\;C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15 PSMODULEPATH=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C: \Program Files\Microsoft Application Virtualization\Client\ PYTHONPATH=G:\QPS\11-Software\03-Python\01-QPS FRAMEWORK\03-STRATEGIES;G:\QPS\10-Sandbox\02-Mitarbeit er\RMoo\01 - QPS FRAMEWORK\11-STRATEGIES;G:\QPS\10-Sandbox\02-Mitarbeit er\RMoo\01 - QPS FRAMEWORK\01-CORE REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> active environment : None user config file : C:\Users\username\.condarc populated config files : C:\Anaconda3\.condarc C:\Users\username\.condarc conda version : 4.5.5 conda-build version : not installed python version : 3.6.2.final.0 base environment : C:\Anaconda3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/win-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/win-64 https://repo.anaconda.com/pkgs/pro/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Anaconda3\pkgs C:\Users\rmoo\AppData\Local\conda\conda\pkgs envs directories : C:\Anaconda3\envs C:\Users\rmoo\AppData\Local\conda\conda\envs C:\Users\rmoo\.conda\envs platform : win-64 user-agent : conda/4.5.5 requests/2.14.2 CPython/3.6.2 Windows/7 Wi ndows/6.1.7601 administrator : False netrc file : None offline mode : False An unexpected error has occurred. Conda has prepared the above report. The problem seems to be the line specs[-1] = ','.join([specs[-1], spec]) in history.py, which fails if specs = []
At your command prompt, can you please provide the output of type C:\Anaconda3\conda-meta\history or alternately just attach to this issue the file `C:\Anaconda3\conda-meta\history`
2018-07-06T17:03:06
conda/conda
7,512
conda__conda-7512
[ "7505" ]
33dace2c9cf1cd864523df4352f6746721a39118
diff --git a/conda/core/link.py b/conda/core/link.py --- a/conda/core/link.py +++ b/conda/core/link.py @@ -9,7 +9,6 @@ from os.path import basename, dirname, isdir, join from subprocess import CalledProcessError import sys -from tempfile import mkdtemp from traceback import format_exception_only import warnings @@ -281,7 +280,8 @@ def _prepare(cls, transaction_context, target_prefix, unlink_precs, link_precs, sp = get_python_site_packages_short_path(python_version) transaction_context['target_site_packages_short_path'] = sp - transaction_context['temp_dir'] = mkdtemp() + transaction_context['temp_dir'] = join(target_prefix, '.condatmp') + mkdir_p(transaction_context['temp_dir']) unlink_action_groups = tuple(ActionGroup( 'unlink', diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -139,33 +139,6 @@ def source_full_path(self): return join(prfx, win_path_ok(shrt_pth)) if prfx and shrt_pth else None -# @with_metaclass(ABCMeta) -# class CreateLeasedPathAction(CreateInPrefixPathAction): -# def __init__(self, transaction_context, package_info, source_prefix, source_short_path, -# target_prefix, target_short_path): -# super(CreateLeasedPathAction, self).__init__(transaction_context, package_info, -# source_prefix, source_short_path, -# target_prefix, target_short_path) -# self.leased_path_entry = LeasedPathEntry( -# _path=target_short_path, -# target_path=self.source_full_path, -# target_prefix=source_prefix, -# leased_path=self.target_full_path, -# package_name=package_info.index_json_record.name, -# leased_path_type=self.leased_path_type, -# ) -# self._execute_successful = False -# -# def reverse(self): -# if self._execute_successful: -# log.trace("reversing leased path creation %s", self.target_full_path) -# rm_rf(self.target_full_path) -# -# @abstractproperty -# def leased_path_type(self): -# raise NotImplementedError() - - class LinkPathAction(CreateInPrefixPathAction): @classmethod @@ -874,59 +847,6 @@ def target_full_path(self): raise NotImplementedError() -# class RegisterPrivateEnvAction(EnvsDirectoryPathAction): -# -# @classmethod -# def create_actions(cls, transaction_context, package_info, target_prefix, requested_spec, -# leased_paths): -# preferred_env = package_info.repodata_record.preferred_env -# if preferred_env_matches_prefix(preferred_env, target_prefix, context.root_prefix): -# return cls(transaction_context, package_info, context.root_prefix, preferred_env, -# requested_spec, leased_paths), -# else: -# return () -# -# def __init__(self, transaction_context, package_info, root_prefix, env_name, requested_spec, -# leased_paths): -# self.root_prefix = root_prefix -# self.env_name = ensure_pad(env_name) -# target_prefix = join(self.root_prefix, 'envs', self.env_name) -# super(RegisterPrivateEnvAction, self).__init__(transaction_context, target_prefix) -# -# self.package_name = package_info.index_json_record.name -# self.requested_spec = requested_spec -# self.leased_paths = leased_paths -# -# fn = basename(package_info.extracted_package_dir) + '.json' -# self.conda_meta_path = join(self.target_prefix, 'conda-meta', fn) -# -# def execute(self): -# log.trace("registering private env for %s", self.target_prefix) -# -# # touches env prefix entry in catalog.json -# # updates leased_paths -# from .envs_manager import EnvsDirectory -# ed = EnvsDirectory(self.envs_dir_path) -# -# self.envs_dir_state = ed._get_state() -# -# for leased_path_entry in self.leased_paths: -# ed.add_leased_path(leased_path_entry) -# -# ed.add_preferred_env_package(self.env_name, self.package_name, self.conda_meta_path, -# self.requested_spec) -# ed.write_to_disk() -# self._execute_successful = True -# -# def reverse(self): -# if self._execute_successful: -# log.trace("reversing environment unregistration in catalog for %s", self.target_prefix) # NOQA -# from .envs_manager import EnvsDirectory -# ed = EnvsDirectory(self.envs_dir_path) -# ed._set_state(self.envs_dir_state) -# ed.write_to_disk() - - # ###################################################### # Removal of Paths within a Prefix # ###################################################### @@ -1044,62 +964,6 @@ def target_full_path(self): raise NotImplementedError() -# class UnregisterPrivateEnvAction(EnvsDirectoryPathAction): -# -# @classmethod -# def create_actions(cls, transaction_context, linked_package_data, target_prefix): -# preferred_env = ensure_pad(linked_package_data.preferred_env) -# if preferred_env_matches_prefix(preferred_env, target_prefix, context.root_prefix): -# package_name = linked_package_data.name -# -# from .envs_manager import EnvsDirectory -# envs_directory_path = EnvsDirectory.get_envs_directory_for_prefix(target_prefix) -# ed = EnvsDirectory(envs_directory_path) -# -# ed.get_leased_path_entries_for_package(package_name) -# -# leased_path_entries = ed.get_leased_path_entries_for_package(package_name) -# leased_paths_to_remove = tuple(lpe._path for lpe in leased_path_entries) -# unlink_leased_path_actions = (UnlinkPathAction(transaction_context, None, -# context.root_prefix, lp) -# for lp in leased_paths_to_remove) -# -# unregister_private_env_actions = cls(transaction_context, context.root_prefix, -# package_name), -# -# return concatv(unlink_leased_path_actions, unregister_private_env_actions) -# -# else: -# return () -# -# def __init__(self, transaction_context, root_prefix, package_name): -# super(UnregisterPrivateEnvAction, self).__init__(transaction_context, root_prefix) -# self.root_prefix = root_prefix -# self.package_name = package_name -# -# def execute(self): -# log.trace("unregistering private env for %s", self.package_name) -# -# from .envs_manager import EnvsDirectory -# ed = EnvsDirectory(self.envs_dir_path) -# -# self.envs_dir_state = ed._get_state() -# -# ed.remove_preferred_env_package(self.package_name) -# -# ed.write_to_disk() -# self._execute_successful = True -# -# def reverse(self): -# if self._execute_successful: -# log.trace("reversing environment unregistration in catalog for %s", -# self.target_prefix) -# from .envs_manager import EnvsDirectory -# ed = EnvsDirectory(self.envs_dir_path) -# ed._set_state(self.envs_dir_state) -# ed.write_to_disk() - - # ###################################################### # Fetch / Extract Actions # ######################################################
Why need PrefixReplaceLinkAction? It breaks Windows permissions. **I'm submitting a...** - [x] bug report - [ ] feature request ## Current Behavior If the conda environment is read-only to Users, installing as admin packages with files that have "prefix_placeholder" overwrite these files permissions to have no access to Users and makes these packages unusable. ### Steps to Reproduce 1. There is a base installation of Anaconda in C:\Anaconda with permissions inherited from C:\: * Administrators read/write * Users read-only 2. However, C:\Anaconda\Library\Qt5Core.dll permissions are different and explicit: * Administrators read/write * Administrator user read/write * Users - no access 3. `conda uninstall qt` and `conda install qt` as administrator user do not change anything 4. Upon further investigation it turns out that in C:\Anaconda\pkgs\qt-5.9.6-vc14h62aca36_0\info\paths.json the entry for Qt5Core.dll has prefix placeholder: ``` { "_path": "Library/bin/Qt5Core.dll", "file_mode": "binary", "path_type": "hardlink", "prefix_placeholder": "C:/qt5/_h_env", "sha256": "50886da211b4acaacc015e18f52fe44c2a07500f05fd09a9cb3a5c026a5eaba4", "size_in_bytes": 5241344 }, ``` 5. The TRACE output of `conda install qt` shows that in this case PrefixReplaceLinkAction is used: ``` TRACE conda.core.path_actions:verify(385): copying C:\Anaconda\pkgs\qt-5.9.6-vc14h62aca36_0\Library\bin\Qt5Core.dll => C:\Users\labdsvm-admin\tmp6f8xpxgo\a39281e8-cb0c-4f01-9d32-e22b2209f393 TRACE conda.gateways.disk.create:_do_copy(275): copying C:\Anaconda\pkgs\qt-5.9.6-vc14h62aca36_0\Library\bin\Qt5Core.dll => C:\Users\labdsvm-admin\tmp6f8xpxgo\a39281e8-cb0c-4f01-9d32-e22b2209f393 TRACE conda.core.path_actions:verify(390): rewriting prefixes in C:\Anaconda\Library\bin\Qt5Core.dll ``` 6. The temp directory is created by mkdtemp() and the [documentation](https://docs.python.org/3/library/tempfile.html#tempfile.mkdtemp) says that > The directory is readable, writable, and searchable only by the creating user ID. 7. This operation first copies the file from pkgs folder to temporary folder that is only writable by current user and later it hardlinks the file from this directory into C:\Anaconda\Library\bin. ``` TRACE conda.core.path_actions:execute(415): linking C:\Users\labdsvm-admin\tmp6f8xpxgo\a39281e8-cb0c-4f01-9d32-e22b2209f393 => C:\Anaconda\Library\bin\Qt5Core.dll TRACE conda.gateways.disk.create:create_link(321): hard linking C:\Users\labdsvm-admin\tmp6f8xpxgo\a39281e8-cb0c-4f01-9d32-e22b2209f393 => C:\Anaconda\Library\bin\Qt5Core.dll ``` 8. The hardlinks retain source file's permissions, so now, the DLL is not readable by other Users. ## Expected Behavior I do not understand why the treatment for files with prefix_placeholder is so radically different. Why conda cannot hardlink the file from pkgs folder as other files? Why copy into temp folder with specifically minimal permissions? The workaround could be to not use system temp folder, but create a temp folder in conda pkgs directory so that permissions are retained. ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` C:\Users\labdsvm-admin>conda info active environment : None user config file : C:\Users\labdsvm-admin\.condarc populated config files : conda version : 4.5.5 conda-build version : 3.10.9 python version : 3.6.4.final.0 base environment : C:\Anaconda (writable) channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/win-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/win-64 https://repo.anaconda.com/pkgs/pro/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Anaconda\pkgs C:\Users\labdsvm-admin\AppData\Local\conda\conda\pkgs envs directories : C:\Anaconda\envs C:\Users\labdsvm-admin\AppData\Local\conda\conda\envs C:\Users\labdsvm-admin\.conda\envs platform : win-64 user-agent : conda/4.5.5 requests/2.18.4 CPython/3.6.4 Windows/10 Windows/10.0.14393 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\labdsvm-admin>conda config --show-sources ``` </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' --> ``` C:\Users\labdsvm-admin>conda list --show-channel-urls # packages in environment at C:\Anaconda: # # Name Version Build Channel _ipyw_jlab_nb_ext_conf 0.1.0 py36he6757f0_0 defaults _nb_ext_conf 0.4.0 py36_1 defaults absl-py 0.2.0 <pip> adal 0.5.1 <pip> alabaster 0.7.10 py36hcd07829_0 defaults anaconda custom py36h363777c_0 defaults anaconda-client 1.6.9 py36_0 defaults anaconda-project 0.8.2 py36hfad2e28_0 defaults applicationinsights 0.11.3 <pip> asn1crypto 0.24.0 py36_0 defaults astor 0.6.2 <pip> astroid 1.6.1 py36_0 defaults astropy 2.0.3 py36hfa6e2cd_0 defaults attrs 17.4.0 py36_0 defaults azure 3.0.0 <pip> azure-batch 4.1.3 <pip> azure-common 1.1.9 <pip> azure-cosmosdb-nspkg 2.0.2 <pip> azure-cosmosdb-table 1.0.2 <pip> azure-datalake-store 0.0.19 <pip> azure-eventgrid 0.1.0 <pip> azure-graphrbac 0.40.0 <pip> azure-keyvault 0.3.7 <pip> azure-mgmt 2.0.0 <pip> azure-mgmt-advisor 1.0.1 <pip> azure-mgmt-applicationinsights 0.1.1 <pip> azure-mgmt-authorization 0.30.0 <pip> azure-mgmt-batch 5.0.0 <pip> azure-mgmt-batchai 1.0.1 <pip> azure-mgmt-billing 0.1.0 <pip> azure-mgmt-cdn 2.0.0 <pip> azure-mgmt-cognitiveservices 2.0.0 <pip> azure-mgmt-commerce 1.0.1 <pip> azure-mgmt-compute 3.0.1 <pip> azure-mgmt-consumption 2.0.0 <pip> azure-mgmt-containerinstance 0.3.1 <pip> azure-mgmt-containerregistry 1.0.1 <pip> azure-mgmt-containerservice 3.0.1 <pip> azure-mgmt-cosmosdb 0.3.1 <pip> azure-mgmt-datafactory 0.4.0 <pip> azure-mgmt-datalake-analytics 0.3.0 <pip> azure-mgmt-datalake-nspkg 2.0.0 <pip> azure-mgmt-datalake-store 0.3.0 <pip> azure-mgmt-devtestlabs 2.2.0 <pip> azure-mgmt-dns 1.2.0 <pip> azure-mgmt-eventgrid 0.4.0 <pip> azure-mgmt-eventhub 1.2.0 <pip> azure-mgmt-hanaonazure 0.1.0 <pip> azure-mgmt-iothub 0.4.0 <pip> azure-mgmt-iothubprovisioningservices 0.1.0 <pip> azure-mgmt-keyvault 0.40.0 <pip> azure-mgmt-loganalytics 0.1.0 <pip> azure-mgmt-logic 2.1.0 <pip> azure-mgmt-machinelearningcompute 0.4.0 <pip> azure-mgmt-managementpartner 0.1.0 <pip> azure-mgmt-marketplaceordering 0.1.0 <pip> azure-mgmt-media 0.2.0 <pip> azure-mgmt-monitor 0.4.0 <pip> azure-mgmt-msi 0.1.0 <pip> azure-mgmt-network 1.7.1 <pip> azure-mgmt-notificationhubs 1.0.0 <pip> azure-mgmt-nspkg 2.0.0 <pip> azure-mgmt-powerbiembedded 1.0.0 <pip> azure-mgmt-rdbms 0.1.0 <pip> azure-mgmt-recoveryservices 0.2.0 <pip> azure-mgmt-recoveryservicesbackup 0.1.1 <pip> azure-mgmt-redis 5.0.0 <pip> azure-mgmt-relay 0.1.0 <pip> azure-mgmt-reservations 0.1.0 <pip> azure-mgmt-resource 1.2.2 <pip> azure-mgmt-scheduler 1.1.3 <pip> azure-mgmt-search 1.0.0 <pip> azure-mgmt-servermanager 1.2.0 <pip> azure-mgmt-servicebus 0.4.0 <pip> azure-mgmt-servicefabric 0.1.0 <pip> azure-mgmt-sql 0.8.6 <pip> azure-mgmt-storage 1.5.0 <pip> azure-mgmt-subscription 0.1.0 <pip> azure-mgmt-trafficmanager 0.40.0 <pip> azure-mgmt-web 0.34.1 <pip> azure-nspkg 2.0.0 <pip> azure-servicebus 0.21.1 <pip> azure-servicefabric 6.1.2.9 <pip> azure-servicemanagement-legacy 0.20.6 <pip> azure-storage 0.36.0 <pip> azure-storage-blob 1.1.0 <pip> azure-storage-common 1.1.0 <pip> azure-storage-file 1.1.0 <pip> azure-storage-nspkg 3.0.0 <pip> azure-storage-queue 1.1.0 <pip> azureml 0.2.7 <pip> babel 2.5.3 py36_0 defaults backports 1.0 py36h81696a8_1 defaults backports.shutil_get_terminal_size 1.0.0 py36h79ab834_2 defaults beautifulsoup4 4.6.0 py36hd4cc5e8_1 defaults bitarray 0.8.1 py36hfa6e2cd_1 defaults bkcharts 0.2 py36h7e685f7_0 defaults blaze 0.11.3 py36h8a29ca5_0 defaults bleach 2.1.2 py36_0 defaults bleach 1.5.0 <pip> bokeh 0.12.13 py36h047fa9f_0 defaults boto 2.48.0 py36h1a776d2_1 defaults boto3 1.7.4 py36_0 defaults botocore 1.10.4 py36_0 defaults bottleneck 1.2.1 py36hd119dfa_0 defaults bz2file 0.98 py36_0 defaults bzip2 1.0.6 vc14_1 [vc14] conda-forge ca-certificates 2018.03.07 0 defaults cached-property 1.4.2 <pip> certifi 2018.4.16 py36_0 defaults cffi 1.11.4 py36hfa6e2cd_0 defaults chainer 4.0.0 <pip> chainerrl 0.3.0 <pip> chardet 3.0.4 py36h420ce6e_1 defaults click 6.7 py36hec8c647_0 defaults cloudpickle 0.5.2 py36_1 defaults clyent 1.2.2 py36hb10d595_1 defaults cntk-gpu 2.5.1 <pip> colorama 0.3.9 py36h029ae33_0 defaults comtypes 1.1.4 py36_0 defaults conda 4.5.5 py36_0 defaults conda-build 3.10.9 py36_0 defaults conda-env 2.6.0 h36134e3_1 defaults conda-verify 2.0.0 py36h065de53_0 defaults configparser 3.5.0 <pip> console_shortcut 0.1.1 h6bb2dd7_3 defaults contextlib2 0.5.5 py36he5d52c0_0 defaults cryptography 2.1.4 py36he1d7878_0 defaults cuda90 1.0 0 pytorch cupy 4.0.0 <pip> curl 7.59.0 vc14_1 [vc14] conda-forge cycler 0.10.0 py36h009560c_0 defaults cython 0.27.3 py36h22f4c84_0 defaults cytoolz 0.9.0 py36hfa6e2cd_0 defaults dask 0.16.1 py36_0 defaults dask-core 0.16.1 py36_0 defaults databricks-cli 0.7.2 <pip> datashape 0.5.4 py36h5770b85_0 defaults decorator 4.2.1 py36_0 defaults distributed 1.20.2 py36_0 defaults dlib 19.9 np111py36_0 conda-forge docutils 0.14 py36h6012d8f_0 defaults entrypoints 0.2.3 py36hfd66bb0_2 defaults et_xmlfile 1.0.1 py36h3d2d736_0 defaults fastcache 1.0.2 py36hfa6e2cd_2 defaults fastparquet 0.1.5 py36_0 conda-forge fastrlock 0.3 <pip> filelock 2.0.13 py36h20000bf_0 defaults flask 0.12.2 py36h98b5e8f_0 defaults flask-cors 3.0.3 py36h8a3855d_0 defaults freetype 2.8.1 vc14_0 [vc14] conda-forge future 0.16.0 <pip> futures 3.1.1 <pip> gast 0.2.0 <pip> gensim 3.4.0 py36_vc14_0 [vc14] conda-forge get_terminal_size 1.0.0 h38e98db_0 defaults gevent 1.2.2 py36h342a76c_0 defaults glob2 0.6 py36hdf76b57_0 defaults graphviz 0.8.2 <pip> greenlet 0.4.12 py36ha00ad21_0 defaults grpcio 1.11.0 <pip> gym 0.10.5 <pip> h5py 2.7.1 py36he54a1c3_0 defaults hdf5 1.10.1 vc14_2 [vc14] conda-forge heapdict 1.0.0 py36_2 defaults html5lib 1.0.1 py36h047fa9f_0 defaults html5lib 1.0.1 <pip> icc_rt 2017.0.4 h97af966_0 defaults icu 58.2 vc14_0 [vc14] conda-forge idna 2.6 py36h148d497_1 defaults imageio 2.3.0 py36_0 defaults imagesize 0.7.1 py36he29f638_0 defaults intel-openmp 2018.0.0 hd92c6cd_8 defaults ipykernel 4.8.0 py36_0 defaults ipython 6.2.1 py36h9cf0123_1 defaults ipython_genutils 0.2.0 py36h3c5d0ee_0 defaults ipywidgets 7.1.1 py36_0 defaults isodate 0.6.0 <pip> isort 4.2.15 py36h6198cc5_0 defaults itsdangerous 0.24 py36hb6c5a24_1 defaults jdcal 1.3 py36h64a5255_0 defaults jedi 0.11.1 py36_0 defaults jinja2 2.10 py36h292fed1_0 defaults jmespath 0.9.3 py36h0745840_0 defaults jpeg 9b vc14_2 [vc14] conda-forge jsonschema 2.6.0 py36h7636477_0 defaults jupyter_client 5.2.2 py36_0 defaults jupyter_console 5.2.0 py36h6d89b47_1 defaults jupyter_core 4.4.0 py36h56e9d50_0 defaults jupyterlab 0.31.4 py36_0 defaults jupyterlab_launcher 0.10.2 py36_0 defaults Keras 2.1.6 <pip> kiwisolver 1.0.1 py36h12c3424_0 defaults krb5 1.14.6 vc14_0 [vc14] conda-forge lazy-object-proxy 1.3.1 py36hd1c21d2_0 defaults libcurl 7.58.0 h7602738_0 defaults libiconv 1.14 vc14_4 [vc14] conda-forge libpng 1.6.34 vc14_0 [vc14] conda-forge libprotobuf 3.5.2 vc14_0 [vc14] conda-forge libpython 2.1 py36_0 defaults libssh2 1.8.0 vc14_2 [vc14] conda-forge libtiff 4.0.9 vc14_0 [vc14] conda-forge libxml2 2.9.5 vc14_1 [vc14] conda-forge libxslt 1.1.32 vc14_0 [vc14] conda-forge lightgbm 2.1.0 <pip> llvmlite 0.21.0 py36he0b0552_0 defaults locket 0.2.0 py36hfed976d_1 defaults lxml 4.2.1 py36_0 conda-forge lzo 2.10 vc14_0 [vc14] conda-forge Markdown 2.6.11 <pip> markupsafe 1.0 py36h0e26971_1 defaults mccabe 0.6.1 py36hb41005a_1 defaults menuinst 1.4.11 py36hfa6e2cd_0 defaults mistune 0.8.3 py36_0 defaults mkl 2018.0.1 h2108138_4 defaults mkl-service 1.1.2 py36h57e144c_4 defaults mpmath 1.0.0 py36hacc8adf_2 defaults msgpack-python 0.5.1 py36he980bc4_0 defaults msrest 0.4.28 <pip> msrestazure 0.4.28 <pip> multipledispatch 0.4.9 py36he44c36e_0 defaults mxnet-cu90 1.1.0.post0 <pip> nb_anacondacloud 1.4.0 py36_0 defaults nb_conda 2.2.0 py36_0 defaults nb_conda_kernels 2.1.0 py36_0 defaults nbconvert 5.3.1 py36h8dc0fde_0 defaults nbformat 4.4.0 py36h3a5bc1b_0 defaults nbpresent 3.0.2 py36_0 defaults networkx 2.1 py36_0 defaults nltk 3.2.5 py36h76d52bb_0 defaults nose 1.3.7 py36h1c3779e_2 defaults notebook 5.4.0 py36_0 defaults numba 0.36.2 np111py36hf5cdf1b_0 defaults numexpr 2.6.4 py36h30784b8_0 defaults numpy 1.14.2 <pip> numpy 1.11.3 py36h4a99626_4 defaults numpydoc 0.7.0 py36ha25429e_0 defaults oauthlib 2.0.7 <pip> odo 0.5.1 py36h7560279_0 defaults olefile 0.45.1 py36_0 defaults onnx 1.1.1 py36_0 conda-forge opencv-python 3.4.0.12 <pip> openpyxl 2.4.10 py36_0 defaults openssl 1.0.2o h8ea7d77_0 defaults packaging 16.8 py36ha0986f6_1 defaults pandas 0.22.0 py36h6538335_0 defaults pandoc 1.19.2.1 hb2460c7_1 defaults pandocfilters 1.4.2 py36h3ef6317_1 defaults parso 0.1.1 py36hae3edee_0 defaults partd 0.3.8 py36hc8e763b_0 defaults path.py 10.5 py36h2b94a8f_0 defaults pathlib2 2.3.0 py36h7bfb78b_0 defaults patsy 0.5.0 py36_0 defaults pep8 1.7.1 py36_0 defaults pickleshare 0.7.4 py36h9de030f_0 defaults Pillow 5.1.0 <pip> pillow 5.1.0 py36h0738816_0 defaults pip 9.0.1 py36h226ae91_4 defaults pip 10.0.1 <pip> pkginfo 1.4.1 py36hb0f9cfa_1 defaults pluggy 0.6.0 py36hc7daf1e_0 defaults ply 3.10 py36h1211beb_0 defaults prompt_toolkit 1.0.15 py36h60b8f86_0 defaults protobuf 3.5.2 py36_vc14_0 [vc14] conda-forge protobuf 3.5.2.post1 <pip> psutil 5.4.5 py36hfa6e2cd_0 defaults py 1.5.2 py36hbcfbabc_0 defaults py4j 0.10.7 <pip> PyAudio 0.2.11 <pip> pycodestyle 2.3.1 py36h7cc55cd_0 defaults pycosat 0.6.3 py36h413d8a4_0 defaults pycparser 2.18 py36hd053e01_1 defaults pycrypto 2.6.1 py36hfa6e2cd_7 defaults pycurl 7.43.0.1 py36h74b6da3_0 defaults pydocumentdb 2.3.1 <pip> pydot 1.2.4 <pip> pyflakes 1.6.0 py36h0b975d6_0 defaults pyglet 1.3.2 <pip> pygments 2.2.0 py36hb010967_0 defaults PyJWT 1.6.1 <pip> pylint 1.8.2 py36_0 defaults pyodbc 4.0.23 py36h6538335_0 defaults pyopenssl 17.5.0 py36h5b7d817_0 defaults pyparsing 2.2.0 py36h785a196_1 defaults PyQt5_sip 4.19.11 <pip> pysocks 1.6.7 py36h698d350_1 defaults pytables 3.4.2 py36h71138e3_2 defaults pytest 3.3.2 py36_0 defaults python 3.6.4 h6538335_1 defaults python-dateutil 2.6.1 py36h509ddcb_1 defaults pytorch 0.4.0 py36_cuda90_cudnn7he774522_1 [cuda90] pytorch pytz 2017.3 py36h1d3fa6b_0 defaults pywavelets 0.5.2 py36hc649158_0 defaults pywin32 222 py36hfa6e2cd_0 defaults pywinpty 0.5 py36h6538335_1 defaults pyyaml 3.12 py36h1d1928f_1 defaults pyzmq 16.0.3 py36he714bf5_0 defaults qt 5.9.6 vc14h62aca36_0 defaults qtawesome 0.4.4 py36h5aa48f6_0 defaults qtpy 1.3.1 py36hb8717c5_0 defaults requests 2.18.4 py36h4371aae_1 defaults requests-oauthlib 0.8.0 <pip> rope 0.10.7 py36had63a69_0 defaults ruamel_yaml 0.15.35 py36hfa6e2cd_1 defaults s3transfer 0.1.13 py36_0 defaults scikit-learn 0.19.1 py36h53aea1b_0 defaults scipy 1.0.0 py36h1260518_0 defaults send2trash 1.4.2 py36_0 defaults setuptools 38.4.0 py36_0 defaults simplegeneric 0.8.1 py36_2 defaults singledispatch 3.4.0.3 py36h17d0c80_0 defaults sip 4.19.8 py36h6538335_0 defaults six 1.11.0 <pip> six 1.11.0 py36h4db2310_1 defaults smart_open 1.5.7 py36_0 defaults snowballstemmer 1.2.1 py36h763602f_0 defaults sortedcollections 0.5.3 py36hbefa0ab_0 defaults sortedcontainers 1.5.9 py36_0 defaults sphinx 1.6.6 py36_0 defaults sphinxcontrib 1.0 py36hbbac3d2_1 defaults sphinxcontrib-websupport 1.0.1 py36hb5e5916_1 defaults sqlalchemy 1.2.1 py36hfa6e2cd_0 defaults sqlite 3.24.0 h7602738_0 defaults statsmodels 0.8.0 py36h6189b4c_0 defaults sympy 1.1.1 py36h96708e0_0 defaults tabulate 0.8.2 <pip> tblib 1.3.2 py36h30f5020_0 defaults tensorboard 1.7.0 <pip> tensorflow-gpu 1.7.0 <pip> termcolor 1.1.0 <pip> terminado 0.8.1 py36_1 defaults testpath 0.3.1 py36h2698cfe_0 defaults thrift 0.11.0 py36_0 conda-forge tk 8.6.7 vc14_0 [vc14] conda-forge toolz 0.9.0 py36_0 defaults torchvision 0.2.1 <pip> tornado 4.5.3 py36_0 defaults traitlets 4.3.2 py36h096827d_0 defaults typing 3.6.2 py36hb035bda_0 defaults unicodecsv 0.14.1 py36h6450c06_0 defaults urllib3 1.22 py36h276f60a_0 defaults vc 14 h0510ff6_3 defaults vs2015_runtime 14.0.25123 3 defaults wcwidth 0.1.7 py36h3d5aa90_0 defaults webencodings 0.5.1 <pip> webencodings 0.5.1 py36h67c50ae_1 defaults werkzeug 0.14.1 py36_0 defaults wheel 0.30.0 py36h6c3ec14_1 defaults widgetsnbextension 3.1.0 py36_0 defaults win_inet_pton 1.0.1 py36he67d7fd_1 defaults win_unicode_console 0.5 py36hcdbd4b5_0 defaults wincertstore 0.2 py36h7fe50ca_0 defaults winpty 0.4.3 vc14_2 [vc14] conda-forge wrapt 1.10.11 py36he5f5981_0 defaults xgboost 0.71 <pip> xlrd 1.1.0 py36h1cb58dc_1 defaults xlsxwriter 1.0.2 py36hf723b7d_0 defaults xlwings 0.11.5 py36_0 defaults xlwt 1.3.0 py36h1a4751e_0 defaults yaml 0.1.7 vc14_0 [vc14] conda-forge zict 0.1.3 py36h2d8e73e_0 defaults zlib 1.2.11 vc14_0 [vc14] conda-forge ``` </p></details>
You filed this in the wrong place. Please re-file at https://github.com/ContinuumIO/anaconda-issues I disagree, the question is about PrefixReplaceLinkAction, which is unrelated to any specific package. The qt is not the only package that becomes inaccessible due to permissions error. AFAICT, your issue here is that the permission on the QtCore DLL are incorrect. If they were ok then you would have no issue here. Another possible issue is that this file doesn't need any prefix replacement at all. Is my understanding incorrect? I would tell there are several points: 1. Why do we need prefix replacement at all? I'm afraid I have not find any explanation on that - could you, please, point me into the right direction? 2. If the prefix replacement is indeed important, at least in this case, then, can you justify using a temporary directory with limited access rights to process these files? It creates permission issues and, really, the problem would be solved if the temporary directory in created in target conda environment, similar to what conda-build does. 3. If both points above are justified - then that would be an issue for Anaconda. Thank you, Oleh Khoma > 1. Why do we need prefix replacement at all? I'm afraid I have not find any explanation on that - could you, please, point me into the right direction? During the build process of certain bits of software (Unix-first stuff mostly, often stuff built using Autotools, but CMake-built software is not exempt from this either) record paths they are told about. These paths are used in the C or C++ code to load auxiliary files (or whatever), but of course they won't exist on the end user's machine so we must re-write them. It's not good to do this though and I sometimes try to make the software dynamic in this regard instead. > 2. If the prefix replacement is indeed important, at least in this case, then, can you justify using a temporary directory with limited access rights to process these files? It creates permission issues and, really, the problem would be solved if the temporary directory in created in target conda environment, similar to what conda-build does. @kalefranz, can you answer this, seems like a fair point but I would guess it's more complicated than that? From my perspective, I can make this problem go away for Qt (and probably will do), by fixing the perms on Qt and making sure it doesn't suffer binary prefix replacement if not necessary, but that's on the anaconda-issues side of things. Re-opening for further discussion, cheers.
2018-07-09T11:47:58
conda/conda
7,515
conda__conda-7515
[ "7506" ]
33dace2c9cf1cd864523df4352f6746721a39118
diff --git a/conda/gateways/connection/__init__.py b/conda/gateways/connection/__init__.py --- a/conda/gateways/connection/__init__.py +++ b/conda/gateways/connection/__init__.py @@ -6,7 +6,13 @@ def should_bypass_proxies_patched(should_bypass_proxies_func, url, no_proxy): # Monkey patch requests, per https://github.com/requests/requests/pull/4723 if url.startswith("file://"): return True - return should_bypass_proxies_func(url, no_proxy) + try: + return should_bypass_proxies_func(url, no_proxy) + except TypeError: + # For versions of requests we shouldn't have to deal with. + # https://github.com/conda/conda/issues/7503 + # https://github.com/conda/conda/issues/7506 + return should_bypass_proxies_func(url) try:
conda update --all: failed to solve environment <!-- 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 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.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, and especially if you are submitting a bug report, **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. --> **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. --> ### 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. --> ``` ~ $ conda update --all Solving environment: failed # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/exceptions.py", line 819, in __call__ return func(*args, **kwargs) File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main exit_code = do_call(args, p) File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 77, in do_call exit_code = getattr(module, func_name)(args, parser) File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/cli/main_update.py", line 14, in execute install(args, parser, 'update') File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/cli/install.py", line 235, in install force_reinstall=context.force, File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/core/solve.py", line 506, in solve_for_transaction force_remove, force_reinstall) File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/core/solve.py", line 439, in solve_for_diff final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove) File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/core/solve.py", line 180, in solve_final_state index, r = self._prepare(prepared_specs) File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/core/solve.py", line 580, in _prepare self.subdirs, prepared_specs) File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/core/index.py", line 215, in get_reduced_index new_records = query_all(spec) File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/core/index.py", line 184, in query_all return tuple(concat(future.result() for future in as_completed(futures))) File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/core/subdir_data.py", line 94, in query self.load() File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/core/subdir_data.py", line 148, in load _internal_state = self._load() File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/core/subdir_data.py", line 216, in _load mod_etag_headers.get('_mod')) File "/Users/apple/anaconda/lib/python3.6/site-packages/conda/core/subdir_data.py", line 416, in fetch_repodata_remote_request timeout=timeout) File "/Users/apple/.local/lib/python3.6/site-packages/requests/sessions.py", line 480, in get return self.request('GET', url, **kwargs) File "/Users/apple/.local/lib/python3.6/site-packages/requests/sessions.py", line 459, in request prep.url, proxies, stream, verify, cert File "/Users/apple/.local/lib/python3.6/site-packages/requests/sessions.py", line 617, in merge_environment_settings env_proxies = get_environ_proxies(url) or {} File "/Users/apple/.local/lib/python3.6/site-packages/requests/utils.py", line 562, in get_environ_proxies if should_bypass_proxies(url): TypeError: should_bypass_proxies_patched() missing 1 required positional argument: 'no_proxy' `$ /Users/apple/anaconda/bin/conda update --all` environment variables: CIO_TEST=<not set> CONDA_ROOT=/Users/apple/anaconda PATH=~/Library/Python/2.7/bin:/Users/apple/anaconda/bin:/usr/bin:/bin:/usr/ sbin:/sbin:/usr/local/bin:/Library/TeX/texbin:/opt/X11/bin:/Library/Fr ameworks/Mono.framework/Versions/Current/Commands:/Applications/Wiresh ark.app/Contents/MacOS REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> ``` ## Expected Behavior <!-- What do you think should happen? --> ## 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 : /Users/apple/.condarc populated config files : /Users/apple/.condarc conda version : 4.5.6 conda-build version : not installed python version : 3.6.6.final.0 base environment : /Users/apple/anaconda (writable) channel URLs : https://conda.anaconda.org/conda-forge/osx-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/osx-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/osx-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/osx-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/osx-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /Users/apple/anaconda/pkgs /Users/apple/.conda/pkgs envs directories : /Users/apple/anaconda/envs /Users/apple/.conda/envs platform : osx-64 user-agent : conda/4.5.6 requests/2.9.1 CPython/3.6.6 Darwin/17.6.0 OSX/10.13.5 UID:GID : 501:20 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' --> ``` ==> /Users/apple/.condarc <== ssl_verify: True channel_priority: False 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 /Users/apple/anaconda: # # Name Version Build Channel _license 1.1 py36_1 defaults absl-py 0.2.2 py_0 conda-forge accumulator 0.3 <pip> alabaster 0.7.11 py_3 conda-forge amqp 2.3.2 py_1 conda-forge anaconda custom py36ha4fed55_0 defaults anaconda-client 1.6.14 py_0 conda-forge anaconda-navigator 1.8.7 py36_0 defaults anaconda-project 0.8.2 py36_0 conda-forge anyqt 0.0.8 py36_1 conda-forge appnope 0.1.0 py36_0 conda-forge appscript 1.0.1 py36h470a237_0 conda-forge arch 4.2 <pip> argh 0.26.2 <pip> argparse 1.4.0 <pip> asn1crypto 0.24.0 py36_0 conda-forge asn1crypto 0.23.0 <pip> aspell-python-py3 1.15 <pip> astor 0.6.2 py_0 conda-forge astroid 1.6.5 py36_0 conda-forge autocorrect 0.3.0 <pip> babel 2.6.0 py36_0 conda-forge backcall 0.1.0 py_0 conda-forge backports 1.0 py36_1 conda-forge backports.functools_lru_cache 1.5 py36_0 conda-forge backports.shutil_get_terminal_size 1.0.0 py_3 conda-forge backports.weakref 1.0.post1 py36hcbb2b67_0 defaults beautifulsoup4 4.6.0 py36_0 conda-forge billiard 3.5.0.3 py36_0 conda-forge bitarray 0.8.2 py36h1de35cc_0 defaults blas 1.0 mkl conda-forge bleach 1.5.0 py36_0 conda-forge blinker 1.4 py_1 conda-forge blist 1.3.6 py36_0 defaults boto 2.48.0 py36hdbc59ac_1 defaults boto3 1.7.52 py_0 conda-forge botocore 1.10.52 py_0 conda-forge bt 0.2.5 <pip> bz2file 0.98 py36_0 defaults bzip2 1.0.6 1 conda-forge ca-certificates 2018.4.16 0 conda-forge cairo 1.14.12 he60d9cb_2 defaults celery 4.1.0 <pip> certifi 2017.11.5 <pip> certifi 2018.4.16 py36_0 conda-forge cffi 1.11.5 py36_0 conda-forge cffi 1.11.2 <pip> chardet 3.0.4 py_1 conda-forge clangdev 6.0.0 default_0 conda-forge click 6.7 py_1 conda-forge cloudpickle 0.5.3 py_0 conda-forge clyent 1.2.2 py_1 conda-forge colorama 0.3.9 py_1 conda-forge commonmark 0.7.5 py_0 conda-forge conda 4.5.6 py36_0 conda-forge conda-env 2.6.0 0 conda-forge contextlib2 0.5.5 py36_1 conda-forge cryptography 2.1.3 <pip> cryptography 2.2.2 py36h1de35cc_0 defaults curl 7.60.0 ha441bb4_0 defaults cycler 0.10.0 py36_0 conda-forge cyordereddict 1.0.0 <pip> cython 0.28.3 py36hfc679d8_0 conda-forge cytoolz 0.9.0.1 py36_0 conda-forge dask-core 0.18.1 py_0 conda-forge dbus 1.13.2 h760590f_1 defaults decorator 4.3.0 py_0 conda-forge distributed 1.22.0 py36_0 conda-forge docutils 0.14 py36_0 conda-forge editdistance 0.4 <pip> entrypoints 0.2.3 py36_1 conda-forge enum34 1.1.6 <pip> et_xmlfile 1.0.1 py36_0 conda-forge eventsourcing 3.0.0 <pip> expat 2.2.5 hfc679d8_1 conda-forge fastcache 1.0.2 py36h470a237_0 conda-forge ffn 0.3.3 <pip> filelock 2.0.13 <pip> fix-yahoo-finance 0.0.19 <pip> flake8 3.5.0 <pip> flask 1.0.2 py_1 conda-forge flask-cors 3.0.6 py36_0 defaults fontconfig 2.13.0 1 conda-forge freetype 2.8.1 0 conda-forge future 0.16.0 py36_0 conda-forge futures 3.1.1 <pip> gast 0.2.0 py_0 conda-forge gensim 3.4.0 py36h917ab60_0 defaults get_terminal_size 1.0.0 h7520d66_0 defaults gettext 0.19.8.1 0 conda-forge gevent 1.3.4 py36h1de35cc_0 defaults glib 2.56.1 h35bc53a_0 defaults gmp 6.1.2 hfc679d8_0 conda-forge gmpy2 2.0.8 py36_1 conda-forge goslate 1.5.1 <pip> graphite2 1.3.11 h7d4d677_0 conda-forge graphviz 2.40.1 h0a44026_0 defaults greenlet 0.4.13 py36_0 conda-forge grpcio 1.12.1 py36hd9629dc_0 defaults gsl 2.4 h1de35cc_4 defaults h5py 2.8.0 py36hb794570_1 conda-forge harfbuzz 1.7.6 h171471c_1 defaults hdf5 1.10.2 0 conda-forge heapdict 1.0.0 py36_0 conda-forge html5lib 0.9999999 py36_0 conda-forge icu 58.2 hfc679d8_0 conda-forge idna 2.7 py_1 conda-forge imagesize 1.0.0 py36_0 conda-forge importlib 1.0.4 <pip> intel-openmp 2018.0.3 0 defaults intervaltree 2.1.0 <pip> ipykernel 4.8.2 py36_0 conda-forge ipython 6.4.0 py36_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge isort 4.3.4 py36_0 conda-forge itsdangerous 0.24 py_2 conda-forge jbig 2.1 0 conda-forge jdcal 1.4 py36_0 conda-forge jedi 0.12.0 py36_0 conda-forge jellyfish 0.5.6 <pip> jinja2 2.10 py36_0 conda-forge jmespath 0.9.3 py36_0 conda-forge joblib 0.12 py_0 conda-forge jpeg 9c h470a237_0 conda-forge jsonschema 2.6.0 py36_1 conda-forge jupyter_client 5.2.3 py36_0 conda-forge jupyter_console 5.2.0 py36_0 conda-forge jupyter_core 4.4.0 py_0 conda-forge jupyterlab_launcher 0.11.0 py36_0 conda-forge keras 2.2.0 0 defaults keras-applications 1.0.2 py_0 conda-forge keras-base 2.2.0 py36_0 defaults keras-preprocessing 1.0.1 py_0 conda-forge keyring 13.2.1 py36_0 conda-forge keyrings.alt 2.3 <pip> kiwisolver 1.0.1 py36_1 conda-forge kombu 4.1.0 <pip> krb5 1.16.1 hbb41f41_0 conda-forge lazy-object-proxy 1.3.1 py36_0 conda-forge lesscpy 0.12.0 <pip> liac-arff 2.1.1 <pip> libcurl 7.60.0 hf30b1f0_0 defaults libcxx 6.0.0 0 conda-forge libcxxabi 4.0.1 hebd6815_0 defaults libedit 3.1.20170329 haf1bffa_0 conda-forge libffi 3.2.1 3 conda-forge libgcc 4.8.5 hdbeacc1_10 defaults libgfortran 3.0.1 h93005f0_2 defaults libgfortran-ng 3.0.1 h93005f0_2 defaults libgpuarray 0.7.6 0 conda-forge libiconv 1.15 h470a237_1 conda-forge libopenblas 0.2.20 hdc02c5d_7 defaults libpng 1.6.34 ha92aebf_1 conda-forge libprotobuf 3.5.2 hd28b015_1 conda-forge libsodium 1.0.16 0 conda-forge libssh2 1.8.0 h5b517e9_2 conda-forge libtiff 4.0.9 he6b73bb_1 conda-forge libuuid 1.0.3 1 conda-forge libxml2 2.9.8 h422b904_1 conda-forge libxslt 1.1.32 h88dbc4e_1 conda-forge llvm-meta 6.0.1 0 conda-forge llvmdev 6.0.0 h137f3e6_3 defaults locket 0.2.0 py36_1 conda-forge lxml 4.2.3 py36hc9114bc_0 conda-forge lzo 2.10 0 conda-forge mako 1.0.7 py36_0 conda-forge markdown 2.6.11 py_0 conda-forge Markdown 2.6.9 <pip> markupsafe 1.0 py36_0 conda-forge matplotlib 2.2.2 py36_1 conda-forge mccabe 0.6.1 py36_0 conda-forge mistune 0.8.3 py36_1 conda-forge mkl 2018.0.3 1 defaults mkl-service 1.1.2 py36h7ea6df4_4 defaults mkl_fft 1.0.2 py36_0 conda-forge mkl_random 1.0.1 py36_0 conda-forge mock 2.0.0 py36_0 conda-forge mpc 1.1.0 4 conda-forge mpfr 3.1.5 0 conda-forge mpmath 1.0.0 py_0 conda-forge msgpack-python 0.5.6 py36h2d50403_2 conda-forge multipledispatch 0.5.0 py36_0 conda-forge multitasking 0.0.5 <pip> navigator-updater 0.2.1 py36_0 defaults nbconvert 5.3.1 py_1 conda-forge nbformat 4.4.0 py36_0 conda-forge ncurses 6.1 0 conda-forge networkx 2.1 py_1 conda-forge ngram 3.3.2 <pip> nltk 3.3.0 py36_0 defaults nose 1.3.7 py36_2 conda-forge notebook 5.5.0 py36_0 conda-forge numpy 1.14.5 py36h9bb19eb_3 defaults numpy-base 1.14.5 py36ha9ae307_3 defaults numpydoc 0.8.0 py36_0 conda-forge oauthlib 2.1.0 py_0 conda-forge olefile 0.45.1 py_1 conda-forge openblas 0.3.1 hd130d23_0 conda-forge openpyxl 2.5.4 py36_0 conda-forge openssl 1.0.2o 0 conda-forge packaging 17.1 py_0 conda-forge pandas 0.23.3 py36_0 conda-forge pandas-datareader 0.6.0 py36_0 conda-forge pandoc 2.2.1 hde52d81_0 conda-forge pandocfilters 1.4.2 py36_0 conda-forge pango 1.41.0 h3bae10e_0 defaults parso 0.1.1 <pip> parso 0.3.0 py_0 conda-forge partd 0.3.8 py36_0 conda-forge path.py 11.0.1 py_0 conda-forge pathlib2 2.3.2 py36_0 conda-forge patsy 0.5.0 py36_0 conda-forge pbr 4.1.0 py_0 conda-forge pcre 8.42 h378b8a2_0 defaults pexpect 4.6.0 py36_0 conda-forge pickleshare 0.7.4 py36_0 conda-forge pillow 5.2.0 py36_0 conda-forge pip 10.0.1 <pip> pip 10.0.1 py36_0 defaults pixman 0.34.0 2 conda-forge ply 3.11 py_1 conda-forge prompt_toolkit 1.0.15 py36_0 conda-forge protobuf 3.5.2 py36_0 conda-forge psutil 5.4.6 py36_0 conda-forge psutil 5.4.1 <pip> ptyprocess 0.6.0 py36_0 conda-forge py 1.5.4 py_0 conda-forge py-stringmatching 0.4.0 <pip> py4j 0.10.7 py36_0 conda-forge PyAlgoTrade 0.18 <pip> pycodestyle 2.4.0 py_1 conda-forge pycosat 0.6.3 py36_0 conda-forge pycparser 2.18 py36_0 conda-forge pycrypto 2.6.1 py36_1 conda-forge pycurl 7.43.0.2 py36hdbc3d79_0 defaults PyDictionary 1.5.2 <pip> pyenchant 1.6.11 <pip> pyflakes 2.0.0 py_0 conda-forge pygments 2.2.0 py_1 conda-forge pygpu 0.7.6 py36h7eb728f_0 conda-forge pyjwt 1.6.4 py_0 conda-forge pylint 1.9.2 py36_0 conda-forge pyodbc 4.0.23 py36h0a44026_0 defaults pyopengl 3.1.1a1 py36_0 conda-forge pyopenssl 18.0.0 py36_0 conda-forge pyOpenSSL 17.3.0 <pip> pyparsing 2.2.0 py_1 conda-forge pyphonetics 0.4.1 <pip> pyqt 5.9.2 py36h11d3b92_0 defaults pysocks 1.6.8 py36_1 conda-forge pyspark 2.3.1 py36_1 conda-forge python 3.6.6 hc167b69_0 defaults python-crfsuite 0.9.5 py36h470a237_0 conda-forge python-dateutil 2.7.3 py_0 conda-forge python-editor 1.0.3 py36_0 conda-forge python.app 2 py36_8 defaults pytz 2018.5 py_0 conda-forge pyyaml 3.12 py36_1 conda-forge pyzmq 17.0.0 py36_4 conda-forge qt 5.9.6 h74ce4d9_0 defaults qtawesome 0.4.4 py36_0 conda-forge qtconsole 4.3.1 py36_0 conda-forge qtpy 1.4.2 pyh8a2030e_1 conda-forge QuantLib-Python 1.11 <pip> readline 7.0 hc1231fa_4 defaults requests 2.19.1 py36_0 conda-forge requests 2.18.4 <pip> requests-file 1.4.3 py36_0 defaults requests-ftp 0.3.1 py36_0 conda-forge requests-oauthlib 1.0.0 py36_0 conda-forge rope 0.10.7 py36_0 conda-forge rpy2 2.9.1 <pip> ruamel_yaml 0.15.42 py36h470a237_0 conda-forge s3transfer 0.1.13 py36_0 conda-forge scikit-learn 0.19.1 py36hffbff8c_0 defaults scipy 1.1.0 py36hcaad992_0 defaults seaborn 0.8.1 py36_0 conda-forge send2trash 1.5.0 py_0 conda-forge setuptools 39.2.0 py36_0 conda-forge setuptools 36.6.0 <pip> simplegeneric 0.8.1 py_1 conda-forge singledispatch 3.4.0.3 py36_0 conda-forge sip 4.19.8 py36_0 conda-forge six 1.11.0 <pip> six 1.11.0 py36_1 conda-forge smart_open 1.6.0 py36_0 conda-forge snowballstemmer 1.2.1 py_1 conda-forge sortedcollections 1.0.1 py_1 conda-forge sortedcontainers 2.0.4 py36_0 conda-forge sphinx 1.7.5 py36_0 conda-forge sphinxcontrib 1.0 py36h9364dc8_1 defaults sphinxcontrib-websupport 1.1.0 py36_0 conda-forge spyder 3.3.0 py36_1 conda-forge spyder-kernels 0.2.4 py36_0 conda-forge sqlalchemy 1.2.9 py36_0 conda-forge sqlite 3.24.0 h2f33b56_0 conda-forge statsmodels 0.9.0 py36_0 conda-forge sympy 1.1.1 py36_0 conda-forge TA-Lib 0.4.10 <pip> tabulate 0.8.2 py_0 conda-forge tblib 1.3.2 py36_0 conda-forge tensorboard 1.8.0 py36_1 conda-forge tensorflow 1.8.0 py36_1 conda-forge termcolor 1.1.0 py36_1 conda-forge terminado 0.8.1 py36_0 conda-forge testpath 0.3.1 py36_0 conda-forge textblob 0.15.1 py_0 conda-forge theano 1.0.2 py36_0 conda-forge tk 8.6.7 0 conda-forge toolz 0.9.0 py_0 conda-forge tornado 5.0.2 py36_0 conda-forge trade 0.2.9 <pip> traitlets 4.3.2 py36_0 conda-forge twython 3.7.0 py_0 conda-forge typing 3.6.4 py36_0 conda-forge unicodecsv 0.14.1 py36_0 conda-forge unidecode 1.0.22 py36_0 conda-forge unixodbc 2.3.6 h3efe00b_0 defaults urllib3 1.23 py36_0 conda-forge urllib3 1.22 <pip> vaderSentiment 2.5 <pip> vine 1.1.4 py_1 conda-forge wcwidth 0.1.7 py36_0 conda-forge webencodings 0.5.1 py36_0 conda-forge werkzeug 0.14.1 py_0 conda-forge wheel 0.31.1 py36_0 conda-forge whoosh 2.7.4 py36_0 conda-forge widgetsnbextension 3.2.1 py36_0 conda-forge wrapt 1.10.11 py36_0 conda-forge xlrd 1.1.0 py_2 conda-forge xlsxwriter 1.0.5 py_0 conda-forge xlwings 0.11.8 py36_0 conda-forge xlwt 1.3.0 py36_0 conda-forge xz 5.2.4 h1de35cc_4 defaults yaml 0.1.7 0 conda-forge zeromq 4.2.5 hfc679d8_3 conda-forge zict 0.1.3 py_0 conda-forge zlib 1.2.11 h470a237_3 conda-forge ``` </p></details>
I am facing the same problem, it is new to me after upgrade conda to 4.5.6
2018-07-09T16:51:47
conda/conda
7,516
conda__conda-7516
[ "7505" ]
d7aa8489cf7a73d0a8e9386093f50529c59bc88f
diff --git a/conda/core/link.py b/conda/core/link.py --- a/conda/core/link.py +++ b/conda/core/link.py @@ -7,7 +7,6 @@ from os.path import basename, dirname, isdir, join from subprocess import CalledProcessError import sys -from tempfile import mkdtemp from traceback import format_exception_only import warnings @@ -279,7 +278,8 @@ def _prepare(cls, transaction_context, target_prefix, unlink_precs, link_precs, sp = get_python_site_packages_short_path(python_version) transaction_context['target_site_packages_short_path'] = sp - transaction_context['temp_dir'] = mkdtemp() + transaction_context['temp_dir'] = join(target_prefix, '.condatmp') + mkdir_p(transaction_context['temp_dir']) unlink_action_groups = tuple(ActionGroup( 'unlink',
Why need PrefixReplaceLinkAction? It breaks Windows permissions. **I'm submitting a...** - [x] bug report - [ ] feature request ## Current Behavior If the conda environment is read-only to Users, installing as admin packages with files that have "prefix_placeholder" overwrite these files permissions to have no access to Users and makes these packages unusable. ### Steps to Reproduce 1. There is a base installation of Anaconda in C:\Anaconda with permissions inherited from C:\: * Administrators read/write * Users read-only 2. However, C:\Anaconda\Library\Qt5Core.dll permissions are different and explicit: * Administrators read/write * Administrator user read/write * Users - no access 3. `conda uninstall qt` and `conda install qt` as administrator user do not change anything 4. Upon further investigation it turns out that in C:\Anaconda\pkgs\qt-5.9.6-vc14h62aca36_0\info\paths.json the entry for Qt5Core.dll has prefix placeholder: ``` { "_path": "Library/bin/Qt5Core.dll", "file_mode": "binary", "path_type": "hardlink", "prefix_placeholder": "C:/qt5/_h_env", "sha256": "50886da211b4acaacc015e18f52fe44c2a07500f05fd09a9cb3a5c026a5eaba4", "size_in_bytes": 5241344 }, ``` 5. The TRACE output of `conda install qt` shows that in this case PrefixReplaceLinkAction is used: ``` TRACE conda.core.path_actions:verify(385): copying C:\Anaconda\pkgs\qt-5.9.6-vc14h62aca36_0\Library\bin\Qt5Core.dll => C:\Users\labdsvm-admin\tmp6f8xpxgo\a39281e8-cb0c-4f01-9d32-e22b2209f393 TRACE conda.gateways.disk.create:_do_copy(275): copying C:\Anaconda\pkgs\qt-5.9.6-vc14h62aca36_0\Library\bin\Qt5Core.dll => C:\Users\labdsvm-admin\tmp6f8xpxgo\a39281e8-cb0c-4f01-9d32-e22b2209f393 TRACE conda.core.path_actions:verify(390): rewriting prefixes in C:\Anaconda\Library\bin\Qt5Core.dll ``` 6. The temp directory is created by mkdtemp() and the [documentation](https://docs.python.org/3/library/tempfile.html#tempfile.mkdtemp) says that > The directory is readable, writable, and searchable only by the creating user ID. 7. This operation first copies the file from pkgs folder to temporary folder that is only writable by current user and later it hardlinks the file from this directory into C:\Anaconda\Library\bin. ``` TRACE conda.core.path_actions:execute(415): linking C:\Users\labdsvm-admin\tmp6f8xpxgo\a39281e8-cb0c-4f01-9d32-e22b2209f393 => C:\Anaconda\Library\bin\Qt5Core.dll TRACE conda.gateways.disk.create:create_link(321): hard linking C:\Users\labdsvm-admin\tmp6f8xpxgo\a39281e8-cb0c-4f01-9d32-e22b2209f393 => C:\Anaconda\Library\bin\Qt5Core.dll ``` 8. The hardlinks retain source file's permissions, so now, the DLL is not readable by other Users. ## Expected Behavior I do not understand why the treatment for files with prefix_placeholder is so radically different. Why conda cannot hardlink the file from pkgs folder as other files? Why copy into temp folder with specifically minimal permissions? The workaround could be to not use system temp folder, but create a temp folder in conda pkgs directory so that permissions are retained. ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` C:\Users\labdsvm-admin>conda info active environment : None user config file : C:\Users\labdsvm-admin\.condarc populated config files : conda version : 4.5.5 conda-build version : 3.10.9 python version : 3.6.4.final.0 base environment : C:\Anaconda (writable) channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/win-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/win-64 https://repo.anaconda.com/pkgs/pro/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Anaconda\pkgs C:\Users\labdsvm-admin\AppData\Local\conda\conda\pkgs envs directories : C:\Anaconda\envs C:\Users\labdsvm-admin\AppData\Local\conda\conda\envs C:\Users\labdsvm-admin\.conda\envs platform : win-64 user-agent : conda/4.5.5 requests/2.18.4 CPython/3.6.4 Windows/10 Windows/10.0.14393 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\labdsvm-admin>conda config --show-sources ``` </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' --> ``` C:\Users\labdsvm-admin>conda list --show-channel-urls # packages in environment at C:\Anaconda: # # Name Version Build Channel _ipyw_jlab_nb_ext_conf 0.1.0 py36he6757f0_0 defaults _nb_ext_conf 0.4.0 py36_1 defaults absl-py 0.2.0 <pip> adal 0.5.1 <pip> alabaster 0.7.10 py36hcd07829_0 defaults anaconda custom py36h363777c_0 defaults anaconda-client 1.6.9 py36_0 defaults anaconda-project 0.8.2 py36hfad2e28_0 defaults applicationinsights 0.11.3 <pip> asn1crypto 0.24.0 py36_0 defaults astor 0.6.2 <pip> astroid 1.6.1 py36_0 defaults astropy 2.0.3 py36hfa6e2cd_0 defaults attrs 17.4.0 py36_0 defaults azure 3.0.0 <pip> azure-batch 4.1.3 <pip> azure-common 1.1.9 <pip> azure-cosmosdb-nspkg 2.0.2 <pip> azure-cosmosdb-table 1.0.2 <pip> azure-datalake-store 0.0.19 <pip> azure-eventgrid 0.1.0 <pip> azure-graphrbac 0.40.0 <pip> azure-keyvault 0.3.7 <pip> azure-mgmt 2.0.0 <pip> azure-mgmt-advisor 1.0.1 <pip> azure-mgmt-applicationinsights 0.1.1 <pip> azure-mgmt-authorization 0.30.0 <pip> azure-mgmt-batch 5.0.0 <pip> azure-mgmt-batchai 1.0.1 <pip> azure-mgmt-billing 0.1.0 <pip> azure-mgmt-cdn 2.0.0 <pip> azure-mgmt-cognitiveservices 2.0.0 <pip> azure-mgmt-commerce 1.0.1 <pip> azure-mgmt-compute 3.0.1 <pip> azure-mgmt-consumption 2.0.0 <pip> azure-mgmt-containerinstance 0.3.1 <pip> azure-mgmt-containerregistry 1.0.1 <pip> azure-mgmt-containerservice 3.0.1 <pip> azure-mgmt-cosmosdb 0.3.1 <pip> azure-mgmt-datafactory 0.4.0 <pip> azure-mgmt-datalake-analytics 0.3.0 <pip> azure-mgmt-datalake-nspkg 2.0.0 <pip> azure-mgmt-datalake-store 0.3.0 <pip> azure-mgmt-devtestlabs 2.2.0 <pip> azure-mgmt-dns 1.2.0 <pip> azure-mgmt-eventgrid 0.4.0 <pip> azure-mgmt-eventhub 1.2.0 <pip> azure-mgmt-hanaonazure 0.1.0 <pip> azure-mgmt-iothub 0.4.0 <pip> azure-mgmt-iothubprovisioningservices 0.1.0 <pip> azure-mgmt-keyvault 0.40.0 <pip> azure-mgmt-loganalytics 0.1.0 <pip> azure-mgmt-logic 2.1.0 <pip> azure-mgmt-machinelearningcompute 0.4.0 <pip> azure-mgmt-managementpartner 0.1.0 <pip> azure-mgmt-marketplaceordering 0.1.0 <pip> azure-mgmt-media 0.2.0 <pip> azure-mgmt-monitor 0.4.0 <pip> azure-mgmt-msi 0.1.0 <pip> azure-mgmt-network 1.7.1 <pip> azure-mgmt-notificationhubs 1.0.0 <pip> azure-mgmt-nspkg 2.0.0 <pip> azure-mgmt-powerbiembedded 1.0.0 <pip> azure-mgmt-rdbms 0.1.0 <pip> azure-mgmt-recoveryservices 0.2.0 <pip> azure-mgmt-recoveryservicesbackup 0.1.1 <pip> azure-mgmt-redis 5.0.0 <pip> azure-mgmt-relay 0.1.0 <pip> azure-mgmt-reservations 0.1.0 <pip> azure-mgmt-resource 1.2.2 <pip> azure-mgmt-scheduler 1.1.3 <pip> azure-mgmt-search 1.0.0 <pip> azure-mgmt-servermanager 1.2.0 <pip> azure-mgmt-servicebus 0.4.0 <pip> azure-mgmt-servicefabric 0.1.0 <pip> azure-mgmt-sql 0.8.6 <pip> azure-mgmt-storage 1.5.0 <pip> azure-mgmt-subscription 0.1.0 <pip> azure-mgmt-trafficmanager 0.40.0 <pip> azure-mgmt-web 0.34.1 <pip> azure-nspkg 2.0.0 <pip> azure-servicebus 0.21.1 <pip> azure-servicefabric 6.1.2.9 <pip> azure-servicemanagement-legacy 0.20.6 <pip> azure-storage 0.36.0 <pip> azure-storage-blob 1.1.0 <pip> azure-storage-common 1.1.0 <pip> azure-storage-file 1.1.0 <pip> azure-storage-nspkg 3.0.0 <pip> azure-storage-queue 1.1.0 <pip> azureml 0.2.7 <pip> babel 2.5.3 py36_0 defaults backports 1.0 py36h81696a8_1 defaults backports.shutil_get_terminal_size 1.0.0 py36h79ab834_2 defaults beautifulsoup4 4.6.0 py36hd4cc5e8_1 defaults bitarray 0.8.1 py36hfa6e2cd_1 defaults bkcharts 0.2 py36h7e685f7_0 defaults blaze 0.11.3 py36h8a29ca5_0 defaults bleach 2.1.2 py36_0 defaults bleach 1.5.0 <pip> bokeh 0.12.13 py36h047fa9f_0 defaults boto 2.48.0 py36h1a776d2_1 defaults boto3 1.7.4 py36_0 defaults botocore 1.10.4 py36_0 defaults bottleneck 1.2.1 py36hd119dfa_0 defaults bz2file 0.98 py36_0 defaults bzip2 1.0.6 vc14_1 [vc14] conda-forge ca-certificates 2018.03.07 0 defaults cached-property 1.4.2 <pip> certifi 2018.4.16 py36_0 defaults cffi 1.11.4 py36hfa6e2cd_0 defaults chainer 4.0.0 <pip> chainerrl 0.3.0 <pip> chardet 3.0.4 py36h420ce6e_1 defaults click 6.7 py36hec8c647_0 defaults cloudpickle 0.5.2 py36_1 defaults clyent 1.2.2 py36hb10d595_1 defaults cntk-gpu 2.5.1 <pip> colorama 0.3.9 py36h029ae33_0 defaults comtypes 1.1.4 py36_0 defaults conda 4.5.5 py36_0 defaults conda-build 3.10.9 py36_0 defaults conda-env 2.6.0 h36134e3_1 defaults conda-verify 2.0.0 py36h065de53_0 defaults configparser 3.5.0 <pip> console_shortcut 0.1.1 h6bb2dd7_3 defaults contextlib2 0.5.5 py36he5d52c0_0 defaults cryptography 2.1.4 py36he1d7878_0 defaults cuda90 1.0 0 pytorch cupy 4.0.0 <pip> curl 7.59.0 vc14_1 [vc14] conda-forge cycler 0.10.0 py36h009560c_0 defaults cython 0.27.3 py36h22f4c84_0 defaults cytoolz 0.9.0 py36hfa6e2cd_0 defaults dask 0.16.1 py36_0 defaults dask-core 0.16.1 py36_0 defaults databricks-cli 0.7.2 <pip> datashape 0.5.4 py36h5770b85_0 defaults decorator 4.2.1 py36_0 defaults distributed 1.20.2 py36_0 defaults dlib 19.9 np111py36_0 conda-forge docutils 0.14 py36h6012d8f_0 defaults entrypoints 0.2.3 py36hfd66bb0_2 defaults et_xmlfile 1.0.1 py36h3d2d736_0 defaults fastcache 1.0.2 py36hfa6e2cd_2 defaults fastparquet 0.1.5 py36_0 conda-forge fastrlock 0.3 <pip> filelock 2.0.13 py36h20000bf_0 defaults flask 0.12.2 py36h98b5e8f_0 defaults flask-cors 3.0.3 py36h8a3855d_0 defaults freetype 2.8.1 vc14_0 [vc14] conda-forge future 0.16.0 <pip> futures 3.1.1 <pip> gast 0.2.0 <pip> gensim 3.4.0 py36_vc14_0 [vc14] conda-forge get_terminal_size 1.0.0 h38e98db_0 defaults gevent 1.2.2 py36h342a76c_0 defaults glob2 0.6 py36hdf76b57_0 defaults graphviz 0.8.2 <pip> greenlet 0.4.12 py36ha00ad21_0 defaults grpcio 1.11.0 <pip> gym 0.10.5 <pip> h5py 2.7.1 py36he54a1c3_0 defaults hdf5 1.10.1 vc14_2 [vc14] conda-forge heapdict 1.0.0 py36_2 defaults html5lib 1.0.1 py36h047fa9f_0 defaults html5lib 1.0.1 <pip> icc_rt 2017.0.4 h97af966_0 defaults icu 58.2 vc14_0 [vc14] conda-forge idna 2.6 py36h148d497_1 defaults imageio 2.3.0 py36_0 defaults imagesize 0.7.1 py36he29f638_0 defaults intel-openmp 2018.0.0 hd92c6cd_8 defaults ipykernel 4.8.0 py36_0 defaults ipython 6.2.1 py36h9cf0123_1 defaults ipython_genutils 0.2.0 py36h3c5d0ee_0 defaults ipywidgets 7.1.1 py36_0 defaults isodate 0.6.0 <pip> isort 4.2.15 py36h6198cc5_0 defaults itsdangerous 0.24 py36hb6c5a24_1 defaults jdcal 1.3 py36h64a5255_0 defaults jedi 0.11.1 py36_0 defaults jinja2 2.10 py36h292fed1_0 defaults jmespath 0.9.3 py36h0745840_0 defaults jpeg 9b vc14_2 [vc14] conda-forge jsonschema 2.6.0 py36h7636477_0 defaults jupyter_client 5.2.2 py36_0 defaults jupyter_console 5.2.0 py36h6d89b47_1 defaults jupyter_core 4.4.0 py36h56e9d50_0 defaults jupyterlab 0.31.4 py36_0 defaults jupyterlab_launcher 0.10.2 py36_0 defaults Keras 2.1.6 <pip> kiwisolver 1.0.1 py36h12c3424_0 defaults krb5 1.14.6 vc14_0 [vc14] conda-forge lazy-object-proxy 1.3.1 py36hd1c21d2_0 defaults libcurl 7.58.0 h7602738_0 defaults libiconv 1.14 vc14_4 [vc14] conda-forge libpng 1.6.34 vc14_0 [vc14] conda-forge libprotobuf 3.5.2 vc14_0 [vc14] conda-forge libpython 2.1 py36_0 defaults libssh2 1.8.0 vc14_2 [vc14] conda-forge libtiff 4.0.9 vc14_0 [vc14] conda-forge libxml2 2.9.5 vc14_1 [vc14] conda-forge libxslt 1.1.32 vc14_0 [vc14] conda-forge lightgbm 2.1.0 <pip> llvmlite 0.21.0 py36he0b0552_0 defaults locket 0.2.0 py36hfed976d_1 defaults lxml 4.2.1 py36_0 conda-forge lzo 2.10 vc14_0 [vc14] conda-forge Markdown 2.6.11 <pip> markupsafe 1.0 py36h0e26971_1 defaults mccabe 0.6.1 py36hb41005a_1 defaults menuinst 1.4.11 py36hfa6e2cd_0 defaults mistune 0.8.3 py36_0 defaults mkl 2018.0.1 h2108138_4 defaults mkl-service 1.1.2 py36h57e144c_4 defaults mpmath 1.0.0 py36hacc8adf_2 defaults msgpack-python 0.5.1 py36he980bc4_0 defaults msrest 0.4.28 <pip> msrestazure 0.4.28 <pip> multipledispatch 0.4.9 py36he44c36e_0 defaults mxnet-cu90 1.1.0.post0 <pip> nb_anacondacloud 1.4.0 py36_0 defaults nb_conda 2.2.0 py36_0 defaults nb_conda_kernels 2.1.0 py36_0 defaults nbconvert 5.3.1 py36h8dc0fde_0 defaults nbformat 4.4.0 py36h3a5bc1b_0 defaults nbpresent 3.0.2 py36_0 defaults networkx 2.1 py36_0 defaults nltk 3.2.5 py36h76d52bb_0 defaults nose 1.3.7 py36h1c3779e_2 defaults notebook 5.4.0 py36_0 defaults numba 0.36.2 np111py36hf5cdf1b_0 defaults numexpr 2.6.4 py36h30784b8_0 defaults numpy 1.14.2 <pip> numpy 1.11.3 py36h4a99626_4 defaults numpydoc 0.7.0 py36ha25429e_0 defaults oauthlib 2.0.7 <pip> odo 0.5.1 py36h7560279_0 defaults olefile 0.45.1 py36_0 defaults onnx 1.1.1 py36_0 conda-forge opencv-python 3.4.0.12 <pip> openpyxl 2.4.10 py36_0 defaults openssl 1.0.2o h8ea7d77_0 defaults packaging 16.8 py36ha0986f6_1 defaults pandas 0.22.0 py36h6538335_0 defaults pandoc 1.19.2.1 hb2460c7_1 defaults pandocfilters 1.4.2 py36h3ef6317_1 defaults parso 0.1.1 py36hae3edee_0 defaults partd 0.3.8 py36hc8e763b_0 defaults path.py 10.5 py36h2b94a8f_0 defaults pathlib2 2.3.0 py36h7bfb78b_0 defaults patsy 0.5.0 py36_0 defaults pep8 1.7.1 py36_0 defaults pickleshare 0.7.4 py36h9de030f_0 defaults Pillow 5.1.0 <pip> pillow 5.1.0 py36h0738816_0 defaults pip 9.0.1 py36h226ae91_4 defaults pip 10.0.1 <pip> pkginfo 1.4.1 py36hb0f9cfa_1 defaults pluggy 0.6.0 py36hc7daf1e_0 defaults ply 3.10 py36h1211beb_0 defaults prompt_toolkit 1.0.15 py36h60b8f86_0 defaults protobuf 3.5.2 py36_vc14_0 [vc14] conda-forge protobuf 3.5.2.post1 <pip> psutil 5.4.5 py36hfa6e2cd_0 defaults py 1.5.2 py36hbcfbabc_0 defaults py4j 0.10.7 <pip> PyAudio 0.2.11 <pip> pycodestyle 2.3.1 py36h7cc55cd_0 defaults pycosat 0.6.3 py36h413d8a4_0 defaults pycparser 2.18 py36hd053e01_1 defaults pycrypto 2.6.1 py36hfa6e2cd_7 defaults pycurl 7.43.0.1 py36h74b6da3_0 defaults pydocumentdb 2.3.1 <pip> pydot 1.2.4 <pip> pyflakes 1.6.0 py36h0b975d6_0 defaults pyglet 1.3.2 <pip> pygments 2.2.0 py36hb010967_0 defaults PyJWT 1.6.1 <pip> pylint 1.8.2 py36_0 defaults pyodbc 4.0.23 py36h6538335_0 defaults pyopenssl 17.5.0 py36h5b7d817_0 defaults pyparsing 2.2.0 py36h785a196_1 defaults PyQt5_sip 4.19.11 <pip> pysocks 1.6.7 py36h698d350_1 defaults pytables 3.4.2 py36h71138e3_2 defaults pytest 3.3.2 py36_0 defaults python 3.6.4 h6538335_1 defaults python-dateutil 2.6.1 py36h509ddcb_1 defaults pytorch 0.4.0 py36_cuda90_cudnn7he774522_1 [cuda90] pytorch pytz 2017.3 py36h1d3fa6b_0 defaults pywavelets 0.5.2 py36hc649158_0 defaults pywin32 222 py36hfa6e2cd_0 defaults pywinpty 0.5 py36h6538335_1 defaults pyyaml 3.12 py36h1d1928f_1 defaults pyzmq 16.0.3 py36he714bf5_0 defaults qt 5.9.6 vc14h62aca36_0 defaults qtawesome 0.4.4 py36h5aa48f6_0 defaults qtpy 1.3.1 py36hb8717c5_0 defaults requests 2.18.4 py36h4371aae_1 defaults requests-oauthlib 0.8.0 <pip> rope 0.10.7 py36had63a69_0 defaults ruamel_yaml 0.15.35 py36hfa6e2cd_1 defaults s3transfer 0.1.13 py36_0 defaults scikit-learn 0.19.1 py36h53aea1b_0 defaults scipy 1.0.0 py36h1260518_0 defaults send2trash 1.4.2 py36_0 defaults setuptools 38.4.0 py36_0 defaults simplegeneric 0.8.1 py36_2 defaults singledispatch 3.4.0.3 py36h17d0c80_0 defaults sip 4.19.8 py36h6538335_0 defaults six 1.11.0 <pip> six 1.11.0 py36h4db2310_1 defaults smart_open 1.5.7 py36_0 defaults snowballstemmer 1.2.1 py36h763602f_0 defaults sortedcollections 0.5.3 py36hbefa0ab_0 defaults sortedcontainers 1.5.9 py36_0 defaults sphinx 1.6.6 py36_0 defaults sphinxcontrib 1.0 py36hbbac3d2_1 defaults sphinxcontrib-websupport 1.0.1 py36hb5e5916_1 defaults sqlalchemy 1.2.1 py36hfa6e2cd_0 defaults sqlite 3.24.0 h7602738_0 defaults statsmodels 0.8.0 py36h6189b4c_0 defaults sympy 1.1.1 py36h96708e0_0 defaults tabulate 0.8.2 <pip> tblib 1.3.2 py36h30f5020_0 defaults tensorboard 1.7.0 <pip> tensorflow-gpu 1.7.0 <pip> termcolor 1.1.0 <pip> terminado 0.8.1 py36_1 defaults testpath 0.3.1 py36h2698cfe_0 defaults thrift 0.11.0 py36_0 conda-forge tk 8.6.7 vc14_0 [vc14] conda-forge toolz 0.9.0 py36_0 defaults torchvision 0.2.1 <pip> tornado 4.5.3 py36_0 defaults traitlets 4.3.2 py36h096827d_0 defaults typing 3.6.2 py36hb035bda_0 defaults unicodecsv 0.14.1 py36h6450c06_0 defaults urllib3 1.22 py36h276f60a_0 defaults vc 14 h0510ff6_3 defaults vs2015_runtime 14.0.25123 3 defaults wcwidth 0.1.7 py36h3d5aa90_0 defaults webencodings 0.5.1 <pip> webencodings 0.5.1 py36h67c50ae_1 defaults werkzeug 0.14.1 py36_0 defaults wheel 0.30.0 py36h6c3ec14_1 defaults widgetsnbextension 3.1.0 py36_0 defaults win_inet_pton 1.0.1 py36he67d7fd_1 defaults win_unicode_console 0.5 py36hcdbd4b5_0 defaults wincertstore 0.2 py36h7fe50ca_0 defaults winpty 0.4.3 vc14_2 [vc14] conda-forge wrapt 1.10.11 py36he5f5981_0 defaults xgboost 0.71 <pip> xlrd 1.1.0 py36h1cb58dc_1 defaults xlsxwriter 1.0.2 py36hf723b7d_0 defaults xlwings 0.11.5 py36_0 defaults xlwt 1.3.0 py36h1a4751e_0 defaults yaml 0.1.7 vc14_0 [vc14] conda-forge zict 0.1.3 py36h2d8e73e_0 defaults zlib 1.2.11 vc14_0 [vc14] conda-forge ``` </p></details>
You filed this in the wrong place. Please re-file at https://github.com/ContinuumIO/anaconda-issues I disagree, the question is about PrefixReplaceLinkAction, which is unrelated to any specific package. The qt is not the only package that becomes inaccessible due to permissions error. AFAICT, your issue here is that the permission on the QtCore DLL are incorrect. If they were ok then you would have no issue here. Another possible issue is that this file doesn't need any prefix replacement at all. Is my understanding incorrect? I would tell there are several points: 1. Why do we need prefix replacement at all? I'm afraid I have not find any explanation on that - could you, please, point me into the right direction? 2. If the prefix replacement is indeed important, at least in this case, then, can you justify using a temporary directory with limited access rights to process these files? It creates permission issues and, really, the problem would be solved if the temporary directory in created in target conda environment, similar to what conda-build does. 3. If both points above are justified - then that would be an issue for Anaconda. Thank you, Oleh Khoma > 1. Why do we need prefix replacement at all? I'm afraid I have not find any explanation on that - could you, please, point me into the right direction? During the build process of certain bits of software (Unix-first stuff mostly, often stuff built using Autotools, but CMake-built software is not exempt from this either) record paths they are told about. These paths are used in the C or C++ code to load auxiliary files (or whatever), but of course they won't exist on the end user's machine so we must re-write them. It's not good to do this though and I sometimes try to make the software dynamic in this regard instead. > 2. If the prefix replacement is indeed important, at least in this case, then, can you justify using a temporary directory with limited access rights to process these files? It creates permission issues and, really, the problem would be solved if the temporary directory in created in target conda environment, similar to what conda-build does. @kalefranz, can you answer this, seems like a fair point but I would guess it's more complicated than that? From my perspective, I can make this problem go away for Qt (and probably will do), by fixing the perms on Qt and making sure it doesn't suffer binary prefix replacement if not necessary, but that's on the anaconda-issues side of things. Re-opening for further discussion, cheers.
2018-07-09T16:53:04
conda/conda
7,525
conda__conda-7525
[ "7524" ]
df615ac68081ab2b9ec309ab9bf3a3cf105ef8fd
diff --git a/conda/gateways/connection/__init__.py b/conda/gateways/connection/__init__.py --- a/conda/gateways/connection/__init__.py +++ b/conda/gateways/connection/__init__.py @@ -2,7 +2,7 @@ from __future__ import absolute_import, division, print_function, unicode_literals from functools import partial -def should_bypass_proxies_patched(should_bypass_proxies_func, url, no_proxy): +def should_bypass_proxies_patched(should_bypass_proxies_func, url, no_proxy=None): # Monkey patch requests, per https://github.com/requests/requests/pull/4723 if url.startswith("file://"): return True
should_bypass_proxies still an issue in 4.5.7 https://github.com/conda/conda/issues/7506#issuecomment-403811279
2018-07-10T14:14:05
conda/conda
7,561
conda__conda-7561
[ "7559" ]
3decbfddf52474c11df16350326bcfa1b72899d4
diff --git a/conda/gateways/connection/adapters/localfs.py b/conda/gateways/connection/adapters/localfs.py --- a/conda/gateways/connection/adapters/localfs.py +++ b/conda/gateways/connection/adapters/localfs.py @@ -5,7 +5,7 @@ import json from logging import getLogger from mimetypes import guess_type -from os import lstat +from os import stat from tempfile import SpooledTemporaryFile from .. import BaseAdapter, CaseInsensitiveDict, Response @@ -25,7 +25,7 @@ def send(self, request, stream=None, timeout=None, verify=None, cert=None, proxi resp.url = request.url try: - stats = lstat(pathname) + stats = stat(pathname) except (IOError, OSError) as exc: resp.status_code = 404 message = {
Can't build from a symbolic link -- UNHELPFUL error message _From @remram44 on July 19, 2018 21:41_ ### Actual Behavior ``` conda.CondaError: Downloaded bytes did not match Content-Length url: file:///tmp/rr_conda_Wg2K6Htj/usagestats.tar.gz target_path: /tmp/rr_conda_Wg2K6Htj/croot/src_cache/usagestats.tar.gz Content-Length: 44 downloaded bytes: 14374 ``` when `/tmp/rr_conda_Wg2K6Htj/usagestats.tar.gz` is a symbolic link ### Expected Behavior `file://` URLs to symbolic links in recipes should not break with this unhelpful error (no Content-Length is involved! This is not even HTTP!) ### Other info This is probably what I was trying to troubleshoot in https://github.com/conda/conda/issues/4134#issuecomment-314097550. The reported size doesn't match the compressed size or the decompressed size, because it is the length of the path in bytes. You should probably change an `lstat()` to a `stat()` somewhere in your size-checking logic. ### Steps to Reproduce Point a recipe's `source.url` to a `file://` URL that is a symbolic link. ### `Output of conda info` ``` active environment : base active env location : /home/remram/miniconda shell level : 1 user config file : /home/remram/.condarc populated config files : /home/remram/.condarc conda version : 4.5.8 conda-build version : 3.10.9 python version : 3.6.4.final.0 base environment : /home/remram/miniconda (writable) channel URLs : https://conda.anaconda.org/conda-forge/linux-64 https://conda.anaconda.org/conda-forge/noarch https://conda.anaconda.org/vida-nyu/linux-64 https://conda.anaconda.org/vida-nyu/noarch https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/linux-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /home/remram/miniconda/pkgs /home/remram/.conda/pkgs envs directories : /home/remram/miniconda/envs /home/remram/.conda/envs platform : linux-64 user-agent : conda/4.5.8 requests/2.18.4 CPython/3.6.4 Linux/4.15.0-24-generic ubuntu/18.04 glibc/2.27 UID:GID : 1000:1000 netrc file : None offline mode : False ``` _Copied from original issue: conda/conda-build#3031_
Thanks for reporting this. I think the issue is in conda, though. Conda has the file download functionality - conda-build does nothing on checking file size when downloading things. Conda-build just calls out to conda. _From @remram44 on July 20, 2018 1:0_ Should I duplicate the issue there? > @remram44 Can you help us out by sharing a specific set of steps that reproduce the behavior you're seeing? Start with `docker run --rm -it continuumio/miniconda3 /bin/bash`. Happy to! This should do: ``` docker run --rm -it continuumio/miniconda3 /bin/bash conda install conda-build mkdir /data && cd /data curl -Ls https://github.com/conda/conda/files/2214610/conda-repro-7559.tar.gz | tar zx conda build usagestats ``` [conda-repro-7559.tar.gz](https://github.com/conda/conda/files/2214610/conda-repro-7559.tar.gz) (16kB) contains the recipe, tarball and symlink; make sure you uncompress in `/data` because that's what the `file://` URL in the recipe points to. You will see: ``` conda.CondaError: Downloaded bytes did not match Content-Length url: file:///data/usagestats.tar.gz target_path: /opt/conda/conda-bld/src_cache/usagestats.tar.gz Content-Length: 21 downloaded bytes: 14369 ```
2018-07-20T17:04:01
conda/conda
7,562
conda__conda-7562
[ "7486" ]
3decbfddf52474c11df16350326bcfa1b72899d4
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -390,7 +390,7 @@ def build_reactivate(self): } def _get_starting_path_list(self): - path = self.environ['PATH'] + path = self.environ.get('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
`conda activate` results in `KeyError` when no environment variable `PATH` is set **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. --> When no PATH environment is set, `conda activate` results in a `KeyError`. The `self.environ['PATH']` should probably be replaced by `self.environ.get('PATH', '')` or something similar. ### 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. --> ``` $ env -i bash --norc --noprofile bash-4.1$ /path/to/conda/anaconda3/bin/conda shell.posix activate # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 98, in main return activator_main() File "/group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/lib/python3.6/site-packages/conda/activate.py", line 584, in main print(activator.execute(), end='') File "/group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/lib/python3.6/site-packages/conda/activate.py", line 157, in execute return getattr(self, self.command)() File "/group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/lib/python3.6/site-packages/conda/activate.py", line 143, in activate return self._finalize(self._yield_commands(self.build_activate(self.env_name_or_prefix)), File "/group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/lib/python3.6/site-packages/conda/activate.py", line 244, in build_activate new_path = self.pathsep_join(self._add_prefix_to_path(prefix)) File "/group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/lib/python3.6/site-packages/conda/activate.py", line 417, in _add_prefix_to_path starting_path_dirs = self._get_starting_path_list() File "/group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/lib/python3.6/site-packages/conda/activate.py", line 384, in _get_starting_path_list path = self.environ['PATH'] KeyError: 'PATH' `$ /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/bin/conda shell.posix activate` environment variables: CIO_TEST=<not set> CONDA_ROOT=/group_workspaces/cems2/fiduceo/Users/gholl/anaconda3 REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> active environment : None user config file : /home/users/gholl/.condarc populated config files : /home/users/gholl/.condarc conda version : 4.5.4 conda-build version : 3.0.27 python version : 3.6.3.final.0 base environment : /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3 (writable) channel URLs : https://conda.anaconda.org/rttools/linux-64 https://conda.anaconda.org/rttools/noarch https://conda.anaconda.org/conda-forge/linux-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/linux-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/pkgs /home/users/gholl/.conda/pkgs envs directories : /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/envs /home/users/gholl/.conda/envs platform : linux-64 user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.3 Linux/2.6.32-754.el6.x86_64 rhel/6.10 glibc/2.12 UID:GID : 35063:26030 netrc file : None offline mode : False An unexpected error has occurred. Conda has prepared the above report. Upload successful. ``` ## Expected Behavior <!-- What do you think should happen? --> I think `conda activate` should work as it otherwise does, and create a `PATH` variable with exactly one directory in it. ## 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 : /home/users/gholl/.condarc populated config files : /home/users/gholl/.condarc conda version : 4.5.4 conda-build version : 3.0.27 python version : 3.6.3.final.0 base environment : /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3 (writable) channel URLs : https://conda.anaconda.org/rttools/linux-64 https://conda.anaconda.org/rttools/noarch https://conda.anaconda.org/conda-forge/linux-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/linux-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/pkgs /home/users/gholl/.conda/pkgs envs directories : /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/envs /home/users/gholl/.conda/envs platform : linux-64 user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.3 Linux/2.6.32-754.el6.x86_64 rhel/6.10 glibc/2.12 UID:GID : 35063:26030 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/users/gholl/.condarc <== channels: - rttools - conda-forge - defaults report_errors: True ``` </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 /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3: # # Name Version Build Channel _ipyw_jlab_nb_ext_conf 0.1.0 py36he11e457_0 defaults alabaster 0.7.10 py36h306e16b_0 defaults anaconda custom py36hbbc8b67_0 defaults anaconda-client 1.6.5 py36h19c0dcd_0 defaults anaconda-navigator 1.6.9 py36h11ddaaa_0 defaults anaconda-project 0.8.0 py36h29abdf5_0 defaults asn1crypto 0.22.0 py36h265ca7c_1 defaults astroid 1.5.3 py36hbdb9df2_0 defaults astropy 2.0.2 py36ha51211e_4 defaults babel 2.5.0 py36h7d14adf_0 defaults backports 1.0 py36hfa02d7e_1 defaults backports.shutil_get_terminal_size 1.0.0 py36hfea85ff_2 defaults beautifulsoup4 4.6.0 py36h49b8c8c_1 defaults bitarray 0.8.1 py36h5834eb8_0 defaults bkcharts 0.2 py36h735825a_0 defaults blaze 0.11.3 py36h4e06776_0 defaults bleach 2.0.0 py36h688b259_0 defaults bokeh 0.12.10 py36hbb0e44a_0 defaults boto 2.48.0 py36h6e4cd66_1 defaults bottleneck 1.2.1 py36haac1ea0_0 defaults bzip2 1.0.6 h0376d23_1 defaults ca-certificates 2017.08.26 h1d4fec5_0 defaults cairo 1.14.10 haa5651f_5 defaults certifi 2017.7.27.1 py36h8b7b77e_0 defaults cffi 1.10.0 py36had8d393_1 defaults chardet 3.0.4 py36h0f667ec_1 defaults click 6.7 py36h5253387_0 defaults cloudpickle 0.4.0 py36h30f8c20_0 defaults clyent 1.2.2 py36h7e57e65_1 defaults colorama 0.3.9 py36h489cec4_0 defaults conda 4.5.4 py36_0 conda-forge conda-build 3.0.27 py36h940a66d_0 defaults conda-env 2.6.0 h36134e3_1 defaults conda-verify 2.0.0 py36h98955d8_0 defaults contextlib2 0.5.5 py36h6c84a62_0 defaults cryptography 2.0.3 py36ha225213_1 defaults curl 7.55.1 hcb0b314_2 defaults cycler 0.10.0 py36h93f1223_0 defaults cython 0.26.1 py36h21c49d0_0 defaults cytoolz 0.8.2 py36h708bfd4_0 defaults dask 0.15.3 py36hdc2c8aa_0 defaults dask-core 0.15.3 py36h10e6167_0 defaults datashape 0.5.4 py36h3ad6b5c_0 defaults dbus 1.10.22 h3b5a359_0 defaults decorator 4.1.2 py36hd076ac8_0 defaults distributed 1.19.1 py36h25f3894_0 defaults docutils 0.14 py36hb0f60f5_0 defaults entrypoints 0.2.3 py36h1aec115_2 defaults et_xmlfile 1.0.1 py36hd6bccc3_0 defaults expat 2.2.4 hc00ebd1_1 defaults fastcache 1.0.2 py36h5b0c431_0 defaults filelock 2.0.12 py36hacfa1f5_0 defaults flask 0.12.2 py36hb24657c_0 defaults flask-cors 3.0.3 py36h2d857d3_0 defaults fontconfig 2.12.4 h88586e7_1 defaults freetype 2.8 h52ed37b_0 defaults get_terminal_size 1.0.0 haa9412d_0 defaults gevent 1.2.2 py36h2fe25dc_0 defaults glib 2.53.6 hc861d11_1 defaults glob2 0.5 py36h2c1b292_1 defaults gmp 6.1.2 hb3b607b_0 defaults gmpy2 2.0.8 py36h55090d7_1 defaults graphite2 1.3.10 hc526e54_0 defaults greenlet 0.4.12 py36h2d503a6_0 defaults gst-plugins-base 1.12.2 he3457e5_0 defaults gstreamer 1.12.2 h4f93127_0 defaults h5py 2.7.0 py36he81ebca_1 defaults harfbuzz 1.5.0 h2545bd6_0 defaults hdf5 1.10.1 hb0523eb_0 defaults heapdict 1.0.0 py36h79797d7_0 defaults html5lib 0.999999999 py36h2cfc398_0 defaults icu 58.2 h211956c_0 defaults idna 2.6 py36h82fb2a8_1 defaults imageio 2.2.0 py36he555465_0 defaults imagesize 0.7.1 py36h52d8127_0 defaults intel-openmp 2018.0.0 h15fc484_7 defaults ipykernel 4.6.1 py36hbf841aa_0 defaults ipython 6.1.0 py36hc72a948_1 defaults ipython_genutils 0.2.0 py36hb52b0d5_0 defaults ipywidgets 7.0.0 py36h7b55c3a_0 defaults isort 4.2.15 py36had401c0_0 defaults itsdangerous 0.24 py36h93cc618_1 defaults jbig 2.1 hdba287a_0 defaults jdcal 1.3 py36h4c697fb_0 defaults jedi 0.10.2 py36h552def0_0 defaults jinja2 2.9.6 py36h489bce4_1 defaults jpeg 9b habf39ab_1 defaults jsonschema 2.6.0 py36h006f8b5_0 defaults jupyter 1.0.0 py36h9896ce5_0 defaults jupyter_client 5.1.0 py36h614e9ea_0 defaults jupyter_console 5.2.0 py36he59e554_1 defaults jupyter_core 4.3.0 py36h357a921_0 defaults jupyterlab 0.27.0 py36h86377d0_2 defaults jupyterlab_launcher 0.4.0 py36h4d8058d_0 defaults lazy-object-proxy 1.3.1 py36h10fcdad_0 defaults libedit 3.1 heed3624_0 defaults libffi 3.2.1 h4deb6c0_3 defaults libgcc-ng 7.2.0 h7cc24e2_2 defaults libgfortran-ng 7.2.0 h9f7466a_2 defaults libpng 1.6.32 hda9c8bc_2 defaults libsodium 1.0.13 h31c71d8_2 defaults libssh2 1.8.0 h8c220ad_2 defaults libstdcxx-ng 7.2.0 h7a57d05_2 defaults libtiff 4.0.8 h90200ff_9 defaults libtool 2.4.6 hd50d1a6_0 defaults libxcb 1.12 h84ff03f_3 defaults libxml2 2.9.4 h6b072ca_5 defaults libxslt 1.1.29 hcf9102b_5 defaults llvmlite 0.20.0 py36_0 defaults locket 0.2.0 py36h787c0ad_1 defaults lxml 4.1.0 py36h5b66e50_0 defaults lzo 2.10 h1bfc0ba_1 defaults markupsafe 1.0 py36hd9260cd_1 defaults matplotlib 2.1.0 py36hba5de38_0 defaults mccabe 0.6.1 py36h5ad9710_1 defaults mistune 0.7.4 py36hbab8784_0 defaults mkl 2018.0.0 hb491cac_4 defaults mkl-service 1.1.2 py36h17a0993_4 defaults mpc 1.0.3 hf803216_4 defaults mpfr 3.1.5 h12ff648_1 defaults mpmath 0.19 py36h8cc018b_2 defaults msgpack-python 0.4.8 py36hec4c5d1_0 defaults multipledispatch 0.4.9 py36h41da3fb_0 defaults navigator-updater 0.1.0 py36h14770f7_0 defaults nbconvert 5.3.1 py36hb41ffb7_0 defaults nbformat 4.4.0 py36h31c9010_0 defaults ncurses 6.0 h06874d7_1 defaults networkx 2.0 py36h7e96fb8_0 defaults nltk 3.2.4 py36h1a0979f_0 defaults nose 1.3.7 py36hcdf7029_2 defaults notebook 5.0.0 py36h0b20546_2 defaults numba 0.35.0 np113py36_10 defaults numexpr 2.6.2 py36hdd3393f_1 defaults numpy 1.13.3 py36ha12f23b_0 defaults numpydoc 0.7.0 py36h18f165f_0 defaults odo 0.5.1 py36h90ed295_0 defaults olefile 0.44 py36h79f9f78_0 defaults openpyxl 2.4.8 py36h41dd2a8_1 defaults openssl 1.0.2l h077ae2c_5 defaults packaging 16.8 py36ha668100_1 defaults pandas 0.20.3 py36h842e28d_2 defaults pandoc 1.19.2.1 hea2e7c5_1 defaults pandocfilters 1.4.2 py36ha6701b7_1 defaults pango 1.40.11 h8191d47_0 defaults partd 0.3.8 py36h36fd896_0 defaults patchelf 0.9 hf79760b_2 defaults path.py 10.3.1 py36he0c6f6d_0 defaults pathlib2 2.3.0 py36h49efa8e_0 defaults patsy 0.4.1 py36ha3be15e_0 defaults pcre 8.41 hc71a17e_0 defaults pep8 1.7.0 py36h26ade29_0 defaults pexpect 4.2.1 py36h3b9d41b_0 defaults pickleshare 0.7.4 py36h63277f8_0 defaults pillow 4.2.1 py36h9119f52_0 defaults pip 9.0.1 py36h8ec8b28_3 defaults pixman 0.34.0 h83dc358_2 defaults pkginfo 1.4.1 py36h215d178_1 defaults ply 3.10 py36hed35086_0 defaults prompt_toolkit 1.0.15 py36h17d85b1_0 defaults psutil 5.4.0 py36h84c53db_0 defaults ptyprocess 0.5.2 py36h69acd42_0 defaults py 1.4.34 py36h0712aa3_1 defaults pycodestyle 2.3.1 py36hf609f19_0 defaults pycosat 0.6.3 py36_0 conda-forge pycparser 2.18 py36hf9f622e_1 defaults pycrypto 2.6.1 py36h6998063_1 defaults pycurl 7.43.0 py36h5e72054_3 defaults pyflakes 1.6.0 py36h7bd6a15_0 defaults pygments 2.2.0 py36h0d3125c_0 defaults pylint 1.7.4 py36hb9d4533_0 defaults pyodbc 4.0.17 py36h999153c_0 defaults pyopenssl 17.2.0 py36h5cc804b_0 defaults pyparsing 2.2.0 py36hee85983_1 defaults pyqt 5.6.0 py36h0386399_5 defaults pysocks 1.6.7 py36hd97a5b1_1 defaults pytables 3.4.2 py36h3b5282a_2 defaults pytest 3.2.1 py36h11ad3bb_1 defaults python 3.6.3 hc9025b9_1 defaults python-dateutil 2.6.1 py36h88d3b88_1 defaults pytz 2017.2 py36hc2ccc2a_1 defaults pywavelets 0.5.2 py36he602eb0_0 defaults pyyaml 3.12 py36hafb9ca4_1 defaults pyzmq 16.0.2 py36h3b0cf96_2 defaults qt 5.6.2 h974d657_12 defaults qtawesome 0.4.4 py36h609ed8c_0 defaults qtconsole 4.3.1 py36h8f73b5b_0 defaults qtpy 1.3.1 py36h3691cc8_0 defaults readline 7.0 hac23ff0_3 defaults requests 2.18.4 py36he2e5f8d_1 defaults rope 0.10.5 py36h1f8c17e_0 defaults ruamel_yaml 0.11.14 py36ha2fb22d_2 defaults scikit-image 0.13.0 py36had3c07a_1 defaults scikit-learn 0.19.1 py36h7aa7ec6_0 defaults scipy 0.19.1 py36h9976243_3 defaults seaborn 0.8.0 py36h197244f_0 defaults setuptools 36.5.0 py36he42e2e1_0 defaults simplegeneric 0.8.1 py36h2cb9092_0 defaults singledispatch 3.4.0.3 py36h7a266c3_0 defaults sip 4.18.1 py36h51ed4ed_2 defaults six 1.11.0 py36h372c433_1 defaults snowballstemmer 1.2.1 py36h6febd40_0 defaults sortedcollections 0.5.3 py36h3c761f9_0 defaults sortedcontainers 1.5.7 py36hdf89491_0 defaults sphinx 1.6.3 py36he5f0bdb_0 defaults sphinxcontrib 1.0 py36h6d0f590_1 defaults sphinxcontrib-websupport 1.0.1 py36hb5cb234_1 defaults spyder 3.2.4 py36hbe6152b_0 defaults sqlalchemy 1.1.13 py36hfb5efd7_0 defaults sqlite 3.20.1 h6d8b0f3_1 defaults statsmodels 0.8.0 py36h8533d0b_0 defaults sympy 1.1.1 py36hc6d1c1c_0 defaults tblib 1.3.2 py36h34cf8b6_0 defaults terminado 0.6 py36ha25a19f_0 defaults testpath 0.3.1 py36h8cadb63_0 defaults tk 8.6.7 h5979e9b_1 defaults toolz 0.8.2 py36h81f2dff_0 defaults tornado 4.5.2 py36h1283b2a_0 defaults traitlets 4.3.2 py36h674d592_0 defaults typing 3.6.2 py36h7da032a_0 defaults unicodecsv 0.14.1 py36ha668878_0 defaults unixodbc 2.3.4 hc36303a_1 defaults urllib3 1.22 py36hbe7ace6_0 defaults wcwidth 0.1.7 py36hdf4376a_0 defaults webencodings 0.5.1 py36h800622e_1 defaults werkzeug 0.12.2 py36hc703753_0 defaults wheel 0.29.0 py36he7f4e38_1 defaults widgetsnbextension 3.0.2 py36hd01bb71_1 defaults wrapt 1.10.11 py36h28b7045_0 defaults xlrd 1.1.0 py36h1db9f0c_1 defaults xlsxwriter 1.0.2 py36h3de1aca_0 defaults xlwt 1.3.0 py36h7b00a1f_0 defaults xz 5.2.3 h2bcbf08_1 defaults yaml 0.1.7 h96e3832_1 defaults zeromq 4.2.2 hb0b69da_1 defaults zict 0.1.3 py36h3a3bf81_0 defaults zlib 1.2.11 hfbfcf68_1 defaults ``` </p></details>
2018-07-20T17:07:02
conda/conda
7,598
conda__conda-7598
[ "7522" ]
7c70170fa62ec69b433a4f099b1fabe6d6e0ebdd
diff --git a/conda/core/solve.py b/conda/core/solve.py --- a/conda/core/solve.py +++ b/conda/core/solve.py @@ -288,9 +288,6 @@ def solve_final_state(self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, if spec.name in specs_map: old_spec = specs_map[spec.name] specs_map[spec.name] = MatchSpec(old_spec, target=None) - if (context.auto_update_conda and paths_equal(self.prefix, context.root_prefix) - and any(dist.name == "conda" for dist in solution)): - specs_map["conda"] = MatchSpec("conda") # add in explicitly requested specs from specs_to_add # this overrides any name-matching spec already in the spec map @@ -303,6 +300,21 @@ def solve_final_state(self, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, if not ignore_pinned: pinned_specs = get_pinned_specs(self.prefix) + # As a business rule, we never want to downgrade conda below the current version, + # unless that's requested explicitly by the user (which we actively discourage). + if 'conda' in specs_map and paths_equal(self.prefix, context.conda_prefix): + conda_prefix_rec = prefix_data.get('conda') + if conda_prefix_rec: + conda_spec = specs_map['conda'] + conda_in_specs_to_add_version = next( + (spec.get('version') for spec in specs_to_add if spec.name == "conda"), None + ) + if not conda_in_specs_to_add_version: + conda_spec = MatchSpec(conda_spec, version=">=%s" % conda_prefix_rec.version) + if context.auto_update_conda: + conda_spec = MatchSpec(conda_spec, target=None) + specs_map['conda'] = conda_spec + final_environment_specs = IndexedSet(concatv( itervalues(specs_map), track_features_specs,
diff --git a/tests/core/test_solve.py b/tests/core/test_solve.py --- a/tests/core/test_solve.py +++ b/tests/core/test_solve.py @@ -3,6 +3,8 @@ from contextlib import contextmanager import os +from pprint import pprint +import sys from unittest import TestCase from os.path import join @@ -681,6 +683,139 @@ def test_broken_install(): # assert r.environment_is_consistent(order) +def test_conda_downgrade(): + specs = MatchSpec("conda-build"), + with env_var("CONDA_CHANNEL_PRIORITY", "False", reset_context): + with get_solver_aggregate_1(specs) as solver: + final_state_1 = solver.solve_final_state() + # PrefixDag(final_state_1, specs).open_url() + pprint([Dist(rec).full_name for rec in final_state_1]) + order = ( + 'channel-4::ca-certificates-2017.08.26-h1d4fec5_0', + 'channel-2::conda-env-2.6.0-0', + 'channel-2::libffi-3.2.1-1', + 'channel-4::libgcc-ng-7.2.0-h7cc24e2_2', + 'channel-4::libstdcxx-ng-7.2.0-h7a57d05_2', + 'channel-4::ncurses-6.0-h9df7e31_2', + 'channel-4::openssl-1.0.2n-hb7f436b_0', + 'channel-4::patchelf-0.9-hf79760b_2', + 'channel-4::tk-8.6.7-hc745277_3', + 'channel-4::xz-5.2.3-h55aa19d_2', + 'channel-4::yaml-0.1.7-had09818_2', + 'channel-4::zlib-1.2.11-ha838bed_2', + 'channel-4::libedit-3.1-heed3624_0', + 'channel-4::readline-7.0-ha6073c6_4', + 'channel-4::sqlite-3.22.0-h1bed415_0', + 'channel-4::python-3.6.4-hc3d631a_1', + 'channel-4::asn1crypto-0.24.0-py36_0', + 'channel-4::beautifulsoup4-4.6.0-py36h49b8c8c_1', + 'channel-4::certifi-2018.1.18-py36_0', + 'channel-4::chardet-3.0.4-py36h0f667ec_1', + 'channel-4::filelock-3.0.4-py36_0', + 'channel-4::glob2-0.6-py36he249c77_0', + 'channel-4::idna-2.6-py36h82fb2a8_1', + 'channel-4::markupsafe-1.0-py36hd9260cd_1', + 'channel-4::pkginfo-1.4.1-py36h215d178_1', + 'channel-4::psutil-5.4.3-py36h14c3975_0', + 'channel-4::pycosat-0.6.3-py36h0a5515d_0', + 'channel-4::pycparser-2.18-py36hf9f622e_1', + 'channel-4::pysocks-1.6.7-py36hd97a5b1_1', + 'channel-4::pyyaml-3.12-py36hafb9ca4_1', + 'channel-4::ruamel_yaml-0.15.35-py36h14c3975_1', + 'channel-4::six-1.11.0-py36h372c433_1', + 'channel-4::cffi-1.11.4-py36h9745a5d_0', + 'channel-4::conda-verify-2.0.0-py36h98955d8_0', + 'channel-4::setuptools-38.5.1-py36_0', + 'channel-4::cryptography-2.1.4-py36hd09be54_0', + 'channel-4::jinja2-2.10-py36ha16c418_0', + 'channel-4::pyopenssl-17.5.0-py36h20ba746_0', + 'channel-4::urllib3-1.22-py36hbe7ace6_0', + 'channel-4::requests-2.18.4-py36he2e5f8d_1', + 'channel-4::conda-4.4.10-py36_0', + 'channel-4::conda-build-3.5.1-py36_0', + ) + assert tuple(final_state_1) == tuple(solver._index[Dist(d)] for d in order) + + specs_to_add = MatchSpec("itsdangerous"), # MatchSpec("conda"), + saved_sys_prefix = sys.prefix + try: + sys.prefix = TEST_PREFIX + with get_solver_aggregate_1(specs_to_add=specs_to_add, prefix_records=final_state_1, + history_specs=specs) as solver: + unlink_precs, link_precs = solver.solve_for_diff() + # PrefixDag(final_state_1, specs).open_url() + pprint([Dist(rec).full_name for rec in unlink_precs]) + pprint([Dist(rec).full_name for rec in link_precs]) + unlink_order = ( + 'channel-4::requests-2.18.4-py36he2e5f8d_1', + 'channel-4::pyopenssl-17.5.0-py36h20ba746_0', + 'channel-4::cryptography-2.1.4-py36hd09be54_0', + 'channel-4::setuptools-38.5.1-py36_0', + 'channel-4::certifi-2018.1.18-py36_0', + 'channel-4::python-3.6.4-hc3d631a_1', + 'channel-4::openssl-1.0.2n-hb7f436b_0', + # no conda downgrade + ) + link_order = ( + 'channel-2::openssl-1.0.2l-0', + 'channel-4::python-3.6.3-h0ef2715_3', + 'channel-2::certifi-2016.2.28-py36_0', + 'channel-2::itsdangerous-0.24-py36_0', + 'channel-2::pyparsing-2.1.4-py36_0', + 'channel-2::requests-2.14.2-py36_0', + 'channel-2::packaging-16.8-py36_0', + 'channel-4::setuptools-36.5.0-py36he42e2e1_0', + 'channel-2::cryptography-1.8.1-py36_0', + 'channel-2::pyopenssl-17.0.0-py36_0', + ) + assert tuple(unlink_precs) == tuple(solver._index[Dist(d)] for d in unlink_order) + assert tuple(link_precs) == tuple(solver._index[Dist(d)] for d in link_order) + + specs_to_add = MatchSpec("itsdangerous"), MatchSpec("conda"), + with get_solver_aggregate_1(specs_to_add=specs_to_add, prefix_records=final_state_1, + history_specs=specs) as solver: + unlink_precs, link_precs = solver.solve_for_diff() + pprint([Dist(rec).full_name for rec in unlink_precs]) + pprint([Dist(rec).full_name for rec in link_precs]) + assert tuple(unlink_precs) == tuple(solver._index[Dist(d)] for d in unlink_order) + assert tuple(link_precs) == tuple(solver._index[Dist(d)] for d in link_order) + + specs_to_add = MatchSpec("itsdangerous"), MatchSpec("conda<4.4.10"), + with get_solver_aggregate_1(specs_to_add=specs_to_add, prefix_records=final_state_1, + history_specs=specs) as solver: + unlink_precs, link_precs = solver.solve_for_diff() + pprint([Dist(rec).full_name for rec in unlink_precs]) + pprint([Dist(rec).full_name for rec in link_precs]) + unlink_order = ( + # now conda gets downgraded + 'channel-4::conda-4.4.10-py36_0', + 'channel-4::requests-2.18.4-py36he2e5f8d_1', + 'channel-4::pyopenssl-17.5.0-py36h20ba746_0', + 'channel-4::cryptography-2.1.4-py36hd09be54_0', + 'channel-4::setuptools-38.5.1-py36_0', + 'channel-4::certifi-2018.1.18-py36_0', + 'channel-4::python-3.6.4-hc3d631a_1', + 'channel-4::openssl-1.0.2n-hb7f436b_0', + ) + link_order = ( + 'channel-2::openssl-1.0.2l-0', + 'channel-4::python-3.6.3-h0ef2715_3', + 'channel-2::certifi-2016.2.28-py36_0', + 'channel-2::itsdangerous-0.24-py36_0', + 'channel-2::pyparsing-2.1.4-py36_0', + 'channel-2::requests-2.14.2-py36_0', + 'channel-2::setuptools-27.2.0-py36_0', + 'channel-2::packaging-16.8-py36_0', + 'channel-2::cryptography-1.8.1-py36_0', + 'channel-2::pyopenssl-17.0.0-py36_0', + 'channel-2::conda-4.3.21-py36_0', + ) + assert tuple(unlink_precs) == tuple(solver._index[Dist(d)] for d in unlink_order) + assert tuple(link_precs) == tuple(solver._index[Dist(d)] for d in link_order) + finally: + sys.prefix = saved_sys_prefix + + def test_install_uninstall_features_1(): specs = MatchSpec("pandas"), MatchSpec("python=2.7"), MatchSpec("numpy 1.6.*") with env_var("CONDA_TRACK_FEATURES", 'mkl', reset_context): @@ -891,47 +1026,52 @@ def test_auto_update_conda(): ) assert tuple(final_state_2) == tuple(solver._index[Dist(d)] for d in order) - with env_vars({"CONDA_AUTO_UPDATE_CONDA": "yes", "CONDA_ROOT_PREFIX": TEST_PREFIX}, reset_context): - specs_to_add = MatchSpec("pytz"), - with get_solver(specs_to_add, prefix_records=final_state_1, history_specs=specs) as solver: - final_state_2 = solver.solve_final_state() - # PrefixDag(final_state_2, specs).open_url() - print([Dist(rec).full_name for rec in final_state_2]) - order = ( - 'channel-1::openssl-1.0.1c-0', - 'channel-1::readline-6.2-0', - 'channel-1::sqlite-3.7.13-0', - 'channel-1::system-5.8-1', - 'channel-1::tk-8.5.13-0', - 'channel-1::yaml-0.1.4-0', - 'channel-1::zlib-1.2.7-0', - 'channel-1::python-2.7.5-0', - 'channel-1::pytz-2013b-py27_0', - 'channel-1::pyyaml-3.10-py27_0', - 'channel-1::conda-1.5.2-py27_0', - ) - assert tuple(final_state_2) == tuple(solver._index[Dist(d)] for d in order) - - with env_vars({"CONDA_AUTO_UPDATE_CONDA": "no", "CONDA_ROOT_PREFIX": TEST_PREFIX}, reset_context): - specs_to_add = MatchSpec("pytz"), - with get_solver(specs_to_add, prefix_records=final_state_1, history_specs=specs) as solver: - final_state_2 = solver.solve_final_state() - # PrefixDag(final_state_2, specs).open_url() - print([Dist(rec).full_name for rec in final_state_2]) - order = ( - 'channel-1::openssl-1.0.1c-0', - 'channel-1::readline-6.2-0', - 'channel-1::sqlite-3.7.13-0', - 'channel-1::system-5.8-1', - 'channel-1::tk-8.5.13-0', - 'channel-1::yaml-0.1.4-0', - 'channel-1::zlib-1.2.7-0', - 'channel-1::python-2.7.5-0', - 'channel-1::pytz-2013b-py27_0', - 'channel-1::pyyaml-3.10-py27_0', - 'channel-1::conda-1.3.5-py27_0', - ) - assert tuple(final_state_2) == tuple(solver._index[Dist(d)] for d in order) + saved_sys_prefix = sys.prefix + try: + sys.prefix = TEST_PREFIX + with env_vars({"CONDA_AUTO_UPDATE_CONDA": "yes"}, reset_context): + specs_to_add = MatchSpec("pytz"), + with get_solver(specs_to_add, prefix_records=final_state_1, history_specs=specs) as solver: + final_state_2 = solver.solve_final_state() + # PrefixDag(final_state_2, specs).open_url() + print([Dist(rec).full_name for rec in final_state_2]) + order = ( + 'channel-1::openssl-1.0.1c-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::yaml-0.1.4-0', + 'channel-1::zlib-1.2.7-0', + 'channel-1::python-2.7.5-0', + 'channel-1::pytz-2013b-py27_0', + 'channel-1::pyyaml-3.10-py27_0', + 'channel-1::conda-1.5.2-py27_0', + ) + assert tuple(final_state_2) == tuple(solver._index[Dist(d)] for d in order) + + with env_vars({"CONDA_AUTO_UPDATE_CONDA": "no"}, reset_context): + specs_to_add = MatchSpec("pytz"), + with get_solver(specs_to_add, prefix_records=final_state_1, history_specs=specs) as solver: + final_state_2 = solver.solve_final_state() + # PrefixDag(final_state_2, specs).open_url() + print([Dist(rec).full_name for rec in final_state_2]) + order = ( + 'channel-1::openssl-1.0.1c-0', + 'channel-1::readline-6.2-0', + 'channel-1::sqlite-3.7.13-0', + 'channel-1::system-5.8-1', + 'channel-1::tk-8.5.13-0', + 'channel-1::yaml-0.1.4-0', + 'channel-1::zlib-1.2.7-0', + 'channel-1::python-2.7.5-0', + 'channel-1::pytz-2013b-py27_0', + 'channel-1::pyyaml-3.10-py27_0', + 'channel-1::conda-1.3.5-py27_0', + ) + assert tuple(final_state_2) == tuple(solver._index[Dist(d)] for d in order) + finally: + sys.prefix = saved_sys_prefix def test_aggressive_update_packages():
Prevent conda from scheduling downgrades of conda when no version is explicitly given To go along with https://github.com/conda/conda/pull/7517. See https://groups.google.com/a/anaconda.com/forum/?utm_medium=email&utm_source=footer#!msg/conda-builders/ydua189zWcg/rz3I99JzAgAJ
2018-07-27T20:52:20
conda/conda
7,606
conda__conda-7606
[ "7592" ]
8468276f1f7b7e02a13daa04123cc2a27e8b8f4f
diff --git a/conda/cli/common.py b/conda/cli/common.py --- a/conda/cli/common.py +++ b/conda/cli/common.py @@ -93,17 +93,14 @@ def specs_from_args(args, json=False): return [arg2spec(arg, json=json) for arg in args] -spec_pat = re.compile(r''' # lgtm [py/regex/unmatchable-dollar] -(?P<name>[^=<>!\s]+) # package name -\s* # ignore spaces -( - (?P<cc>=[^=]+(=[^=]+)?) # conda constraint - | - (?P<pc>(?:[=!]=|[><]=?).+) # new (pip-style) constraint(s) -)? -$ # end-of-line -''', re.VERBOSE) # lgtm [py/regex/unmatchable-dollar] -# This logic has been here for four years. Even if it's wrong, we're not changing it now. +spec_pat = re.compile(r'(?P<name>[^=<>!\s]+)' # package name # lgtm [py/regex/unmatchable-dollar] + r'\s*' # ignore spaces + r'(' + r'(?P<cc>=[^=]+(=[^=]+)?)' # conda constraint + r'|' + r'(?P<pc>(?:[=!]=|[><]=?).+)' # new (pip-style) constraint(s) + r')?$', + re.VERBOSE) # lgtm [py/regex/unmatchable-dollar] def strip_comment(line): diff --git a/conda/core/subdir_data.py b/conda/core/subdir_data.py --- a/conda/core/subdir_data.py +++ b/conda/core/subdir_data.py @@ -363,6 +363,10 @@ def _process_raw_repodata_str(self, raw_repodata_str): if add_pip and info['name'] == 'python' and info['version'].startswith(('2.', '3.')): info['depends'].append('pip') info.update(meta_in_common) + if info.get('record_version', 0) > 1: + log.debug("Ignoring record_version %d from %s", + info["record_version"], info['url']) + continue package_record = PackageRecord(**info) _package_records.append(package_record) 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 @@ -6,6 +6,7 @@ from abc import ABCMeta, abstractmethod, abstractproperty from collections import Mapping from functools import reduce +from logging import getLogger from operator import attrgetter from os.path import basename import re @@ -27,6 +28,7 @@ except ImportError: # pragma: no cover from .._vendor.toolz.itertoolz import concat, concatv, groupby # NOQA +log = getLogger(__name__) class MatchSpecType(type): @@ -559,6 +561,12 @@ def _parse_spec_str(spec_str): spec_str, _ = spec_str[:ndx], spec_str[ndx:] spec_str.strip() + # Step 1.b strip ' if ' anticipating future compatibility issues + spec_split = spec_str.split(' if ', 1) + if len(spec_split) > 1: + log.debug("Ignoring conditional in spec %s", spec_str) + spec_str = spec_split[0] + # Step 2. done if spec_str is a tarball if spec_str.endswith(CONDA_TARBALL_EXTENSION): # treat as a normal url
Compatibility shims for future releases * filter loaded repodata on repodata_version * split matchspec on `" if "`
2018-07-30T19:49:04
conda/conda
7,607
conda__conda-7607
[ "3982" ]
6975b8379b17aeaece564737232e8bbc23ec918c
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -613,6 +613,9 @@ def __init__(self, arguments=None): def _update_prompt(self, set_vars, conda_prompt_modifier): ps1 = self.environ.get('PS1', '') + if 'POWERLINE_COMMAND' in ps1: + # Defer to powerline (https://github.com/powerline/powerline) if it's in use. + return current_prompt_modifier = self.environ.get('CONDA_PROMPT_MODIFIER') if current_prompt_modifier: ps1 = re.sub(re.escape(current_prompt_modifier), r'', ps1)
activate and powerline don't play nice together I am using [powerline](https://github.com/powerline/powerline) to display the current anaconda environment in my shell. However, when I use `source active MY_ENV ` it doesn't realize that I am already using `powerline` to display the anaconda environment and it appends the current anaconda environment before my `PS1` variable. Effectively it now displays my environment twice in my shell. One trivial workaround for this is to check whether `PS1` is modified by `powerline` before appending the current environment to it. I am happy to file a pull request, but I wanted to check how people feel about this and also if anybody else has any better ideas of how to deal with this.
Just be aware that #3175 happened so the activate/deactivate scripts have been completely refactored. I do not know enough about powerline (I just learned about it) to quickly offer a solution however I suggest adding the check for powerline to the `conda ..changeps1` function and that way make no changes to any of the activate/deactivate scripts.
2018-07-31T10:18:24
conda/conda
7,629
conda__conda-7629
[ "7595" ]
a752bd37ffa759ece68881b54e72c7480c857627
diff --git a/conda/core/initialize.py b/conda/core/initialize.py --- a/conda/core/initialize.py +++ b/conda/core/initialize.py @@ -47,7 +47,7 @@ from .._vendor.auxlib.ish import dals from ..activate import CshActivator, FishActivator, PosixActivator, XonshActivator from ..base.context import context -from ..common.compat import (PY2, ensure_binary, ensure_fs_path_encoding, ensure_unicode, on_mac, +from ..common.compat import (PY2, ensure_binary, ensure_fs_path_encoding, ensure_text_type, on_mac, on_win, open) from ..common.path import (expand, get_bin_directory_short_path, get_python_short_path, get_python_site_packages_short_path, win_path_ok) @@ -453,6 +453,15 @@ def make_initialize_plan(conda_prefix, shells, for_user, for_system, anaconda_pr 'conda_prefix': conda_prefix, }, }) + # it would be nice to enable this on a user-level basis, but unfortunately, it is + # a system-level key only. + plan.append({ + 'function': init_long_path.__name__, + 'kwargs': { + 'target_path': 'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\' + 'FileSystem\\LongPathsEnabled' + } + }) if anaconda_prompt: plan.append({ 'function': install_anaconda_prompt.__name__, @@ -529,7 +538,8 @@ def run_plan_elevated(plan): file=sys.stderr) with open(temp_path) as fh: - _plan = json.loads(ensure_unicode(fh.read())) + _plan = json.loads(ensure_text_type(fh.read())) + finally: if temp_path and lexists(temp_path): rm_rf(temp_path) @@ -560,7 +570,7 @@ def run_plan_from_stdin(): def run_plan_from_temp_file(temp_path): with open(temp_path) as fh: - plan = json.loads(ensure_unicode(fh.read())) + plan = json.loads(ensure_text_type(fh.read())) run_plan(plan) with open(temp_path, 'w+b') as fh: fh.write(ensure_binary(json.dumps(plan, ensure_ascii=False))) @@ -1107,6 +1117,29 @@ def init_cmd_exe_registry(target_path, conda_prefix): return Result.NO_CHANGE +def init_long_path(target_path): + win_ver, _, win_rev = context.os_distribution_name_version[1].split('.') + # win10, build 14352 was the first preview release that supported this + if int(win_ver) >= 10 and int(win_rev) >= 14352: + prev_value, value_type = _read_windows_registry(target_path) + if prev_value != "1": + if context.verbosity: + print('\n') + print(target_path) + print(make_diff(prev_value, "1")) + if not context.dry_run: + _write_windows_registry(target_path, "1", winreg.REG_DWORD) + return Result.MODIFIED + else: + return Result.NO_CHANGE + else: + if context.verbosity: + print('\n') + print('Not setting long path registry key; Windows version must be at least 10 with ' + 'the fall 2016 "Anniversary update" or newer.') + return Result.NO_CHANGE + + def remove_conda_in_sp_dir(target_path): # target_path: site_packages_dir modified = False
diff --git a/tests/core/test_initialize.py b/tests/core/test_initialize.py --- a/tests/core/test_initialize.py +++ b/tests/core/test_initialize.py @@ -274,6 +274,8 @@ def test_make_initialize_plan_cmd_exe(self): assert len(steps) == 2 steps = tuple(step for step in plan if step['function'] == 'install_anaconda_prompt') assert len(steps) == 2 + steps = tuple(step for step in plan if step['function'] == 'init_long_path') + assert len(steps) == 1 def test_make_entry_point(self): with tempdir() as conda_temp_prefix: @@ -770,6 +772,34 @@ def _read_windows_registry_mock(target_path): expected = "echo hello & \"c:\\Users\\Lars\\miniconda\\condacmd\\conda_hook.bat\" & echo \"world\"" assert c.stdout.strip().splitlines()[-1][1:] == expected + @pytest.mark.skipif(not on_win, reason="win-only test") + def test_init_enable_long_path(self): + self.dummy_value = "0" + + def _read_windows_registry_mock(target_path): + return self.dummy_value, "REG_DWORD" + + def _write_windows_registry_mock(target_path, value, dtype): + self.dummy_value = value + + from conda.core import initialize + orig_read_windows_registry = initialize._read_windows_registry + initialize._read_windows_registry = _read_windows_registry_mock + orig_write_windows_registry = initialize._write_windows_registry + initialize._write_windows_registry = _write_windows_registry_mock + orig_join = initialize.join + initialize.join = ntpath.join + + try: + target_path = r'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem\\LongPathsEnabled' + assert initialize._read_windows_registry(target_path)[0] == "0" + initialize.init_long_path(target_path) + assert initialize._read_windows_registry(target_path)[0] == "1" + finally: + initialize._read_windows_registry = orig_read_windows_registry + initialize._write_windows_registry = orig_write_windows_registry + initialize.join = orig_join + def test_init_sh_system(self): with tempdir() as td: target_path = join(td, 'conda.sh')
add registry modifications to conda init * enable long paths * also consider symlinks
For symlinks, Ray thinks it's best to just try enabling development mode. Probably should be done as a optional CLI flag. For long paths, * cpython documentation: https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170aa2b/Doc/using/windows.rst#removing-the-max_path-limitation * Windows installer code: https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170aa2b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp#L651-L678 The majority of the code changes will be in https://github.com/conda/conda/blob/f055f667b54fd76562b5beda4d2d7df620a59363/conda/core/initialize.py. The docstring at the top of the module describes the general strategy of how `conda.core.initialize` works. ``` Sections in this module are 1. top-level functions 2. plan creators 3. plan runners 4. individual operations 5. helper functions The top-level functions compose and execute full plans. A plan is created by composing various individual operations. The plan data structure is a list of dicts, where each dict represents an individual operation. The dict contains two keys--`function` and `kwargs`--where function is the name of the individual operation function within this module. Each individual operation must a) return a `Result` (i.e. NEEDS_SUDO, MODIFIED, or NO_CHANGE) b) have no side effects if context.dry_run is True c) be verbose and descriptive about the changes being made or proposed is context.verbosity >= 1 The plan runner functions take the plan (list of dicts) as an argument, and then coordinate the execution of each individual operation. The docstring for `run_plan_elevated()` has details on how that strategy is implemented. ``` Tests are in the associated https://github.com/conda/conda/blob/f055f667b54fd76562b5beda4d2d7df620a59363/tests/core/test_initialize.py
2018-08-07T16:14:52
conda/conda
7,675
conda__conda-7675
[ "7672", "7672" ]
c411642c06795aa144d81b24876fb20547fa6f86
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 @@ -2,7 +2,6 @@ # Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause. from __future__ import absolute_import, division, print_function, unicode_literals -import collections import json import os from os.path import isfile, join @@ -13,7 +12,8 @@ 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.compat import (Mapping, Sequence, 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, yaml_dump, yaml_load @@ -35,7 +35,7 @@ def execute(args, parser): def format_dict(d): lines = [] for k, v in iteritems(d): - if isinstance(v, collections.Mapping): + if isinstance(v, Mapping): if v: lines.append("%s:" % k) lines.append(pretty_map(v)) @@ -257,7 +257,8 @@ def execute_config(args, parser): if key not in sequence_parameters: from ..exceptions import CondaValueError raise CondaValueError("Key '%s' is not a known sequence parameter." % key) - if not isinstance(rc_config.get(key, []), list): + if not (isinstance(rc_config.get(key, []), Sequence) and not + isinstance(rc_config.get(key, []), string_types)): from ..exceptions import CouldntParseError bad = rc_config[key].__class__.__name__ raise CouldntParseError("key %r should be a list, not %s." % (key, bad)) diff --git a/conda/common/compat.py b/conda/common/compat.py --- a/conda/common/compat.py +++ b/conda/common/compat.py @@ -46,6 +46,7 @@ # ############################# if PY3: # pragma: py2 no cover + from collections.abc import Mapping, Sequence from io import StringIO from itertools import zip_longest if sys.version_info[1] >= 5: @@ -54,6 +55,7 @@ else: JSONDecodeError = ValueError elif PY2: # pragma: py3 no cover + from collections import Mapping, Sequence from cStringIO import StringIO from itertools import izip as zip, izip_longest as zip_longest JSONDecodeError = ValueError
Ruamel Yaml CommentedSeq Subclasses MutableSequence not List ## Current Behavior `conda` checks if something is a list, but since it is loaded by `ruamel_yaml` it is a `CommentedSeq`, which now no longer subclasses from `list` but from `MutableSequence`. ```python Traceback (most recent call last): File "/opt/conda/lib/python3.6/site-packages/conda/cli/main_config.py", line 30, in execute execute_config(args, parser) File "/opt/conda/lib/python3.6/site-packages/conda/cli/main_config.py", line 263, in execute_config raise CouldntParseError("key %r should be a list, not %s." % (key, bad)) conda.exceptions.CouldntParseError: key 'channels' should be a list, not CommentedSeq. ``` I think this is the relevant line in master. https://github.com/conda/conda/blob/master/conda/cli/main_config.py#L286 [Commit in `ruamel.yaml` changing inheritance](https://bitbucket.org/ruamel/yaml/commits/9e4de94ee6a88ed86ab5fdc6d49a23cfc6ab5782) ### Steps to Reproduce Run a build with `ruamel_yaml>0.15.54`. ## Expected Behavior Not error with `ruamel_yaml>0.15.54` ## Environment Information Working on it. <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` ``` </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' --> ``` ``` </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' --> ``` ``` </p></details> Ruamel Yaml CommentedSeq Subclasses MutableSequence not List ## Current Behavior `conda` checks if something is a list, but since it is loaded by `ruamel_yaml` it is a `CommentedSeq`, which now no longer subclasses from `list` but from `MutableSequence`. ```python Traceback (most recent call last): File "/opt/conda/lib/python3.6/site-packages/conda/cli/main_config.py", line 30, in execute execute_config(args, parser) File "/opt/conda/lib/python3.6/site-packages/conda/cli/main_config.py", line 263, in execute_config raise CouldntParseError("key %r should be a list, not %s." % (key, bad)) conda.exceptions.CouldntParseError: key 'channels' should be a list, not CommentedSeq. ``` I think this is the relevant line in master. https://github.com/conda/conda/blob/master/conda/cli/main_config.py#L286 [Commit in `ruamel.yaml` changing inheritance](https://bitbucket.org/ruamel/yaml/commits/9e4de94ee6a88ed86ab5fdc6d49a23cfc6ab5782) ### Steps to Reproduce Run a build with `ruamel_yaml>0.15.54`. ## Expected Behavior Not error with `ruamel_yaml>0.15.54` ## Environment Information Working on it. <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` ``` </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' --> ``` ``` </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' --> ``` ``` </p></details>
2018-08-20T10:42:11
conda/conda
7,725
conda__conda-7725
[ "7724" ]
ec64c67846b7f8bb940116654b4ec6ab0ae6fb5d
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -402,15 +402,15 @@ def envs_dirs(self): if self.root_writable: fixed_dirs = ( join(self.root_prefix, 'envs'), - join(self._user_data_dir, 'envs'), join('~', '.conda', 'envs'), ) else: fixed_dirs = ( - join(self._user_data_dir, 'envs'), - join(self.root_prefix, 'envs'), join('~', '.conda', 'envs'), + join(self.root_prefix, 'envs'), ) + if on_win: + fixed_dirs += join(user_data_dir(APP_NAME, APP_NAME), 'envs'), return tuple(IndexedSet(expand(p) for p in concatv(self._envs_dirs, fixed_dirs))) @property @@ -419,10 +419,13 @@ def pkgs_dirs(self): return tuple(IndexedSet(expand(p) for p in self._pkgs_dirs)) else: cache_dir_name = 'pkgs32' if context.force_32bit else 'pkgs' - return tuple(IndexedSet(expand(join(p, cache_dir_name)) for p in ( + fixed_dirs = ( self.root_prefix, - self._user_data_dir, - ))) + join('~', '.conda'), + ) + if on_win: + fixed_dirs += user_data_dir(APP_NAME, APP_NAME), + return tuple(IndexedSet(expand(join(p, cache_dir_name)) for p in (fixed_dirs))) @memoizedproperty def trash_dir(self): @@ -434,13 +437,6 @@ def trash_dir(self): mkdir_p(trash_dir) return trash_dir - @property - def _user_data_dir(self): - if on_win: - return user_data_dir(APP_NAME, APP_NAME) - else: - return expand(join('~', '.conda')) - @property def default_prefix(self): if self.active_prefix:
Move windows package cache and envs dirs back to '~/.conda' directory In conda 4.3, we moved the default writable user location for envs_dirs and pkgs_dirs from `%USERPROFILE%\.conda` to `%USERPROFILE%\AppData\Local\conda\conda`. The reason for the change was to move conda towards more standards compliance. That change sometime collides with conda's concept of relocatable environments (i.e. environment root locations at any arbitrary file system path) and the standard [maximum path length restriction](https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation) of 260 characters. Consider transitioning user's package caches and new named envs directories back to `%USERPROFILE%\.conda`. We will still need to keep knowledge of `%USERPROFILE%\AppData\Local\conda\conda`, but newly downloaded packages and newly created named envs can by default be located in `%USERPROFILE%\.conda`.
2018-09-02T22:22:56
conda/conda
7,735
conda__conda-7735
[ "7706" ]
c9f55e23b8a5b117d48bb6aff6038fac164b0a44
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -422,7 +422,7 @@ def _add_prefix_to_path(self, prefix, starting_path_dirs=None): path_list = list(self.path_conversion(self._get_starting_path_list())) else: path_list = list(self.path_conversion(starting_path_dirs)) - path_list[0:0] = list(self._get_path_dirs2(prefix)) + path_list[0:0] = list(self.path_conversion(self._get_path_dirs2(prefix))) return tuple(path_list) def _remove_prefix_from_path(self, prefix, starting_path_dirs=None): @@ -708,6 +708,18 @@ def _build_activate_shell_custom(self, export_vars): def _hook_preamble(self): raise NotImplementedError() + def _add_prefix_to_path(self, prefix, starting_path_dirs=None): + # If this is the first time we're activating an environment, we need to ensure that + # the condacmd directory is included in the path list. + old_conda_shlvl = int(self.environ.get('CONDA_SHLVL', '').strip() or 0) + if starting_path_dirs is None: + starting_path_dirs = self._get_starting_path_list() + starting_path_dirs = list(starting_path_dirs) + if not old_conda_shlvl and not any(p.endswith("condacmd") for p in starting_path_dirs): + condacmd_dir = self.path_conversion(join(context.conda_prefix, "condacmd")) + starting_path_dirs.insert(0, condacmd_dir) + return super(CmdExeActivator, self)._add_prefix_to_path(prefix, starting_path_dirs) + class FishActivator(_Activator):
diff --git a/tests/test_activate.py b/tests/test_activate.py --- a/tests/test_activate.py +++ b/tests/test_activate.py @@ -99,7 +99,10 @@ def test_PS1_no_changeps1(self): instructions = activator.build_activate("base") assert instructions['export_vars']['CONDA_PROMPT_MODIFIER'] == '' - def test_add_prefix_to_path(self): + def test_add_prefix_to_path_posix(self): + if on_win and "PWD" not in os.environ: + pytest.skip("This test cannot be run from the cmd.exe shell.") + activator = PosixActivator() path_dirs = activator.path_conversion(['/path1/bin', '/path2/bin', '/usr/local/bin', '/usr/bin', '/bin']) @@ -112,6 +115,23 @@ def test_add_prefix_to_path(self): new_path = activator._add_prefix_to_path(test_prefix, path_dirs) assert new_path == added_paths + path_dirs + @pytest.mark.skipif(not on_win, reason="windows-specific test") + def test_add_prefix_to_path_cmdexe(self): + activator = CmdExeActivator() + + path_dirs = activator.path_conversion(["C:\\path1", "C:\\Program Files\\Git\\cmd", "C:\\WINDOWS\\system32"]) + assert len(path_dirs) == 3 + test_prefix = '/usr/mytest/prefix' + added_paths = activator.path_conversion(activator._get_path_dirs(test_prefix)) + if isinstance(added_paths, string_types): + added_paths = added_paths, + + new_path = activator._add_prefix_to_path(test_prefix, path_dirs) + assert new_path[:len(added_paths)] == added_paths + assert new_path[-len(path_dirs):] == path_dirs + assert len(new_path) == len(added_paths) + len(path_dirs) + 1 + assert new_path[len(added_paths)].endswith("condacmd") + def test_remove_prefix_from_path_1(self): activator = PosixActivator() original_path = tuple(activator._get_starting_path_list())
new shell activation seems to break conda-build env activation <!-- 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. --> This is with master, on win-64. ``conda 4.6.0a2.post446+4b8c40a90`` (base) Z:\code\aggregate-clean2>where conda c:\miniconda2\Library\bin\conda.bat c:\miniconda2\Scripts\conda.exe c:\miniconda2\condacmd\conda.bat ### 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. --> ``` (base) Z:\code\aggregate-clean2>c:\miniconda2\Scripts\conda.exe init cmd.exe no change c:\miniconda2\Scripts\conda.exe no change c:\miniconda2\Scripts\conda-env.exe no change c:\miniconda2\Scripts\conda-script.py no change c:\miniconda2\Scripts\conda-env-script.py no change c:\miniconda2\condacmd\conda.bat no change c:\miniconda2\condacmd\_conda_activate.bat no change c:\miniconda2\condacmd\conda_auto_activate.bat no change c:\miniconda2\condacmd\conda_hook.bat no change c:\miniconda2\Scripts\activate.bat no change c:\miniconda2\condacmd\activate.bat no change c:\miniconda2\condacmd\deactivate.bat no change c:\miniconda2\Scripts\activate no change c:\miniconda2\Scripts\deactivate no change c:\miniconda2\etc\profile.d\conda.sh no change c:\miniconda2\etc\fish\conf.d\conda.fish no change c:\miniconda2\Lib\site-packages\xonsh\conda.xsh no change c:\miniconda2\etc\profile.d\conda.csh no change HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun No action taken. ``` Now, build a recipe with conda-build: ``` (base) Z:\code\aggregate-clean2>conda build numexpr-feedstock --python=3.7 ( elided text about env creation and variable setting) (base) c:\miniconda2\conda-bld\numexpr_1535419666960\work>conda activate "c:\miniconda2\conda-bld\numexpr_1535419666960\_h_env" CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. If using 'conda activate' from a batch script, change your invocation to 'CALL conda.bat activate'. To initialize your shell, run $ conda init <SHELL_NAME> Currently supported shells are: - bash - cmd.exe - fish - tcsh - xonsh - zsh See 'conda init --help' for more information and options. IMPORTANT: You may need to close and restart your shell after running 'conda init'. ``` The raw cmd.exe does appear to behave more cleanly: ``` Z:\>where conda c:\miniconda2\condacmd\conda.bat ``` However, this also results in the same build failures. I thought this was something to do with Anaconda Prompt and confusion between that and the new way, but it appears the new way is just as broken by itself. =( ## Expected Behavior <!-- What do you think should happen? --> Conda build should be able to activate envs? ## Environment Information <details open><summary><code>`conda info`</code></summary><p> <!-- between the ticks below, paste the output of 'conda info' --> ``` (base) Z:\code\aggregate-clean2>conda info active environment : base active env location : c:\miniconda2 shell level : 1 user config file : C:\Users\builder\.condarc populated config files : C:\Users\builder\.condarc conda version : 4.6.0a2.post446+4b8c40a90 conda-build version : 3.13.0+0.g170fa827.dirty python version : 2.7.14.final.0 base environment : c:\miniconda2 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/win-64 https://repo.anaconda.com/pkgs/free/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:\miniconda2\pkgs C:\Users\builder\AppData\Local\conda\conda\pkgs envs directories : c:\miniconda2\envs C:\Users\builder\AppData\Local\conda\conda\envs C:\Users\builder\.conda\envs platform : win-64 user-agent : conda/4.6.0a2.post446+4b8c40a90 requests/2.18.4 CPython/2.7.14 Windows/10 Windows/10.0.17134 administrator : False 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' --> ``` ``` </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' --> ``` ``` </p></details>
We probably just need to ensure that `self.sep.join((context.conda_prefix, 'condacmd'))` is always put in front of the added prefix paths at https://github.com/conda/conda/blob/4b8c40a908ce9d536244fe5ca1868c06251802c4/conda/activate.py#L425 on Windows, I guess.
2018-09-04T19:56:34
conda/conda
7,773
conda__conda-7773
[ "7764" ]
21a24f02b2687d0895de04664a4ec23ccc75c33a
diff --git a/conda/activate.py b/conda/activate.py --- a/conda/activate.py +++ b/conda/activate.py @@ -97,6 +97,11 @@ def reactivate(self): def hook(self, auto_activate_base=None): builder = [] builder.append(self._hook_preamble()) + + # here + condabin_dir = self.path_conversion(join(context.conda_prefix, "condabin")) + self.export_var_tmpl % ("PATH", self.pathsep_join((condabin_dir, ))) + with open(self.hook_source_path) as fsrc: builder.append(fsrc.read()) if auto_activate_base is None and context.auto_activate_base or auto_activate_base: @@ -422,6 +427,16 @@ def _add_prefix_to_path(self, prefix, starting_path_dirs=None): path_list = list(self.path_conversion(self._get_starting_path_list())) else: path_list = list(self.path_conversion(starting_path_dirs)) + + # If this is the first time we're activating an environment, we need to ensure that + # the condabin directory is included in the path list. + # Under normal conditions, if the shell hook is working correctly, this should + # never trigger. + old_conda_shlvl = int(self.environ.get('CONDA_SHLVL', '').strip() or 0) + if not old_conda_shlvl and not any(p.endswith("condabin") for p in path_list): + condabin_dir = self.path_conversion(join(context.conda_prefix, "condabin")) + path_list.insert(0, condabin_dir) + path_list[0:0] = list(self.path_conversion(self._get_path_dirs2(prefix))) return tuple(path_list) @@ -607,7 +622,7 @@ def _hook_preamble(self): if on_win: return ('export CONDA_EXE="$(cygpath \'%s\')"\n' 'export CONDA_BAT="%s"' - % (context.conda_exe, join(context.conda_prefix, 'condacmd', 'conda.bat')) + % (context.conda_exe, join(context.conda_prefix, 'condabin', 'conda.bat')) ) else: return 'export CONDA_EXE="%s"' % context.conda_exe @@ -708,18 +723,6 @@ def _build_activate_shell_custom(self, export_vars): def _hook_preamble(self): raise NotImplementedError() - def _add_prefix_to_path(self, prefix, starting_path_dirs=None): - # If this is the first time we're activating an environment, we need to ensure that - # the condacmd directory is included in the path list. - old_conda_shlvl = int(self.environ.get('CONDA_SHLVL', '').strip() or 0) - if starting_path_dirs is None: - starting_path_dirs = self._get_starting_path_list() - starting_path_dirs = list(starting_path_dirs) - if not old_conda_shlvl and not any(p.endswith("condacmd") for p in starting_path_dirs): - condacmd_dir = self.path_conversion(join(context.conda_prefix, "condacmd")) - starting_path_dirs.insert(0, condacmd_dir) - return super(CmdExeActivator, self)._add_prefix_to_path(prefix, starting_path_dirs) - class FishActivator(_Activator): diff --git a/conda/cli/main_run.py b/conda/cli/main_run.py --- a/conda/cli/main_run.py +++ b/conda/cli/main_run.py @@ -26,7 +26,7 @@ def _get_activated_env_vars_win(env_location): try: conda_bat = os.environ["CONDA_BAT"] except KeyError: - conda_bat = abspath(join(sys.prefix, 'condacmd', 'conda.bat')) + conda_bat = abspath(join(sys.prefix, 'condabin', 'conda.bat')) temp_path = None try: diff --git a/conda/core/initialize.py b/conda/core/initialize.py --- a/conda/core/initialize.py +++ b/conda/core/initialize.py @@ -198,9 +198,9 @@ def initialize_dev(shell, dev_env_prefix=None, conda_source_root=None): builder += ["@SET %s=" % unset_env_var for unset_env_var in unset_env_vars] builder += ['@SET "%s=%s"' % (key, env_vars[key]) for key in sorted(env_vars)] builder += [ - '@CALL \"%s\"' % join(dev_env_prefix, 'condacmd', 'conda_hook.bat'), + '@CALL \"%s\"' % join(dev_env_prefix, 'condabin', 'conda_hook.bat'), '@IF %errorlevel% NEQ 0 @EXIT /B %errorlevel%', - '@CALL \"%s\" activate \"%s\"' % (join(dev_env_prefix, 'condacmd', 'conda.bat'), + '@CALL \"%s\" activate \"%s\"' % (join(dev_env_prefix, 'condabin', 'conda.bat'), dev_env_prefix), '@IF %errorlevel% NEQ 0 @EXIT /B %errorlevel%', ] @@ -248,6 +248,16 @@ def make_install_plan(conda_prefix): }, }) else: + # We can't put a conda.exe in condabin on Windows. It'll conflict with conda.bat. + plan.append({ + 'function': make_entry_point.__name__, + 'kwargs': { + 'target_path': join(conda_prefix, 'condabin', 'conda'), + 'conda_prefix': conda_prefix, + 'module': 'conda.cli', + 'func': 'main', + }, + }) conda_exe_path = join(conda_prefix, 'bin', 'conda') conda_env_exe_path = join(conda_prefix, 'bin', 'conda-env') @@ -275,30 +285,30 @@ def make_install_plan(conda_prefix): # ###################################### if on_win: plan.append({ - 'function': install_condacmd_conda_bat.__name__, + 'function': install_condabin_conda_bat.__name__, 'kwargs': { - 'target_path': join(conda_prefix, 'condacmd', 'conda.bat'), + 'target_path': join(conda_prefix, 'condabin', 'conda.bat'), 'conda_prefix': conda_prefix, }, }) plan.append({ - 'function': install_condacmd_conda_activate_bat.__name__, + 'function': install_condabin_conda_activate_bat.__name__, 'kwargs': { - 'target_path': join(conda_prefix, 'condacmd', '_conda_activate.bat'), + 'target_path': join(conda_prefix, 'condabin', '_conda_activate.bat'), 'conda_prefix': conda_prefix, }, }) plan.append({ - 'function': install_condacmd_conda_auto_activate_bat.__name__, + 'function': install_condabin_conda_auto_activate_bat.__name__, 'kwargs': { - 'target_path': join(conda_prefix, 'condacmd', 'conda_auto_activate.bat'), + 'target_path': join(conda_prefix, 'condabin', 'conda_auto_activate.bat'), 'conda_prefix': conda_prefix, }, }) plan.append({ - 'function': install_condacmd_hook_bat.__name__, + 'function': install_condabin_hook_bat.__name__, 'kwargs': { - 'target_path': join(conda_prefix, 'condacmd', 'conda_hook.bat'), + 'target_path': join(conda_prefix, 'condabin', 'conda_hook.bat'), 'conda_prefix': conda_prefix, }, }) @@ -312,14 +322,14 @@ def make_install_plan(conda_prefix): plan.append({ 'function': install_activate_bat.__name__, 'kwargs': { - 'target_path': join(conda_prefix, 'condacmd', 'activate.bat'), + 'target_path': join(conda_prefix, 'condabin', 'activate.bat'), 'conda_prefix': conda_prefix, }, }) plan.append({ 'function': install_deactivate_bat.__name__, 'kwargs': { - 'target_path': join(conda_prefix, 'condacmd', 'deactivate.bat'), + 'target_path': join(conda_prefix, 'condabin', 'deactivate.bat'), 'conda_prefix': conda_prefix, }, }) @@ -466,7 +476,7 @@ def make_initialize_plan(conda_prefix, shells, for_user, for_system, anaconda_pr plan.append({ 'function': install_anaconda_prompt.__name__, 'kwargs': { - 'target_path': join(conda_prefix, 'condacmd', 'Anaconda Prompt.lnk'), + 'target_path': join(conda_prefix, 'condabin', 'Anaconda Prompt.lnk'), 'conda_prefix': conda_prefix, }, }) @@ -667,14 +677,14 @@ def make_entry_point_exe(target_path, conda_prefix): def install_anaconda_prompt(target_path, conda_prefix): - # target_path: join(conda_prefix, 'condacmd', 'Anaconda Prompt.lnk') + # target_path: join(conda_prefix, 'condabin', 'Anaconda Prompt.lnk') # target: join(os.environ["HOMEPATH"], "Desktop", "Anaconda Prompt.lnk") icon_path = join(CONDA_PACKAGE_ROOT, 'shell', 'conda_icon.ico') args = ( '/K', - '""%s" && "%s""' % (join(conda_prefix, 'condacmd', 'conda_hook.bat'), - join(conda_prefix, 'condacmd', 'conda_auto_activate.bat')), + '""%s" && "%s""' % (join(conda_prefix, 'condabin', 'conda_hook.bat'), + join(conda_prefix, 'condabin', 'conda_auto_activate.bat')), ) # The API for the call to 'create_shortcut' has 3 # required arguments (path, description, filename) @@ -730,16 +740,16 @@ def install_Scripts_activate_bat(target_path, conda_prefix): def install_activate_bat(target_path, conda_prefix): - # target_path: join(conda_prefix, 'condacmd', 'activate.bat') - src_path = join(CONDA_PACKAGE_ROOT, 'shell', 'condacmd', 'activate.bat') + # target_path: join(conda_prefix, 'condabin', 'activate.bat') + src_path = join(CONDA_PACKAGE_ROOT, 'shell', 'condabin', 'activate.bat') with open(src_path) as fsrc: file_content = fsrc.read() return _install_file(target_path, file_content) def install_deactivate_bat(target_path, conda_prefix): - # target_path: join(conda_prefix, 'condacmd', 'deactivate.bat') - src_path = join(CONDA_PACKAGE_ROOT, 'shell', 'condacmd', 'deactivate.bat') + # target_path: join(conda_prefix, 'condabin', 'deactivate.bat') + src_path = join(CONDA_PACKAGE_ROOT, 'shell', 'condabin', 'deactivate.bat') with open(src_path) as fsrc: file_content = fsrc.read() return _install_file(target_path, file_content) @@ -769,33 +779,33 @@ def install_deactivate(target_path, conda_prefix): return _install_file(target_path, file_content) -def install_condacmd_conda_bat(target_path, conda_prefix): - # target_path: join(conda_prefix, 'condacmd', 'conda.bat') - conda_bat_src_path = join(CONDA_PACKAGE_ROOT, 'shell', 'condacmd', 'conda.bat') +def install_condabin_conda_bat(target_path, conda_prefix): + # target_path: join(conda_prefix, 'condabin', 'conda.bat') + conda_bat_src_path = join(CONDA_PACKAGE_ROOT, 'shell', 'condabin', 'conda.bat') with open(conda_bat_src_path) as fsrc: file_content = fsrc.read() return _install_file(target_path, file_content) -def install_condacmd_conda_activate_bat(target_path, conda_prefix): - # target_path: join(conda_prefix, 'condacmd', '_conda_activate.bat') - conda_bat_src_path = join(CONDA_PACKAGE_ROOT, 'shell', 'condacmd', '_conda_activate.bat') +def install_condabin_conda_activate_bat(target_path, conda_prefix): + # target_path: join(conda_prefix, 'condabin', '_conda_activate.bat') + conda_bat_src_path = join(CONDA_PACKAGE_ROOT, 'shell', 'condabin', '_conda_activate.bat') with open(conda_bat_src_path) as fsrc: file_content = fsrc.read() return _install_file(target_path, file_content) -def install_condacmd_conda_auto_activate_bat(target_path, conda_prefix): - # target_path: join(conda_prefix, 'condacmd', 'conda_auto_activate.bat') - conda_bat_src_path = join(CONDA_PACKAGE_ROOT, 'shell', 'condacmd', 'conda_auto_activate.bat') +def install_condabin_conda_auto_activate_bat(target_path, conda_prefix): + # target_path: join(conda_prefix, 'condabin', 'conda_auto_activate.bat') + conda_bat_src_path = join(CONDA_PACKAGE_ROOT, 'shell', 'condabin', 'conda_auto_activate.bat') with open(conda_bat_src_path) as fsrc: file_content = fsrc.read() return _install_file(target_path, file_content) -def install_condacmd_hook_bat(target_path, conda_prefix): - # target_path: join(conda_prefix, 'condacmd', 'conda_hook.bat') - conda_bat_src_path = join(CONDA_PACKAGE_ROOT, 'shell', 'condacmd', 'conda_hook.bat') +def install_condabin_hook_bat(target_path, conda_prefix): + # target_path: join(conda_prefix, 'condabin', 'conda_hook.bat') + conda_bat_src_path = join(CONDA_PACKAGE_ROOT, 'shell', 'condabin', 'conda_hook.bat') with open(conda_bat_src_path) as fsrc: file_content = fsrc.read() return _install_file(target_path, file_content) @@ -1089,7 +1099,7 @@ def init_cmd_exe_registry(target_path, conda_prefix): prev_value = "" value_type = winreg.REG_EXPAND_SZ - hook_path = '"%s"' % join(conda_prefix, 'condacmd', 'conda_hook.bat') + hook_path = '"%s"' % join(conda_prefix, 'condabin', 'conda_hook.bat') replace_str = "__CONDA_REPLACE_ME_123__" new_value = re.sub( r'(\".*?conda[-_]hook\.bat\")',
diff --git a/tests/core/test_initialize.py b/tests/core/test_initialize.py --- a/tests/core/test_initialize.py +++ b/tests/core/test_initialize.py @@ -21,7 +21,7 @@ from conda.core.initialize import Result, _get_python_info, init_sh_system, init_sh_user, \ initialize_dev, install, install_conda_csh, install_conda_fish, \ install_conda_sh, install_conda_xsh, make_entry_point, make_entry_point_exe, \ - make_initialize_plan, make_install_plan, install_condacmd_conda_bat + make_initialize_plan, make_install_plan, install_condabin_conda_bat from conda.exceptions import CondaValueError from conda.gateways.disk.create import create_link, mkdir_p from conda.models.enums import LinkType @@ -102,31 +102,31 @@ def test_make_install_plan(self): } }, { - "function": "install_condacmd_conda_bat", + "function": "install_condabin_conda_bat", "kwargs": { "conda_prefix": "/darwin", - "target_path": "/darwin\\condacmd\\conda.bat" + "target_path": "/darwin\\condabin\\conda.bat" } }, { - "function": "install_condacmd_conda_activate_bat", + "function": "install_condabin_conda_activate_bat", "kwargs": { "conda_prefix": "/darwin", - "target_path": "/darwin\\condacmd\\_conda_activate.bat" + "target_path": "/darwin\\condabin\\_conda_activate.bat" } }, { - "function": "install_condacmd_conda_auto_activate_bat", + "function": "install_condabin_conda_auto_activate_bat", "kwargs": { "conda_prefix": "/darwin", - "target_path": "/darwin\\condacmd\\conda_auto_activate.bat" + "target_path": "/darwin\\condabin\\conda_auto_activate.bat" } }, { - "function": "install_condacmd_hook_bat", + "function": "install_condabin_hook_bat", "kwargs": { "conda_prefix": "/darwin", - "target_path": "/darwin\\condacmd\\conda_hook.bat" + "target_path": "/darwin\\condabin\\conda_hook.bat" } }, { @@ -140,14 +140,14 @@ def test_make_install_plan(self): "function": "install_activate_bat", "kwargs": { "conda_prefix": "/darwin", - "target_path": "/darwin\\condacmd\\activate.bat" + "target_path": "/darwin\\condabin\\activate.bat" } }, { "function": "install_deactivate_bat", "kwargs": { "conda_prefix": "/darwin", - "target_path": "/darwin\\condacmd\\deactivate.bat" + "target_path": "/darwin\\condabin\\deactivate.bat" } }, { @@ -195,6 +195,15 @@ def test_make_install_plan(self): ] else: assert plan == [ + { + "function": "make_entry_point", + "kwargs": { + "conda_prefix": "/darwin", + "func": "main", + "module": "conda.cli", + "target_path": "/darwin/condabin/conda" + } + }, { "function": "make_entry_point", "kwargs": { @@ -337,7 +346,7 @@ def test_install_conda_sh(self): if on_win: first_line, second_line, remainder = created_file_contents.split('\n', 2) assert first_line == "export CONDA_EXE=\"$(cygpath '%s')\"" % context.conda_exe - assert second_line == "export CONDA_BAT=\"%s\"" % join(context.conda_prefix, 'condacmd', 'conda.bat') + assert second_line == "export CONDA_BAT=\"%s\"" % join(context.conda_prefix, 'condabin', 'conda.bat') else: first_line, remainder = created_file_contents.split('\n', 1) assert first_line == 'export CONDA_EXE="%s"' % context.conda_exe @@ -427,11 +436,11 @@ def test_install_conda_csh(self): result = install_conda_csh(target_path, conda_prefix) assert result == Result.NO_CHANGE - def test_install_condacmd_conda_bat(self): + def test_install_condabin_conda_bat(self): with tempdir() as conda_temp_prefix: conda_prefix = abspath(sys.prefix) - target_path = join(conda_temp_prefix, 'condacmd', 'conda.bat') - result = install_condacmd_conda_bat(target_path, conda_prefix) + target_path = join(conda_temp_prefix, 'condabin', 'conda.bat') + result = install_condabin_conda_bat(target_path, conda_prefix) assert result == Result.MODIFIED with open(target_path) as fh: @@ -439,11 +448,11 @@ def test_install_condacmd_conda_bat(self): remainder = created_file_contents - with open(join(CONDA_PACKAGE_ROOT, 'shell', 'condacmd', 'conda.bat')) as fh: + with open(join(CONDA_PACKAGE_ROOT, 'shell', 'condabin', 'conda.bat')) as fh: original_contents = fh.read() assert remainder == original_contents - result = install_condacmd_conda_bat(target_path, conda_prefix) + result = install_condabin_conda_bat(target_path, conda_prefix) assert result == Result.NO_CHANGE def test__get_python_info(self): @@ -480,7 +489,8 @@ def test_install_1(self): ) else: modified_files = ( - 'conda', + 'conda', # condabin/conda + 'conda', # bin/conda 'conda-env', 'activate', 'deactivate', @@ -538,7 +548,8 @@ def test_initialize_dev_bash(self): ) else: modified_files = ( - 'conda', + 'conda', # condabin/conda + 'conda', # bin/conda 'conda-env', 'activate', 'deactivate', @@ -600,7 +611,8 @@ def test_initialize_dev_cmd_exe(self): ) else: modified_files = ( - 'conda', + 'conda', # condabin/conda + 'conda', # bin/conda 'conda-env', 'activate', 'deactivate', @@ -769,7 +781,7 @@ def _read_windows_registry_mock(target_path): initialize._read_windows_registry = orig_read_windows_registry initialize.join = orig_join - expected = "echo hello & \"c:\\Users\\Lars\\miniconda\\condacmd\\conda_hook.bat\" & echo \"world\"" + expected = "echo hello & \"c:\\Users\\Lars\\miniconda\\condabin\\conda_hook.bat\" & echo \"world\"" assert c.stdout.strip().splitlines()[-1][1:] == expected @pytest.mark.skipif(not on_win, reason="win-only test") diff --git a/tests/test_activate.py b/tests/test_activate.py --- a/tests/test_activate.py +++ b/tests/test_activate.py @@ -113,7 +113,8 @@ def test_add_prefix_to_path_posix(self): added_paths = added_paths, new_path = activator._add_prefix_to_path(test_prefix, path_dirs) - assert new_path == added_paths + path_dirs + condabin_dir = context.conda_prefix + "/condabin" + assert new_path == added_paths + (condabin_dir,) + path_dirs @pytest.mark.skipif(not on_win, reason="windows-specific test") def test_add_prefix_to_path_cmdexe(self): @@ -130,7 +131,7 @@ def test_add_prefix_to_path_cmdexe(self): assert new_path[:len(added_paths)] == added_paths assert new_path[-len(path_dirs):] == path_dirs assert len(new_path) == len(added_paths) + len(path_dirs) + 1 - assert new_path[len(added_paths)].endswith("condacmd") + assert new_path[len(added_paths)].endswith("condabin") def test_remove_prefix_from_path_1(self): activator = PosixActivator() @@ -1144,7 +1145,7 @@ class InteractiveShell(object): 'cmd.exe': { 'activator': 'cmd.exe', 'init_command': 'set "CONDA_SHLVL=" ' - '&& @CALL conda\\shell\\condacmd\\conda_hook.bat ' + '&& @CALL conda\\shell\\condabin\\conda_hook.bat ' '&& set "CONDA_EXE=python -m conda"', 'print_env_var': '@echo %%%s%%', }, @@ -1286,6 +1287,7 @@ def basic_posix(self, shell): num_paths_added = len(tuple(PosixActivator()._get_path_dirs(self.prefix))) shell.assert_env_var('CONDA_SHLVL', '0') PATH0 = shell.get_env_var('PATH').strip(':') + assert any(p.endswith("condabin") for p in PATH0.split(":")) shell.sendline('conda activate base') # shell.sendline('env | sort') diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -925,7 +925,7 @@ def test_install_freeze_installed_flag(self): run_command(Commands.INSTALL, prefix, "conda-forge::tensorflow>=1.4 --dry-run --freeze-installed") - @pytest.mark.xfail(on_win and datetime.now() < datetime(2018, 9, 15), + @pytest.mark.xfail(on_win and datetime.now() < datetime(2018, 10, 1), reason="need to talk with @msarahan about blas patches on Windows", strict=True) def test_install_features(self): diff --git a/tests/test_resolve.py b/tests/test_resolve.py --- a/tests/test_resolve.py +++ b/tests/test_resolve.py @@ -1025,7 +1025,7 @@ def test_no_features(): ] [email protected](datetime.now() < datetime(2018, 9, 15), reason="bogus test; talk with @mcg1969") [email protected](datetime.now() < datetime(2018, 10, 1), reason="bogus test; talk with @mcg1969") def test_multiple_solution(): assert False # index2 = index.copy()
change name of 'condacmd' dir to 'condabin'; use on all platforms
2018-09-17T14:13:29
conda/conda
7,783
conda__conda-7783
[ "7782" ]
c4c49187a80ed959099af1089d62206eeb028e0e
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 @@ -288,24 +288,29 @@ def __str__(self): name_matcher = self._match_components.get('name', '*') builder.append(('::%s' if builder else '%s') % name_matcher) - version_exact = False version = self._match_components.get('version') + build = self._match_components.get('build') + version_exact = False if version: version = text_type(version) - if any(s in version for s in '><$^|,!'): + if any(s in version for s in "><$^|,"): brackets.append("version='%s'" % version) - elif version.endswith('.*'): - builder.append('=' + version[:-2]) - elif version.endswith('*'): - builder.append('=' + version[:-1]) - elif version.startswith('=='): + elif version[:2] in ("!=", "~="): + if build: + brackets.append("version='%s'" % version) + else: + builder.append(version) + elif version[-2:] == ".*": + builder.append("=" + version[:-2]) + elif version[-1] == "*": + builder.append("=" + version[:-1]) + elif version.startswith("=="): builder.append(version) version_exact = True else: - builder.append('==' + version) + builder.append("==" + version) version_exact = True - build = self._match_components.get('build') if build: build = text_type(build) if any(s in build for s in '><$^|,'): @@ -500,7 +505,7 @@ def _parse_version_plus_build(v_plus_b): >>> _parse_version_plus_build("* *") ('*', '*') """ - parts = re.search(r'((?:.+?)[^><!,|]?)(?:(?<![=!|,<>])(?:[ =])([^-=,|<>]+?))?$', v_plus_b) + parts = re.search(r'((?:.+?)[^><!,|]?)(?:(?<![=!|,<>~])(?:[ =])([^-=,|<>~]+?))?$', v_plus_b) if parts: version, build = parts.groups() build = build and build.strip() @@ -640,7 +645,7 @@ def _parse_spec_str(spec_str): subdir = brackets.pop('subdir') # Step 6. strip off package name from remaining version + build - m3 = re.match(r'([^ =<>!]+)?([><!= ].+)?', spec_str) + m3 = re.match(r'([^ =<>!~]+)?([><!=~ ].+)?', spec_str) if m3: name, spec_str = m3.groups() if name is None: diff --git a/conda/models/version.py b/conda/models/version.py --- a/conda/models/version.py +++ b/conda/models/version.py @@ -229,6 +229,9 @@ def __init__(self, vstr): def __str__(self): return self.norm_version + def __repr__(self): + return "%s(\"%s\")" % (self.__class__.__name__, self) + def _eq(self, t1, t2): for v1, v2 in zip_longest(t1, t2, fillvalue=[]): for c1, c2 in zip_longest(v1, v2, fillvalue=self.fillvalue): @@ -389,11 +392,15 @@ def untreeify(spec, _inand=False): return spec +def compatible_release_operator(x, y): + return op.__ge__(x, y) and x.startswith(VersionOrder(".".join(text_type(y).split(".")[:-1]))) + + # This RE matches the operators '==', '!=', '<=', '>=', '<', '>' # followed by a version string. It rejects expressions like # '<= 1.2' (space after operator), '<>1.2' (unknown operator), # and '<=!1.2' (nonsensical operator). -version_relation_re = re.compile(r'^(=|==|!=|<=|>=|<|>)(?![=<>!])(\S+)$') +version_relation_re = re.compile(r'^(=|==|!=|<=|>=|<|>|~=)(?![=<>!~])(\S+)$') regex_split_re = re.compile(r'.*[()|,^$]') OPERATOR_MAP = { '==': op.__eq__, @@ -402,10 +409,11 @@ def untreeify(spec, _inand=False): '>=': op.__ge__, '<': op.__lt__, '>': op.__gt__, - '=': lambda x, y: text_type(x).startswith(text_type(y)), - "!=startswith": lambda x, y: not text_type(x).startswith(text_type(y)), + '=': lambda x, y: x.startswith(y), + "!=startswith": lambda x, y: not x.startswith(y), + "~=": compatible_release_operator, } -OPERATOR_START = frozenset(('=', '<', '>', '!')) +OPERATOR_START = frozenset(('=', '<', '>', '!', '~')) class BaseSpec(object):
diff --git a/tests/models/test_match_spec.py b/tests/models/test_match_spec.py --- a/tests/models/test_match_spec.py +++ b/tests/models/test_match_spec.py @@ -205,13 +205,20 @@ def test_canonical_string_forms(self): assert m("numpy==1.10=py38_0") == "numpy==1.10=py38_0" assert m("numpy[version=1.10 build=py38_0]") == "numpy==1.10=py38_0" - assert m("numpy!=1.10") == "numpy[version='!=1.10']" - assert m("numpy !=1.10") == "numpy[version='!=1.10']" + assert m("numpy!=1.10") == "numpy!=1.10" + assert m("numpy !=1.10") == "numpy!=1.10" assert m("numpy!=1.10 py38_0") == "numpy[version='!=1.10',build=py38_0]" assert m("numpy !=1.10 py38_0") == "numpy[version='!=1.10',build=py38_0]" assert m("numpy!=1.10=py38_0") == "numpy[version='!=1.10',build=py38_0]" assert m("numpy !=1.10=py38_0") == "numpy[version='!=1.10',build=py38_0]" assert m("numpy >1.7,!=1.10 py38_0") == "numpy[version='>1.7,!=1.10',build=py38_0]" + assert m("numpy!=1.10.*") == "numpy!=1.10.*" + assert m("numpy!=1.10,!=1.11") == "numpy[version='!=1.10,!=1.11']" + assert m("numpy=1.10.*,!=1.10.2") == "numpy[version='=1.10.*,!=1.10.2']" + + assert m("numpy ~=1.10.1") == "numpy~=1.10.1" + assert m("numpy~=1.10.1") == "numpy~=1.10.1" + assert m("numpy ~=1.10.1 py38_0") == "numpy[version='~=1.10.1',build=py38_0]" # # a full, exact spec looks like 'defaults/linux-64::numpy==1.8=py26_0' # # can we take an old dist str and reliably parse it with MatchSpec? @@ -312,9 +319,6 @@ def test_matchspec_errors(self): # skipping on Windows for now. don't feel like dealing with the windows url path crud assert text_type(MatchSpec("/some/file/on/disk/package-1.2.3-2.tar.bz2")) == '*[url=file:///some/file/on/disk/package-1.2.3-2.tar.bz2]' - with pytest.raises(InvalidSpec): - MatchSpec("appdirs ~=1.4.3") - def test_dist(self): dst = Dist('defaults::foo-1.2.3-4.tar.bz2') a = MatchSpec(dst) @@ -437,6 +441,9 @@ def test_bracket_matches(self): assert not MatchSpec("numpy[build_number='>7']").match(record) assert MatchSpec("numpy[build_number='>=7']").match(record) + assert MatchSpec("numpy ~=1.10").match(record) + assert MatchSpec("numpy~=1.10").match(record) + def test_license_match(self): record = { 'name': 'numpy', @@ -666,15 +673,20 @@ def test_parse_equal_equal(self): } def test_parse_hard(self): + assert _parse_spec_str("numpy~=1.7.1") == { + "_original_spec_str": "numpy~=1.7.1", + "name": "numpy", + "version": "~=1.7.1", + } assert _parse_spec_str("numpy>1.8,<2|==1.7") == { "_original_spec_str": "numpy>1.8,<2|==1.7", "name": "numpy", "version": ">1.8,<2|==1.7", } - assert _parse_spec_str("numpy >1.8,<2|==1.7,!=1.9 py34_0") == { - "_original_spec_str": "numpy >1.8,<2|==1.7,!=1.9 py34_0", + assert _parse_spec_str("numpy >1.8,<2|==1.7,!=1.9,~=1.7.1 py34_0") == { + "_original_spec_str": "numpy >1.8,<2|==1.7,!=1.9,~=1.7.1 py34_0", "name": "numpy", - "version": ">1.8,<2|==1.7,!=1.9", + "version": ">1.8,<2|==1.7,!=1.9,~=1.7.1", "build": "py34_0", } assert _parse_spec_str("*>1.8,<2|==1.7") == { diff --git a/tests/models/test_version.py b/tests/models/test_version.py --- a/tests/models/test_version.py +++ b/tests/models/test_version.py @@ -277,3 +277,24 @@ def test_invalid_version_specs(self): VersionSpec("~") with pytest.raises(InvalidVersionSpec): VersionSpec("^") + + def test_compatible_release_versions(self): + assert VersionSpec("~=1.10").match("1.11.0") + assert not VersionSpec("~=1.10.0").match("1.11.0") + + assert not VersionSpec("~=3.3.2").match("3.4.0") + assert not VersionSpec("~=3.3.2").match("3.3.1") + assert VersionSpec("~=3.3.2").match("3.3.2.0") + assert VersionSpec("~=3.3.2").match("3.3.3") + + assert VersionSpec("~=3.3.2|==2.2").match("2.2.0") + assert VersionSpec("~=3.3.2|==2.2").match("3.3.3") + assert not VersionSpec("~=3.3.2|==2.2").match("2.2.1") + + with pytest.raises(InvalidVersionSpec): + VersionSpec("~=3.3.2.*") + + def test_pep_440_arbitrary_equality_operator(self): + # We're going to leave the not implemented for now. + with pytest.raises(InvalidVersionSpec): + VersionSpec("===3.3.2") diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -20,7 +20,7 @@ import re from shlex import split from shutil import copyfile, rmtree -from subprocess import check_call, CalledProcessError, check_output +from subprocess import check_call, CalledProcessError, check_output, Popen, PIPE import sys from tempfile import gettempdir from unittest import TestCase @@ -1610,6 +1610,37 @@ def test_conda_pip_interop_conda_editable_package(self): assert unlink_dists[0]["name"] == "urllib3" assert unlink_dists[0]["channel"] == "pypi" + def test_conda_pip_interop_compatible_release_operator(self): + # Regression test for #7776 + with make_temp_env("pip=10 six=1.9 appdirs") as prefix: + assert package_is_installed(prefix, "python") + assert package_is_installed(prefix, "six=1.9") + assert package_is_installed(prefix, "appdirs>=1.4.3") + + p = Popen(PYTHON_BINARY + " -m pip install fs==2.1.0", stdout=PIPE, stderr=PIPE, cwd=prefix, shell=True) + stdout, stderr = p.communicate() + rc = p.returncode + assert int(rc) != 0 + assert "Cannot uninstall" in text_type(stderr) + + run_command(Commands.REMOVE, prefix, "six") + assert not package_is_installed(prefix, "six") + + output = check_output(PYTHON_BINARY + " -m pip install fs==2.1.0", cwd=prefix, shell=True) + print(output) + PrefixData._cache_.clear() + assert package_is_installed(prefix, "fs==2.1.0") + # six_record = next(PrefixData(prefix).query("six")) + # print(json_dump(six_record.dump())) + assert package_is_installed(prefix, "six~=1.10") + + stdout, stderr = run_command(Commands.LIST, prefix) + assert not stderr + assert "fs 2.1.0 pypi_0 pypi" in stdout + + with pytest.raises(DryRunExit): + run_command(Commands.INSTALL, prefix, "agate=1.6 --dry-run") + @pytest.mark.skipif(on_win, reason="gawk is a windows only package") def test_search_gawk_not_win_filter(self): with make_temp_env() as prefix:
Implement PEP-440 compatible release operator https://www.python.org/dev/peps/pep-0440/#compatible-release xref: https://github.com/conda/conda/issues/7776
2018-09-19T03:13:34
conda/conda
7,784
conda__conda-7784
[ "7770" ]
c4c49187a80ed959099af1089d62206eeb028e0e
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 @@ -27,7 +27,7 @@ def print_export_header(subdir): def get_packages(installed, regex): pat = re.compile(regex, re.I) if regex else None for prefix_rec in sorted(installed, key=lambda x: x.name.lower()): - if pat and pat.search(str(prefix_rec)) is None: + if pat and pat.search(prefix_rec.name) is None: continue yield prefix_rec
[4.6.0b0] conda list conda spews irrelevant packages Fairly sure this used to be more specific. Seems to be unwantedly matching on channel. If that new behaviour is by design is there some way to switch it off? ``` λ conda list conda # packages in environment at C:\Miniconda3: # # Name Version Build Channel altair 2.2.2 py_0 conda-forge anaconda-client 1.7.1 py36_0 anaconda-navigator 1.8.7 py36_0 anaconda-project 0.8.2 py36_0 arrow-cpp 0.10.0 py36_vc14h12fa3ca_0 [vc14] conda-forge async_generator 1.10 py_0 conda-forge autograd 1.2 py_1 conda-forge backports.functools_lru_cache 1.5 py_1 conda-forge bleach 2.1.4 py_0 conda-forge boost-cpp 1.67.0 hea38baa_0 conda-forge boto3 1.7.80 py_0 conda-forge botocore 1.10.80 py_0 conda-forge ca-certificates 2018.8.24 ha4d7672_0 conda-forge cachetools 2.1.0 py_0 conda-forge cftime 1.0.1 py36h452e1ab_0 conda-forge clangdev 5.0.0 flang_3 [flang vc14] conda-forge cmake 3.12.1 he025d50_0 conda-forge conda 4.6.0b0 py36_0 conda-canary conda-build 3.13.0 py36_0 conda-build-all 1.1.3 py_0 conda-forge conda-env 2.6.0 1 conda-forge-pinning 2018.08.14 0 conda-forge conda-smithy 3.1.12 py_0 conda-forge conda-verify 2.0.0 py36h065de53_0 contextvars 2.3 py_0 conda-forge cryptography 2.3.1 py36h74b6da3_0 conda-forge cryptography-vectors 2.3.1 py36_0 conda-forge defusedxml 0.5.0 py36_0 conda-forge docker-py 3.5.0 py36_0 conda-forge docker-pycreds 0.3.0 py_1 conda-forge flatbuffers 1.9.0 h6538335_1 conda-forge fonts-anaconda 1 h8fa9717_0 fs.sshfs 0.8.0 py36_0 conda-forge gensim 3.5.0 py36_vc14_0 [vc14] conda-forge gitdb2 2.0.4 py_0 conda-forge grpcio 1.14.1 py36he089993_0 conda-forge h5netcdf 0.6.2 py_0 conda-forge hypothesis 3.69.0 py36h39e3cac_0 conda-forge immutables 0.6 py36hfa6e2cd_0 conda-forge invoke 1.2.0 py36_0 conda-forge ipympl 0.2.1 py36_0 conda-forge jpeg 9c hfa6e2cd_0 conda-forge jupyterlab 0.34.0 py36_0 conda-forge ldap3 2.5.1 py_0 conda-forge libflang 5.0.0 vc14_20180208 [vc14] conda-forge libpng 1.6.35 h7602738_0 conda-forge libxcb 1.13 hcb389fa_2 conda-forge llvm-meta 6.0.1 0 conda-forge llvmdev 6.0.1 h4de0a4f_2 conda-forge lz4-c 1.8.2 he025d50_0 conda-forge mkl_fft 1.0.6 py36_0 conda-forge <snip> ...dozens more... ``` ```
That’s a regression. Thanks for the report! No problems - I'm kicking the tires as the killer feature for me is being able to specify channels with the `defaults::numpy` syntax in `env.yml` files. I also had a problem with `conda init cmd.exe` but fixed it and now can't repro. I'll see if can recreate it and if so will open an issue.
2018-09-19T03:35:42
conda/conda
7,826
conda__conda-7826
[ "7805" ]
db6af4ff1c859659be08ce98ca50c9ae69142474
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -138,8 +138,10 @@ class Context(Configuration): _root_prefix = PrimitiveParameter("", aliases=('root_dir', 'root_prefix')) _envs_dirs = SequenceParameter(string_types, aliases=('envs_dirs', 'envs_path'), - string_delimiter=os.pathsep) - _pkgs_dirs = SequenceParameter(string_types, aliases=('pkgs_dirs',)) + string_delimiter=os.pathsep, + expandvars=True) + _pkgs_dirs = SequenceParameter(string_types, aliases=('pkgs_dirs',), + expandvars=True) _subdir = PrimitiveParameter('', aliases=('subdir',)) _subdirs = SequenceParameter(string_types, aliases=('subdirs',)) @@ -151,12 +153,15 @@ class Context(Configuration): # remote connection details ssl_verify = PrimitiveParameter(True, element_type=string_types + (bool,), aliases=('verify_ssl',), - validation=ssl_verify_validation) + validation=ssl_verify_validation, + expandvars=True) client_ssl_cert = PrimitiveParameter(None, aliases=('client_cert',), - element_type=string_types + (NoneType,)) + element_type=string_types + (NoneType,), + expandvars=True) client_ssl_cert_key = PrimitiveParameter(None, aliases=('client_cert_key',), - element_type=string_types + (NoneType,)) - proxy_servers = MapParameter(string_types + (NoneType,)) + element_type=string_types + (NoneType,), + expandvars=True) + proxy_servers = MapParameter(string_types + (NoneType,), expandvars=True) remote_connect_timeout_secs = PrimitiveParameter(9.15) remote_read_timeout_secs = PrimitiveParameter(60.) remote_max_retries = PrimitiveParameter(3) @@ -172,19 +177,24 @@ class Context(Configuration): validation=channel_alias_validation) channel_priority = PrimitiveParameter(ChannelPriority.FLEXIBLE) _channels = SequenceParameter(string_types, default=(DEFAULTS_CHANNEL_NAME,), - aliases=('channels', 'channel',)) # channel for args.channel + aliases=('channels', 'channel',), + expandvars=True) # channel for args.channel _custom_channels = MapParameter(string_types, DEFAULT_CUSTOM_CHANNELS, - aliases=('custom_channels',)) - _custom_multichannels = MapParameter(list, aliases=('custom_multichannels',)) + aliases=('custom_channels',), + expandvars=True) + _custom_multichannels = MapParameter(list, aliases=('custom_multichannels',), + expandvars=True) _default_channels = SequenceParameter(string_types, DEFAULT_CHANNELS, - aliases=('default_channels',)) + aliases=('default_channels',), + expandvars=True) _migrated_channel_aliases = SequenceParameter(string_types, aliases=('migrated_channel_aliases',)) - migrated_custom_channels = MapParameter(string_types) # TODO: also take a list of strings + migrated_custom_channels = MapParameter(string_types, + expandvars=True) # TODO: also take a list of strings override_channels_enabled = PrimitiveParameter(True) show_channel_urls = PrimitiveParameter(None, element_type=(bool, NoneType)) use_local = PrimitiveParameter(False) - whitelist_channels = SequenceParameter(string_types) + whitelist_channels = SequenceParameter(string_types, expandvars=True) always_softlink = PrimitiveParameter(False, aliases=('softlink',)) always_copy = PrimitiveParameter(False, aliases=('copy',)) diff --git a/conda/common/configuration.py b/conda/common/configuration.py --- a/conda/common/configuration.py +++ b/conda/common/configuration.py @@ -24,13 +24,13 @@ from itertools import chain from logging import getLogger from os import environ, stat -from os.path import basename, join +from os.path import basename, join, expandvars from stat import S_IFDIR, S_IFMT, S_IFREG from enum import Enum, EnumMeta -from .compat import (isiterable, iteritems, itervalues, odict, primitive_types, string_types, - text_type, with_metaclass) +from .compat import (binary_type, isiterable, iteritems, itervalues, odict, primitive_types, + string_types, text_type, with_metaclass) from .constants import NULL from .path import expand from .serialize import yaml_load @@ -69,6 +69,12 @@ def pretty_map(dictionary, padding=' '): return '\n'.join("%s%s: %s" % (padding, key, value) for key, value in iteritems(dictionary)) +def expand_environment_variables(unexpanded): + if isinstance(unexpanded, string_types) or isinstance(unexpanded, binary_type): + return expandvars(unexpanded) + else: + return unexpanded + class ConfigurationError(CondaError): pass @@ -383,12 +389,13 @@ class Parameter(object): _type = None _element_type = None - def __init__(self, default, aliases=(), validation=None): + def __init__(self, default, aliases=(), validation=None, expandvars=False): self._name = None self._names = None self.default = default self.aliases = aliases self._validation = validation + self._expandvars = expandvars def _set_name(self, name): # this is an explicit method, and not a descriptor/setter @@ -445,6 +452,19 @@ def _get_all_matches(self, instance): def _merge(self, matches): raise NotImplementedError() + def _expand(self, data): + if self._expandvars: + # This is similar to conda._vendor.auxlib.type_coercion.typify_data_structure + # It could be DRY-er but that would break SRP. + if isinstance(data, Mapping): + return type(data)((k, expand_environment_variables(v)) for k, v in iteritems(data)) + elif isiterable(data): + return type(data)(expand_environment_variables(v) for v in data) + else: + return expand_environment_variables(data) + else: + return data + def __get__(self, instance, instance_type): # strategy is "extract and merge," which is actually just map and reduce # extract matches from each source in SEARCH_PATH @@ -453,9 +473,12 @@ def __get__(self, instance, instance_type): return instance._cache_[self.name] matches, errors = self._get_all_matches(instance) + merged = self._merge(matches) if matches else self.default + # We need to expand any environment variables before type casting. + # Otherwise e.g. `my_bool_var: $BOOL` with BOOL=True would raise a TypeCoercionError. + expanded = self._expand(merged) try: - result = typify_data_structure(self._merge(matches) if matches else self.default, - self._element_type) + result = typify_data_structure(expanded, self._element_type) except TypeCoercionError as e: errors.append(CustomValidationError(self.name, e.value, "<<merged>>", text_type(e))) else: @@ -515,7 +538,7 @@ class PrimitiveParameter(Parameter): python 2 has long and unicode types. """ - def __init__(self, default, aliases=(), validation=None, element_type=None): + def __init__(self, default, aliases=(), validation=None, element_type=None, expandvars=False): """ Args: default (Any): The parameter's default value. @@ -529,7 +552,7 @@ def __init__(self, default, aliases=(), validation=None, element_type=None): """ self._type = type(default) if element_type is None else element_type self._element_type = self._type - super(PrimitiveParameter, self).__init__(default, aliases, validation) + super(PrimitiveParameter, self).__init__(default, aliases, validation, expandvars) def _merge(self, matches): important_match = first(matches, self._match_key_is_important, default=None) @@ -554,7 +577,7 @@ class SequenceParameter(Parameter): _type = tuple def __init__(self, element_type, default=(), aliases=(), validation=None, - string_delimiter=','): + string_delimiter=',', expandvars=False): """ Args: element_type (type or Iterable[type]): The generic type of each element in @@ -567,7 +590,7 @@ def __init__(self, element_type, default=(), aliases=(), validation=None, """ self._element_type = element_type self.string_delimiter = string_delimiter - super(SequenceParameter, self).__init__(default, aliases, validation) + super(SequenceParameter, self).__init__(default, aliases, validation, expandvars) def collect_errors(self, instance, value, source="<<merged>>"): errors = super(SequenceParameter, self).collect_errors(instance, value) @@ -643,7 +666,7 @@ class MapParameter(Parameter): """ _type = frozendict - def __init__(self, element_type, default=None, aliases=(), validation=None): + def __init__(self, element_type, default=None, aliases=(), validation=None, expandvars=False): """ Args: element_type (type or Iterable[type]): The generic type of each element. @@ -655,7 +678,7 @@ def __init__(self, element_type, default=None, aliases=(), validation=None): """ self._element_type = element_type default = default and frozendict(default) or frozendict() - super(MapParameter, self).__init__(default, aliases, validation) + super(MapParameter, self).__init__(default, aliases, validation, expandvars) def collect_errors(self, instance, value, source="<<merged>>"): errors = super(MapParameter, self).collect_errors(instance, value)
diff --git a/tests/common/test_configuration.py b/tests/common/test_configuration.py --- a/tests/common/test_configuration.py +++ b/tests/common/test_configuration.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from conda.common.io import env_var +from conda.common.io import env_var, env_vars from conda._vendor.auxlib.ish import dals from conda.common.compat import odict, string_types @@ -18,7 +18,6 @@ from tempfile import mkdtemp from unittest import TestCase - test_yaml_raw = { 'file1': dals(""" always_yes: no @@ -135,6 +134,20 @@ # comment value """), + 'env_vars': dals(""" + env_var_map: + expanded: $EXPANDED_VAR + unexpanded: $UNEXPANDED_VAR + + env_var_str: $EXPANDED_VAR + env_var_bool: $BOOL_VAR + normal_str: $EXPANDED_VAR + + env_var_list: + - $EXPANDED_VAR + - $UNEXPANDED_VAR + - regular_var + """), } @@ -150,6 +163,12 @@ class SampleConfiguration(Configuration): boolean_map = MapParameter(bool) commented_map = MapParameter(string_types) + env_var_map = MapParameter(string_types, expandvars=True) + env_var_str = PrimitiveParameter('', expandvars=True) + env_var_bool = PrimitiveParameter(False, element_type=bool, expandvars=True) + normal_str = PrimitiveParameter('', expandvars=False) + env_var_list = SequenceParameter(string_types, expandvars=True) + def load_from_string_data(*seq): return odict((f, YamlRawParameter.make_raw_parameters(f, yaml_load(test_yaml_raw[f]))) @@ -463,3 +482,13 @@ def test_invalid_seq_parameter(self): config = SampleConfiguration()._set_raw_data(data) with raises(InvalidTypeError): config.channels + + def test_expanded_variables(self): + with env_vars({'EXPANDED_VAR': 'itsexpanded', 'BOOL_VAR': 'True'}): + config = SampleConfiguration()._set_raw_data(load_from_string_data('env_vars')) + assert config.env_var_map['expanded'] == 'itsexpanded' + assert config.env_var_map['unexpanded'] == '$UNEXPANDED_VAR' + assert config.env_var_str == 'itsexpanded' + assert config.env_var_bool is True + assert config.normal_str == '$EXPANDED_VAR' + assert config.env_var_list == ('itsexpanded', '$UNEXPANDED_VAR', 'regular_var') diff --git a/tests/models/test_channel.py b/tests/models/test_channel.py --- a/tests/models/test_channel.py +++ b/tests/models/test_channel.py @@ -615,6 +615,41 @@ def test_old_channel_alias(self): "ftp://new.url:8082/conda-forge/label/dev/noarch", ] +class ChannelEnvironmentVarExpansionTest(TestCase): + + @classmethod + def setUpClass(cls): + channels_config = dals(""" + channels: + - http://user22:[email protected]:8080 + + whitelist_channels: + - http://user22:[email protected]:8080 + + custom_channels: + unexpanded: http://user1:[email protected]:8080/with/path/t/tk-1234 + expanded: http://user33:[email protected]:8080/with/path/t/tk-1234 + """) + reset_context() + rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(channels_config))) + context._set_raw_data(rd) + + @classmethod + def tearDownClass(cls): + reset_context() + + def test_unexpanded_variables(self): + with env_var('EXPANDED_PWD', 'pass44'): + channel = Channel('unexpanded') + assert channel.auth == 'user1:$UNEXPANDED_PWD' + + def test_expanded_variables(self): + with env_var('EXPANDED_PWD', 'pass44'): + channel = Channel('expanded') + assert channel.auth == 'user33:pass44' + assert context.channels[0] == 'http://user22:[email protected]:8080' + assert context.whitelist_channels[0] == 'http://user22:[email protected]:8080' + class ChannelAuthTokenPriorityTests(TestCase):
Add expansion of environment variables in `channels` config key As per https://github.com/conda/conda/issues/1156#issuecomment-299913430, can we get expansion of environment variables in the `channels` config key? This would be useful for me, as I can then add the following lines to my `.condarc` file: ``` channels: - https://${USERNAME}:${PASSWORD}@my.private.conda.channel ```
Come to think of it, if environment variables will be expanded in `channels`, they should probably also be expanded in all other channel-related config keys, such as `custom_channels`, `custom_multichannels`, `default_channels`, `migrated_custom_channels`, and `whitelist_channels`. @kalefranz If you give your thumbs up I'd be happy to put in a PR in case you're pressed for time. I couldn't find a precedent for expanding non-path variables in the codebase though -- so I'm a bit unsure whether this is a sane thing to do. Yeah I say go for it. I especially see the value for `${PASSWORD}` in the example you give. Here are my thoughts right now. Buckle your seatbelt 😜 We need to set clear standards for usage requirements. Do we support `$PASSWORD`, `${PASSWORD}`, and/or `%PASSWORD%`? Note that `os.path.expandvars` has different behavior on different platforms. The notes for the `ntpath.py` version are ``` # Expand paths containing shell variable substitutions. # The following rules apply: # - no expansion within single quotes # - '$$' is translated into '$' # - '%%' is translated into '%' if '%%' are not seen in %var1%%var2% # - ${varname} is accepted. # - $varname is accepted. # - %varname% is accepted. # - varnames can be made out of letters, digits and the characters '_-' # (though is not verified in the ${varname} and %varname% cases) # XXX With COMMAND.COM you can use any characters in a variable name, # XXX except '^|<>='. Expand shell variables of the forms $var, ${var} and %var%. Unknown variables are left unchanged. ``` The notes for the `posixpath.py` version are ``` Expand shell variables of form $var and ${var}. Unknown variables are left unchanged. ``` How do we handle non-ascii characters? In the variable name itself? In the value/contents of the environment variable? Besides config parameters that deal with channels, other parameters we should probably have env var expansion in are `ssl_verify`, `client_ssl_cert`, `client_ssl_cert_key`, `proxy_servers`, `envs_dirs`, `pkgs_dirs`. I think some, most, maybe all of these might already be happening. We should take this opportunity to be sure though. How do we handle merges of channels lists where different parts of a channel specification are given in different places? A url that represents a channel is cut up into the following components - `scheme` - `auth` - `channel_location` - `token` - `channel_name` - `subdir` - `package_filename` When we merge channels, either with `context.channels` or with `conda.models.channel.prioritize_channels()` and `conda.models.channel.all_channel_urls()`, if we are given one channel URL that contains auth and one that doesn't, do we keep the auth information intact regardless of order? What happens if the auth information conflicts? What happens if one url only provides the username component, but a second provides both username and password? Same questions for `scheme`, `channel_location`, `token`, and `subdir`. The "primary key" in this situation should always be `channel_name`. Given all these thoughts and questions, `tests/models/test_channel.py` probably needs a lot more work. Good catch on the platform discrepancies. The existing path expansions have these baked-in, so I'd say we keep relying `os.path.expandvars` and propagate the discrepancies to the to-be expanded config parameters. It would be strange to recommend `${VAR}` on Windows or `%VAR%` on Linux, wouldn't it? What about false-positive expansions? The chances of having a`VAR` environment variable defined _and_ an unrelated `%VAR%` string in your URL are pretty slim, but still. Same goes for the `${VAR}` syntax since `$` is a valid URL character. Since these collisions can also exist for paths I think we can ignore them. As for the non-ASCII characters, I'm not sure. If these were problematic, wouldn't issues have crept up in other places (regardless of variable expansion)? Or nobody is using non-ASCII chars ... Either way, I'm not sure that's necessarily inside the scope of this issue. I'm also inclined to not consider the merging of the channels. If variables get expanded early enough I'd say it's outside of the scope of this issue. Not sure this is feasible though. I'll have a look at the other config parameters you mentioned, to be sure they're also expanded.
2018-10-03T15:00:07
conda/conda
7,827
conda__conda-7827
[ "7755" ]
5e1629ef61a787d50fce25f2dc5df26b6967d9af
diff --git a/conda_env/specs/__init__.py b/conda_env/specs/__init__.py --- a/conda_env/specs/__init__.py +++ b/conda_env/specs/__init__.py @@ -13,35 +13,42 @@ def detect(**kwargs): - # Check file existence filename = kwargs.get('filename') - if filename and not os.path.isfile(filename): - raise EnvironmentFileNotFound(filename=filename) + remote_definition = kwargs.get('name') # Check extensions all_valid_exts = YamlFileSpec.extensions.union(RequirementsSpec.extensions) fname, ext = os.path.splitext(filename) - if ext == '' or ext not in all_valid_exts: - raise EnvironmentFileExtensionNotValid(filename) - elif ext in YamlFileSpec.extensions: - specs = [YamlFileSpec] - elif ext in RequirementsSpec.extensions: - specs = [RequirementsSpec] + + # First check if file exists and test the known valid extension for specs + file_exists = filename and os.path.isfile(filename) + if file_exists: + if ext == '' or ext not in all_valid_exts: + raise EnvironmentFileExtensionNotValid(filename) + elif ext in YamlFileSpec.extensions: + specs = [YamlFileSpec] + elif ext in RequirementsSpec.extensions: + specs = [RequirementsSpec] else: specs = [NotebookSpec, BinstarSpec] # Check specifications + spec_instances = [] for SpecClass in specs: spec = SpecClass(**kwargs) + spec_instances.append(spec) if spec.can_handle(): return spec - raise SpecNotFound(build_message(specs)) + if not file_exists and remote_definition is None: + raise EnvironmentFileNotFound(filename=filename) + else: + raise SpecNotFound(build_message(spec_instances)) -def build_message(specs): - binstar_spec = next((spec for spec in specs if isinstance(spec, BinstarSpec)), None) +def build_message(spec_instances): + binstar_spec = next((s for s in spec_instances if isinstance(s, BinstarSpec)), None) if binstar_spec: return binstar_spec.msg else: - return "\n".join([s.msg for s in specs if s.msg is not None]) + return "\n".join([s.msg for s in spec_instances if s.msg is not None]) diff --git a/conda_env/specs/binstar.py b/conda_env/specs/binstar.py --- a/conda_env/specs/binstar.py +++ b/conda_env/specs/binstar.py @@ -43,10 +43,6 @@ def __init__(self, name=None, **kwargs): def can_handle(self): result = self._can_handle() - if result: - print("WARNING: Binstar environments are deprecated and scheduled to be " - "removed in conda 4.5. See conda issue #5843 at " - "https://github.com/conda/conda/pull/5843 for more information.") return result def _can_handle(self): @@ -60,6 +56,7 @@ def _can_handle(self): self.msg = ("Anaconda Client is required to interact with anaconda.org or an " "Anaconda API. Please run `conda install anaconda-client`.") return False + return self.package is not None and self.valid_package() return False
diff --git a/tests/conda_env/test_cli.py b/tests/conda_env/test_cli.py --- a/tests/conda_env/test_cli.py +++ b/tests/conda_env/test_cli.py @@ -50,6 +50,7 @@ test_env_name_1 = "env-1" test_env_name_2 = "snowflakes" +test_env_name_42 = "env-42" def escape_for_winpath(p): @@ -86,16 +87,16 @@ def run_env_command(command, prefix, *arguments): command_line = "{0} -n {1} {2}".format(command, prefix, " ".join(arguments)) elif command is Commands.ENV_CREATE: # CREATE if prefix : - command_line = "{0} -f {1} {2}".format(command, prefix, " ".join(arguments)) + command_line = "{0} -f {1} {2}".format(command, prefix, " ".join(arguments)) else: - command_line = "{0} ".format(command) + command_line = "{0} {1}".format(command, " ".join(arguments)) elif command is Commands.ENV_REMOVE: # REMOVE command_line = "{0} --yes -n {1} {2}".format(command, prefix, " ".join(arguments)) elif command is Commands.ENV_UPDATE: command_line = "{0} -n {1} {2}".format(command, prefix, " ".join(arguments)) else: command_line = " --help " - + print(command_line) args = p.parse_args(split(command_line)) context._set_argparse_args(args) @@ -155,6 +156,9 @@ def tearDown(self): if env_is_created(test_env_name_1): run_env_command(Commands.ENV_REMOVE, test_env_name_1) + if env_is_created(test_env_name_42): + run_env_command(Commands.ENV_REMOVE, test_env_name_42) + def test_conda_env_create_no_file(self): ''' Test `conda env create` without an environment.yml file @@ -175,6 +179,17 @@ def test_conda_env_create_no_existent_file(self): except Exception as e: self.assertIsInstance(e, EnvironmentFileNotFound) + def test_create_valid_remote_env(self): + run_env_command(Commands.ENV_CREATE, None, 'goanpeca/env-42') + self.assertTrue(env_is_created(test_env_name_42)) + + o, e = run_conda_command(Commands.INFO, None, "--json") + + parsed = json.loads(o) + self.assertNotEqual( + len([env for env in parsed['envs'] if env.endswith(test_env_name_42)]), 0 + ) + def test_create_valid_env(self): ''' Creates an environment.yml file and @@ -203,12 +218,24 @@ def test_update(self): self.assertNotEqual(len(parsed), 0) def test_name(self): + """ # smoke test for gh-254 + Test that --name can overide the `name` key inside an environment.yml + """ create_env(environment_1) + env_name = 'smoke-gh-254' try: - run_env_command(Commands.ENV_CREATE, test_env_name_1, "create") + run_env_command(Commands.ENV_CREATE, 'environment.yml', "-n", + env_name) except Exception as e: - self.assertIsInstance(e, EnvironmentFileNotFound, str(e)) + print(e) + + o, e = run_conda_command(Commands.INFO, None, "--json") + + parsed = json.loads(o) + self.assertNotEqual( + len([env for env in parsed['envs'] if env.endswith(env_name)]), 0 + ) def env_is_created(env_name):
fix 'conda env create` using remote env file Fix `conda env create mfix/mfix-18.1.0-osx64` in master. Broken in https://github.com/conda/conda/pull/7385. xref: https://github.com/conda/conda/issues/7111 Can also remove the deprecation warnings now (they were apparently placed in the wrong code location to begin with).
2018-10-04T16:38:01
conda/conda
7,919
conda__conda-7919
[ "7917" ]
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:40
conda/conda
7,948
conda__conda-7948
[ "7942" ]
95a1d48bb724926d574aba4af41e302ebdf6162d
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 @@ -8,6 +8,7 @@ from os import listdir from os.path import basename, isdir, isfile, join, lexists +from .._vendor.auxlib.exceptions import ValidationError from ..base.constants import CONDA_TARBALL_EXTENSION, PREFIX_MAGIC_FILE from ..base.context import context from ..common.compat import JSONDecodeError, itervalues, odict, string_types, with_metaclass @@ -257,6 +258,16 @@ def _load_site_packages(self): python_record = read_python_record(self.prefix_path, af, python_pkg_record.version) except EnvironmentError: continue + except ValidationError: + import sys + exc_type, exc_value, exc_traceback = sys.exc_info() + import traceback + tb = traceback.format_exception(exc_type, exc_value, exc_traceback) + log.warn("Problem reading non-conda package record at %s. Please verify that you " + "still need this, and if so, that this is still installed correctly. " + "Reinstalling this package may help.", af) + log.debug("ValidationError: \n%s\n", "\n".join(tb)) + continue if not python_record: continue self.__prefix_records[python_record.name] = python_record
non-conda-installed python packages can have missing version information When reading up metadata out of site-packages, non-conda-installed python packages can sometime be missing version information. When this is the case, we should default to a hard-codes `0.0.0` version. I believe this behavior is consistent with python’s own `python setup.py —version` when no version is actually given in the `setup()` function.
2018-11-08T23:48:48
conda/conda
7,951
conda__conda-7951
[ "7950" ]
d9ca6008736ff84dabfc484e115eeb5730e96e34
diff --git a/conda/core/initialize.py b/conda/core/initialize.py --- a/conda/core/initialize.py +++ b/conda/core/initialize.py @@ -1157,7 +1157,7 @@ def init_cmd_exe_registry(target_path, conda_prefix): hook_path = '"%s"' % join(conda_prefix, 'condabin', 'conda_hook.bat') replace_str = "__CONDA_REPLACE_ME_123__" new_value = re.sub( - r'(\".*?conda[-_]hook\.bat\")', + r'(\"[^\"]*?conda[-_]hook\.bat\")', replace_str, prev_value, count=1,
Conda Init Bug in v4.6.0b1 While exploring #7881 , I found a small bug in the regex pattern matching at: https://github.com/conda/conda/blob/7a93664267488adc5052efef38614fab537da446/conda/core/initialize.py#L1157-L1166 The regex pattern assumes that I would not have quotes in my already existing value in the registry key. For example, if I have the current value set as... ``` "\path\to\custom\startup.bat" & "\path\to\prev_installation\condabin\conda_hook.bat" ``` ... upon `conda init`, it will change the value to: ``` "\path\to\new_installation\condabin\conda_hook.bat" ``` Instead of: ``` "\path\to\custom\startup.bat" & "\path\to\new_installation\condabin\conda_hook.bat" ```
2018-11-10T14:47:06
conda/conda
7,986
conda__conda-7986
[ "5588" ]
523fcfddf8f149b3ee2e1788027df1060b02987e
diff --git a/conda/core/path_actions.py b/conda/core/path_actions.py --- a/conda/core/path_actions.py +++ b/conda/core/path_actions.py @@ -13,6 +13,7 @@ from .envs_manager import USER_ENVIRONMENTS_TXT_FILE, register_env, unregister_env from .portability import _PaddingError, update_prefix from .prefix_data import PrefixData +from .. import CondaError from .._vendor.auxlib.compat import with_metaclass from .._vendor.auxlib.ish import dals from ..base.constants import CONDA_TARBALL_EXTENSION @@ -161,6 +162,10 @@ def make_file_link_action(source_path_data): noarch = package_info.repodata_record.noarch if noarch == NoarchType.python: sp_dir = transaction_context['target_site_packages_short_path'] + if sp_dir is None: + raise CondaError("Unable to determine python site-packages " + "dir in target_prefix!\nPlease make sure " + "python is installed in %s" % target_prefix) target_short_path = get_python_noarch_target_path(source_path_data.path, sp_dir) elif noarch is None or noarch == NoarchType.generic: target_short_path = source_path_data.path
diff --git a/tests/common/pkg_formats/test_python.py b/tests/common/pkg_formats/test_python.py --- a/tests/common/pkg_formats/test_python.py +++ b/tests/common/pkg_formats/test_python.py @@ -398,7 +398,7 @@ def test_metadata(): # Python Distributions # ----------------------------------------------------------------------------- [email protected](datetime.now() < datetime(2018, 12, 1), [email protected](datetime.now() < datetime(2019, 1, 1), reason="This test needs to be refactored for the case of raising a hard " "error when the anchor_file doesn't exist.", strict=True) diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -584,8 +584,13 @@ def test_strict_channel_priority(self): assert not stderr json_obj = json_loads(stdout) channel_groups = groupby("channel",json_obj["actions"]["LINK"]) + channel_groups = sorted(list(channel_groups)) # conda-forge should be the only channel in the solution on unix - assert list(channel_groups) == ["conda-forge"] + # fiona->gdal->libgdal->m2w64-xz brings in pkgs/msys2 on win + if on_win: + assert channel_groups == ["conda-forge", "pkgs/msys2"] + else: + assert channel_groups == ["conda-forge"] def test_strict_resolve_get_reduced_index(self): channels = (Channel("defaults"),) @@ -925,8 +930,7 @@ def test_install_freeze_installed_flag(self): run_command(Commands.INSTALL, prefix, "conda-forge::tensorflow>=1.4 --dry-run --freeze-installed") - @pytest.mark.xfail(on_win and datetime.now() < datetime(2018, 11, 1), - reason="need to talk with @msarahan about blas patches on Windows", + @pytest.mark.xfail(on_win, reason="nomkl not present on windows", strict=True) def test_install_features(self): with make_temp_env("python=2 numpy=1.13 nomkl") as prefix: diff --git a/tests/test_resolve.py b/tests/test_resolve.py --- a/tests/test_resolve.py +++ b/tests/test_resolve.py @@ -1025,7 +1025,7 @@ def test_no_features(): ] [email protected](datetime.now() < datetime(2018, 12, 1), reason="bogus test; talk with @mcg1969") [email protected](datetime.now() < datetime(2019, 1, 1), reason="bogus test; talk with @mcg1969") def test_multiple_solution(): assert False # index2 = index.copy()
Installing a local noarch package fails I downloaded a bokeh noarch package from https://anaconda.org/bokeh/bokeh/0.12.7dev3/download/noarch/bokeh-0.12.7dev3-py_0.tar.bz2 to install and received an error when trying to install from downloaded package: conda install ../conda/bokeh-0.12.7dev3-py_0-noarch.tar.bz2 -p /Users/hsparra/milestone1_py36An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at: https://github.com/conda/conda/issues Current conda install: platform : osx-64 conda version : 4.3.21 conda is private : False conda-env version : 4.3.21 conda-build version : 2.1.15 python version : 3.5.2.final.0 requests version : 2.12.4 root environment : /Users/hsparra/anaconda (writable) default environment : /Users/hsparra/milestone1_py36 envs directories : /Users/hsparra/anaconda/envs /Users/hsparra/.conda/envs package cache : /Users/hsparra/anaconda/pkgs /Users/hsparra/.conda/pkgs channel URLs : https://conda.anaconda.org/bokeh/c/dev/osx-64 https://conda.anaconda.org/bokeh/c/dev/noarch https://conda.anaconda.org/anaconda/osx-64 https://conda.anaconda.org/anaconda/noarch https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch https://conda.anaconda.org/conda-forge/osx-64 https://conda.anaconda.org/conda-forge/noarch https://conda.anaconda.org/anaconda-fusion/osx-64 https://conda.anaconda.org/anaconda-fusion/noarch https://conda.anaconda.org/anaconda-mosaic/osx-64 https://conda.anaconda.org/anaconda-mosaic/noarch https://conda.anaconda.org/quanyuan/osx-64 https://conda.anaconda.org/quanyuan/noarch config file : /Users/hsparra/.condarc netrc file : None offline mode : False user-agent : conda/4.3.21 requests/2.12.4 CPython/3.5.2 Darwin/16.6.0 OSX/10.12.5 UID:GID : 503:20 $ /Users/hsparra/milestone1_py36/bin/conda install ../conda/bokeh-0.12.7dev3-py_0-noarch.tar.bz2 -p /Users/hsparra/milestone1_py36` Traceback (most recent call last): File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/exceptions.py", line 632, in conda_exception_handler return_value = func(*args, **kwargs) File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/cli/main.py", line 137, in _main exit_code = args.func(args, p) File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/cli/install.py", line 199, in install explicit(args_packages, prefix, verbose=not context.quiet) File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/misc.py", line 110, in explicit execute_actions(actions, index, verbose=verbose) File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/plan.py", line 830, in execute_actions execute_instructions(plan, index, verbose) File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/instructions.py", line 247, in execute_instructions cmd(state, arg) File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/instructions.py", line 108, in UNLINKLINKTRANSACTION_CMD txn.execute() File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/core/link.py", line 263, in execute self.verify() File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/core/link.py", line 242, in verify self.prepare() File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/core/link.py", line 173, in prepare concatv(unlink_actions, link_actions)) File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/core/link.py", line 172, in <genexpr> self.all_actions = tuple(per_pkg_actions for per_pkg_actions in File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/core/link.py", line 169, in <genexpr> for pkg_info, lt in zip(self.packages_info_to_link, link_types) File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/core/link.py", line 406, in make_link_actions file_link_actions = LinkPathAction.create_file_link_actions(*required_quad) File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/core/path_actions.py", line 181, in create_file_link_actions return tuple(make_file_link_action(spi) for spi in package_info.paths_data.paths) File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/core/path_actions.py", line 181, in <genexpr> return tuple(make_file_link_action(spi) for spi in package_info.paths_data.paths) File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/core/path_actions.py", line 161, in make_file_link_action target_short_path = get_python_noarch_target_path(source_path_info.path, sp_dir) File "/Users/hsparra/anaconda/lib/python3.5/site-packages/conda/common/path.py", line 238, in get_python_noarch_target_path return source_short_path.replace('site-packages', sp_dir, 1) TypeError: Can't convert 'NoneType' object to str implicitly` Installing from anaconda.org using the bokeh dev channel, `conda install -c bokeh/label/dev bokeh` works, but specifying the package directly does not work `conda install https://anaconda.org/bokeh/bokeh/0.12.7dev3/download/noarch/bokeh-0.12.7dev3-py_0.tar.bz2`
Any chance this bugs gets resolved? Not sure if this is a bug, because when a tarball is installed directly like that, conda doesn't invoke the solver and installs the package directly, so in the scenario when the conda environment or prefix in which the package is going to be installed doesn't already have some version of python installed, conda doesn't know which `lib/python??/site-packages` directory to pick. To get around this problem, install python into that environment/prefix first, and then install the noarch_python tarball.
2018-11-24T09:26:11
conda/conda
7,989
conda__conda-7989
[ "7976", "7952" ]
523fcfddf8f149b3ee2e1788027df1060b02987e
diff --git a/conda/core/initialize.py b/conda/core/initialize.py --- a/conda/core/initialize.py +++ b/conda/core/initialize.py @@ -1118,7 +1118,9 @@ def _read_windows_registry(target_path): # pragma: no cover try: value_tuple = winreg.QueryValueEx(key, value_name) - value_value = value_tuple[0].strip() + value_value = value_tuple[0] + if isinstance(value_value, str): + value_value = value_value.strip() value_type = value_tuple[1] return value_value, value_type except Exception: @@ -1187,13 +1189,13 @@ def init_long_path(target_path): # win10, build 14352 was the first preview release that supported this if int(win_ver) >= 10 and int(win_rev) >= 14352: prev_value, value_type = _read_windows_registry(target_path) - if prev_value != "1": + if str(prev_value) != "1": if context.verbosity: print('\n') print(target_path) - print(make_diff(prev_value, "1")) + print(make_diff(str(prev_value), '1')) if not context.dry_run: - _write_windows_registry(target_path, "1", winreg.REG_DWORD) + _write_windows_registry(target_path, 1, winreg.REG_DWORD) return Result.MODIFIED else: return Result.NO_CHANGE
diff --git a/tests/common/pkg_formats/test_python.py b/tests/common/pkg_formats/test_python.py --- a/tests/common/pkg_formats/test_python.py +++ b/tests/common/pkg_formats/test_python.py @@ -398,7 +398,7 @@ def test_metadata(): # Python Distributions # ----------------------------------------------------------------------------- [email protected](datetime.now() < datetime(2018, 12, 1), [email protected](datetime.now() < datetime(2019, 1, 1), reason="This test needs to be refactored for the case of raising a hard " "error when the anchor_file doesn't exist.", strict=True) diff --git a/tests/core/test_initialize.py b/tests/core/test_initialize.py --- a/tests/core/test_initialize.py +++ b/tests/core/test_initialize.py @@ -826,7 +826,7 @@ def _read_windows_registry_mock(target_path): @pytest.mark.skipif(not on_win, reason="win-only test") def test_init_enable_long_path(self): - self.dummy_value = "0" + self.dummy_value = 0 def _read_windows_registry_mock(target_path): return self.dummy_value, "REG_DWORD" @@ -844,9 +844,9 @@ def _write_windows_registry_mock(target_path, value, dtype): try: target_path = r'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem\\LongPathsEnabled' - assert initialize._read_windows_registry(target_path)[0] == "0" + assert initialize._read_windows_registry(target_path)[0] == 0 initialize.init_long_path(target_path) - assert initialize._read_windows_registry(target_path)[0] == "1" + assert initialize._read_windows_registry(target_path)[0] == 1 finally: initialize._read_windows_registry = orig_read_windows_registry initialize._write_windows_registry = orig_write_windows_registry diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -584,8 +584,13 @@ def test_strict_channel_priority(self): assert not stderr json_obj = json_loads(stdout) channel_groups = groupby("channel",json_obj["actions"]["LINK"]) + channel_groups = sorted(list(channel_groups)) # conda-forge should be the only channel in the solution on unix - assert list(channel_groups) == ["conda-forge"] + # fiona->gdal->libgdal->m2w64-xz brings in pkgs/msys2 on win + if on_win: + assert channel_groups == ["conda-forge", "pkgs/msys2"] + else: + assert channel_groups == ["conda-forge"] def test_strict_resolve_get_reduced_index(self): channels = (Channel("defaults"),) @@ -925,8 +930,7 @@ def test_install_freeze_installed_flag(self): run_command(Commands.INSTALL, prefix, "conda-forge::tensorflow>=1.4 --dry-run --freeze-installed") - @pytest.mark.xfail(on_win and datetime.now() < datetime(2018, 11, 1), - reason="need to talk with @msarahan about blas patches on Windows", + @pytest.mark.xfail(on_win, reason="nomkl not present on windows", strict=True) def test_install_features(self): with make_temp_env("python=2 numpy=1.13 nomkl") as prefix: diff --git a/tests/test_resolve.py b/tests/test_resolve.py --- a/tests/test_resolve.py +++ b/tests/test_resolve.py @@ -1025,7 +1025,7 @@ def test_no_features(): ] [email protected](datetime.now() < datetime(2018, 12, 1), reason="bogus test; talk with @mcg1969") [email protected](datetime.now() < datetime(2019, 1, 1), reason="bogus test; talk with @mcg1969") def test_multiple_solution(): assert False # index2 = index.copy()
nomkl tests running on Windows fail Appears some `nomkl` feature tests are being run on Windows and [failing on CI]( https://ci.appveyor.com/project/ContinuumAnalyticsFOSS/conda/builds/20408292/job/q40u301c397wpyji?fullLog=true#L1181 ). IIUC `nomkl` does not exist on Windows. So this is as expected. Should these tests be marked as known fails, skipped, or similar? Conda Init (v4.6.0b1 ) --system cmd.exe chokes ``` # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "c:\users\wani\downloads\repos\conda\conda\exceptions.py", line 1001, in __call__ return func(*args, **kwargs) File "c:\users\wani\downloads\repos\conda\conda\cli\main.py", line 84, in _main exit_code = do_call(args, p) File "c:\users\wani\downloads\repos\conda\conda\cli\conda_argparse.py", line 81, in do_call exit_code = getattr(module, func_name)(args, parser) File "c:\users\wani\downloads\repos\conda\conda\cli\main_init.py", line 52, in execute anaconda_prompt) File "c:\users\wani\downloads\repos\conda\conda\core\initialize.py", line 106, in initialize run_plan(plan2) File "c:\users\wani\downloads\repos\conda\conda\core\initialize.py", line 552, in run_plan result = globals()[step['function']](*step.get('args', ()), **step.get('kwargs', {})) File "c:\users\wani\downloads\repos\conda\conda\core\initialize.py", line 1196, in init_long_path _write_windows_registry(target_path, "1", winreg.REG_DWORD) File "c:\users\wani\downloads\repos\conda\conda\core\initialize.py", line 1143, in _write_windows_registry winreg.SetValueEx(key, value_name, 0, value_type, value_value) ValueError: Could not convert the data to the specified type. `$ C:\ProgramData\MinicondaX\Scripts\conda-script.py init --system cmd.exe` ```
2018-11-25T17:18:44
conda/conda
7,998
conda__conda-7998
[ "7976" ]
c429cf4f2f009a4ca27a2715a5317781269a5e9b
diff --git a/conda/base/context.py b/conda/base/context.py --- a/conda/base/context.py +++ b/conda/base/context.py @@ -105,6 +105,7 @@ def ssl_verify_validation(value): class Context(Configuration): add_pip_as_python_dependency = PrimitiveParameter(True) + allow_conda_downgrades = PrimitiveParameter(False) allow_cycles = PrimitiveParameter(True) # allow cyclical dependencies, or raise allow_softlinks = PrimitiveParameter(False) auto_update_conda = PrimitiveParameter(True, aliases=('self_update',)) @@ -590,6 +591,7 @@ def list_parameters(self): 'bld_path', 'conda_build', 'croot', + 'allow_conda_downgrades', 'debug', 'default_python', 'dry_run', diff --git a/conda/history.py b/conda/history.py --- a/conda/history.py +++ b/conda/history.py @@ -233,7 +233,7 @@ def get_user_requests(self): conda_versions_from_history = tuple(x['conda_version'] for x in res if 'conda_version' in x) - if conda_versions_from_history: + if conda_versions_from_history and not context.allow_conda_downgrades: minimum_conda_version = sorted(conda_versions_from_history, key=VersionOrder)[-1] minimum_major_minor = '.'.join(take(2, minimum_conda_version.split('.'))) current_major_minor = '.'.join(take(2, CONDA_VERSION.split('.')))
diff --git a/tests/test_create.py b/tests/test_create.py --- a/tests/test_create.py +++ b/tests/test_create.py @@ -805,8 +805,7 @@ def test_only_deps_flag(self): assert package_is_installed(prefix, 'openssl') assert package_is_installed(prefix, 'itsdangerous') - @pytest.mark.xfail(on_win and datetime.now() < datetime(2018, 9, 15), - reason="need to talk with @msarahan about blas patches on Windows", + @pytest.mark.xfail(on_win, reason="nomkl not present on windows", strict=True) def test_install_features(self): with make_temp_env("python=2 numpy=1.13 nomkl") as prefix:
nomkl tests running on Windows fail Appears some `nomkl` feature tests are being run on Windows and [failing on CI]( https://ci.appveyor.com/project/ContinuumAnalyticsFOSS/conda/builds/20408292/job/q40u301c397wpyji?fullLog=true#L1181 ). IIUC `nomkl` does not exist on Windows. So this is as expected. Should these tests be marked as known fails, skipped, or similar?
2018-11-29T04:11:33
conda/conda
8,053
conda__conda-8053
[ "7665" ]
64bde065f8343276f168d2034201115dff7c5753
diff --git a/conda/gateways/disk/delete.py b/conda/gateways/disk/delete.py --- a/conda/gateways/disk/delete.py +++ b/conda/gateways/disk/delete.py @@ -214,7 +214,7 @@ def rm(fn, childpath): if onerror is None: raise else: - onerror(fn, childpath, sys.exc_info()[0]) + onerror(fn, childpath, sys.exc_info()) def visit_files(root, targets): for target in targets:
conda.gateways.disk.delete.rm and conda.gateways.disk.delete.retry disagree on arguments Using Conda 4.5.4 with Python 2.7.14 on Windows, I'm getting the following error when using `conda remove`: ``` Traceback (most recent call last): File "C:\bin\Miniconda2\lib\site-packages\conda\exceptions.py", line 819, in __call__ return func(*args, **kwargs) File "C:\bin\Miniconda2\lib\site-packages\conda\cli\main.py", line 78, in _main exit_code = do_call(args, p) File "C:\bin\Miniconda2\lib\site-packages\conda\cli\conda_argparse.py", line 77, in do_call exit_code = getattr(module, func_name)(args, parser) File "C:\bin\Miniconda2\lib\site-packages\conda\cli\main_install.py", line 12, in execute delete_trash() File "C:\bin\Miniconda2\lib\site-packages\conda\gateways\disk\delete.py", line 68, in delete_trash backoff_rmdir(path, max_tries=1) File "C:\bin\Miniconda2\lib\site-packages\conda\gateways\disk\delete.py", line 145, in backoff_rmdir _rmdir(join(root, dir)) File "C:\bin\Miniconda2\lib\site-packages\conda\gateways\disk\delete.py", line 134, in _rmdir exp_backoff_fn(rmtree, path, onerror=retry, max_tries=max_tries) File "C:\bin\Miniconda2\lib\site-packages\conda\gateways\disk\__init__.py", line 30, in exp_backoff_fn result = fn(*args, **kwargs) File "C:\bin\Miniconda2\lib\site-packages\conda\gateways\disk\delete.py", line 212, in rmtree visit_files(root, files) File "C:\bin\Miniconda2\lib\site-packages\conda\gateways\disk\delete.py", line 200, in visit_files rm(unlink, join(root, target)) File "C:\bin\Miniconda2\lib\site-packages\conda\gateways\disk\delete.py", line 196, in rm onerror(fn, childpath, sys.exc_info()[0]) File "C:\bin\Miniconda2\lib\site-packages\conda\gateways\disk\delete.py", line 126, in retry if getattr(exc_info[1], 'errno', None) == ENOENT: TypeError: 'type' object has no attribute '__getitem__' ``` Looking at the Conda source, this appears to be because `conda.gateways.disk.delete.retry` expects to receive the tuple returned by of `sys.exc_info()`, so that it can analyse the exception error message, but `conda.gateways.disk.delete.rm` passes it only the first entry in that tuple (the exception type). (There's an underlying problem that it seems the .trash directory isn't being deleted, but that should throw a more helpful error in `delete_trash`)
Yeah all this is tied into https://github.com/conda/conda/issues/6631, which I've tried [more](https://github.com/conda/conda/pull/6660) [than](https://github.com/conda/conda/pull/7077) [once](https://github.com/conda/conda/pull/7083) to wrap up. I still haven't figured out the bizarre file locking we're seeing on appveyor in those PRs. The code for Python 2 reimplementation of `rmtree` seems buggy: the call `onerror(fn, childpath, sys.exc_info()[0])` should be `onerror(fn, childpath, sys.exc_info())` here: https://github.com/conda/conda/blob/1471f043eed980d62f46944e223f0add6a9a790b/conda/gateways/disk/delete.py#L190-L198 Should be straightforward to fix. Might not fix the appveyor strangeness, but the above seems the cause for this bugreport. I'm seeing this issue on Appveyor *only* for Python 2 but not Python 3, so presumably the Appveyor locking stuff is a separate problem, and the issue here can occur independently of it. @pv Had the same bug, fix worked for me thanks.
2019-01-03T15:10:57
conda/conda
8,083
conda__conda-8083
[ "8076" ]
1bf5787d01e61eb4c418651fcfd328e5cffbd0d5
diff --git a/conda/core/solve.py b/conda/core/solve.py --- a/conda/core/solve.py +++ b/conda/core/solve.py @@ -340,6 +340,14 @@ def _find_inconsistent_packages(self, ssc): # we remove now from consideration the set of packages causing inconsistencies, # and then we add them back in following the main SAT call. _, inconsistent_precs = ssc.r.bad_installed(ssc.solution_precs, ()) + if inconsistent_precs: + # It is possible that the package metadata is incorrect, for example when + # un-patched metadata from the Miniconda or Anaconda installer is present, see: + # https://github.com/conda/conda/issues/8076 + # Update the metadata with information from the index and see if that makes the + # environment consistent. + ssc.solution_precs = tuple(ssc.index.get(k, k) for k in ssc.solution_precs) + _, inconsistent_precs = ssc.r.bad_installed(ssc.solution_precs, ()) if log.isEnabledFor(DEBUG): log.debug("inconsistent precs: %s", dashlist(inconsistent_precs) if inconsistent_precs else 'None')
unexpected python update with 4.6.0rc1 ``` [root@847ac3bf50f9 build_scripts]# conda install imagesize Collecting package metadata: done Solving environment: done ## Package Plan ## environment location: /opt/conda added / updated specs: - imagesize The following packages will be downloaded: package | build ---------------------------|----------------- imagesize-1.1.0 | py37_0 9 KB defaults python-3.7.1 | h0371630_7 36.4 MB defaults ------------------------------------------------------------ Total: 36.4 MB The following NEW packages will be INSTALLED: imagesize pkgs/main/linux-64::imagesize-1.1.0-py37_0 The following packages will be UPDATED: python 2.7.15-h9bab390_6 --> 3.7.1-h0371630_7 Proceed ([y]/n)? n ``` ``` [root@847ac3bf50f9 build_scripts]# conda info active environment : None user config file : /root/.condarc populated config files : /root/.condarc conda version : 4.6.0rc1 conda-build version : 3.17.6 python version : 2.7.15.final.0 base environment : /opt/conda (writable) channel URLs : https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /opt/conda/pkgs /root/.conda/pkgs envs directories : /opt/conda/envs /root/.conda/envs platform : linux-64 user-agent : conda/4.6.0rc1 requests/2.21.0 CPython/2.7.15 Linux/4.9.125-linuxkit centos/6.9 glibc/2.12 UID:GID : 0:0 netrc file : None offline mode : False ``` Reproducible by: * ``docker run -ti conda/c3i-linux-64 bash`` * ``conda install python=2.7`` * ``conda update -c conda-canary conda`` * ``conda install imagesize``
I think this is a special behavior of the base environment. Running the same workflow but creating and activating a Python 2.7 environment does not upgrade python when `conda install imagesize` is run. Perhaps more concerning is that python in the base environment can be downgrade without updating other installed packages: ``` [root@06d038b9f267 build_scripts]# conda list conda # packages in environment at /opt/conda: # # Name Version Build Channel anaconda-client 1.6.14 py36_0 defaults conda 4.6.0rc1 py36_0 conda-canary conda-build 3.10.4 py36_0 defaults conda-concourse-ci 0.1.0 pypi_0 pypi conda-env 2.6.0 h36134e3_1 defaults conda-verify 2.0.0 py36h98955d8_0 defaults [root@06d038b9f267 build_scripts]# conda install -c conda-canary python=2.7 Collecting package metadata: done Solving environment: done ## Package Plan ## environment location: /opt/conda added / updated specs: - python=2.7 The following packages will be downloaded: package | build ---------------------------|----------------- python-2.7.15 | h9bab390_6 12.8 MB defaults readline-7.0 | h7b6447c_5 392 KB defaults zlib-1.2.11 | h7b6447c_3 120 KB defaults ------------------------------------------------------------ Total: 13.3 MB The following packages will be UPDATED: readline 7.0-ha6073c6_4 --> 7.0-h7b6447c_5 zlib 1.2.11-ha838bed_2 --> 1.2.11-h7b6447c_3 The following packages will be DOWNGRADED: python 3.6.8-h0371630_0 --> 2.7.15-h9bab390_6 Proceed ([y]/n)? ``` ``` [root@06d038b9f267 build_scripts]# conda info active environment : None user config file : /root/.condarc populated config files : /root/.condarc conda version : 4.6.0rc1 conda-build version : 3.10.4 python version : 3.6.8.final.0 base environment : /opt/conda (writable) channel URLs : https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /opt/conda/pkgs /root/.conda/pkgs envs directories : /opt/conda/envs /root/.conda/envs platform : linux-64 user-agent : conda/4.6.0rc1 requests/2.18.4 CPython/3.6.8 Linux/4.13.0-45-generic centos/6.9 glibc/2.12 UID:GID : 0:0 netrc file : None offline mode : False ``` Reproducible by: * docker run -ti conda/c3i-linux-64 bash * conda update -c conda-canary conda * conda install -c conda-canary python=2.7 Hmmmm, @jjhelmus I run into a different issue when I try to do that with the continuum/miniconda3 docker image. ``` # conda info active environment : base active env location : /opt/conda shell level : 1 user config file : /root/.condarc populated config files : conda version : 4.6.0rc1 conda-build version : not installed python version : 3.7.2.final.0 base environment : /opt/conda (writable) channel URLs : https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /opt/conda/pkgs /root/.conda/pkgs envs directories : /opt/conda/envs /root/.conda/envs platform : linux-64 user-agent : conda/4.6.0rc1 requests/2.21.0 CPython/3.7.2 Linux/4.9.125-linuxkit debian/9 glibc/2.24 UID:GID : 0:0 netrc file : None offline mode : False ``` ``` # conda list # packages in environment at /opt/conda: # # Name Version Build Channel asn1crypto 0.24.0 py37_0 ca-certificates 2018.03.07 0 certifi 2018.11.29 py37_0 cffi 1.11.5 py37he75722e_1 chardet 3.0.4 py37_1 conda 4.6.0rc1 py37_0 conda-canary conda-env 2.6.0 1 cryptography 2.4.2 py37h1ba5d50_0 idna 2.8 py37_0 imagesize 1.1.0 py37_0 libedit 3.1.20170329 h6b74fdf_2 libffi 3.2.1 hd88cf55_4 libgcc-ng 8.2.0 hdf63c60_1 libstdcxx-ng 8.2.0 hdf63c60_1 ncurses 6.1 he6710b0_1 openssl 1.1.1a h7b6447c_0 pip 18.1 py37_0 pycosat 0.6.3 py37h14c3975_0 pycparser 2.19 py37_0 pyopenssl 18.0.0 py37_0 pysocks 1.6.8 py37_0 python 3.7.2 h0371630_0 readline 7.0 h7b6447c_5 requests 2.21.0 py37_0 ruamel_yaml 0.15.46 py37h14c3975_0 setuptools 40.6.3 py37_0 six 1.12.0 py37_0 sqlite 3.26.0 h7b6447c_0 tk 8.6.8 hbc83047_0 urllib3 1.24.1 py37_0 wheel 0.32.3 py37_0 xz 5.2.4 h14c3975_4 yaml 0.1.7 had09818_2 zlib 1.2.11 h7b6447c_3 (base) root@14700af21dc1:/# conda install python=2.7 -c conda-canary Collecting package metadata: done Solving environment: done ## Package Plan ## environment location: /opt/conda added / updated specs: - python=2.7 The following packages will be downloaded: package | build ---------------------------|----------------- certifi-2018.11.29 | py27_0 146 KB pip-18.1 | py27_0 1.8 MB python-2.7.15 | h9bab390_6 12.8 MB setuptools-40.6.3 | py27_0 627 KB wheel-0.32.3 | py27_0 34 KB ------------------------------------------------------------ Total: 15.3 MB The following packages will be DOWNGRADED: certifi 2018.11.29-py37_0 --> 2018.11.29-py27_0 pip 18.1-py37_0 --> 18.1-py27_0 python 3.7.2-h0371630_0 --> 2.7.15-h9bab390_6 setuptools 40.6.3-py37_0 --> 40.6.3-py27_0 wheel 0.32.3-py37_0 --> 0.32.3-py27_0 Proceed ([y]/n)? y Downloading and Extracting Packages python-2.7.15 | 12.8 MB | ################################################################################################################ | 100% certifi-2018.11.29 | 146 KB | ################################################################################################################ | 100% pip-18.1 | 1.8 MB | ################################################################################################################ | 100% setuptools-40.6.3 | 627 KB | ################################################################################################################ | 100% wheel-0.32.3 | 34 KB | ################################################################################################################ | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done Traceback (most recent call last): File "/opt/conda/bin/conda", line 12, in <module> from conda.cli import main ImportError: No module named conda.cli ``` Reproducible by: * docker run -it continuumio/miniconda3 bash * conda update -c conda-canary conda * conda install python=2.7 -c conda-canary It seems as if conda 4.6.0rc1 believes the environment is in an inconsistent state and therefore removes the inconsistent packages from the SAT solve: ``` [root@06d038b9f267 build_scripts]# CONDA_DEBUG=1 conda install -c conda-canary python=2.7 ... ... DEBUG conda.core.solve:_find_inconsistent_packages(345): inconsistent precs: - defaults/linux-64::git==2.19.1=pl526hacde149_0 - defaults/linux-64::cryptography==2.4.2=py36h1ba5d50_0 - defaults/linux-64::krb5==1.16.1=h173b8e3_7 ... ... DEBUG conda.resolve:get_reduced_index(324): Retrieving packages for: - binutils_impl_linux-64 - binutils_linux-64 - ca-certificates - conda-env - expat - gcc_impl_linux-64 - gcc_linux-64 - gxx_impl_linux-64 - gxx_linux-64 - libedit - libgcc-ng - libssh2 - libstdcxx-ng - ncurses - openssl - patchelf - perl - python=2.7 - sqlite - xz ... ``` > Hmmmm, @jjhelmus I run into a different issue when I try to do that with the continuum/miniconda3 docker image. Different issue but looks to be the same cause, conda thinks the environment is inconsistent: ``` DEBUG conda.core.solve:_find_inconsistent_packages(345): inconsistent precs: - conda-canary/linux-64::conda==4.6.0rc1=py37_0 - defaults/linux-64::pycparser==2.19=py37_0 ``` The environment in question ARE inconsistent when the information in conda-meta is used because the libffi package has incorrect depends information: ``` # cat /opt/conda/conda-meta/libffi-3.2.1-hd88cf55_4.json { "arch": "x86_64", "build": "hd88cf55_4", "build_number": 4, "depends": [ "libgcc-ng 7.2.0.*", "libstdcxx-ng 7.2.0.*" ], ``` The dependencies should be `libgcc-ng >= 7.2.0` and `libstdcxx >=7.2.0`. I'm not sure why conda 4.5.12 ignores this dependency.
2019-01-11T23:29:28