useblocks / sphinx-collections

Integrates different sources into one Sphinx project.
https://sphinx-collections.readthedocs.io/en/latest/
MIT License
18 stars 8 forks source link

pip install and pip-compile fails for new package version 0.2.0 #26

Open marcel-22 opened 9 months ago

marcel-22 commented 9 months ago

Hi, I tried updating sphinx-collections from 0.0.1 to 0.2.0 but get some errors.

Command pip-compile fails

I updated sphinx-collections version in my requirements.in file and tried to create the requirements.txt file using pip-compile.

pip-compile requirements.in
    WARNING: Generating metadata for package sphinx-collections produced metadata for project name sphinxcontrib-collections.
    Fix your #egg=sphinx-collections fragments.
  ERROR: Could not find a version that satisfies the requirement sphinx-collections==0.2.0 (from versions: 0.0.1a1, 0.0.1, 0.2.0)
Traceback (most recent call last):
  File "C:\...\.venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 348, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "C:\...\.venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 173, in _add_to_criteria
    raise RequirementsConflicted(criterion)
pip._vendor.resolvelib.resolvers.RequirementsConflicted: Requirements conflict: SpecifierRequirement('sphinx-collections==0.2.0')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\...\.venv\Lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 92, in resolve
    result = self._result = resolver.resolve(
                            ^^^^^^^^^^^^^^^^^
  File "C:\...\.venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 481, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\...\.venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 350, in resolve
    raise ResolutionImpossible(e.criterion.information)
pip._vendor.resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=SpecifierRequirement('sphinx-collections==0.2.0'), parent=None)]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\...\.venv\Scripts\pip-compile.exe\__main__.py", line 7, in <module>
  File "C:\...\.venv\Lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\...\.venv\Lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\...\.venv\Lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\...\.venv\Lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\...\.venv\Lib\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\...\.venv\Lib\site-packages\piptools\scripts\compile.py", line 659, in cli
    results = resolver.resolve(max_rounds=max_rounds)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\...\.venv\Lib\site-packages\piptools\resolver.py", line 604, in resolve
    is_resolved = self._do_resolve(
                  ^^^^^^^^^^^^^^^^^
  File "C:\...\.venv\Lib\site-packages\piptools\resolver.py", line 636, in _do_resolve
    resolver.resolve(
  File "C:\...\.venv\Lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 101, in resolve
    raise error from e
pip._internal.exceptions.DistributionNotFound: No matching distribution found for sphinx-collections==0.2.0

Command pip install fails

pip install sphinx-collections==0.2.0  
Collecting sphinx-collections==0.2.0
  Downloading sphinx-collections-0.2.0.tar.gz (12 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
  WARNING: Generating metadata for package sphinx-collections produced metadata for project name sphinxcontrib-collections. Fix your #egg=sphinx-collections fragments.
Discarding https://files.pythonhosted.org/packages/f7/4d/6c94cf98457d43e4fed65a25e1cafc0a5250c8e9ce2838ae31c249912400/sphinx-collections-0.2.0.tar.gz (from https://pypi.org/simple/sphinx-collections/): Requested sphinxcontrib-collections from https://files.pythonhosted.org/packages/f7/4d/6c94cf98457d43e4fed65a25e1cafc0a5250c8e9ce2838ae31c249912400/sphinx-collections-0.2.0.tar.gz has inconsistent name: expected 'sphinx-collections', but metadata has 'sphinxcontrib-collections'
ERROR: Could not find a version that satisfies the requirement sphinx-collections==0.2.0 (from versions: 0.0.1a1, 0.0.1, 0.2.0)
ERROR: No matching distribution found for sphinx-collections==0.2.0
marcel-22 commented 9 months ago

I noticed the version number in pyproject.toml is still 0.0.2. Should be updated too I guess.

danwos commented 9 months ago

Thanks for reporting this problem :+1:

Unfortunately, I can execute a pip install sphinx-collections successfully on my machine with a fresh Python venv.

However, I fixed the problem in pyproject.toml and pushed it to master As I have no experience with pip-compile, can you do me a favour an test this?

joaohf commented 9 months ago

Hi,

@danwos, could you check the installed sphinx-collections version ?

Mine is:

[dev]$ pip list | grep collections
sphinx-collections             0.0.1

Here is what happens when I try to install. It switches to 0.0.1 version:

[dev]$ pip install sphinx-collections
Defaulting to user installation because normal site-packages is not writeable
Collecting sphinx-collections
  Downloading sphinx-collections-0.2.0.tar.gz (12 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
  WARNING: Generating metadata for package sphinx-collections produced metadata for project name sphinxcontrib-collections. Fix your #egg=sphinx-collections fragments.
Discarding https://files.pythonhosted.org/packages/f7/4d/6c94cf98457d43e4fed65a25e1cafc0a5250c8e9ce2838ae31c249912400/sphinx-collections-0.2.0.tar.gz (from https://pypi.org/simple/sphinx-collections/): Requested sphinxcontrib-collections from https://files.pythonhosted.org/packages/f7/4d/6c94cf98457d43e4fed65a25e1cafc0a5250c8e9ce2838ae31c249912400/sphinx-collections-0.2.0.tar.gz has inconsistent name: expected 'sphinx-collections', but metadata has 'sphinxcontrib-collections'
  Downloading sphinx_collections-0.0.1-py3-none-any.whl (17 kB)
Requirement already satisfied: sphinx>2.0 in /usr/local/lib/python3.11/site-packages (from sphinx-collections) (6.1.3)
Requirement already satisfied: jinja2 in /usr/local/lib/python3.11/site-packages (from sphinx-collections) (3.1.2)
Requirement already satisfied: gitpython in /usr/local/lib/python3.11/site-packages (from sphinx-collections) (3.1.40)
Requirement already satisfied: sphinxcontrib-applehelp in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (1.0.7)
Requirement already satisfied: sphinxcontrib-devhelp in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (1.0.5)
Requirement already satisfied: sphinxcontrib-jsmath in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (1.0.1)
Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (2.0.4)
Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.5 in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (1.1.9)
Requirement already satisfied: sphinxcontrib-qthelp in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (1.0.6)
Requirement already satisfied: Pygments>=2.13 in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (2.17.2)
Requirement already satisfied: docutils<0.20,>=0.18 in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (0.18.1)
Requirement already satisfied: snowballstemmer>=2.0 in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (2.2.0)
Requirement already satisfied: babel>=2.9 in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (2.14.0)
Requirement already satisfied: alabaster<0.8,>=0.7 in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (0.7.13)
Requirement already satisfied: imagesize>=1.3 in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (1.4.1)
Requirement already satisfied: requests>=2.25.0 in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (2.31.0)
Requirement already satisfied: packaging>=21.0 in /usr/local/lib/python3.11/site-packages (from sphinx>2.0->sphinx-collections) (23.2)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.11/site-packages (from jinja2->sphinx-collections) (2.1.3)
Requirement already satisfied: gitdb<5,>=4.0.1 in /usr/local/lib/python3.11/site-packages (from gitpython->sphinx-collections) (4.0.11)
Requirement already satisfied: smmap<6,>=3.0.1 in /usr/local/lib/python3.11/site-packages (from gitdb<5,>=4.0.1->gitpython->sphinx-collections) (5.0.1)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/site-packages (from requests>=2.25.0->sphinx>2.0->sphinx-collections) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.11/site-packages (from requests>=2.25.0->sphinx>2.0->sphinx-collections) (3.6)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/site-packages (from requests>=2.25.0->sphinx>2.0->sphinx-collections) (2.1.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.11/site-packages (from requests>=2.25.0->sphinx>2.0->sphinx-collections) (2023.11.17)
Installing collected packages: sphinx-collections
Successfully installed sphinx-collections-0.0.1

Looks like the file pyproject.toml points to the wrong name and repository: sphinxcontrib-collections.

marcel-22 commented 9 months ago

@danwos Maybe you can try the command pip install sphinx-collections==0.2.0 ? Then you'll probably get the same error No matching distribution found as described in my original post. This is also the main error cause why pip-compile fails.

I have the same output as @joaohf for command pip install sphinx-collections. Looks like the name and repository in pyproject.toml are wrong indeed (when I compare it to the repo version of sphinx-needs for example). I am not familiar with pyproject.toml, so I don't know if the definition of packages[] is okay/wrong as well?

qor-lb commented 6 months ago

Hi, any updates on the above issue? I just tried to update my sphinx-collections and it seems this error still exists:

[dev]$ pip install --upgrade sphinx-collections
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: sphinx-collections in /home/dev/.local/lib/python3.10/site-packages (0.0.1)
Collecting sphinx-collections
  Using cached sphinx-collections-0.2.0.tar.gz (12 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
  WARNING: Generating metadata for package sphinx-collections produced metadata for project name sphinxcontrib-collections. Fix your #egg=sphinx-collections fragments.
Discarding https://files.pythonhosted.org/packages/f7/4d/6c94cf98457d43e4fed65a25e1cafc0a5250c8e9ce2838ae31c249912400/sphinx-collections-0.2.0.tar.gz#sha256=eb266811ca117524919a9f232dd27267a2838d9c0729604f8411ae7eab36f660 (from https://pypi.org/simple/sphinx-collections/): Requested sphinxcontrib-collections from https://files.pythonhosted.org/packages/f7/4d/6c94cf98457d43e4fed65a25e1cafc0a5250c8e9ce2838ae31c249912400/sphinx-collections-0.2.0.tar.gz#sha256=eb266811ca117524919a9f232dd27267a2838d9c0729604f8411ae7eab36f660 has inconsistent name: filename has 'sphinx-collections', but metadata has 'sphinxcontrib-collections'
Requirement already satisfied: jinja2 in /home/dev/.local/lib/python3.10/site-packages (from sphinx-collections) (3.1.2)
Requirement already satisfied: sphinx>2.0 in /home/dev/.local/lib/python3.10/site-packages (from sphinx-collections) (7.3.7)
Requirement already satisfied: gitpython in /home/dev/.local/lib/python3.10/site-packages (from sphinx-collections) (3.1.43)
Requirement already satisfied: sphinxcontrib-applehelp in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (1.0.8)
Requirement already satisfied: requests>=2.25.0 in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (2.31.0)
Requirement already satisfied: Pygments>=2.14 in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (2.17.2)
Requirement already satisfied: imagesize>=1.3 in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (1.4.1)
Requirement already satisfied: sphinxcontrib-qthelp in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (1.0.7)
Requirement already satisfied: docutils<0.22,>=0.18.1 in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (0.20.1)
Requirement already satisfied: sphinxcontrib-jsmath in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (1.0.1)
Requirement already satisfied: tomli>=2 in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (2.0.1)
Requirement already satisfied: sphinxcontrib-devhelp in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (1.0.6)
Requirement already satisfied: alabaster~=0.7.14 in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (0.7.16)
Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.9 in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (1.1.10)
Requirement already satisfied: snowballstemmer>=2.0 in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (2.2.0)
Requirement already satisfied: packaging>=21.0 in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (24.0)
Requirement already satisfied: babel>=2.9 in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (2.14.0)
Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /home/dev/.local/lib/python3.10/site-packages (from sphinx>2.0->sphinx-collections) (2.0.5)
Requirement already satisfied: MarkupSafe>=2.0 in /home/dev/.local/lib/python3.10/site-packages (from jinja2->sphinx-collections) (2.1.3)
Requirement already satisfied: gitdb<5,>=4.0.1 in /home/dev/.local/lib/python3.10/site-packages (from gitpython->sphinx-collections) (4.0.11)
Requirement already satisfied: smmap<6,>=3.0.1 in /home/dev/.local/lib/python3.10/site-packages (from gitdb<5,>=4.0.1->gitpython->sphinx-collections) (5.0.1)
Requirement already satisfied: idna<4,>=2.5 in /home/dev/.local/lib/python3.10/site-packages (from requests>=2.25.0->sphinx>2.0->sphinx-collections) (3.6)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/dev/.local/lib/python3.10/site-packages (from requests>=2.25.0->sphinx>2.0->sphinx-collections) (2.2.1)
Requirement already satisfied: certifi>=2017.4.17 in /home/dev/.local/lib/python3.10/site-packages (from requests>=2.25.0->sphinx>2.0->sphinx-collections) (2024.2.2)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/dev/.local/lib/python3.10/site-packages (from requests>=2.25.0->sphinx>2.0->sphinx-collections) (3.3.2)
marcel-22 commented 6 months ago

Yes, I would like an update as well :-)

fix-with-tempo commented 3 months ago

I can confirm this issue. Installing the package with a requirments.txt via sphinxcontrib-collections@git+https://github.com/useblocks/sphinx-collections.git@37b54c0a78e1772aabe13634ea2e2211749ac865 works, but note that sphinx-collections needs to be replaced by sphinxcontrib-collections.

sphinxcontrib-collections==0.2.0 does not work.

As https://github.com/useblocks/sphinx-collections/issues/26#issuecomment-1963907277 states the naming is not consistent.

Is there any objection to changing sphinxcontrib-collections to sphinx-collections? And then package a version 0.2.1?

fix-with-tempo commented 1 month ago

I can confirm this issue. Installing the package with a requirments.txt via sphinxcontrib-collections@git+https://github.com/useblocks/sphinx-collections.git@37b54c0a78e1772aabe13634ea2e2211749ac865 works, but note that sphinx-collections needs to be replaced by sphinxcontrib-collections.

sphinxcontrib-collections==0.2.0 does not work.

As #26 (comment) states the naming is not consistent.

Is there any objection to changing sphinxcontrib-collections to sphinx-collections? And then package a version 0.2.1?

Hi @danwos, how shall we proceed with this issue? Shall I open a PR with the proposed fix? I need this working, so I am fine helping to fix it.

Just let me know how you like it.