Skip to content
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

[BUGFIX] Use pip==20.0.2 to match core st2 pin #687

Merged
merged 5 commits into from
Mar 6, 2021

Conversation

cognifloyd
Copy link
Member

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:

  • a6c4b89373e01f1c38396ce65d9dda3e3be0e842
  • c9f6638c491383e7587ab44f76673c81805aaa13
  • e1804fb666cd9d41a77a1e776fe6bb0a1e1b949b
  • 40827e7fdb04588bfc12ce4da7c7a9bc7e9c4ae3

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

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:
- a6c4b89373e01f1c38396ce65d9dda3e3be0e842
- c9f6638c491383e7587ab44f76673c81805aaa13
- e1804fb666cd9d41a77a1e776fe6bb0a1e1b949b
- 40827e7fdb04588bfc12ce4da7c7a9bc7e9c4ae3

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
Copy link
Member

@Kami Kami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Kami
Copy link
Member

Kami commented Mar 4, 2021

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.

@Kami
Copy link
Member

Kami commented Mar 4, 2021

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).

@Kami
Copy link
Member

Kami commented Mar 5, 2021

Finally got it to work - StackStorm/st2packaging-dockerfiles#104 (comment).

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.

Copy link
Contributor

@amanda11 amanda11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Kami
Copy link
Member

Kami commented Mar 6, 2021

Yay, finally all green and correct pip versions being used across the board 🎉

[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

@Kami Kami merged commit 9477d5c into StackStorm:master Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants