[SERVER-62399] Use of v3 tooclhain virtualenv is a python2 environment Created: 18/Nov/21  Updated: 29/Oct/23  Resolved: 06/Jan/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.3.0

Type: Bug Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Raiden Worley (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
Backwards Compatibility: Fully Compatible
Sprint: TIPS 2022-01-10
Participants:
Linked BF Score: 200

 Description   

While investigating BF-23427 I noticed the following puzzling stack trace:

 [2021/11/18 00:04:57.139] Running command 'shell.exec' in "compile mongodb" (step 3.1 of 3)
 [2021/11/18 00:04:57.140] /opt/mongodbtoolchain/v3/bin/virtualenv --python /opt/mongodbtoolchain/v3/bin/python3 "/data/mci/5a9b6420868baf7df4696cfd36f5098e/compile_venv"
 [2021/11/18 00:05:06.730] /opt/mongodbtoolchain/revisions/8391ec859b03d3bebb666821a88e616ae61a567a/stow/python2-v3.qLj/lib/python2.7/site-packages/virtualenv.py:1041: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
 [2021/11/18 00:05:06.730]   import imp
 [2021/11/18 00:05:07.676] Using base prefix '/opt/mongodbtoolchain/revisions/8391ec859b03d3bebb666821a88e616ae61a567a/stow/python3-v3.vlw'
 [2021/11/18 00:05:07.676] New python executable in /data/mci/5a9b6420868baf7df4696cfd36f5098e/compile_venv/bin/python3
 [2021/11/18 00:05:07.676] Also creating executable in /data/mci/5a9b6420868baf7df4696cfd36f5098e/compile_venv/bin/python
 [2021/11/18 00:05:10.452] Installing setuptools, pip, wheel...
 [2021/11/18 00:05:10.452]   Complete output from command /data/mci/5a9b642086...ile_venv/bin/python3 - setuptools pip wheel:
 [2021/11/18 00:05:10.452]   Traceback (most recent call last):
 [2021/11/18 00:05:10.452]   File "<stdin>", line 8, in <module>
 [2021/11/18 00:05:10.452]   File "<frozen zipimport>", line 259, in load_module
 [2021/11/18 00:05:10.452]   File "/opt/mongodbtoolchain/revisions/8391ec859b03d3bebb666821a88e616ae61a567a/stow/python2-v3.qLj/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/__init__.py", line 42, in <module>
 [2021/11/18 00:05:10.452]   File "<frozen zipimport>", line 259, in load_module
 [2021/11/18 00:05:10.452]   File "/opt/mongodbtoolchain/revisions/8391ec859b03d3bebb666821a88e616ae61a567a/stow/python2-v3.qLj/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/cmdoptions.py", line 16, in <module>
 [2021/11/18 00:05:10.452]   File "<frozen zipimport>", line 259, in load_module
 [2021/11/18 00:05:10.452]   File "/opt/mongodbtoolchain/revisions/8391ec859b03d3bebb666821a88e616ae61a567a/stow/python2-v3.qLj/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 25, in <module>
 [2021/11/18 00:05:10.452]   File "<frozen zipimport>", line 259, in load_module
 [2021/11/18 00:05:10.452]   File "/opt/mongodbtoolchain/revisions/8391ec859b03d3bebb666821a88e616ae61a567a/stow/python2-v3.qLj/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/download.py", line 39, in <module>
 [2021/11/18 00:05:10.452]   File "<frozen zipimport>", line 259, in load_module
 [2021/11/18 00:05:10.452]   File "/opt/mongodbtoolchain/revisions/8391ec859b03d3bebb666821a88e616ae61a567a/stow/python2-v3.qLj/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/utils/glibc.py", line 3, in <module>
 [2021/11/18 00:05:10.452]   File "/opt/mongodbtoolchain/revisions/8391ec859b03d3bebb666821a88e616ae61a567a/stow/python3-v3.vlw/lib/python3.9/ctypes/__init__.py", line 8, in <module>
 [2021/11/18 00:05:10.452]     from _ctypes import Union, Structure, Array
 [2021/11/18 00:05:10.452] ImportError: libffi.so.5: cannot open shared object file: No such file or directory
 [2021/11/18 00:05:10.452] During handling of the above exception, another exception occurred:
 [2021/11/18 00:05:10.452] Traceback (most recent call last):
 [2021/11/18 00:05:10.452]   File "<stdin>", line 11, in <module>
 [2021/11/18 00:05:10.452] ImportError: cannot import name 'main' from 'pip' (/opt/mongodbtoolchain/revisions/8391ec859b03d3bebb666821a88e616ae61a567a/stow/python2-v3.qLj/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/__init__.py)
 [2021/11/18 00:05:10.452] ----------------------------------------
 [2021/11/18 00:05:10.452] ...Installing setuptools, pip, wheel...done.

How are we using both python2 and python3 at the same time?

Discussed with robert.guo for a bit and we realized that ehe /opt/mongodbtoolchain/v3/bin/virtualenv is a python2 virtualenv. It always will be too, because we no longer build it for part of python3.

This code should instead be invoking virtualenv as /opt/mongodbtoolchain/v3/bin/python3 -m virtualenv <args>.



 Comments   
Comment by Githook User [ 06/Jan/22 ]

Author:

{'name': 'Carl Raiden Worley', 'email': 'carl.worley@10gen.com', 'username': 'aggrand'}

Message: SERVER-62399 Use of v3 tooclhain virtualenv is a python2 environment
Branch: master
https://github.com/mongodb/mongo/commit/6c0a9bd4e888a8404df21976a222ec14beca06bf

Generated at Thu Feb 08 05:55:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.