Skip to content

Setting up mkdocs-material with latest github version

Find the tag of the latest version on github.com/squidfunk/mkdocs-material, e.g., 7.1.5, and make a shallow clone (arbitrarily under a directory ~/github in this example).

% git clone --branch 7.1.5 --depth 1 https://github.com/squidfunk/mkdocs-material.git

Enter that directory

% cd ~/github/mkdocs-material

Setup local environment directory (abitrarily named .venv here).

% python3 -m venv .venv

Activate it

% source .venv/bin/activate

and the prompt will change

(.venv)%

Use pip to install the necessary python modules

(.venv)% pip3 install -r requirements.txt

You'll probably get some error messages but do it again and it will tell everything is OK.

Build it

(.venv)% python3 setup.py build

Decide what root to install under. Arbitrarily, this example uses /mnt/common.

Add to your ~/.bashrc the following -

export PYTHONPATH=/mnt/common/lib/python3.8/site-packages:$PYTHONPATH
export PATH=/mnt/common/bin:$PATH

(Note: Modifiying .bashrc should not be necessary if the root is /)

Then of course

(.venv)% source ~/.bashrc

Then execute install.

(.venv)% python3 setup.py  install --prefix /mnt/common

If an error occurs repeat the same command and it should work the second time.

Close the terminal to exit the (.venv) python environment.

The directory ~/github/mkdocs-material is no loger required.

rm -Rf ~/github/mkdocs-material

Suppose you have a mkdocs-material site in the directory ~/github/mysite. Then

% cd ~/github/mysite
% mkdocs serve

should work correctly.