AWS CLI not working because of unsupported Python version - python-3.x

I'm trying to download the AWS CLI tools onto my mac. The error message is pretty clear Unsupported Python version detected: Python 2.7 To continue using this installer you must use Python 3.6 or later. The issue I'm having is that aliasing python to python3 isn't working. For some reason, after aliasing, the installer still references Python 2.7.
After aliasing through the cli didn't work for installing AWS CLI, I added alias python=python3 to my .zshrc file. Running python --version returns Python 3.9.6. Running the AWS installer still references the older version of python.
I'm hesitant to completely override the older version, because I've read from multiple sources that the default python on OS X should not be touched.
Can someone explain how I can reference the newer version of python when installing the AWS CLI tools?

while installation, choosing python3 worked well for me. Choose the "To install the AWS CLI version using the bundled installer" from here: https://docs.aws.amazon.com/cli/v1/userguide/install-macos.html
sudo /usr/local/bin/python3 awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Replace /usr/local/bin/python3 with the path to your python binary with version >= 3.6.

My problem was that I was trying to download an old version of the awscli. After downloading the newest version I ran into some issues with the credentials file. Upon updating the credentials file and adding a config file in the .aws directory, everything worked as expected.

Related

Should i remove Python 3.6 while installing Python 3.8 or newer?

I tried to install a certain python module that required python 3.6 minimum to work properly so I checked my version using python --version which gave me the output of Python 2.7.17 and then used python3 --version giving me Python 3.6.9. Now, I know for a fact that i have Python 3.8 installed because I ran apt install python3.8 just before checking the version.
If someone wants to know what my system is running; I am currently running Elementary OS 5.1.7 Hera.
EDIT:
(IDK what term to use, I want to say I am done going through answers, and I liked none.)
After a while of whacking my brain, I decided not to uninstall the 3.6 version as It may have version specific modules which if removed may cause other installed programs to break.
Since I just use Linux for my college-work, It wont matter if more than one versions are installed anyway.
Sorry for any mistakes I may have made, I was never good at this kind of things.
Use conda to install and manage different versions of Python (or lots of other software, for that matter). Install different Python versions in separate conda environments. For example:
Find what python versions are available:
conda search python
Output (as of the time of writing, in the future I expect that the latest Python versions will be higher):
Loading channels: done
# Name Version Build Channel
python 1.0.1 0 conda-forge
python 1.2 0 conda-forge
...
python 3.9.0 h88f2d9e_1 pkgs/main
python 3.9.0 ha017127_4_cpython conda-forge
Install the Python versions you need in separate environments. Here, install Python 3.9.0 in environment named python39:
conda create --name python39 python=3.9.0
Switching environments is easy:
conda activate python39
# python is now 3.9.0
conda deactivate
# back to the default python
or (deprecated now):
source activate python39
source deactivate
SEE ALSO:
conda docs: Managing environments
This question is more appropriate for Unix & Linux.
Python installations (more generally, versioned installations of software) co-exist on linux using version numbers. You can likely run Python 3.8 using the python3.8 command (or else, locate where you installed it and run from there / add the location to the PATH environment variable to run directly).
Likewise, for each python version you can install its own package manager (e.g. install pip3.8 by python3.8 -m pip install pip) and use it to install packages for that python version. (As different projects require different sets of packages, the general practice is to create a "virtual environment", i.e. a separate copy of the needed version of python, pip and their package installation folders for each project, and install the required packages there - for more information see e.g. this excellent answer).
Regarding the command python3 (usually /usr/bin/python3) is just a symbolic link, you can replace it with the version you like (as long as it remains compatible with what the system expects - i.e. python3 of version no less than your built-in python3/python3-minimal, otherwise you will probably break something), e.g. assuming which python3 gives you /usr/bin/python3, you can
sudo rm /usr/bin/python3 #remove existing link
sudo ln /usr/bin/python3.8 /usr/bin/python3 # create a new link to the version of your choice
(although a better alternative could be instead aliasing it alias python3='/usr/bin/python3.8' and adding this to ~/.bashrc).
Whatever you do, do not uninstall python3-minimal as it is - at least, on Ubuntu - required by the system and uninstalling or changing it will likely break the system.

Upgradation to Python 3.7

I have Ubuntu 19.04 OS and I needed python 3.6 version so I somehow managed to get python3.6 on my device without removing python3.7 but now I would like to revert back to using python3.7. Can anyone suggest how to do it?
If you've got multiple version of Python installed, you can choose which one to use as default in update-alternatives:
sudo update-alternatives --config python3
, then follow the prompt instructions.
Try using virtual environments, namely anaconda for these kinds of things. I am not aware of any other methods. Anaconda basically creates a virtual environment in which you can specify the version of all packages including python itself

