myrmex-org/docker-lambda-packager

Error during packaging with Python 3 runtime

tdzienniak opened this issue · 1 comments

When I try to package my lambda using Python 3 runtime, I get this error. I don't get it when using Python 2:

Exception:
Traceback (most recent call last):
  File "/opt/python3/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/opt/python3/lib/python3.6/site-packages/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/opt/python3/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/opt/python3/lib/python3.6/site-packages/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/opt/python3/lib/python3.6/site-packages/pip/req/req_install.py", line 281, in populate_link
    self.link = self._wheel_cache.cached_wheel(self.link, self.name)
  File "/opt/python3/lib/python3.6/site-packages/pip/wheel.py", line 68, in cached_wheel
    self._cache_dir, link, self._format_control, package_name)
  File "/opt/python3/lib/python3.6/site-packages/pip/wheel.py", line 129, in cached_wheel
    wheel_names = os.listdir(root)
PermissionError: [Errno 13] Permission denied: '/home/myrmex/.cache/pip/wheels/be/32/77/a8d74e428b50a73cc626b25e5677c7583991831089428a088a'
Changing myrmex UID to 1000
Collecting numpy==1.11.0 (from -r requirements.txt (line 1))

I have one dependency in requiremets.txt file and it is numpy. This is my packaging command:

docker run -e HOST_UID=`id -u` -e HOST_GID=`id -g` -e RUNTIME=python3 -v `pwd`/dist/py/myFunction:/data myrmex/lambda-packager

What can be causing this error?

Hi @tdzienniak,

I can run the following command with a requirement.txt containing numpy==1.11.0

$ docker run -e HOST_UID=`id -u` -e HOST_GID=`id -g` -e RUNTIME=python3 -v `pwd`:/data myrmex/lambda-packager 
Changing myrmex UID to 1001
Collecting numpy==1.11.0 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/1a/5c/57c6920bf4a1b1c11645b625e5483d778cedb3823ba21a017112730f0a12/numpy-1.11.0.tar.gz (4.2MB)
Installing collected packages: numpy
  Running setup.py install for numpy: started
    Running setup.py install for numpy: still running...
    Running setup.py install for numpy: finished with status 'done'
Successfully installed numpy-1.11.0

I don't understand why there is a /home/myrmex/.cache/pip/wheels/ directory in your case. Seems like the artefacts of a previous installation but there should be a new container for each execution.

What is the operating system you are using to run docker ?