ipython-notebook

Execute another ipython notebook in a separate namespace

会有一股神秘感。 提交于 2019-12-02 05:38:58
I've been using some very nice code from this example to run one ipython notebook from another, which I (basically) copy below. This turns out to be a very nice way to organize my code. But now, I want to compare some sympy expressions that I've coded up with roughly equivalent sympy expressions that someone else has coded up. And since there are some name clashes, I'd like to be able to execute the two notebooks in their own namespaces, so that if Bob and I both define a sympy expression x , I can just evaluate Bob.x - Me.x to see if they are the same (or find their differences). [Note that

Loading AMSmath explicitly in IPython notebook causes “[Math Processing Error]”

天大地大妈咪最大 提交于 2019-12-02 05:38:00
I am a relatively new IPython Notebook user and I am using IPython 3.2.1. So upfront, my apologies if I did not read some documentation carefully! I am trying to typeset some LaTeX in my Notebook intended for a presentation. I tried to utilize MathJax capabilities better than what's (supposedly) available by default and so tried incorporating other extensions that come with MathJax explicitly. In particular, I tried getting my IPython Notebook to load AMScd.js, AMSsymbols.js and unicode.js through the following sequence of steps: Obtain the .js files for these extensions from the latest

I have the following error. How to fix the following certificate error (ipython)?

冷暖自知 提交于 2019-12-02 04:29:19
I'm getting the following error when I want to run ipython notebook on my macbook. Does anyone know how to fix this? Could you please help me about it? ERROR:root:Exception in I/O handler for fd 6 Traceback (most recent call last): File "//anaconda/lib/python2.7/site-packages/zmq/eventloop/ioloop.py", line 346, in start self._handlers[fd](fd, events) File "//anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 167, in accept_handler callback(connection, address) File "//anaconda/lib/python2.7/site-packages/tornado/tcpserver.py", line 217, in _handle_connection do_handshake_on_connect

Stdout in IPython notebook vs CLI IPython

老子叫甜甜 提交于 2019-12-02 01:23:40
Results of commands are not displayed when run from a notebook cell. From IPython notebook: os.system("pwd") 0 <-- no errors From IPython invoked from CLI: In [15]: os.system("pwd") /Users/joe Out[15]: 0 <-- no errors I expected to see /Users/joe displayed when command runs from a notebook cell. What's missing? Thank you, I. This is explained here : When you do os.system, it's not capturing stdout/stderr from the new process. In the terminal, this works, because stdout and stderr just go directly to the terminal, without Python ever knowing about them. In the notebook, it doesn't, because the

IPython notebook stops evaluating cells after plt.show()

 ̄綄美尐妖づ 提交于 2019-12-02 00:48:30
问题 I am using iPython to do some coding. When I open the notebook and run some codes by doing SHIFT+ENTER it runs. But after one or two times, it stops giving any output. Why is that. I have to shutdown the notebook again open it and then it runs for few times and same problem again. Here is the code I have used. Cell Toolbar: Question 1: Rotational Invariance of PCA I(1): Importing the data sets and plotting a scatter plot of the two. In [1]: # Channging the working directory import os os

ipython: Can I provide input to a shell command

北城余情 提交于 2019-12-01 21:21:48
问题 Can I execute a shell command that requires input in ipython and/or an ipython notebook? When I execute such a command, I see it's prompt, but no apparent way to provide it with input from my keyboard. An example could be an rsync command to a remote server (thus requiring a password). There are no doubt dangers security-wise here - these are somewhat reduced in my case as I'm running on localhost . 回答1: Reposting as an answer, with a bit more detail: No, it's a long standing issue that's

IPython notebook stops evaluating cells after plt.show()

依然范特西╮ 提交于 2019-12-01 20:15:29
I am using iPython to do some coding. When I open the notebook and run some codes by doing SHIFT+ENTER it runs. But after one or two times, it stops giving any output. Why is that. I have to shutdown the notebook again open it and then it runs for few times and same problem again. Here is the code I have used. Cell Toolbar: Question 1: Rotational Invariance of PCA I(1): Importing the data sets and plotting a scatter plot of the two. In [1]: # Channging the working directory import os os.getcwd() path="/Users/file/" os.chdir(path) pwd=os.getcwd() print(pwd) # Importing the libraries import

Weird behaviour with semicolon before function call in ipython/ipython notebook

痞子三分冷 提交于 2019-12-01 18:20:12
I stumbled upon some strange behaviour using ipython-notebook and wondered what, if any, the purpose was. If you enter a semicolon before a function call, you get the result of applying the function to a string which reflects all the code after the function name. For example, if I do ;list('ab') I get the result of list("('ab')") : In [138]: ;list('ab') Out[138]: ['(', "'", 'a', 'b', "'", ')'] I'm using jupyter with ipython 4 . It happens in ipython as well as ipython notebook . Has anyone seen this before or does anyone know if it's intended and, if so, why? It's a command for automatic

How do I define custom magics in jupyter?

妖精的绣舞 提交于 2019-12-01 11:29:05
I'm using Ubuntu 14.04 LTS with an Anaconda python installation: Python 3.5.1 :: Anaconda 2.4.1 (64-bit) I'm trying to use this recipe to enable C++ interactive compiling in my ipython notebooks: import IPython.core.magic as ipym @ipym.magics_class class CppMagics(ipym.Magics): @ipym.cell_magic def cpp(self, line, cell=None): """Compile, execute C++ code, and return the standard output.""" # Define the source and executable filenames. source_filename = 'temp.cpp' program_filename = 'temp.exe' # Write the code contained in the cell to the C++ file. with open(source_filename, 'w') as f: f.write

How do I set up default cell magics for every ipython notebook cell?

北战南征 提交于 2019-12-01 11:25:54
I have an iPython notebook that is completely made up of R cells. At the start of every cell, I have defined my R cell magic as follows: %%R However, is there a way to have just set that as a default for the entire notebook, so I don't have to type it into every cell? IRKernel is an R kernel for ipython/jupyter as suggested by @cel. There are lots of other kernels that you can use. 来源: https://stackoverflow.com/questions/30490801/how-do-i-set-up-default-cell-magics-for-every-ipython-notebook-cell