Repository: scipy/scipy
Pull request: CI: fix `Intel oneAPI tests` job
<!-- 
Thanks for contributing a pull request! Please ensure that
your PR satisfies the checklist before submitting:
https://scipy.github.io/devdocs/dev/contributor/development_workflow.html#checklist-before-submitting-a-pr

Also, please name and describe your PR as you would write a
commit message:
https://scipy.github.io/devdocs/dev/contributor/development_workflow.html#writing-the-commit-message.
However, please only include an issue number in the description, not the title,
and please ensure that any code names containing underscores are enclosed in backticks.

Depending on your changes, you can skip CI operations and save time and energy: 
https://scipy.github.io/devdocs/dev/contributor/continuous_integration.html#skipping

Note that we are a team of volunteers; we appreciate your
patience during the review process.

Again, thanks for contributing!
-->

#### Reference issue
<!--Example: Closes gh-WXYZ.-->

Closes https://github.com/scipy/scipy/issues/21934

#### What does this implement/fix?
<!--Please explain your changes.-->

The reason for `meson.build:1:0: ERROR: Compiler icx cannot compile programs` https://github.com/scipy/scipy/issues/21934, is due to issues with installing `pythran` and `compilers` from `conda`. Some dependencies of these two conda packages mess up the linker search path i.e., `/usr/lib/gcc` isn't there in the linker search path. So, I have followed the windows way for installing conda packages for this job, i.e., listing minimal set of packages by hand. `pythran` is installed via `pip`. We don't need `compilers` package because we need `icx`, `ifx`, `icpx` which are installed from Intel website.

#### Additional information
<!--Any additional information you think is important.-->


Problem statement:
BUG: Intel oneAPI tests / py3.12, dev.py: `meson.build:1:0: ERROR: Compiler icx cannot compile programs.`
### Describe your issue.

We're getting a failure in the "Intel oneAPI tests / py3.12, dev.py" job, e.g. in gh-21920.

### Reproducing Code Example

```python
-
```


### Error message

```shell
Run . /opt/intel/oneapi/setvars.sh --force
 
:: initializing oneAPI environment ...
   bba80f82-41f1-4586-850f-1cd95cc2cc3c.sh: BASH_VERSION = 5.2.21(1)-release
   args: Using "$@" for setvars.sh arguments: --force
:: advisor -- latest
:: ccl -- latest
:: compiler -- latest
:: dal -- latest
:: debugger -- latest
:: dev-utilities -- latest
:: dnnl -- latest
:: dpcpp-ct -- latest
:: dpl -- latest
:: ipp -- latest
:: ippcp -- latest
:: mkl -- latest
:: mpi -- latest
:: tbb -- latest
:: vtune -- latest
:: oneAPI environment initialized ::
 
Channels:
 - conda-forge
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/runner/miniconda3/envs/scipy-dev

  removed specs:
    - compilers


The following packages will be REMOVED:

  binutils-2.43-h4852527_2
  binutils_linux-64-2.43-h4852527_2
  c-compiler-1.8.0-h2b85faf_1
  compilers-1.8.0-ha770c72_1
  cxx-compiler-1.8.0-h1a2810e_1
  fortran-compiler-1.8.0-h36df796_1
  gcc_linux-64-13.3.0-hc28eda2_7
  gfortran-13.3.0-h9576a4e_1
  gfortran_impl_linux-64-13.3.0-h10434e7_1
  gfortran_linux-64-13.3.0-hb919d3a_7
  gxx_linux-64-13.3.0-h6834431_7


Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
💻  meson setup /home/runner/work/scipy/scipy/build --prefix 
/home/runner/work/scipy/scipy/build-install -Dblas=mkl-dynamic-lp64-iomp 
-Dlapack=mkl-dynamic-lp64-iomp
The Meson build system
Version: 1.6.0
Source dir: /home/runner/work/scipy/scipy
Build dir: /home/runner/work/scipy/scipy/build
Build type: native build
Project name: scipy
Project version: 1.15.0.dev0+git20241124.eb132a4

meson.build:1:0: ERROR: Compiler icx cannot compile programs.

A full log can be found at /home/runner/work/scipy/scipy/build/meson-logs/meson-log.txt
==== CI platform detected, click here for meson-log.txt contents. ====
```


### SciPy/NumPy/Python version and system information

```shell
-
```

Hints from issue discussion:
The actual error is:
```
  -----------
  Sanity testing C compiler: icx
  Is cross compiler: False.
  Sanity check compiler command line: icx sanitycheckc.c -o sanitycheckc.exe -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/runner/miniconda3/envs/scipy-dev/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/runner/miniconda3/envs/scipy-dev/include -D_FILE_OFFSET_BITS=64 -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,--allow-shlib-undefined -Wl,-rpath,/home/runner/miniconda3/envs/scipy-dev/lib -Wl,-rpath-link,/home/runner/miniconda3/envs/scipy-dev/lib -L/home/runner/miniconda3/envs/scipy-dev/lib
  Sanity check compile stdout:
  
  -----
  Sanity check compile stderr:
  /usr/bin/ld: cannot find crtbeginS.o: No such file or directory
  icx: error: linker command failed with exit code 1 (use -v to see invocation)
  
  -----
  
  meson.build:1:0: ERROR: Compiler icx cannot compile programs.
  ```


@czgdp1807 would you be able to look into this? It's probably something like the GitHub Action image changing, given the `/usr/bin/ld: cannot find crtbeginS.o` error. 
On my Linux machine, it works with `compilers` conda package removed from the environment. However, it fails with a similar error if `compilers` package is there in the environment,

```zsh
Sanity check compile stderr:
/home/czgdp18079/miniforge3/envs/scipy-dev/bin/ld: cannot find crtbeginS.o: No such file or directory
icx: error: linker command failed with exit code 1 (use -v to see invocation)

-----

```
Ah that makes sense. The Intel compilers depend on GCC or Clang version (pretty fragile design, sigh), so that explains it. If you check what is actually installed now (e.g., version of `gcc_linux-64`) and compare with the version from before the job started failing, that should tell us what to pin.
Yes. That's what I am doing. Just pinning the version.

Commit message: CI: Switch from czgdp1807 to scipy

Patch to review:
diff --git a/.github/workflows/linux_intel_oneAPI.yml b/.github/workflows/linux_intel_oneAPI.yml
index 6f8b5fc321d0..64ec66b11f5e 100644
--- a/.github/workflows/linux_intel_oneAPI.yml
+++ b/.github/workflows/linux_intel_oneAPI.yml
@@ -60,8 +60,10 @@ jobs:
           use-mamba: true
 
       - name: Update Conda Environment
+        shell: bash -l {0}
         run: |
-          mamba env update -n scipy-dev -f environment.yml
+          conda activate scipy-dev
+          conda install -c conda-forge pkg-config meson meson-python ninja numpy cython pybind11 pytest pytest-xdist pytest-timeout pytest-fail-slow pooch rich-click click doit pydevtool hypothesis
 
       - name: cache install
         id: cache-install
@@ -86,7 +88,7 @@ jobs:
         run: |
           . /opt/intel/oneapi/setvars.sh --force
           conda activate scipy-dev
-          conda remove -y compilers
+          pip install pythran
           unset FFLAGS
           CC=icx CXX=icpx FC=ifx python dev.py build -C-Dblas=mkl-dynamic-lp64-iomp -C-Dlapack=mkl-dynamic-lp64-iomp
 


Code review comments:
diff_hunk: @@ -86,7 +88,7 @@ jobs:
         run: |
           . /opt/intel/oneapi/setvars.sh --force
           conda activate scipy-dev
-          conda remove -y compilers
+          pip install pythran
path: .github/workflows/linux_intel_oneAPI.yml
text: @author:
Installing from `conda` causes issues as I explained in the description.