zhengruifeng commented on code in PR #54175:
URL: https://github.com/apache/spark/pull/54175#discussion_r2776716649
##########
dev/spark-test-image/python-314/Dockerfile:
##########
@@ -54,14 +54,17 @@ RUN apt-get update && apt-get install -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
+# Setup virtual environment
+ENV VIRTUAL_ENV=/opt/spark-venv
+RUN python3.14 -m venv --without-pip $VIRTUAL_ENV
+ENV PATH="$VIRTUAL_ENV/bin:$PATH"
Review Comment:
this is a AI-recommended approach, and the source is
https://pythonspeed.com/articles/activate-virtualenv-dockerfile/
```
FROM python:3.12-slim
RUN python3 -m venv /opt/venv
# This is wrong!
RUN . /opt/venv/bin/activate
# Install dependencies:
COPY requirements.txt .
RUN pip install -r requirements.txt
# Run the application:
COPY myapp.py .
CMD ["python", "myapp.py"]
```
it said the the normal way to activate venv only take effect in its `RUN`
command, I did try it though
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]