jupyter-notebook

Can a jupyter notebook find its own filename?

断了今生、忘了曾经 提交于 2020-07-20 07:33:07
问题 Is it possible for a jupyter notebook to get the name of its own file, similarly to what we would do from a python script? os.path.basename(__file__) doesn't seem to work, at least for me on jupyterlab sys.argv[0] returns my_home/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py 回答1: The only way I've found is through JavaScritp as in this answer. The compact form is a cell like this: %%javascript IPython.notebook.kernel.execute(`notebookName = '${window.document.getElementById(

Download data from a jupyter server

前提是你 提交于 2020-07-20 06:48:06
问题 I'm using ipython notebook by connecting to a server I don't know how to download a thing (data frame, .csv file,... for example) programatically to my local computer. Because I can't specific declare the path like C://user//... It will be downloaded to their machine not mine 回答1: If you are using Jupyter notebook, you can go to the "File" tab on the top left part of the notebook and click "Open". It shows you the content of the current directory. You can select your data file with different

Problem displaying widgets / ipywidgets install unsuccessful

落爺英雄遲暮 提交于 2020-07-20 03:48:24
问题 I'm implementing widgets in my jupyter notebook (via anaconda). I tried first by using an old code from a professor of mine, but it's not displaying widgets. I tried installing: jupyter labextension install @jupyter-widgets/jupyterlab-manager But it was unsuccessful This was presented when I attempted installation of the package via windows command prompt: C:\Users\davio>jupyter labextension install @jupyter-widgets/jupyterlab-manager Traceback (most recent call last): File "C:\Users\davio

Problem displaying widgets / ipywidgets install unsuccessful

安稳与你 提交于 2020-07-20 03:48:04
问题 I'm implementing widgets in my jupyter notebook (via anaconda). I tried first by using an old code from a professor of mine, but it's not displaying widgets. I tried installing: jupyter labextension install @jupyter-widgets/jupyterlab-manager But it was unsuccessful This was presented when I attempted installation of the package via windows command prompt: C:\Users\davio>jupyter labextension install @jupyter-widgets/jupyterlab-manager Traceback (most recent call last): File "C:\Users\davio

Set my jupyter notebook to use python version of an enviroment

只谈情不闲聊 提交于 2020-07-18 06:24:09
问题 I opened a jupyter notebook from an anaconda enviiroment but the kernel uses a default version of python instead of the python defined in this enviroment (That has all pthe packages i installed). How can I change it? (myEnv) okoub@my-mac:~/Desktop$jupyter notebook [I 13:35:46.644 NotebookApp] The port 8888 is already in use, trying another port. [I 13:35:46.646 NotebookApp] The port 8889 is already in use, trying another port. [I 13:35:46.675 NotebookApp] JupyterLab alpha preview extension

Get the path of the notebook on Google Colab

折月煮酒 提交于 2020-07-15 09:36:39
问题 I'm trying to use hyperas (hyperparameter optimization for keras) in a Google Colab notebook, I've installed hyperas sucefully with: !pip install hyperas but there is a problem with the minimize function parameter notebook_name that is mandatory to set when you are using a notebook This param has to be filled with the path of the notebook but in Colab I don't know how to get it 回答1: You can copy the notebook.ipybn from Google Drive. Then hyperas can extract the info from it. # Install the

os.getenv returns empty output - python

假装没事ソ 提交于 2020-07-10 10:29:29
问题 I am new to python and encountering some issues while executing os commands. I have set my environment variables like as shown below SPARK_HOME = '/opt/spark' HAIL_HOME = '/opt/hail/hail' When I type os.getenv('SPARK_HOME') , I get the below output '/opt/spark/' But when I type os.getenv('HAIL_HOME') , I get blank output Please note that I type the above two commands from a virtual environment using jupyter notebook. Why it works for spark and returns empty for hail Can guide me with this

os.getenv returns empty output - python

▼魔方 西西 提交于 2020-07-10 10:29:01
问题 I am new to python and encountering some issues while executing os commands. I have set my environment variables like as shown below SPARK_HOME = '/opt/spark' HAIL_HOME = '/opt/hail/hail' When I type os.getenv('SPARK_HOME') , I get the below output '/opt/spark/' But when I type os.getenv('HAIL_HOME') , I get blank output Please note that I type the above two commands from a virtual environment using jupyter notebook. Why it works for spark and returns empty for hail Can guide me with this

How to automate running of Jupyter Notebook cells periodically

廉价感情. 提交于 2020-07-09 16:46:13
问题 I want to integrate my jupyter notebook with my website, where I have written the code to fetch real-time data from MySQL server and do real-time visualisation using plotly . But every time I'm having to run all the cells of my Kernel. Is there a way I can automate the running of the Jupyter notebook cells periodically say everyday 1 hour? 回答1: My suggestion would be to Setup a cron job with the periodicity you want. Use runipy to run all the cells in the notebook. It has a lot of

MathJax auto equation numbering does not work in Jupyter properly

孤街浪徒 提交于 2020-07-09 12:57:25
问题 I want to number the LaTeX equation, I searched internet that I shall use %%javascript MathJax.Hub.Config({ TeX:{equationNumbers:{autoNumber:'all'}} }); I tested with an equation also with \eqref{} : In equation $\eqref{eq:sample}$, we find the value of an interesting integral: \begin{equation} \int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15} \label{eq:sample}{\tag{99}} \end{equation} The output in JupyterLab is So far everything looks alright, however I start any another cell, use