PennyLaneAI / pennylane-lightning

The PennyLane-Lightning plugin provides a fast state-vector simulator written in C++ for use with PennyLane
https://docs.pennylane.ai/projects/lightning
Apache License 2.0
82 stars 35 forks source link

[BUG] RuntimeError: filesystem error due to incorrect path in PennyLane Lightning #797

Open xaviere97 opened 1 month ago

xaviere97 commented 1 month ago

Issue description

PennyLane Lightning encounters a "filesystem error" when trying to access the scipy.libs directory due to an incorrect path construction. The error message indicates that a forward slash is missing before the ../../ sequence in the path.

  1. Install PennyLane and PennyLane Lightning (latest versions).
  2. Run any code that utilizes PennyLane Lightning's quantum operations.

Name: PennyLane Version: 0.37.0 Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network. Home-page: https://github.com/PennyLaneAI/pennylane Author: Author-email: License: Apache License 2.0 Location: /usr/local/lib/python3.10/dist-packages Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml, typing-extensions Required-by: PennyLane_Lightning

Platform info: Linux-6.1.85+-x86_64-with-glibc2.35 Python version: 3.10.12 Numpy version: 1.25.2 Scipy version: 1.11.4 Installed devices:

Additional information

Possible Solution

Adding the missing forward slash in the relevant PennyLane Lightning code might resolve the issue.

maliasadi commented 1 month ago

Thanks @xaviere97 for reporting this issue! This is actually an interesting one. Currently, Lightning doesn't support system-level Python binaries on Debian/Ubuntu distros where packages are installed in dist-packages instead of site-packages. We can provide a fix if requested. In the meantime, I suggest using venv to create a Python virtual environment and re-install pennylane-lightning in the default pip site-packages. You may also need to upgrade scipy on your machine to use the latest features of PennyLane.