question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

22.0: `assert len(weights) == expected_node_count AssertionError`

See original GitHub issue

Description

Hi there,

I’m one of the maintainers for Qtile (https://www.github.com/qtile/qtile).

I’ve noticed that our docs (hosted by ReadTheDocs) have begun failing to build.

The error message is:

ERROR: Exception:
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/qtile/envs/3274/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 165, in exc_logging_wrapper
    status = run_func(*args)
  File "/home/docs/checkouts/readthedocs.org/user_builds/qtile/envs/3274/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "/home/docs/checkouts/readthedocs.org/user_builds/qtile/envs/3274/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 389, in run
    to_install = resolver.get_installation_order(requirement_set)
  File "/home/docs/checkouts/readthedocs.org/user_builds/qtile/envs/3274/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 190, in get_installation_order
    expected_node_count=len(self._result.mapping) + 1,
  File "/home/docs/checkouts/readthedocs.org/user_builds/qtile/envs/3274/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 276, in get_topological_weights
    assert len(weights) == expected_node_count
AssertionError

The first failure (https://readthedocs.org/projects/qtile/builds/15928125/) was the first build following the release of 22.0.

The most recent failure (https://readthedocs.org/projects/qtile/builds/15931046/) also fails on 22.0.1.

Expected behavior

Documents should build successfully.

I’m not aware of any other changes that would have impacted the building of our docs.

pip version

22.0 and 22.0.1

Python version

3.7

OS

ReadTheDocs docker image - I think is Ubuntu 20.04

How to Reproduce

(Appreciate this isn’t particularly helpful…)

  1. Submit a PR for Qtile
  2. Hook starts build of docs
  3. Build fails

Note: I cannot recreate locally. However, given that the failures started with 22.0 I can only assume it’s caused by that. Unfortunately, I don’t know what the error message means.

Output

No response

Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:18 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
notatallshawcommented, Jan 31, 2022

Hmmm… Maybe this needs running the pip install commands that RTD runs before those?

pip install --upgrade pip setuptools<58.3.0 
pip install --upgrade mock==1.0.1 pillow==5.4.1 alabaster>=0.7,<0.8,!=0.7.5 commonmark==0.8.1 recommonmark==0.5.0 sphinx<2 sphinx-rtd-theme<0.5 readthedocs-sphinx-ext<2.2 
pip install -r docs/requirements.txt

It might be that already-installed packages are implicated.

I am able to reproduce the error following these steps with a fresh virtual environment. Here are the steps specifically:

python3.10 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip "setuptools<58.3.0"
python -m pip install --upgrade mock==1.0.1 pillow==5.4.1 "alabaster>=0.7,<0.8,!=0.7.5" commonmark==0.8.1 recommonmark==0.5.0 "sphinx<2" "sphinx-rtd-theme<0.5" "readthedocs-sphinx-ext<2.2"
python -m pip install -r requirements.txt

And the requirements file looks like this:

setuptools_scm
sphinx
sphinx_rtd_theme
funcparserlib==1.0.0a0
sphinxcontrib-seqdiag
numpydoc
cairocffi >= 0.9.0
cffi >= 1.1.0
xcffib >= 0.10.1

I have not been able to reproduce it using a single install or using download.

I set a breakpoint where the asert statement is and I found:

(Pdb) expected_node_count
41
(Pdb) len(weights)
42
(Pdb) weights
{'snowballstemmer': 41, 'urllib3': 41, 'alabaster': 41, 'pytz': 41, 'six': 41, 'pyparsing': 41, 'imagesize': 41, '<Python from Requires-Python>': 41, 'pygments': 41, 'pillow': 41, 'charset-normalizer': 41, 'docutils': 41, 'certifi': 41, 'setuptools': 41, 'markupsafe': 41, 'sphinxcontrib-serializinghtml': 41, 'idna': 41, 'packaging': 24, 'funcparserlib': 24, 'sphinxcontrib-websupport': 24, 'webcolors': 24, 'pycparser': 24, 'sphinxcontrib-qthelp': 24, 'sphinxcontrib-htmlhelp': 24, 'babel': 24, 'sphinxcontrib-applehelp': 24, 'tomli': 24, 'requests': 24, 'sphinxcontrib-devhelp': 24, 'sphinxcontrib-jsmath': 24, 'jinja2': 24, 'cffi': 10, 'sphinx': 10, 'setuptools-scm': 10, 'blockdiag': 10, 'cairocffi': 6, 'sphinx-rtd-theme': 6, 'numpydoc': 6, 'seqdiag': 6, 'xcffib': 6, 'sphinxcontrib-seqdiag': 1, None: 0}
0reactions
notatallshawcommented, Feb 6, 2022

So can anyone help me out with 22.0.3

This issue is closed. If you have a new issue with the latest version of pip (currently 22.0.3) you should report that new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Builds failing since pip update to 22.0 and 22.0.1 #8864 - GitHub
Builds failing since pip update to 22.0 and 22.0.1 #8864 ... 22.0: assert len(weights) == expected_node_count AssertionError pypa/pip#10851.
Read more >
Pip fails to install long requirements.txt on 22.04 Kubuntu ...
The problem seems to lie in the stock pip installed. If you do: pip install --upgrade pip. and get a version that is...
Read more >
assert len(weights) == expected_node_count AssertionError
22.0 : `assert len(weights) == expected_node_count AssertionError`. This issue has been tracked since 2022-01-30. Description.
Read more >
Text and Subfield Search: Assertion error Python - MongoDB
I have the correct query in my db.py under the method build_query_sort_project(), because my cluster returns the values correctly.
Read more >
pip - bytemeta
Python >=3.6 is not enforced for pip 22.0 conda-forge installations. aixtools ... 22.0: `assert len(weights) == expected_node_count AssertionError`.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found