M
Modular3mo ago
Kiraid

Offline Kaggle Install

I would like to install and use Mojo+Max (Magic-cli?) in an offline Kaggle Notebook but the workarounds that I have seen require uploading the package's .whl files (https://www.kaggle.com/code/jisukim8873/install-llm-packages-without-internet-access/notebook, https://www.kaggle.com/code/panozzaj/installing-pip-packages-on-kaggle-without-internet) as a dataset. I can mark the dataset with Modular's License but I believe that is against their terms and conditions of not hosting Mojo's codebase. Could Modular upload (with CI?) a dataset of install files (or ready to use executables) and an example Kaggle Notebook that can run Mojo in offline mode (a requirement of submissions)?
7 Replies
Kiraid
KiraidOP3mo ago
https://discord.com/channels/1087530497313357884/1267269207372988597/1276944873680801793 caroline_frasca:
Sorry for the delay on this – I've confirmed that uploading the .whl file to Kaggle doesn't violate our terms & conditions. Let us know if you run into any issues along the way so we can help out 🙂
@Caroline Is Apache License v2.0 the correct license to tag? Then put this in the description?
Copyright (c) 2024, Modular Inc. All rights reserved.

Licensed under the Apache License v2.0 with LLVM Exceptions:
https://llvm.org/LICENSE.txt

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Copyright (c) 2024, Modular Inc. All rights reserved.

Licensed under the Apache License v2.0 with LLVM Exceptions:
https://llvm.org/LICENSE.txt

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Or is this the correct one to use:
https://www.modular.com/legal/max-mojo-license
https://www.modular.com/legal/max-mojo-license
Or is this the correct one to site:
Licensed under https://www.modular.com/legal/terms
Licensed under https://www.modular.com/legal/terms
Caroline
Caroline3mo ago
Hey @Kiraid, this is the right license for the full MAX and Mojo SDKs: https://www.modular.com/legal/max-mojo-license
Modular: MAX & Mojo Community License
The MAX SDK ("MAX") & Mojo Community License governs what uses we allow with our software and how you can change the world with it.
Kiraid
KiraidOP3mo ago
Using ipython magic-action %%script to call modular's magic shell, while offline, running a no-op comment line of #, I get the following error:
Error starting shell: Not a tty (os error 25)

---------------------------------------------------------------------------
CalledProcessError Traceback (most recent call last)
Cell In[2], line 1
----> 1 get_ipython().run_cell_magic('mojo', '', '#\n')

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

File /opt/conda/lib/python3.10/site-packages/IPython/core/magic.py:755, in MagicAlias.__call__(self, *args, **kwargs)
753 args_list[0] = self.magic_params + " " + args[0]
754 args = tuple(args_list)
--> 755 return fn(*args, **kwargs)
756 finally:
757 self._in_call = False

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'#\n'' returned non-zero exit status 1.
Error starting shell: Not a tty (os error 25)

---------------------------------------------------------------------------
CalledProcessError Traceback (most recent call last)
Cell In[2], line 1
----> 1 get_ipython().run_cell_magic('mojo', '', '#\n')

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

File /opt/conda/lib/python3.10/site-packages/IPython/core/magic.py:755, in MagicAlias.__call__(self, *args, **kwargs)
753 args_list[0] = self.magic_params + " " + args[0]
754 args = tuple(args_list)
--> 755 return fn(*args, **kwargs)
756 finally:
757 self._in_call = False

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'#\n'' returned non-zero exit status 1.
%%script calling bash or python works just fine. https://ipython.readthedocs.io/en/stable/interactive/magics.html
Kiraid
KiraidOP3mo ago
Offline Mojo Template
Explore and run machine learning code with Kaggle Notebooks | Using data from Offline Mojo
Kiraid
KiraidOP3mo ago
Opened up an issue for this here: https://github.com/modularml/mojo/issues/3429
Caroline
Caroline3mo ago
Hey @Kiraid, as I mentioned earlier, compiling Mojo in a Kaggle cell isn't something that we'd expect to work currently (including with magic). This is something we're hoping will be possible in the next few months. Sorry if my earlier message was unclear on this.
Kiraid
KiraidOP3mo ago
Offline Mojo
! magic --no-progress run mojo "test.mojo"
Want results from more Discord servers?
Add your server