Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-62399

Use of v3 tooclhain virtualenv is a python2 environment

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.3.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • TIPS 2022-01-10
    • 200

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

            Assignee:
            carl.worley@mongodb.com Raiden Worley (Inactive)
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: