ipython-notebook

Cannot import modules in jupyter notebook; wrong sys.path

不问归期 提交于 2020-02-14 02:51:07
问题 I am having a problem importing modules in my iPython/Jupyter notebook. The problem fundamentally lies in where the sys.path is pointing to. From the iPython/Jupyter notebook, sys.executable returns: '/usr/bin/python' However, from the command line, it returns: '//anaconda/bin/python' I have tried un-installing and re-installing anacondas, but the problem still remains. I have also tried augmenting $PYTHONPATH in my bash_profile to include //anaconda/bin/python, but this doesn't resolve it.

Cannot import modules in jupyter notebook; wrong sys.path

末鹿安然 提交于 2020-02-14 02:50:49
问题 I am having a problem importing modules in my iPython/Jupyter notebook. The problem fundamentally lies in where the sys.path is pointing to. From the iPython/Jupyter notebook, sys.executable returns: '/usr/bin/python' However, from the command line, it returns: '//anaconda/bin/python' I have tried un-installing and re-installing anacondas, but the problem still remains. I have also tried augmenting $PYTHONPATH in my bash_profile to include //anaconda/bin/python, but this doesn't resolve it.

IPython Notebook error: Error loading notebook

扶醉桌前 提交于 2020-02-01 03:20:06
问题 Within the past few minutes, I have not been able to access any of the .ipynb files previously created with Python3.4. I go to the subdirectory with these files, enter ipython3 notebook When I open a "New" notebook, I get the following error: Unexpected error while saving file: Untitled1.ipynb database disk image is malformed I cannot open old notebooks either. I get the error: An unknown error occurred while loading this notebook. This version can load notebook formats v4 or earlier. See the

Automatic scroll down to bottom of result in ipython notebook

别说谁变了你拦得住时间么 提交于 2020-01-24 05:39:28
问题 Is there a way to configure the ipython notebook so that whenever I print a long list, I automatically see the bottom? for example, in the terminal, if I run the following: for i in range(1000): print i It automatically scrolls to the bottom: 992 993 994 995 996 997 998 999 In [2]: But in the Python notebook, I see the beginning and I have to manually scroll down to the last numbers. I am running a long loop that takes a few seconds for each iteration, and it is inconvenient to have to scroll

iPython notebook on Mac OSX Yosemite: no module named jinja2, even if it's installed

时光总嘲笑我的痴心妄想 提交于 2020-01-23 11:49:36
问题 I am trying to run iPython notebook on OSX Yosemite. I have installed everything via pip install ipython[all] and I see mattia:~ mattiaspeziali$ pip freeze backports.ssl-match-hostname==3.4.0.2 certifi==14.5.14 docutils==0.12 gnureadline==6.3.3 ipython==2.3.1 Jinja2==2.7.3 MarkupSafe==0.23 nose==1.3.4 numpy==1.8.2 numpydoc==0.5 pandas==0.14.1 Pygments==2.0.1 pyzmq==14.4.1 Sphinx==1.2.3 tornado==4.0.2 vboxapi==1.0 However, jinja2 seems not installed properly: mattia:~ mattiaspeziali$ ipython

How to change alignment of displayed equations in IPython Notebook?

若如初见. 提交于 2020-01-22 11:03:29
问题 I would like my MathJax displayed equations in IPython Notebook to be aligned at the left instead of centered. This is controlled by a core configuration option displayAlign in MathJax as described here. I have tried to set this option in IPython Notebook by adding this to my config.js file MathJax.Hub.Config({ displayAlign: "left" }); but it doesn't have any effect. How can I set MathJax core configuration options in IPython Notebook? [Update] I have found one way that works: add the above

How to change alignment of displayed equations in IPython Notebook?

ⅰ亾dé卋堺 提交于 2020-01-22 11:03:09
问题 I would like my MathJax displayed equations in IPython Notebook to be aligned at the left instead of centered. This is controlled by a core configuration option displayAlign in MathJax as described here. I have tried to set this option in IPython Notebook by adding this to my config.js file MathJax.Hub.Config({ displayAlign: "left" }); but it doesn't have any effect. How can I set MathJax core configuration options in IPython Notebook? [Update] I have found one way that works: add the above

How do I define custom magics in jupyter?

ぃ、小莉子 提交于 2020-01-21 09:27:17
问题 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'

Display multiple images in one IPython Notebook cell?

自古美人都是妖i 提交于 2020-01-19 18:24:13
问题 If I have multiple images (loaded as NumPy arrays) how can I display the in one IPython Notebook cell? I know that I can use plt.imshow(ima) to display one image… but I want to show more than one at a time. I have tried: for ima in images: display(Image(ima)) But I just get a broken image link: 回答1: Short answer: call plt.figure() to create new figures if you want more than one in a cell: for ima in images: plt.figure() plt.imshow(ima) But to clarify the confusion with Image : IPython.display

Interactive Python - solutions for relative imports

心不动则不痛 提交于 2020-01-17 04:41:24
问题 From Python relative imports for the billionth time: For a from .. import to work, the module's name must have at least as many dots as there are in the import statement. ... if you run the interpreter interactively ... the name of that interactive session is __main__ Thus you cannot do relative imports directly from an interactive session I like to use interactive Jupyter Notebook sessions to explore data and test modules before writing production code. To make things clear and accessible to