Install problems with homebrew's python - python

Setting up a new mac here. I just installed python with brew install python, but when I try to install virtualenv with sudo pip install virtualenv it returns sudo: pip: command not found.
When I try sudo easy_install pip it returns the following response
Traceback (most recent call last):
File "/usr/local/bin/easy_install", line 11, in <module>
load_entry_point('setuptools==33.1.1', 'console_scripts', 'easy_install')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 565, 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/__init__.py", line 2697, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2370, in load
return self.resolve()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2376, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "build/bdist.macosx-10.12-intel/egg/setuptools/__init__.py", line 10, in <module>
File "build/bdist.macosx-10.12-intel/egg/setuptools/extern/__init__.py", line 1, in <module>
ImportError: No module named extern
I can't imagine what is happening, but with my old installation I had any of this problems. Any help woul be really helpful…

I update this question to post a possible solution:
curl https://bootstrap.pypa.io/get-pip.py | sudo python

Related

python Tor nyx ModuleNotFoundError: No module named 'distutils.pawn' at Ubuntu 18.04

File "/usr/bin/nyx", line 11, in <module>
load_entry_point('nyx==2.0.4', 'console_scripts', 'nyx')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 480, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2693, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2324, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2330, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/nyx/__init__.py", line 46, in <module>
import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
i tried to execute "nyx" command. I use ubuntu 18.04 in my Secure shell.
Did you install venv on your system?
If not, try the following:
sudo apt install python3.x-venv
x represents the version number. If using Python 3.11, the command will look as follows:
sudo apt install python3.11-venv

Error Installing "psycopg2" python module for creating connection to PostgreSQL via Python 2.7 on macOS

also tried installing psycopg2-binary as well but same error (not sure what am I missing here, new to PostgreSQL and PyCharm)
pip install psycopg2
pip install psycopg2-binary
Error message
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==7.1.0', 'console_scripts', 'pip')()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 558, 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 2682, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2365, in resolve
raise ImportError(str(exc))
ImportError: 'module' object has no attribute 'main'
first of all run easy_install --upgrade pip command to upgrade your pip.
then type and run this
from pip._internal import main
main(['install', 'psycopg2'])
After that run this
main(['install', 'psycopg2-binary'])

Pip error -> ImportError: No module named helpers

When I'm trying to install any package using pip it gives an error. It shows "ImportError: No module named helpers". I tried installing the helpers module using pip but the same error occurred. I'm pasting the output of the error message. Operating System: Arch Linux.
pip2 install requests
Error:
Traceback (most recent call last):
File "/usr/bin/pip2", line 11, in <module>
load_entry_point('pip==18.1', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2411, in load
return self.resolve()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2417, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python2.7/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/cmdoptions.py", line 22, in <module>
from pip._internal.utils.ui import BAR_TYPES
File "/usr/lib/python2.7/site-packages/pip/_internal/utils/ui.py", line 15, in <module>
from pip._vendor.progress.helpers import HIDE_CURSOR, SHOW_CURSOR, WritelnMixin
ImportError: No module named helpers
Thanks for everyone's help. I found out the solution. When I upgraded to python 3.7 pip was broken.
Executing these commands solved the issue.
rm -rf /usr/lib/python3.7/site-packages
python3.7 -m ensurepip
pip install --upgrade pip
Same can be used with Python2 as well, just replacing 3.7 with 2.7 and pip with pip2.

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.

getting a traceback error when installing boto using pip

[root#ip-172-31-34-8 ec2-user]# sudo pip install -U boto
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3020, in <module>
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 616, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 629, in _build_from_requirements
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 807, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==6.1.1
If you are installing on a fresh EC2 machine, which I guess from the first line of your code, you may not have pip installed.
For recent versions of AWS Linux AMI, you may use easy_install instead:
sudo easy_install pip
And then:
sudo easy_install boto3
Or:
sudo pip install boto3

Categories