easydiffusion icon indicating copy to clipboard operation
easydiffusion copied to clipboard

Dependency Issues on my Ubunutu 22.04 with conda: chardet, idna, requests,

Open peddanet opened this issue 2 years ago • 4 comments

On my ubunntu system 22.04 with python installed:

$ sudo update-alternatives --config python
[..]
There are 2 choices for the alternative python (providing /usr/local/bin/python).

  Selection    Path                 Priority   Status
------------------------------------------------------------
  0            /usr/bin/python3.7    2         auto mode
* 1            /usr/bin/python3.10   1         manual mode
  2            /usr/bin/python3.7    2         manual mode

Press <enter> to keep the current choice[*], or type selection number: 

I was not able to install the ./start.sh script. After some debugging, I found out that conda was lacking the package "chardef". However, when I tried to simply install it by first running (the probably unnecessary) commands:

$ micromamba activate /home/pwein/Downloads/easy-diffusion/installer_files/env
$ eval "$(micromamba shell hook --shell bash)" # as proposed after the first call because a parent process was working, that is why I assume this was potentially unnecessary

After that I try to resolve the dependency issuesin that macromamba environment (or whatever it is):

$ micromamba run -p /home/pwein/Downloads/easy-diffusion/installer_files/env pip3 install chardet
Collecting chardet
  Using cached chardet-5.2.0-py3-none-any.whl.metadata (3.4 kB)
Using cached chardet-5.2.0-py3-none-any.whl (199 kB)
Installing collected packages: chardet
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
requests 2.25.1 requires chardet<5,>=3.0.2, but you have chardet 5.2.0 which is incompatible.
requests 2.25.1 requires idna<3,>=2.5, but you have idna 3.6 which is incompatible.
conda 23.9.0 requires requests<3,>=2.27.0, but you have requests 2.25.1 which is incompatible.
Successfully installed chardet-5.2.0

I had to specifically resolve those conflicts by

$ micromamba run -p /home/pwein/Downloads/easy-diffusion/installer_files/env pip3 install chardet\<5
Collecting chardet<5
  Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 178.7/178.7 kB 3.2 MB/s eta 0:00:00
Installing collected packages: chardet
  Attempting uninstall: chardet
    Found existing installation: chardet 5.2.0
    Uninstalling chardet-5.2.0:
      Successfully uninstalled chardet-5.2.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
requests 2.25.1 requires idna<3,>=2.5, but you have idna 3.6 which is incompatible.
conda 23.9.0 requires requests<3,>=2.27.0, but you have requests 2.25.1 which is incompatible.
Successfully installed chardet-4.0.0

$ micromamba run -p /home/pwein/Downloads/easy-diffusion/installer_files/env pip3 install idna\<3
Collecting idna<3
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.8/58.8 kB 1.5 MB/s eta 0:00:00
Installing collected packages: idna
  Attempting uninstall: idna
    Found existing installation: idna 3.6
    Uninstalling idna-3.6:
      Successfully uninstalled idna-3.6
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
conda 23.9.0 requires requests<3,>=2.27.0, but you have requests 2.25.1 which is incompatible.
Successfully installed idna-2.10

