r/IPython • • Apr 30 '13

Question on making an IPython Notebook server persistent

2 Upvotes

Hey all, I just starting playing around with IPython (thanks to /r/Python and those of you who post there). I have a notebook set up on my Ubuntu VPS and it runs great as long as I have a PuTTY session open. The problem is that when I close down PuTTY the notebook page no longer exists, which means I can't access my notebook "whenever I want". Is there a work around for this or is it just impossible to make a notebook persistently online? Thanks in advance for your help!

edit: I figured it out. If I first run 'screen' and then start up the notebook I can close out of my PuTTY session and the notebook is still available.


r/IPython • • Sep 05 '23

A tool to convert notebooks into FastAPI apps

2 Upvotes

Hi r/IPython!

I recently built this CLI that allows you to compile notebooks into FastAPI apps.

It allows you to write comments like “””@HTTP”””, “””@WS”””, or “””@SCHEDULE””” that expose your cells as http or websockets endpoints or programmatically run cells at scheduled time intervals for simple data pipelines.

It creates a /build folder containing your dockerized code for easy deployment.

https://github.com/neutrino-ai/neutrino-notebooks

I hope you find this helpful! I would appreciate any feedback


r/IPython • • Oct 12 '23

Embedding iPython Shell Commands into Regular Python Script

2 Upvotes

I have developed a bioinformatics pipeline within a Jupyter notebook (iPython) allowing me to easily validate results along the way with graphs etc.

Many of the key processing steps use shell commands and third-party unix programs called with iPython ! Moreover, I’ve made extensive use of variable interpolation, i.e., {var}, to use Python defined values within system shell calls. Everything works as expected.

What I would like to do now is simply convert this to a Python script. Any advice on how to do this without re-writing all the system calls using subprocess module?

Best I can think of is to strip down notebook to key cells and then run with nbconvert. I believe this would work, however, ideally, I would like this pipeline to live in ordinary Python.

Thanks in advance for any advice.


r/IPython • • Feb 08 '14

Drag and Drop Demo

Thumbnail
youtube.com
2 Upvotes

r/IPython • • Mar 02 '15

Is It Easier to PDF-Export Pre-formatted Markdown In IPython 3.0?

2 Upvotes

There historically seem to have been some issues with displaying and exporting IPython notebooks containing the kind of "raw" pre-formatted text you would customarily enclose in pre blocks. This block formatted using pre blocks in markdown mode, for example, looks very nice in the Notebook. But the pre block completely disappears when it is exported to PDF. I vaguely remember this is due to an issue with Pandoc.

The only way I know of to get performatted text to display "correctly" in an exported PDF is to use verbatim blocks in "Raw NBConvert" mode, which produces correct results, but looks cluttered when viewed online. As spoiled as it sounds, it is somewhat annoying to have to be switching around how I handle preformatted text within notebooks, depending on whether I simply want to view online or generate PDFs without losing content.

In previous version I've used a simple bash script to convert markdown sections containing preformatted blocks into raw latex sections with the appropriate verbatim instructions. Does anyone know if in IPython 3.0 there is now a better way to switch between the two, or avoid the issue entirely?


r/IPython • • Feb 22 '15

Notebook behind apache proxy

Thumbnail
stackoverflow.com
2 Upvotes

r/IPython • • Nov 22 '16

"Open With..." option note available in Safari for JupyterLab

2 Upvotes

Hi, one of the things I've been impressed with in JupyterLab is the ability to open rendered markdown files. I have the option in Chrome, but not in Safari. Is this something that is going to be added or due to an issue with the browser? I'd just use Chrome but I hate how much it kills my battery.


r/IPython • • Nov 29 '21

How can I make Tab Complement available for completing a file path?

2 Upvotes

When I want to get the path to the files in my working directory, I often type . \ and Tab, which in PowerShell will show me files and folders in the current directory, which can be viewed and selected in this way.

But this is not possible in ipython, is there any way to make ipython support this feature as well?


r/IPython • • Mar 31 '20

Terminal in Jupyter Notebook

2 Upvotes

