timvink / mkdocs-table-reader-plugin

MkDocs plugin that enables a markdown tag like {{ read_csv('table.csv') }} to directly insert various table formats into a page
https://timvink.github.io/mkdocs-table-reader-plugin/
MIT License
111 stars 18 forks source link

Poetry add mkdocs-table-reader-plugin hangs when resolving dependencies #28

Closed HundredVisionsGuy closed 1 year ago

HundredVisionsGuy commented 1 year ago

I tried installing mkdocs-table-reader-plugin using poetry add mkdocs-table-reader-plugin but it hangs and never resolves.

I ran the poetry command at 1:38pm, and it added mkdocs-table-reader-plugin = "^1.1.0" to my pyproject.toml file, but when it got to the Resolving dependencies... state, it just stalled.

I let it run

My Environment: OS: Windows 10 Python - using 3.7 in my virtual environment Project I'm trying to add it to is at file-clerk repo (note: I'm waiting to push my latest commit until I get this resolved, so you won't see the code.

It's now 2:10 over 40 minutes after I ran the command, and it's still hanging.

I'm going to try the suggestions from Poetry install is stuck on specific dependency with "pending..."

If it works, I'll happily contribute to the docs if you like.

I'm attaching the current state of the pyproject.toml and poetry.lock (as txt files [pyproject.toml.txt]

HundredVisionsGuy commented 1 year ago

I think it's due to the pandas dependency, which requires Python 3.8 or higher, and I was using Python 3.7.

Here's what I did to discover the isuue: I deleted the lock file, and re-ran poetry update, but I added the -vvv for verbose output (poetry update -vvv).

You can see the stack trace below: poetry update stacktrace.txt

HundredVisionsGuy commented 1 year ago

I got it working after updating my poetry env to use Python 3.9. The steps required in Windows:

  1. Download Python 3.8 or 3.9 and note where the path to python.exe is.
  2. In the terminal run the following to update your poetry env to switch Python version: poetry env use C:\path\to\python\folder\python.exe (in my case, it was in C:\Users\myusername\AppData\Local\Programs\Python\Python39\python.exe
  3. Not sure if this is necessary, but you might want to delete poetry.lock before running update or add
  4. Run either poetry add mkdocs-table-reader-plugin (if you don't have it in the pyproject.toml file) or poetry update if the library is there.

As I said, if you would like me to contribute my notes to the documentation, I am more than happy to; otherwise, do what you want with this issue.

timvink commented 1 year ago

pandas does not support python 3.7 since their 1.4.x releases (https://github.com/pandas-dev/pandas/releases/tag/v1.4.0).

This package requires pandas>=1.1:

https://github.com/timvink/mkdocs-table-reader-plugin/blob/908c8a297beb32c563d1f78fb26c298b79ae5009/setup.py#L28

pip should be able to automatically determine the latest suitable version (which would be pandas==1.3.5 for python 3.7). See https://pip.pypa.io/en/stable/topics/dependency-resolution/

So, this is not a problem with this plugin. In your case, it seems poetry is not allowing for this backtracking (copied from the stacktrace):

  Because no versions of mkdocs-table-reader-plugin match >1.1.0,<2.0.0
   and mkdocs-table-reader-plugin (1.1.0) depends on pandas (>=1.1), mkdocs-table-reader-plugin (>=1.1.0,<2.0.0) requires pandas (>=1.1).
  Because pandas (1.4.3) requires Python >=3.8
   and no versions of pandas match >=1.1,<1.4.3 || >1.4.3, pandas is forbidden.
  Thus, mkdocs-table-reader-plugin is forbidden.
  So, because file-clerk depends on mkdocs-table-reader-plugin (^1.1.0), version solving failed.

This line no versions of pandas match >=1.1,<1.4.3 || >1.4.3 seems wrong, as you can see on pypi pandas has f.e. 1.3.5. Maybe a proxy issue on your windows setup or something?

Good that upgrading python solves it. Python 3.7 supports ends in 11 months (https://endoflife.date/python), so probably best to upgrade your python version anyway :)