Netsquid installation troubleshooting

In installing SquidASM one of the most common problems relate to installing Netsquid. Netsquid must be compiled per python version, operating system and chip architecture. For Linux users with an intel x86-64 architecture this is rarely noticeable, but macOSX users may struggle to find a version of Netsquid that they can install. This is due to the extra dependencies on major MacOSX version combined with Apple changing the chip architecture from intel x86-64 to M1 and then M2 chips.

If you have any trouble with installation feel free to ask your questions here or contribute to the knowledge base by posting your solutions!

We have collected some tips that may help those struggling to install Netsquid on macOSX:

  • One can look on the pypi server for Netsquid to find what wheel files are available, and switch to an appropriate python version.
  • Despite the wheel file being installable, pip may claim this is not the case. Using a different (and older) pip version may resolve this.

Installing Netsquid on MacOS 12.x with Intel chips and python 3.8.

When installing on this machine I found that pip would only allow me to install Netsquid versions 1.0.7 and 0.8.7. This is an issue as to avoid a bug in SquidASM, we want to have at least squidASM>=1.1.2

We should be able to install Netsquid 1.1.6 as netsquid-1.1.6-cp38-cp38-macosx_11_0_x86_64.whl exists. On closer inspection of the succeeding installation, the wheel file downloaded would be of type: netsquid-1.0.7-cp38-cp38-macosx_10_15_x86_64.whl despite netsquid-1.0.7-cp38-cp38-macosx_11_0_x86_64.whl file existing.

Solution
We manually edit the python wheel file to allow us to install it.

  1. Go to: https://pypi.netsquid.org/netsquid/ and download the correct wheel file (In this case netsquid-1.1.6-cp38-cp38-macosx_11_0_x86_64.whl )
  2. Unzip the wheel file
  3. Open the file named WHEEL inside netsquid-1.1.6.dist-info folder
  4. Modify the field Tag from:
    Tag: cp38-cp38-macosx_11_0_x86_64
    to
    Tag: cp38-cp38-macosx_10_15_x86_64
  5. Run wheel pack . in the unziped wheel folder. It will produce a new wheel file in the same folder (You might need to install the wheel package first with pip install wheel)
  6. install the package from the newly created wheel file (pip install netsquid-1.1.6-cp38-cp38-macosx_10_15_x86_64.whl )

Hello,
I’m having problems installing squidasm on an M1 mac (OS 13.4.1). When I do make install I get:

ERROR: Could not find a version that satisfies the requirement pydynaa<1.0,>=0.3 (from squidasm) (from versions: 0.0.1, 1.0.1, 1.0.2)
ERROR: No matching distribution found for pydynaa<1.0,>=0.3
make: *** [install] Error 1

I tried fetching an arm wheel file for pydinaa, however when I install it i run into other errors:
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cysignals
Running setup.py clean for cysignals
Failed to build cysignals
ERROR: Could not build wheels for cysignals, which is required to install pyproject.toml-based projects

What could I try?

Hello,

Sorry to hear that you are experiencing issues.
As for the first error: “ERROR: Could not find a version that satisfies the requirement pydynaa<1.0,>=0.3”, we were in the process of relaxing the pydynaa requirements.
The pull request to resolve this has just been merged into the develop branch. Updating your squidasm package to the newest version using the command git pull inside the squidasm folder will fix this issue.

Sadly I do not think this will resolve the cysignals issue. I am aware of another user that experienced this issue before. I will contact this user and see if he can help.

Hi Atom!

I remember having similar issues when I was trying to install squidasm for the first time (also M1 Mac)

Could you try to install cysignals manually first, but then a specific version? If you’re not using a virtual environment, try:

python -m pip install cysignals==1.10.3

If you are using a virtual environment, just adapt:

./relative/path/to/venv/bin/python -m pip install cysignals==1.10.3

Afterwards, re-run make install to see if it now works.

Please let us know if it works/if it didn’t. Then we can continue looking for the solution!

HI Jsdj,
here’s what i get when i force the cysignal version in my virtual environment as you recommended:

  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.
╰─> cysignals

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

The good news is that I did solve the pydynaa issue by pulling the latest branch!

Hey Atom,
Sorry to hear that it is still not working out.
Moving forward there are two things that come into my mind to try:

  1. Try out different versions of the cysignals and possibly pip. So try if cysignals 1.10.2, 1.9.x, etc. work. In installing Netsquid, we have found that it can depend on the pip version if you are allowed to install Netsquid. In that case it was using pip 21 that we could install and not with pip 23. (Not 21.0.0, but one of the newer 21.x.x version)

  2. Build the package from source
    In this case you will compile the source C\C++ code on your local machine.
    To do this:

  • Clone the cysignals repository using: git clone git@github.com:sagemath/cysignals.git
  • Create a venv using python3 -m venv venv in the cysignals repo
  • Install the requirements using pip install -r requirements.txt
  • Build the package using make build
    (It is not unlikely that in this step you might encounter some missing requirements for the compilation process. On Linux I was missing a python.h file that required sudo apt-get install python-dev. On MacOSX this went smoothly, but I suspect i installed some xcode tools at some point.)
  • Install it as a python package using pip install .
  • Either install it using the same venv as you use for squidASM now or make a wheel file out of it using python setup.py bdist_wheel that will create a wheel file in the dist directory that you can then use to install cysignals.

