I would like to know how to use vi-like key bindings in a Jupyter console -- not just with ipython, but with any kernel.
Previous answers show this is possible for ipython. So, perhaps there is some flag or config file where this can be specified. Jupyter does not appear to have an equivalent to ipython profile and giving the same flagged variables as in ipython does not work.
The Jupyter console documentation almost provides the answer. For the flag, you just need to change the variable name:
jupyter console --kernel=ir --ZMQTerminalInteractiveShell.editing_mode=vi
To set this option globally, you have to add c.ZMQTerminalInteractiveShell.editing_mode='vi' to $HOME/.jupyter/jupyter_console_config.py. It's necessary to prefix the 'c.', similar to what's created when running ipython profile create, which the documentation does not specify.
Related
I was trying to using !date to print date-related information in jupyter notebook, but it seems that it just hang around there without running, what might be reason. I am using Anaconda virtual environment on windows.
In IPython syntax, the exclamation mark (!) allows users to run shell commands from inside a Jupyter Notebook code cell.
If you are on Windows, date will show the system data and allows you to set a new one. This doesn't make much sense from inside Jupyter Notebooks.
If you want to see the current date and time in IPython, instead use
import time
time.strftime("%c")
I am learning how to do equation numbering using ams math in local Jupyter notebook. As per the documentation, it says to make changes in _config.yml file. But I am not sure where to find it on my Mac. If it helps, I have the file jupyter_notebook_config.py in ~/.jupyter directory. But they don't look the same.
Can I kindly get some help here (example'll be appreciated), how to work with _config.yml file. thanks in advance.
The documentation you linked to is for a project called jupyter-book. If you're using that, then, as #MattDMo said, follow the example from the tutorial and add the _config.yml in the folder that contains your book.
If you're using a regular Jupyter Notebook, you can disregard that and just write the LaTeX in a Markdown cell, where it will be rendered (by MathJax rather than MyST), without any extra config.
I use Sympy for some calculations and during debugging or after the script has run in want to inspect some variables. The IDE is Spyder, so i use its console. I think it is called IPython, but i am not sure about this.
As all the variables used within the script, they all remain available after the script stopped. I just write the name of a variable to the console and expect that the content of the variable is displayed.
This works nicely for "normal" variables. But when it comes to Sympy objects, i can see only garbage:
What am i doing wrong? Can i change this behavior? Can i make Spyder/IPython write the Sympy expressions using normal ASCII characters, It does not need to reformat the expressions in some not easy readably ASCII "art". If i need a nice representation of the expressions i can use a Jupyter notebook anyway.
I deactivated "Symbolic mathematics" in Preferences / IPython console / Advanced settings.
I am trying to use plotnine to generate some graphs. I import the required libraries:
from plotnine import *
from plotnine.data import mpg
And then, if I run the following code in PyCharm I get a Warning message, the window plot
shows a "No answer" message and I am forced to restart the python terminal:
(ggplot(mpg) # defining what data to use
+ aes(x='class') # defining what variable to use
+ geom_bar(size=20) # defining the type of plot to use
)
<ggplot: (150517199824)>
C:\Users\alvaromc317\miniconda3\envs\general\lib\site-packages\plotnine\ggplot.py:363: UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail.
However, If I start a python terminal from windows cmd terminal and run the same script as before, I get no error message and I see the plot with no problem.
What is happening and how do I get to use plotnine in pycharm?
In case it is needed, I work using a Windows 10 machine and python 3x based on miniconda.
I'm having a similar problem, but on MacOS using the commercial addition of PyCharm.
From this github issue and this JetBrains issue, it looks like it might be related to a PyCharm bug.
I currently seem to have two different directories, one listed under Local\AppData\Programs and one under the PyCharm library (the IDE I started using). I was downloading a gmail APK (ezgmail), and I noticed the actions I took in the default IDLE and PyCharm shells had different results when trying to import the module.
Are these two instances of Python files different? If so, how should I combat installations in the future?
Note:
I originally used pip to download ezgmail in the shell, but later clicked on the "download ezgmail" hyperlink suggestion by PyCharm.)
PyCharm creates a virtual environment in which you install python packages. The IDLE uses the global python interpreter.
The two prgrams are looking for the libraries in different locations. PyCharm creates a virtual environment for every project you create (if you specify but its on by default)