pola-rs / pyo3-polars

Plugins/extension for Polars
MIT License
232 stars 38 forks source link

cannot find -lpython3.10: No such file or directory #53

Open wukan1986 opened 8 months ago

wukan1986 commented 8 months ago

derive_expression can not install

kan@DESKTOP-7DFCADR:~/test/pyo3-polars/example/derive_expression$ make install
python3 -m venv venv
venv/bin/pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
Writing to /home/kan/.config/pip/pip.conf
venv/bin/pip install -r requirements.txt
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting maturin
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/88/c0/d4502bc09d630fb6813cfd83007875d29eb17fe92c505fe954c2fc45a6e1/maturin-1.4.0-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64.whl (10.6 MB)
Collecting polars
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ef/91/53eeb28756a25b6ccad7855f3f29eb9d54e202d0077981b39ce2f8221299/polars-0.19.19-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.5 MB)
Collecting tomli>=1.1.0
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/97/75/10a9ebee3fd790d20926a90a2547f0bf78f371b2f13aa822c759680ca7b9/tomli-2.0.1-py3-none-any.whl (12 kB)
Installing collected packages: tomli, polars, maturin
Successfully installed maturin-1.4.0 polars-0.19.19 tomli-2.0.1
unset CONDA_PREFIX && \
source venv/bin/activate && maturin develop -m expression_lib/Cargo.toml
    Updating crates.io index
remote: Enumerating objects: 38034, done.
remote: Counting objects: 100% (23903/23903), done.
remote: Compressing objects: 100% (1066/1066), done.
remote: Total 38034 (delta 22876), reused 23836 (delta 22809), pack-reused 14131
Receiving objects: 100% (38034/38034), 28.43 MiB | 10.20 MiB/s, done.
Resolving deltas: 100% (28824/28824), completed with 1524 local objects.
From https://github.com/rust-lang/crates.io-index
   fe38024d35..29db9c3160             -> origin/HEAD
  Downloaded crossbeam-utils v0.8.17
  Downloaded crossbeam-deque v0.8.4
  Downloaded crossbeam-epoch v0.9.16
  Downloaded ryu v1.0.16
  Downloaded zerocopy v0.7.31
  Downloaded syn v2.0.41
  Downloaded zerocopy-derive v0.7.31
  Downloaded libc v0.2.151
  Downloaded 8 crates (1.8 MB) in 1m 18s
🍹 Building a mixed python/rust project
🔗 Found pyo3 bindings
🐍 Found CPython 3.10 at /home/kan/test/pyo3-polars/example/derive_expression/venv/bin/python
   Compiling autocfg v1.1.0
   Compiling libc v0.2.151
   Compiling version_check v0.9.4

......

   Compiling pyo3-polars-derive v0.3.0 (/home/kan/test/pyo3-polars/pyo3-polars-derive)
   Compiling pyo3-polars v0.9.0 (/home/kan/test/pyo3-polars/pyo3-polars)
   Compiling jemallocator v0.5.4
   Compiling expression_lib v0.1.0 (/home/kan/test/pyo3-polars/example/derive_expression/expression_lib)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/kan/.rustup/toolchains/nightly-2023-10-12-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/kan/test/pyo3-polars/example/derive_expression/venv/bin:/home/kan/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:

......

/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/kan/test/pyo3-polars/target/debug/deps/libexpression_lib.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lpython3.10: No such file or directory
          collect2: error: ld returned 1 exit status

error: could not compile `expression_lib` (lib) due to previous error
💥 maturin failed
  Caused by: Failed to build a native library through cargo
  Caused by: Cargo build finished with "exit status: 101": `env -u CARGO PYO3_ENVIRONMENT_SIGNATURE="cpython-3.10-64bit" PYO3_PYTHON="/home/kan/test/pyo3-polars/example/derive_expression/venv/bin/python" PYTHON_SYS_EXECUTABLE="/home/kan/test/pyo3-polars/example/derive_expression/venv/bin/python" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/home/kan/test/pyo3-polars/example/derive_expression/expression_lib/Cargo.toml" "--lib"`
make: *** [Makefile:10: install] Error 1

Installed versions:

(venv) kan@DESKTOP-7DFCADR:~/test/pyo3-polars/example/derive_expression$ pip list
Package    Version
---------- -------
maturin    1.4.0
pip        22.0.2
polars     0.19.19
setuptools 59.6.0
tomli      2.0.1
(venv) kan@DESKTOP-7DFCADR:~/test/pyo3-polars/example/derive_expression$ python --version
Python 3.10.6
(venv) kan@DESKTOP-7DFCADR:~/test/pyo3-polars/example/derive_expression/venv/bin$ ls -al
total 31764
drwxr-xr-x 2 kan kan     4096 Dec 15 13:40 .
drwxr-xr-x 5 kan kan     4096 Dec 15 13:40 ..
-rw-r--r-- 1 kan kan     9033 Dec 15 13:40 Activate.ps1
-rw-r--r-- 1 kan kan     2024 Dec 15 13:40 activate
-rw-r--r-- 1 kan kan      950 Dec 15 13:40 activate.csh
-rw-r--r-- 1 kan kan     2092 Dec 15 13:40 activate.fish
-rwxr-xr-x 1 kan kan 32480392 Dec 15 13:40 maturin
-rwxr-xr-x 1 kan kan      274 Dec 15 13:40 pip
-rwxr-xr-x 1 kan kan      274 Dec 15 13:40 pip3
-rwxr-xr-x 1 kan kan      274 Dec 15 13:40 pip3.10
lrwxrwxrwx 1 kan kan        7 Dec 15 13:40 python -> python3
lrwxrwxrwx 1 kan kan       16 Dec 15 13:40 python3 -> /usr/bin/python3
lrwxrwxrwx 1 kan kan        7 Dec 15 13:40 python3.10 -> python3
(venv) kan@DESKTOP-7DFCADR:~/test/pyo3-polars/example/derive_expression/venv/lib$ ls -al
total 12
drwxr-xr-x 3 kan kan 4096 Dec 15 13:40 .
drwxr-xr-x 5 kan kan 4096 Dec 15 13:40 ..
drwxr-xr-x 3 kan kan 4096 Dec 15 13:40 python3.10
wukan1986 commented 8 months ago

I can compile and install polars_ds_extension

kan@DESKTOP-7DFCADR:~/test/polars_ds_extension$ make install
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting maturin[patchelf]

......
Installing collected packages: patchelf, tomli, threadpoolctl, polars, pluggy, packaging, numpy, joblib, iniconfig, exceptiongroup, scipy, pytest, maturin, scikit-learn
Successfully installed exceptiongroup-1.2.0 iniconfig-2.0.0 joblib-1.3.2 maturin-1.4.0 numpy-1.26.2 packaging-23.2 patchelf-0.17.2.1 pluggy-1.3.0 polars-0.19.19 pytest-7.4.3 scikit-learn-1.3.2 scipy-1.11.4 threadpoolctl-3.2.0 tomli-2.0.1
unset CONDA_PREFIX && \
source .venv/bin/activate && maturin develop -m Cargo.toml
  Downloaded gemm-f16 v0.16.15
  Downloaded num-iter v0.1.43
  Downloaded matrixcompare-core v0.1.0

......

🍹 Building a mixed python/rust project
🔗 Found pyo3 bindings
🐍 Found CPython 3.10 at /home/kan/test/polars_ds_extension/.venv/bin/python
📡 Using build options features from pyproject.toml
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Ignoring numpy: markers 'extra == "dev"' don't match your environment
Ignoring pytest: markers 'extra == "dev"' don't match your environment
Ignoring pre-commit: markers 'extra == "dev"' don't match your environment
Ignoring scikit-learn: markers 'extra == "dev"' don't match your environment
Ignoring scipy: markers 'extra == "dev"' don't match your environment
Requirement already satisfied: polars>=0.19.19 in ./.venv/lib/python3.10/site-packages (0.19.19)
   Compiling autocfg v1.1.0

......

    Finished dev [unoptimized + debuginfo] target(s) in 59.54s
📦 Built wheel for CPython 3.10 to /tmp/.tmpdlFHTO/polars_ds-0.1.4-cp310-cp310-linux_x86_64.whl
🛠 Installed polars_ds-0.1.4