Hi Allesandro,

I just realized, maybe easiest is to try and install every element that I have in my current working venv.

I cannot post files, so copy all these elements to a new file and save it as ‘r2.txt’:

asttokens==2.2.1
backcall==0.2.0
bitarray==2.8.1
click==8.1.3
cloudpickle==2.2.1
comm==0.1.3
contourpy==1.0.7
cycler==0.11.0
cysignals==1.10.3
Cython==0.29.35
dataclasses==0.6
debugpy==1.6.7
decorator==5.1.1
exceptiongroup==1.1.1
executing==1.2.0
fonttools==4.39.4
importlib-metadata==6.6.0
importlib-resources==5.12.0
iniconfig==2.0.0
ipykernel==6.23.1
ipython==8.12.2
jedi==0.18.2
jupyter_client==8.2.0
jupyter_core==5.3.0
kiwisolver==1.4.4
matplotlib==3.7.1
matplotlib-inline==0.1.6
nest-asyncio==1.5.6
netqasm==0.13.1
netsquid==1.1.6
-e git+https://gitlab.com/softwarequtech/netsquid-snippets/netsquid-abstractmodel.git@b5ec523148a2e23b29ff6efa25eb73073ad4feda#egg=netsquid_abstractmodel&subdirectory=../../../submodules/netsquid-abstractmodel
-e git+https://gitlab.com/softwarequtech/netsquid-snippets/netsquid-magic.git@f14298d1ee0c9d760d8c5a504654f4e6dcb43513#egg=netsquid_magic&subdirectory=../../../submodules/netsquid-magic
-e git+https://github.com/QuTech-Delft/squidasm.git@04644c26b1180101ef4fbb66a62ebedfab848b42#egg=netsquid_netbuilder&subdirectory=submodules/netsquid-netbuilder
netsquid-nv==8.0.0
netsquid-physlayer==4.3.0
netsquid-simulationtools==2.0.0
numpy==1.22.4
packaging==23.1
pandas==1.5.3
parso==0.8.3
pexpect==4.8.0
pickleshare==0.7.5
Pillow==9.5.0
platformdirs==3.5.1
pluggy==1.0.0
prompt-toolkit==3.0.38
psutil==5.9.5
ptyprocess==0.7.0
pure-eval==0.2.2
pydantic==1.10.9
pydynaa==0.3.6
Pygments==2.15.1
pyparsing==3.0.9
pytest==7.3.1
python-dateutil==2.8.2
pytz==2023.3
PyYAML==6.0
pyzmq==25.1.0
qlink-interface==1.0.0
scipy==1.8.1
six==1.16.0
spyder-kernels==2.4.3
-e git+https://github.com/QuTech-Delft/squidasm.git@04644c26b1180101ef4fbb66a62ebedfab848b42#egg=squidasm
stack-data==0.6.2
tomli==2.0.1
tornado==6.3.2
traitlets==5.9.0
typing_extensions==4.6.3
wcwidth==0.2.6
wurlitzer==3.0.3
zipp==3.15.0

Then save that file in the root folder of your squidasm. Install everything by using:

./relative/path/to/venv/bin/python -m pip install -r r2.txt

And check if you can run the make install afterwards.

BTW, just to check, are you indeed using python version 3.8?

Hello @mvanhooft and @jsdj ,
thanks for your support. I’ve managed to complete the installation. One question though: when i run “make verify”, 2 tests fail. Is this the expected behaviour?

Below a log:
" drop_qubit = not keep_combined
if not isinstance(qubit, Qubit):

      raise TypeError("The qubit given must be a qubit object")

E TypeError: The qubit given must be a qubit object

SEnv/lib/python3.8/site-packages/netsquid/qubits/qubitapi.py:471: TypeError
=========================== short test summary info ============================
FAILED tests/stack/test_two_nodes.py::TestTwoNodes::test_entangle_md - TypeError: The qubit given must be a qubit object
FAILED tests/stack/test_two_nodes.py::TestTwoNodes::test_entangle_md_with_wait - TypeError: The qubit given must be a qubit object
========================= 2 failed, 49 passed in 6.56s =========================
make: *** [tests] Error 1"

Looking forward to explore the squidasm potential in the next days!

Hello @atom,

Good to hear it is working now!

This is a known bug on MacOS systems. We have solved this issue on the branch blueprint-integration-beta-0.0.2. Its impact is not critical, as long as you don’t use the create_measure() method of EPR sockets, but it would still be prudent to switch to blueprint-integration-beta-0.0.2 branch.

You can switch branches via:
git checkout blueprint-integration-beta-0.0.2
After switching you do need to reinstall the package using: make install

EDIT:
The branch mentioned here does not exist anymore use git checkout b0.0.5 or, if they exist, the newest of the bx.x.x versions instead.

Thank you @mvanhooft !

“All examples work!
Everything works!”

1 Like