Suvro Choudhury
Suvro Choudhury

Reputation: 145

import boto3 error on Mac OS

I'm trying to install boto3 on my mac (high sierra 10.13.3) and tried to follow : https://github.com/boto/boto3. I had already installed python 3 using homebrew before, but when I tried to see pip --version, I get error. So, I did

1) modify .bash_profile to add

alias pip=pip3

2) verify

$ pip --version
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)

3)

$ pip install boto3
Collecting boto3
  Downloading boto3-1.5.36-py2.py3-none-any.whl (128kB)
    100% |████████████████████████████████| 133kB 474kB/s
Collecting botocore<1.9.0,>=1.8.50 (from boto3)
  Downloading botocore-1.8.50-py2.py3-none-any.whl (4.1MB)
    100% |████████████████████████████████| 4.1MB 376kB/s
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in ./Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in ./Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in ./Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: docutils>=0.10 in ./Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: six>=1.5 in ./Library/Python/3.6/lib/python/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.9.0,>=1.8.50->boto3)
Installing collected packages: botocore, boto3
  Found existing installation: botocore 1.8.20
    Uninstalling botocore-1.8.20:
      Successfully uninstalled botocore-1.8.20
Successfully installed boto3-1.5.36 botocore-1.8.50

4) just to make sure this was fine, I ran

$ pip3 install boto3
Requirement already satisfied: boto3 in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: botocore<1.9.0,>=1.8.50 in /usr/local/lib/python3.6/site-packages (from boto3)
Requirement already satisfied: docutils>=0.10 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: six>=1.5 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.9.0,>=1.8.50->boto3)

5) but, now when I ran import boto3 in Idle, I get error

import boto3
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import boto3
ModuleNotFoundError: No module named 'boto3'

I even tried to change path in .bash_profile, but it did not work. Thoughts?

Upvotes: 3

Views: 18280

Answers (2)

Mihai Gheoace
Mihai Gheoace

Reputation: 11

For those seeing this in 2023, check ImportError after successful pip installation, as noted by @Ankur Jyoti Phukan. For example, if you use also brew for package management, both the python3 and boto3 should be installed with boto3. When python3 already installed, for boto3 either:

python3 -m pip install boto3

or:

brew install python-boto3

Upvotes: 1

Javier Irraz&#225;bal
Javier Irraz&#225;bal

Reputation: 23

It worked for me to just copy all of packages with "bolo" in the name from the Python 3.7 folder to the Python 2.7 folder:

/usr/local/lib/python3.7/site-packages $ sudo cp -R boto* /Library/Python/2.7/site-packages/.

Upvotes: 1

Related Questions