network-importer icon indicating copy to clipboard operation
network-importer copied to clipboard

Build fails because PyATS wont install on Mac M1

Open fdebonneval opened this issue 3 years ago • 4 comments

Environment

  • Python version: 3.7
  • Network Importer version: HEAD on develop branch

Steps to Reproduce

On a mac M1 platform

  1. docker rmi python:3.7 && docker run --rm -it python:3.7 bash -c 'pip install pyats'
  2. docker rmi python:3.7 && docker run --rm -it --platform linux/amd64 python:3.7 bash -c 'pip install pyats'

Expected Behavior

On docker-compose up, network-importer image should build

Observed Behavior

Build crashes with the error

ERROR: Could not find a version that satisfies the requirement pyats (from versions: none)
ERROR: No matching distribution found for pyats

Proposed solution

Forcing hardware platform in the Dockerfile solves the build issue and seems cross-platform and cross Docker Compose (V1 and V2) compatible. This can be used until PyATS is published on PyPI bulid for ARM processor. FROM --platform=linux/amd64 python:${PYTHON_VER}

fdebonneval avatar Jan 11 '22 16:01 fdebonneval

pyATS issue - https://github.com/CiscoTestAutomation/pyats/issues/138

jvanderaa avatar Jan 12 '22 14:01 jvanderaa

@fdebonneval I found a less rigid way of solving this. While some solutions recommend moving the whole setup to run under Rosetta (which forces the images to be build with linux/amd64), you can have your docker-compose commands build the right images with the DOCKER_DEFAULT_PLATFORM environment variable set to linux/amd64. You could add this to your shell profile, use something like direnv, or at call time: DOCKER_DEFAULT_PLATFORM=linux/amd64 docker-compose up.

bryanculver avatar Jan 31 '22 21:01 bryanculver

Hi Bryan, Thanks for taking a look at the issue. Your solution implies that all the stack will be build to that AMD64 architecture. My solution overrides only the container that need a pip package that has no ARM build. Two way to address the issue.

fdebonneval avatar Feb 02 '22 10:02 fdebonneval

https://pypi.org/project/pyats/22.3/#files pyATS 22.3 now supports M1 for Python 3.8+

GerriorL avatar Apr 01 '22 13:04 GerriorL