Getting Started
Setting Up the Morphik server
Installation Options
Direct Installation
Prerequisites
Cloning the Repository
To get started with Morphik, we need to first setup the server. This involves cloning the repository, installing the dependencies, and the running the server. You are just a few steps away from accurate, agentic RAG over your multi-modal data!
First, let’s clone the repository from GitHub.
After cloning the repository, you will notice a morphik-core
folder in your current directory.
If you see an error like ls: morphik-core: No such file or directory
, it means that the repository is not cloned properly. Please try again.
Once you have cloned the repository, navigate into the morphik-core
folder.
Next, you need to set up a virtual environment called .venv
.
Setting Up the Environment
Installing Python Dependencies
While it is not required, we highly recommend using a virtual environment to ensure dependencies from other projects do not conflict with Morphik. You may use managers like uv
or poetry
, but for this guide, we will use the built-in venv
module.
Morphik currently supports Python 3.12 as the latest version. We recommend using Python 3.12 for optimal compatibility.
Now, you need to activate the virtual environment. The activation command differs based on your operating system.
If you encounter execution policy errors in PowerShell, you may need to run:
After activation, your command prompt should be prefixed with (.venv)
, indicating that the virtual environment is active. Once your virtual environment is activated, you can install the required dependencies.
Python Dependencies for Document Processing
You may also need additional Python packages or NLTK resources for processing various document types:
Setting up the Server Parameters
At this point, you may want to customize the server - such as use a different model, enable or disable certain features, etc. - you can do so by editing the morphik.toml
file.
Morphik now uses a registered models approach, which allows you to define hundreds of different models in one place and reference them throughout your configuration. This makes it easy to mix and match models based on your needs (e.g., smaller models for simpler tasks). You can find more details about configuration here.
Morphik uses environment variables to manage secrets and API keys. In order to ensure that any pre-set keys are available to the server, copy the .env.example
file to .env
:
In case you’re using external models like OpenAI or Anthropic Claude, you’ll need to edit the .env
file with the necessary API keys. Finally, you can run the setup script to install dependencies and setup the database and vector store.
Launching the Server
You are now ready to launch the Morphik server! Just run the following command to start the server.
You should see the following output:
This means that the server is running on http://localhost:8000
. You can now interact with the server using the API or the Python SDK.
Direct Installation
Prerequisites
Cloning the Repository
To get started with Morphik, we need to first setup the server. This involves cloning the repository, installing the dependencies, and the running the server. You are just a few steps away from accurate, agentic RAG over your multi-modal data!
First, let’s clone the repository from GitHub.
After cloning the repository, you will notice a morphik-core
folder in your current directory.
If you see an error like ls: morphik-core: No such file or directory
, it means that the repository is not cloned properly. Please try again.
Once you have cloned the repository, navigate into the morphik-core
folder.
Next, you need to set up a virtual environment called .venv
.
Setting Up the Environment
Installing Python Dependencies
While it is not required, we highly recommend using a virtual environment to ensure dependencies from other projects do not conflict with Morphik. You may use managers like uv
or poetry
, but for this guide, we will use the built-in venv
module.
Morphik currently supports Python 3.12 as the latest version. We recommend using Python 3.12 for optimal compatibility.
Now, you need to activate the virtual environment. The activation command differs based on your operating system.
If you encounter execution policy errors in PowerShell, you may need to run:
After activation, your command prompt should be prefixed with (.venv)
, indicating that the virtual environment is active. Once your virtual environment is activated, you can install the required dependencies.
Python Dependencies for Document Processing
You may also need additional Python packages or NLTK resources for processing various document types:
Setting up the Server Parameters
At this point, you may want to customize the server - such as use a different model, enable or disable certain features, etc. - you can do so by editing the morphik.toml
file.
Morphik now uses a registered models approach, which allows you to define hundreds of different models in one place and reference them throughout your configuration. This makes it easy to mix and match models based on your needs (e.g., smaller models for simpler tasks). You can find more details about configuration here.
Morphik uses environment variables to manage secrets and API keys. In order to ensure that any pre-set keys are available to the server, copy the .env.example
file to .env
:
In case you’re using external models like OpenAI or Anthropic Claude, you’ll need to edit the .env
file with the necessary API keys. Finally, you can run the setup script to install dependencies and setup the database and vector store.
Launching the Server
You are now ready to launch the Morphik server! Just run the following command to start the server.
You should see the following output:
This means that the server is running on http://localhost:8000
. You can now interact with the server using the API or the Python SDK.
Using Docker
Morphik provides a streamlined Docker-based setup that includes all necessary components: the core API, PostgreSQL with pgvector, and Ollama for AI models.
Prerequisites
- Docker and Docker Compose installed on your system
- At least 10GB of free disk space (for models and data)
- 8GB+ RAM recommended
Quick Start
- Clone the repository and navigate to the project directory:
- Before first-time setup, check the configuration:
Ensure your morphik.toml
file has the correct settings for running in Docker:
(If using local models with Ollama) Also ensure the Ollama configuration matches your deployment setup:
- If running both Morphik and Ollama as Docker containers:
- If running Morphik in Docker but Ollama locally:
And update the active model references to use the appropriate Docker configurations:
If you want to use Ollama for AI capabilities (recommended for local development):
This will build docker with an Ollama container.
Or if you’re using OpenAI, Anthropic, or other models (configure the API key in .env):
This will build docker without the Ollama container.
These commands will:
- Build all required containers
- Download necessary AI models (nomic-embed-text and llama3.2 if using Ollama)
- Initialize the PostgreSQL database with pgvector
- Start all services
The initial setup may take 5-10 minutes depending on your internet speed, as it needs to download the AI models.
Note: When using Ollama, ensure your system has sufficient memory. The llama3.2 model requires at least 4GB of available RAM. If you encounter memory issues, you can increase Docker’s memory allocation in Docker Desktop settings (Resources > Advanced > Memory), modify the
morphik.toml
file to use a smaller model, or switch to using OpenAI API.
- To completely reset (will delete all data and models):
Configuration
The default configuration works out of the box and includes:
- PostgreSQL with pgvector for document storage
- Ollama for AI models (embeddings and completions)
- Local file storage
- Basic authentication
You can customize your setup by creating a .env
file:
Accessing Services
- Morphik API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Health Check: http://localhost:8000/health
Troubleshooting
-
Service Won’t Start
-
Database Issues
- Check PostgreSQL is healthy:
docker compose ps
- Verify database connection:
docker compose exec postgres psql -U morphik -d morphik
- Check PostgreSQL is healthy:
-
Model Download Issues
- Check Ollama logs:
docker compose logs ollama
- Ensure enough disk space for models
- Try restarting Ollama:
docker compose restart ollama
- Verify that your Redis and Ollama configuration in
morphik.toml
matches your deployment:- For Redis in Docker, use
host = "redis"
(not “localhost”) - If running Ollama in Docker, use
http://ollama:11434
endpoint - If running Ollama locally but Morphik in Docker, use
http://host.docker.internal:11434
- For Redis in Docker, use
- Check Ollama logs:
-
Ollama Memory Issues
-
If you see errors like “model requires more system memory than is available” in the logs:
- Increase Docker memory allocation in Docker Desktop:
- Open Docker Desktop application
- Click on Settings (gear icon)
- Go to “Resources” section
- Increase memory allocation to at least 6GB (8GB recommended)
- Click “Apply & Restart”
- Alternatively, modify
morphik.toml
to use a smaller model - Or switch to OpenAI API by uncommenting the OpenAI sections in
morphik.toml
- Increase Docker memory allocation in Docker Desktop:
-
For knowledge graph creation specifically, you can switch from Ollama to OpenAI:
-
-
Performance Issues
- Monitor resources:
docker stats
- Ensure sufficient RAM (8GB+ recommended)
- Check disk space:
df -h
- Monitor resources:
Community Support
We have an open community with lots of discussion where you can get help, report bugs, and share your experiences with Morphik. If you need assistance or want to contribute, please join our community!
Join our Discord
Get help, report bugs, and connect with other Morphik users.
Next Steps
Now that you have the server running, you can explore the different ways to interact with the server.
Was this page helpful?