Skip to content

Commit 1e3b8eb

Browse files
authored
fix: Fix installing dependencies via pip in project template (#977)
- closes #975
1 parent 0b5e478 commit 1e3b8eb

File tree

1 file changed

+5
-5
lines changed
  • src/crawlee/project_template/{{cookiecutter.project_name}}

1 file changed

+5
-5
lines changed

src/crawlee/project_template/{{cookiecutter.project_name}}/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ RUN echo "Python version:" \
2929
&& echo "Installing dependencies:" \
3030
# Export packages from poetry.lock
3131
&& poetry export -f requirements.txt --without-hashes | \
32-
# Replace playwright version so that it matches whatever is pre-installed in the image
33-
sed "s/^playwright==.*/playwright==$(playwright --version | cut -d ' ' -f 2)/" | \
32+
# Replace playwright version so that it matches whatever is pre-installed in the image (the `hash` checks if playwright is installed)
33+
sed "s/^playwright==\(.*\)/playwright==$(hash playwright 2>/dev/null && (playwright --version | cut -d ' ' -f 2) || echo '\1')/" | \
3434
# Install everything using pip (ignore dependency checks - the lockfile is correct, period)
3535
pip install -r /dev/stdin --no-dependencies \
3636
&& echo "All installed Python packages:" \
@@ -48,9 +48,9 @@ RUN echo "Python version:" \
4848
&& python --version \
4949
&& echo "Installing dependencies:" \
5050
# Install everything using pip, set playwright version so that it matches whatever is pre-installed in the image
51-
cat requirements.txt \
52-
# Replace playwright version so that it matches whatever is pre-installed in the image
53-
sed "s/^playwright==.*/playwright==$(playwright --version | cut -d ' ' -f 2)/" | \
51+
&& cat requirements.txt | \
52+
# Replace playwright version so that it matches whatever is pre-installed in the image (the `hash` checks if playwright is installed)
53+
sed "s/^playwright==\(.*\)/playwright==$(hash playwright 2>/dev/null && (playwright --version | cut -d ' ' -f 2) || echo '\1')/" | \
5454
# Install everything using pip (ignore dependency checks - the lockfile is correct, period)
5555
pip install -r /dev/stdin --no-dependencies \
5656
&& echo "All installed Python packages:" \

0 commit comments

Comments
 (0)