Snowflake-connector-python fails to install. Returns "ModuleNotFoundError: No module named 'cmake'"

1.7k views Asked by At

I'm trying to install snowflake-connector-python using pip, but it's giving me this error stack trace:

            copying pyarrow/tests/parquet/test_metadata.py -> build/lib.macosx-10.9-universal2-cpython-311/pyarrow/tests/parquet
            copying pyarrow/tests/parquet/test_pandas.py -> build/lib.macosx-10.9-universal2-cpython-311/pyarrow/tests/parquet
            copying pyarrow/tests/parquet/test_parquet_file.py -> build/lib.macosx-10.9-universal2-cpython-311/pyarrow/tests/parquet
            copying pyarrow/tests/parquet/test_parquet_writer.py -> build/lib.macosx-10.9-universal2-cpython-311/pyarrow/tests/parquet
            running build_ext
            creating /private/var/folders/4c/xj1m5wts0xx46bbh5qhhhg4m0000gq/T/pip-install-v4ysgr2_/pyarrow_ae70c3da10594e6eb24b27149ad7d95d/build/temp.macosx-10.9-universal2-cpython-311
            -- Running cmake for pyarrow
            cmake -DPYTHON_EXECUTABLE=/Users/gree030/Workspace/projectName/venv/bin/python -DPython3_EXECUTABLE=/Users/gree030/Workspace/projectName/venv/bin/python "" -DPYARROW_BUILD_CUDA=off -DPYARROW_BUILD_FLIGHT=off -DPYARROW_BUILD_GANDIVA=off -DPYARROW_BUILD_DATASET=off -DPYARROW_BUILD_ORC=off -DPYARROW_BUILD_PARQUET=off -DPYARROW_BUILD_PARQUET_ENCRYPTION=off -DPYARROW_BUILD_PLASMA=off -DPYARROW_BUILD_S3=off -DPYARROW_BUILD_HDFS=off -DPYARROW_USE_TENSORFLOW=off -DPYARROW_BUNDLE_ARROW_CPP=off -DPYARROW_BUNDLE_BOOST=off -DPYARROW_GENERATE_COVERAGE=off -DPYARROW_BOOST_USE_SHARED=on -DPYARROW_PARQUET_USE_SHARED=on -DCMAKE_BUILD_TYPE=release /private/var/folders/4c/xj1m5wts0xx46bbh5qhhhg4m0000gq/T/pip-install-v4ysgr2_/pyarrow_ae70c3da10594e6eb24b27149ad7d95d
            error: command 'cmake' failed: No such file or directory
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for pyarrow
      Failed to build pyarrow
      ERROR: Could not build wheels for pyarrow, which is required to install pyproject.toml-based projects
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Here are my environments:

  • Python version: 3.11.1
  • pip version: 22.3.1

I tried installing and updating cmake but it still gave me this error:

            copying pyarrow/tests/parquet/test_pandas.py -> build/lib.macosx-10.9-universal2-cpython-311/pyarrow/tests/parquet
            copying pyarrow/tests/parquet/test_parquet_file.py -> build/lib.macosx-10.9-universal2-cpython-311/pyarrow/tests/parquet
            copying pyarrow/tests/parquet/test_parquet_writer.py -> build/lib.macosx-10.9-universal2-cpython-311/pyarrow/tests/parquet
            running build_ext
            creating /private/var/folders/4c/xj1m5wts0xx46bbh5qhhhg4m0000gq/T/pip-install-ejkkok_0/pyarrow_e560da15c45d4feeb95b2060af382048/build/temp.macosx-10.9-universal2-cpython-311
            -- Running cmake for pyarrow
            cmake -DPYTHON_EXECUTABLE=/Users/gree030/Workspace/projectName/venv/bin/python -DPython3_EXECUTABLE=/Users/gree030/Workspace/projectName/venv/bin/python "" -DPYARROW_BUILD_CUDA=off -DPYARROW_BUILD_FLIGHT=off -DPYARROW_BUILD_GANDIVA=off -DPYARROW_BUILD_DATASET=off -DPYARROW_BUILD_ORC=off -DPYARROW_BUILD_PARQUET=off -DPYARROW_BUILD_PARQUET_ENCRYPTION=off -DPYARROW_BUILD_PLASMA=off -DPYARROW_BUILD_S3=off -DPYARROW_BUILD_HDFS=off -DPYARROW_USE_TENSORFLOW=off -DPYARROW_BUNDLE_ARROW_CPP=off -DPYARROW_BUNDLE_BOOST=off -DPYARROW_GENERATE_COVERAGE=off -DPYARROW_BOOST_USE_SHARED=on -DPYARROW_PARQUET_USE_SHARED=on -DCMAKE_BUILD_TYPE=release /private/var/folders/4c/xj1m5wts0xx46bbh5qhhhg4m0000gq/T/pip-install-ejkkok_0/pyarrow_e560da15c45d4feeb95b2060af382048
            Traceback (most recent call last):
              File "/Users/gree030/Workspace/projectName/venv/bin/cmake", line 5, in <module>
                from cmake import cmake
            ModuleNotFoundError: No module named 'cmake'
            error: command '/Users/gree030/Workspace/projectName/venv/bin/cmake' 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 pyarrow
      Failed to build pyarrow
      ERROR: Could not build wheels for pyarrow, which is required to install pyproject.toml-based projects
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I also followed the documentation here and dependency installment guide here on how to install the connector and downloaded the dependent libraries using:

pip install -r https://raw.githubusercontent.com/snowflakedb/snowflake-connector-python/main/tested_requirements/requirements_311.reqs

given that my python version is 3.11.0.

1

There are 1 answers

1
Khalil On BEST ANSWER

It turns out that the build dependencies were causing the problem. One of the dependencies pyarrow seems to be triggering the error when using python 3.11 at the time of this writing. Downgrading to python version 3.9.16 solved the issue with installing snowflake-connector-python.