I run the following command to install pandas via pip:
sudo pip install pandas --upgrade
which outputs
Requirement already up-to-date: pandas in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
Requirement already up-to-date: numpy>=1.7.0 in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from pandas)
Requirement already up-to-date: python-dateutil>=2 in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from pandas)
Requirement already up-to-date: pytz>=2011k in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from pandas)
Requirement already up-to-date: six>=1.5 in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from python-dateutil>=2->pandas)
However, when I use python3 in the command line, I cannot import pandas:
$ python3
>>> import pandas
>>> Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'pandas'
It appears that this is in the correct location, as
which python3
is in the following location:
/opt/local/bin/python3
Executing within python3
>>> import sys
>>> print(sys.version)
outputs
'3.4.5 (default, Jun 27 2016, 04:57:21) \n[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]'
Why can't I import pandas?
EDIT: I'm using pip version pip3:
pip --version
outputs
pip 8.1.2 from /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (python 3.4)
Looks like your OS uses pip2 by default. This could be checked by typing:
$ pip --version
pip 8.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)
Try to use pip3 command like that:
sudo pip3 install pandas --upgrade
Related
On Windows 10 pro, I am running a docker image with python and jupyter installed. I can start the docker image and from that shell start the jupyter notebook fine. Both python2 and python3 kernels are available. PIL and Pillow are installed but I cannot import them. See below:
(I have indicated the contents of each jupyter cell with double asterisks.
The result of each cell then simply follows below it)
**!pip install Image**
Requirement already satisfied: Image in /usr/local/lib/python3.6/dist-packages (1.5.27)
Requirement already satisfied: pillow in /usr/lib/python3/dist-packages (from Image) (5.1.0)
Requirement already satisfied: django in /usr/local/lib/python3.6/dist-packages (from Image) (2.2)
Requirement already satisfied: sqlparse in /usr/local/lib/python3.6/dist-packages (from django->Image) (0.3.0)
Requirement already satisfied: pytz in /usr/lib/python3/dist-packages (from django->Image) (2018.3)
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
**!pip install Pillow**
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (5.1.0)
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
**!python -m pip install pillow**
Requirement already satisfied: pillow in /usr/lib/python3/dist-packages (5.1.0)
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
**import PIL**
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-7-70d569469e06> in <module>()
----> 1 import PIL
ImportError: No module named PIL
**import PIL.Image**
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-8-df3f6661ddbf> in <module>()
----> 1 import PIL.Image
ImportError: No module named PIL.Image
**import pillow**
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-11-e32915389b2c> in <module>()
----> 1 import pillow
ImportError: No module named pillow
But when I exit the notebook and start an interactive python session in the running docker container, PIL is found easily:
root#7092fc2336d3:/# python
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL
>>>
well this is weird. It turns out that the pip in jupyter was installing in the python3 site packages but the python in the jupyter notebook was looking in the python2 site packages. so when I installed pillow in a jupyter cell like so
!/usr/bin/python2.7 -m pip install Pillow
now this works
import PIL.Image
I am working on jupyter-notebook.
When i give the command
import pandas
df = pandas.read_csv('/home/pglab1/WiFi Strength_Mar06.csv')
print(df)
it shows the following error:
ImportError Traceback (most recent call last)
<ipython-input-39-b8728196942c> in <module>()
----> 1 import pandas
2 df = pandas.read_csv('/home/pglab1/WiFi Strength_Mar06.csv')
3 print(df)
/usr/local/lib/python2.7/dist-packages/pandas/__init__.py in <module>()
21
22 # numpy compat
---> 23 from pandas.compat.numpy import *
24
25 try:
/usr/local/lib/python2.7/dist-packages/pandas/compat/numpy/__init__.py in <module>()
20 'your numpy version is {0}.\n'
21 'Please upgrade numpy to >= 1.12.0 to use '
---> 22 'this pandas version'.format(_np_version))
23
24
ImportError: this version of pandas is incompatible with numpy < 1.12.0
your numpy version is 1.11.0.
Please upgrade numpy to >= 1.12.0 to use this pandas version
in the same notebook, when I give the command,
!pip install pandas,
the output is
Requirement already satisfied: pandas in /usr/local/lib/python2.7/dist-packages (0.24.1)
Requirement already satisfied: python-dateutil>=2.5.0 in /usr/local/lib/python2.7/dist-packages (from pandas) (2.6.1)
Requirement already satisfied: numpy>=1.12.0 in /usr/local/lib/python2.7/dist-packages (from pandas) (1.16.2)
Requirement already satisfied: pytz>=2011k in /usr/lib/python2.7/dist-packages (from pandas) (2014.10)
Requirement already satisfied: six>=1.5 in /usr/lib/python2.7/dist-packages (from python-dateutil>=2.5.0->pandas) (1.10.0)
cheetah 2.4.4 requires Markdown>=2.0.1, which is not installed.
You are using pip version 10.0.0, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I am not familiar with software environment, so kindly help me how to correct this.( The problem is Pandas require a numpy package >1.12.0 but the numpy package in .../dist-packages is 1.16.2. this is my understanding)
This works in such situations
import sys
!{sys.executable} -m pip install numpy
Try:
pip install --upgrade pip
pip install markdown
pip install --upgrade numpy
pip install pandas
You might want to install using the following command:
import sys
!{sys.executable} -m pip install pandas
rather than just !pip install pandas - this will ensure that you are using the right pip for associated with the kernel.
I can't seem to import panda package. I use Visual Studio code to code. I use a mac and have osX 10.14 Majove.
The code that i am trying to compile is :
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
house_data = pd.read_csv('house.csv')
plt.plot(house_data['surface'], house_data['loyer'], 'ro', markersize=4)
plt.show()
When I try to use pip install pandas i get on my terminal :
(base) pip install pandas
Requirement already satisfied: pandas in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.24.0)
Requirement already satisfied: pytz>=2011k in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (2018.9)
Requirement already satisfied: python-dateutil>=2.5.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (2.7.5)
Requirement already satisfied: numpy>=1.12.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (1.15.3)
Requirement already satisfied: six>=1.5 in /Users/Library/Python/3.7/lib/python/site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)
(base) Thibaults-MBP-5d47:ML_folder thibaultmonsel$
Then when i execute my code i get :
Traceback (most recent call last):
File "ML1.py", line 5, in <module>
import pandas as pd
ImportError: No module named pandas
After if i try sudo pip install pandas i get :
(base) MBP-5d47:ML_folder $ sudo pip3 install pandas --upgrade
Password:
The directory '/Users/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory.If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pandas
Downloading https://files.pythonhosted.org/packages/34/63/529fd1391044051514f2f22d61754245db2133cd37c4dad7150a1cbe2ece/pandas-0.24.1-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (15.9MB)
100% |████████████████████████████████| 15.9MB 901kB/s
Requirement already satisfied, skipping upgrade: python-dateutil>=2.5.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (2.7.5)
Requirement already satisfied, skipping upgrade: numpy>=1.12.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (1.15.3)
Requirement already satisfied, skipping upgrade: pytz>=2011k in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (2018.9)
Requirement already satisfied, skipping upgrade: six>=1.5 in /Users/Library/Python/3.7/lib/python/site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)
Installing collected packages: pandas
Found existing installation: pandas 0.24.0
Uninstalling pandas-0.24.0:
Successfully uninstalled pandas-0.24.0
Successfully installed pandas-0.24.1
However, i still get no modules named pandas
Lastly, when i try pip3 install pandas i get :
Requirement already satisfied: pandas in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.24.0)
Requirement already satisfied: pytz>=2011k in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (2018.9)
Requirement already satisfied: numpy>=1.12.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (1.15.3)
Requirement already satisfied: python-dateutil>=2.5.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (2.7.5)
Requirement already satisfied: six>=1.5 in /Users/Library/Python/3.7/lib/python/site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)
When i try to execute the program i get the same error mentioned above after using pip3 install pandas....
I also did an import.sys if can help :
base)-MBP-5d47:ML_folder $ python help1.py
2.7.10 (default, Aug 17 2018, 17:41:52)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)]
Here is also my sys.path :
['/Users/Desktop/ML_folder', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Python/2.7/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC']
You need to install pandas with:
pip install pandas
If you run into issues with privileges, you may need to run:
sudo pip install pandas
It is also possible on Python 3 that you may need to run:
pip3 install pandas (although pip may be pointing to pip3 already). You can read about differences between pip versions on this SO post.
If you don't have pip installed, see here for installation.
Check pandas package path from your env with:
jupyter kernelspec list
If you see the path:
/Users/yourname/Library/Jupyter/kernels/yourenv
Delete that Jupyter folder from Library and run again.
if you see such this in your IDE and the error "no module named pandas" when you run your code, it means that pandas has not been installed although you have done "pip install pandas" or whatever.
Go to file > settings > project interpreter and see if pandas is available in the list of packages. if not simply click + (plus), choose pandas and install it in your project environment .
see picture
then wait for you IDE update your project skeletons ... voila , the error disappears !
When entering the command to run your file, make sure you specify which version of python you're using. For example, instead of python filename.py, use python3 filename.py or python2 filename.py
your pandas is installed in python3 (3.7):
Requirement already satisfied: pandas in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.24.0)
but you are running python2.7 and pandas isn't in your path 2.7:
['/Users/thibaultmonsel/Desktop/ML_folder',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/Library/Python/2.7/site-packages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC']
try to simply run your script using python3:
python3 help1.py
or add python3 header, example:
#!/usr/bin/env python3
or
#!/usr/local/bin/python3
and if that doesn't work (like I had the same problem because I was importing pandas from jupyter notebook, macos), you can ultimately import from your --user path, example:
sys.path.append("/Users/<USER>/Library/Python/3.7/lib/python/site-packages")
but make sure you have pandas installed there (..python/site-packages/pandas) using
pip3 install pandas --user
Check your virtual environment (you can see it at the left corner of VS code) and install the package (e.g. pandas) in your virtual environment like this:
conda install -n yourenvname [package]
install pandas outside the project, I wanted to download it only for an env environment but I got the same error so I did it from outside.
Code > Preferences > Settings
In Search, type "interpreter"
You will see a bar : Python: Default Interpreter Path
Paste your correct path to Python (something like "/usr/local/bin/python3" in Mac), it will automatically save
Then go back to your python file and try to run
For me, the below command works in MAC
sudo -H pip3 install pandas --upgrade
I have only very rudimentary experience in Python. I am trying to install the package pyslim (see here on the pypi website). I did
$ pip install pyslim
Requirement already satisfied: pyslim in ./Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg (0.1)
Requirement already satisfied: msprime in /usr/local/lib/python2.7/site-packages (from pyslim) (0.6.1)
Requirement already satisfied: attrs in /usr/local/lib/python2.7/site-packages (from pyslim) (16.3.0)
Requirement already satisfied: svgwrite in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (1.1.12)
Requirement already satisfied: jsonschema in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (2.6.0)
Requirement already satisfied: six in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (1.10.0)
Requirement already satisfied: numpy>=1.7.0 in /usr/local/lib/python2.7/site-packages/numpy-1.10.4-py2.7-macosx-10.11-x86_64.egg (from msprime->pyslim) (1.10.4)
Requirement already satisfied: h5py in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (2.8.0)
Requirement already satisfied: pyparsing>=2.0.1 in /usr/local/lib/python2.7/site-packages (from svgwrite->msprime->pyslim) (2.2.0)
Requirement already satisfied: functools32; python_version == "2.7" in /usr/local/lib/python2.7/site-packages (from jsonschema->msprime->pyslim) (3.2.3.post2)
But when I open python and try to import pyslim, it fails
> import pyslim
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/remi/Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg/pyslim/__init__.py", line 4, in <module>
from pyslim.slim_metadata import * # NOQA
File "/Users/remi/Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg/pyslim/slim_metadata.py", line 1, in <module>
import attr
ImportError: No module named attr
So, I did
$ pip install attr
Requirement already satisfied: attr in /usr/local/lib/python2.7/site-packages (0.3.1)
and
$ pip install attrs
Requirement already satisfied: attrs in /usr/local/lib/python2.7/site-packages (16.3.0)
I restarted python and tried to import pyslim again but I keep receiving the same error message. I also tried to download and install the files from github by doing
$ git clone https://github.com/tskit-dev/pyslim.git
$ cd pyslim
$ python setup.py install --user
as indicated here on the pypi website. On this last line of code, I get a long output ending with
Download error on https://pypi.python.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) -- Some packages may not be found!
No local packages or download links found for attrs
error: Could not find suitable distribution for Requirement.parse('attrs')
I am using Python 2.7.10 on a MAC OSX 10.11.6. Not sure if it matter but I usually install things with homebrew. I am using pip 18.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7).
Edit
$ which python
/usr/bin/python
$ which pip
/usr/local/bin/pip
Take a look to this other question that is related to the attrs package.
In your case, you have attr and attrs installed at the same time, and they are incompatible between them, so python is unable to resolve the package name on the import correctly.
You should use attrs only, so try uninstalling attr and try it again:
python -m pip uninstall attr
If, in the future, you need to have some packages incompatibles between them, take a look about using virtual environments in Python, which are really easy to use and will be very useful to play with packages and packages versions without break anything.
First uninstall pyslim. Use "pip uninstall pyslim". Then try installing again using
"conda install -c conda-forge pyslim"
Refer https://anaconda.org/conda-forge/pyslim
Why python is not finding boto3 when pip or pip3 shows it's installed.
I'm on Mac machine. Tried pip/pip3 with / without sudo. Tried changing the PATH variable as well with few paths but no luck.
PATH: /Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/arun/.sdkman/candidates/gradle/current/bin:/Users/arun/aks/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
and
$ python -c 'import sys; print sys.path'|tr ',' '\012'
[''
'/Library/Python/2.7/site-packages/RBTools-0.5.7-py2.7.egg'
'/Library/Python/2.7/site-packages/wfawsclitools-0.1-py2.7.egg'
'/Library/Python/2.7/site-packages/PyYAML-3.12-py2.7-macosx-10.12-intel.egg'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload'
'/Library/Python/2.7/site-packages'
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python'
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC']
and
$ python -m site
sys.path = [
'/Users/arun/ubuntu-vagrant-box',
'/Library/Python/2.7/site-packages/RBTools-0.5.7-py2.7.egg',
'/Library/Python/2.7/site-packages/wfawsclitools-0.1-py2.7.egg',
'/Library/Python/2.7/site-packages/PyYAML-3.12-py2.7-macosx-10.12-intel.egg',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/Library/Python/2.7/site-packages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
]
USER_BASE: '/Users/arun/Library/Python/2.7' (doesn't exist)
USER_SITE: '/Users/arun/Library/Python/2.7/lib/python/site-packages' (doesn't exist)
ENABLE_USER_SITE: True
Steps I ran so far:
[arun#ip-10.11.33-65 ~/aks] $ pip install --upgrade pip
Requirement already up-to-date: pip in /usr/local/lib/python2.7/site-packages
[arun#ip-10.11.33-65 ~/aks] $ pip install boto3
Requirement already satisfied: boto3 in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: botocore<1.6.0,>=1.5.0 in /usr/local/lib/python2.7/site-packages (from boto3)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /usr/local/lib/python2.7/site-packages (from boto3)
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in /usr/local/lib/python2.7/site-packages (from boto3)
Requirement already satisfied: docutils>=0.10 in /usr/local/lib/python2.7/site-packages (from botocore<1.6.0,>=1.5.0->boto3)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /usr/local/lib/python2.7/site-packages (from botocore<1.6.0,>=1.5.0->boto3)
Requirement already satisfied: futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" in /usr/local/lib/python2.7/site-packages (from s3transfer<0.2.0,>=0.1.10->boto3)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python2.7/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.6.0,>=1.5.0->boto3)
[arun#ip-10.11.33-65 ~/aks] $ pip3 install boto3
Requirement already satisfied (use --upgrade to upgrade): boto3 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages
Requirement already satisfied (use --upgrade to upgrade): s3transfer<0.2.0,>=0.1.0 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from boto3)
Requirement already satisfied (use --upgrade to upgrade): botocore<1.5.0,>=1.4.1 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from boto3)
Requirement already satisfied (use --upgrade to upgrade): jmespath<1.0.0,>=0.7.1 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from boto3)
Requirement already satisfied (use --upgrade to upgrade): docutils>=0.10 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from botocore<1.5.0,>=1.4.1->boto3)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil<3.0.0,>=2.1 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from botocore<1.5.0,>=1.4.1->boto3)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.5.0,>=1.4.1->boto3)
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[arun#ip-10.11.33-65 ~/aks] $ which python
/usr/bin/python
[arun#ip-10.11.33-65 ~/aks] $ `which python` --version
Python 2.7.10
[arun#ip-10.11.33-65 ~/aks] $ python
Python 2.7.10 (default, Jul 30 2016, 19:40:32)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named boto3
>>> ^D
[arun#ip-10.11.33-65 ~/aks] $
On the other side, if I run python3, it works for import boto3 but not import boto.
Install like this:
python -m pip install --user boto3
I ran into this same issue the other day. I had python 2.7 installed on my Mac (there by default I presume). I then installed homebrew and used it to get the latest version of python setup: brew install python
Then, I had two versions of python, which is okay. Brew installed pip3 along with Python 3.6.5.
So then, I was able to run this to get boto3: pip3 install boto3
To ensure that it is accessible, use the python3 command, not the older python. So in my case, I ran my code with:
python3 signURL.py
Just in case this worked for me after upgrading to ansible 2.4.0.0:
pip install --upgrade --user boto3
That recreated my $HOME/Library/Python/2.7/lib/python/site-packages
so I'm an uber noob at python, doing something for work but posting just in case this helps someone... I had the same error and all it was was that I had everything downloaded under python3 and I was typing the python some_script.py causing the:
File "some_script.py", line 4, in <module>
import boto3
changing it to python3 some_script.py fixed it/found the proper module