I recently found out about Jupyterlab. I like the improvement over plain Notebooks.
I was hoping we could actually use Jupyterlab as an online IDE for web development of Django, Flask or other projects. I don't like developing in a local environment. However I cannot find anything about using Jupyter for web development. Not in their Github repo or searching on Google.
Opening normal .py the tab function to list all functions, classes etc don't work. This also doesn't work when importing a .py file in a .ipynb file.
Using nbconvert and P2J to convert all files back and forth from .py to ipynb and vice versa isn't really efficient.
And besides this, another issue with this approach is that
if you import nb 2 in nb 1 and you change something in nb 2 you have to restart the entire kernel of nb 1 in order to have the changes take effect. Simply re-running the import or importlib.reload(nb2) doesn't work.
Is there a good approach to this?
Related
I am using nbinteract to develop an interactive web page from a Jupyter notebook. I finally got to the end and published the first version of it but it does not appear the python libraries loaded properly (see image below). This appears to be the problem even in the original nbinteract tutorial. Any ideas on what might be the problem here?
Thank you
It’s possible to export a notebook including widgets to html using nbconvert (https://github.com/jupyter/nbconvert ). You need to make sure to save the notebook using the classic Jupyter Notebook (not JupyterLab) with the “Widgets -> Save Notebook Widget State” menu option.
Unfortunately, it’s not possible to preserve the behavior of the callback functions this way because these functions are defined using Python, and there’s no Python kernel available in the standalone HTML file.
To host interactive figures outside of the notebook , writing a Dash app is always good (https://dash.plot.ly/ ). or If you want to stay in notebook/widget field you could use https://github.com/QuantStack/voila.
My Original Error:
I am new to python and am using anaconda 4.8.3. When I try to autocomplete after math. or sentence. nothing shows up. I have tried installing both pyreadline and jedi, but both are already installed with anaconda apparently. I have not disabled or enabled anything outside of the normal process of learning to use conda, like setting up shells and feeling out how to use ipython/notebooks.
The Fix that I was able to find:
%config Completer.use_jedi = False
Put this line of code literally anywhere, I recommend making a separate text file for this specifically if you are having this issue, and you just need to run it before coding. You will need to do this every time that you open up the notebook but aside from that it is an easy fix. If you know anyone with this problem please share this with them. So far I have not found anything else that works for me, so if there is a more permanent option I would love to see it.
For ipython version 7.19.0 add the following to your ipython config file. default is at where your other profile files are lurking at
.ipython/profile_default/ipython_config.py
c.Completer.use_jedi=False
Looks like some stability issues are still being worked on.
ref IPython core.completer
I have generated an .exe-file for a little PowerPoint Tool, that I've written using python 3.6, the PyQt5 framework and pyinstaller. The program runs without any errors on my own laptop and functions as expected.
Unfortunately, I can't get the .exe to run on a different computer. I've tried with 2 other computers now and get different errors on each of them.
PC 1:
Entry Point not found
The procedure entry point ucrtbase.terminate could not be
located in the dynamic link library api-ms-win-crt-runtime-l1-1-0.dll.
PC 2:
This application failed to start because it could not load the Qt platform plugin 'Windows'.
The thing, that bugs me is, that I had this last error (from PC2) during development on my dev computer, but fixed this problem for my own PC.
What I was trying to do is create an .exe-file that just runs on any PC. It's a simple PowerPoint Helper, which is supposed to be a quick tool to create new slides from a folder of images. That is why it's pretty important, that it can be seamlessly used. Ideally just opening the .exe and go, without the need to worry about individual missing pieces on every single computer, where it will be utilized.
BIG QUESTION: Is there anything I can do, to guarantee my .exe to include all the dependencies that are needed to run?
Things I've tried (aka I DID try to solve it myself.. for days):
read trough here: https://github.com/pyqt/python-qt5/issues/2
changed my .specas mentioned here: https://github.com/carlosperate/pyinstaller-test/blob/master/package/pyqt5_test.spec
read through all of this: https://stackoverflow.com/search?page=2&tab=Relevance&q=entry%20point%20not%20found
and this: https://stackoverflow.com/search?q=qt+platform+windows
and this: pyinstaller exe without any dependencies?
But nothing helps.... Most of the posts address problems when compiling the executable file, but this works just fine for me.
If using Python 3.5, PyInstaller 3.3.1 and PyQt 5.9.2 is an option for you, use fbs instead of PyInstaller to freeze your application. It is based on PyInstaller but solves edge cases like the one you are experiencing. There are instructions for setting up your app for use with fbs here.
Collaboration with a coworker on a Jupyter notebook is driving me nuts. We're working on different versions (I would say "branches", but that's probably too fancy for what we're doing) of the same notebook. I try to merge (some of) the changes he introduces, into my version. Since diffing JSON files is a nightmare, I convert the two notebooks to .py files (Download as\Python (.py file) from the File menu of the notebooks) and then compare the .py files in PyCharm. This works nicely, also because all output is removed when exporting to .py.
The problem now is to import the changed .py file into Jupyter. Is this possible? The one thing that gives me hope of an affirmative answer, is that into the exported .py files there are some # In[4]: comments, which maybe the Jupyter interface may use to understand how the code is divided into cells. Or is it just impossible to go back? If so, do you have any other suggestions to merge some of changes between two different versions of a Jupyter notebook?
To answer the second question:
(And this question looks related there)
When we had that problem, using jq as described in this post worked okay. (The part starting from "Enter jq".)
To use this, you would have a second, "stripped" version of the notebook which is the one you add to git, in addition to your development notebook (which is not added to git, otherwise you get merge conflicts with the development notebooks of your teammates).
You always need an additional step,
nbstrip_jq mynotebook.ipynb > mynotebook_stripped.ipynb
before doing git add mynotebook_stripped.ipynb, git commit etc. But if everyone in your team does that, the changes are more or less nicely manageable with git. For bigger projects, you could try automating it like described further below in the same post.
I'm learning some Data Science and for that I'm using Python with Jupyter Notebook. Which I think it's great for data analysis, mainly because it’s super easy to run step-by-step code. You can see everything that is happening.
On the other hand, to do more complex projects, like a web crawler or an Object Oriented program to extract information from an API, I’m using Sublime Text3. IMO it’s simple, clean, light… perfect. Also I think that .py is better than .ipynb for that (I don't even know if it's possible to do OO with Jupyter).
My problem now is integrating these two tools. The best I can do now is convert the dictionnaires in some .csv file and read it manually in Jupyter notebook. Obviously it doesn't sounds very smart and it is like a temporary solution just for experimentation.
This is the first time I'm dealing with a project which I need to integrate more than one environment and not only working with the same languages with all the files in the same folder etc. so I'm not very familiar on how to approach that.
If someone could explain the right way of integrating these two IDEs, how to make all the process more 'automatic', if it's better to use some database and then extract with SQL or something like that I'd appreciate very much.
PS: Also, if you guys have any material on how should a Python Data Science project be organized it would be awesome. Thanks!
I use ipython magic commands to help me switch between a text editor and a ipython notebook.
Specifically, I like to experiment with the code in the Notebook for the reasons you mentioned, and then when I'm ready to integrate it as a class in a bigger system I use the %%writefile filename.py command which will export that cell into a .py file.
You can also use %load filename.py and %run myfile.py to bring .py files into the notebook.