Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation was successful, but MKDOCS server spits out the error "plugin is not installed" #82

Open
surfingjoe opened this issue Aug 30, 2023 · 11 comments

Comments

@surfingjoe
Copy link

On my MAC, I have both Python version 2.7 and Python version 3.11.5. I tried installing using the default command:
pip install mkdocs-awesome-pages-plugin
That failed, of course, because my Python version 2.7 support has been deprecated.
So I used the following command to successfully install the awsome-pages plugin:
python3 -m pip install mkdocs-awesome-pages-plugin
However, MKDOCS SERVE gives me the following error Error: The "awesome-pages" plugin is not installed

I even ran a reinstall of mkdocs-awesome-pages-plugin and the terminal came back with a list of requirements that are "already satisfied", confirming that the plugin is installed.

Need some help here, as I do not normally involve myself in coding, so I'm at a loss as to what to do next!

@lukasgeiter
Copy link
Owner

My first guess is that the plugin is installed in a different location than mkdocs itself. Run the following command to print all packages that are installed alongside the plugin:

python3 -m pip freeze

@surfingjoe
Copy link
Author

This is the list:
bracex==2.3.post1
click==8.1.7
ghp-import==2.1.0
Jinja2==3.1.2
Markdown==3.4.4
MarkupSafe==2.1.3
mergedeep==1.3.4
mkdocs==1.5.2
mkdocs-awesome-pages-plugin==2.9.2
natsort==8.4.0
packaging==23.1
pathspec==0.11.2
platformdirs==3.10.0
python-dateutil==2.8.2
PyYAML==6.0.1
pyyaml_env_tag==0.1
six==1.16.0
watchdog==3.0.0
wcmatch==8.4.1

@kamilkrzyskow
Copy link
Contributor

I recommend using a Virtual Environment to have a better control of the packages.

But anyways looking at the pip freeze it seems that both MkDocs and the plugin are installed in the same pip environment.

Try running python3 -m mkdocs instead of just mkdocs or make sure that the MkDocs in python 2 is uninstalled.

@surfingjoe
Copy link
Author

I ran the following command:
python2 pip uninstall mkdocs and successfully removed mkdocs from version 2

Still, though, running mkdocs serve works as long as I have the awesome-pages plugin commented out.

Sooooo, I tried your other suggestion to run python3 -m mkdocs serve and received the following errors:

Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mkdocs/main.py", line 361, in
cli()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mkdocs/main.py", line 270, in serve_command
serve.serve(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mkdocs/commands/serve.py", line 59, in serve
config = get_config()
^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mkdocs/commands/serve.py", line 47, in get_config
config = load_config(
^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mkdocs/config/base.py", line 378, in load_config
errors, warnings = cfg.validate()
^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mkdocs/config/base.py", line 230, in validate
run_failed, run_warnings = self._validate()
^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mkdocs/config/base.py", line 188, in _validate
self[key] = config_option.validate(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mkdocs/config/config_options.py", line 182, in validate
return self.run_validation(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mkdocs/config/config_options.py", line 1064, in run_validation
self.load_plugin_with_namespace(name, cfg)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/mkdocs/config/config_options.py", line 1095, in load_plugin_with_namespace
current_theme = self._config[self.theme_key]['name']
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
TypeError: string indices must be integers, not 'str'

@surfingjoe
Copy link
Author

kamilkrzyskow, what kind of virtual environment do you recommend when you say virtual environment? Perhaps Docker with a mapped volume for the documentation?

@kamilkrzyskow
Copy link
Contributor

kamilkrzyskow commented Aug 30, 2023

@surfingjoe I mean the most simple, python3 -m venv venv (using the venv module to create a venv directory) then activating it.
I guess on Mac it's source venv/bin/activate but you'd better double check that.

I don't use Docker or any Conda environment overlay.

After the activation your terminal should show (venv) and then every pip install command will install packages into that virtual environment.

@surfingjoe
Copy link
Author

kamilkrzyskow, I will give that a shot. I'm for learning something new every day and that sounds very handy!

@lukasgeiter
Copy link
Owner

Thanks @kamilkrzyskow for helping out here, virtual environments are definitely the way to go 👍

@surfingjoe Please also post the contents of your mkdocs.yml. The latest error you've posted looks like mkdocs/mkdocs#3351 which happens when the theme is invalid (e.g. not installed).

@surfingjoe
Copy link
Author

surfingjoe commented Aug 31, 2023

It took me a while to get the chance to go back to this today. Good News
I originally still had a problem with Python 2.7 installed when running the virtual environment, "error 2.7 deprecated."
So, I completely removed Python using the following article. Hint: I removed both Python 2.7 and Python 3.11 and all links to them.

I then installed only Python3.
Then, I used PIP3 to install virtualenv, MKDOCS, Windmill theme, and awesome-pages-plugin.
Then I ran the instructions to launch Venv found in this article.

kamilkrzyskow Thank You so much, I learned something valuable from using the virtual environment. Makes a cleaner use of MKDOCS by far!!

@kamilkrzyskow
Copy link
Contributor

Wait, when reading this in order you installed virtualenv, the theme, MkDocs and the plugin and only after that activated the virtual environment?

If so that's not the right order, you activate the virtual environment and then install the packages so that they're isolated in that environment.
Otherwise you installed everything globally.

If you like your virtualenv then you can stick with it, but I will reiterate that I meant the default already built-in method.

https://devdocs.io/python~3.11/library/venv

@surfingjoe
Copy link
Author

kamilkrzyskow - Sorry, I must've mis-phrased something. I activated virtualenv before installing MKDOCS, Windmill theme, and awesome-pages-plugin.

I will check the method mentioned by your link above.

Thank You!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants