Skip to content

Comments

Add example of dockerfile with creating new virtualenv#27522

Closed
ayushthe1 wants to merge 3 commits intoapache:mainfrom
ayushthe1:branch2
Closed

Add example of dockerfile with creating new virtualenv#27522
ayushthe1 wants to merge 3 commits intoapache:mainfrom
ayushthe1:branch2

Conversation

@ayushthe1
Copy link
Contributor


closes: #26881

Add a guide to the documentation about how to add your own python venv and install packages via requirements.txt ExternalPythonOperator

@boring-cyborg boring-cyborg bot added area:production-image Production image improvements and fixes kind:documentation labels Nov 5, 2022
@ayushthe1 ayushthe1 mentioned this pull request Nov 5, 2022
@potiuk
Copy link
Member

potiuk commented Nov 7, 2022

I think the dockerfile does not build - you can try to build it locally with docker build command and see what the problem is.

@ayushthe1
Copy link
Contributor Author

Screenshot from 2022-11-07 13-34-36
hey @stromal ,i am getting an error in dockerfile due to command COPY airflow/requirments.txt .Is the path specified here right or i need to do something else ?

@stromal
Copy link

stromal commented Nov 7, 2022

@ayushthe1
I just heave base folder that contains everything called airflow and it has requirements.txt to install staff that is the whole point of the ExternalPythonOperator.
tha Dockerfile outside of (at /home/ubuntu) that so it can acces all folders around the ubuntu system.

requirements.txt ex,.:

pandas==1.2.0
pymongo==3.11

@potiuk
Copy link
Member

potiuk commented Nov 7, 2022

Yeah - the requirements.txt files should also be added to the folder and referred to, (and also I think in the .rst doc you should include the content of the requirements.txt as separate exampleinclude.

@potiuk
Copy link
Member

potiuk commented Nov 7, 2022

BTW, This is the main purpose of the automated tests for those examples - we could have missed explanation and we would not explain that requirements.txt file is there, but the failing test actually pointed out that we also need it there (and add explanation on it)

@ayushthe1
Copy link
Contributor Author

hey @potiuk ,what should i add in the requirements.txt file ?

@potiuk
Copy link
Member

potiuk commented Nov 13, 2022

Can be anything neutral. I think we have a few places with similar things:

For example this is what we have in example_python_operator:

        @task.virtualenv(
            task_id="virtualenv_python", requirements=["colorama==0.4.0"], system_site_packages=False
        )

@stromal
Copy link

stromal commented Nov 14, 2022

@ayushthe1

numpy and pandas

@potiuk
Copy link
Member

potiuk commented Nov 14, 2022

@ayushthe1

numpy and pandas

I tihnk numpy and pandas are definitely too much for such an example. We have this page - if someone adds an example how to install numpy and pandas there, this is the right place:

https://airflow.apache.org/docs/docker-stack/recipes.html

The example that should be part of "creating a venv" is there to show mechanism not the way how to solve particular problems with installing numpy and pandas and they will cloud the purpose of that example.

If you think @stromal that numpy and pandas are needed, you can add a chapter to recipes but this is not the scope of this PR. Scope of this PR is to show how to create a virtualenv in the current base Docker image.

@potiuk
Copy link
Member

potiuk commented Nov 16, 2022

@ayushthe1 - shall we get it to completion :)?

@ayushthe1
Copy link
Contributor Author

@ayushthe1 - shall we get it to completion :)?

Should I add coloroma==0.4.0 in requirement.txt ?

@potiuk
Copy link
Member

potiuk commented Nov 18, 2022

@ayushthe1 - shall we get it to completion :)?

Should I add coloroma==0.4.0 in requirement.txt ?

Yes. Please.

@potiuk
Copy link
Member

potiuk commented Nov 23, 2022

Hey @ayushthe1 - are you finishing that one? We are about to release 2.5 and it would be great to get that one in

@ayushthe1
Copy link
Contributor Author

Hey @ayushthe1 - are you finishing that one? We are about to release 2.5 and it would be great to get that one in

Sorry, it's taking so much time to complete it. Currently my exams are going on and I will complete the work as soon as i get some free time.

@potiuk
Copy link
Member

potiuk commented Dec 5, 2022

gentle ping :)

@ayushthe1
Copy link
Contributor Author

gentle ping :)

sorry for the delay ,i will now start working back on this.

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Jan 26, 2023
@github-actions github-actions bot closed this Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:production-image Production image improvements and fixes kind:documentation stale Stale PRs per the .github/workflows/stale.yml policy file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add example of dockerfile with creating new virtualenv

3 participants