$ micromamba run -p /home/pwein/Downloads/easy-diffusion/installer_files/env pip3 install requests\<3
Requirement already satisfied: requests<3 in /home/pwein/.local/lib/python3.8/site-packages (2.25.1)
Requirement already satisfied: chardet<5,>=3.0.2 in ./installer_files/env/lib/python3.8/site-packages (from requests<3) (4.0.0)
Requirement already satisfied: idna<3,>=2.5 in ./installer_files/env/lib/python3.8/site-packages (from requests<3) (2.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/pwein/.local/lib/python3.8/site-packages (from requests<3) (1.26.5)
Requirement already satisfied: certifi>=2017.4.17 in ./installer_files/env/lib/python3.8/site-packages (from requests<3) (2023.11.17)

$ micromamba run -p /home/pwein/Downloads/easy-diffusion/installer_files/env pip3 install requests\>=2.27.0
Collecting requests>=2.27.0
  Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Requirement already satisfied: charset-normalizer<4,>=2 in ./installer_files/env/lib/python3.8/site-packages (from requests>=2.27.0) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in ./installer_files/env/lib/python3.8/site-packages (from requests>=2.27.0) (2.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/pwein/.local/lib/python3.8/site-packages (from requests>=2.27.0) (1.26.5)
Requirement already satisfied: certifi>=2017.4.17 in ./installer_files/env/lib/python3.8/site-packages (from requests>=2.27.0) (2023.11.17)
Downloading requests-2.31.0-py3-none-any.whl (62 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB 2.0 MB/s eta 0:00:00
Installing collected packages: requests
  Attempting uninstall: requests
    Found existing installation: requests 2.25.1
    Uninstalling requests-2.25.1:
      Successfully uninstalled requests-2.25.1
Successfully installed requests-2.31.0

After that I could proceed with the setup procedure flawlessly:

$ ./start.sh

On my other Ubuntu 22.04 laptop it runs flawlessly through. Whysoever! This bug issue is just to show a way of resolving these depenedencies, cause I am not so an "expert python programmer". Hope it might help.

Honestly I have only a vague idea why I had run into these issues:

  • computer was updated from Ubuntu 20.04 to 22.04
  • maybe I made a mistake when setting up python3.7 and 3.10 and/or their virtualenvs

peddanet avatar Dec 01 '23 22:12 peddanet

@cmdr2 You might close it, if this was too special only to my configuration. Sorry for disturbing then ;D....

peddanet avatar Dec 01 '23 22:12 peddanet

It would be interesting to see the initial error message, before you changed the environment. Easy Diffusion comes with its own Python installation and should not be affected by your system's Python environment.

JeLuF avatar Dec 08 '23 10:12 JeLuF

Same issue with Ubuntu 22.04 - a little more info on where the chardet error is coming from (on mine at least) - the conda setup step is sourcing from my .local/lib/ python directories:

╰─$ ./start.sh 
/usr/bin/curl
/usr/bin/tar
/usr/bin/bzip2
Downloading micromamba from https://micro.mamba.pm/api/micromamba/linux-64/latest to /home/user/sw/easy-diffusion/installer_files/mamba/micromamba
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  4432    0  4432    0     0   3611      0 --:--:--  0:00:01 --:--:-- 18089
bin/micromamba
100 5375k  100 5375k    0     0  2594k      0  0:00:02  0:00:02 --:--:-- 15.9M
Micromamba version:
1.5.6
Empty environment created at prefix: /home/user/sw/easy-diffusion/installer_files/env
Packages to install: conda python=3.8.5
conda-forge/noarch                                  13.4MB @  11.8MB/s  1.2s
conda-forge/linux-64                                32.3MB @  18.6MB/s  1.8s

Transaction

  Prefix: /home/user/sw/easy-diffusion/installer_files/env

  Updating specs:

   - conda
   - python=3.8.5


  Package                     Version  Build               Channel          Size
──────────────────────────────────────────────────────────────────────────────────
  Install:
──────────────────────────────────────────────────────────────────────────────────

  + _libgcc_mutex                 0.1  conda_forge         conda-forge       3kB
  + libstdcxx-ng               13.2.0  h7e041cc_5          conda-forge       4MB
  + python_abi                    3.8  4_cp38              conda-forge       6kB
  + ld_impl_linux-64             2.40  h41732ed_0          conda-forge     705kB
  + ca-certificates          2024.2.2  hbcca054_0          conda-forge     155kB
  + libgomp                    13.2.0  h807b86a_5          conda-forge     420kB
  + _openmp_mutex                 4.5  2_gnu               conda-forge      24kB
  + libgcc-ng                  13.2.0  h807b86a_5          conda-forge     771kB
  + openssl                    1.1.1w  hd590300_0          conda-forge       2MB
  + libffi                      3.2.1  he1b5a44_1007       conda-forge      48kB
  + ncurses                       6.4  h59595ed_2          conda-forge     884kB
  + libzlib                    1.2.13  hd590300_5          conda-forge      62kB
  + xz                          5.2.6  h166bdaf_0          conda-forge     418kB
  + readline                      8.2  h8228510_1          conda-forge     281kB
  + zstd                        1.5.5  hfc55251_0          conda-forge     545kB
  + zlib                       1.2.13  hd590300_5          conda-forge      93kB
  + tk                         8.6.13  noxft_h4845f30_101  conda-forge       3MB
  + libsqlite                  3.44.2  h2797004_0          conda-forge     846kB
  + sqlite                     3.44.2  h2c6b66d_0          conda-forge     836kB
  + python                      3.8.5  h1103e12_9_cpython  conda-forge      23MB
  + wheel                      0.42.0  pyhd8ed1ab_0        conda-forge      58kB
  + setuptools                 69.0.3  pyhd8ed1ab_0        conda-forge     471kB
  + pip                          24.0  pyhd8ed1ab_0        conda-forge       1MB
  + pysocks                     1.7.1  pyha2e5f31_6        conda-forge      19kB
  + charset-normalizer          3.3.2  pyhd8ed1ab_0        conda-forge      47kB
  + idna                          3.6  pyhd8ed1ab_0        conda-forge      50kB
  + certifi                  2024.2.2  pyhd8ed1ab_0        conda-forge     161kB
  + colorama                    0.4.6  pyhd8ed1ab_0        conda-forge      25kB
  + pycparser                    2.21  pyhd8ed1ab_0        conda-forge     103kB
  + packaging                    23.2  pyhd8ed1ab_0        conda-forge      49kB
  + boltons                    23.1.1  pyhd8ed1ab_0        conda-forge     304kB
  + archspec                    0.2.2  pyhd8ed1ab_0        conda-forge      42kB
  + pluggy                      1.4.0  pyhd8ed1ab_0        conda-forge      23kB
  + tqdm                       4.66.1  pyhd8ed1ab_0        conda-forge      89kB
  + brotli-python               1.1.0  py38h17151c0_1      conda-forge     351kB
  + ruamel.yaml.clib            0.2.7  py38h01eb140_2      conda-forge     147kB
  + jsonpointer                   2.4  py38h578d9bd_3      conda-forge      16kB
  + pycosat                     0.6.6  py38h01eb140_0      conda-forge      85kB
  + cffi                       1.14.4  py38ha312104_0      conda-forge     231kB
  + ruamel.yaml               0.17.40  py38h01eb140_0      conda-forge     197kB
  + cryptography               39.0.0  py38h1724139_0      conda-forge       1MB
  + zstandard                  0.22.0  py38ha98ab4e_0      conda-forge     403kB
  + urllib3                     2.2.0  pyhd8ed1ab_0        conda-forge      95kB
  + jsonpatch                    1.33  pyhd8ed1ab_0        conda-forge      17kB
  + pyopenssl                  23.2.0  pyhd8ed1ab_1        conda-forge     129kB
  + conda-package-streaming     0.9.0  pyhd8ed1ab_0        conda-forge      19kB
  + requests                   2.31.0  pyhd8ed1ab_0        conda-forge      57kB
  + conda-package-handling      2.2.0  pyh38be061_0        conda-forge     255kB
  + conda                      23.9.0  py38h578d9bd_2      conda-forge     957kB

  Summary:

  Install: 49 packages

  Total download: 45MB

──────────────────────────────────────────────────────────────────────────────────



Transaction starting
python_abi                                           6.4kB @  60.3kB/s  0.1s
ca-certificates                                    155.4kB @   1.1MB/s  0.1s
_libgcc_mutex                                        2.6kB @  14.7kB/s  0.2s
ld_impl_linux-64                                   704.7kB @   3.9MB/s  0.2s
readline                                           281.5kB @   1.1MB/s  0.1s
ncurses                                            884.4kB @   2.8MB/s  0.2s
libstdcxx-ng                                         3.8MB @   9.4MB/s  0.4s
idna                                                50.1kB @ 117.6kB/s  0.1s
pip                                                  1.4MB @   3.1MB/s  0.2s
pycparser                                          102.7kB @ 210.1kB/s  0.1s
archspec                                            42.3kB @  82.9kB/s  0.1s
brotli-python                                      350.8kB @ 632.4kB/s  0.1s
pycosat                                             85.0kB @ 149.1kB/s  0.1s
requests                                            56.7kB @  86.0kB/s  0.1s
jsonpatch                                           17.4kB @  26.2kB/s  0.1s
tk                                                   3.3MB @   4.9MB/s  0.5s
cryptography                                         1.4MB @   1.9MB/s  0.2s
libgomp                                            419.8kB @ 544.4kB/s  0.1s
xz                                                 418.4kB @ 525.8kB/s  0.1s
setuptools                                         470.5kB @ 536.8kB/s  0.1s
openssl                                              2.0MB @   2.2MB/s  0.2s
certifi                                            160.6kB @ 175.4kB/s  0.1s
libsqlite                                          845.8kB @ 905.4kB/s  0.2s
boltons                                            304.2kB @ 318.3kB/s  0.1s
ruamel.yaml.clib                                   147.1kB @ 151.9kB/s  0.1s
ruamel.yaml                                        197.3kB @ 199.7kB/s  0.1s
pyopenssl                                          129.0kB @ 128.1kB/s  0.1s
libffi                                              48.0kB @  46.6kB/s  0.1s
conda                                              956.6kB @ 905.0kB/s  0.1s
zlib                                                92.8kB @  87.4kB/s  0.1s
pysocks                                             19.0kB @  17.8kB/s  0.1s
packaging                                           49.5kB @  45.5kB/s  0.1s
jsonpointer                                         16.1kB @  14.7kB/s  0.0s
urllib3                                             94.5kB @  84.5kB/s  0.1s
_openmp_mutex                                       23.6kB @  20.6kB/s  0.1s
zstd                                               545.2kB @ 473.4kB/s  0.1s
charset-normalizer                                  46.6kB @  40.2kB/s  0.1s
tqdm                                                89.4kB @  76.5kB/s  0.1s
libzlib                                             61.6kB @  51.1kB/s  0.1s
conda-package-streaming                             19.2kB @  15.9kB/s  0.1s
colorama                                            25.2kB @  20.7kB/s  0.1s
zstandard                                          402.9kB @ 326.4kB/s  0.1s
sqlite                                             836.4kB @ 649.3kB/s  0.1s
wheel                                               57.6kB @  44.4kB/s  0.1s
cffi                                               231.2kB @ 176.9kB/s  0.1s
libgcc-ng                                          770.5kB @ 569.4kB/s  0.1s
pluggy                                              23.4kB @  17.1kB/s  0.1s
conda-package-handling                             255.1kB @ 185.8kB/s  0.1s
python                                              23.0MB @  12.8MB/s  1.6s
Linking _libgcc_mutex-0.1-conda_forge
Linking libstdcxx-ng-13.2.0-h7e041cc_5
Linking python_abi-3.8-4_cp38
Linking ld_impl_linux-64-2.40-h41732ed_0
Linking ca-certificates-2024.2.2-hbcca054_0
Linking libgomp-13.2.0-h807b86a_5
Linking _openmp_mutex-4.5-2_gnu
Linking libgcc-ng-13.2.0-h807b86a_5
Linking openssl-1.1.1w-hd590300_0
Linking libffi-3.2.1-he1b5a44_1007
Linking ncurses-6.4-h59595ed_2
Linking libzlib-1.2.13-hd590300_5
Linking xz-5.2.6-h166bdaf_0
Linking readline-8.2-h8228510_1
Linking zstd-1.5.5-hfc55251_0
Linking zlib-1.2.13-hd590300_5
Linking tk-8.6.13-noxft_h4845f30_101
Linking libsqlite-3.44.2-h2797004_0
Linking sqlite-3.44.2-h2c6b66d_0
Linking python-3.8.5-h1103e12_9_cpython
Linking wheel-0.42.0-pyhd8ed1ab_0
Linking setuptools-69.0.3-pyhd8ed1ab_0
Linking pip-24.0-pyhd8ed1ab_0
Linking pysocks-1.7.1-pyha2e5f31_6
Linking charset-normalizer-3.3.2-pyhd8ed1ab_0
Linking idna-3.6-pyhd8ed1ab_0
Linking certifi-2024.2.2-pyhd8ed1ab_0
Linking colorama-0.4.6-pyhd8ed1ab_0
Linking pycparser-2.21-pyhd8ed1ab_0
Linking packaging-23.2-pyhd8ed1ab_0
Linking boltons-23.1.1-pyhd8ed1ab_0
Linking archspec-0.2.2-pyhd8ed1ab_0
Linking pluggy-1.4.0-pyhd8ed1ab_0
Linking tqdm-4.66.1-pyhd8ed1ab_0
Linking brotli-python-1.1.0-py38h17151c0_1
Linking ruamel.yaml.clib-0.2.7-py38h01eb140_2
Linking jsonpointer-2.4-py38h578d9bd_3
Linking pycosat-0.6.6-py38h01eb140_0
Linking cffi-1.14.4-py38ha312104_0
Linking ruamel.yaml-0.17.40-py38h01eb140_0
Linking cryptography-39.0.0-py38h1724139_0
Linking zstandard-0.22.0-py38ha98ab4e_0
Linking urllib3-2.2.0-pyhd8ed1ab_0
Linking jsonpatch-1.33-pyhd8ed1ab_0
Linking pyopenssl-23.2.0-pyhd8ed1ab_1
Linking conda-package-streaming-0.9.0-pyhd8ed1ab_0
Linking requests-2.31.0-pyhd8ed1ab_0
Linking conda-package-handling-2.2.0-pyh38be061_0
Linking conda-23.9.0-py38h578d9bd_2

Transaction finished

To activate this environment, use:

    micromamba activate /home/user/sw/easy-diffusion/installer_files/env

Or to execute a single command in this environment, use:

    micromamba run -p /home/user/sw/easy-diffusion/installer_files/env mycommand

/usr/bin/git
git version 2.34.1
/home/user/sw/easy-diffusion/installer_files/env/bin/conda
Traceback (most recent call last):
  File "/home/user/sw/easy-diffusion/installer_files/env/lib/python3.8/site-packages/conda/exception_handler.py", line 17, in __call__
    return func(*args, **kwargs)
  File "/home/user/sw/easy-diffusion/installer_files/env/lib/python3.8/site-packages/conda/cli/main.py", line 68, in main_subshell
    parser = generate_parser(add_help=True)
  File "/home/user/sw/easy-diffusion/installer_files/env/lib/python3.8/site-packages/conda/cli/conda_argparse.py", line 114, in generate_parser
    configure_parser_create(sub_parsers)
  File "/home/user/sw/easy-diffusion/installer_files/env/lib/python3.8/site-packages/conda/cli/conda_argparse.py", line 772, in configure_parser_create
    add_parser_solver(solver_mode_options)
  File "/home/user/sw/easy-diffusion/installer_files/env/lib/python3.8/site-packages/conda/cli/conda_argparse.py", line 1968, in add_parser_solver
    choices=context.plugin_manager.get_solvers(),
  File "/home/user/sw/easy-diffusion/installer_files/env/lib/python3.8/site-packages/conda/base/context.py", line 492, in plugin_manager
    from ..plugins.manager import get_plugin_manager
  File "/home/user/sw/easy-diffusion/installer_files/env/lib/python3.8/site-packages/conda/plugins/__init__.py", line 28, in <module>
    from .hookspec import hookimpl  # noqa: F401
  File "/home/user/sw/easy-diffusion/installer_files/env/lib/python3.8/site-packages/conda/plugins/hookspec.py", line 16, in <module>
    from .types import (
  File "/home/user/sw/easy-diffusion/installer_files/env/lib/python3.8/site-packages/conda/plugins/types.py", line 15, in <module>
    from requests.auth import AuthBase
  File "/home/user/.local/lib/python3.8/site-packages/requests/__init__.py", line 44, in <module>
    import chardet
ModuleNotFoundError: No module named 'chardet'

williamshowalter avatar Feb 07 '24 02:02 williamshowalter

Just to get around the headache I temporarily moved ~/.local/lib/python3.8 in my home directory and it was happy proceeding past conda (there were unresolvable conflicts in dependencies between my local pip --user files and what micromamba wanted so I couldn't do what @peddanet did).

williamshowalter avatar Feb 07 '24 02:02 williamshowalter