Update conda.py
Browse files
conda.py
CHANGED
|
@@ -52,15 +52,13 @@ input_widget.add_class('boxs')
|
|
| 52 |
def CondaInstall():
|
| 53 |
try:
|
| 54 |
display(Image(filename=str(img)))
|
| 55 |
-
print(f"{BLUE} Iniciando actualizaci贸n forzada a Python 3.10.13...")
|
| 56 |
|
| 57 |
cmd_list = [
|
| 58 |
(f'rm -rf {home}/.condarc', None),
|
| 59 |
('conda config --add channels conda-forge', None),
|
| 60 |
('conda install -qy mamba', f'{BLUE} Installing Anaconda'),
|
| 61 |
('mamba install -y conda', None),
|
| 62 |
-
|
| 63 |
-
('mamba install -y --force-reinstall python=3.10.13', f'{CYAN} Installing Python 3.10.13 (Forced)'),
|
| 64 |
('mamba install -y glib gperftools openssh pv gputil curl', f'{PURPLE} Installing Conda Packages'),
|
| 65 |
('pip install psutil aria2 gdown', f'{PINK} Installing Python Packages'),
|
| 66 |
('conda clean -qy --all', None)
|
|
@@ -68,23 +66,11 @@ def CondaInstall():
|
|
| 68 |
|
| 69 |
for cmd, msg in cmd_list:
|
| 70 |
if msg is not None: print(msg)
|
| 71 |
-
|
| 72 |
-
result = subprocess.run(shlex.split(cmd), capture_output=True, text=True)
|
| 73 |
-
if result.returncode != 0 and result.stderr:
|
| 74 |
-
print(f"Command '{cmd}' failed with error: {result.stderr}")
|
| 75 |
-
except Exception as e:
|
| 76 |
-
print(f"Error executing '{cmd}': {e}")
|
| 77 |
-
|
| 78 |
-
# Verificar la versi贸n de Python despu茅s de la instalaci贸n
|
| 79 |
-
try:
|
| 80 |
-
python_ver = subprocess.run(['python', '--version'], capture_output=True, text=True)
|
| 81 |
-
print(f"{GREEN} Python version after installation: {python_ver.stdout.strip()}")
|
| 82 |
-
except Exception as e:
|
| 83 |
-
print(f"Error checking Python version: {e}")
|
| 84 |
|
| 85 |
SyS(f'rm -rf {home}/.cache/* {home}/.condarc')
|
| 86 |
clear_output()
|
| 87 |
-
print(f'{GREEN} Done
|
| 88 |
|
| 89 |
get_ipython().kernel.do_shutdown(True)
|
| 90 |
|
|
@@ -132,11 +118,12 @@ def KeyWidget(civitai_key='', hf_token=''):
|
|
| 132 |
input_widget.close()
|
| 133 |
main_output.clear_output()
|
| 134 |
|
| 135 |
-
|
|
|
|
|
|
|
|
|
|
| 136 |
with main_output:
|
| 137 |
-
print(f"{CYAN} Forzando actualizaci贸n a Python 3.10.13...")
|
| 138 |
CondaInstall()
|
| 139 |
-
|
| 140 |
save_button.on_click(KeyInputs)
|
| 141 |
|
| 142 |
def KeyCheck():
|
|
@@ -152,7 +139,6 @@ def KeyCheck():
|
|
| 152 |
else:
|
| 153 |
KeyInject(civitai_key, hf_token)
|
| 154 |
display(main_output)
|
| 155 |
-
# Forzar la actualizaci贸n sin importar la versi贸n actual de Conda
|
| 156 |
CondaInstall()
|
| 157 |
else:
|
| 158 |
display(input_widget, main_output)
|
|
@@ -169,4 +155,4 @@ def CondaMisc():
|
|
| 169 |
|
| 170 |
CondaMisc()
|
| 171 |
LoadCSS()
|
| 172 |
-
KeyCheck()
|
|
|
|
| 52 |
def CondaInstall():
|
| 53 |
try:
|
| 54 |
display(Image(filename=str(img)))
|
|
|
|
| 55 |
|
| 56 |
cmd_list = [
|
| 57 |
(f'rm -rf {home}/.condarc', None),
|
| 58 |
('conda config --add channels conda-forge', None),
|
| 59 |
('conda install -qy mamba', f'{BLUE} Installing Anaconda'),
|
| 60 |
('mamba install -y conda', None),
|
| 61 |
+
('mamba install -y python=3.10.13', f'{CYAN} Installing Python 3.10'),
|
|
|
|
| 62 |
('mamba install -y glib gperftools openssh pv gputil curl', f'{PURPLE} Installing Conda Packages'),
|
| 63 |
('pip install psutil aria2 gdown', f'{PINK} Installing Python Packages'),
|
| 64 |
('conda clean -qy --all', None)
|
|
|
|
| 66 |
|
| 67 |
for cmd, msg in cmd_list:
|
| 68 |
if msg is not None: print(msg)
|
| 69 |
+
subprocess.run(shlex.split(cmd), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
SyS(f'rm -rf {home}/.cache/* {home}/.condarc')
|
| 72 |
clear_output()
|
| 73 |
+
print(f'{GREEN} Done')
|
| 74 |
|
| 75 |
get_ipython().kernel.do_shutdown(True)
|
| 76 |
|
|
|
|
| 118 |
input_widget.close()
|
| 119 |
main_output.clear_output()
|
| 120 |
|
| 121 |
+
p = subprocess.run(['conda', '--version'], capture_output=True, text=True, check=True)
|
| 122 |
+
cv = p.stdout.strip().split()[1]
|
| 123 |
+
mv = int(cv.split('.')[0])
|
| 124 |
+
|
| 125 |
with main_output:
|
|
|
|
| 126 |
CondaInstall()
|
|
|
|
| 127 |
save_button.on_click(KeyInputs)
|
| 128 |
|
| 129 |
def KeyCheck():
|
|
|
|
| 139 |
else:
|
| 140 |
KeyInject(civitai_key, hf_token)
|
| 141 |
display(main_output)
|
|
|
|
| 142 |
CondaInstall()
|
| 143 |
else:
|
| 144 |
display(input_widget, main_output)
|
|
|
|
| 155 |
|
| 156 |
CondaMisc()
|
| 157 |
LoadCSS()
|
| 158 |
+
KeyCheck()
|