DEV Community

Aditya Kanekar
Aditya Kanekar

Posted on

8 1

Installing SciSpacy on Apple M1 Laptops

Background

I was working on developing a API based on SciSpacy to search for medical terms. Looking at the slow performance of loading the model and entity linker on the Intel i5 chip on my Lenovo laptop, I was curious to check how the Apple M1 chip would perform since I own a MacBook Air with M1 chip with following specifications,

  • RAM - 16GB
  • Storage - 512GB SSD
  • Apple M1 chip
    • 8-core CPU with 4 perform­ance cores and 4 efficiency cores
    • 8-core GPU
    • 16-core Neural Engine

The Process

Following are the dependencies from requirement.txt file for SciSpacy and the en_core_sci_lg model,

scispacy==0.5.0
https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.5.0/en_core_sci_lg-0.5.0.tar.gz
Enter fullscreen mode Exit fullscreen mode

The ** pip install -r requirement.txt ** failed with lot of errors while installing a dependency ** nmslib ** with an error ** clang compiler does not support '-march=native' **. Since I already had the Xcode installed on my Mac the version of C was 11 but somehow the mentioned command was failing, since the said argument was not supported on the C version. With a lot of digging around I finally found a solution mentioned on SciSpacy GitHub page.

Install the nmslib using following command,

CFLAGS="-mavx -DWARN(a)=(a)" pip install nmslib
Enter fullscreen mode Exit fullscreen mode

After running this command all the packages got installed as expected and I was able to load and run the queries on SciSpacy model.

Next I will be coming up with the performance comparison on Apple M1 vs Intel i5 chip. I understand the comparison isn't fair but it just shows how much improved the M1 Chip is over the Intel processors.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (2)

Collapse
 
jsulopzs profile image
Jesús López

Thanks for this!

Collapse
 
adityakanekar profile image
Aditya Kanekar

Thank you :)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay