Search code examples
pythonamazon-web-servicesamazon-ec2anacondaaws-cloud9

Configure AWS Cloud9 to use Anaconda Python Environment


I want AWS Cloud9 to use the Python version and specific packages from my Anaconda Python environment. How can I achieve this? Where should I look in the settings or configuration?

My current setup: I have an AWS EC2 instance with Ubuntu Linux, and I have configured AWS Cloud9 to work with the EC2 instance.

I have Anaconda installed on the EC2 instance, and I have created a conda Python3 environment to use, but Cloud9 always wants to use my Linux system's installed Python3 version.


Solution

  • I finally found something that forces AWS Cloud9 to use the Python3 version installed in my Anaconda environment on my AWS EC2 instance.

    The instructions to create a custom AWS Cloud9 runner for Python are here:

    {
        "cmd" : ["/home/ubuntu/anaconda3/envs/ijackweb/bin/python3.6", "$file", "$args"],
        "info" : "Running $project_path$file_name...",
        "selector" : "source.py"
    }
    

    I just create a new runner and paste the above code in there, and Cloud9 runs my application with my Anaconda environment's version of Python3.

    The only thing I don't understand about the above code is what the "selector": "source.py" line does.