Simple package to lookup missing packages and autoinstall them.
pip install superimport
There are two ways to use superimport:
- superimport can be called as a program, see
-h
for args. This allows you to do "superimports" across mulitple files and folders. - by adding
import superimport
to the top of your python script. This is the per script mode.
See this notebook
- If the missing python package contains a requirement that is not listed in its own requirements.txt and is being used your file will fail anyway.
- If you import superimport twice in the same process (a common usecase is ipython kernels), the second time will not work because of the way python loads modules , you would need a something like deimport to deimport the package before being able to import superimport to the desired effect again.
- If you run superimport in ipython, please use deimport to deimport superimport and use
%run -n
if you use%run