Closed
Description
Affects: JuliaCall
Describe the bug
The Bloqade.jl library has a function rydberg_h
that has several keyword arguments using unicode characters.
The following bug was discovered where one of those keyword arguments is a U+03D5
phi but at some point juliacall seems to turn that into a U+03C6
phi, causing Julia to complain that theres no function that matches rydberg_h
.
A minimal working example would be the following (assuming Bloqade.jl
is already installed in the Julia environment):
from juliacall import Main as jl
from juliacall import Pkg as jlPkg
from math import pi
jl.seval("using Bloqade")
atoms = jl.Bloqade.generate_sites(jl.Bloqade.SquareLattice(), 3, 4, scale=4.5)
hamiltonian = jl.Bloqade.rydberg_h(atoms, Ω=4*2*pi, Δ=10*2*pi, ϕ=0.0)
Which produces the following error:
---------------------------------------------------------------------------
JuliaError Traceback (most recent call last)
Cell In[4], line 4
1 jl.seval("using Bloqade")
3 atoms = jl.Bloqade.generate_sites(jl.Bloqade.SquareLattice(), 3, 4, scale=4.5)
----> 4 hamiltonian = jl.Bloqade.rydberg_h(atoms, Ω=4*2*pi, Δ=10*2*pi, ϕ=0.0)
File [~/.julia/packages/PythonCall/1f5yE/src/jlwrap/any.jl:208](https://file+.vscode-resource.vscode-cdn.net/Users/jlong/Desktop/vrige-debug/~/.julia/packages/PythonCall/1f5yE/src/jlwrap/any.jl:208), in __call__(self, *args, **kwargs)
206 return ValueBase.__dir__(self) + self._jl_callmethod($(pyjl_methodnum(pyjlany_dir)))
207 def __call__(self, *args, **kwargs):
--> 208 return self._jl_callmethod($(pyjl_methodnum(pyjlany_call)), args, kwargs)
209 def __len__(self):
210 return self._jl_callmethod($(pyjl_methodnum(pyjlany_op(length))))
JuliaError: MethodError: no method matching rydberg_h(::AtomList{2, Float64}; φ::Float64, Ω::Float64, Δ::Float64)
Closest candidates are:
rydberg_h(::Any; C, Ω, ϕ, Δ) got unsupported keyword argument "φ"
@ BloqadeExpr [~/.julia/packages/BloqadeExpr/yw55x/src/interface.jl:85](https://file+.vscode-resource.vscode-cdn.net/Users/jlong/Desktop/vrige-debug/~/.julia/packages/BloqadeExpr/yw55x/src/interface.jl:85)
rydberg_h(::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any) got unsupported keyword arguments "φ", "Ω", "Δ"
@ BloqadeExpr [~/.julia/packages/BloqadeExpr/yw55x/src/interface.jl:89](https://file+.vscode-resource.vscode-cdn.net/Users/jlong/Desktop/vrige-debug/~/.julia/packages/BloqadeExpr/yw55x/src/interface.jl:89)
Stacktrace:
[1] kwerr(::NamedTuple{(:φ, :Ω, :Δ), Tuple{Float64, Float64, Float64}}, ::Function, ::AtomList{2, Float64})
@ Base [./error.jl:165](https://file+.vscode-resource.vscode-cdn.net/Users/jlong/Desktop/vrige-debug/error.jl:165)
[2] pyjlany_call(self::typeof(rydberg_h), args_::Py, kwargs_::Py)
@ PythonCall [~/.julia/packages/PythonCall/1f5yE/src/jlwrap/any.jl:34](https://file+.vscode-resource.vscode-cdn.net/Users/jlong/Desktop/vrige-debug/~/.julia/packages/PythonCall/1f5yE/src/jlwrap/any.jl:34)
[3] _pyjl_callmethod(f::Any, self_::Ptr{PythonCall.C.PyObject}, args_::Ptr{PythonCall.C.PyObject}, nargs::Int64)
@ PythonCall [~/.julia/packages/PythonCall/1f5yE/src/jlwrap/base.jl:69](https://file+.vscode-resource.vscode-cdn.net/Users/jlong/Desktop/vrige-debug/~/.julia/packages/PythonCall/1f5yE/src/jlwrap/base.jl:69)
[4] _pyjl_callmethod(o::Ptr{PythonCall.C.PyObject}, args::Ptr{PythonCall.C.PyObject})
@ PythonCall.C [~/.julia/packages/PythonCall/1f5yE/src/cpython/jlwrap.jl:47](https://file+.vscode-resource.vscode-cdn.net/Users/jlong/Desktop/vrige-debug/~/.julia/packages/PythonCall/1f5yE/src/cpython/jlwrap.jl:47)
Your system
- OS: Mac OS Ventura 13.3.1, M1 Pro Macbook
- Julia: 1.9.1
- Python: 3.11.3
- JuliaCall
conda list
# Name Version Build Channel
appnope 0.1.3 pyhd8ed1ab_0 conda-forge
asttokens 2.2.1 pyhd8ed1ab_0 conda-forge
backcall 0.2.0 pyh9f0ad1d_0 conda-forge
backports 1.0 pyhd8ed1ab_3 conda-forge
backports.functools_lru_cache 1.6.5 pyhd8ed1ab_0 conda-forge
bzip2 1.0.8 h620ffc9_4
ca-certificates 2023.5.7 hf0a4a13_0 conda-forge
contourpy 1.1.0 pypi_0 pypi
cycler 0.11.0 pypi_0 pypi
debugpy 1.5.1 py311h313beb8_0
decorator 5.1.1 pyhd8ed1ab_0 conda-forge
executing 1.2.0 pyhd8ed1ab_0 conda-forge
fonttools 4.40.0 pypi_0 pypi
importlib-metadata 6.7.0 pyha770c72_0 conda-forge
importlib_metadata 6.7.0 hd8ed1ab_0 conda-forge
ipykernel 6.15.0 pyh736e0ef_0 conda-forge
ipython 8.14.0 pyhd1c38e8_0 conda-forge
jedi 0.18.2 pyhd8ed1ab_0 conda-forge
juliacall 0.9.13 pypi_0 pypi
juliapkg 0.1.10 pypi_0 pypi
jupyter_client 8.3.0 pyhd8ed1ab_0 conda-forge
jupyter_core 5.3.0 py311hca03da5_0
kiwisolver 1.4.4 pypi_0 pypi
libcxx 16.0.6 h4653b0c_0 conda-forge
libffi 3.4.4 hca03da5_0
libsodium 1.0.18 h27ca646_1 conda-forge
matplotlib 3.7.1 pypi_0 pypi
matplotlib-inline 0.1.6 pyhd8ed1ab_0 conda-forge
ncurses 6.4 h313beb8_0
nest-asyncio 1.5.6 pyhd8ed1ab_0 conda-forge
numpy 1.25.0 pypi_0 pypi
openssl 3.1.1 h53f4e23_1 conda-forge
packaging 23.1 pyhd8ed1ab_0 conda-forge
parso 0.8.3 pyhd8ed1ab_0 conda-forge
pexpect 4.8.0 pyh1a96a4e_2 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pillow 9.5.0 pypi_0 pypi
pip 23.1.2 py311hca03da5_0
platformdirs 3.8.0 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.38 pyha770c72_0 conda-forge
prompt_toolkit 3.0.38 hd8ed1ab_0 conda-forge
psutil 5.9.0 py311h80987f9_0
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge
pure_eval 0.2.2 pyhd8ed1ab_0 conda-forge
pygments 2.15.1 pyhd8ed1ab_0 conda-forge
pyparsing 3.1.0 pypi_0 pypi
python 3.11.3 hb885b13_1
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
pyzmq 25.1.0 py311h313beb8_0
readline 8.2 h1a28f6b_0
semantic-version 2.10.0 pypi_0 pypi
setuptools 67.8.0 py311hca03da5_0
six 1.16.0 pyh6c4a22f_0 conda-forge
sqlite 3.41.2 h80987f9_0
stack_data 0.6.2 pyhd8ed1ab_0 conda-forge
tk 8.6.12 hb8d0fd4_0
tornado 6.2 py311h80987f9_0
traitlets 5.9.0 pyhd8ed1ab_0 conda-forge
typing-extensions 4.6.3 hd8ed1ab_0 conda-forge
typing_extensions 4.6.3 pyha770c72_0 conda-forge
tzdata 2023c h04d1e81_0
wcwidth 0.2.6 pyhd8ed1ab_0 conda-forge
wheel 0.38.4 py311hca03da5_0
xz 5.4.2 h80987f9_0
zeromq 4.3.4 hbdafb3b_1 conda-forge
zipp 3.15.0 pyhd8ed1ab_0 conda-forge
zlib 1.2.13 h5a0b063_0
juliapkg.status()
[bd27d05e] Bloqade v0.1.23
[9a3f8284] Random
Additional context
I'm testing this in a Jupyter Notebook in VSCode with conda but the bug was originally discovered while being used in Pycharm with conda.