amazon-bedrock-workshop icon indicating copy to clipboard operation
amazon-bedrock-workshop copied to clipboard

"apt-get update && apt-get install g++ -y" in bedrock_boto3_setup.jpynb returned error when using latest JupyterLab app in SageMaker Studio

Open kai-zhu-aws opened this issue 2 years ago • 3 comments

SageMaker recently announced new SageMaker Studio. It has new app type called JupyterLab. I cloned the repo in a JupyterLab app. When run the below code, it returned error.

%%bash
apt-get update && apt-get install g++ -y

Reading package lists...

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/

---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
Cell In[6], line 1
----> 1 get_ipython().run_cell_magic('bash', '', 'apt-get update && apt-get install g++ -y\n')

File /opt/conda/lib/python3.10/site-packages/IPython/core/interactiveshell.py:2515, in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
   2513 with self.builtin_trap:
   2514     args = (magic_arg_s, cell)
-> 2515     result = fn(*args, **kwargs)
   2517 # The code below prevents the output from being displayed
   2518 # when using magics with decorator @output_can_be_silenced
   2519 # when the last Python token in the expression is a ';'.
   2520 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File /opt/conda/lib/python3.10/site-packages/IPython/core/magics/script.py:154, in ScriptMagics._make_script_magic.<locals>.named_script_magic(line, cell)
    152 else:
    153     line = script
--> 154 return self.shebang(line, cell)

File /opt/conda/lib/python3.10/site-packages/IPython/core/magics/script.py:314, in ScriptMagics.shebang(self, line, cell)
    309 if args.raise_error and p.returncode != 0:
    310     # If we get here and p.returncode is still None, we must have
    311     # killed it but not yet seen its return code. We don't wait for it,
    312     # in case it's stuck in uninterruptible sleep. -9 = SIGKILL
    313     rc = p.returncode or -9
--> 314     raise CalledProcessError(rc, cell)

CalledProcessError: Command 'b'apt-get update && apt-get install g++ -y\n'' returned non-zero exit status 100.

kai-zhu-aws avatar Dec 22 '23 04:12 kai-zhu-aws

Screenshot 2024-01-05 at 6 13 12 PM The issue occurs in SageMaker Notebook instance - JupyterLab.

awsarippa avatar Jan 05 '24 12:01 awsarippa

+1

Also running into this, and prefixed with sudo as well

weklund avatar Jan 10 '24 22:01 weklund

I was able to get past this with sudo -s before apt-get update && apt-get install g++ -y @awsarippa

weklund avatar Jan 10 '24 23:01 weklund

Closing this; please refer to the latest bedrock workshop update and reopen if still relevant

w601sxs avatar Apr 09 '24 20:04 w601sxs