Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Building PennyLane from source breaks PennyLane Lightning import #2388

Closed
1 task done
dominicpasquali opened this issue Mar 29, 2022 · 5 comments
Closed
1 task done
Labels
bug 🐛 Something isn't working

Comments

@dominicpasquali
Copy link

dominicpasquali commented Mar 29, 2022

Expected behavior

I expect to install PennyLane from source and run import pennylane_lightning without error.

Actual behavior

PennyLane Lightning is unable to import 'Expectation' from 'pennylane.operation'

Additional information

Error occurs as of March 28th, 2022

Source code

Following: https://pennylane.ai/install.html?version=source
Ran:

git clone https://github.com/PennyLaneAI/pennylane.git
cd pennylane
pip install -e .

Opening up Python:

$ python

Importing PennyLane Lightning

/home/pennylane# pythonPython 3.7.13 (Mar 28 2022, 17:37:17)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pennylane_lightning

Tracebacks

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/pennylane_lightning/__init__.py", line 17, in <module>
    from .lightning_qubit import LightningQubit
  File "/usr/local/lib/python3.7/dist-packages/pennylane_lightning/lightning_qubit.py", line 37, in <module>
    from pennylane.operation import Expectation, Tensor
ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/operation.py)

System information

Running

import pennylane as qml; qml.about()

yields

Python 3.7.13 (default, Mar 16 2022, 17:37:17) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pennylane as qml; qml.about()
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Name: PennyLane
Version: 0.23.0.dev0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: https://github.com/XanaduAI/pennylane
Author: None
Author-email: None
License: Apache License 2.0
Location: /home/pennylane
Requires: numpy, scipy, networkx, retworkx, autograd, toml, appdirs, semantic-version, autoray, cachetools, pennylane-lightning
Required-by: PennyLane-Lightning
Platform info:           Linux-5.4.144+-x86_64-with-Ubuntu-18.04-bionic
Python version:          3.7.13
Numpy version:           1.21.5
Scipy version:           1.4.1
Installed devices:
- default.gaussian (PennyLane-0.23.0.dev0)
- default.mixed (PennyLane-0.23.0.dev0)
- default.qubit (PennyLane-0.23.0.dev0)
- default.qubit.autograd (PennyLane-0.23.0.dev0)
- default.qubit.jax (PennyLane-0.23.0.dev0)
- default.qubit.tf (PennyLane-0.23.0.dev0)
- default.qubit.torch (PennyLane-0.23.0.dev0)
- lightning.qubit (PennyLane-Lightning-0.22.0)

Existing GitHub issues

  • I have searched existing GitHub issues to make sure the issue does not already exist.
@dominicpasquali dominicpasquali added the bug 🐛 Something isn't working label Mar 29, 2022
@dominicpasquali dominicpasquali changed the title [BUG] Building PennyLane from source breaks PennyLane Lightning [BUG] Building PennyLane from source breaks PennyLane Lightning import Mar 29, 2022
@antalszava
Copy link
Contributor

Hi @dominicpasquali, thanks for the report! This issue has been resolved in PennyLaneAI/pennylane-lightning#259 that was merged into the master branch of PennyLane-Lightning.

Cloning and building PennyLane-Lightning too should help resolve the issue. Let us know how it goes! 🙂

@dominicpasquali
Copy link
Author

dominicpasquali commented Apr 4, 2022

Hi @antalszava - sorry for the delay. Unfortunately building PennyLane-Lightning from source still doesn't solve the problem. Please see my code below:

Following: https://pennylane-lightning.readthedocs.io/en/latest/installation.html

$ pip install pybind11 pennylane-lightning --no-binary :all:
Collecting pybind11
  Downloading pybind11-2.9.2.tar.gz (193 kB)
     |████████████████████████████████| 193 kB 3.6 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: ....
....
Successfully built pybind11
Installing collected packages: pybind11
Successfully installed pybind11-2.9.2
$ python3
Python 3.8.10 (default, Mar 15 2022, 12:22:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pennylane_lightning
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/dist-packages/pennylane_lightning/__init__.py", line 17, in <module>
    from .lightning_qubit import LightningQubit
  File "/usr/local/lib/python3.8/dist-packages/pennylane_lightning/lightning_qubit.py", line 37, in <module>
    from pennylane.operation import Expectation, Tensor
ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/operation.py)

@dominicpasquali
Copy link
Author

dominicpasquali commented Apr 4, 2022

Hi @antalszava - I think I've found a bigger problem. When I follow https://pennylane.readthedocs.io/en/stable/development/guide/tests.html and do the test manually I get the below.
For: python -m pytest --ignore=tests/beta tests
I get (abbreviating the output):

============================================================================================= short test summary info =============================================================================================
FAILED tests/test_debugging.py::TestSnapshot::test_lightning_qubit[None] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/operation.py)
FAILED tests/test_debugging.py::TestSnapshot::test_lightning_qubit[parameter-shift] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/operation.py)
FAILED tests/test_debugging.py::TestSnapshot::test_lightning_qubit[adjoint] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/operation.py)
FAILED tests/devices/test_lightning_qubit.py::test_integration - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/operation.py)
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement0-float32] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement0-float64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement1-float32] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement1-float64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement2-float32] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement2-float64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement3-float32] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement3-float64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_complex_dtype[measurement0-complex64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennyla...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_complex_dtype[measurement0-complex128] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennyl...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_complex_dtype[measurement1-complex64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennyla...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_complex_dtype[measurement1-complex128] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennyl...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_complex_dtype[measurement2-complex64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennyla...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_complex_dtype[measurement2-complex128] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennyl...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_quantum_teleportation[lightning.qubit-rads0] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/ho...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_quantum_teleportation[lightning.qubit-rads1] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/ho...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_quantum_teleportation[lightning.qubit-rads2] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/ho...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops0-lightning.qubit-r0] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops0-lightning.qubit-r1] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops0-lightning.qubit-r2] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops0-lightning.qubit-r3] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops1-lightning.qubit-r0] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops1-lightning.qubit-r1] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops1-lightning.qubit-r2] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops1-lightning.qubit-r3] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops2-lightning.qubit-r0] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops2-lightning.qubit-r1] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops2-lightning.qubit-r2] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops2-lightning.qubit-r3] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations_assert_zero_state[ops0-lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylan...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations_assert_zero_state[ops1-lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylan...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations_assert_zero_state[ops2-lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylan...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations_with_else[lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' ...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_cond_qfunc[lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/penn...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_cond_qfunc_with_else[lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/penn...
FAILED tests/transforms/test_tape_expand.py::TestCreateCustomDecompExpandFn::test_one_custom_decomp[lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane...
FAILED tests/transforms/test_tape_expand.py::TestCreateCustomDecompExpandFn::test_custom_decomp_used_twice - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane...
========================================================= 41 failed, 8247 passed, 1547 skipped, 21 xfailed, 4 xpassed, 109 warnings in 532.64s (0:08:52) ==========================================================

and if I do the full test with: make test
I get:

============================================================================================= short test summary info =============================================================================================
FAILED tests/test_debugging.py::TestSnapshot::test_lightning_qubit[None] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/operation.py)
FAILED tests/test_debugging.py::TestSnapshot::test_lightning_qubit[parameter-shift] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/operation.py)
FAILED tests/test_debugging.py::TestSnapshot::test_lightning_qubit[adjoint] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/operation.py)
FAILED tests/devices/test_lightning_qubit.py::test_integration - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/operation.py)
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement0-float32] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement0-float64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement1-float32] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement1-float64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement2-float32] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement2-float64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement3-float32] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_real_dtype[measurement3-float64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/op...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_complex_dtype[measurement0-complex64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennyla...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_complex_dtype[measurement0-complex128] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennyl...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_complex_dtype[measurement1-complex64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennyla...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_complex_dtype[measurement1-complex128] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennyl...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_complex_dtype[measurement2-complex64] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennyla...
FAILED tests/devices/test_lightning_qubit.py::TestDtypePreserved::test_complex_dtype[measurement2-complex128] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennyl...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_quantum_teleportation[lightning.qubit-rads0] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/ho...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_quantum_teleportation[lightning.qubit-rads1] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/ho...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_quantum_teleportation[lightning.qubit-rads2] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/ho...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops0-lightning.qubit-r0] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops0-lightning.qubit-r1] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops0-lightning.qubit-r2] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops0-lightning.qubit-r3] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops1-lightning.qubit-r0] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops1-lightning.qubit-r1] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops1-lightning.qubit-r2] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops1-lightning.qubit-r3] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops2-lightning.qubit-r0] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops2-lightning.qubit-r1] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops2-lightning.qubit-r2] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations[ops2-lightning.qubit-r3] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations_assert_zero_state[ops0-lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylan...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations_assert_zero_state[ops1-lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylan...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations_assert_zero_state[ops2-lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylan...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_conditional_rotations_with_else[lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' ...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_cond_qfunc[lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/penn...
FAILED tests/transforms/test_defer_measurements.py::TestConditionalOperations::test_cond_qfunc_with_else[lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/penn...
FAILED tests/transforms/test_tape_expand.py::TestCreateCustomDecompExpandFn::test_one_custom_decomp[lightning.qubit] - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane...
FAILED tests/transforms/test_tape_expand.py::TestCreateCustomDecompExpandFn::test_custom_decomp_used_twice - ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane...
========================================================= 41 failed, 8247 passed, 1547 skipped, 21 xfailed, 4 xpassed, 109 warnings in 524.94s (0:08:44) ==========================================================

this is in conflict with the most recent check suite:
https://github.com/PennyLaneAI/pennylane/runs/5808502403?check_suite_focus=true

I thnk the heart of the problem is located in: https://github.com/PennyLaneAI/pennylane/blob/b9bc9be03d814f6b2c9f79622c778793fd969919/.github/workflows/tests.yml which (and please correct me if I'm wrong or if I'm completely missing/not seeing something): doesn't test for PennyLane-Lightning and doesn't do the full tests (python -m pytest --ignore=tests/beta tests or make test). Instead only subtests of these test are conducted, hence the errors when done manually vs automatically by GitHub.

@antalszava
Copy link
Contributor

Hi @dominicpasquali,

ImportError: cannot import name 'Expectation' from 'pennylane.operation' (/home/pennylane/pennylane/operation.py)

This error was solved in PennyLaneAI/pennylane-lightning#259 in the PennyLane-Lightning repo. To get that version of Lightning, the PennyLane-Lightning repository can be cloned from GitHub and then running pip install -e . in the main folder would build the binaries on the master branch. The changes are not accessible via the official PyPi site (and using pip). On the team, we do use Test PyPi to distribute pre-release binaries, this is also what is being used in the test suite, see this line here:

pip install -i https://test.pypi.org/simple/ PennyLane-Lightning --pre --upgrade

This could potentially be an alternative, however, the fact that the binaries are available on Test PyPi might change in the future.

@albi3ro
Copy link
Contributor

albi3ro commented Jan 19, 2024

Closing this issue as stale, and as pennylane and pennylane-lightning have both substantially changed since this issue was opened.

@albi3ro albi3ro closed this as completed Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants