0

So I was trying to modify an existing library and instead of doing it the smart way and using pip -e I instead just installed the libraries, then swapped the modified files for whatever changes I wanted. For example if I had:

Library A/ 
---doSomethingA.py 
---otherFiles.py

I just deleted doSomethingA.py and replaced it with my version of doSomethingA.py. Theoretically I figured, because im editing the file locally, it should still work as planned for my library with whatever extra functionality I want.

HOWEVER.... its basically going crazy. While I can see my edited changes in the file, when I run the library its obviously not running that file. I did things like:

  1. commenting out the whole file (still runs somehow)

  2. Actually uninstalling the library and part of another script using doSomethingA.py it still runs?? (i.e Something like import libraryA works on JupyerHub, but not on the putty terminal... ?)

I've obviously come to the conclusion that its not running the file that it says that it is (and trust me I've checked the path of the file like 10 times).

My question is:

  • How is this possible? What are the places that python would store another copy of the file etc?

I've also deleted the __pychache__, but I can't think of anything else to do. Is my best option to just give up and create a new virtual environment, etc?

ocean800
  • 3,489
  • 13
  • 41
  • 73

1 Answers1

1

I understand that you are running on jupyter hub.

This means that your python is running remotly on the server and the framework is taking care to synch your local project (but not the installed libraries).

The python on the server is not aware of your local change.

As a temporary mitigation you can copy the installed library to you project root.

Lior Cohen
  • 5,570
  • 2
  • 14
  • 30
  • Ah so you are saying that Jupyter Hub will check and update changes from `ProjectA` everytime I make them, but if I install a `LibraryA` it will only sync once with that library once its installed? I dont understand why it would still be partially functioning after an uninstall however – ocean800 Nov 04 '19 at 21:27
  • 1
    This is usually what happens in remote interpreters. The site-package is large and sync is expensive. user project is usually lean. – Lior Cohen Nov 04 '19 at 21:59
  • I just moved off of JupyterHub for the time being but your answer was a lifesaver, thanks :) – ocean800 Nov 04 '19 at 22:41