5

I'm trying to follow the instructions here but no matter what I do it seems to be stuck on using Python 2.7.1 which is causing me errors currently.

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install-osx.html

Attached is an image showing my logs of upgrading to the newest awsebccli but its still stuck saying 2.7.1 when it should say 3.6 (or newer)

What could I be doing wrong?

I want to note that I also installed the newest version of python3 and python via brew.

enter image description here

enter image description here

Here is the exact error I'm getting if it helps also.

enter image description here

Joseph Astrahan
  • 8,659
  • 12
  • 83
  • 154
  • I'm really new to this idea of a virtualenv, what exactly does that do? I'll do some research into it in meantime but not sure what to do with that info just yet. I'm looking over the link though to try and take it all in. – Joseph Astrahan Jan 06 '17 at 05:52
  • I suppose I should be asking how do I make this use the virtualenv for purposes of running eb local run? – Joseph Astrahan Jan 06 '17 at 05:54

1 Answers1

3

You do not want to upgrade the default python 2.7x installation or the python 3.x installation available on linux or OSX. There are usually lots of other libraries and applications that depend on this default installation. When you want to use a specific version of python the approach is to rely on a virtual enviorenment.

virtualenv is a tool to create isolated Python environments.

You are then leaving the system installation untouched. Getting the hang of virtualenv is quite easy. Once you create it (a one off task). All you need is to activate it and then you can use it as you would normally use the default python interpreter. How to copy packages from one virtualenv (or the system installation) to another is discussed here:

Installing python3 in a python2 virtual environment

Community
  • 1
  • 1
e4c5
  • 52,766
  • 11
  • 101
  • 134
  • Can you give an example how this would work for the amazon client? I'm still confused what to do exactly, very new to this. – Joseph Astrahan Jan 06 '17 at 05:57
  • just installed it using 'pip install virtualenv', that step is done so far. – Joseph Astrahan Jan 06 '17 at 05:59
  • watching a video here that really helped explained it for me (https://www.youtube.com/watch?v=N5vscPTWKOk), giving this a try, its a cool idea. – Joseph Astrahan Jan 06 '17 at 06:09
  • yes, you might have a few hours of trouble today but you will be saving a lot of grey hairs and many many hours of hard work in the long run. – e4c5 Jan 06 '17 at 06:12
  • 1
    Yeah that did the trick, once you source into the enviroment, I ran to install the aws elastic beanstalk client again like this, pip install --upgrade awsebcli, and now it says EB CLI 3.9.0 (Python 3.6.0), hurray! – Joseph Astrahan Jan 06 '17 at 06:12
  • Unfortunately it didn't fix my error lol, now it says... ERROR: JSONDecodeError :: Extra data: line 2 column 1 (char 61) – Joseph Astrahan Jan 06 '17 at 06:12
  • that's an unrelated issue. I think a new question is in order :-) – e4c5 Jan 06 '17 at 06:13
  • yes, I posted it here, http://stackoverflow.com/questions/41499676/upgrade-python-on-mac-from-2-7-to-3-6-or-newest-for-elastic-beanstalk-client-a – Joseph Astrahan Jan 06 '17 at 06:13
  • I just updated the question so if you looked already look again. – Joseph Astrahan Jan 06 '17 at 06:16
  • no I did post another question, http://stackoverflow.com/questions/41499676/upgrade-python-on-mac-from-2-7-to-3-6-or-newest-for-elastic-beanstalk-client-a – Joseph Astrahan Jan 06 '17 at 20:26
  • crap I gave wrong link no wonder..., http://stackoverflow.com/questions/41499034/error-running-dockerrun-aws-json-file-error-valueerror-extra-data – Joseph Astrahan Jan 06 '17 at 20:26