|
import subprocess, sys, os, time, select, pty, errno |
|
from IPython import get_ipython |
|
from pathlib import Path |
|
|
|
xxx = Path('/kaggle/working') |
|
script = xxx / 'venv.py' |
|
|
|
os.chdir(xxx) |
|
sys.path.append(str(xxx)) |
|
|
|
get_ipython().system('curl -sLO https://raw.githubusercontent.com/gutris1/segsmaker/main/kaggle/script/pantat88.py') |
|
time.sleep(1) |
|
|
|
from pantat88 import say, download |
|
say('γ{red} Installing VENV{d} γ{red}') |
|
|
|
req_list = [ |
|
f"curl -LO https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/get_ip.py", |
|
f"curl -LO https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel", |
|
f"curl -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64", |
|
f"apt-get update", |
|
f"apt -y install lz4 pv aria2", |
|
f"pip install -q git+https://github.com/DEX-1101/colablib", |
|
f"npm install -g localtunnel", |
|
f"chmod +x /usr/bin/cl"] |
|
|
|
for items in req_list: |
|
subprocess.run(items.split(), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) |
|
|
|
def venv_install(): |
|
os.chdir('/kaggle') |
|
url = 'https://huggingface.co/pantat88/back_up/resolve/main/venv.tar.lz4' |
|
fn = Path(url).name |
|
download(url) |
|
|
|
extract_venv = f'pv {fn} | lz4 -d | tar xf -' |
|
get_ipython().system(extract_venv) |
|
Path(fn).unlink() |
|
|
|
vnv = Path('/kaggle/venv') |
|
get_ipython().system(f'rm -rf {vnv / "bin" / "pip*"}') |
|
get_ipython().system(f'rm -rf {vnv / "bin" / "python*"}') |
|
get_ipython().system(f'python -m venv {vnv}') |
|
|
|
venv_install() |
|
os.chdir(xxx) |
|
say('γ{red} VENV Setup Completed{d} γ{red}') |
|
script.unlink() |