I have installed Python3 and pip3 on my Macbook pro.
Running python --version shows Python 3.6.3
Running pip --version shows pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
however running aws --version shows aws-cli/1.11.170 Python/2.7.10 Darwin/16.7.0 botocore/1.7.28
Looks like it's using python2. How do I fix this?
Why is it really an issue?
I assume you installed the AWS CLI tool by downloading the installer directly. If you want to "fix" it then uninstall the CLI tool, and then install it through pip with pip install awscli.
Related
this question is specifically for aws cloud9. Everything looks fine prima-facie, but it's creating a lot of problems.
When i am checking python version, it's showing the correct version (without using python3)
xxxx#yyyyy.zzz:~/environment $ python --version
Python 3.6.8
When i am using which python, it's showing the correct (desired) python version
xxxx#yyyy.zzz:~/environment $ which python
alias python='python36'
/usr/bin/python36
When i am checking pip version, it's showing pip version for python 3.6, but showing a very old version of pip.
xxxx#yyyy.zzz:~/environment $ python -m pip --version
pip 9.0.3 from /usr/lib/python3.6/dist-packages (python 3.6)
When i try to upgrade pip to new version, it goes to python2.7 now (undesirable)
xxx#yyyy.zzz:~/environment $ pip install --upgrade pip
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Requirement already up-to-date: pip in /usr/local/lib/python2.7/site-packages (20.0.2)
so, when i do a pip install of a desired package, it gets installed, but cannot use it in my program as it installs for python 2.7.
I have gone past this issue on my local windows computer a long time ago. However, this is a ec2 default environment that comes when setting up cloud9, and is a linux ubuntu dist (afaik).
Have tried to find out online, but couldn't get a simple answer. I could find answers relating to using virtualenv for these kind of issues. I am wondering if there is a simpler solution to this.
I finally resolved it by unaliasing "python" with python36.
unalias python
Then when i went to ask python version, it gave python 2.7 (as expected)
then i went for
sudo python3 -m pip install --upgrade pip
it finally worked and upgraded pip to latest.
then i could download other libraries using
python3 -m pip install <library-name>
Thanks Arun for your extensive help.
This solution may be a workaround, but it finally made it work. If anyone wants me to find the solution further, i am ready to engage.
python is an alias to point to python36. Looks like you have python 2 and python 3 installed.
python -m pip --version is returning the pip version pointing to python3 because python here refers to python3. If you try python2.7 -m pip --version it will return the pip version corresponding to python2.7
You should rather check pip --version to see the version of pip.
You could install your packages using pip3 install <package-name> or set an alias for pip to point to pip3
which pip3
Once you get the path of pip3, then you can create the alias
alias pip=`<path to pip3>
I am new to python (not new to programming) and unfortunately butchered my previous python 3.7 installation while figuring things out. Long story short, I ended up deleting and reinstalling pip3, which in turn made the standard pip command (for the 2.7 pre-installed version of python o macOS) not exist. I've managed to get both installed again but am concerned with their locations.
My question is regarding the locations of both pip and pip3 when running the pip --version as well as the pip3 --version command.
Below is the output for these commands:
pip --version
pip 19.3.1 from /Users/Wyatt/Library/Python/2.7/lib/python/site-packages/pip (python 2.7)
pip3 --version
pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)
I believe pip3 is in the correct location, but feel that the pip command should not be located inside of my user library, but the system library like pip3. Is this correct, and if not, how can I fix this?
On my local machine MacOs the default pip resides at the following location
pip --version
pip 19.3.1 from /Library/Python/2.7/site-packages/pip-19.3.1-py2.7.egg/pip (python 2.7)
And after installing python3 using HomeBrew brew install python3, pip3 location is the following.
pip3 --version
pip 19.3.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
I am on an Ubuntu virtual machine and I am trying to update my version of python on the command line. I followed the instructions here
and eventually ran $ sudo apt-get install python3.6 but when I run python3 --version it tells me my python version is 3.5.2
I am following a tutorial on heroku about building a web app using python for the server side and it says I need python3.6 installed. But when I got to the step where it was really needed, I found out it wasn't actually installed.
Any ideas?
Installing the python3.6 package doesn't touch your existing system Python installation. Python 3.5 is still installed as you saw by the output of $python3 --version. To invoke Python 3.6, you can use: $python3.6
AWS CLI Mavens,
Via macOS' Terminal, trying to install and configure AWS CLI on macOS Sierra 10.12.6 to use Python 3.6.2 instead of macOS' default, Python 2.7.10.
Although I rigorously followed AWS' instructions (http://docs.amazonaws.cn/en_us/cli/latest/userguide/cli-install-macos.html), including configuring ./bash_profile thus:
# Setting PATH for Python 3.6.x
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
and double-checking via **echo $PATH**
PATH=/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
When executing
$ aws --version
the result is always this:
aws-cli/1.10.60 Python/2.7.10 Darwin/16.7.0 botocore/1.4.50
Thank you in advance for any suggestions as to how to configure AWS CLI to ignore Python 2.7.10 and execute via Python 3.6.x.
Plane Wryter
In my case, I solved this problem via followings.
$ pip3 --version
pip 18.1 from {....} (python 3.6)
$ export PATH=~/.local/bin:~/Library/Python/3.6/bin:$PATH
$ pip3 install awscli --upgrade # without --user
$ aws --version
aws-cli/1.16.22 Python/3.6.5 Darwin/18.2.0 botocore/1.12.12
It sounds like you may have the awscli installed twice under different versions of Python, and the version installed on System Python is taking precedence.
Try running both of these commands and see if it shows up in both:
$ pip3 freeze | grep awscli
Then:
$ pip2 freeze | grep awscli
If it's listed in the latter, then run:
$ pip2 uninstall awscli
With a fresh install today, this is the output I get:
$ aws --version
aws-cli/1.11.162 Python/3.6.2 Darwin/15.6.0 botocore/1.7.20
I'm not very familiar with how AWS recommends installing Python on macOS, but the most flexible way in my opinion is to install pyenv via brew then manage your Python versions through pyenv. This allows you the flexibility of having multiple subversions of Python 2 and Python 3 installed simultaneously, as well as System Python. I would recommend this approach here as well.
I faced the same issue. Instead of fixing it, I altered my path and installed with brew. It was seamless and the fastest solution.
$brew install awscli
Then,
$aws --version
How did you install awscli? Did you use pip that comes with Python 3?
Check which pip you're using and use the one for Python 3 to install awscli.
I was able to get it work by doing this
export PATH=~/.local/bin:~/Library/Python/3.6/bin:$PATH
pip3 install awscli
I'm a new Python user. I'm having issues installing new modules for python 2.7. When I try installing a new module from PyCharm, I get the following error
Error: Python packaging tool 'pip' not found
Moreover, I'm a bit confuse about which Python version I'm actually using...
This is what I get when I type the following commands in the terminal.
$ which python
/usr/bin/python
$ echo $PYTHONPATH
PYTHONPATH:/usr/local/lib/python3/dist-packages/
$ python -V
Python 2.7.6
Everything seems a bit messed up to me...all the procedures I follow to install pip result in failure. The command
$ python get-pip.py
returns
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command
However, when I run that command, it tells me that there is no module named pip.
Please, how can I fix it? I need to work with Python 2.7 but I'm completely unable to install packages. Thanks.
EDIT I am using Ubuntu 14.04 LTS
You may be trying to install pip wrong. Depending on your version of linux there are several install methods that can be found here
for your version judging by your use of get.
try this one:
sudo apt-get install python-pip