How to Fix libmecab2 Not Installed on Ubuntu

You can usually resolve the “libmecab2 is not installed” error by repairing APT if needed, refreshing its package lists, and installing the libmecab2 runtime package from the repositories configured for your Ubuntu release. If APT cannot find that package, the problem is usually an unavailable repository, an unsupported release, a package-version mismatch, or an interrupted package transaction, not a missing manual download. Start by identifying whether the message comes from APT’s dependency resolver or from the application loader.

Use this table to choose the right starting point.

Symptom Likely Cause Safe Next Action
APT says libmecab2 is not installed or reports unmet dependencies The package is absent or the package database is incomplete Refresh APT, repair pending configuration if necessary, then install libmecab2
E: Unable to locate package libmecab2 APT has no package candidate from enabled sources Check the Ubuntu release and configured repositories; do not download a random .deb
An application reports libmecab.so.2 cannot be opened The runtime library is missing, the wrong architecture is installed, or the app uses an isolated runtime Install and verify the package, then check the application’s supported build and architecture
A downloaded MySQL archive fails before it starts Archive installs do not automatically pull Ubuntu dependencies Install the archive prerequisites before extracting and starting MySQL
An old installer requests libmecab2v5 The installer uses an older dependency name On Ubuntu 16.04, install libmecab2 and verify the target release’s APT dependency output

What the libmecab2 Error Means

libmecab2 is the Ubuntu package that provides the MeCab runtime library used by some applications. MeCab is a text-analysis and morphological-analysis tool, commonly used with Japanese-language processing software and some database or search components.

The wording of the error matters:

  • An APT error about libmecab2 usually means another package declares it as a dependency and APT cannot satisfy that dependency.
  • A startup error mentioning libmecab.so.2 means the application loader cannot find a compatible shared library at runtime.
  • A package installer may mention an older package name even when the repository package you need has a newer or differently formatted name.

Installing unrelated packages such as dictionaries, development headers, or a full MeCab command-line setup is not the first fix. Start with the runtime package requested by the failing application.

How to Fix the libmecab2 Error on Ubuntu

Refreshing package lists, repairing interrupted transactions when needed, and installing libmecab2 resolves the missing runtime library error when APT provides a candidate.

Step 1: Check What APT Can Install

  1. Stop the failing installer or application and copy the complete error message. Note the application name, the Ubuntu release, and whether the error mentions libmecab2, libmecab2v5, or libmecab.so.2.
  2. Check your system’s primary package architecture.
dpkg --print-architecture

Most desktop and server installations return amd64. If you are installing a vendor archive, container image, or 32-bit application, its architecture must match an available compatible library package.

  1. Simulate the installation to identify APT’s package candidate and any proposed conflicts or removals: This does not modify the system, but it shows whether APT has a package candidate and whether it expects conflicts or removals.
apt-get -s install libmecab2

If the simulation offers to install libmecab2 without removing important packages, continue with the next steps. If the simulation says there is no installation candidate or cannot locate the package, correct the configured repositories and verify the Ubuntu release before continuing.

I reproduce one problem at a time in a clean container or virtual environment when possible, because it removes machine-specific package and repository noise.

Step 2: Refresh the Package Lists

APT can have outdated or incomplete package indexes, especially after a release upgrade, a repository change, or an interrupted setup. Refresh them first.

sudo apt update

Confirm that the update completes without repository errors before continuing.

If the update finishes normally, continue to the repair step only if APT previously reported interrupted packages or dependency problems. If you see repository errors such as a missing Release file, a 404 response, or authentication failures, do not bypass them with an unofficial package download. Correct the repository configuration for your installed Ubuntu release, or upgrade from an unsupported release.

Step 3: Repair an Interrupted Package Transaction

Run these commands only if APT reports unmet dependencies, an interrupted dpkg process, or packages that are not fully configured.

sudo dpkg --configure -a

Resolve unfinished dependencies with APT:

sudo apt --fix-broken install

Review APT’s proposed changes carefully. Stop if it proposes removing a database server, desktop environment, language runtime, or another package you need. A dependency repair should not be treated as safe merely because it completes automatically.

When both commands finish without errors, refresh the package lists once more if repository metadata changed during the repair.

sudo apt update

Step 4: Install the Runtime Package

Install libmecab2 through APT after it shows a compatible package candidate:

sudo apt install libmecab2

APT should display the package it will install and any dependencies it needs.

Avoid these shortcuts:

  • Do not force-install a .deb built for another Ubuntu release.
  • Do not create a manual symlink named libmecab.so.2.
  • Do not use --force, dpkg --ignore-depends, or dependency-breaking options to get past the installer.
  • Do not add an unrelated third-party repository merely because it contains a similarly named package.

Those approaches can leave the package database inconsistent or load an incompatible library into the application.

Step 5: Verify the Package and Retry the Application

Confirm that Ubuntu considers the package installed.

dpkg-query -W -f='${db:Status-Status} ${Version}\n' libmecab2

A successful result begins with installed. You can also check that the system library cache includes the MeCab library.

ldconfig -p | grep 'libmecab.so.2'

Finally, rerun the original application installer or start the application that failed. If libmecab2 is installed but the same shared-library error remains, the application may be built for a different architecture, may need a vendor-supported older runtime, or may be running in a container or bundled environment that cannot see the host library.

Handle Older Package Names and Missing APT Candidates

