Ami update in region breaks search for python version capable of boto3 import.
sh-4.2$ ls | grep python
python
python2
python2.7
python2.7-config
python2-config
python3
python3.7
python3.7m
python3.8
python3.8-config
python3.8-x86_64-config
python-config
sh-4.2$ /usr/bin/python3 --version
Python 3.7.16
sh-4.2$ /usr/bin/python3
Python 3.7.16 (default, Dec 15 2022, 23:24:54)
[GCC 7.3.1 20180712 (Red Hat 7.3.1-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'boto3'
>>>
Testing Done
[ ] Notebook Instance created successfully with the Lifecycle Configuration
[ ] Notebook Instance stopped and started successfully
[ ] Documentation in the script around any network access requirements
[ ] Documentation in the script around any IAM permission requirements
[x] CLI commands used to validate functionality on the instance
[ ] New script link and description added to README.md
# Provide your commands here
sh-4.2$ if $(which python) -c "import boto3" 2>/dev/null; then
> PYTHON_DIR=$(which python)
> elif /usr/bin/python -c "import boto3" 2>/dev/null; then
> PYTHON_DIR='/usr/bin/python'
> else
> # If no boto3 just quit because the script won't work
> echo "No boto3 found in Python or Python3. Exiting..."
> exit 1
> fi
sh-4.2$ echo $PYTHON_DIR
/home/ec2-user/anaconda3/envs/JupyterSystemEnv/bin/python
sh-4.2$
sh-4.2$ /home/ec2-user/anaconda3/envs/JupyterSystemEnv/bin/python
Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:53)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto3
>>>
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Issue #, if available:
Description of changes:
Ami update in region breaks search for python version capable of boto3 import.
Testing Done
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.