[DRIVERS-2346] [EVG tools] activate_venv.sh fails with RuntimeError: no .dist-info at ... Created: 01/Jun/22  Updated: 28/Oct/23  Resolved: 06/Jun/22

Status: Closed
Project: Drivers
Component/s: Evergreen Tools
Fix Version/s: None

Type: Task Priority: Unknown
Reporter: Shane Harvey Assignee: Shane Harvey
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Driver Changes: Not Needed

 Description   

Noticed today in a patch build:

 [2022/06/01 22:52:27.397] [shell='sh' working_directory='\data\mci\96fe8fea8729b98936102ba6308d7d2e']
 [2022/06/01 22:52:27.397] Executing script with sh: if [ -n "true" ]; then
 [2022/06/01 22:52:27.397]   set -o errexit
 [2022/06/01 22:52:27.397] export DRIVERS_TOOLS="C:/data/mci/96fe8fea8729b98936102ba6308d7d2e/drivers-tools"
 [2022/06/01 22:52:27.397] export MONGO_ORCHESTRATION_HOME="C:/data/mci/96fe8fea8729b98936102ba6308d7d2e/drivers-tools/.evergreen/orchestration"
 [2022/06/01 22:52:27.397] export MONGODB_BINARIES="C:/data/mci/96fe8fea8729b98936102ba6308d7d2e/drivers-tools/mongodb/bin"
 [2022/06/01 22:52:27.397] export UPLOAD_BUCKET="mongo-python-driver"
 [2022/06/01 22:52:27.397] export PROJECT_DIRECTORY="C:/data/mci/96fe8fea8729b98936102ba6308d7d2e/src"
 [2022/06/01 22:52:27.397] export TMPDIR="C:/data/mci/96fe8fea8729b98936102ba6308d7d2e/drivers-tools/.evergreen/orchestration/db"
 [2022/06/01 22:52:27.397] # Installation of cryptography requires a rust compiler on some machines
 [2022/06/01 22:52:27.397] export PATH="C:/data/mci/96fe8fea8729b98936102ba6308d7d2e/drivers-tools/mongodb/bin:/home/admin/.cargo/bin:/usr/local/bin:/usr/bin:/cygdrive/c/Python27:/cygdrive/c/Python27/Scripts:/cygdrive/c/Python310/Scripts:/cygdrive/c/Python310:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Windows/System32/OpenSSH:/cygdrive/c/Windows/system32/config/systemprofile/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Program Files/Amazon/cfn-bootstrap:/cygdrive/c/Program Files/Docker:/cygdrive/c/ProgramData/chocolatey/bin:/cygdrive/c/Program Files/dotnet:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Python27:/cygdrive/c/Python27/Scripts:/cygdrive/c/openssl/bin:/cygdrive/c/sasl/bin:/cygdrive/c/snmp/bin:/cygdrive/c/go/bin:/cygdrive/c/Program Files/Git/bin:/cygdrive/c/Program Files/nodejs:/cygdrive/c/Perl64/bin:/cygdrive/c/curl/dlls:/cygdrive/c/Program Files/nodejs:/cygdrive/c/Users/mci-exec/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Users/mci-exec/.dotnet/tools:/cygdrive/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin:/cygdrive/c/Users/Administrator/AppData/Roaming/npm:/cygdrive/c/go/bin:/cygdrive/c/Windows/Sysnative:/cygdrive/c/mingw-w64/x86_64-4.9.1-posix-seh-rt_v3-rev1/mingw64/bin"
 [2022/06/01 22:52:27.397] export PROJECT="mongo-python-driver"
 [2022/06/01 22:52:27.397]   cd C:/data/mci/96fe8fea8729b98936102ba6308d7d2e/drivers-tools/.evergreen/csfle
 [2022/06/01 22:52:27.397]   . ./activate_venv.sh
 [2022/06/01 22:52:27.397] fi
 [2022/06/01 22:52:27.400] tracking process with pid 3000
 [2022/06/01 22:52:27.400] started process with pid '3000'
 [2022/06/01 22:52:28.296] RuntimeError: failed to build image setuptools because:
 [2022/06/01 22:52:28.296] Traceback (most recent call last):
 [2022/06/01 22:52:28.296]   File "c:\python27\lib\site-packages\virtualenv\seed\embed\via_app_data\via_app_data.py", line 57, in _install
 [2022/06/01 22:52:28.296]     installer.install(creator.interpreter.version_info)
 [2022/06/01 22:52:28.296]   File "c:\python27\lib\site-packages\virtualenv\seed\embed\via_app_data\pip_install\base.py", line 35, in install
 [2022/06/01 22:52:28.296]     self._uninstall_previous_version()
 [2022/06/01 22:52:28.296]   File "c:\python27\lib\site-packages\virtualenv\seed\embed\via_app_data\pip_install\base.py", line 151, in _uninstall_previous_version
 [2022/06/01 22:52:28.296]     dist_name = self._dist_info.stem.split("-")[0]
 [2022/06/01 22:52:28.296]   File "c:\python27\lib\site-packages\virtualenv\seed\embed\via_app_data\pip_install\base.py", line 115, in _dist_info
 [2022/06/01 22:52:28.296]     raise RuntimeError(msg)  # pragma: no cover
 [2022/06/01 22:52:28.296] RuntimeError: no .dist-info at C:\Users\mci-exec\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-62.1.0-py3-none-any, has distutils-precedence.pth, pkg_resources, setuptools, _distutils_hack

