Hi, all! First time writing - hopefully in the correct category.
Im running through a tutorial notebook, and ran into problems when executing a !aws command via the notebook. This command also aggregates some information with grep command (!aws … | grep …).
I tried installing m2-base to introduced grep to my current environment, although the notebook shell does not recognize the grep command.
I thus tried to run the cell with the %%bash-magic, however now it does not recognize the aws command.
I’m starting the JupyterLab session from my base environment via a PowerShell Anaconda Prompt. And the notebook session is running a kernel from a prefixed virtual conda environment in my project directory.
There is quite a lot of shell commands in this notebook, as it is written for tutorial purposes, and manually translating each command is hopefully not the preffered solution.
Many thanks for any kind of help =)
Inside a cell, you can find out which python is being used by:
or use !which python
So if your env is say from /opt/conda/envs/my-env, you would expect the python to come from /opt/conda/envs/my-env/bin/python.
!, you automatically execute code on the commandline (CMD). Therefore, you can run any commands that also run inside a CMD with it. For example, with
!ECHO %%PATH%% you get whatever is in your current PATH variable. Whatever application you want to run, the directory with the application’s exe file must be listed here. You can also invoke a command that in turn invokes something else, e.g.
!powershell Get-Command aws would show what PowerShell believes “aws” should resolve to - here most likely nothing. You might need to install a few commands and either clutter your PATH variable with them (with the danger of breaking your system if you accidentially redefine commands that already exist under Windows) or you fix all the Shell commands by invoking a Shell and passing your command to that Shell, similar to
Maybe an easier alternative could be to just run that Jupyter Notebook(s) inside a virtual machine with Linux. You might be interested in Hyper-V, VirtualBox, or maybe even WSL. Then you can run all the Shell commands natively on that OS.
If it is not possible to use MSYS2, I guess I’ll try WSL!