Cannot install Python package on SageMaker

0

I am trying to install CKG Python library on my SageMaker Studio, following this instruction, https://ckg.readthedocs.io/en/latest/intro/getting-started-with-build.html

I changed 'python setup.py install' to 'pip install .'

but I still get an error

ers
            creating build/lib.linux-x86_64-cpython-37/examples/advanced
            copying examples/advanced/__init__.py -> build/lib.linux-x86_64-cpython-37/examples/advanced
            copying examples/advanced/acent.py -> build/lib.linux-x86_64-cpython-37/examples/advanced
            copying examples/advanced/cheshire_tomography.py -> build/lib.linux-x86_64-cpython-37/examples/advanced
            copying examples/advanced/circuits.py -> build/lib.linux-x86_64-cpython-37/examples/advanced
            copying examples/advanced/image_processing.py -> build/lib.linux-x86_64-cpython-37/examples/advanced
            copying examples/advanced/numpy_test.py -> build/lib.linux-x86_64-cpython-37/examples/advanced
            copying examples/advanced/optimal_control.py -> build/lib.linux-x86_64-cpython-37/examples/advanced
            copying examples/advanced/stock_tradeoff.py -> build/lib.linux-x86_64-cpython-37/examples/advanced
            copying examples/advanced/test.py -> build/lib.linux-x86_64-cpython-37/examples/advanced
            copying examples/advanced/xpress_example.py -> build/lib.linux-x86_64-cpython-37/examples/advanced
            creating build/lib.linux-x86_64-cpython-37/examples/flows
            copying examples/flows/__init__.py -> build/lib.linux-x86_64-cpython-37/examples/flows
            copying examples/flows/commodity_flow.py -> build/lib.linux-x86_64-cpython-37/examples/flows
            copying examples/flows/create_graph.py -> build/lib.linux-x86_64-cpython-37/examples/flows
            copying examples/flows/incidence_matrix.py -> build/lib.linux-x86_64-cpython-37/examples/flows
            copying examples/flows/leaky_edges.py -> build/lib.linux-x86_64-cpython-37/examples/flows
            copying examples/flows/max_flow.py -> build/lib.linux-x86_64-cpython-37/examples/flows
            running build_ext
            building '_cvxcore' extension
            creating build/temp.linux-x86_64-cpython-37
            creating build/temp.linux-x86_64-cpython-37/cvxpy
            creating build/temp.linux-x86_64-cpython-37/cvxpy/cvxcore
            creating build/temp.linux-x86_64-cpython-37/cvxpy/cvxcore/python
            creating build/temp.linux-x86_64-cpython-37/cvxpy/cvxcore/src
            gcc -pthread -B /opt/conda/envs/BookEnv_01/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Icvxpy/cvxcore/src/ -Icvxpy/cvxcore/python/ -Icvxpy/cvxcore/include/ -I/opt/conda/envs/BookEnv_01/include/python3.7m -I/tmp/pip-build-env-21op54p3/overlay/lib/python3.7/site-packages/numpy/core/include -c cvxpy/cvxcore/python/cvxcore_wrap.cpp -o build/temp.linux-x86_64-cpython-37/cvxpy/cvxcore/python/cvxcore_wrap.o -O3
            error: command 'gcc' failed: No such file or directory: 'gcc'
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for cvxpy
      Failed to build cvxpy
      ERROR: Could not build wheels for cvxpy, which is required to install pyproject.toml-based projects
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/home/sagemaker-user/CKG/setup.py", line 52, in <module>
          include_package_data=True,
        File "/opt/conda/envs/BookEnv_01/lib/python3.7/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/opt/conda/envs/BookEnv_01/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/opt/conda/envs/BookEnv_01/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/opt/conda/envs/BookEnv_01/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/opt/conda/envs/BookEnv_01/lib/python3.7/site-packages/setuptools/dist.py", line 1243, in run_command
          super().run_command(command)
        File "/opt/conda/envs/BookEnv_01/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/opt/conda/envs/BookEnv_01/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 378, in run
          self.run_command("install")
        File "/opt/conda/envs/BookEnv_01/lib/python3.7/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/opt/conda/envs/BookEnv_01/lib/python3.7/site-packages/setuptools/dist.py", line 1243, in run_command
          super().run_command(command)
        File "/opt/conda/envs/BookEnv_01/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/sagemaker-user/CKG/setup.py", line 15, in run
          check_call("pip install -r requirements.txt".split())
        File "/opt/conda/envs/BookEnv_01/lib/python3.7/subprocess.py", line 363, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['pip', 'install', '-r', 'requirements.txt']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for CKG
  Running setup.py clean for CKG
Failed to build CKG
ERROR: Could not build wheels for CKG, which is required to install pyproject.toml-based projects

Please kindly help me figure this one out.

  • $ cd CKG/ $ conda activate ckgenv Do ls -la to see if requirements.txt file exist then run below command
    pip install -r requirements.txt or python -m pip install -r requirements.txt (just in case)

    Then proceed with next steps

1 Answer
0

You must review if the package you're trying to install is compatible with the python version of the AWS SageMaker Studio instance you're using.

AWS
vtjean
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions