2020-07-16 23:31:39 +03:00
|
|
|
|
---
|
|
|
|
|
template: overrides/main.html
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Troubleshooting
|
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
## Theme not recognized
|
|
|
|
|
|
|
|
|
|
Operating systems:
|
|
|
|
|
:fontawesome-brands-apple:
|
|
|
|
|
:fontawesome-brands-windows:
|
|
|
|
|
:fontawesome-brands-linux:
|
|
|
|
|
|
|
|
|
|
!!! error "Error: Unrecognized theme"
|
|
|
|
|
|
|
|
|
|
``` sh
|
|
|
|
|
mkdocs serve
|
|
|
|
|
# => INFO - Building documentation...
|
|
|
|
|
# => ERROR - Config value: 'theme'. Error: Unrecognised theme 'material'.
|
|
|
|
|
# => ...
|
|
|
|
|
# => ConfigurationError: Aborted with 1 Configuration Errors!
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
If you run into this error, the most common reason is that you installed MkDocs
|
|
|
|
|
through some package manager (e.g. `brew` or `apt-get`) and Material for MkDocs
|
|
|
|
|
through `pip`, so both packages end up in different locations. MkDocs only
|
|
|
|
|
checks its install location for themes.
|
|
|
|
|
|
2020-07-16 23:31:39 +03:00
|
|
|
|
## Inadequate permissions
|
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
Operating systems: :fontawesome-brands-apple:
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
|
|
|
|
!!! error "Error: Permission denied"
|
|
|
|
|
|
|
|
|
|
``` sh
|
|
|
|
|
pip install mkdocs-material
|
2020-08-01 21:40:48 +03:00
|
|
|
|
# => Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '...'
|
2020-07-16 23:31:39 +03:00
|
|
|
|
# => Consider using the --user option or check the permissions.
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
When you're running the pre-installed version of Python on macOS, `pip` tries
|
|
|
|
|
to install packages in a folder for which your user might not have the adequate
|
2020-07-23 15:37:20 +03:00
|
|
|
|
permissions. There are three possible solutions for this, the recommended one
|
|
|
|
|
of which is to use virtual environments:
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
=== "Virtual environments"
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
If you're installing Material for MkDocs with `pip`, the easiest way to make
|
|
|
|
|
sure that you end up with the correct versions and without any
|
|
|
|
|
incompatibility problems between packages it to use a [virtual
|
|
|
|
|
environment][1]. First, ensure that you have a Python version of 3 or
|
|
|
|
|
higher installed:
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
```
|
|
|
|
|
python --version
|
|
|
|
|
```
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
If you're good to go, create and activate a virtual environment with:
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
```
|
|
|
|
|
python -m venv venv
|
|
|
|
|
source ./venv/bin/activate
|
|
|
|
|
```
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
Note that the second `venv` is the name of the folder where to create the
|
|
|
|
|
virtual environment – you may choose it as you like. Your terminal should
|
|
|
|
|
now print `(venv)` before the prompt and the `python` executable should be
|
|
|
|
|
located inside the folder you just created.
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
Next, [install Material for MkDocs][2] with `pip`, which will download and
|
|
|
|
|
install all packages in the `venv` folder you just created, including MkDocs
|
|
|
|
|
and its dependencies:
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
```
|
|
|
|
|
pip install mkdocs-material
|
|
|
|
|
```
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
Verify that MkDocs and Material for MkDocs were both installed correctly:
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
```
|
|
|
|
|
mkdocs --version
|
|
|
|
|
mkdocs serve --help
|
|
|
|
|
```
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
MkDocs should list `material` as an option under the `--theme` flag. When
|
|
|
|
|
you're finished working with MkDocs, you can exit the virtual environment
|
|
|
|
|
with:
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
```
|
|
|
|
|
deactivate
|
|
|
|
|
```
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
=== "User space"
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
Provide the `--user` flag to the install command and `pip` will install the
|
|
|
|
|
package in a user-site location. While this is not a global installation,
|
|
|
|
|
it's still not isolated and may lead to problems when you use different
|
|
|
|
|
versions of Material for MkDocs in other projects:
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
```
|
|
|
|
|
pip install --user mkdocs-material
|
|
|
|
|
```
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
=== "Upgrade Python"
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
Upgrade your Python installation by installing Python with [Homebrew][3].
|
|
|
|
|
This should eliminate a lot of problems you will run into with `pip`. Yet,
|
|
|
|
|
it's still not an isolated installation which may also lead to the same
|
|
|
|
|
problems as installing in user space:
|
2020-07-16 23:31:39 +03:00
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
```
|
|
|
|
|
brew upgrade python
|
2020-07-16 23:31:39 +03:00
|
|
|
|
```
|
|
|
|
|
|
2020-07-23 15:37:20 +03:00
|
|
|
|
[1]: https://docs.python.org/3/tutorial/venv.html
|
|
|
|
|
[2]: getting-started.md#with-pip
|
|
|
|
|
[3]: https://brew.sh/
|