lcpp-org / RustBCA

A free, open-source Binary Collision Approximation (BCA) code for ion-material interactions including sputtering, implantation, and reflection
https://github.com/lcpp-org/RustBCA/wiki
GNU General Public License v3.0
42 stars 15 forks source link

[bug] installation fails on MacOS #229

Closed borondics closed 1 year ago

borondics commented 1 year ago

Description I can't install the code on MacOS even after upgrading pip and pre-installing the requirements in a fresh python environment. Maybe the issue is mixing conda and pip?

To Reproduce Please attach the relevant TOML input file and list the command line arguments used. pip install git+https://github.com/lcpp-org/RustBCA.git or cloning and installing it from the cloned directory.

Expected behavior Be able to install RustBCM

Error messages, output files, or figures

Collecting git+https://github.com/lcpp-org/RustBCA.git
  Cloning https://github.com/lcpp-org/RustBCA.git to /private/var/folders/tt/s6sbh8hn1ysbvb2bxgr5cbm40000gn/T/pip-req-build-9p9m9erl
  Running command git clone --filter=blob:none --quiet https://github.com/lcpp-org/RustBCA.git /private/var/folders/tt/s6sbh8hn1ysbvb2bxgr5cbm40000gn/T/pip-req-build-9p9m9erl
  Resolved https://github.com/lcpp-org/RustBCA.git to commit 9cbede642d9f8bf316b68b7eb4798bb64b9093a2
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: RustBCA
  Building wheel for RustBCA (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for RustBCA (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      running bdist_wheel
      running build
      running build_ext
      running build_rust
      error: can't find Rust compiler

      If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

      To update pip, run:

          pip install --upgrade pip

      and then retry package installation.

      If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for RustBCA
Failed to build RustBCA
ERROR: Could not build wheels for RustBCA, which is required to install pyproject.toml-based projects

System (please complete the following information): OS: MacOS 14.1.1 Sonoma

> ~/temp/RustBCA> conda list
# packages in environment at /Users/borondics/miniconda3/envs/rustbca:
#
# Name                    Version                   Build  Channel
ca-certificates           2023.11.17           h8857fd0_0    conda-forge
contourpy                 1.2.0                    pypi_0    pypi
cycler                    0.12.1                   pypi_0    pypi
fonttools                 4.45.1                   pypi_0    pypi
importlib-resources       6.1.1                    pypi_0    pypi
kiwisolver                1.4.5                    pypi_0    pypi
libcxx                    16.0.6               hd57cbcb_0    conda-forge
libffi                    3.3                  h046ec9c_2    conda-forge
libsqlite                 3.44.2               h92b6c6a_0    conda-forge
libzlib                   1.2.13               h8a1eda9_5    conda-forge
matplotlib                3.8.2                    pypi_0    pypi
ncurses                   6.4                  h93d8f39_2    conda-forge
numpy                     1.26.2                   pypi_0    pypi
openssl                   1.1.1w               h8a1eda9_0    conda-forge
packaging                 23.2                     pypi_0    pypi
pillow                    10.1.0                   pypi_0    pypi
pip                       23.3.1             pyhd8ed1ab_0    conda-forge
pyparsing                 3.1.1                    pypi_0    pypi
python                    3.9.6           hd187cdc_1_cpython    conda-forge
python-dateutil           2.8.2                    pypi_0    pypi
readline                  8.2                  h9e318b2_1    conda-forge
scipy                     1.11.4                   pypi_0    pypi
semantic-version          2.10.0                   pypi_0    pypi
setuptools                68.2.2             pyhd8ed1ab_0    conda-forge
setuptools-rust           1.8.1                    pypi_0    pypi
shapely                   2.0.2                    pypi_0    pypi
six                       1.16.0                   pypi_0    pypi
sqlite                    3.44.2               h7461747_0    conda-forge
tk                        8.6.13               h1abcd95_1    conda-forge
toml                      0.10.2                   pypi_0    pypi
tomli                     2.0.1                    pypi_0    pypi
tzdata                    2023c                h71feb2d_0    conda-forge
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h775f41a_0    conda-forge
zipp                      3.17.0                   pypi_0    pypi
zlib                      1.2.13               h8a1eda9_5    conda-forge
drobnyjt commented 1 year ago

Hi @borondics, thanks for opening an issue! Quick question so I can understand your problem better: are you trying to install the Python package libRustBCA or RustBCA as a standalone executable?

I noticed this error message appears in the output you shared:

error: can't find Rust compiler
...
If you did intend to build this package from source, try installing a Rust
compiler from your system package manager and ensure it is on the
PATH during installation.

I don't have any pre-built wheels available, so you will have to build it from source. Do you have the Rust compiler installed? If not, the recommended way to get one is to install the Rust toolchain via rustup.

borondics commented 1 year ago

Thanks! Worked like a charm!