ERROR:root:Line magic function `%azureml` not found? - azure-machine-learning-workbench

I have created a "Blank Jupyter Notebook" project in Azure ML Workbench. When I try to run the Sample notebook found in the project, I get this error message:
ERROR:root:Line magic function `%azureml` not found.
What is missing?

You should change your kernel. I mean, do not use "local" kernel, use "project_name local" or any kernel which depends on your project .config file. You can change it on Jupyter from Kernel section on the top of the menu.

Related

Unable to set the kernel ("Not specified") for a jupyter notebook in Pycharm

As seen in the screenshot the kernel is "Not specified" and can not set since the dropdown is disabled. Can this be remedied?
The Project interpreter is python3 and otherwise for other file types the project works fine
I've run into the same issue of PyCharm not allowing me to select a Jupyter kernel other than the one that is saved to the notebook (the drop-down menu is either grayed-out as in your picture, or disappears altogether). This condition appears to occur when the kernel that was active when the notebook was saved is not available in the current environment. The only workaround I've found for this situation is:
Start a Jupyter notebook server using the same Python environment as you are using in PyCharm
From the Jupyter server web page, open the notebook
From the Kernel menu, select Change kernel, and then select the desired kernel
Save the notebook, then close/halt it
Re-open the notebook in PyCharm. It should then be able to execute with the kernel that was chosen in Step 3 above.

How to use Tensorboard within a notebook running on Amazon SageMaker Studio Lab?

I have a Jupyter notebook running within an Amazon SageMaker Studio Lab (https://studiolab.sagemaker.aws/) environment, and I want to use Tensordboard to monitor my model's performance inside the notebook.
I have used the following commands to set up the Tensorboard:
%load_ext tensorboard
# tb_log_dir variable holds the path to the log directory
%tensorboard --logdir tb_log_dir
But nothing shows up in the output of the cell where I execute the commands. See:
The two buttons shown in the picture are not responding, BTW.
How to solve this problem? Any suggestions would be appreciated.
I would try the canonical way to use tensorboard in AWS Sagemaker, it should be supported also by Studio Lab, it is described here. Basically install tensorboard and using the EFS_PATH_LOG_DIR launch tensorboard using the embedded console (you can do the following also from a cell):
pip install tensorboard
tensorboard --logdir <EFS_PATH_LOG_DIR>
Be careful with the EFS_PATH_LOG_DIR, be sure this folder is valida path from the location you are, for example by default you are located in studio-lab-user/sagemaker-studiolab-notebooks/ so the proper command would be !tensorboard --logdir logs/fit.
Then open a browser to:
https://<YOUR URL>/studiolab/default/jupyter/proxy/6006/

How to set Julia Environment for IJulia Jupyter notebook?

I am encountering package compatibility issues within my global Julia environment for specific packages I want to use in a Jupyter notebook. Is there a way to tell IJulia to use a different environment instead of my global one?
The default IJulia kernel sets --project=#. so the most convenient way (IMO) is to just keep your project in the same folder as the notebook. The result is that the correct project is used from the start and you don't have to worry about activating it while in the notebook.
You can always start up a notebook, and within a cell run
using Pkg
Pkg.activate("./path/to/folder")
When starting the notebook type:
notebook(dir="/path/to/your/environment/")
This will launch Jupyter notebook loading the environment (Project.toml) in the directory that you have specified. If there is no Project.toml in that directory, the default (global) environment will be used.
Depending on the complexity of your setup, you might want to consider Lmod
I use this with a module hierarchy: 1. Core module, 2. Compiler modules, MPI modules.
With this, its possible to quickly switch between difference branches.

Running a python .py file on Jetbrain Pycharm

I write my .py files using Pycharm JetBrains editors. When I run my codes, the output is shown in a console entitled "Run", without any prompt. Therefore, I dont have access to the variables of my code output. How can I force the pycharm to show the output of my codes in ipython console?
You can edit the Run Configuration and check the box "Show command line afterwards". This will run your script, but leave you in an interactive prompt. Everything from your script will have been imported and available.
As a note, if you install the IPython package (Preferences -> Project -> Project Interpreter, click + to add packages) then you can get a nicer console interpreter.
Finally, a different way to accomplish what you are looking for: run under Debug rather than Run. You can set a breakpoint and then use the debugger's Console right at the line you might be interested in.

How to enable and access debug logging for notebook and IPython kernel

I'm doing a small research on IPython kernel and trying to get debug logs out of it and see how it interacts with a notebook. Now it looks like the documentation and example configs shipped in my distribution is totally outdated.
The questions
Where the ipython kernel log files are located?
How can I enable DEBUG level logging in both jupyter notebook and ipython kernel?
What I've tried
Please read this section before giving links to the official docs
First I created profiles for both IPython and notebook with the following commands:
$ ipython profile create
$ jupyter notebook --generate-config
As expected three files where created:
.jupyter/jupyter_notebook_config.py
.ipython/profile_default/ipython_config.py
.ipython/profile_default/ipython_kernel_config.py
In these files I found similar commented fragments:
# Set the log level by value or name.
# c.Application.log_level = 0
I tried to uncomment it in the jupyter config. Instead of adding more details it totally disabled console output for the jupyter process. I also tried value 50 it has the same result, value DEBUG gave me Python error on start.
I also played with these values in ipython's configs but I wasn't able to find log files location.
In mail list command line option --log-level=DEBUG is mentioned and indeed it works for jupyter. But I really want to persist this setting in a profile and have debug info for the kernel too.
Config options NotebookApp.log_level and IPKernelApp.log_level also change nothing.
I believe that this kind of functionality is still on the wishlist:
https://github.com/ipython/ipython/issues/8570
But you could try something like this:
jupyter notebook --debug > log.file 2>&1
or
ipykernel kernel --debug > log.file 2>&1
You can also try to start ipython kernel without attached frontend with option --debug:
ipython kernel --debug
You can get lot of info about interaction between kernel and the forntend by setting c.Session.debug = True in jupyter_notebook_config.py.

Resources