Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mamba search --json #668

Closed
hakasapl opened this issue Jan 27, 2021 · 1 comment
Closed

mamba search --json #668

hakasapl opened this issue Jan 27, 2021 · 1 comment
Labels
status::need-triage New feature proposal that have not been reviewed.

Comments

@hakasapl
Copy link

I'm experiencing an issue where the command mamba search --json fails. The conda equivalent conda search --json succeeds. I will attach the output of the mamba command below:

(jupyter-2-1) root@node19:~# mamba search --json
{
  "command": "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/bin/mamba search --json",
  "conda_info": {
    "GID": 0,
    "UID": 0,
    "active_prefix": "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1",
    "active_prefix_name": "base",
    "channels": [
      "https://repo.anaconda.com/pkgs/main/linux-64",
      "https://repo.anaconda.com/pkgs/main/noarch",
      "https://repo.anaconda.com/pkgs/r/linux-64",
      "https://repo.anaconda.com/pkgs/r/noarch"
    ],
    "conda_build_version": "not installed",
    "conda_env_version": "4.9.2",
    "conda_location": "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda",
    "conda_prefix": "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1",
    "conda_private": false,
    "conda_shlvl": 1,
    "conda_version": "4.9.2",
    "config_files": [],
    "default_prefix": "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1",
    "env_vars": {
      "CIO_TEST": "<not set>",
      "CONDA_DEFAULT_ENV": "jupyter-2-1",
      "CONDA_EXE": "/modules/apps/miniconda/4.8.3/bin/conda",
      "CONDA_PREFIX": "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1",
      "CONDA_PROMPT_MODIFIER": "(jupyter-2-1) ",
      "CONDA_PYTHON_EXE": "/modules/apps/miniconda/4.8.3/bin/python",
      "CONDA_ROOT": "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1",
      "CONDA_SHLVL": "1",
      "CURL_CA_BUNDLE": "<not set>",
      "FPATH": "/usr/lmod/lmod/init/ksh_funcs",
      "MANPATH": "/usr/lmod/lmod/share/man:",
      "MODULEPATH": "/modules/modulefiles",
      "PATH": "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/bin:/modules/apps/miniconda/4.8.3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
      "PYTHONROOT": "/modules/apps/miniconda/4.8.3",
      "REQUESTS_CA_BUNDLE": "<not set>",
      "SSL_CERT_FILE": "<not set>",
      "__LMOD_REF_COUNT_MODULEPATH": "/modules/modulefiles:1",
      "__LMOD_SET_FPATH": "1"
    },
    "envs": [],
    "envs_dirs": [
      "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/envs",
      "/root/.conda/envs"
    ],
    "netrc_file": null,
    "offline": false,
    "pkgs_dirs": [
      "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/pkgs",
      "/root/.conda/pkgs"
    ],
    "platform": "linux-64",
    "python_version": "3.9.1.final.0",
    "rc_path": "/root/.condarc",
    "requests_version": "2.25.1",
    "root_prefix": "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1",
    "root_writable": true,
    "site_dirs": [],
    "sys.executable": "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/bin/python",
    "sys.prefix": "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1",
    "sys.version": "3.9.1 | packaged by conda-forge | (default, Jan 10 2021, 02:55:42) \n[GCC 9.3.0]",
    "sys_rc_path": "/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/.condarc",
    "user_agent": "conda/4.9.2 requests/2.25.1 CPython/3.9.1 Linux/5.4.0-64-generic ubuntu/20.04.1 glibc/2.31",
    "user_rc_path": "/root/.condarc",
    "virtual_pkgs": [
      [
        "__glibc",
        "2.31",
        "0"
      ],
      [
        "__unix",
        "0",
        "0"
      ],
      [
        "__archspec",
        "1",
        "x86_64"
      ]
    ]
  },
  "error": "ImportError(\"cannot import name 'id' from partially initialized module 'conda._vendor.distro' (most likely due to a circular import) (/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/_vendor/distro.py)\")",
  "exception_name": "ImportError",
  "exception_type": "<class 'ImportError'>",
  "traceback": "Traceback (most recent call last):\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/gateways/connection/session.py\", line 60, in __call__\n    return cls._thread_local.session\nAttributeError: '_thread._local' object has no attribute 'session'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/exceptions.py\", line 1079, in __call__\n    return func(*args, **kwargs)\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/mamba/mamba.py\", line 882, in exception_converter\n    raise e\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/mamba/mamba.py\", line 876, in exception_converter\n    exit_code = _wrapped_main(*args, **kwargs)\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/mamba/mamba.py\", line 835, in _wrapped_main\n    result = do_call(args, p)\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/mamba/mamba.py\", line 714, in do_call\n    exit_code = getattr(module, func_name)(args, parser)\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/cli/main_search.py\", line 73, in execute\n    matches = sorted(SubdirData.query_all(spec, channel_urls, subdirs),\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/core/subdir_data.py\", line 120, in query_all\n    result = tuple(concat(executor.map(subdir_query, channel_urls)))\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/concurrent/futures/_base.py\", line 600, in result_iterator\n    yield fs.pop().result()\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/concurrent/futures/_base.py\", line 433, in result\n    return self.__get_result()\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/concurrent/futures/_base.py\", line 389, in __get_result\n    raise self._exception\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/concurrent/futures/thread.py\", line 52, in run\n    result = self.fn(*self.args, **self.kwargs)\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/core/subdir_data.py\", line 112, in <lambda>\n    subdir_query = lambda url: tuple(SubdirData(Channel(url), repodata_fn=repodata_fn).query(\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/core/subdir_data.py\", line 125, in query\n    self.load()\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/core/subdir_data.py\", line 189, in load\n    _internal_state = self._load()\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/core/subdir_data.py\", line 259, in _load\n    raw_repodata_str = fetch_repodata_remote_request(\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/core/subdir_data.py\", line 485, in fetch_repodata_remote_request\n    session = CondaSession()\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/gateways/connection/session.py\", line 62, in __call__\n    session = cls._thread_local.session = super(CondaSessionType, cls).__call__()\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/gateways/connection/session.py\", line 97, in __init__\n    self.headers['User-Agent'] = context.user_agent\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/_vendor/auxlib/decorators.py\", line 268, in new_fget\n    cache[inner_attname] = func(self)\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/base/context.py\", line 744, in user_agent\n    builder.append(\"%s/%s\" % self.os_distribution_name_version)\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/_vendor/auxlib/decorators.py\", line 268, in new_fget\n    cache[inner_attname] = func(self)\n  File \"/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/base/context.py\", line 786, in os_distribution_name_version\n    from .._vendor.distro import id, version\nImportError: cannot import name 'id' from partially initialized module 'conda._vendor.distro' (most likely due to a circular import) (/modules/apps/miniconda/4.8.3/envs/jupyter-2-1/lib/python3.9/site-packages/conda/_vendor/distro.py)\n"
}

The strange thing is that this issue is intermittent. The first time it will fail, the second time it will succeed.

I'm using miniconda on Ubuntu 20.04. Please let me know if I can provide more info.

@adriendelsalle adriendelsalle added the status::need-triage New feature proposal that have not been reviewed. label Jun 4, 2021
@wolfv
Copy link
Member

wolfv commented Jun 17, 2021

works for me. it's weird because mamba search just forwards all arguments for this command to conda.

Also a json search without arguments is a little bit pointless since it might be better to read the repodata files directly (found in $ROOT_PREFIX/pkgs/cache/*.json).

@wolfv wolfv closed this as completed Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status::need-triage New feature proposal that have not been reviewed.
Projects
None yet
Development

No branches or pull requests

3 participants