mamba: Could not read JSON repodata file (...) parse error line 1: subdir mismatch

Troubleshooting docs

  • My problem is not solved in the Troubleshooting docs

Search tried in issue tracker

I did this; other issues seem to be a different root cause (truncated JSON)

Latest version of Mamba

  • My problem is not solved with the latest version

Tried in Conda?

Not reproducible with Conda

Describe your issue

When creating a new environment (e.g. mamba create -n foo python~=3.10) or installing a package (e.g. mamba install matplotlib), I receive this error immediately after pulling repodata:

Could not read JSON repodata file (/home/mfisher/miniconda3/pkgs/cache/fb830941.json) parse error line 1: subdir mismatch

I found issue #947 , which seems to be a different underlying cause. In my case, the JSON file is well-formed, not truncated. I re-created the JSON file (using jq) as a multi-line file, and the error points to the last line of this object:

    "click-3.3-py27_0.tar.bz2": {
      "build_number": 0,
      "name": "click",
      "license": "BSD License",
      "requires": [],
      "machine": "x86_64",
      "platform": "linux",
      "depends": [
        "python 2.7*"
      ],
      "version": "3.3",
      "build": "py27_0",
      "md5": "d4ab83dde357193d11b5efec15236825",
      "binstar": {
        "package_id": "552da0a8e1dad1296bdcf89e",
        "channel": "main",
        "owner_id": "5506fdf05e76835ac59a826c"
      },
      "size": 84363,
      "arch": "x86_64",
      "operatingsystem": "linux",
      "target-triplet": "x86_64-any-linux",
      "subdir": "osx-64"
    },

I see the “mismatch” between the subdir value and the operatingsystem value, but I don’t know why it’s like this or how to fix it. This cache file is for the NSIDC channel in anaconda.org ("_url": "https://conda.anaconda.org/nsidc/linux-64/repodata.json"), which hasn’t had any activity in a couple of months. I haven’t changed my .condarc in months, maybe years, and I think installing packages with mamba was working earlier this week. It seems something changed about the repodata we’re receiving from anaconda.org that messes up mamba, but conda somehow handles it.

  • Removing the nsidc channel from my .condarc resolves the issue, but of course we’d like that to work with mamba!
  • Switching to conda resolves the issue.
  • Removing the cache file does not resolve the issue; it re-downloads and reproduces the error.

mamba info / micromamba info

$ mamba info

                  __    __    __    __
                 /  \  /  \  /  \  /  \
                /    \/    \/    \/    \
