Registry / data / tika
library3.1.0pypypi✓ verified 87d ago

tika-python is a client for the Apache Tika server, a powerful toolkit for document parsing and metadata extraction from over a thousand different file types. It provides a simple API to interact with a running Tika server, allowing Python applications to leverage Tika's capabilities. The current version is 3.1.0. Releases tend to follow major Apache Tika server releases, with occasional bugfix updates.

pip install tika
INSTALL
IMPORT
SIG · TIKA
T
tika
datapythonv3.1.0
Install
2.3s avg
Import
867ms
Disk
24MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.941s · 22.1MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.3s · import 0.794s · 23MB
24MB installed
● package 24MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parser
from tika import parser
config
from tika import config

This example demonstrates how to parse a local file using the `tika-python` client. It requires an Apache Tika server to be running and accessible. The client attempts to start the server automatically, but explicit management is often required for production use.

import os from tika import parser, config # IMPORTANT: This library requires a running Apache Tika server (Java application). # tika-python attempts to start a Tika server automatically if one isn't found, # but this often requires Java to be correctly installed and JAVA_HOME set. # For robust usage, it's often recommended to start the Tika server manually # (e.g., 'java -jar /path/to/tika-server.jar') before running your Python code, # or to configure 'tika.config.getTikaClient().startServer()' explicitly. # Ensure the Tika server is accessible (default port is 9998). # Create a dummy file for parsing dummy_file_path = "dummy_document.txt" with open(dummy_file_path, "w") as f: f.write("This is a test document for Apache Tika.") f.write("\nIt contains some sample text.") try: # Parse the dummy file parsed = parser.from_file(dummy_file_path) if parsed and parsed.get("content"): print("Extracted content:") print(parsed["content"].strip()) print("\nExtracted metadata (sample):") print(f"Content-Type: {parsed['metadata'].get('Content-Type')}") print(f"Content-Length: {parsed['metadata'].get('Content-Length')}") else: print("Failed to extract content or metadata. Check Tika server logs.") except Exception as e: print(f"An error occurred during parsing: {e}") print("This often indicates the Tika server is not running or not accessible.") print("Please ensure you have Java installed and the Tika server is running.") finally: if os.path.exists(dummy_file_path): os.remove(dummy_file_path)
Debug
Known issues
breakingThe `tika-python` library is a client to the Apache Tika server (a Java application) and *requires* the server to be running. It will attempt to start a server automatically if not found, but this often fails if Java is not installed or JAVA_HOME is not correctly configured.
fix
Ensure Java is installed and `JAVA_HOME` environment variable is set. For production, consider starting the Tika server manually (e.g., `java -jar tika-server.jar`) and configuring `tika-python` to connect to it, rather than relying on auto-start.
affects: All versions
gotchaPerformance issues or timeouts can occur when parsing very large files or processing many files synchronously, as Tika operations are blocking HTTP calls. The Tika server itself also has memory and CPU requirements.
fix
For large-scale processing, implement asynchronous parsing, use a task queue (e.g., Celery), or configure the Tika server with sufficient resources and appropriate timeouts.
affects: All versions
breakingThe behavior of passing `headers` arguments to `parser.from_file` and `parser.from_buffer` was fixed in version 3.1.0. If you were relying on previous (potentially incorrect) behavior, your parsing results or header handling might change.
fix
Review code that passes custom headers to `from_file` or `from_buffer` and test thoroughly after upgrading to 3.1.0 to ensure the intended behavior is preserved.
affects: >=3.1.0
gotchaCompatibility issues can arise between `tika-python` client versions and the Apache Tika server version it connects to, especially across major server releases (e.g., Tika server 1.x vs 2.x/3.x).
fix
Ideally, match your `tika-python` client version with the major version of the Tika server you are connecting to. Always test thoroughly when upgrading either the client or the server.
affects: All versions
Errors
Common errors & fixes
tika.exceptions.TikaClientError: Failed to connect to Tika server.
The Apache Tika server is not running, is inaccessible at the specified URL/port, or a firewall is blocking the connection.
fix
Ensure Java (version 8+) is installed, start the Tika server (manually or by ensuring 'tika-server.jar' is locatable), and verify that `TikaClient.TikaClient(url='...')` points to the correct server address and port.
Failed to start Tika server. Please ensure that you have Java installed and that the 'tika-server.jar' is in your PATH or specified via 'TikaClient.TikaClient(jar_path=...)'
The `tika-python` client attempted to automatically start the Tika server but failed because Java is not found, or the `tika-server.jar` file cannot be located.
fix
Install Java Development Kit (JDK) 8 or higher and ensure `JAVA_HOME` is set or `java` is in your system's PATH. Alternatively, download `tika-server.jar` and specify its path explicitly: `from tika import config; config.TikaClient(jar_path='/path/to/tika-server.jar')`.
ModuleNotFoundError: No module named 'tika'
The `tika` Python package has not been installed in the current Python environment.
fix
Install the library using pip: `pip install tika`
ImportError: cannot import name 'parse' from 'tika'
The `parse` function is a submodule of `tika.parser`, not directly available under the `tika` top-level package.
fix
Import `parse` from the `tika.parser` submodule: `from tika.parser import parse`
Upgrade
Version history
3.1.0latest on PyPI · released Mar 26, 2025
Audit
Dependencies
requestsrequiredUsed for HTTP communication with the Apache Tika server.
requests-toolbeltrequiredUsed for multipart/form-data encoding when sending files to the Tika server.
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
tika — pip install tika · libregistry