@@ -344,10 +344,22 @@ create_conda_environment () {
344
344
echo " "
345
345
fi
346
346
347
- # -y removes any existing conda environment with the same name
347
+ # The `-y` flag removes any existing Conda environment with the same name
348
348
echo " [SETUP] Creating new Conda environment (Python ${python_version} ) ..."
349
349
(exec_with_retries conda create -y --name " ${env_name} " python=" ${python_version} " ) || return 1
350
350
351
+ echo " [SETUP] Upgrading PIP to latest ..."
352
+ print_exec conda run -n " ${env_name} " pip install --upgrade pip
353
+
354
+ # The pyOpenSSL and cryptography packages versions need to line up for PyPI publishing to work
355
+ # https://stackoverflow.com/questions/74981558/error-updating-python3-pip-attributeerror-module-lib-has-no-attribute-openss
356
+ echo " [SETUP] Upgrading pyOpenSSL ..."
357
+ print_exec conda run -n " ${env_name} " python -m pip install " pyOpenSSL>22.1.0"
358
+
359
+ # This test fails with load errors if the pyOpenSSL and cryptography package versions don't align
360
+ echo " [SETUP] Testing pyOpenSSL import ..."
361
+ (test_python_import " ${env_name} " OpenSSL) || return 1
362
+
351
363
echo " [SETUP] Installed Python version: $( conda run -n " ${env_name} " python --version) "
352
364
echo " [SETUP] Successfully created Conda environment: ${env_name} "
353
365
}
@@ -1086,6 +1098,7 @@ publish_to_pypi () {
1086
1098
echo " [INSTALL] Installing twine ..."
1087
1099
print_exec conda install -n " ${env_name} " -y twine
1088
1100
(test_python_import " ${env_name} " twine) || return 1
1101
+ (test_python_import " ${env_name} " OpenSSL) || return 1
1089
1102
1090
1103
echo " [PUBLISH] Uploading package(s) to PyPI: ${package_name} ..."
1091
1104
conda run -n " ${env_name} " \
0 commit comments