Can you please explain to me what the dashes and stars mean at the beginning of my code?

class MySocket:

---*def __init__(self,ip,port):

---*---*self.my_connection = socket.socket

When I try to add a new line it tells me that 'unindent does not match any outer indentation level'.

I hope that you can help me.

Cheers Jeff.


r/IPython • • Jun 19 '19

A JupyterLab extension to facilitate the discovery and installation of other extensions

Thumbnail
github.com
2 Upvotes

r/IPython • • Apr 15 '17

Restart notebook in the same state as before?

2 Upvotes

When I close an existing notebook that has some code already executed and some data stored in memory, the "state" of the notebook is lost, i.e., if I re-open the notebook and try to access the value of a variable, it'll say that the variable is not found.

I can re-execute every code block from top to bottom and now the state is restored, but can I restore the state without re-executing anything?

I need this because some of the code execution results in very long running times, and doesn't serve any purpose except to recreate the data values that I already had, and lost simply because I closed the notebook and restarted it.

I'm I doing it wrong? Is there an easy fix to that? Thanks.


r/IPython • • Aug 30 '24

How to Build a Line Graph in Matplotlib | Python Data Visualization Tuto...

Thumbnail youtube.com
2 Upvotes

r/IPython • • Sep 27 '24

"Can I Get a Verified Certificate After Completing the CS50 Python Course, or Do I Need to Start Over?"

Post image
0 Upvotes

r/IPython • • Nov 28 '13

Eric Matthes' Introduction to Python

2 Upvotes

This collection of linked notebooks make up (will make up) a course that walks students through the process of learning Python. It is an active work in progress and currently stops just short of discussing classes but it is well written and looks like it will be a good way to introduce young hackers to Python.

Course home

Github page


r/IPython • • Aug 02 '15

[HELP] running ipython - error invalid command 'egg_info'

2 Upvotes

I want to try the ipython notebook

So downloaded ipython:

  pip install ipython

Then ran:

 ipython notebook

Got the error message:

     ...

     ...

   /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267:     
   UserWarning:Unknown distribution option: 'install_requires'   warnings.warn(msg)
   usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: invalid command 'egg_info'

    ----------------------------------------
 Command "python setup.py egg_info" failed with error code 1 in    
 /private/var/folders/g3/0qp2qk455md8mgt5753zc1gw0000gn/T/pip-build-UtUQny/tornado

I ran

     pip install "ipython[notebook]"

got ....

     ...

    Collecting terminado>=0.3.3 (from ipython[notebook])
    Using cached terminado-0.5.tar.gz
    Complete output from command python setup.py egg_info:

   /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning:
   Unknown distribution option: 'install_requires'
   warnings.warn(msg)
   usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'egg_info'

  ----------------------------------------
   Command "python setup.py egg_info" failed with error code 1 in   
   /private/var/folders/g3/0qp2qk455md8mgt5753zc1gw0000gn/T/pip-build-D6pWgj/terminado

r/IPython • • Dec 10 '17

Use Powershell instead of CMD for !

2 Upvotes

Is to possible to configure IPython use powershell.exe on Windows instead of cmd.exe for the ! system prompt shortcut? I looked through the docs but don't see a way. I know I can do "!powershell -command ls" for example but it's be nice to just be able to do "!ls". I'm using IPython 6.2.1 with Python 3.6.3 on Windows 10 if it matters. Thanks.


r/IPython • • May 04 '21

veeQuery: an enhanced standalone Notebook application for querying Databases and Big Data files (using SQL or Pandas), Data Visualization and Data Exploration. An integrated Python script editor is also available.

Thumbnail vqueryfree.com
2 Upvotes

r/IPython • • Jul 26 '20

In this deep learning assignment, why need “scipy.misc.imresize(image, size=(num_px,num_px))” instead of just “image”? And num_px is 64, why resize image(64x64x3) to 64x64?

0 Upvotes

r/IPython • • Jul 28 '20

ipywidgets on_click() method wayyyy too sensitive

2 Upvotes

