- Install pyenv (kivabe korben niche dewa ase)
- Install python 3.8.6 using pyenv (Pyevn cheat sheet added below)
- Install vscode
- Install following extentions in vscode:
chrmarti.regex donjayamanne.githistory dzhavat.bracket-pair-toggler eamodio.gitlens GrapeCity.gc-excelviewer humao.rest-client ionutvmi.path-autocomplete iterative.dvc mechatroner.rainbow-csv ms-azuretools.vscode-docker ms-python.autopep8 ms-python.flake8 ms-python.isort ms-python.pylint ms-python.python ms-python.vscode-pylance ms-toolsai.jupyter ms-toolsai.jupyter-keymap ms-toolsai.jupyter-renderers ms-toolsai.vscode-jupyter-cell-tags ms-toolsai.vscode-jupyter-slideshow ms-vscode-remote.remote-containers ms-vscode-remote.remote-ssh ms-vscode-remote.remote-ssh-edit ms-vscode.remote-explorer njpwerner.autodocstring PKief.material-icon-theme Shan.code-settings-sync shardulm94.trailing-spaces shd101wyy.markdown-preview-enhanced VisualStudioExptTeam.intellicode-api-usage-examples VisualStudioExptTeam.vscodeintellicode wayou.vscode-todo-highlight yzhang.markdown-all-in-one
- Create virtual environment (kivabe korben niche dewa ase)
- Install all python required libs-
pip install -r requriements.txt
-
Open windows powershell and run this command:
Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"
-
If you are getting any UnauthorizedAccess error as below then start Windows PowerShell with the Run as administrator option and run -
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
-
Then re-run the previous powershell link code.
-
For more details visit this link.
- If you wish to install a specific release of Pyenv rather than the latest head, set the PYENV_GIT_TAG environment variable (e.g. export
PYENV_GIT_TAG=v2.2.5
).curl https://pyenv.run | bash
- For more details visit this link.
Here's a cheat sheet of some commonly used commands with pyenv:
-
To list all the available Python versions that can be installed with pyenv:
pyenv install --list
-
pyenv install: Install a specific Python version.
pyenv install <version>
-
pyenv versions: List all installed Python versions.
pyenv versions
-
pyenv global: Set the global Python version to be used.
pyenv global <version>
-
pyenv local: Set a Python version for the current directory.
pyenv local <version>
-
pyenv shell: Set a Python version for the current shell session.
pyenv shell <version>
-
pyenv uninstall: Uninstall a specific Python version.
pyenv uninstall <version>
-
pyenv rehash: Rehash the installed executables.
pyenv rehash
-
pyenv which: Display the full path to the executable of a Python version.
pyenv which <version>
-
pyenv exec: Run a command using a specified Python version.
pyenv exec <version> <command>
-
Install and create virtual environment:
pip install virtualenv python -m venv mlops_env
-
Activate it: Linux:
source mlops_env/bin/activate
Windows:
C:\Users\path\mlops_env\Scripts\activate
All about EDA. Check notebook folder.
- Install Docker.
- Download apache airflow YAML file Link
- Update yaml file and add dockerfile (provided updated files in repo)
- Init Airflow:
docker-compose up airflow-init
- Start Airflow services
docker-compose up
- Stop Airflow
docker-compose down
- For Cornjob stuff : https://crontab.guru/
- Scheduler Doc : https://airflow.apache.org/docs/apache-airflow/1.10.1/scheduler.html
- install black
pip install black
- fix code format. black then code directory.
black .\dags\airline_price.py
- airflow docker-compose up issue. Showing this error message:
File "/usr/local/lib/python3.9/logging/config.py", line 571, in configure mlops-airflow-webserver-1 | raise ValueError('Unable to configure handler ' mlops-airflow-webserver-1 | ValueError: Unable to configure handler 'processor'
Solution : create logs, dags, data, config, plugins folder manually.
-
Open the IAM console at https://console.aws.amazon.com/iam/.
-
On the navigation menu, choose Users.
-
Choose your IAM user name (not the check box).
-
Open the Security credentials tab, and then choose Create access key.
-
To see the new access key, choose Show. Your credentials resemble the following:
Access key ID: AKIAIOSFODNN7EXAMPLE Secret access key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
-
To download the key pair, choose Download
.csv
file. Store the.csv
file with keys in a secure location.
for more details : https://docs.aws.amazon.com/powershell/latest/userguide/pstools-appendix-sign-up.html
We will use mlflow for experiment tracking and model deploying. MLFlow official doc: https://mlflow.org/docs/latest/index.html
- Updated dag
- docker-compose YAML file updated
- AWS credential added inside YAML file
- RUN docker compose
- To build the Docker image, navigate to the directory containing the Dockerfile and run the following command:
docker build -t mlflow-server -f Docker-mlflow .
- Once the image is built, you can run the MLflow server using the following command:
docker run -p 5000:5000 -v mlflow:/mlflow mlflow-server
MLflow stopped working after docker-compose up without any error. But work properly without Airflow. π
Solution: Reason was there was no space in my C drive for running it. I reomved few big files. and restarted the docker. I worked with the issue.
- We solved MLFlow docker issue
- Then we discuss about DVC
- DVC install
pip install dvc
- Init DVC
dvc init
- data versioning
dvc add data/ git add data.dvc
- model versioning
dvc add models/
- Discussion about data drift
- Evidently code added into pipeline (https://www.evidentlyai.com/)
- requirement file updated
- Model deploy with Flask & Docker
- Prepare Docker-app to deploy flask app
- Added flask app code and requirement
- Test notebook added
- Build command:
docker image build -t flaskapp -f .\Docker-app .
- Run command:
docker run -p 80:80 -t flaskapp