Open wangqiuoe opened 1 month ago
Hi @wangqiuoe ,
Thank you for opening this issue. I'm not being able to replicate your problem. It looks to me like an installation issue.
I recommended that you create a new virtual environment to avoid any installation issues. You can create a virtual environment with Conda and install Strawberry Fields as follows:
Note that you will be installing 3 packages here: Strawberry Fields, Jupyter, and Matplotlib. Also, note that where it says
If you're still having trouble in your newly created environment please post here the output of sf.about()
import strawberryfields as sf
sf.about()
Please let us know if this resolves your issue!
Hi @CatalinaAlbornoz
I have followed your method and it still ends at the same point as before
Traceback (most recent call last):
File "/home/qcl/Downloads/strawberryfields-master/examples/gate_teleportation.py", line 2, in <module>
import strawberryfields as sf
File "/home/qcl/anaconda3/envs/sf/lib/python3.10/site-packages/strawberryfields/__init__.py", line 24, in <module>
from . import apps
File "/home/qcl/anaconda3/envs/sf/lib/python3.10/site-packages/strawberryfields/apps/__init__.py", line 36, in <module>
import strawberryfields.apps.qchem
File/home/1/anaconda3/envs/sf/lib/python3.10/site-packages/strawberryfields/apps/qchem/__init__.py", line 34, in <module>
import strawberryfields.apps.qchem.dynamics
File/home/qcl/anaconda3/envs/sf/lib/python3.10/site-packages/strawberryfields/apps/qchem/dynamics.py", line 73, in <module>
import strawberryfields.utills import operation
File "/home/qcl/anaconda3/envs/sf/lib/python3.10/site-packages/strawberryfields/utils/__init__.py", line 21, in <module>
from .program_funstions import *
from import File/hone/qcl/anaconda3/envs/sf/lib/python3.18/site-packages/strawberryfields/utils/program_functions.py", line 28, in <module>
fron strawberryfields.engine import LocalEngine
File "/home/qcl/anaconda3/envs/sf/lib/python3.18/site-packages/strawberryfields/engine.py", line 29, in <module>
from strawberryfields.device import Device
File "/home/qcl/anaconda3/envs/sf/lib/python3.10/site-packages/strawberryfields/device.py", line 23, in <module>
from strawberryfields.io import to_program
File "/home/qcl/anaconda3/envs/sf/lib/python3.10/site-packages/strawberryfields/io/__init.py__", line 26, in <module>
from strawberryfields.program import Program
File " /home/qcl/anaconda3/envs/sf/lib/python3.18/site-packages/strawberryfields/program.py", line 62, in <module>
from strawberryfields.compilers import Compiler, compiler_db
File "/hone/ /qcl/ /anaconda3/envs/sf/lib/python3.10/site-packages/strawberryfields/compilers/__init__.py", line 40, in <module>
from .xcov import Xcov
File "/home/qcl/anaconda3/envs/sf/lib/python3.10/site-packages/strawberryftelds/comptlers/xcov.py", line 25, in <module>
import strawberryfields.ops as ops
File "/home/qcl/anaconda3/envs/sf/lib/python3.10/site-packages/strawberryfields/ops.py", line 33, in <module>
from .backends.states import BaseFockState, BaseGaussianState, BaseBosonicState
File "/home/qcl/anaconda3/envs/sf/lib/python3.10/site-packages/strawberryfields/backends/__init__.py", line 72, in <module>
from .gaussianbackend import GaussianBackend
File "/home/qcl/anaconda3/envs/sf/11b/python3.10/site-packages/strawberryflelds/backends/gausstanbackend/__init__.py", line 16, in <module>
from .backend import GaussianBackend
"/home/qcl/anaconda3/envs/sf/lib/python3.10/site-packages/strawberryflelds/backends/gausstanbackend/backend.py", line 23, in <module>
from strawberryfields.backends.states import BaseGaussianState
File "/home/qcl/anaconda3/envs/sf/lib/python3.10/site-packages/strawberryfields/backends/states.py", line 27, in <module>
from scipy.integrate import simps
ImportError: cannot import name 'simps' from 'scipy.integrate' (/home/qcl/.local/lib/python3.10/site-packages/scipy/integrate/init_.py)
I have python==3.10
Hi @umar1kfarooq-king ,
You can try using Google Colab. This would be the recommended option.
If you need to install locally: If the local Conda instructions don't work you can try creating the virtual environment with venv. The document attached shows the instructions on how to create the virtual environment and install PennyLane. In this case instead of installing PennyLane you can install Strawberry Fields. PennyLane installation instructions 2024.pdf
I hope this helps.
@CatalinaAlbornoz
I just installed strawberryfields and facing same issue with import.
I'm using Python 3.10
I checked scipy, they don't have a function scipy.integrate.simps
(at least not anymore). The function called scipy.integrate.simpson
:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.simpson.html
OK. scipy deprecated simps
https://github.com/scipy/scipy/issues/21070
Before posting a bug report
Expected behavior
import pacakage successfully
Actual behavior
After installation, when doing
from strawberryfields.apps import points, plot
, it reports the import error.I've checked scipy.integrate, and the current version has
simpson
instead ofsimps
methodReproduces how often
100%
System information
Source code
No response
Tracebacks
No response
Additional information
No response