Questions tagged [magic-command]

11 questions
18
votes
2 answers

Is %matplotlib inline still needed?

There are many resources that explains why %matplotlib inline is necessary to display plots inline. E.g. Purpose of %matplotlib inline. However, I feel that it is no longer necessary if we are using later version of IPython in your Jupyter…
2
votes
2 answers

Azure databricks %run magic command unable to find file path

I have 2 notebooks under the root folder in my workspace. Calling one notebook from the other with %run magic cmd returns error saying file path not found. This is my command: %run /Users/name@comp.com/notebookB $arg1=val1 $arg2=val2
1
vote
2 answers

Synapse : Execute the Magic Command (%run) Notebook from Pipeline

The magic commands work perfectly in Notebooks. However, While running the same notebook from the Synapse pipeline, it could not locate the notebook's path. Appreciate your help { "errorCode": "6002", "message": "MagicUsageError: Cannot read…
1
vote
1 answer

Use Built-in Magic Command to Run Script in Parent Directory

I don't know how to run the python scripts in parent directory using Jupyter Notebook's magic command %run script_name. I attempted to add the parent directory path into the sys.path as I did in the following code but it's not helpful. I also tried…
universe123
  • 103
  • 5
1
vote
1 answer

How to pass a variable in a full cell magic command in Jupyter/Colab?

My code uses SQL to query a database hosted in BigQuery. Say I have a list of items stored in a variable: list = ['a','b','c'] And I want to use that list as a parameter on a query like this: %%bigquery --project xxx query SELECT * FROM…
1
vote
1 answer

Using rpy2 in jupyter notebook but there is no output. Error in withVisible({ : object 'returns' not found

the screenshot for jupyternotebook I've successfully installed ryp2 using wheel. I'm using Python 3.7.6 and rpy2 2.9.5. I can get the output from jupter notebook when running python code but it doesn't work when using R magic. I tried to see if I…
0
votes
1 answer

How to allow %run magic command in Azure Databricks cluster?

I am currently trying to work through a Databricks course and am getting the following error stating that "Your administrator has only allowed sql and python commands on this cluster. This execution contained at least one disallowed language." I am…
0
votes
1 answer

Unable to run secondary notebook from Azure DevOps repo in Databricks due to 'file not found' error

I have my Azure DevOps repo cloned into Databricks. I'm trying to run the %run on a secondary notebook in the repo. When I attempt to execute the %run command on the secondary notebook, I consistently receive a file not found error. I'm working on…
0
votes
0 answers

Unable to set breakpoint in ipython command line when spyder is used

Hi =) I understand that I can run an ipython debugger and set a breakpoint at the command line, e.g. %run -d -b12 convert_excel.py However, I am unable to get Spyder (version 5.4.3) to recognise the -b12 command. An example script to reproduce this…
0
votes
1 answer

How to add same lines of code at the beginning of each cell in a Jupyter Notebook?

I would like to push my notebooks into GitLab without them showing the different outputs (3d plots, dataframes, etc...) in order to keep the size of those notebooks reasonable. I had the following idea: setting up a boolean variable at the beginning…
DayG
  • 31
  • 4
0
votes
1 answer

I want to run magic command % somefile.py inside a jupyter notebook. However, this program requires variables from the main script

To clarify, somfile.py needs variables that are generated from main.ipynb. So, when I simply do %run somefile.py I get this error: NameError: name 'viewer' is not defined This viewer is defined in the main code above. However, now if I use %load…