tleyden / eyepi

Object detection on Raspberry Pi with AWS Lambda/S3 backend
2 stars 0 forks source link

Prep ubuntu container with python3 #4

Closed tleyden closed 3 years ago

tleyden commented 3 years ago

Dockerfile

FROM arm32v7/python:3.7.9-buster
RUN wget https://archive.raspbian.org/raspbian.public.key -O - | apt-key add -
RUN wget https://archive.raspberrypi.org/debian/raspberrypi.gpg.key -O - | apt-key add -
RUN echo "deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" >> /etc/apt/sources.list

RUN apt-get update && apt-get install -y emacs25-nox libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev qt4-dev-tools libatlas-base-dev

RUN pip3 install boto3

# Need to get an older version of OpenCV because version 4 has errors - see https://github.com/EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi/blob/master/get_pi_requirements.sh
RUN pip3 install opencv-python==3.4.11.45

# Get packages required for TensorFlow
# Using the tflite_runtime packages available at https://www.tensorflow.org/lite/guide/python
# Will change to just 'pip3 install tensorflow' once newer versions of TF are added to piwheels
pip3 install https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_armv7l.whl
tleyden commented 3 years ago
$ docker pull arm32v7/python:3.7.9-buster
tleyden commented 3 years ago
docker save tleyden5iwx/eyepi > artifacts/com.example.WriteToS3PyDocker/1.0.0/write-to-s3-pydocker.tar
tleyden commented 3 years ago
sudo /greengrass/v2/bin/greengrass-cli deployment create --recipeDir ~/GreengrassCore/recipes --artifactDir ~/GreengrassCore/artifacts --merge "com.example.WriteToS3PyDocker=1.0.0"
tleyden commented 3 years ago

It works!

---
RecipeFormatVersion: 2020-01-25
ComponentName: com.example.WriteToS3PyDocker
ComponentVersion: '1.0.0'
ComponentDescription: Publish to iot core via python
ComponentPublisher: tleyden
ComponentDependencies:
  aws.greengrass.TokenExchangeService:
    VersionRequirement: '>=0.0.0'
    DependencyType: HARD
ComponentConfiguration:
  DefaultConfiguration:
    Message: world
Manifests:
  - Platform:
      os: linux
    Lifecycle:
      Run:
        Script: docker run --network="host" -e AWS_REGION -e SVCUID -e AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT -e AWS_CONTAINER_AUTHORIZATION_TOKEN -e AWS_CONTAINER_CREDENTIALS_FULL_URI --rm tleyden5iwx/eyepi python3 /root/push_to_s3.py
tleyden commented 3 years ago

Error installing dependencies

pip3 install opencv-python==3.4.11.45
Collecting opencv-python==3.4.11.45
  Downloading opencv-python-3.4.11.45.tar.gz (87.4 MB)
     |████████████████████████████████| 87.4 MB 3.3 kB/s
  Installing build dependencies ... \

/

error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-d4o7osa5/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"'' 'numpy==1.19.3; python_version>='"'"'3.9'"'"''
       cwd: None
  Complete output (61 lines):
  Ignoring numpy: markers 'python_version == "3.6"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.8"' don't match your environment
  Ignoring numpy: markers 'python_version >= "3.9"' don't match your environment
  Collecting numpy==1.14.5
    Downloading numpy-1.14.5.zip (4.9 MB)
  Collecting cmake
    Downloading cmake-3.18.4.post1.tar.gz (28 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting pip
    Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
  Collecting scikit-build
    Using cached scikit_build-0.11.1-py2.py3-none-any.whl (72 kB)
  Collecting wheel
    Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
  Collecting distro
    Using cached distro-1.5.0-py2.py3-none-any.whl (18 kB)
  Collecting packaging
    Using cached packaging-20.8-py2.py3-none-any.whl (39 kB)
  Collecting pyparsing>=2.0.2
    Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
  Collecting setuptools
    Using cached setuptools-51.1.1-py3-none-any.whl (2.0 MB)
  Building wheels for collected packages: numpy, cmake
    Building wheel for numpy (setup.py): started
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): finished with status 'done'
    Created wheel for numpy: filename=numpy-1.14.5-cp37-cp37m-linux_armv7l.whl size=7477538 sha256=14f9615022f60cf28570ca800337179e0dfed16dde8c62c01e6c62c2d45485e8
    Stored in directory: /root/.cache/pip/wheels/0a/e4/17/6553eef9223d4266539532502327af0aae43f46ff5d392d361
    Building wheel for cmake (PEP 517): started
    Building wheel for cmake (PEP 517): finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp7n645pxz
         cwd: /tmp/pip-install-lfs06z7d/cmake_4f5f4e655fe34a26a232c267312c2f98
    Complete output (9 lines):
      File "/tmp/pip-build-env-y1pvd3c9/overlay/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
        cmkr = cmaker.CMaker(cmake_executable)
      File "/tmp/pip-build-env-y1pvd3c9/overlay/lib/python3.7/site-packages/skbuild/cmaker.py", line 95, in __init__
        self.cmake_version = get_cmake_version(self.cmake_executable)
      File "/tmp/pip-build-env-y1pvd3c9/overlay/lib/python3.7/site-packages/skbuild/cmaker.py", line 82, in get_cmake_version
        "Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
    Traceback (most recent call last):

    Problem with the CMake installation, aborting build. CMake executable is cmake
    ----------------------------------------
    ERROR: Failed building wheel for cmake
  Successfully built numpy
  Failed to build cmake
  ERROR: Could not build wheels for cmake which use PEP 517 and cannot be installed directly
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-d4o7osa5/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"'' 'numpy==1.19.3; python_version>='"'"'3.9'"'"'' Check the logs for full command output.