Not being able to install pip in WSL - python

I recently installed python3 and I had tons of problems so decided to delete my wsl and reinstall everything since I didn't have important stuff there.
I installed python 3.10 and apparently pip but when I try to use pip to install something or just to use list I'm getting this:
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==20.0.2', 'console_scripts', 'pip')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 19, in <module>
from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils.util'
I'm not really sure how to fix it. I've tried a few things already

Related

Spyder cannot launch: pyzmq

Upon launching spyder 3.3.6, I receive the following error:
Traceback (most recent call last):
File "/usr/bin/spyder", line 11, in <module>
load_entry_point('spyder==3.3.6', 'gui_scripts', 'spyder3')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 473, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2447, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2453, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/spyder/app/start.py", line 14, in <module>
import zmq
File "/usr/lib/python3/dist-packages/zmq/__init__.py", line 55, in <module>
from zmq import backend
File "/usr/lib/python3/dist-packages/zmq/backend/__init__.py", line 40, in <module>
reraise(*exc_info)
File "/usr/lib/python3/dist-packages/zmq/utils/sixcerpt.py", line 34, in reraise
raise value
File "/usr/lib/python3/dist-packages/zmq/backend/__init__.py", line 27, in <module>
_ns = select_backend(first)
File "/usr/lib/python3/dist-packages/zmq/backend/select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "/usr/lib/python3/dist-packages/zmq/backend/cython/__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython' (most likely due to a circular import) (/usr/lib/python3/dist-packages/zmq/backend/cython/__init__.py)
Version of pyzmq is 20.0.0. Using pip, I've tried to update, uninstall-reinstall, and downgrade it to 19.0.2, but nothing helped. I'm using Debian testing, it's up to date.
Any ideas?

Archlinux:pip: ImportError: cannot import name 'requests'

Some of my python packages installed with pip had conflicts with another package I tried installing using pacman. So I decided to uninstall all the packages installed with pip. I made a requirements.txt file with all the packages and started uninstalling them. It worked fine for a while but eventually gave this error:
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==10.0.1', 'console_scripts', 'pip')()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 479, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2703, in load_entry_point
return ep.load()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2321, in load
return self.resolve()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2327, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
from pip._internal import cmdoptions
File "/usr/lib/python3.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
from pip._internal.index import (
File "/usr/lib/python3.6/site-packages/pip/_internal/index.py", line 15, in <module>
from pip._vendor import html5lib, requests, six
ImportError: cannot import name 'requests'
I got a similar error everytime I tried running pip after that.

Cannot use Easy_install to Install Pip

Having problems installing pip and other environment things for OSX. Going through different guides on SE (including these link, link), and everyone's solution seems to be to uninstall pip, and then install with easy_install. Problem is, easy_install gives this error:
Traceback (most recent call last):
File "/usr/local/opt/python/libexec/bin/easy_install", line 11, in <module>
load_entry_point('setuptools==36.5.0', 'console_scripts', 'easy_install-2.7')()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 570, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2755, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2409, in load
return self.resolve()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2415, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py", line 10, in <module>
from setuptools.extern.six.moves import filter, map
File "/usr/local/lib/python2.7/site-packages/setuptools/setuptools/__init__.py", line 160, in <module>
monkey.patch_all()
File "/usr/local/lib/python2.7/site-packages/setuptools/setuptools/monkey.py", line 67, in patch_all
distutils.core.Command = setuptools.Command
AttributeError: 'module' object has no attribute 'Command'
What's my next step? I'm trying to uninstall pip and reinstall it because pip itself was giving this same error.

Pip disabled after trying to upgrade Openssl

I've been trying to use tweepy which requieres pyOpenssl, but after trying to upgrade Openssl I'm getting this error which actually disable my pip for any package
$ pip install cryptography
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2598, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2258, in load
return self.resolve()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2264, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 22, in <module>
import requests, six
File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 68, in <module>
_attach_namespace(urllib3, 'requests.packages')
File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 63, in _attach_namespace
module = __import__(name)
File "/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 55, in <module>
import OpenSSL.SSL
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 112, in <module>
if _lib.Cryptography_HAS_SSL_ST:
AttributeError: 'FFILibrary' object has no attribute 'Cryptography_HAS_SSL_ST'
Now, as I said, I can't install anything since this error keeps apearing. I already tried to follow the recomendation on the following link but without any success
How to install cryptography on ubuntu?
The version of python is 2.7 and linux is debian
Thanks

Pip doesn't work on Mac OS X / ImportError: No module named utils

I can't get pip to work on OS X. I've tried everything I could find here, installing, removing, reinstalling python, etc. but nothing works. I keep getting the following error message:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==8.1.1', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 357, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2394, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2108, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/__init__.py", line 14, in <module>
from pip.utils import get_installed_distributions, get_prog
ImportError: No module named utils

Categories