PyO3 / maturin

Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages
https://maturin.rs
Apache License 2.0
3.54k stars 242 forks source link

Mixted rust/python project fails to install on windows with maturin 1.7 #2141

Closed ManonMarchand closed 1 week ago

ManonMarchand commented 1 week ago

Bug Description

Hi!

On windows in a mixed rust/python project, running

maturin build --release

works perfectly, but then

pip install .

Fails with File mocpy\mocpy.cp312-win_amd64.pyd was already added from D:\a\mocpy\mocpy\python\mocpy\mocpy.cp312-win_amd64.pyd, can't added it from D:\a\mocpy\mocpy\target\release\maturin\mocpy.dll

It looks like the check was added in maturin 1.7 with these lines https://github.com/PyO3/maturin/blob/2061d01bf40ee4c753cc03b84e22ac226a962414/src/module_writer.rs#L551 where I'd expect in this case that the source files would be identified as being the same.

Maybe I'm building two different files and I'm not aware? Here is a link to our repo https://github.com/cds-astro/mocpy

Your maturin version (maturin --version)

1.7 (works with 1.6)

Your Python version (python -V)

all fail (3.8 to 3.12)

Your pip version (pip -V)

24.1

What bindings you're using

pyo3

Does cargo build work?

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

Steps to Reproduce

  1. find a windows machine (here github public runner, it runs windows 2022)
  2. pip install maturin
  3. maturin develop --release
  4. pip install .
Details

