rosscdh / mkdocs-markdownextradata-plugin

A MkDocs plugin that injects the mkdocs.yml extra variables into the markdown template
MIT License
84 stars 17 forks source link

Cannot install plugin #1

Closed fralau closed 6 years ago

fralau commented 6 years ago

Following the procedure, I called the following command:

$ pip install mkdocs-markdownextra
Collecting mkdocs-markdownextra
  Could not find a version that satisfies the requirement mkdocs-markdownextra (from versions: )
No matching distribution found for mkdocs-markdownextra

I tried to download the code in a local directory and run python setup.py install. It worked, but then I get the following error:

[I 180623 15:40:18 watcher:92] Running task: <function builder at 0x10ce90b90> (delay: None)
INFO    -  Building documentation...
ERROR   -  Config value: 'plugins'. Error: The "markdownextra" plugin is not installed
[E 180623 15:40:18 ioloop:638] Exception in callback <bound method type.poll_tasks of <class 'livereload.handlers.LiveReloadHandler'>>
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/site-packages/tornado/ioloop.py", line 1026, in _run
        return self.callback()
      File "/usr/local/lib/python2.7/site-packages/livereload/handlers.py", line 66, in poll_tasks
        filepath, delay = cls.watcher.examine()
      File "/usr/local/lib/python2.7/site-packages/livereload/watcher.py", line 93, in examine
        func()
      File "/usr/local/lib/python2.7/site-packages/mkdocs/commands/serve.py", line 104, in builder
        theme_dir=theme_dir
      File "/usr/local/lib/python2.7/site-packages/mkdocs/config/base.py", line 194, in load_config
        "Aborted with {0} Configuration Errors!".format(len(errors))
    ConfigurationError: Aborted with 1 Configuration Errors! 

What should I do?

rosscdh commented 6 years ago

Hi there,

  1. the plugin is not yet available on pypi
  2. Ill take a look at the setup.py

Questions:

  1. you are aware this plugin (may) not work with python 2.7 (I recommend 3)
  2. try installing it with pip install -e git+https://github.com/rosscdh/mkdocs-markdownextradata-plugin#egg=markdownextradata
rosscdh commented 6 years ago

I've just published the 0.0.3 version to pypi

https://pypi.org/project/mkdocs-markdownextradata-plugin/

fralau commented 6 years ago

Hi,

Thanks a lot for the prompt reaction! On my system the default is python2, so that added a little complication.

I did install mkdocs with pip3; I assumed it run under python3, but the safety setup.py file was still failing. In my case (on MacOs), pip3 was mixed-up and it was running… python2:

$ cat /usr/local/bin/pip3
#!/usr/local/opt/python@2/bin/python2.7
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3'
__requires__ = 'pip==10.0.1'
import re
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(
        load_entry_point('pip==10.0.1', 'console_scripts', 'pip3')()
    )

Finally, I solved this by:

  1. brew upgrade python3
  2. pip uninstall mkdocs and mkdocs-markdownextra (and pip3 uninstall)
  3. Reinstalling them with pip3 install.

Basically, upgrading python3 and a clean reinstall of mkdocs.

But now I have another problem: the server does not recognize markdownextra plugin:

$ mkdocs serve
INFO    -  Building documentation...
ERROR   -  Config value: 'plugins'. Error: The "markdownextra" plugin is not installed

Aborted with 1 Configuration Errors!

Maybe a little piece still missing?

Note

This is to evidence that mkdocs run under python3:

$ which mkdocs
/usr/local/bin/mkdocs
$ head /usr/local/bin/mkdocs
#!/usr/local/opt/python/bin/python3.6

# -*- coding: utf-8 -*-
import re
import sys

from mkdocs.__main__ import cli

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
rosscdh commented 6 years ago

Hi there,

  1. you def need to be using https://virtualenv.pypa.io/en/stable/ (which lets you create a python3 only environment)
  2. looks like the docs were out of date the plugin should be configured like so:
plugins:
    - search
    - markdownextradata

note how its markdownextradata and not markdownextra

fralau commented 6 years ago

Thanks my mistake was the wrong name of the setup: not markdownextra but markdownextradata.

I recognize that a virtualenv might be the best solution, but fortunately it wasn't necessary in this case.

I now works, thanks!

rosscdh commented 6 years ago

Thats great news!

Thanks for raising the problem! forced me to fix a few issues :) all the best and i wish you luck with your project