I have the following line of codes:
from pip import main as pipmain
# initial installation
pipmain(["install", "pyscenic==0.10.0"])
import pyscenic
pyscenic.__version__
# return 0.10.0
# Some large code here
# second installation
pipmain(["install", "install", "pyscenic==0.10.4"])
import pyscenic
pyscenic.__version__
# still return 0.10.0
# Another large chunk that required new version
There I want to upgrade the pyscenic package on-the-fly inside my code. However as I noted above, in the second installation the version still doesn't change. I expect it to change to 0.10.4. How can I do it properly?
I also tried this, still no avail:
import os
import importlib
os.system('pip install pyscenic==0.10.0')
import pyscenic
pyscenic.__version__
os.system('pip install pyscenic==0.10.4')
import pyscenic
pyscenic.__version__
importlib.reload(pyscenic)
pyscenic.__version__
All code tested on IPython (interactive). If I exit the IPython and re-enter again it will take effect. But that's not what I want.
from How to make Python package update within a code to take effect on-the-fly
No comments:
Post a Comment