david-cortes / isotree

(Python, R, C/C++) Isolation Forest and variations such as SCiForest and EIF, with some additions (outlier detection + similarity + NA imputation)
https://isotree.readthedocs.io
BSD 2-Clause "Simplified" License
186 stars 38 forks source link

pip install issue: cc1plus no such file or directory #44

Closed rmurphy2718 closed 2 years ago

rmurphy2718 commented 2 years ago

Issue

I cannot pip install isotree. Is there a way to fix it without sudo? Is there a pre-built wheel anywhere? Thanks!

Command and output

pip install isotree --no-cache-dir
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: ...
Collecting isotree
  Downloading 
...tar.gz (288 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 288.1/288.1 kB 15.1 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: isotree
  Building wheel for isotree (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for isotree (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [29 lines of output]
      /tmp/pip-build-env-v6v2li_1/overlay/lib/python3.9/site-packages/setuptools/_distutils/extension.py:134: UserWarning: Unknown Extension options: 'install_requires'
        warnings.warn(msg)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-39
      creating build/lib.linux-x86_64-cpython-39/isotree
      copying isotree/__init__.py -> build/lib.linux-x86_64-cpython-39/isotree
      running build_ext
      g++: error: unrecognized command line option ‘-std=c++17’
      g++: error: unrecognized command line option ‘-std=gnu++14’
      --- Checking compiler support for option '-fopenmp'
      --- Checking compiler support for '__restrict' qualifier
      --- Checking compiler support for option '-O3'
      --- Checking compiler support for option '-fno-math-errno'
      --- Checking compiler support for option '-fno-trapping-math'
      --- Checking compiler support for option '-std=c++17'
      --- Checking compiler support for option '-std=gnu++14'
      --- Checking compiler support for option '-std=c++11'
      --- Checking compiler support for option '-flto'
      cythoning isotree/cpp_interface.pyx to isotree/cpp_interface.cpp
      building 'isotree._cpp_interface' extension
      creating build/temp.linux-x86_64-cpython-39
      creating build/temp.linux-x86_64-cpython-39/isotree
      creating build/temp.linux-x86_64-cpython-39/src
      gcc -pthread -B /opt/deep_learning/conda/envs/my_env/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/deep_learning/conda/envs/my_env/include -fPIC -O2 -isystem /opt/deep_learning/conda/envs/my_env/include -march=x86-64 -fPIC -D_USE_XOSHIRO -D_FOR_PYTHON -DSUPPORTS_RESTRICT=1 -D_USE_ROBIN_MAP -I/tmp/pip-build-env-v6v2li_1/overlay/lib/python3.9/site-packages/numpy/core/include -I. -I./src -I/opt/deep_learning/conda/envs/my_env/include/python3.9 -c isotree/cpp_interface.cpp -o build/temp.linux-x86_64-cpython-39/isotree/cpp_interface.o -fopenmp -O3 -fno-math-errno -fno-trapping-math -std=c++11 -flto
      gcc: error trying to exec 'cc1plus': execvp: No such file or directory
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

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

System information

Ubuntu 2018.03 on a managed cloud computing service within a docker container. I don't have the ability to sudo install stuff and there is a reluctance to change the docker image.

david-cortes commented 2 years ago

Have you installed gcc and g++ on this system?

david-cortes commented 2 years ago

Actually, from googling the error: https://stackoverflow.com/questions/11912878/gcc-error-gcc-error-trying-to-exec-cc1-execvp-no-such-file-or-directory

The package you need to install is build-essential

rmurphy2718 commented 2 years ago

Hi again,

Like I said above, I do not have sudo access to install build-essential. We cannot change the docker image, either. Is there another workaround? Are there pre-built wheels?

david-cortes commented 2 years ago

No, there are no prebuilt wheels. A possible workaround would be to build a binary wheel in a different machine for the same target platform (you'll also need to set export DONT_SET_MARCH=1) and use those in the docker image. Other than that, there's no workarounds - this is a source package and requires a compiler toolchain to build.

rmurphy2718 commented 2 years ago

I will give it a try, thank you for responding to the closed issue!