Closed cognifloyd closed 3 years ago
Hm, it's failing with
[package: st2] Collecting pymongo==3.10.0 (from -r ./requirements.txt (line 48))
[package: st2] ERROR: Could not find a version that satisfies the requirement pymongo==3.10.0 (from -r ./requirements.txt (line 48)) (from versions: none)
[package: st2] ERROR: No matching distribution found for pymongo==3.10.0 (from -r ./requirements.txt (line 48))
[package: st2] Traceback (most recent call last):
[package: st2] File "/usr/bin/dh_virtualenv", line 110, in <module>
[package: st2] sys.exit(main() or 0)
[package: st2] File "/usr/bin/dh_virtualenv", line 90, in main
[package: st2] deploy.install_dependencies()
[package: st2] File "/usr/lib/python2.7/dist-packages/dh_virtualenv/deployment.py", line 177, in install_dependencies
[package: st2] subprocess.check_call(self.pip('-r', requirements_path))
[package: st2] File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
[package: st2] raise CalledProcessError(retcode, cmd)
[package: st2] subprocess.CalledProcessError: Command '['/tmp/st2-20210304-6-9j53ti/st2/debian/st2/opt/stackstorm/st2/bin/python', '/tmp/st2-20210304-6-9j53ti/st2/debian/st2/opt/stackstorm/st2/bin/pip', 'install', '--log=/tmp/tmp78RH06', '--find-links=/tmp/wheelhouse', '--no-index', '-r', './requirements.txt']' returned non-zero exit status 1
[package: st2] debian/rules:65: recipe for target 'override_dh_virtualenv' failed
On Bionic.
No idea why yet. It almost looks like it's trying to use unsupported Python version, but pymongo 3.10.0 claims it still supports Python 2.7.
OK, I found the root cause:
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
/usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
Looking in links: /tmp/wheelhouse
Processing /tmp/wheelhouse/pymongo-3.10.0-cp36-cp36m-manylinux2014_x86_64.whl
Installing collected packages: pymongo
Successfully installed pymongo-3.10.0
root@00b4249e9eca:~/build# /tmp/st2-20210304-7-1rag3n8/st2/debian/st2/opt/stackstorm/st2/bin/pip install "pymongo==3.10.0" --no-index
Collecting pymongo==3.10.0
ERROR: Could not find a version that satisfies the requirement pymongo==3.10.0 (from versions: none)
ERROR: No matching distribution found for pymongo==3.10.0
root@00b4249e9eca:~/build# /tmp/st2-20210304-7-1rag3n8/st2/debian/st2/opt/stackstorm/st2/bin/pip --version
pip 19.1.1 from /tmp/st2-20210304-7-1rag3n8/st2/debian/st2/opt/stackstorm/st2/lib/python3.6/site-packages/pip (python 3.6)
So the pip which is used for virtualenv is still old one which doesn't support manywheel2014 wheel format used by pymongo.
Looking into a fix (I believe we just need to specify right pip path so it uses Python 3 pip and not old system one).
Finally got it to work - https://github.com/StackStorm/st2packaging-dockerfiles/pull/104#issuecomment-791313855.
Spent many more hours that I would hope on that yesterday. Even though we pinned pip in various places that was not enough and created virtualenv was still using incorrect versions (and those were not consistent across deb distros - Xenial was using 21.0 and Bionic was using 19.1 - nasty and a ticking time bomb for sure).
In short - that code was broken and dangerous for a long time and some of my recent changes just exposed those long standing issues.
Yay, finally all green and correct pip versions being used across the board :tada:
[package: st2] dh-virualenv versions info [package: st2] Using Python: Python 3.6.13 [package: st2] Using pip: pip 20.0.2 from /tmp/st2-20210306-6-91jjcd/st2/debian/st2/opt/stackstorm/st2/lib/python3.6/site-packages/pip (python 3.6)
... [wheelhouse: st2] Building wheel for stackstorm-runner-action-chain (setup.py): finished with status 'done' [wheelhouse: st2] Created wheel for stackstorm-runner-action-chain: filename=stackstorm_runner_action_chain-3.5.dev0-py3-none-any.whl size=10636 sha256=6e86808e181539b41863a25ddc078ad99d4eff3a4b3b14ad65e592fbe0dcb224 [wheelhouse: st2] Stored in directory: /tmp/pip-ephem-wheel-cache-_v0neswv/wheels/ce/4e/be/58be4b46658e56060994e2282478f9ce0ef3b2706ddb78324a [wheelhouse: st2] Successfully built stackstorm-runner-action-chain [wheelhouse: st2] WARNING: You are using pip version 20.0.2; however, version 21.0.1 is available. ...
What supposed to be 10 minute change turned into many hours :D
We have been running tests with pip==20.0.2 in v3.3.0 and v3.2.0. But we have still been installing pip 19 in production.
That is very likely to cause installation errors for packs in production that would not exist during testing (eg if a pack's dep uses a pip feature that is not available in pip 19, which is becoming more common).
See these commits in StackStorm/st2:
We have not been testing with anything newer than pip 20.0.2, however, so upgrading to a newer version is dangerous. Since we've already been testing with 20.0.2, we should start with making pip consistent across all of our infrastructure and then we can worry about upgrading.
Here is a list of places that need to be updated when we do upgrade pip: https://github.com/StackStorm/st2/wiki/Where-all-to-update-pip-and-or-virtualenv