Score:1

Python 3.8 + Pip on WSL

to flag

I've being looking around on the internet and either nobody else has this problem, or nobody else can solve it. I used the deadsnake repository to use Python 3.8, which seems to work, but when I try to get pip it starts complaining about not having distutils.cmd. This is WSL Ubuntu 22.04. There shouldn't be a *.cmd anything.

Online everybody who claims to know tells me use apt install python3-pip. This just installs python3.10 even though the article was about getting python3.8. Everywhere I look specifically for how to do it on WSL, they either don't tell me anything different, or they leave pip out.

Here is the main article I was following: https://www.linuxcapable.com/install-python-3-8-on-ubuntu-linux/#:~:text=Install%20Python%20PIP%20with%203.8%20on%20Ubuntu%20Linux,the%20following%20APT%20command.%20sudo%20apt%20install%20python3-pip

Does anyone know a way to fix this?

EDIT: Here's the error message.

Traceback (most recent call last):
  File "get-pip.py", line 32267, in <module>
    main()
  File "get-pip.py", line 135, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 111, in bootstrap
    monkeypatch_for_cert(tmpdir)
  File "get-pip.py", line 92, in monkeypatch_for_cert
    from pip._internal.commands.install import InstallCommand
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp4nc0p6x0/pip.zip/pip/_internal/commands/__init__.py", line 9, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp4nc0p6x0/pip.zip/pip/_internal/cli/base_command.py", line 15, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp4nc0p6x0/pip.zip/pip/_internal/cli/cmdoptions.py", line 24, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp4nc0p6x0/pip.zip/pip/_internal/cli/parser.py", line 12, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp4nc0p6x0/pip.zip/pip/_internal/configuration.py", line 26, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp4nc0p6x0/pip.zip/pip/_internal/utils/logging.py", line 29, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp4nc0p6x0/pip.zip/pip/_internal/utils/misc.py", line 43, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp4nc0p6x0/pip.zip/pip/_internal/locations/__init__.py", line 66, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmp4nc0p6x0/pip.zip/pip/_internal/locations/_distutils.py", line 20, in <module>
ModuleNotFoundError: No module named 'distutils.cmd'
Saxtheowl avatar
iq flag
yes, It look like an error Python 3.8 on your WSL
Score:1
iq flag

Here how you could fix your problem and install Python 3.8 for WSL:

go to WSL and your terminal do sudo apt remove python3.8 python3.8-minimal python3.8-dev python3-pip then sudo apt install build-essential then we install python

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.8 python3.8-dev

then get-pip for your python

wget https://bootstrap.pypa.io/get-pip.py

then pip

sudo python3.8 get-pip.py

If you are missing the distutils here is how to fix it:

sudo apt-get install build-essential
sudo apt-get install python3.8-distutils

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

then again:

sudo python3.8 get-pip.py
dboggs95 avatar
to flag
I tried this. It's very close to the procedure I already tried. It gave me the same error as before. I'll add it to my post.
Saxtheowl avatar
iq flag
I edited my post with a solution to your error
dboggs95 avatar
to flag
Thanks. I saw a GitHub issue that kind of pointed to that being the issue. I'll try it later today, and if it works, I'll mark this as the answer.
dboggs95 avatar
to flag
I tested your exact procedure, and it installs all the required packages for pip to work. I also found the same thing can also be accomplished by running sudo apt install python3.8-full, which installs much more, but I'm trying to experiment with AI and it seems like I need a million things to make anything work, so if I don't it'll probably complain later about not having things. Besides, drive space isn't an issue, so no point in being stingy with it.
Saxtheowl avatar
iq flag
Having lots of package even the not needed one is not a real problem if you want to experiment, and you can do a fresh install without them later if you want
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.