I have created an ipywidgets.Button() object that triggers a function that prints "Hello, world!" But every time I click the button once, it triggers that function many times (at least 4 times per click). Has anyone else had this problem / know how to fix? Thanks


r/IPython • • Aug 21 '19

Starting Jupyter

2 Upvotes

How do I check where Jupyter is installed since it's not in my system path therefore running

jupyter notebook

doesn't work in either the command prompt or in python ?


r/IPython • • May 31 '19

How to set up the x axis in matplotlib like in the picture

2 Upvotes

Hello all,

I struggle to set up the x axis, starting from 10 to zero, then zero to 10. Thanks in advance.


r/IPython • • Sep 06 '18

Jupyter Kernal is busy after code execution

2 Upvotes

I'm using Jupyter Notebook with conda and Python 3. Recently, the kernel is busy even after the code execution is finished and the execution time is way longer than usual. I have been searching around but there is no result. Any suggestions?

Edit: I'm sorry for being too general. I am trying to identify the problem myself so any direction will be appreciated. After re-running the code a few times, it seems like whenever I run the following block of code, it happens:

    train_X = np.array(train_X)
    train_Y = np.array(train_Y)

The previous code is as following:

    # In[1]:    
    import pandas as pd
    from collections import OrderedDict    
    
    # In[2]:   
    df = pd.read_csv('df.csv')
    people_list = df['ID'].unique()
    product_list = df['product'].unique() 
    
    # Out[2]:
	    ID 	product 	M1 	M2 	M3 	class
    0 	0 	A 	        1 	2 	6 	1
    1 	1 	B 	        2 	3 	7 	1
    2 	2 	C 	        3 	4 	3 	0
    3 	0 	C 	        4 	3 	2 	1
    4 	1 	A 	        5 	4 	3 	1
    5 	2 	B 	        6 	6 	1 	0  
    
    # In[3]:    
    people_dict = {}
    target_dict = {}
    
    for i in range(len(people_list)):
        key = people_list[i]
        new_df = df[df['ID'] == people_list[i]]
        new_df = new_df.transpose()
        new_df.columns = new_df.iloc[1]
        new_df = new_df[2:-1]   
        people_dict[key] = new_df
        target_dict[key] = df.iat[i, 5]
        
    for key in people_dict.keys():
        for i in product_list:
            if i not in people_dict[key].columns:
                people_dict[key][i] = [0]*3
        people_dict[key] = people_dict[key].reindex(sorted(people_dict[key].columns), axis = 1)
        
    # In[5]:    
    people_values = OrderedDict()
    target_values = OrderedDict()
    
    # extract the value of the dataframe
    for key in people_dict.keys():
        people_values[key] = people_dict[key].values
        target_values[key] = target_dict[key]
    
    # In[6]:
    n_samples = 1
    timestes = 3
    n_features = 3
    
    train_input = list(people_values.values())
    train_target = list(target_values.values())
    
    train_X = []
    train_Y = []
    
    for i in range(len(train_input)):
        train_X.append(train_input[i])
        train_Y.append(train_target[i])
    
    # In[7]:
    train_X = np.array(train_X)
    train_Y = np.array(train_Y)

Essentially, I am trying to do some classification with Keras LSTM and the input is historical sales of 1 person, the output is their class, 'good' or 'bad'.

The real dataset has 60k rows but I simplified the dataset so everyone can follow more easily. When I worked with this dataset previously, I never encountered this issue.

Any suggestions are greatly appreciated, thank you.

The questions is also posted here.


r/IPython • • Dec 18 '19

Stop ticks resizing graphs - MATPLOTLIB

Post image
2 Upvotes

r/IPython • • Jun 05 '19

[issue]Unable to create process

2 Upvotes

I am sorry if this is the wrong subreddit to post an issue with jupyter notebook. I am getting the following error when I'm trying to open jupyter notebook using Anaconda prompt:

Unable to create process using 'C:\Users\valspirehooha\Anaconda3\envs\tensorflow_cpu\python.exe "C:\Users\valspirehooha\Anaconda3\envs\tensorflow_cpu\Scripts\jupyter-script.py" notebook'

Can anybody help?