How Do I Pip Install Linux Packages On A Windows Machine (for Aws Lambda)?
I'm trying to write a Python AWS Lambda script. The Python code works locally in Windows, but it's using the Windows packages installed through pip. When uploading to AWS Lambda, I
Solution 1:
Thanks to explanation from @C.Nivs, this can be done using Docker interactively:
- First run docker interactively with
docker run -it python:3.6-slim bash
. Then create a folder 'target' and pip install into it (this installs the linux packages). Make note of the container id (my command line shows root@31d9be68deec:/#. The container id is31d9be68deec
)
mkdir /target
pip install pandas -t /target
- Then open a new command prompt and use docker cp to copy files from container to local. The following copies from the
target
folder in the container to the local folder libs.
docker cp <container_id>:/target libs
That's it. The python packages are now available in the local folder libs
.
Note from @C.Nivs: "COPY doesn't do what it's name might suggest. COPY is a build step that copies files from the build context (where the image is being built) to the image itself. It doesn't allow things to go the other way".
Post a Comment for "How Do I Pip Install Linux Packages On A Windows Machine (for Aws Lambda)?"