Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycharm Jupyter Notebook `PYTHONPATH`?

System information

  • Mac OS X 10.12 Sierra
  • Pycharm 2016.2.3
  • Python 3.5.1
  • Jupyter 4.1.0

Question

When I'm using Jupyter Notebook under Pycharm, it doesn't seem to include my current working directory, or the source root directory, in the PYTHONPATH of the currently active Jupyter Notebook. This is unlike the behaviour of ordinary .py files, for which Pycharm automatically includes its current directory and the project source root directory in the PYTHONPATH. So, is it possible to set Pycharm to automatically include the project source root directory in the PYTHONPATH for Jupyter Notebooks run under Pycharm?

like image 824
Ray Avatar asked Oct 10 '16 10:10

Ray


People also ask

How do I debug a Jupyter notebook in PyCharm?

Debug code in Jupyter notebooksSet the breakpoints in the selected cell and press Alt + Shift + Enter for Windows or ⌥⇧↩ for macOS. Alternatively, you can right-click the cell and select Debug Cell from the context menu.

Can you use Ipywidgets in PyCharm?

PyCharm Pro now has full support for both static and JavaScript-based outputs used by popular scientific libraries such as #Plotly, Bokeh, #Altair, ipywidgets, and more.


1 Answers

It turns out, in a past endeavour, I modified my jupyter_notebook_config.py in %USER%\.jupyter folder. Looked at lines as follows:

## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'D:\\Works\\GitHub\\Jupyter\\'

The line under the ##, indicates the override path, evidently.

When I commented it out...Pycharm all of the sudden successfully launched with pwd of the file (location of the .ipynb). good luck, hth.

like image 193
OSHI_7 Avatar answered Oct 14 '22 07:10

OSHI_7