Solution:
I opened a Terminal from the top menu (Terminal -> New Terminal);

in the newly opened terminal I typed:

pip install botocore
pip install boto3

After doing this, the errors I was getting for:

import boto3
from botocore.exceptions import ClientError

disappeared (after closing and reopening the Python file I was editing).

Background:
I am new to VisualStudio Code (Version: 1.41.1 on MacOS Mojave 10.14.6) and I was having the same problem.

Answer from bennythejudge on Stack Overflow
🌐
MLJAR
mljar.com › modulenotfounderror › no-module-named-boto3
No module named boto3
The Python complains that boto3 module can't be importend because its path is not present in your current Python path. When using Python srcipt in your terminal your output with error message might look like this: ... Traceback (most recent call last): File "<string>", line 1, in <module> ...
Discussions

Import "boto3" could not be resolved/Python, VS Code - Stack Overflow
I am working on my python project, wherefor I need to import the package called "boto3". Therefore I get this error tooltip: "Import "boto3" could not be resolved". I ... More on stackoverflow.com
🌐 stackoverflow.com
No module named 'boto3'
Hi, This may be a dumb question. I want to use boto3 library in the Lambda function (import boto3) but have encountered this error: ``` [2019-06-20T15:52:17.548-07:00][FATAL]-lambda_runtime.p... More on repost.aws
🌐 repost.aws
10
0
June 21, 2019
"ImportError: No module named boto" when Boto is installed on OS X.
I've been searching all night for a solution to this and nothing has worked so far. I have Python 2.7.8 installed, and boto is also installed on OS X 10.10.3. The problem is that unless I'm running as my root user, when I try to run the ... More on github.com
🌐 github.com
32
May 27, 2015
No module named 'boto3' (jupyter) - python3
Describe the bug import boto3 is failing on jupyter. ModuleNotFoundError: No module named 'boto3' Steps to reproduce import boto3 (base) BLDM3192-MAC:Downloads ksachdeva$ python -m pip inst... More on github.com
🌐 github.com
2
April 28, 2020
🌐
4sysops
4sysops.com › home › blog › articles › install boto3 (aws sdk for python) in visual studio code (vs code) on windows
Install Boto3 (AWS SDK for Python) in Visual Studio Code (VS Code) on Windows – 4sysops
January 19, 2024 - In this guide, I show you how to install Boto3, the AWS SDK for Python, in Microsoft's free Visual Studio Code (VS Code) on a Windows machine. This will allow you to automate in Amazon's cloud with the most popular scripting language on the planet.
🌐
Roboflow
roboflow.com › use opencv › modulenotfounderror: no module named 'boto3'
ModuleNotFoundError: no module named 'boto3' (OpenCV)
The ModuleNotFoundError: no module named 'boto3' error occurs when you have not installed the boto3 AWS package on your system.
🌐
AWS re:Post
repost.aws › questions › QUIVsDk3N5QOmXBZW5bdISbg › no-module-named-boto3
No module named 'boto3' | AWS re:Post
June 21, 2019 - Hi Visual, Greengrass doesn't follow ... file that you upload to Lambda. The easiest way to do this is to navigate to your own code and then do pip install -t ....
🌐
GitHub
github.com › boto › boto › issues › 3194
"ImportError: No module named boto" when Boto is installed on OS X. · Issue #3194 · boto/boto
May 27, 2015 - I've been searching all night for a solution to this and nothing has worked so far. I have Python 2.7.8 installed, and boto is also installed on OS X 10.10.3. The problem is that unless I'm running as my root user, when I try to run the ...
Published   May 27, 2015
Author   peterjohnjoseph
Find elsewhere
🌐
GitHub
github.com › boto › boto3 › issues › 2401
No module named 'boto3' (jupyter) - python3 · Issue #2401 · boto/boto3
April 28, 2020 - Describe the bug import boto3 is failing on jupyter. ModuleNotFoundError: No module named 'boto3' Steps to reproduce import boto3 (base) BLDM3192-MAC:Downloads ksachdeva$ python -m pip install --user boto3 Collecting boto3 Downloading ht...
Author   ksachdeva11
🌐
Reddit
reddit.com › r/vscode › vs code not recognising package in conda environment
r/vscode on Reddit: VS Code not recognising package in conda environment
May 25, 2021 -

I'm trying to run the following AWS notebooks inside my conda environment.

The first cell is:

import boto3
import sagemaker
from sagemaker import get_execution_role

ecr_namespace = "sagemaker-training-containers/"
prefix = "script-mode-container"

ecr_repository_name = ecr_namespace + prefix
role = get_execution_role()
account_id = role.split(":")[4]
region = boto3.Session().region_name
sagemaker_session = sagemaker.session.Session()
bucket = sagemaker_session.default_bucket()

print(account_id)
print(region)
print(role)
print(bucket)

When I try to run it I get this error - ModuleNotFoundError: No module named 'boto3'

I've pip installed boto3, sagemaker and all relevant dependencies inside my environment and confirmed with $conda list.

I've also checked which environment my interpreter is running and it seems to be the correct one with the required dependencies - Current: ~/anaconda3/envs/local_SageMaker/bin/python.

I had it working fine on windows so I'm confused as to why this isn't working on my linux side.

Does anyone have a solution as to how to get VS Code interpreter to recognise the packages in my conda environment?

🌐
Bobby Hadz
bobbyhadz.com › blog › python-no-module-named-boto3
ModuleNotFoundError: No module named 'boto3' in Python | bobbyhadz
April 8, 2024 - If the error persists, try restarting your IDE and development server/script. VSCode often glitches and a reboot resolves the issue. If the error is not resolved, try to use the Visual Studio Code terminal to install the boto3 module.
🌐
sebhastian
sebhastian.com › no-module-named-boto3
How to fix ModuleNotFoundError: No module named 'boto3' in Python | sebhastian
April 14, 2023 - In summary, the ModuleNotFoundError: No module named 'boto3' error occurs when the boto3 library is not available in your Python environment.
🌐
Researchdatapod
researchdatapod.com › home › how to solve python modulenotfounderror: no module named ‘boto3’
How to Solve Python ModuleNotFoundError: no module named 'boto3' - The Research Scientist Pod
February 19, 2022 - Second, within your python program, ... The modulenotfounderror occurs if you misspell the module name, incorrectly point to the module path or do not have the module installed in your Python environment....
🌐
Finxter
blog.finxter.com › fixed-modulenotfounderror-no-module-named-boto3
[Fixed] ModuleNotFoundError: No module named ‘boto3’ – Be on the Right Side of Change
December 10, 2021 - This is supposed to import the Pandas library into your (virtual) environment. However, it only throws the following ImportError: No module named boto3: >>> import boto3 Traceback (most recent call last): File "<pyshell#6>", line 1, in <module> import boto3 ModuleNotFoundError: No module named ...
🌐
Codegive
codegive.com › blog › import_boto3_not_working.php
"import boto3 not working" (2026): The Ultimate Troubleshooting Guide to AWS Python Success!
The error "import boto3 not working" (often manifesting as ModuleNotFoundError: No module named 'boto3') signifies that your Python interpreter cannot locate the boto3 library when attempting to execute import boto3 in your script or interactive session. This isn't a problem with the boto3 ...
🌐
Itsourcecode
itsourcecode.com › home › modulenotfounderror: no module named ‘boto3’
Modulenotfounderror: no module named 'boto3' [SOLVED]
April 4, 2023 - The most common cause of the error “ModuleNotFoundError: No module named ‘boto3’” is that the Boto3 module is haven’t been installed on your system.
🌐
GitHub
github.com › boto › boto3 › issues › 2475
Unable to import boto3 using Python 3.9.0b1 · Issue #2475 · boto/boto3
June 8, 2020 - Describe the bug Import boto3 using python3.9.0b1 gives ModuleNotFoundError Steps to reproduce Install python 3.9.0b1. On windows 10 using powershell Create a virtual environment ('C:\Program Files\Python39\python.exe' -m venv venv) inst...
Author   tigerrabbit
🌐
Edureka Community
edureka.co › home › community › categories › cloud computing › aws › importerror no module named boto3
ImportError No module named boto3 | Edureka Community
April 28, 2020 - Hi Guys, I am getting this below error, when I tried to import boto3 module in my python code. ... 1, in ImportError: No module named boto3