Throw ImportError: No module named boto3 in Python 3

Dung Do Tien Jun 10 2022 288

 Hello, I'm a newbie join to a Python project in my group. I only join to learning more about Python. Today I get code from Github and run but I got an error ImportError: No module named boto3.

 >>> import boto3
Traceback (most recent call last):
  File "projects/Python/first_project/main.py", line 2, in <module>
ImportError: No module named boto3

Project is using Python version 3.9.7. Visual code and Window 11.

Thank you for any help.

Have 2 answer(s) found.
  • h

    hanh Hoang Dinh Jun 10 2022

    I think you need re-install boto3 by using the command:

     pip3 install boto3

    This command is only used for Python 3. Because you said your project used Python version 3.9.7.

    Another case, may be useful for someone:

     # in a virtual environment or using Python 2
    pip install boto3
    
    # if you get permissions error
    sudo pip3 install boto3
    
    # if you don't have pip in your PATH environment variable
    python -m pip install boto3
    
    # for python 3 (could also be pip3.10 depending on your version)
    python3 -m pip install boto3
    
    # for Anaconda
    conda install -c conda-forge boto3

    Happy to help you!!!

  • B

    Binh Quoc Jun 10 2022

    I think boto3 module is missing from your system. Use the command below to install boto3.

     python -m pip install --user boto3

    Hope it is helpful for you.

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close