Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup script fails on Arch Linux: ModuleNotFoundError: No module named 'pkg_resources' #3050

Open
wonder75 opened this issue Jan 15, 2025 · 7 comments

Comments

@wonder75
Copy link

wonder75 commented Jan 15, 2025

This is what I get when trying to run the setup script on a current Arch linux:

> ~/opt/kohya_ss/kohya_ss -> ./setup.sh 
Skipping git operations.
Arch Linux or Arch base detected.
Python TK found...
Switching to virtual Python environment.
Traceback (most recent call last):
  File "/home/ben/opt/kohya_ss/kohya_ss/setup/setup_linux.py", line 3, in <module>
    import setup_common
  File "/home/ben/opt/kohya_ss/kohya_ss/setup/setup_common.py", line 8, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
Exiting Python virtual environment.
Setup finished! Run ./gui.sh to start.
Please note if you'd like to expose your public server you need to run ./gui.sh --share

Any advice on what to do? Thank you!

@vszalai
Copy link

vszalai commented Jan 15, 2025

Are you using python version higher than 3.10.9 but lower than 3.11.0 in the venv?

@wonder75
Copy link
Author

Hey,

I am not sure. How would I configure what python version is being used in the venv?

Default Python version on the system is 3.13.1
But I also installed 3.10.16-1 from here:
https://aur.archlinux.org/packages?O=0&SeB=nd&K=python+3.10&outdated=&SB=p&SO=d&PP=50&submit=Go

I have this in /usr/bin:

[root@ben bin]# ls -la | grep python
-rwxr-xr-x  1 root root           5346 21. Nov 14:34 activate-global-python-argcomplete
-rwxr-xr-x  1 root root          14480 19. Dez 15:44 grpc_python_plugin
lrwxrwxrwx  1 root root             53 20. Nov 10:43 lirc-setup -> ../lib/python3.13/site-packages/lirc-setup/lirc-setup
lrwxrwxrwx  1 root root              7  4. Dez 19:05 python -> python3
lrwxrwxrwx  1 root root             10  4. Dez 19:05 python3 -> python3.13
-rwxr-xr-x  1 root root          14208 17. Jan 03:15 python3.10
-rwxr-xr-x  1 root root           3234 17. Jan 03:15 python3.10-config
-rwxr-xr-x  1 root root          14384  4. Dez 19:05 python3.13
-rwxr-xr-x  1 root root           3446  4. Dez 19:05 python3.13-config
lrwxrwxrwx  1 root root             17  4. Dez 19:05 python3-config -> python3.13-config
-rwxr-xr-x  1 root root           2604 21. Nov 14:34 python-argcomplete-check-easy-install-script
lrwxrwxrwx  1 root root             14  4. Dez 19:05 python-config -> python3-config
-rwxr-xr-x  1 root root           1992 21. Nov 14:34 register-python-argcomplete

Maybe setup.sh is not using 3.10 for the venv? How would I configure that?
Sadly I have no idea how python works behind the curtains.

@b-fission
Copy link
Contributor

pkg_resources is part of python's setuptools package. Are you able to install through pip, specifically for python3.10 and not your system's python3.13?

@wonder75
Copy link
Author

Sorry I have no idea about the inner workings of python. I am lost here. Could you provide instructions on how to install the required packages? I have python-pip and python-env installed. Some tutorial suggested it. But I can't make it work.

@b-fission
Copy link
Contributor

I'm going to suggest using miniconda since it avoids having to compile from source packages.

Refer to the install instructions for Miniconda here but basically, this...

mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.sh

Side note: The above commands will make a directory called miniconda3 in your home dir, which is where conda's python packages will reside. If you don't know what you're doing, do not remove/relocate miniconda3 since that may break the install.

Now set up conda environment with python 3.10

source ~/miniconda3/bin/activate
conda create -n py310 python=3.10.16
conda activate py310

And do the setup for kohya_ss as usual. I recommend deleting the existing venv if you have one present.

cd kohya_ss
rm -fr venv
./setup.sh

If that all works out, start the GUI.

./gui.sh

I believe there will be additional things to set up, but see if you can get the web GUI to run.

@wonder75
Copy link
Author

Thank you very much! I will try that out and report back.

@wonder75
Copy link
Author

This worked! I was able to reach the GUI. Did not have time to train yet. Thank you very much for your help. I guess this will help a lot of people on Arch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants