network-importer
network-importer copied to clipboard
Build fails because PyATS wont install on Mac M1
Environment
- Python version: 3.7
- Network Importer version: HEAD on develop branch
Steps to Reproduce
On a mac M1 platform
- docker rmi python:3.7 && docker run --rm -it python:3.7 bash -c 'pip install pyats'
- 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}
pyATS issue - https://github.com/CiscoTestAutomation/pyats/issues/138
@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.
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.
https://pypi.org/project/pyats/22.3/#files pyATS 22.3 now supports M1 for Python 3.8+