Module Builds Without Attributes
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- cmake, python
- Lĩnh vực
- build-system
Hướng nghiên cứu
Bắt đầu với CMakeLists.txt và các bước cài đặt trong issue, sau đó tái hiện việc import và kiểm tra dir(scikit_build_example). Cách giải quyết được báo cáo là import scikit_build_example._core, vì vậy hãy xác nhận rằng cách này cung cấp add và subtract, đồng thời xác định xem ví dụ hay hướng dẫn của nó có nên làm rõ cách sử dụng đó hay không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Following the instructions I am able to build and import the python module. However the module is missing all attributes (add, docs, subtract),
- Cloned the repo
- Open powershell v7.5.4 Run pip install ./scikit_build_example (pip version 26.0.1)
- Run python (version 3.14)
import scikit_build_examplescikit_build_example.add(1,2)- receive error: AttributeError: module 'scikit_build_example' has no attribute 'add'
Theorized that it may have to do with how pybind11 is linked
- placed pybind11 in submodule scikit_build_example/extern/pybind11
- commented line 14 in CMakeLists.txt
- added line: "add_subdirectory(extern/pybind11)
- Open powershell run
pip install ./scikit_build_example
pip uninstalled scikit_build_example-0.0.1
pip installed scikit_build_example-0.01 - Run python
6.import scikit_build_example scikit_build_example.add(1,2)- receive error: AttributeError: module 'scikit_build_example' has no attribute 'add'
For both cases the python dir(module) command output line
dir(scikit_build_example)
['doc', 'file', 'loader', 'name', 'package', 'path', 'spec']
Nox log has been attached
Help would be appreciated in resolving this issue
*Edit: Solution
- I have a python version with path name "python" and a different version with "py"
used the command python -m pip install, with python -m pip list to ensure the package existed in the correct version - Using the pip uninstall command the output:
*\python314\lib\site-packages\hello-0.0.1.dist-info*
*\python314\lib\site-packages\hello_core.cp314-win_amd64.pyd
gave me a clue that the attributes were being stored in a second location. Issue #63 contained the final clue to the naming convention to get access to the attributes
The automatically generated signatures of the class functions contain then something like packagename.modulename.classname
Therefore in order to get access to the defined attributes and follow the tutorial the import statement must be
import scikit_build_example._core
scikit_build_example._core.add(1,2)
'dir(scikit_build_example._core)'
['doc', 'file', 'loader', 'name', 'package', 'spec', 'version', 'add', 'subtract']
- Ngôn ngữ chính
- Python
- Star
- 147
- Fork
- 39
- 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 pybind/scikit_build_example
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 65/100
pybind/scikit_build_example#209 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
pybind/scikit_build_example#189 · 3 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
pybind/scikit_build_example#181 · 4 bình luận ·
-
pip install fail to linkĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
pybind/scikit_build_example#162 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 50/100
pybind/scikit_build_example#161 · 1 reaction ·
Tất cả issue của pybind/scikit_build_example
Issue tương tự
-
app: scripts Bucket: KTLO status: backlog type: housekeeping
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
netbox-community/netbox-scripts#217 ·
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 64/100
-
ApacheTomcatImporterPipeline truncates milestone fixed versions (e.g. 11.0.0-M6 -> 11.0.0)Có thể đã có người làm @nikolya-ctrl đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
aboutcode-org/vulnerablecode#2533 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
PermafrostDiscoveryGateway/water-timeseries-v2#312 ·
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 72/100
ClickHouse/dbt-clickhouse#829 ·
Maintainer thường phản hồi trong vòng 1 ngày