Fwd: linux-miniconda-installer script usage and problems.

From: Mario Marietto <marietto2008_at_gmail.com>
Date: Wed, 25 Jan 2023 23:54:03 UTC
Hello to everyone,

I've been able to run the stable diffusion webui of automatic1111. You can
read the post and the tutorial that I have created here :

https://forums.freebsd.org/threads/how-to-run-stable-diffusion-webui-on-freebsd.87610/

What's the problem that I have ? The problem is that it runs only with the
centos7 userland.

As I said,to run it I'm forced to use the centos package installed on
/compat/linux. But I have also installed Ubuntu on /compat/ubuntu with some
important applications inside that I use from time to time,like
brave,chrome,firefox,spotify,Sikulix,etc. As you probably know,we can't use
two linux layers simultaneously. So,if I want to run stable diffusion I
can't run at the same time the linux version of firefox,useful when I want
to watch some DRM protected content. But what happens when I try to run the
commands above using ubuntu instead of centos ? this :

service ubuntu onestop && sysctl compat.linux.emul_path=/compat/ubuntu
&& service ubuntu onestart
cd /compat
source /usr/home/marietto/miniconda3/etc/profile.d/conda.sh
conda activate
cd /compat/ubuntu/home/marietto/stable-diffusion-webui
conda activate automatic
LD_PRELOAD=/compat/dummy-uvm.so  python3 launch.py

Python 3.10.9 (main, Jan 11 2023, 15:21:40) [GCC 11.2.0]
Commit hash: 360feed9b55fb03060c236773867b08b4265645d
Traceback (most recent call last):
  File "/compat/ubuntu/home/marietto/stable-diffusion-webui/launch.py",
line 294, in <module>
    prepare_environment()
  File "/compat/ubuntu/home/marietto/stable-diffusion-webui/launch.py",
line 209, in prepare_environ
ment
    run_python("import torch; assert torch.cuda.is_available(), 'Torch
is not able to use GPU; add -
-skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'")
  File "/compat/ubuntu/home/marietto/stable-diffusion-webui/launch.py",
line 73, in run_python
    return run(f'"{python}" -c "{code}"', desc, errdesc)
  File "/compat/ubuntu/home/marietto/stable-diffusion-webui/launch.py",
line 49, in run
    raise RuntimeError(message)
RuntimeError: Error running command.
Command: "/home/marietto/miniconda3/envs/automatic/bin/python3" -c
"import torch; assert torch.cuda.
is_available(), 'Torch is not able to use GPU; add
--skip-torch-cuda-test to COMMANDLINE_ARGS variab
le to disable this check'"
Error code: 1
stdout: <empty>
stderr: Traceback (most recent call last):
  File "<string>", line 1, in <module>
AssertionError: Torch is not able to use GPU; add
--skip-torch-cuda-test to COMMANDLINE_ARGS variabl
e to disable this check

I don't know why that error happens,but I know that it does not happen if I
use Centos instead of Ubuntu and I have issued the same commands included
in the tutorial to both "distros". I suspect that centos has some different
software mechanisms than ubuntu. But I want to use only one "distro" and I
would like it to be Ubuntu,because I have a better familiarity with it than
with the centos.

I understand that I have two roads that I can follow :

1) installing Debian in a chroot under CentOS

2) modify the script called "*miniconda-installer.sh*" and / or the script
called "*Miniconda3-latest-Linux-x86_64.sh*" or both,I don't know.

First of all,I have installed ubuntu following this tutorial :


https://forums.freebsd.org/threads/linuxulator-how-to-install-brave-linux-app-on-freebsd-13-0.78879/


and then I've started to follow the instructions and I've reached the point
where miniconda3 should be installed. This is what happens when I try to do
that on a fresh installation of FreeBSD :

# miniconda-installer.sh
/compat/linux/bin/sh: error while loading shared libraries:
libtinfo.so.5: cannot open shared object file: No such file or
directory

As the error says,it refers to /compat/linux,but I'm using
/compat/ubuntu,so,I've thought to make some little modification inside
the script called *"miniconda-installer.sh"*,changing the word linux
with the word ubuntu.
Below you see what happens when I run the modified script :

Miniconda3 will now be installed into this location:
/home/marietto/miniconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/home/marietto/miniconda3] >>>
PREFIX=/home/marietto/miniconda3
md5sum: -: No such file or directory
WARNING: md5sum mismatch of tar archive
expected: 81b26c617ffd9011dea96fd57c13e71b
     got:
Unpacking payload ...

Installing base environment...


Downloading and Extracting Packages


Downloading and Extracting Packages

Preparing transaction: done
Executing transaction: done
Miniconda3-latest-Linux-x86_64.sh: 438: [[: not found

Installing * environment...

Miniconda3-latest-Linux-x86_64.sh: 444: [[: not found

CondaFileIOError: '/home/marietto/miniconda3/pkgs/envs/*/env.txt'.
[Errno 2] No such file or directory:
'/home/marietto/miniconda3/pkgs/envs/*/env.txt


My knowledge of the shell scripting is too low to understand how to fix
that error. But I presume that someone of you can.

It looks like a script requiring bash running in plain /bin/sh. So,I
tried to do something like this :


marietto@marietto:/compat $ bash

[marietto@marietto /compat]$ miniconda-installer

Welcome to Miniconda3 py310_22.11.1-1

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
======================================
End User License Agreement - Miniconda
======================================

Copyright 2015-2022, Anaconda, Inc.

All rights reserved under the 3-clause BSD License:

This End User License Agreement (the "Agreement") is a legal agreement
between you and Anaconda, Inc
. ("Anaconda") and governs your use of Miniconda.

Subject to the terms of this Agreement, Anaconda hereby grants you a
non-exclusive, non-transferable
 license to:

  * Install and use the Miniconda,
  * Modify and create derivative works of sample source code delivered
in Miniconda subject to the T
erms of Service for the Repository (as defined hereinafter) available
at https://www.anaconda.com/te
rms-of-service <https://www.anaconda.com/te%0Drms-of-service>, and
  * Redistribute code files in source (if provided to you by Anaconda
as source) and binary forms, w
ith or without modification subject to the requirements set forth below.

Anaconda may, at its option, make available patches, workarounds or
other updates to Miniconda. Unle
ss the updates are provided with their separate governing terms, they
are deemed part of Miniconda l
icensed to you as provided in this Agreement. This Agreement does not
entitle you to any support for

Do you accept the license terms? [yes|no]
[no] >>> yes

Miniconda3 will now be installed into this location:
/home/marietto/miniconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/home/marietto/miniconda3] >>>
PREFIX=/home/marietto/miniconda3
md5sum: -: No such file or directory
WARNING: md5sum mismatch of tar archive
expected: 81b26c617ffd9011dea96fd57c13e71b
     got:
Unpacking payload ...

Installing base environment...


Downloading and Extracting Packages


Downloading and Extracting Packages

Preparing transaction: done
Executing transaction: done
Miniconda3-latest-Linux-x86_64.sh: 438: [[: not found

Installing * environment...

Miniconda3-latest-Linux-x86_64.sh: 444: [[: not found

CondaFileIOError: '/home/marietto/miniconda3/pkgs/envs/*/env.txt'.
[Errno 2] No such file or directory:
'/home/marietto/miniconda3/pkgs/envs/*/env.txt

As further experiment I have installed the ubuntu userland under
/compact and I have renamed the name ubuntu
with the name linux and I tried again to install the
linux-miniconda-installer,but it didn't even work.
The error that I get in this case is the same as before. I don't know
what to do next.

-- 
Mario.