Re: [jupyter] Jupyter doesn't see my Python package modifications

9 views
Skip to first unread message

Joe Quigley

unread,
Sep 25, 2018, 12:35:47 PM9/25/18
to jup...@googlegroups.com
If you use it in a Jupyter Notebook or Lab, you can handle this by restarting the kernel. This can be done via "Kernel > Restart" or by pressing the 0 (zero) key twice.

The reason why this happens is because Python caches imported modules. Your changes aren't reflected in the module cache, so when you go to re-import it will simply pull from the cache again. Restarting the kernel will create a new Python process with an empty module cache- restarting the Jupyter server has the same effect.

(as an aside, you don't have to press the "synchronize" button in PyCharm. That is more for JetBrains internals- typically, you use it as a troubleshooting step when dealing with PyCharm bugs.)

-Joe

On Tue, Sep 25, 2018 at 8:54 AM, Alvipa <patricia.alva...@gmail.com> wrote:
Hello everyone,

I'm learning to handle Jupyter in a more advanced way and I have this doubt:

I created a package with Python scripts under the directory "my_packages", and developed its content with the PyCharm editor. I import this package from Jupyter notebook. So that all works well.

The problem is when I make changes to my package code. When I want to update the changes, I click on the PyCharm "Synchronize" button, but in order to make Jupyter see it I have to turn Jupyter off and on again.

As an addition, Jupyter runs under an Anaconda environment and I have exported in .bashrc the path of the package directory:
export PYTHONPATH="$HOME/root_package/":${PYTHONPATH}
export JUPYTER_PATH="$HOME/root_package/":${JUPYTER_PATH}
export PYTHONPATH
export JUPYTER_PATH

I've already tried everything I can imagine (adding channels to anaconda, etc.)
I can't turn Jupyter on and off every time I make a modification to my package. 
What can I do?

Thank you in advance






--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/f946b9d7-4672-4b17-a380-2000325d9689%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages