Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

The path where headers are installed on Windows is not found (by default) by setuptools

Đang mở
#78 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
38/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cpp, python
Lĩnh vực
build-system

Hướng nghiên cứu

Bắt đầu với bản tái hiện bằng setup.py và ví dụ pkg.cpp, sau đó kiểm tra cách gói conda trên Windows đặt các header của xtensor-python trong $envprefix/Library/include. Xác nhận thay đổi bằng cách chạy python setup.py build trên Windows và kiểm tra rằng setuptools tìm thấy các header từ đường dẫn include mặc định.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Issue:
On Linux, the conda xtensor-python package installs the headers at $envprefix/include, which is searched by default when building extensions with setuptools. This is good!
On Windows, however, the headers are installed at $envprefix/Library/include, which is not searched by setuptools by default (one needs to fiddle with os.environ["CONDA_PREFIX"] in setup.py to add the path). Instead, they could be installed at $envprefix/include, and things would work fine.

One can repro e.g. by running python setup.py build with the following setup.py:

from setuptools import setup
from pybind11.setup_helpers import Pybind11Extension                                                                                                                                                                                            setup(
    name="testpkg",
    ext_modules=[Pybind11Extension("pkg", ["pkg.cpp"])],
)

and pkg.cpp, basically copied from xtensor-python's docs:

#include <numeric>                        // Standard library import for std::accumulate
#include "pybind11/pybind11.h"            // Pybind11 import to define Python bindings
#include "xtensor/xmath.hpp"              // xtensor import for the C++ universal functions
#define FORCE_IMPORT_ARRAY                // numpy C api loading
#include "xtensor-python/pyarray.hpp"     // Numpy bindings

double sum_of_sines(xt::pyarray<double>& m)
{
    auto sines = xt::sin(m);  // sines does not actually hold values.
    return std::accumulate(sines.cbegin(), sines.cend(), 0.0);
}

PYBIND11_MODULE(pkg, m)
{
    xt::import_numpy();
    m.doc() = "Test module for xtensor python bindings";

    m.def("sum_of_sines", sum_of_sines, "Sum the sines of the input values");
}

(Note that the same problem actually applies for xtensor itself, but I'm only opening it here.)


Environment (conda list):

Clean environment created with conda create -n tmpenv -c conda-forge python=3.9 xtensor-python.

$ conda list
# packages in environment at C:\Users\Antony\miniconda3\envs\tmpenv:
#
# Name                    Version                   Build  Channel
ca-certificates           2021.5.30            h5b45459_0    conda-forge
certifi                   2021.5.30        py39hcbf5309_0    conda-forge
intel-openmp              2021.2.0           h57928b3_616    conda-forge
libblas                   3.9.0                     9_mkl    conda-forge
libcblas                  3.9.0                     9_mkl    conda-forge
liblapack                 3.9.0                     9_mkl    conda-forge
mkl                       2021.2.0           hb70f87d_389    conda-forge
numpy                     1.20.3           py39h6635163_1    conda-forge
openssl                   1.1.1k               h8ffe710_0    conda-forge
pip                       21.1.2             pyhd8ed1ab_0    conda-forge
pybind11                  2.6.2            py39h2e07f2f_0    conda-forge
pybind11-global           2.6.2            py39h2e07f2f_0    conda-forge
python                    3.9.4           h7840368_0_cpython    conda-forge
python_abi                3.9                      1_cp39    conda-forge
setuptools                49.6.0           py39hcbf5309_3    conda-forge
sqlite                    3.35.5               h8ffe710_0    conda-forge
tbb                       2021.2.0             h2d74725_0    conda-forge
tzdata                    2021a                he74cb21_0    conda-forge
vc                        14.2                 hb210afc_4    conda-forge
vs2015_runtime            14.28.29325          h5e1d092_4    conda-forge
wheel                     0.36.2             pyhd3deb0d_0    conda-forge
wincertstore              0.2             py39hcbf5309_1006    conda-forge
xtensor                   0.23.10              h5362a0b_0    conda-forge
xtensor-python            0.25.2           py39h66837cb_0    conda-forge
xtl                       0.7.2                h5362a0b_1    conda-forge

Details about conda and system ( conda info ):
$ conda info
     active environment : tmpenv
    active env location : C:\Users\Antony\miniconda3\envs\tmpenv
            shell level : 3
       user config file : C:\Users\Antony\.condarc
 populated config files :
          conda version : 4.9.2
    conda-build version : 3.20.5
         python version : 3.8.3.final.0
       virtual packages : __win=0=0
                          __archspec=1=x86_64
       base environment : C:\Users\Antony\miniconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\Antony\miniconda3\pkgs
                          C:\Users\Antony\.conda\pkgs
                          C:\Users\Antony\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\Antony\miniconda3\envs
                          C:\Users\Antony\.conda\envs
                          C:\Users\Antony\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.9.2 requests/2.23.0 CPython/3.8.3 Windows/10 Windows/10.0.19041
          administrator : False
             netrc file : None
           offline mode : False
Ngôn ngữ chính
Shell
Star
1
Fork
12
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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của conda-forge/xtensor-python-feedstock

Tất cả issue của conda-forge/xtensor-python-feedstock

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.