Neoteroi / mkdocs-plugins

Plugins for MkDocs.
MIT License
116 stars 9 forks source link

Error while using github workflow #42

Closed joseale2310 closed 11 months ago

joseale2310 commented 11 months ago

Hi! I am getting the following error while using a github workflow to deploy my webpage to Github Pages using mkdocs gh-pages

This is the error that I am getting:

ERROR   -  Config value 'markdown_extensions': Failed to load extension 'neoteroi.cards'.
ModuleNotFoundError: No module named 'neoteroi.cards'

I do have the mkdocs.yml set up properly, and all was working fine before! This is my markdown_extensions:

markdown_extensions:
  - abbr # abbreviations   
  - admonition  
  - attr_list # Add HTML/CSS to Markdown elements  
  - def_list # Definition lists  
  - footnotes  
  - md_in_html  
  - toc: # Table of contents  
      permalink: true # Adds anchor link, can customise symbol with emoji  

  - tables  

  # Python extensions - can see descriptions  
  # at https://facelessuser.github.io/pymdown-extensions/  

  - pymdownx.arithmatex: # LaTeX  
      generic: true  
  - pymdownx.betterem: # improves emphasis (bold/italic) handling  
      smart_enable: all   
  - pymdownx.critic # useful for marking .md file without changes to html  
  - pymdownx.caret # improved functionality for caret symbol  
  - pymdownx.details # collapsable elements that hide content  
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
      options:
        custom_icons:
          - overrides/.icons
  - pymdownx.highlight: # code highlighting  
      anchor_linenums: true  
  - pymdownx.inlinehilite # inline code highlight  
  - pymdownx.keys # to make entering and styling keyboard key presses easier  
  - pymdownx.mark # highlight/mark text  
  - pymdownx.smartsymbols # special characters (e.g. arrows, tm, fractions)  
  - pymdownx.superfences # arbitrary nesting of code and content blocks inside each other
  - pymdownx.tabbed: # add tabs to .md file
      alternate_style: true
  - pymdownx.tasklist: # checkbox task list  
      custom_checkbox: true
  - pymdownx.tilde # delete and subscript
  - neoteroi.cards

And this is my workflow:

name: render page
on:
  push:
    branches:
      - webpage 
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: 3.x
      - run: |
          pip install mkdocs-material mkdocs-bibtex neoteroi-mkdocs mkdocs-video mkdocs-minify-plugin mkdocs-jupyter mkdocs-git-revision-date-localized-plugin mkdocs-table-reader-plugin
          mkdocs gh-deploy --force

The python version that is using turns out to be 3.11.4, which is the same that I have locally and it works with no issues when I run mkdocs gh-deploy or mkdocs serve.

Here are more details about the error:

Successfully installed GitPython-3.1.32 MarkupSafe-2.1.2 PyYAML-6.0.1 anyio-3.7.1 asttokens-2.2.1 attrs-23.1.0 babel-2.12.1 backcall-0.2.0 beautifulsoup4-4.12.2 bleach-6.0.0 certifi-2023.7.22 charset-normalizer-3.2.0 click-8.1.6 colorama-0.4.6 comm-0.1.3 commonmark-0.9.1 csscompressor-0.9.5 debugpy-1.6.7 decorator-5.1.1 defusedxml-0.7.1 essentials-1.1.5 essentials-openapi-1.0.8 executing-1.2.0 fastjsonschema-2.18.0 ghp-import-2.1.0 gitdb-4.0.10 h11-0.14.0 htmlmin2-0.1.13 httpcore-0.17.3 httpx-0.24.1 idna-3.4 ipykernel-6.25.0 ipython-8.14.0 jedi-0.18.2 jinja2-3.1.2 jsmin-3.0.1 jsonschema-4.18.4 jsonschema-specifications-2023.7.1 jupyter-client-8.3.0 jupyter-core-5.3.1 jupyterlab-pygments-0.2.2 jupytext-1.14.7 latexcodec-2.0.1 lxml-4.9.3 markdown-3.4.4 markdown-it-py-3.0.0 matplotlib-inline-0.1.6 mdit-py-plugins-0.4.0 mdurl-0.1.2 mergedeep-1.3.4 mistune-3.0.1 mkdocs-1.5.1 mkdocs-bibtex-2.11.0 mkdocs-git-revision-date-localized-plugin-1.2.0 mkdocs-jupyter-0.24.2 mkdocs-material-9.1.21 mkdocs-material-extensions-1.1.1 mkdocs-minify-plugin-0.7.0 mkdocs-table-reader-plugin-2.0.1 mkdocs-video-1.5.0 nbclient-0.8.0 nbconvert-7.7.3 nbformat-5.9.1 neoteroi-mkdocs-0.0.5 nest-asyncio-1.5.7 numpy-1.25.1 packaging-23.1 pandas-2.0.3 pandocfilters-1.5.0 parso-0.8.3 pathspec-0.11.1 pexpect-4.8.0 pickleshare-0.7.5 platformdirs-3.9.1 prompt-toolkit-3.0.39 psutil-5.9.5 ptyprocess-0.7.0 pure-eval-0.2.2 pybtex-0.24.0 pygments-2.15.1 pymdown-extensions-10.1 pypandoc-1.11 python-dateutil-2.8.2 pytz-2023.3 pyyaml-env-tag-0.1 pyzmq-25.1.0 referencing-0.30.0 regex-2023.6.3 requests-2.31.0 rich-12.6.0 rpds-py-0.9.2 six-1.16.0 smmap-5.0.0 sniffio-1.3.0 soupsieve-2.4.1 stack-data-0.6.2 tabulate-0.9.0 tinycss2-1.2.1 toml-0.10.2 tornado-6.3.2 traitlets-5.9.0 tzdata-2023.3 urllib3-2.0.4 validators-0.20.0 watchdog-3.0.0 wcwidth-0.2.6 webencodings-0.5.1
INFO    -  DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
given by the platformdirs library.  To remove this warning and
see the appropriate new directories, set the environment variable
`JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
The use of platformdirs will be the default in `jupyter_core` v6
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jupyter_core/utils/__init__.py", line 89, in deprecation
    warnings.warn(message, DeprecationWarning, stacklevel=stacklevel + 1)
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jupyter_client/connect.py", line 20, in 
    from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write

ERROR   -  Config value 'markdown_extensions': Failed to load extension 'neoteroi.cards'.
ModuleNotFoundError: No module named 'neoteroi.cards'

Aborted with 1 configuration errors!
Error: Process completed with exit code 1.

Thanks!

RobertoPrevato commented 11 months ago

Hi @joseale2310 I wonder why your logs say "neoteroi-mkdocs-0.0.5" is being installed, which is an old version. Since you don´t specify the version in your pip install command, it should install the latest version, that is 1.0.3. I guess pypi is automatically downgrading the dependency for some cross-dependency with other packages, I try to replicate the error.

RobertoPrevato commented 11 months ago

It seems the problem is caused by:

mkdocs-material 9.1.21 requires mkdocs>=1.5.0, but you have mkdocs 1.4.3 which is incompatible.

To fix, I need to either unpin the dependency for mkdocs or increase its number.

RobertoPrevato commented 11 months ago

@joseale2310 I verified the issue is fixed now. I unpinned two dependencies (httpx and mkdocs), this can of course can cause issues in the future, if breaking changes are introduced in those packages - but in this particular case I preferred to unpin dependencies in my library. Arguably, you should pin your dependencies to not always get the last stable release of each package.

Today that would be:

anyio==3.7.1
asttokens==2.2.1
attrs==23.1.0
Babel==2.12.1
backcall==0.2.0
beautifulsoup4==4.12.2
bleach==6.0.0
certifi==2023.7.22
charset-normalizer==3.2.0
click==8.1.6
colorama==0.4.6
comm==0.1.3
csscompressor==0.9.5
debugpy==1.6.7
decorator==5.1.1
defusedxml==0.7.1
essentials==1.1.5
essentials-openapi==1.0.8
executing==1.2.0
fastjsonschema==2.18.0
ghp-import==2.1.0
gitdb==4.0.10
GitPython==3.1.32
h11==0.14.0
htmlmin2==0.1.13
httpcore==0.17.3
httpx==0.24.1
idna==3.4
ipykernel==6.25.0
ipython==8.14.0
jedi==0.18.2
Jinja2==3.1.2
jsmin==3.0.1
jsonschema==4.18.4
jsonschema-specifications==2023.7.1
jupyter_client==8.3.0
jupyter_core==5.3.1
jupyterlab-pygments==0.2.2
jupytext==1.14.7
latexcodec==2.0.1
lxml==4.9.3
Markdown==3.4.4
markdown-it-py==3.0.0
MarkupSafe==2.1.3
matplotlib-inline==0.1.6
mdit-py-plugins==0.4.0
mdurl==0.1.2
mergedeep==1.3.4
mistune==3.0.1
mkdocs==1.5.1
mkdocs-bibtex==2.11.0
mkdocs-git-revision-date-localized-plugin==1.2.0
mkdocs-jupyter==0.24.2
mkdocs-material==9.1.21
mkdocs-material-extensions==1.1.1
mkdocs-minify-plugin==0.7.0
mkdocs-table-reader-plugin==2.0.1
mkdocs-video==1.5.0
nbclient==0.8.0
nbconvert==7.7.3
nbformat==5.9.1
neoteroi-mkdocs==1.0.4
nest-asyncio==1.5.7
numpy==1.25.1
packaging==23.1
pandas==2.0.3
pandocfilters==1.5.0
parso==0.8.3
pathspec==0.11.1
pexpect==4.8.0
pickleshare==0.7.5
platformdirs==3.9.1
prompt-toolkit==3.0.39
psutil==5.9.5
ptyprocess==0.7.0
pure-eval==0.2.2
pybtex==0.24.0
Pygments==2.15.1
pymdown-extensions==10.1
pypandoc==1.11
python-dateutil==2.8.2
pytz==2023.3
PyYAML==6.0.1
pyyaml_env_tag==0.1
pyzmq==25.1.0
referencing==0.30.0
regex==2023.6.3
requests==2.31.0
rich==13.4.2
rpds-py==0.9.2
six==1.16.0
smmap==5.0.0
sniffio==1.3.0
soupsieve==2.4.1
stack-data==0.6.2
tabulate==0.9.0
tinycss2==1.2.1
toml==0.10.2
tornado==6.3.2
traitlets==5.9.0
tzdata==2023.3
urllib3==2.0.4
validators==0.20.0
watchdog==3.0.0
wcwidth==0.2.6
webencodings==0.5.1
joseale2310 commented 11 months ago

Thank you very muc for the fast response! It is strange cause the problem has not happened before until now, with the exact same setup!

RobertoPrevato commented 11 months ago

Thank you very muc for the fast response! It is strange cause the problem has not happened before until now, with the exact same setup!

That is because mkdocs-material was released, with a requirement such as mkdocs>=1.5.0, while neoteroi-mkdocs required a lower version of mkdocs (being tested with it). Since you are installing dependencies without specifying their version, the same problem can appear in the future with other packages. If you don´t pin your dependencies, it is always possible that some new release will break your workflow.