Pip / boto problems - ImportError: No module named boto3

20,962

Probably, the best way to deal with multiple python versions is to isolate them using virtualenv

This article covers it's basics and would give you a good overview http://docs.python-guide.org/en/latest/dev/virtualenvs/

Share:
20,962

Related videos on Youtube

SPRBRN
Author by

SPRBRN

Updated on September 18, 2022

Comments

  • SPRBRN
    SPRBRN over 1 year

    I want to get boto3 working in a python3 script. I can execute aws commands from the cli.

    1. After updating pip, it doesn't run with sudo rights unless I use the absolute path: /usr/local/bin/pip. Without sudo rights it works. I have no idea why it doesn't run under sudo, which it did before updating, as /usr/local/bin is in PATH.

    2. Should I run pip under sudo or not?

    3. I installed boto3, but still get ImportError: No module named 'boto3'. This is when I execute a script that runs python3. But it seems that boto3 is installed for python2.

    Output:

    $ sudo /usr/local/bin/pip install --upgrade boto3
    Requirement already up-to-date: boto3 in /usr/local/lib/python2.7/site-packages
    

    How do I get boto3 working with python3?

  • SPRBRN
    SPRBRN over 8 years
    Thanks. That fixes question 3. I still have to use the absolute path for pip, but that's not a major problem. And I'm still wondering whether to run pip as root or not.
  • Serhii Balbieko
    Serhii Balbieko over 8 years
    virtualenv by default lets you run it as regular user, as it installs packages inside an env and accessible for your current user