pytorch / pytorch

Tensors and Dynamic neural networks in Python with strong GPU acceleration
https://pytorch.org
Other
84.39k stars 22.73k forks source link

installation of pytorch `cpuonly` from conda with `nomkl` installs `mkl` #71022

Open scottgigante-immunai opened 2 years ago

scottgigante-immunai commented 2 years ago

🐛 Describe the bug

When installing pytorch with cpuonly and nomkl, the pytorch recipe calls for the installation of mkl. Maybe I am misunderstanding, but I would think if you specifically ask for nomkl then pytorch should be installed linked to OpenMP, as it would be if I installed with pip.

Setup

conda update -n base -c defaults -y conda
conda create -n pytorch-bug -y python=3.8
conda activate pytorch-bug
conda config --add channels conda-forge --add channels pytorch
conda install -y numpy scipy nomkl
``` environment location: /opt/conda/envs/pytorch-bug added / updated specs: - nomkl - numpy - scipy The following packages will be downloaded: package | build ---------------------------|----------------- libblas-3.9.0 |12_linux64_openblas 12 KB conda-forge libcblas-3.9.0 |12_linux64_openblas 12 KB conda-forge libgfortran-ng-11.2.0 | h69a702a_11 19 KB conda-forge libgfortran5-11.2.0 | h5c6108e_11 1.7 MB conda-forge liblapack-3.9.0 |12_linux64_openblas 12 KB conda-forge libopenblas-0.3.18 |pthreads_h8fe5266_0 9.6 MB conda-forge nomkl-1.0 | h5ca1d4c_0 4 KB conda-forge numpy-1.22.0 | py38h6ae9a64_0 6.9 MB conda-forge scipy-1.7.3 | py38h56a6a73_0 21.9 MB conda-forge ------------------------------------------------------------ Total: 40.1 MB The following NEW packages will be INSTALLED: libblas conda-forge/linux-64::libblas-3.9.0-12_linux64_openblas libcblas conda-forge/linux-64::libcblas-3.9.0-12_linux64_openblas libgfortran-ng conda-forge/linux-64::libgfortran-ng-11.2.0-h69a702a_11 libgfortran5 conda-forge/linux-64::libgfortran5-11.2.0-h5c6108e_11 liblapack conda-forge/linux-64::liblapack-3.9.0-12_linux64_openblas libopenblas conda-forge/linux-64::libopenblas-0.3.18-pthreads_h8fe5266_0 nomkl conda-forge/noarch::nomkl-1.0-h5ca1d4c_0 numpy conda-forge/linux-64::numpy-1.22.0-py38h6ae9a64_0 scipy conda-forge/linux-64::scipy-1.7.3-py38h56a6a73_0 ```

The buggy command

conda install pytorch cpuonly nomkl

The result

Both nomkl and mkl are installed!

``` ## Package Plan ## environment location: /opt/conda/envs/pytorch-bug added / updated specs: - cpuonly - nomkl - pytorch The following packages will be downloaded: package | build ---------------------------|----------------- blas-1.0 | openblas 48 KB anaconda cpuonly-2.0 | 0 2 KB pytorch ninja-1.10.2 | h4bd325d_1 2.4 MB conda-forge nomkl-3.0 | 0 48 KB anaconda pytorch-1.4.0 | py3.8_cpu_0 39.0 MB pytorch pytorch-mutex-1.0 | cpu 3 KB pytorch ------------------------------------------------------------ Total: 41.5 MB The following NEW packages will be INSTALLED: blas anaconda/linux-64::blas-1.0-openblas cpuonly pytorch/noarch::cpuonly-2.0-0 intel-openmp anaconda/linux-64::intel-openmp-2020.2-254 mkl anaconda/linux-64::mkl-2020.2-256 ninja conda-forge/linux-64::ninja-1.10.2-h4bd325d_1 pytorch pytorch/linux-64::pytorch-1.4.0-py3.8_cpu_0 pytorch-mutex pytorch/noarch::pytorch-mutex-1.0-cpu The following packages will be UPDATED: nomkl conda-forge/noarch::nomkl-1.0-h5ca1d4~ --> anaconda/linux-64::nomkl-3.0-0 Proceed ([y]/n) ``` or, if instead I didn't list the `anaconda` channel: ``` ## Package Plan ## environment location: /opt/conda/envs/pytorch-bug added / updated specs: - cpuonly - nomkl - pytorch The following packages will be downloaded: package | build ---------------------------|----------------- blas-1.0 | openblas 46 KB cpuonly-2.0 | 0 2 KB pytorch intel-openmp-2021.4.0 | h06a4308_3561 4.2 MB mkl-2021.4.0 | h06a4308_640 142.6 MB ninja-1.10.2 | h4bd325d_0 2.4 MB conda-forge nomkl-3.0 | 0 46 KB pytorch-1.4.0 | py3.8_cpu_0 39.0 MB pytorch pytorch-mutex-1.0 | cpu 3 KB pytorch ------------------------------------------------------------ Total: 188.3 MB The following NEW packages will be INSTALLED: blas pkgs/main/linux-64::blas-1.0-openblas cpuonly pytorch/noarch::cpuonly-2.0-0 intel-openmp pkgs/main/linux-64::intel-openmp-2021.4.0-h06a4308_3561 mkl pkgs/main/linux-64::mkl-2021.4.0-h06a4308_640 ninja conda-forge/linux-64::ninja-1.10.2-h4bd325d_0 pytorch pytorch/linux-64::pytorch-1.4.0-py3.8_cpu_0 pytorch-mutex pytorch/noarch::pytorch-mutex-1.0-cpu The following packages will be UPDATED: nomkl conda-forge/noarch::nomkl-1.0-h5ca1d4~ --> pkgs/main/linux-64::nomkl-3.0-0 ```

By pip instead

pip install torch

which downloads torch-1.10.1-cp38-cp38-manylinux1_x86_64.whl and installs as desired, without MKL.

Versions

``` $ python collect_env.py Collecting environment information... PyTorch version: N/A Is debug build: N/A CUDA used to build PyTorch: N/A ROCM used to build PyTorch: N/A OS: Debian GNU/Linux 10 (buster) (x86_64) GCC version: (Debian 8.3.0-6) 8.3.0 Clang version: Could not collect CMake version: Could not collect Libc version: glibc-2.28 Python version: 3.8.12 (default, Oct 12 2021, 13:49:34) [GCC 7.5.0] (64-bit runtime) Python platform: Linux-5.4.0-1059-gcp-x86_64-with-glibc2.17 Is CUDA available: N/A CUDA runtime version: Could not collect GPU models and configuration: Could not collect Nvidia driver version: Could not collect cuDNN version: Could not collect HIP runtime version: N/A MIOpen runtime version: N/A Versions of relevant libraries: [pip3] numpy==1.20.3 [conda] nomkl 1.0 h5ca1d4c_0 conda-forge [conda] numpy 1.20.3 py38h9894fe3_1 conda-forge ```

cc @ezyang @seemethere @malfet

Svito-zar commented 2 years ago

any updates on this issue?