AttributeError("'numpy.ndarray' object has no attribute 'name'")
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- developer-experience
Hướng nghiên cứu
Tái hiện thiết lập Julia 1.11 và Python 3.12 đã được báo cáo, bắt đầu với writer.addDetector(reg). So sánh các lệnh gọi dựa trên pyimport với việc thực thi bên trong capsule py"""...""", sau đó kiểm tra pyg4ometry/gdml/Writer.py tại addDetector, writePhysicalVolume và writeVectorVariable. Hoàn thành có nghĩa là xác định liệu PyCall có gây ra sự không khớp giữa ndarray và object hay không, đồng thời ghi lại hoặc sửa hành vi tương thích.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I intend to execute example at github page of pyg4ometry module https://github.com/g4edge/pyg4ometry.
import pyg4ometry as pg4
from g4edgetestdata import G4EdgeTestData
g4data = G4EdgeTestData()
# define a geometry registry
reg = pg4.geant4.Registry()
# build the world volume
world_s = pg4.geant4.solid.Orb("WorldAir", 1.5, reg, lunit="cm")
world_l = pg4.geant4.LogicalVolume(world_s, "G4_AIR", "WorldAir", reg)
reg.setWorld(world_l)
# import an STL file
reader = pg4.stl.Reader(g4data["stl/utah_teapot.stl"], registry=reg)
teapot_s = reader.getSolid()
# place the teapot in the world
teapot_l = pg4.geant4.LogicalVolume(teapot_s, "G4_Cu", "UtahTeapot", reg)
pg4.geant4.PhysicalVolume([0, 0, 0], [0, 0, 0], teapot_l, "UtahTeapot", world_l, reg)
# export to GDML file "geometry.gdml"
writer = pg4.gdml.Writer()
writer.addDetector(reg)
writer.write("./geometry.gdml")
# start an interactive VTK viewer instance
viewer = pg4.visualisation.VtkViewer()
viewer.addLogicalVolume(reg.getWorldVolume())
viewer.view()
For PyCall i create virtual environment with pyg4ometry and pybdsim installed. No ROOT usage is required. PyCall is then build with python executable from that environment.
I replace the first 3 lines with
pg4 = pyimport("pyg4ometry")
g4etd = pyimport("g4edgetestdata")
g4data = g4etd.G4EdgeTestData()
Executions breaks at line
writer.addDetector(reg)
with
ERROR: PyError ($(Expr(:escape, :(ccall(#= /home/alpha/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'AttributeError'>
AttributeError("'numpy.ndarray' object has no attribute 'name'")
File "/home/alpha/pythonenvs/paper2024c/lib/python3.12/site-packages/pyg4ometry/gdml/Writer.py", line 76, in addDetector
self.writeLogicalVolume(logical)
File "/home/alpha/pythonenvs/paper2024c/lib/python3.12/site-packages/pyg4ometry/gdml/Writer.py", line 381, in writeLogicalVolume
dve = self.writePhysicalVolume(dv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alpha/pythonenvs/paper2024c/lib/python3.12/site-packages/pyg4ometry/gdml/Writer.py", line 429, in writePhysicalVolume
self.writeVectorVariable(pvol, pv.rotation)
File "/home/alpha/pythonenvs/paper2024c/lib/python3.12/site-packages/pyg4ometry/gdml/Writer.py", line 190, in writeVectorVariable
if allow_ref and vv.name in self.registry.defineDict:
^^^^^^^
Stacktrace:
[1] pyerr_check
@ ~/.julia/packages/PyCall/1gn3u/src/exception.jl:75 [inlined]
[2] pyerr_check
@ ~/.julia/packages/PyCall/1gn3u/src/exception.jl:79 [inlined]
[3] _handle_error(msg::String)
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/exception.jl:96
[4] macro expansion
@ ~/.julia/packages/PyCall/1gn3u/src/exception.jl:110 [inlined]
[5] #107
@ ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:43 [inlined]
[6] disable_sigint
@ ./c.jl:167 [inlined]
[7] __pycall!
@ ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:42 [inlined]
[8] _pycall!(ret::PyObject, o::PyObject, args::Tuple{PyObject}, nargs::Int64, kw::Ptr{Nothing})
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:29
[9] _pycall!(ret::PyObject, o::PyObject, args::Tuple{PyObject}, kwargs::@Kwargs{})
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:11
[10] (::PyObject)(::PyObject, ::Vararg{Any}; kwargs::@Kwargs{})
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:86
[11] top-level scope
@ ~/modeling/Paper2024c/Calibration/Calibration.jl:89
When Python code is executed in py""" """ capsule, it executes without errors.
Julia Version 1.11.0
Commit 501a4f25c2 (2024-10-07 11:40 UTC)
Build Info:
Note: This is an unofficial build, please report bugs to the project
responsible for this build and not to the Julia project unless you can
reproduce the issue using official builds available at https://julialang.org/downloads
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 128 × Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, icelake-server)
Threads: 64 default, 0 interactive, 32 GC (on 128 virtual cores)
Environment:
LD_LIBRARY_PATH =
JULIA_EDITOR = code
JULIA_NUM_THREADS = 64
- Ngôn ngữ chính
- Julia
- Star
- 1.5k
- Fork
- 186
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của JuliaPy/PyCall.jl
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Meta-Issue: Mutli-threading leads to segfaultsCó thể đã có người làm @topolarity đã nhận 211 ngày trước. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Crashes with Julia 1.12 and Revise.jlCó thể đã có người làm @topolarity đã nhận 211 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Tất cả issue của JuliaPy/PyCall.jl
Issue tương tự
-
broken links in docsĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
JuliaPhysics/BeamletOptics.jl#127 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Chains resumed from `initial_state` take `num_warmup + 1` warm-up stepsCó thể đã có người làm @thevolatilebit đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
TuringLang/AbstractMCMC.jl#220 ·
-
found-by-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
exanauts/SparseDirectSolver.jl#92 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày