Build a Python + OpenCV environment on Cloud9

This is the environment construction procedure when you want to create a Python + OpenCV development environment on AWS Cloud9. In particular, the various installation parts were troublesome, so I will summarize them. (I don't know if it's the best method, I'm sorry.)

Creating EC2

I created it with ʻEC2 instance type: t3.small`, but please choose any instance type and create it.

Extend a Cloud9 instance volume

The default volume for t3.small is 10GiB. If this is the case, the capacity will be insufficient at the stage of various installations, so expand the capacity. (If there is not enough space, No space left on device will be displayed during installation). Please refer to the following article for the extension procedure. https://qiita.com/ktrkmk/items/8cf1e100da2e717f3be2 I once expanded to 30 GiB.

Homebrew installation

Install with the following command.

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

It is said that there is no path, so execute the following commands in order to deal with it.

$ test -d ~/.linuxbrew && PATH="$HOME/.linuxbrew/bin:$HOME/.linuxbrew/sbin:$PATH"
$ test -d /home/linuxbrew/.linuxbrew && PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH"
$ test -r ~/.bash_profile && echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.bash_profile
$ echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.profile

Check if it can be executed. If the version is displayed, it's OK.

$ brew -v
Homebrew 2.2.11
Homebrew/linuxbrew-core (git revision 9d9624; last commit 2020-04-05)

Install pyenv

Install with the following command.

$ brew install pyenv

Check if it can be executed. If the version is displayed, it's OK.

$ pyenv -v
pyenv 1.2.18

Python installation

Specify the version you want to install and execute. (This time it is 3.8.1.)

$ pyenv install 3.8.1

Check if it is installed.

$ pyenv versions
* system (set by /home/ec2-user/.pyenv/version)
  3.8.1

3.8.1 is displayed, but since*is attached to system, change this.

$ pyenv global 3.8.1

confirm one more time.

$ pyenv versions
  system (set by /home/ec2-user/.pyenv/version)
* 3.8.1

It is OK if * is moved to 3.8.1.

Edit bash_profile

Check the Python version again here.

$ python --version
Python 3.6.10

You'll probably see the original Python version, so edit bash_profile to be able to run the Python version of pyenv.

$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
$ exec $SHELL -l

Check the Python version, and if it is reflected, it's OK.

$ python --version
Python 3.8.1

Install Open CV

Initially

$ brew install opencv

I tried to install it with this, but it didn't work ... So I used pip.

$ pip install opencv-python

To check if it is installed

$ python
>>> import cv2

If no message appears, it's OK. This completes the environment construction.

reference

https://qiita.com/nasuvitz/items/5eec6ab9444cff8e9467 https://prog-8.com/docs/python-env https://www.lifewithpython.com/2018/01/python-checking-version.html https://news.mynavi.jp/article/zeropython-34/ https://qiita.com/makki_maki04/items/f62c5e4e68709d9b3b89 https://dev.classmethod.jp/articles/aws-cloud9-pyenv/

Recommended Posts

Build a Python + OpenCV environment on Cloud9
Build a python3 environment on CentOS7
Build Python3 and OpenCV environment on Ubuntu 18.04
Build a python environment on MacOS (Catallina)
Simply build a Python 3 execution environment on Windows
Build a python environment with ansible on centos6
Build a Python environment on Mac (Mountain Lion)
Build Python environment on Windows
Build a Python development environment on your Mac
Build python environment on windows
Build a Python environment offline
Build a Python development environment on Raspberry Pi
Build a "Deep learning from scratch" learning environment on Cloud9 (jupyter miniconda python3)
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
# 2 Build a Python environment on AWS EC2 instance (ubuntu18.04)
Build a machine learning Python environment on Mac OS
Build a GVim-based Python development environment on Windows 10 (1) Installation
Build a Python development environment on Mac OS X
Build a Python environment on your Mac using pyenv
Build a Python development environment using pyenv on MacOS
How to build a Python environment on amazon linux 2
Building a Python environment on Mac
Create a Python environment on Mac (2017/4)
Create a python environment on centos
Build Python 3.8 + Pipenv environment on Ubuntu 18.04
OpenCV3 & Python3 environment construction on Ubuntu
Build a python machine learning study environment on macOS sierra
Build a machine learning environment on mac (pyenv, deeplearning, opencv)
How to build a new python virtual environment on Ubuntu
Build an Ubuntu python development environment on Google Cloud Platform
Build a python data analysis environment on Mac (El Capitan)
Build a GVim-based Python development environment on Windows 10 (2) Basic settings
Build a python environment on CentOS 7.7 for your home server
Python 2.7, 3.4, 3.5 extension module build environment on Windows
I want to build a Python environment
Creating a python virtual environment on Windows
Created Ubuntu, Python, OpenCV environment on Docker
Build Python environment with Anaconda on Mac
Create an OpenCV3 + python3 environment on OSX
Build a python virtual environment with pyenv
Build a modern Python environment with Neovim
Build a game leaderboard on Alibaba cloud using Python and Redis
Build a Python environment on your Mac with Anaconda and PyCharm
# 3 Build a Python (Django) environment on AWS EC2 instance (ubuntu18.04) part2
build Python on Ubuntu
Create a Python environment
Build a LAMP environment on your local Docker
Build a WardPress environment on AWS with pulumi
Build python environment with pyenv on EC2 (ubuntu)
[Python] Build a Django development environment with Docker
Create a python3 build environment with Sublime Text3
Build a simple Python virtual environment without pyenv
[Venv] Create a python virtual environment on Ubuntu
Build Python3 + flask environment on GCP Compute Engine
Build a Kubernetes environment for development on Ubuntu
Quickly build a Python Django environment with IntelliJ
Building a Python environment on a Sakura VPS server
Create a Python execution environment on IBM i
Create a Python virtual development environment on Windows
Build a Python machine learning environment with a container
Build a python execution environment with VS Code