Installing pyjls on Mac M1

Hello!

I’m trying to install pyjls and joulescope on my M1 Macbook. The UI works fine but can’t get this python lib to install.

I get the below error after running:

 sudo pip3 install -U pyjls

Error:

      error: unknown target CPU 'armv8-a+crc+simd'
      note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

Full log:

michael@Michaels-MBP pyjoulescope_examples % sudo pip3 install -U pyjls
WARNING: The directory '/Users/michael/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Collecting pyjls
  Downloading pyjls-0.4.2.tar.gz (254 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 254.9/254.9 kB 5.8 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.16 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyjls) (1.22.4)
Building wheels for collected packages: pyjls
  Building wheel for pyjls (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [36 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-3.9
      creating build/lib.macosx-10.9-universal2-3.9/pyjls
      copying pyjls/version.py -> build/lib.macosx-10.9-universal2-3.9/pyjls
      copying pyjls/__init__.py -> build/lib.macosx-10.9-universal2-3.9/pyjls
      copying pyjls/structs.py -> build/lib.macosx-10.9-universal2-3.9/pyjls
      copying pyjls/__main__.py -> build/lib.macosx-10.9-universal2-3.9/pyjls
      creating build/lib.macosx-10.9-universal2-3.9/pyjls/v1
      copying pyjls/v1/__init__.py -> build/lib.macosx-10.9-universal2-3.9/pyjls/v1
      creating build/lib.macosx-10.9-universal2-3.9/pyjls/test
      copying pyjls/test/__init__.py -> build/lib.macosx-10.9-universal2-3.9/pyjls/test
      copying pyjls/test/test_binding.py -> build/lib.macosx-10.9-universal2-3.9/pyjls/test
      creating build/lib.macosx-10.9-universal2-3.9/pyjls/entry_points
      copying pyjls/entry_points/__init__.py -> build/lib.macosx-10.9-universal2-3.9/pyjls/entry_points
      copying pyjls/entry_points/annotate.py -> build/lib.macosx-10.9-universal2-3.9/pyjls/entry_points
      copying pyjls/entry_points/info.py -> build/lib.macosx-10.9-universal2-3.9/pyjls/entry_points
      running build_ext
      building 'pyjls.binding' extension
      creating build/temp.macosx-10.9-universal2-3.9
      creating build/temp.macosx-10.9-universal2-3.9/pyjls
      creating build/temp.macosx-10.9-universal2-3.9/src
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -Iinclude -Iinclude_prv -I/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c pyjls/binding.c -o build/temp.macosx-10.9-universal2-3.9/pyjls/binding.o -march=armv8-a+crc+simd
      In file included from pyjls/binding.c:728:
      In file included from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5:
      In file included from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
      In file included from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1960:
      /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
      #warning "Using deprecated NumPy API, disable it with " \
       ^
      1 warning generated.
      error: unknown target CPU 'armv8-a+crc+simd'
      note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyjls
  Running setup.py clean for pyjls
Failed to build pyjls
Installing collected packages: pyjls
  Running setup.py install for pyjls ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for pyjls did not run successfully.
  │ exit code: 1
  ╰─> [36 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-3.9
      creating build/lib.macosx-10.9-universal2-3.9/pyjls
      copying pyjls/version.py -> build/lib.macosx-10.9-universal2-3.9/pyjls
      copying pyjls/__init__.py -> build/lib.macosx-10.9-universal2-3.9/pyjls
      copying pyjls/structs.py -> build/lib.macosx-10.9-universal2-3.9/pyjls
      copying pyjls/__main__.py -> build/lib.macosx-10.9-universal2-3.9/pyjls
      creating build/lib.macosx-10.9-universal2-3.9/pyjls/v1
      copying pyjls/v1/__init__.py -> build/lib.macosx-10.9-universal2-3.9/pyjls/v1
      creating build/lib.macosx-10.9-universal2-3.9/pyjls/test
      copying pyjls/test/__init__.py -> build/lib.macosx-10.9-universal2-3.9/pyjls/test
      copying pyjls/test/test_binding.py -> build/lib.macosx-10.9-universal2-3.9/pyjls/test
      creating build/lib.macosx-10.9-universal2-3.9/pyjls/entry_points
      copying pyjls/entry_points/__init__.py -> build/lib.macosx-10.9-universal2-3.9/pyjls/entry_points
      copying pyjls/entry_points/annotate.py -> build/lib.macosx-10.9-universal2-3.9/pyjls/entry_points
      copying pyjls/entry_points/info.py -> build/lib.macosx-10.9-universal2-3.9/pyjls/entry_points
      running build_ext
      building 'pyjls.binding' extension
      creating build/temp.macosx-10.9-universal2-3.9
      creating build/temp.macosx-10.9-universal2-3.9/pyjls
      creating build/temp.macosx-10.9-universal2-3.9/src
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -Iinclude -Iinclude_prv -I/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c pyjls/binding.c -o build/temp.macosx-10.9-universal2-3.9/pyjls/binding.o -march=armv8-a+crc+simd
      In file included from pyjls/binding.c:728:
      In file included from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5:
      In file included from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
      In file included from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1960:
      /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
      #warning "Using deprecated NumPy API, disable it with " \
       ^
      1 warning generated.
      error: unknown target CPU 'armv8-a+crc+simd'
      note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyjls

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Hi @michaeld and welcome to the Joulescope forum!

I believe that we tested pyjls ran on Mac M1’s a while back. I’ll take a look. Can you also post the output of python3 -VV ? That’s two V, not W. Thanks!

I tried this on a 2020 M1, fully up-to-date with the latest brew. Here is the output for python3 -VV:

Python 3.9.13 (main, May 24 2022, 21:13:51)
[Clang 13.1.6 (clang-1316.0.21.2)]

And pip3 install -U pyjls gives:

DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
WARNING: Ignoring invalid distribution -ython (/opt/homebrew/lib/python3.9/site-packages)
WARNING: Ignoring invalid distribution -ython (/opt/homebrew/lib/python3.9/site-packages)
Collecting pyjls
  Downloading pyjls-0.4.2.tar.gz (254 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 254.9/254.9 kB 5.0 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.16 in /opt/homebrew/lib/python3.9/site-packages (from pyjls) (1.22.2)
Building wheels for collected packages: pyjls
  Building wheel for pyjls (setup.py) ... done
  Created wheel for pyjls: filename=pyjls-0.4.2-cp39-cp39-macosx_12_0_arm64.whl size=174123 sha256=74aa800bd4d5f378d6c984fef00204b1775c58e187031189f3ad48a2578e7b9b
  Stored in directory: /Users/mliberty/Library/Caches/pip/wheels/6b/15/63/4b28f1b09abb37130f219bf4521474c9432363939d5616ca9e
Successfully built pyjls
WARNING: Ignoring invalid distribution -ython (/opt/homebrew/lib/python3.9/site-packages)
Installing collected packages: pyjls
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
WARNING: Ignoring invalid distribution -ython (/opt/homebrew/lib/python3.9/site-packages)
Successfully installed pyjls-0.4.2
WARNING: Ignoring invalid distribution -ython (/opt/homebrew/lib/python3.9/site-packages)
WARNING: Ignoring invalid distribution -ython (/opt/homebrew/lib/python3.9/site-packages)
WARNING: Ignoring invalid distribution -ython (/opt/homebrew/lib/python3.9/site-packages)
WARNING: There was an error checking the latest version of pip.

Despite all the errors due to pip3 being broken, pyjls installed just fine.

python3 -c "import pyjls; print(pyjls.__version__)"
0.4.2

Here is my machine info

Any thoughts on what is different with your setup?

Hi thanks for the feedback.

michael@Michaels-MBP ~ % python3 -VV
Python 3.9.10 (v3.9.10:f2f3f53782, Jan 13 2022, 16:55:45) 
[Clang 13.0.0 (clang-1300.0.29.30)]

Should I update? I’m on “Apple M1 Pro” actually maybe that is an issue?

Screenshot 2022-06-20 at 11.35.34

If you are comfortable updating, please do. I am not sure it’s the issue, but it is one less variable. You should be able to get macOS 12.4 and then update brew:

brew update
brew upgrade

I did double-check that I am running python3 arm64, not amd64:

% which python3
/opt/homebrew/bin/python3
% file /opt/homebrew/bin/python3
/opt/homebrew/bin/python3: Mach-O 64-bit executable arm64