[Tex/LaTex] mathtools package – Package database exclusively locked

miktexmiktex2.9

I’m having an issue concerning the mathtools package.
I’m using MikTex 2.9 and TexMaker.

Whenever I attempt to run the following example code

\documentclass{article}

\usepackage{mathtools}
    
\begin{document}
This is a test.  
\end{document}

I get the error message

Another MiKTeX program has exclusevily locked the package database.

This is the info I obtained from the consoles error log via the 'Copy Info' Button.

GENERAL MIKTEX INFORMATION ReportDate: 2021-04-12 06:04:57

CurrentVersion: 21.3 SetupDate: 2018-04-26 20:38:00

SetupVersion: 2.9

Configuration: Regular

GitInfo: ab8ebca / 2021-03-19 10:22:46

OS: Windows 10 Home, 64-bit, build 19042

SharedSetup: no

LinkTargetDirectory: C:\Program Files\MikTeX 2.9\miktex\bin\x64

PathOkay: yes

SystemAdmin: yes

RootPrivileges: no

AdminMode: no

Root0: C:\Users\Admin\AppData\Roaming\MiKTeX\2.9

Root1: C:\Users\Admin\AppData\Local\MiKTeX\2.9

Root2: C:\Program Files\MikTeX 2.9

Root3: C:\ProgramData\MiKTeX\2.9

UserInstall: C:\Program Files\MikTeX 2.9

UserConfig: C:\Users\Admin\AppData\Roaming\MiKTeX\2.9

UserData: C:\Users\Admin\AppData\Local\MiKTeX\2.9

CommonInstall: C:\Program Files\MikTeX 2.9

CommonConfig: C:\ProgramData\MiKTeX\2.9

CommonData: C:\ProgramData\MiKTeX\2.9

Invokers: …/explorer/A43/texmaker

ERROR DETAILS

Program: pdflatex

Source: Libraries\MiKTeX\PackageManager\PackageManagerImpl.cpp:119

Error: The package database is locked and cannot be accessed.

Description: Another MiKTeX program has exclusevily locked the package
database.

Remedy: Close running MiKTeX programs and try again.

Moreover I got the notification that the file calc.sty could not be found and that the file in question is part of the latex-tools package.

In addition, the console of TexMaker produces the following error message.

C:\Program Files\MikTeX 2.9\tex/latex/mathtools\mathtools.sty

! LaTeX Error: File `calc.sty' not found.Type X to quit or to
proceed,or enter new name. (Default extension: sty)Enter file name:!
Emergency stop. \RequirePackage

I checked both of the paths

C:\Program Files\MikTeX 2.9\tex/latex/mathtools\

C:\Program Files\MikTeX 2.9\tex/latex/latex-tools\

And indeed the folder mathtools does not contain the file calc.sty while the folder latex-tools does.

I attempted to uninstall both packages via MikTex console, then refreshed the file name database as well as the font map files and updated the package database. Then I reinstalled the packages and repeated the refreshment and updating process but to no avail. I have made sure that MikTex Console ran in Administrator mode during the procedure.

It seems that my MikTex installation is somehow unable to detect the two paths and the file calc.sty. Unfortunately my Google searches have only yielded results regarding missing mathtools.sty files which is a distinct issue. So I am not sure what else can be done.

\Edit: I was to able to resolve the issue by completely uninstalling and then reinstalling MikTex 2.9 .

Best Answer

First, remove Miktex completely, including registry information. Then reinstall Miktex, remembering not to install it in folders that require administrator access, such as Program Files.