Older Ubuntu 16.04 dependencies requesting libmecab2v5 use libmecab2, while an empty Candidate field requires checking release, repositories, and application support.

When an Older Installer Requests libmecab2v5

Some older packages request libmecab2v5 rather than the repository package name you expect. For an older dependency on Ubuntu 16.04, the package to select is libmecab2.

The relevant name range in this case is libmecab2v5, which may appear in the old dependency request, and libmecab2, which is the package name to install on that Ubuntu release. Confirm the exact dependency for the target release rather than assuming an old package name remains valid everywhere.

For an application available from APT, inspect its dependency metadata by replacing your-package-name with the actual package name.

apt-cache depends your-package-name

For a local installer file, inspect its embedded metadata before trying to install it.

dpkg-deb -I ./installer.deb

If the package was built for a much older Ubuntu release, the reliable solution is usually to obtain a build supported by your current Ubuntu release. Replacing individual library packages to satisfy an obsolete installer can create conflicts with the rest of the system.

When APT Cannot Locate libmecab2

E: Unable to locate package libmecab2 means APT has no matching package in its current indexes. First check whether APT has a candidate.

apt-cache policy libmecab2

If the Candidate field is empty after a successful package-list update, check these conditions:

  • Your Ubuntu release is supported and its configured repositories still exist.
  • The standard Ubuntu repository components for that release are enabled.
  • You are not using repository entries for a different Ubuntu codename.
  • A corporate proxy, internal mirror, or container base image is not providing incomplete package indexes.
  • The application you are installing actually supports your Ubuntu release and architecture.

When a candidate becomes available, verify its compatibility before installing. The package may require a different C library, architecture, or ABI version.

Fix libmecab2 Errors During a MySQL Archive Installation

Install dependencies according to the failing application’s installation path; a MySQL archive prerequisite is not a universal repair for every application that mentions MeCab.

A downloaded MySQL archive does not use APT to install its runtime dependencies automatically. For the MySQL archive setup sequence, install the prerequisites before downloading and extracting the archive:

sudo apt install libncurses5 libaio1 libmecab2

Run that command before you download, unpack, initialize, or start that MySQL archive. After it completes, continue with the archive’s normal installation procedure and start the server using the vendor’s documented command sequence.

This prerequisite command is appropriate for that archive-based MySQL setup because it installs three required runtime libraries together.

Keep KMail and Database Dependencies Separate

KMail can bring database-related dependencies through Akonadi, but installing KMail is not a general fix for a missing MeCab library. On Kubuntu 22.04, when your goal is specifically to install KMail, the package command is:

apt install kmail

Run it as root or from an administrator shell, and inspect the package transaction before accepting it. Back up important databases before changing database-related packages, and treat a mail-client installation as a separate task from repairing a MySQL archive or another application.

After the transaction completes, launch KMail from the desktop application menu and confirm that it opens normally. If your original libmecab2 error came from a different program, return to that program and test it separately.

Confirm the Fix and Avoid Future Package Problems

A successful repair has two parts: APT reports libmecab2 as installed, and the original application starts or installs without the missing-library error. Package installation alone does not prove that a vendor archive, container, or bundled application can use the host library.

If the problem persists, collect the Ubuntu release information and package candidate details before changing anything else.

cat /etc/os-release
apt-cache policy libmecab2

Use that information to choose a build of the application intended for your Ubuntu release. For applications in Docker or another container system, install the library in the image that runs the application rather than only on the host machine.

To prevent recurrences:

  • Keep repository entries matched to the installed Ubuntu release.
  • Complete package upgrades rather than interrupting them.
  • Prefer repository packages when available.
  • Use the vendor’s supported archive instructions when installing software outside APT.
  • Use APT’s simulation mode to preview dependency changes affecting servers, databases, or language runtimes.

Frequently Asked Questions

Why is Ubuntu not installing libmecab2?

Ubuntu usually cannot install libmecab2 because APT has stale indexes, a broken package transaction, no enabled repository containing the package, or a request for an application build that does not match the Ubuntu release. Run the package-list refresh first, then check whether apt-cache policy libmecab2 shows a candidate. If no candidate exists, fix the repository or use an application build supported by that release.

How do I fix the “E: Unable to locate package” error in Ubuntu?

Refresh APT’s indexes first.

sudo apt update

Then check whether APT can see the package.

apt-cache policy libmecab2

If there is still no candidate, the enabled sources do not provide the package for that Ubuntu release. Correct the release repositories or use a compatible application package instead of installing a random downloaded .deb.

Is libmecab2v5 the same as libmecab2?

No. libmecab2v5 and libmecab2 are related dependency names, but they are not interchangeable across all Ubuntu releases. When an older installer requests libmecab2v5 on Ubuntu 16.04, install libmecab2; confirm the exact package through the target release’s APT dependency output. For a newer Ubuntu release, use the package name and application build that its repositories support.

Do I need to install MeCab dictionaries too?

Not for the initial missing-runtime-library repair. libmecab2 addresses the runtime library dependency; an application may separately require a dictionary package or its own language-data configuration after it starts. Install additional data only when the application’s own error message or documentation identifies that requirement.

Should I download libmecab2 manually from another Ubuntu release?

No. A manually downloaded package may depend on incompatible versions of system libraries or conflict with packages already installed. Use APT for the installed Ubuntu release whenever possible, verify that libmecab2 reports as installed, and then retry the original application with a release-compatible build.