https://spruce.mongodb.com/task/mongo_python_driver_tests_windows_encryption__platform~windows_64_vsMulti_small_auth_ssl~noauth_nossl_python_version_windows~3.9_encryption~encryption_crypt_shared_test_rapid_replica_set_patch_f4fc742ff38110aa41f2a46b267319403d89f3b1_6297ec58c9ec447522c592ce_22_06_01_22_46_51/logs?execution=0&sortBy=STATUS&sortDir=ASC

I believe the issue is that activate_venv.sh uses "virtualenv" which is Python 2.7 and no longer works. Instead we should use venv.



 Comments   
Comment by Githook User [ 02/Jun/22 ]

Author:

{'name': 'Shane Harvey', 'email': 'shnhrv@gmail.com', 'username': 'ShaneHarvey'}

Message: DRIVERS-2346 Upgrade pip/setuptools when using venv (#205)
Branch: master
https://github.com/mongodb-labs/drivers-evergreen-tools/commit/694655b585872ef1d55dce4bbe3310b7eef5b1da

Comment by Shane Harvey [ 02/Jun/22 ]

New PR: https://github.com/mongodb-labs/drivers-evergreen-tools/pull/205

Comment by Shane Harvey [ 02/Jun/22 ]

Reopening because the above fix was incomplete. Now that we're using venv, MONOGDB-AWS auth tests are failing because the pip in use does not fetch the wheel:

 [2022/06/02 12:42:26.118] ++ CRYPTOGRAPHY_DONT_BUILD_RUST=1
 [2022/06/02 12:42:26.118] ++ pip install --upgrade boto3~=1.19 cryptography~=3.4.8 pykmip~=0.10.0
 [2022/06/02 12:42:26.490] /opt/python/3.6/bin/python3
 [2022/06/02 12:42:26.490] Looking in indexes: https://artifactory.corp.mongodb.com/artifactory/api/pypi/pypi/simple, https://pypi.org/simple
 [2022/06/02 12:42:27.440] Collecting boto3~=1.19
 [2022/06/02 12:42:27.440]   Using cached https://files.pythonhosted.org/packages/75/ca/d917b244919f1ebf96f7bbd5a00e4641f7e9191b0d070258f5dc10f5eaad/boto3-1.23.10-py3-none-any.whl
 [2022/06/02 12:42:27.970] Collecting cryptography~=3.4.8
 [2022/06/02 12:42:27.970]   Using cached https://files.pythonhosted.org/packages/cc/98/8a258ab4787e6f835d350639792527d2eb7946ff9fc0caca9c3f4cf5dcfe/cryptography-3.4.8.tar.gz
 [2022/06/02 12:42:31.150]   Installing build dependencies: started
 [2022/06/02 12:42:31.150]   Installing build dependencies: finished with status 'done'
...
 [2022/06/02 12:42:40.373]         =============================DEBUG ASSISTANCE=============================
 [2022/06/02 12:42:40.373]         If you are seeing a compilation error please try the following steps to
 [2022/06/02 12:42:40.373]         successfully install cryptography:
 [2022/06/02 12:42:40.373]         1) Upgrade to the latest pip and try again. This will fix errors for most
 [2022/06/02 12:42:40.373]            users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
 [2022/06/02 12:42:40.373]         2) Read https://cryptography.io/en/latest/installation.html for specific
 [2022/06/02 12:42:40.373]            instructions for your platform.
 [2022/06/02 12:42:40.373]         3) Check our frequently asked questions for more information:
 [2022/06/02 12:42:40.373]            https://cryptography.io/en/latest/faq.html
 [2022/06/02 12:42:40.373]         4) Ensure you have a recent Rust toolchain installed:
 [2022/06/02 12:42:40.373]            https://cryptography.io/en/latest/installation.html#rust
 [2022/06/02 12:42:40.373]         5) If you are experiencing issues with Rust for *this release only* you may
 [2022/06/02 12:42:40.373]            set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.

To fix this we likely need to upgrade pip/setuptools in the venv.

Comment by Githook User [ 01/Jun/22 ]

Author:

{'name': 'Shane Harvey', 'email': 'shnhrv@gmail.com', 'username': 'ShaneHarvey'}

Message: DRIVERS-2346 Use venv instead of virtualenv (#204)
Branch: master
https://github.com/mongodb-labs/drivers-evergreen-tools/commit/0638b75db86aae603fa882271a251e86309fe050

Generated at Thu Feb 08 08:25:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.