Using latest Python version

I am setting up a new computer and the current latest version of Python is Python 3.4.6. I am trying to update it to version 3.7.0 (the latest version at the time of writing).
I tried pyenv install 3.7.0 and it successfully installed.
But when I type $ python3 --version at the command line it still says Python 3.4.6.
When I type $ which python3 the path it shows is /.pyenv/shims/python3.
Navigating to that path I find that there also exists /.pyenv/shims/python3.7.
How do I point the python command to the newest install?
I know there are a million questions asking how to point python from Python 2.x to Python 3.x. But I have not found one showing how to point from Python 3.old to Python 3.new
I am using Linux OpenSuse.
Use the pyenv global command. In this case, it should be pyenv global 3.7.0. Check out the pyenv commands list for more info.

Does TensorFlow 1.9 support Python 3.7

I'm hesitating whether to downgrade to Python 3.6 or install a new version of TensorFlow.
Does TensorFlow 1.9 support Python 3.7?
I was able to install Tensorflow 1.12.0 with Python 3.7 on MacOS, with the following command.
sudo python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
Not yet. It seems there are some variables named "async", which has become a keyword in 3.7. Shouldn't be too difficult to fix, but still a problem.
Source: https://github.com/tensorflow/tensorflow/issues/20444
Probably not yet.
First of all, you will probably get a SyntaxError: invalid syntax because some parameters and variables at the pywrap_tensorflow_internal.py module have the name async which is a reserved keyword in Python 3.7.0 (see also this post).
However, you can solve this by simply changing the name of all these (Ctrl + R and Replace All) from async to for example async1.
The problem is that then you will probably get a ImportError: No module named '_pywrap_tensorflow_internal' which perhaps may be fixed for any previous version before Python 3.7.0 as this post on StackOverflow suggests but personally I could not fix it on my laptop with Python 3.7.0 .
Consequently, I simply downgraded to Python 3.6.6 and now Tensorflow is working fine.
There is a whl built here. However in my run it was cpu version.
https://www.lfd.uci.edu/~gohlke/pythonlibs/
as of Aug 26tH, there is an update on the tensorflow github site
https://github.com/tensorflow/tensorflow/pull/21202
Tensorflow 1.13.1 now supports Python 3.7.
According to the comments on github
see
https://github.com/tensorflow/tensorflow/issues/20517#issuecomment-457185528
by member av8ramit
"We are aiming to try and have Windows and Ubuntu python binaries by rc2 or the official."
the estimated release date for 2019-02-03
however on
https://github.com/winpython/winpython/issues/687
one can read from a winpython contributor:
"Tensorflow-2 is 2019, Tensorflow-1 on Python-3.7 is still not in sight"
Finally Worked for me!
On Python 3.6.4 (even 3.6.5 failed for me)
Install Python3.6.4 from here:
https://www.python.org/downloads/mac-osx/
If you're facing issues with Python pkgs that you already had on you older version just revert it using this post:
python location on mac osx
I found this to work after searching for a while.
As Tensorflow only supports Python 3.6 as of now, you can install a different version of python alongside your standard one. Here are the steps I followed:
Download the Python3.6 tgz file from the official website (eg. Python-3.6.6.tgz)
Unpack it with tar -xvzf Python-3.6.6.tgz
cd Python-3.6.6
run ./configure
run make altinstall to install it (install vs altinstall explanation here Difference in details between "make install" and "make altinstall")
You'll normally find your new python install under /usr/local/bin. Now you can create a new virtualenv specifying the python version with:
virtualenv --python=python3.6 env3.6
Get into the virtualenv running the command source env3.6/source/bin/activate.
Install tensorflow with the classic pip install tensorflow
Profit
First of all,
*conda create -n yourenvname python=3.6
*conda activate yourenvname
*pip install tensorflow
then it will work like rock.

Downloading Python Modules

I just installed Python3.4.2 yesterday on Windows 7. I tried typing out the command to download and install modules in the system terminal but I got Syntax Error. Within the terminal I typed: pip install pyPdf. Just wondering what my issue was.
Apparently, pyPdf is 2.x package
The raise syntax in Python 3.x no longer accepts comma-separated arguments
here is porting guide from 2.x to 3.x
http://docs.pythonsprints.com/python3_porting/py-porting.html

Resources