installing tox dependencies for testing fails: ERROR: In --require-hashes mode, all requirements must have their versions pinned with ==. These do not: win32-setctime>=1.0.0
Categories
(Tree Management :: Treeherder, defect)
Tracking
(Not tracked)
People
(Reporter: aryx, Unassigned)
Details
Attachments
(1 external file)
python -m tox fails with:
Collecting win32-setctime>=1.0.0
ERROR: In --require-hashes mode, all requirements must have their versions pinned with ==. These do not:
win32-setctime>=1.0.0 from https://files.pythonhosted.org/packages/27/48/406897d29b97d1323fced8b43805511b7e4ff1a8398b898719275af65e5a/win32_setctime-1.0.3-py3-none-any.whl#sha256=dc925662de0a6eb987f0b01f599c01a8236cb8c62831c22d9cada09ad958243e (from loguru==0.5.3->-r requirements\common.txt (line 241))
WARNING: You are using pip version 21.0.1; however, version 21.1.1 is available.
You should consider upgrading via the 'c:\mozilla\coding\code\treeherder\.tox\py38\scripts\python.exe -m pip install --upgrade pip' command.
ERROR: InvocationError for command 'C:\Mozilla\Coding\Code\treeherder\.tox\py38\Scripts\pip.EXE' install -r 'requirements\common.txt' (exited with code 1)
From requirements\common.txt:
loguru==0.5.3 \
--hash=sha256:b28e72ac7a98be3d28ad28570299a393dfcd32e5e3f6a353dec94675767b6319 \
--hash=sha256:f8087ac396b5ee5f67c963b495d615ebbceac2796379599820e324419d53667c
# via mozci
Marco, are you aware of this and if yes, are there plans to pin dependencies in mozci including hashes?
Comment 1•5 years ago
|
||
Can we pin the dependency in treeherder instead?
In mozci, given that it is a library, I think we should only define ranges of supported versions for the dependencies, but then let the users decide which version to use in particular.
Comment 2•5 years ago
|
||
mozci does already pin loguru:
https://github.com/mozilla/mozci/blob/master/poetry.lock#L1088
I don't think this error has anything to do with mozci tbh. Is treeherder using pip-compile by any chance? The problem is likely that the requirements.txt was generated on a different platform / Python version than the one you are using locally, and loguru likely uses environment markers to conditionally include win32-setctime only when using Windows. Since pip-compile doesn't support environment markers, if you generate on a non-Windows platform, that dep won't get included in the lock file.
This is one of the reasons I think poetry is superior to pip-compile, it's all baked in.
Comment 3•5 years ago
|
||
Actually looking at the treeherder repo, it does use poetry, however the tox.ini is using a requirements.txt persumably generated via pip-compile. So I think rather than pip install -r requirements.txt, the tox file should be using poetry install and this will stop happening.
Comment 4•5 years ago
|
||
(In reply to Andrew Halberstadt [:ahal] from comment #2)
mozcidoes already pin loguru:
https://github.com/mozilla/mozci/blob/master/poetry.lock#L1088
This is tangential to the problem at hand, but figured I'd clarify a bit. This lock file only works for the mozci project itself. In general, packages (like treeherder in this case) are responsible for their own pinning. So it will never be the case that an unpinned dependency would be the fault of said dependency. E.g, in mozci, loguru happened to get resolved and pinned to 0.5.3. But when treeherder generates its lock file, it might get pinned to a different version (since we defined a loose constraint for it within mozci). But ultimately it is up to the infra in treeherder to manage how (or whether) it pins its dependencies.
Comment 5•5 years ago
|
||
Comment 6•5 years ago
|
||
Above pull request fails CI, but should give a decent enough idea of how I would recommend fixing this.
Comment 7•5 years ago
|
||
(In reply to Andrew Halberstadt [:ahal] from comment #3)
Actually looking at the
treeherderrepo, it does use poetry, however thetox.iniis using a requirements.txt persumably generated viapip-compile. So I think rather thanpip install -r requirements.txt, the tox file should be usingpoetry installand this will stop happening.
Yes, we do use pip-compile and its a pain since it doesn't pin a package's dependencies. I'm open to using poetry or pip-compile-multi instead - anything to make python dependency management as easy as yarn does for JS dependencies. Armen set a lot of this up (tox/poetry) so I don't really have any historical knowledge of that part of the app.
Description
•