Skip to content

Commit

Permalink
Add pyenv environments up front in the command so students don't need…
Browse files Browse the repository at this point in the history
… to do it. (gsingers#5)

* test pip install

* pip stuff

* pip
  • Loading branch information
gsingers authored Jan 28, 2022
1 parent 71fce96 commit 358b958
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
output/
logstash-*
# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
7 changes: 7 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ RUN pip install ipython
RUN pip install urljoin
RUN pip install matplotlib
RUN pip install graphviz
RUN pip install bottleneck

RUN pyenv virtualenv 3.9.7 search_with_ml_opensearch
RUN pyenv virtualenv 3.9.7 search_with_ml_week1
RUN pyenv virtualenv 3.9.7 search_with_ml_week2
RUN pyenv virtualenv 3.9.7 search_with_ml_week3
RUN pyenv virtualenv 3.9.7 search_with_ml_week4



RUN curl -o logstash-oss-with-opensearch-output-plugin-7.13.2-linux-x64.tar.gz https://artifacts.opensearch.org/logstash/logstash-oss-with-opensearch-output-plugin-7.13.2-linux-x64.tar.gz
RUN tar -xf logstash-oss-with-opensearch-output-plugin-7.13.2-linux-x64.tar.gz
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,14 @@ The following things must be done each time you create a new Gitpod Workspace (u

At the command line, do the following steps to run the example. For purposes of demonstration, let's assume we are working on week 2. Substitute accordingly for the week you are working on.

1. Setup your Python Virtual Environment. We use `pyenv` (Pyenv website)[https://github.com/pyenv/pyenv] and `pyenv-virtualenv` (Pyenv Virtualenv)[https://github.com/pyenv/pyenv-virtualenv], but you can use whatever you are most comfortable with.
1. `pyenv install 3.9.7` -- Install Python 3.9.7 into PyEnv if it isn't installed already. (if you are running in Gitpod, this should already be installed.)
1. `pyenv virtualenv 3.9.7 search_with_ml_week2` -- Create a Virtualenv using that 3.9.7 install
1. `pyenv activate search_with_ml_week2` -- Activate that Virtualenv.
1. Install the Python dependencies: `pip install -r requirements_week2.txt`
1. Activate your Python Virtual Environment. We use `pyenv` (Pyenv website)[https://github.com/pyenv/pyenv] and `pyenv-virtualenv` (Pyenv Virtualenv)[https://github.com/pyenv/pyenv-virtualenv], but you can use whatever you are most comfortable with.
1. `pyenv activate search_with_ml_week2` -- Activate that Virtualenv. Substitute in whatever week you are working on.
1. Run Flask:
1. `export FLASK_ENV=development`
1. *_IMPORTANT_* Set the Flask App Environment Variable: `export FLASK_APP=week2`
1. `flask run --port 3000` (The default port of 5000 is already in use)
1. Open the Flask APP at `https://3000-<$GITPOD_URL>/`
1. Or run `ipython`

# Working locally (Not supported, but may work for you. YMMV)

Expand Down
13 changes: 12 additions & 1 deletion gitpod-command.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
ln -s /workspace/kaggle /home/gitpod/.kaggle

eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
mkdir -p /workspace/opensearch
mkdir -p /workspace/logstash
mkdir -p /workspace/datasets
sudo chown -R gitpod:gitpod /workspace/opensearch
sudo chown -R gitpod:gitpod /workspace/logstash
ln -s /home/gitpod/logstash-7.13.2 /workspace/logstash/logstash-7.13.2
pyenv activate search_with_ml_week1
pip install -r /workspace/search_with_machine_learning_course/requirements_week1.txt
pyenv activate search_with_ml_week2
pip install -r /workspace/search_with_machine_learning_course/requirements_week2.txt
pyenv activate search_with_ml_week3
pip install -r /workspace/search_with_machine_learning_course/requirements_week3.txt
pyenv activate search_with_ml_week4
pip install -r /workspace/search_with_machine_learning_course/requirements_week4.txt


cd docker
docker-compose up -d

0 comments on commit 358b958

Please sign in to comment.