███████████████/  /██/  /██/  /██/  /████████████████████████
              /  / \   / \   / \   / \  \____
             /  /   \_/   \_/   \_/   \    o \__,
            / _/                       \_____/  `
            |/
        ███╗   ███╗ █████╗ ███╗   ███╗██████╗  █████╗
        ████╗ ████║██╔══██╗████╗ ████║██╔══██╗██╔══██╗
        ██╔████╔██║███████║██╔████╔██║██████╔╝███████║
        ██║╚██╔╝██║██╔══██║██║╚██╔╝██║██╔══██╗██╔══██║
        ██║ ╚═╝ ██║██║  ██║██║ ╚═╝ ██║██████╔╝██║  ██║
        ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚═════╝ ╚═╝  ╚═╝

        mamba (1.3.1) supported by @QuantStack

        GitHub:  https://github.com/mamba-org/mamba
        Twitter: https://twitter.com/QuantStack

█████████████████████████████████████████████████████████████


     active environment : None
            shell level : 0
       user config file : /home/mfisher/.condarc
 populated config files : /home/mfisher/.condarc
          conda version : 23.1.0
    conda-build version : 3.21.8
         python version : 3.9.16.final.0
       virtual packages : __archspec=1=x86_64
                          __glibc=2.31=0
                          __linux=5.18.10=0
                          __unix=0=0
       base environment : /home/mfisher/miniconda3  (writable)
      conda av data dir : /home/mfisher/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/nodefaults/linux-64
                          https://conda.anaconda.org/nodefaults/noarch
          package cache : /home/mfisher/miniconda3/pkgs
                          /home/mfisher/.conda/pkgs
       envs directories : /home/mfisher/miniconda3/envs
                          /home/mfisher/.conda/envs
               platform : linux-64
             user-agent : conda/23.1.0 requests/2.25.1 CPython/3.9.16 Linux/5.18.10-76051810-generic ubuntu/20.04.5 glibc/2.31
                UID:GID : 1002:1002
             netrc file : /home/mfisher/.netrc
           offline mode : False

Logs

Looking for: ['matplotlib']                                            
                                                                       
warning  libmamba Could not parse state file: Could not load cache state: [json.exception.type_error.302] type must be string, but is null     
warning  libmamba Could not parse state file: Could not load cache state: [json.exception.type_error.302] type must be string, but is null     
conda-forge/linux-64                                        Using cache
conda-forge/noarch                                          Using cache                                                                        
warning  libmamba Could not parse state file: Could not load cache state: [json.exception.type_error.302] type must be string, but is null     
warning  libmamba Could not parse state file: Could not load cache state: [json.exception.type_error.302] type must be string, but is null     
nodefaults/linux-64                                144.0 B @ 342.0 B/s  0.4s   
nodefaults/noarch                                  135.0 B @ 295.0 B/s  0.5s                                                                   
nsidc/noarch                                         3.6kB @   7.7kB/s  0.5s
nsidc/linux-64                                      48.6kB @  96.7kB/s  0.5s
Could not read JSON repodata file (/home/mfisher/miniconda3/pkgs/cache/fb830941.json) parse error line 1: subdir mismatch
                                                                                                                                               
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<                                                                                   
                                                                                                                                               
    Traceback (most recent call last):                                                                                                         
      File "/home/mfisher/miniconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1124, in __call__                                  
        return func(*args, **kwargs)                                                                                                           
      File "/home/mfisher/miniconda3/lib/python3.9/site-packages/mamba/mamba.py", line 936, in exception_converter                             
        raise e                                                                                                                                
      File "/home/mfisher/miniconda3/lib/python3.9/site-packages/mamba/mamba.py", line 929, in exception_converter                             
        exit_code = _wrapped_main(*args, **kwargs)                                                                                             
      File "/home/mfisher/miniconda3/lib/python3.9/site-packages/mamba/mamba.py", line 887, in _wrapped_main                                   
        result = do_call(parsed_args, p)                                                                                                       
      File "/home/mfisher/miniconda3/lib/python3.9/site-packages/mamba/mamba.py", line 750, in do_call                                         
        exit_code = install(args, parser, "install")                                                                                           
      File "/home/mfisher/miniconda3/lib/python3.9/site-packages/mamba/mamba.py", line 497, in install                                         
        index = load_channels(pool, channels, repos)                                                                                           
      File "/home/mfisher/miniconda3/lib/python3.9/site-packages/mamba/utils.py", line 178, in load_channels                                   
        repo = subdir.create_repo(pool)                                                                                                        
    RuntimeError: Could not read JSON repodata file (/home/mfisher/miniconda3/pkgs/cache/fb830941.json) parse error line 1: subdir mismatch    
                                                                                                                                               
`$ /home/mfisher/miniconda3/bin/mamba install matplotlib`                                                                                      
                                                                                                                                               
  environment variables:                                                                                                                       
                 CIO_TEST=<not set>                                                                                                            
        CONDA_DEFAULT_ENV=quarto                                                                                                               
                CONDA_EXE=/home/mfisher/miniconda3/bin/conda                                                                                   
             CONDA_PREFIX=/home/mfisher/miniconda3/envs/quarto                                                                                 
    CONDA_PROMPT_MODIFIER=(quarto)                                                                                                             
         CONDA_PYTHON_EXE=/home/mfisher/miniconda3/bin/python                                                                                  
               CONDA_ROOT=/home/mfisher/miniconda3                                                                                             
              CONDA_SHLVL=1                                                                                                                    
           CURL_CA_BUNDLE=<not set>                                                                                                            
            DEFAULTS_PATH=/usr/share/gconf/regolith.default.path                                                                               
               LD_PRELOAD=<not set>                                                                                                            
           MANDATORY_PATH=/usr/share/gconf/regolith.mandatory.path                                                                             
                     PATH=/home/mfisher/miniconda3/envs/quarto/bin:/home/mfisher/.pyenv/shims:/h                                               
                          ome/mfisher/.local/bin:/home/mfisher/bin:/home/mfisher/.local/bin:/hom                                               
                          e/mfisher/bin:/home/mfisher/.pyenv/bin:/home/mfisher/.nvm/versions/nod                                               
                          e/v13.8.0/bin:/home/mfisher/miniconda3/condabin:/home/mfisher/.local/b                                               
                          in:/home/mfisher/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin                                               
                          :/sbin:/bin:/usr/games:/usr/local/games:/snap/bin                                                                    
        QUARTO_SHARE_PATH=/home/mfisher/miniconda3/envs/quarto/share/quarto                                                                    
       REQUESTS_CA_BUNDLE=<not set>                                                                                                            
            SSL_CERT_FILE=<not set>                                                                                                            
               WINDOWPATH=2                                                                                                                    
                                                                                                                                               
     active environment : quarto                                                                                                               
    active env location : /home/mfisher/miniconda3/envs/quarto                                                                                 
            shell level : 1                                                                                                                    
       user config file : /home/mfisher/.condarc                                                                                               
 populated config files : /home/mfisher/.condarc                                                                                               
          conda version : 23.1.0                                                                                                               
    conda-build version : 3.21.8                                                                                                               
         python version : 3.9.16.final.0                                                                                                       
       virtual packages : __archspec=1=x86_64                                                                                                  
                          __glibc=2.31=0                                                                                                       
                          __linux=5.18.10=0                                                                                                    
                          __unix=0=0                                                                                                           
       base environment : /home/mfisher/miniconda3  (writable)                                                                                 
      conda av data dir : /home/mfisher/miniconda3/etc/conda                                                                                   
  conda av metadata url : None                                                                                                                 
           channel URLs : https://conda.anaconda.org/nsidc/linux-64                                                                            
                          https://conda.anaconda.org/nsidc/noarch                                                                              
                          https://conda.anaconda.org/conda-forge/linux-64                                                                      
                          https://conda.anaconda.org/conda-forge/noarch 
                          https://conda.anaconda.org/nodefaults/linux-64
                          https://conda.anaconda.org/nodefaults/noarch
          package cache : /home/mfisher/miniconda3/pkgs
                          /home/mfisher/.conda/pkgs
       envs directories : /home/mfisher/miniconda3/envs
                          /home/mfisher/.conda/envs
               platform : linux-64
             user-agent : conda/23.1.0 requests/2.25.1 CPython/3.9.16 Linux/5.18.10-76051810-generic ubuntu/20.04.5 glibc/2.31
                UID:GID : 1002:1002 
             netrc file : /home/mfisher/.netrc
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

environment.yml

n/a

~/.condarc

auto_activate_base: false
channels:
  - conda-forge
  - nsidc
  - nodefaults
report_errors: false

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 35 (6 by maintainers)

Most upvoted comments

A fix for the docker images (that are used by conda-forge to build packages) is here: https://github.com/conda-forge/docker-images/pull/236 (it drops the defaults channel from the channel list).

Funnily enough, the recipe’s CI is also failing with the same error image

When I deleted

  "info": {
    "subdir": "linux-64"
  },

from the top of the file as you pointed out, the problem stops and my packages install. (thanks @mattgodbolt for checking there!)

yes, thanks @johnhany97 – we’re chatting with Anaconda folks and maybe they can help us with removing / reverting the addition of the noarch packages to the repodata. Because updating libsolv might also be tricky in this state 😕

The error popped up for me and also points to a similar spacey-model-... entry that doesn’t have any obvious mismatch with subdir.

Hi, Just to comment on this issue. For me it was related to the disk quota that exceeded, so it was unable to write files on the home directory (where mamba was installed) So check your disk quota before Best regards

That definitely is a better approach. I will try to get the PR I put up to succeed CI just in case we do need to push it out to avoid the current global outage.

thanks for working on this @johnhany97

@jpedrick it’s late in germany, but we could patch the libsolv feedstock and things should start working again (except for micromamba).

Looks like this is causing a major outage in the conda-forge ecosystem now. That explains why this ticket got so busy today 😆 I think we can rest easy that this will be solved switfly.

The head of my file:

 head /home/mgodbolt/.cache/ozy/internal_install/conda/4.12.0/pkgs/cache/47929eba.json
{"_cache_control":"public, max-age=30","_etag":"W/\"ddd0a69b544f008c98d33b795cb37083\"","_mod":"Thu, 08 Jun 2023 18:59:29 GMT","_url":"https://repo.anaconda.com/pkgs/main/linux-64/repodata.json",
  "info": {
    "subdir": "linux-64"
  },
  "packages": {
    "_anaconda_depends-2018.12-py27_0.tar.bz2": {
      "build": "py27_0",
      "build_number": 0,
      "depends": [
        "alabaster",