Jupyter running different version of uninstalled library?

血红的双手。 提交于 2020-01-16 19:31:13

问题


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?


回答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.



来源:https://stackoverflow.com/questions/58701115/jupyter-running-different-version-of-uninstalled-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!