Run # Install, create and activate a python virtualenv Collecting virtualenv Downloading virtualenv-20.26.3-py3-none-any.whl.metadata (4.5 kB) Collecting distlib<1,>=0.3.7 (from virtualenv) Downloading distlib-0.3.8-py2.py3-none-any.whl.metadata (5.1 kB) Collecting filelock<4,>=3.12.2 (from virtualenv) Downloading filelock-3.15.4-py3-none-any.whl.metadata (2.9 kB) Collecting platformdirs<5,>=3.9.1 (from virtualenv) Downloading platformdirs-4.2.2-py3-none-any.whl.metadata (11 kB) Downloading virtualenv-20.26.3-py3-none-any.whl (5.7 MB) ---------------------------------------- 5.7/5.7 MB 72.8 MB/s eta 0:00:00 Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB) --------------------------------------- 468.9/468.9 kB 28.7 MB/s eta 0:00:00 Downloading filelock-3.15.4-py3-none-any.whl (16 kB) Downloading platformdirs-4.2.2-py3-none-any.whl (18 kB) Installing collected packages: distlib, platformdirs, filelock, virtualenv Successfully installed distlib-0.3.8 filelock-3.15.4 platformdirs-4.2.2 virtualenv-20.26.3 Notice: A new release of pip is available: 24.1.1 -> 24.1.2 Notice: To update, run: python.exe -m pip install --upgrade pip created virtual environment CPython3.12.4.final.0-64 in 849ms creator CPython3Windows(dest=D:\a\mocpy\mocpy\mocpy-env, clear=False, no_vcs_ignore=False, global=False) seeder FromAppData(download=False, pip=bundle, via=copy, app_data_dir=C:\Users\runneradmin\AppData\Local\pypa\virtualenv) added seed packages: pip==24.1 activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator Collecting maturin Downloading maturin-1.7.0-py3-none-win_amd64.whl.metadata (18 kB) Downloading maturin-1.7.0-py3-none-win_amd64.whl (7.3 MB) ---------------------------------------- 7.3/7.3 MB 78.5 MB/s eta 0:00:00 Installing collected packages: maturin Successfully installed maturin-1.7.0 Notice: A new release of pip is available: 24.1 -> 24.1.2 Notice: To update, run: python.exe -m pip install --upgrade pip Updating crates.io index Locking 82 packages to latest compatible versions Adding base64 v0.21.7 (latest: v0.22.1) Adding bitflags v1.3.2 (latest: v2.6.0) Adding heck v0.4.1 (latest: v0.5.0) Adding moc v0.14.2 (latest: v0.15.0) Adding numpy v0.20.0 (latest: v0.21.0) Adding pyo3 v0.20.3 (latest: v0.22.1) Adding pyo3-build-config v0.20.3 (latest: v0.22.1) Adding pyo3-ffi v0.20.3 (latest: v0.22.1) Adding pyo3-macros v0.20.3 (latest: v0.22.1) Adding pyo3-macros-backend v0.20.3 (latest: v0.22.1) Adding rustc-hash v1.1.0 (latest: v2.0.0) Downloading crates ... Downloaded num_threads v0.1.7 Downloaded unindent v0.2.3 Downloaded redox_syscall v0.5.2 Downloaded windows-targets v0.52.6 Downloaded target-lexicon v0.12.14 Downloaded thiserror v1.0.61 Downloaded unicode-ident v1.0.12 Downloaded png v0.17.13 Downloaded serde_json v1.0.120 Downloaded rayon v1.10.0 Downloaded syn v2.0.69 Downloaded stc-s v0.1.0 Downloaded windows_aarch64_gnullvm v0.52.6 Downloaded windows_x86_64_gnullvm v0.52.6 Downloaded windows_i686_gnullvm v0.52.6 Downloaded libc v0.2.155 Downloaded windows_x86_64_msvc v0.52.6 Downloaded windows_x86_64_gnu v0.52.6 Downloaded windows_i686_msvc v0.52.6 Downloaded windows_i686_gnu v0.52.6 Downloaded windows_aarch64_msvc v0.52.6 Downloaded pyo3 v0.20.3 Downloaded ndarray v0.15.6 Downloaded mapproj v0.3.0 Downloaded portable-atomic v1.6.0 Downloaded moc v0.14.2 Downloaded numpy v0.20.0 Downloaded num-bigint v0.4.6 Downloaded nom v7.1.3 Downloaded minimal-lexical v0.2.1 Downloaded memchr v2.7.4 Downloaded cdshealpix v0.6.9 Downloaded base64 v0.21.7 Downloaded serde_derive v1.0.204 Downloaded rayon-core v1.12.1 Downloaded proc-macro2 v1.0.86 Downloaded parking_lot v0.12.3 Downloaded num-traits v0.2.19 Downloaded miniz_oxide v0.7.4 Downloaded matrixmultiply v0.3.8 Downloaded flate2 v1.0.30 Downloaded crossbeam-utils v0.8.20 Downloaded slab v0.4.9 Downloaded serde v1.0.204 Downloaded ryu v1.0.18 Downloaded quick-error v2.0.1 Downloaded pyo3-ffi v0.20.3 Downloaded pyo3-build-config v0.20.3 Downloaded num-complex v0.4.6 Downloaded heck v0.4.1 Downloaded fdeflate v0.3.4 Downloaded adler v1.0.2 Downloaded smallvec v1.13.2 Downloaded simd-adler32 v0.3.7 Downloaded scopeguard v1.2.0 Downloaded rustc-hash v1.1.0 Downloaded quote v1.0.36 Downloaded pyo3-macros-backend v0.20.3 Downloaded pyo3-macros v0.20.3 Downloaded parking_lot_core v0.9.10 Downloaded num-iter v0.1.45 Downloaded memoffset v0.9.1 Downloaded itoa v1.0.11 Downloaded crossbeam-epoch v0.9.18 Downloaded crc32fast v1.4.2 Downloaded thiserror-impl v1.0.61 Downloaded num-rational v0.4.2 Downloaded num-integer v0.1.46 Downloaded num v0.4.3 Downloaded lock_api v0.4.12 Downloaded indoc v2.0.5 Downloaded bitflags v2.6.0 Downloaded rawpointer v0.2.1 Downloaded once_cell v1.19.0 Downloaded katex-doc v0.1.0 Downloaded either v1.13.0 Downloaded crossbeam-deque v0.8.5 Downloaded cfg-if v1.0.0 Downloaded byteorder v1.5.0 Downloaded bitflags v1.3.2 Downloaded autocfg v1.3.0 šŸ“¦ Including license file "D:\a\mocpy\mocpy\LICENSE" šŸ¹ Building a mixed python/rust project šŸ”— Found pyo3 bindings šŸ Found CPython 3.12 at D:\a\mocpy\mocpy\mocpy-env\Scripts\python.exe šŸ“” Using build options profile, frozen, locked, bindings from pyproject.toml Ignoring astropy: markers 'python_version == "3.8"' don't match your environment Ignoring requests: markers 'extra == "query-fits"' don't match your environment Ignoring regions: markers 'extra == "astropy-regions"' don't match your environment Ignoring astropy-sphinx-theme: markers 'extra == "docs"' don't match your environment Ignoring astropy-healpix: markers 'extra == "docs"' don't match your environment Ignoring nbsphinx: markers 'extra == "docs"' don't match your environment Ignoring numpydoc: markers 'extra == "docs"' don't match your environment Ignoring sphinx-astropy: markers 'extra == "docs"' don't match your environment Ignoring sphinx-collections: markers 'extra == "docs"' don't match your environment Ignoring sphinx-copybutton: markers 'extra == "docs"' don't match your environment Ignoring sphinx-gallery: markers 'extra == "docs"' don't match your environment Ignoring sphinxcontrib-bibtex: markers 'extra == "docs"' don't match your environment Ignoring astropy-healpix: markers 'extra == "dev"' don't match your environment Ignoring pre-commit: markers 'extra == "dev"' don't match your environment Ignoring pytest: markers 'extra == "dev"' don't match your environment Ignoring pytest-mock: markers 'extra == "dev"' don't match your environment Ignoring pytest-cov: markers 'extra == "dev"' don't match your environment Ignoring requests: markers 'extra == "dev"' don't match your environment Ignoring regions: markers 'extra == "dev"' don't match your environment Ignoring ruff: markers 'extra == "dev"' don't match your environment Ignoring astroquery: markers 'extra == "notebooks"' don't match your environment Ignoring ipyaladin: markers 'extra == "notebooks"' don't match your environment Ignoring regions: markers 'extra == "notebooks"' don't match your environment Ignoring nbmake: markers 'extra == "notebooks"' don't match your environment Collecting astropy Downloading astropy-6.1.1-cp312-cp312-win_amd64.whl.metadata (10 kB) Collecting numpy<2.0 Downloading numpy-1.26.4-cp312-cp312-win_amd64.whl.metadata (61 kB) ---------------------------------------- 61.0/61.0 kB 3.4 MB/s eta 0:00:00 Collecting matplotlib Downloading matplotlib-3.9.1-cp312-cp312-win_amd64.whl.metadata (11 kB) Collecting cdshealpix>=0.6.4 Downloading cdshealpix-0.6.5-cp312-none-win_amd64.whl.metadata (3.9 kB) Collecting networkx>=2.5 Downloading networkx-3.3-py3-none-any.whl.metadata (5.1 kB) Collecting pyerfa>=2.0.1.1 (from astropy) Downloading pyerfa-2.0.1.4-cp39-abi3-win_amd64.whl.metadata (5.9 kB) Collecting astropy-iers-data>=0.2024.5.27.0.30.8 (from astropy) Downloading astropy_iers_data-0.2024.7.8.0.31.19-py3-none-any.whl.metadata (5.1 kB) Collecting PyYAML>=3.13 (from astropy) Downloading PyYAML-6.0.1-cp312-cp312-win_amd64.whl.metadata (2.1 kB) Collecting packaging>=19.0 (from astropy) Downloading packaging-24.1-py3-none-any.whl.metadata (3.2 kB) Collecting contourpy>=1.0.1 (from matplotlib) Downloading contourpy-1.2.1-cp312-cp312-win_amd64.whl.metadata (5.8 kB) Collecting cycler>=0.10 (from matplotlib) Downloading cycler-0.12.1-py3-none-any.whl.metadata (3.8 kB) Collecting fonttools>=4.22.0 (from matplotlib) Downloading fonttools-4.53.1-cp312-cp312-win_amd64.whl.metadata (165 kB) ------------------------------------- 165.9/165.9 kB 10.4 MB/s eta 0:00:00 Collecting kiwisolver>=1.3.1 (from matplotlib) Downloading kiwisolver-1.4.5-cp312-cp312-win_amd64.whl.metadata (6.5 kB) Collecting pillow>=8 (from matplotlib) Downloading pillow-10.4.0-cp312-cp312-win_amd64.whl.metadata (9.3 kB) Collecting pyparsing>=2.3.1 (from matplotlib) Downloading pyparsing-3.1.2-py3-none-any.whl.metadata (5.1 kB) Collecting python-dateutil>=2.7 (from matplotlib) Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB) Collecting six>=1.5 (from python-dateutil>=2.7->matplotlib) Downloading six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB) Downloading astropy-6.1.1-cp312-cp312-win_amd64.whl (6.4 MB) ---------------------------------------- 6.4/6.4 MB 81.7 MB/s eta 0:00:00 Downloading numpy-1.26.4-cp312-cp312-win_amd64.whl (15.5 MB) ---------------------------------------- 15.5/15.5 MB 81.8 MB/s eta 0:00:00 Downloading matplotlib-3.9.1-cp312-cp312-win_amd64.whl (8.0 MB) ---------------------------------------- 8.0/8.0 MB 84.7 MB/s eta 0:00:00 Downloading cdshealpix-0.6.5-cp312-none-win_amd64.whl (851 kB) --------------------------------------- 851.5/851.5 kB 18.3 MB/s eta 0:00:00 Downloading networkx-3.3-py3-none-any.whl (1.7 MB) ---------------------------------------- 1.7/1.7 MB 54.6 MB/s eta 0:00:00 Downloading astropy_iers_data-0.2024.7.8.0.31.19-py3-none-any.whl (1.9 MB) ---------------------------------------- 1.9/1.9 MB 40.7 MB/s eta 0:00:00 Downloading contourpy-1.2.1-cp312-cp312-win_amd64.whl (189 kB) ---------------------------------------- 189.9/189.9 kB 5.8 MB/s eta 0:00:00 Downloading cycler-0.12.1-py3-none-any.whl (8.3 kB) Downloading fonttools-4.53.1-cp312-cp312-win_amd64.whl (2.2 MB) ---------------------------------------- 2.2/2.2 MB 46.4 MB/s eta 0:00:00 Downloading kiwisolver-1.4.5-cp312-cp312-win_amd64.whl (56 kB) ---------------------------------------- 56.0/56.0 kB 3.1 MB/s eta 0:00:00 Downloading packaging-24.1-py3-none-any.whl (53 kB) ---------------------------------------- 54.0/54.0 kB 1.4 MB/s eta 0:00:00 Downloading pillow-10.4.0-cp312-cp312-win_amd64.whl (2.6 MB) ---------------------------------------- 2.6/2.6 MB 54.1 MB/s eta 0:00:00 Downloading pyerfa-2.0.1.4-cp39-abi3-win_amd64.whl (347 kB) --------------------------------------- 347.1/347.1 kB 10.9 MB/s eta 0:00:00 Downloading pyparsing-3.1.2-py3-none-any.whl (103 kB) ---------------------------------------- 103.2/103.2 kB 3.0 MB/s eta 0:00:00 Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB) --------------------------------------- 229.9/229.9 kB 13.7 MB/s eta 0:00:00 Downloading PyYAML-6.0.1-cp312-cp312-win_amd64.whl (138 kB) ---------------------------------------- 138.7/138.7 kB 8.0 MB/s eta 0:00:00 Downloading six-1.16.0-py2.py3-none-any.whl (11 kB) Installing collected packages: six, PyYAML, pyparsing, pillow, packaging, numpy, networkx, kiwisolver, fonttools, cycler, astropy-iers-data, python-dateutil, pyerfa, contourpy, matplotlib, astropy, cdshealpix Successfully installed PyYAML-6.0.1 astropy-6.1.1 astropy-iers-data-0.2024.7.8.0.31.19 cdshealpix-0.6.5 contourpy-1.2.1 cycler-0.12.1 fonttools-4.53.1 kiwisolver-1.4.5 matplotlib-3.9.1 networkx-3.3 numpy-1.26.4 packaging-24.1 pillow-10.4.0 pyerfa-2.0.1.4 pyparsing-3.1.2 python-dateutil-2.9.0.post0 six-1.16.0 Compiling autocfg v1.3.0 Compiling proc-macro2 v1.0.86 Compiling unicode-ident v1.0.12 Compiling target-lexicon v0.12.14 Compiling once_cell v1.19.0 Compiling num-traits v0.2.19 Compiling crossbeam-utils v0.8.20 Compiling cfg-if v1.0.0 Compiling pyo3-build-config v0.20.3 Compiling quote v1.0.36 Compiling syn v2.0.69 Compiling num-integer v0.1.46 Compiling windows_x86_64_msvc v0.52.6 Compiling crossbeam-epoch v0.9.18 Compiling rayon-core v1.12.1 Compiling pyo3-ffi v0.20.3 Compiling crossbeam-deque v0.8.5 Compiling num-complex v0.4.6 Compiling lock_api v0.4.12 Compiling serde v1.0.204 Compiling libc v0.2.155 Compiling parking_lot_core v0.9.10 Compiling simd-adler32 v0.3.7 Compiling windows-targets v0.52.6 Compiling num-bigint v0.4.6 Compiling matrixmultiply v0.3.8 Compiling memoffset v0.9.1 Compiling portable-atomic v1.6.0 Compiling adler v1.0.2 Compiling either v1.13.0 Compiling scopeguard v1.2.0 Compiling smallvec v1.13.2 Compiling heck v0.4.1 Compiling serde_json v1.0.120 Compiling pyo3-macros-backend v0.20.3 Compiling num-rational v0.4.2 Compiling serde_derive v1.0.204 Compiling rayon v1.10.0 Compiling miniz_oxide v0.7.4 Compiling pyo3 v0.20.3 Compiling num-iter v0.1.45 Compiling crc32fast v1.4.2 Compiling slab v0.4.9 Compiling memchr v2.7.4 Compiling thiserror v1.0.61 Compiling rawpointer v0.2.1 Compiling ryu v1.0.18 Compiling itoa v1.0.11 Compiling minimal-lexical v0.2.1 Compiling nom v7.1.3 Compiling flate2 v1.0.30 Compiling num v0.4.3 Compiling pyo3-macros v0.20.3 Compiling parking_lot v0.12.3 Compiling thiserror-impl v1.0.61 Compiling fdeflate v0.3.4 Compiling katex-doc v0.1.0 Compiling unindent v0.2.3 Compiling bitflags v1.3.2 Compiling base64 v0.21.7 Compiling indoc v2.0.5 Compiling cdshealpix v0.6.9 Compiling stc-s v0.1.0 Compiling png v0.17.13 Compiling ndarray v0.15.6 Compiling mapproj v0.3.0 Compiling byteorder v1.5.0 Compiling rustc-hash v1.1.0 Compiling quick-error v2.0.1 Compiling moc v0.14.2 Compiling num_threads v0.1.7 Compiling numpy v0.20.0 Compiling MOCPy v0.15.0 (D:\a\mocpy\mocpy) Finished `release` profile [optimized] target(s) in 1m 12s šŸ“¦ Built wheel for CPython 3.12 to C:\Users\RUNNER~1\AppData\Local\Temp\.tmpr7GIhr\mocpy-0.15.0-cp312-none-win_amd64.whl āœļø Setting installed package as editable šŸ›  Installed mocpy-0.15.0 Processing d:\a\mocpy\mocpy Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Requirement already satisfied: astropy in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from mocpy==0.15.0) (6.1.1) Requirement already satisfied: numpy<2.0 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from mocpy==0.15.0) (1.26.4) Requirement already satisfied: matplotlib in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from mocpy==0.15.0) (3.9.1) Requirement already satisfied: cdshealpix>=0.6.4 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from mocpy==0.15.0) (0.6.5) Requirement already satisfied: networkx>=2.5 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from mocpy==0.15.0) (3.3) Collecting astropy-healpix (from mocpy==0.15.0) Downloading astropy_healpix-1.0.3-cp39-abi3-win_amd64.whl.metadata (4.2 kB) Collecting pre-commit>=2.20 (from mocpy==0.15.0) Downloading pre_commit-3.7.1-py2.py3-none-any.whl.metadata (1.3 kB) Collecting pytest>6.0 (from mocpy==0.15.0) Downloading pytest-8.2.2-py3-none-any.whl.metadata (7.6 kB) Collecting pytest-mock (from mocpy==0.15.0) Downloading pytest_mock-3.14.0-py3-none-any.whl.metadata (3.8 kB) Collecting pytest-cov (from mocpy==0.15.0) Downloading pytest_cov-5.0.0-py3-none-any.whl.metadata (27 kB) Collecting requests (from mocpy==0.15.0) Downloading requests-2.32.3-py3-none-any.whl.metadata (4.6 kB) Collecting regions (from mocpy==0.15.0) Downloading regions-0.9-cp312-cp312-win_amd64.whl.metadata (6.0 kB) Collecting ruff>=0.5.0 (from mocpy==0.15.0) Downloading ruff-0.5.1-py3-none-win_amd64.whl.metadata (25 kB) Collecting cfgv>=2.0.0 (from pre-commit>=2.20->mocpy==0.15.0) Downloading cfgv-3.4.0-py2.py3-none-any.whl.metadata (8.5 kB) Collecting identify>=1.0.0 (from pre-commit>=2.20->mocpy==0.15.0) Downloading identify-2.6.0-py2.py3-none-any.whl.metadata (4.4 kB) Collecting nodeenv>=0.11.1 (from pre-commit>=2.20->mocpy==0.15.0) Downloading nodeenv-1.9.1-py2.py3-none-any.whl.metadata (21 kB) Requirement already satisfied: pyyaml>=5.1 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from pre-commit>=2.20->mocpy==0.15.0) (6.0.1) Collecting virtualenv>=20.10.0 (from pre-commit>=2.20->mocpy==0.15.0) Using cached virtualenv-20.26.3-py3-none-any.whl.metadata (4.5 kB) Collecting iniconfig (from pytest>6.0->mocpy==0.15.0) Downloading iniconfig-2.0.0-py3-none-any.whl.metadata (2.6 kB) Requirement already satisfied: packaging in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from pytest>6.0->mocpy==0.15.0) (24.1) Collecting pluggy<2.0,>=1.5 (from pytest>6.0->mocpy==0.15.0) Downloading pluggy-1.5.0-py3-none-any.whl.metadata (4.8 kB) Collecting colorama (from pytest>6.0->mocpy==0.15.0) Downloading colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB) Requirement already satisfied: pyerfa>=2.0.1.1 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from astropy->mocpy==0.15.0) (2.0.1.4) Requirement already satisfied: astropy-iers-data>=0.2024.5.27.0.30.8 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from astropy->mocpy==0.15.0) (0.2024.7.8.0.31.19) Requirement already satisfied: contourpy>=1.0.1 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from matplotlib->mocpy==0.15.0) (1.2.1) Requirement already satisfied: cycler>=0.10 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from matplotlib->mocpy==0.15.0) (0.12.1) Requirement already satisfied: fonttools>=4.22.0 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from matplotlib->mocpy==0.15.0) (4.53.1) Requirement already satisfied: kiwisolver>=1.3.1 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from matplotlib->mocpy==0.15.0) (1.4.5) Requirement already satisfied: pillow>=8 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from matplotlib->mocpy==0.15.0) (10.4.0) Requirement already satisfied: pyparsing>=2.3.1 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from matplotlib->mocpy==0.15.0) (3.1.2) Requirement already satisfied: python-dateutil>=2.7 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from matplotlib->mocpy==0.15.0) (2.9.0.post0) Collecting coverage>=5.2.1 (from coverage[toml]>=5.2.1->pytest-cov->mocpy==0.15.0) Downloading coverage-7.5.4-cp312-cp312-win_amd64.whl.metadata (8.4 kB) Collecting charset-normalizer<4,>=2 (from requests->mocpy==0.15.0) Downloading charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl.metadata (34 kB) Collecting idna<4,>=2.5 (from requests->mocpy==0.15.0) Downloading idna-3.7-py3-none-any.whl.metadata (9.9 kB) Collecting urllib3<3,>=1.21.1 (from requests->mocpy==0.15.0) Downloading urllib3-2.2.2-py3-none-any.whl.metadata (6.4 kB) Collecting certifi>=2017.4.17 (from requests->mocpy==0.15.0) Downloading certifi-2024.7.4-py3-none-any.whl.metadata (2.2 kB) Requirement already satisfied: six>=1.5 in d:\a\mocpy\mocpy\mocpy-env\lib\site-packages (from python-dateutil>=2.7->matplotlib->mocpy==0.15.0) (1.16.0) Collecting distlib<1,>=0.3.7 (from virtualenv>=20.10.0->pre-commit>=2.20->mocpy==0.15.0) Using cached distlib-0.3.8-py2.py3-none-any.whl.metadata (5.1 kB) Collecting filelock<4,>=3.12.2 (from virtualenv>=20.10.0->pre-commit>=2.20->mocpy==0.15.0) Using cached filelock-3.15.4-py3-none-any.whl.metadata (2.9 kB) Collecting platformdirs<5,>=3.9.1 (from virtualenv>=20.10.0->pre-commit>=2.20->mocpy==0.15.0) Using cached platformdirs-4.2.2-py3-none-any.whl.metadata (11 kB) Downloading pre_commit-3.7.1-py2.py3-none-any.whl (204 kB) --------------------------------------- 204.3/204.3 kB 12.9 MB/s eta 0:00:00 Downloading pytest-8.2.2-py3-none-any.whl (339 kB) --------------------------------------- 339.9/339.9 kB 20.6 MB/s eta 0:00:00 Downloading ruff-0.5.1-py3-none-win_amd64.whl (8.6 MB) ---------------------------------------- 8.6/8.6 MB 92.3 MB/s eta 0:00:00 Downloading astropy_healpix-1.0.3-cp39-abi3-win_amd64.whl (54 kB) ---------------------------------------- 54.2/54.2 kB 2.7 MB/s eta 0:00:00 Downloading pytest_cov-5.0.0-py3-none-any.whl (21 kB) Downloading pytest_mock-3.14.0-py3-none-any.whl (9.9 kB) Downloading regions-0.9-cp312-cp312-win_amd64.whl (343 kB) --------------------------------------- 343.5/343.5 kB 10.4 MB/s eta 0:00:00 Downloading requests-2.32.3-py3-none-any.whl (64 kB) ---------------------------------------- 64.9/64.9 kB 3.6 MB/s eta 0:00:00 Downloading certifi-2024.7.4-py3-none-any.whl (162 kB) ---------------------------------------- 163.0/163.0 kB 4.8 MB/s eta 0:00:00 Downloading cfgv-3.4.0-py2.py3-none-any.whl (7.2 kB) Downloading charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl (100 kB) ---------------------------------------- 100.4/100.4 kB 2.9 MB/s eta 0:00:00 Downloading coverage-7.5.4-cp312-cp312-win_amd64.whl (208 kB) --------------------------------------- 208.8/208.8 kB 12.4 MB/s eta 0:00:00 Downloading identify-2.6.0-py2.py3-none-any.whl (98 kB) ---------------------------------------- 99.0/99.0 kB 2.9 MB/s eta 0:00:00 Downloading idna-3.7-py3-none-any.whl (66 kB) ---------------------------------------- 66.8/66.8 kB 3.5 MB/s eta 0:00:00 Downloading nodeenv-1.9.1-py2.py3-none-any.whl (22 kB) Downloading pluggy-1.5.0-py3-none-any.whl (20 kB) Downloading urllib3-2.2.2-py3-none-any.whl (121 kB) ---------------------------------------- 121.4/121.4 kB 7.4 MB/s eta 0:00:00 Using cached virtualenv-20.26.3-py3-none-any.whl (5.7 MB) Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB) Downloading iniconfig-2.0.0-py3-none-any.whl (5.9 kB) Using cached distlib-0.3.8-py2.py3-none-any.whl (468 kB) Using cached filelock-3.15.4-py3-none-any.whl (16 kB) Using cached platformdirs-4.2.2-py3-none-any.whl (18 kB) Building wheels for collected packages: mocpy Building wheel for mocpy (pyproject.toml): started Building wheel for mocpy (pyproject.toml): finished with status 'error' error: subprocess-exited-with-error Building wheel for mocpy (pyproject.toml) did not run successfully. exit code: 1

 Building wheels for collected packages: mocpy
  Building wheel for mocpy (pyproject.toml): started
  Building wheel for mocpy (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error

  Building wheel for mocpy (pyproject.toml) did not run successfully.
  exit code: 1

  [12 lines of output]
  Running `maturin pep517 build-wheel -i D:\a\mocpy\mocpy\mocpy-env\Scripts\python.exe --compatibility off`
  šŸ“¦ Including license file "D:\a\mocpy\mocpy\LICENSE"
  ļæ½\x8dļæ½ Building a mixed python/rust project
  šŸ”— Found pyo3 bindings
  ļæ½\x90\x8d Found CPython 3.12 at D:\a\mocpy\mocpy\mocpy-env\Scripts\python.exe
  šŸ“” Using build options profile, frozen, locked, bindings from pyproject.toml
      Finished `release` profile [optimized] target(s) in 0.11s
  šŸ’„ maturin failed
    Caused by: Failed to add the files to the wheel
    Caused by: Failed to write to mocpy\mocpy.cp312-win_amd64.pyd
    Caused by: File mocpy\mocpy.cp312-win_amd64.pyd was already added from D:\a\mocpy\mocpy\python\mocpy\mocpy.cp312-win_amd64.pyd, can't added it from D:\a\mocpy\mocpy\target\release\maturin\mocpy.dll
  Error: command ['maturin', 'pep517', 'build-wheel', '-i', 'D:\\a\\mocpy\\mocpy\\mocpy-env\\Scripts\\python.exe', '--compatibility', 'off'] returned non-zero exit status 1
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mocpy
Failed to build mocpy
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (mocpy)

Link to the action's run https://github.com/cds-astro/mocpy/actions/runs/9835431210/job/27150205177 And to the corresponding workflow https://github.com/cds-astro/mocpy/actions/runs/9835431210/workflow

messense commented 1 week ago

Can you try add .pyd pattern to .gitignore? cc @konstin

ManonMarchand commented 1 week ago

I tried and it works, thanks! I don't get why though. What's happening there on windows?

messense commented 1 week ago

Without ignoring it in git, maturin will try to add it to wheel, but the extension module file will also be added after cargo build to ensure it's up-to-date, creating conflicts.

It only happens when you run maturin develop before building the wheel, it's not happening on Linux and macOS jobs because you have built the wheel before running maturin develop.