Search code examples
pythoncondacartopymamba

Mamba error while creating a new virtual environment: could not open lock file


When I run the following command:

mamba create --name eco-tech-h2gam-venv regionmask cartopy

I get this error:

Looking for: ['regionmask', 'cartopy']

error    libmamba Could not open lockfile 'C:\ProgramData\anaconda3\pkgs\cache\cache.lock'

Any idea how to overcome it?

Additional Details

  • OS: Windows 11
  • Anaconda 3 base distribution

Solution

  • Lock files can be cleared using the mamba clean --locks command. See in the documentation (abridged):

    $ mamba clean -h
    # usage: mamba clean [-h] [-a] [-i] [-p] [-t] [-f] [-c [TEMPFILES ...]] [-l] [--json] [-v]
    #                    [-q] [-d] [-y] [--locks]
    # 
    # Removal Targets:
    #   --locks               Remove lock files.