hiddenSymmetries/simsopt

Docker image for mac m1?

Closed this issue · 1 comments

I am trying to use simsopt Docker image on my Mac M1, but I get the following warning:

docker run -it --rm hiddensymmetries/simsopt ipython
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

and when attempting to import simsopt, I get the error:

In [1]: import simsopt
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[1], line 1
----> 1 import simsopt

File /venv/lib/python3.10/site-packages/simsopt/__init__.py:13
      1 # ===================ATTENTION=================================================
      2 # Don't abuse this file by importing all variables from all modules to top-level.
      3 # Import only the important classes that should be at top-level.
   (...)
     10 # "from xyz import *".  If xyz[.py] contains __all__ = ['XYZ'], only XYZ is 
     11 # imported
---> 13 from ._core import make_optimizable, load, save
     14 # from .objectives import LeastSquaresProblem
     15 # from .solve import least_squares_serial_solve
     16 
     17 #__all__ = ['LeastSquaresProblem', 'LeastSquaresTerm']
     18 
     19 # VERSION info
     20 from ._version import version as __version__

File /venv/lib/python3.10/site-packages/simsopt/_core/__init__.py:3
      1 from .derivative import *
      2 from .descriptor import *
----> 3 from .optimizable import *
      4 from .util import *
      6 __all__ = (derivative.__all__ + descriptor.__all__ + optimizable.__all__ + util.__all__)

File /venv/lib/python3.10/site-packages/simsopt/_core/optimizable.py:31
     28 from .util import ImmutableId, OptimizableMeta, WeakKeyDefaultDict, \
     29     DofLengthMismatchError
     30 from .derivative import derivative_dec
---> 31 from .json import GSONable, SIMSON, GSONDecoder, GSONEncoder
     33 try:
     34     import networkx as nx

File /venv/lib/python3.10/site-packages/simsopt/_core/json.py:25
     22 import numpy as np
     24 try:
---> 25     import jax
     26 except ImportError:
     27     jax = None

File /venv/lib/python3.10/site-packages/jax/__init__.py:39
     34 del _cloud_tpu_init
     36 # Confusingly there are two things named "config": the module and the class.
     37 # We want the exported object to be the class, so we first import the module
     38 # to make sure a later import doesn't overwrite the class.
---> 39 from jax import config as _config_module
     40 del _config_module
     42 # Force early import, allowing use of `jax.core` after importing `jax`.

File /venv/lib/python3.10/site-packages/jax/config.py:17
      1 # Copyright 2018 The JAX Authors.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
   (...)
     14 
     15 # TODO(phawkins): fix users of this alias and delete this file.
---> 17 from jax._src.config import config  # noqa: F401

File /venv/lib/python3.10/site-packages/jax/_src/config.py:27
     24 import threading
     25 from typing import Any, Callable, Generic, NamedTuple, Optional, TypeVar
---> 27 from jax._src import lib
     28 from jax._src.lib import jax_jit
     29 from jax._src.lib import transfer_guard_lib

File /venv/lib/python3.10/site-packages/jax/_src/lib/__init__.py:83
     79 # Before importing any C compiled modules from jaxlib, first import the CPU
     80 # feature guard module to verify that jaxlib was compiled in a way that only
     81 # uses instructions that are present on this machine.
     82 import jaxlib.cpu_feature_guard as cpu_feature_guard
---> 83 cpu_feature_guard.check_cpu_features()
     85 try:
     86   import jaxlib.cuda_plugin_extension as cuda_plugin_extension  # pytype: disable=import-error

RuntimeError: This version of jaxlib was built using AVX instructions, which your CPU and/or operating system do not support. You may be able work around this issue by building jaxlib from source.

Could someone help me with this?

@abaillod
Unfortunately, the docker image works only for x86_64 CPUs. Since Mac M1/M2 are based on ARM CPUs, the instructions in simsopt docker can not run on Mac M1. In the future, we may release the arm images.