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
Issue with jupyter-book 0.11 and pip-compile #1351
Comments
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗 |
Heya, well I would suggest you should not be trying to manually create a requirements.txt with all of the requirements pinned to specific versions (aka a lock file); with any packages this will inevitably lead to inconsistencies. Instead, you could simply run in fresh virtual environment something like In terms, of jupyter-book not yet supporting markdown-it-py v1, this is known (I was the one who upgraded markdown-it-py and also jupytext to use v1), we are just upgrading the rest of the stack first (e.g. executablebooks/MyST-Parser@fb8c8fd and executablebooks/MyST-NB#320) then will update jupyter-book relatively shortly. |
Hi @chrisjsewell. Here's a fun thing for you to try: |
Well yes that's because markdown-it-py 0.6 does not support attrs>21. The resolution time is an issue you can raise with pip, but again the point is, if you literally hard-code package versions that are incompatible, you can never hope to get a compatible environment. jupyter-book will always end up being "out of date" with respect to one package or another, this is not a problem because it is why we have semantic versioning, but equally you should not expect to be able to have a |
There are many good reasons to lock dependencies using pip-compile. Docker deployment, for example. The reason why pip freeze is not a great idea is nicely explained here. The problem here is that jupyter-book is relying in internally-inconsistent dependencies, which is a bug--either the dependency causing the conflict is incompatible with the previous version or it is not. In either case, the correct pinning would be >= the lower version number. |
What do you believe to be the internally-inconsistent dependencies? |
See the errors above--the situation cannot be satisfied. |
That is an extremely bad idea and against semantic versioning, since it would mean that every time a dependent package made a breaking change it would break jupyter-book |
It is not at all against sem ver. Tests would be catching the breaking changes. But this is not a jupyter-book issue (which is a program), but rather with the libraries it uses. Typically, one does not expect |
Firstly jupytext is not a dependency of jupyter-book, i.e. you can use jupyter-book without jupytext. It's commonly used with it though, so we could certainly consider having a pinned version in an extra. Secondly, both jupyter-book (via myst-nb) and jupytext clearly specify the versions of markdown-it-py they work with, for all releases. As I have already suggested you need to lower your version of jupytext to one that supports markdown-it-py v0.6 |
This is false, in the sense that it comes into an empty venv with a simple
|
I'm afraid I very much disagree with you expectations here. Again there is nothing wrong with the specifications of the dependencies here, they all clearly specify for every release what dependencies they work with. Unfortunately pip, although improving, is still not perfect at dependency resolution. If you had installed via Conda that is at actually better at doing this resolution. |
In fact, jupytext is part of Line 37 in ff51015
|
Oh wait is |
an aside - this makes me wonder if we should move the dependency on jupytext here: Line 42 in ff51015
to an optional dependency. In the codebase, I think the only place where we use jupytext is in a utility function, and this itself uses a jupyter-book/jupyter_book/utils.py Line 55 in cbafb54
I'm not sure where/when we decided to add jupytext as a dependency (maybe it is a carry-over from the past?) and the discussion here makes me think that it isn't needed |
Yeh I would have to look for when why/why its added, in case there is/was a good reaon. But yeh its actually nothing to do with jupytext, that was a red herring. its seeming likely because of the |
No, this is not correct. The only thing in the requirements file is jupyter-book, as shown in the reproducible example above. |
See the reproducible example above, specifically the |
abd so what output do you get when you run |
On a quick check, it seems to be related to: jazzband/pip-tools#1372, i.e. " That's because pip-tools doesn't yet have a proper dependency resolver." If you simply run |
Yes, it is related, but I also agree somewhat with the author of pip-tools there. pip-installing the 1-line requirements.txt file does work (which we did already know), and gives the following
Note that this new venv does not have pip-tools, and some of these issues are in the jupyter-book chain:
In the end, I've hacked the production requirements file to "work", but it is unclear how generally this will work. If some subset of jupyter-book really does need
In other words, all all 3 of those markdown-it-py versions included in the CI? The output of pip freeze is:
|
Yeh that's definitely it I think, there is no problem installing jupyter-book with pip or Conda; its a surprise to me TBH, because I have used pip-compile before with no issues, but I'm not sure how it is supposed to work properly without a dependency resolver, given that is a core part of its functionality So yes |
The dependency resolution is mathematically impossible in this case. A version cannot simultaneously be both |
What comment are you referring to by the pip-tools author? From what I read in the issues they all seem in agreement that need a resolver (and one will be implemented) |
The one linked to above, re: |
No thats is only because, for some reason pip-compile decides to pin |
The long and the short of it is; don't rely on pip-compile until jazzband/pip-tools#1372 is fixed, because without it, it simply does not work. If you want a lock-file for jupyter-book 0.11.1 that actually works:
|
This is because myst-parser is pinning it to 0.2.8: https://github.com/executablebooks/MyST-Parser/blob/master/setup.cfg#L43
|
Actually, no--that's the requirement for the latest version. Checking the older now. |
Okay, I think I see what's happening now. I traced myst-parser back to 0.13.7 and it pins mdit-py-plugins to 0.2.5. |
Exactly and that works fine with markdown-it-py v0.6. |
follow-up: I've got a PR to see what happens if we remove jupytext...I don't suspect it will be a problem (though we use it in our documentation) #1353 |
yeh but then I can see people getting the wrong version of jupytext and everything will break. Again jupytext is actually nothing to do with the issue here. |
But yeh though absolutely thanks for bringing it to our attention (this issue with pip-compile) @molpopgen |
Thanks for helping me work through it. It is frustrating that it finds the wrong answer--this is the first one in a long time of using it to manage all the CI environments for a few projects. |
well, as you can see lol, its also frustrating for me, since I have gone to great pains to ensure all the dependency pieces fit together 🥴. But yeh come v0.12, this should all clear up, and then the point of releasing markdown-it-py v1 was that it should be pretty stable now and rarely incur any further breaking changes. |
Just FYI, this problem also arises when using pipenv to manage a project's environment. I have worked around it with direct, restricted dependency on [packages]
jupyter-book = "==0.11.*"
mdit-py-plugins = "<0.2.7" |
maintainer summary: jazzband/pip-tools#1372, is causing pip-compile to currently fail with jupyter-book v0.11, this should be fixed with jupyter-book v0.12
Describe the bug
The pinning of
markdown-it-py
is inconsistent.To Reproduce
Expected behavior
I expected a consistent set of pinned dependencies that I could store in a requirements.txt file.
Environment
Python 3.8.6 on Pop OS 20.04
The text was updated successfully, but these errors were encountered: