pip install pygtk not working - python

Any ideas as to what this means? I don't know if this helps, but it seems like most things I try to pip install don't install correctly and I get errors.
BenjaminsMacBook:~ OwlFace$ pip install pygtk
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: pip==1.4.1
BenjaminsMacBook:~ OwlFace$

pygtk install script can't find pip 1.4.1
you have to install pip 1.4.1

You can check my answer here. Basically, to fix it, run:
easy_install --upgrade pip

There's a Dependency of pip required version = 1.4.1,
$ which pip
/usr/local/bin/pip
if no output here probably you dont have pip installed
$ pip --version
pip 1.4.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
if your version is not 1.4.1, update pip
Your error shows that you have pip installed, so check the version
BenjaminsMacBook:~ OwlFace$ pip install pygtk
Traceback (most recent call last):
===> File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
For pip1.4.1 visit: https://pypi.python.org/pypi/pip/

Related

Can't install PyQt5 using pip

I have tried to install PyQt5 using
pip install PyQt5
and
sudo -H pip install PyQt5
both of them give me the errors
ERROR: Could not find a version that satisfies the requirement PyQt5 (from versions: none)
ERROR: No matching distribution found for PyQt5
I use Ubuntu 18.04.
My python version is: Python 2.7.15rc1
I have already installed python3-pip and tried to install PyQt5 using
pip3 install PyQt5
I get the error
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3241, in <module>
#_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3225, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 585, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==9.0.1' distribution was not found and is required by the application
My python3 version is: Python3.6.7.
You need to upgrade your pip
pip install --user --upgrade pip
Then do a fresh install
pip install PyQt5
or
pip3 install PyQt5
Try this:
python3 -m pip install PyQt5
I know it is a bit late to answer.
In PyCharm, even upgraded pip gives error in this package.
Downgraded the PyQt5 version to 5.12.2 works fine.
Use,
pip install PyQt5==5.12.2
pip install PyQtWebEngine==5.12
Or,
pip3 install PyQt5==5.12.2
pip3 install PyQtWebEngine==5.12
Works fine for me.
You can run command
pip3 install PyQt5
or for Python 2 you can manually install from https://www.riverbankcomputing.com/software/pyqt/download5

six cannot be imported/uninstalled/reinstalled/upgraded

I'm trying to run lldb on my MacBook terminal, but I get errors related to the six package:
File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 98, in <module>
import six
ImportError: No module named six
Traceback (most recent call last):
File "<string>", line 1, in <module>
I tried to launch python from terminal and then execute import six, but still:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named six
Next step was to uninstall and reinstall six, but it seems like everything related to this package is corrupted for me:
$: pip uninstall six
Uninstalling six:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info
Proceed (y/n)? y
Exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/uninstall.py", line 59, in run
requirement_set.uninstall(auto_confirm=options.yes)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 1035, in uninstall
req.uninstall(auto_confirm=auto_confirm)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 598, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 1836, in remove
renames(path, new_path)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/util.py", line 295, in renames
shutil.move(old, new)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/_c/lj7t1035563flfh7fy4m3gfh0000gn/T/pip-YQdNMp-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
Storing debug log for failure in /Users/lab5/.pip/pip.log
$: pip install --ignore-installed six
Downloading/unpacking six
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement six
Cleaning up...
No distributions at all found for six
Storing debug log for failure in /Users/lab5/.pip/pip.log
I downloaded six and installed it from the tar.gz file, but it still seems like the old version is installed:
$: pip install --ignore-installed ~/Downloads/six-1.5.1.tar.gz
Unpacking ./Downloads/six-1.5.1.tar.gz
Running setup.py (path:/var/folders/_c/lj7t1035563flfh7fy4m3gfh0000gn/T/pip-zqLhAa-build/setup.py) egg_info for package from file:///Users/lab5/Downloads/six-1.5.1.tar.gz
no previously-included directories found matching 'documentation/_build'
Installing collected packages: six
Running setup.py install for six
no previously-included directories found matching 'documentation/_build'
Successfully installed six
Cleaning up...
$: pip show six
---
Name: six
Version: 1.4.1
Location: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requires:
Python version: Python 2.7.15
Pip version: pip 1.5.6 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (python 2.7)
Do you have any recommendations for me how to get rid of those errors and run lldb properly? I took someone's suggestion to install python again (simply brew install python), but it was not helpful.
You are using python2, to use brew to install python2 you need to add #2
brew install python#2
I use the python2 installed with brew and was able to install six just fine. From your errors, it appears when you tried pip install six you got the OSError: [Errno 1] Operation not permitted:
Try running pip with sudo -H
sudo -H pip install six --upgrade
I'm still not sure what the reasons for the errors were, but I could get rid of them after upgrading my python version and I'm just fine with that.
To install a new python version:
brew install python
Then, I removed the link at /usr/local/bin/python and set it again to the new version:
rm /usr/local/bin/python
ln -s /usr/local/Cellar/python/3.7.0/bin/python3.7 /usr/local/bin/python
Then, installed six with the new version's pip:
python -m pip install six
(executing python -m enforces installing with the new pip, for the new python)
I'm not 100% cool with that solution, I still have to remove old versions to have a clean python installation, but at least I can work with lldb now, which was my main goal
Pointing to the correct Xcode installation using xcode-select -switch solved it for me.

Python pip package RequestsDependencyWarning when installing elastic-search-curator

I installed elastic search curator via the following command.
sudo pip install -U elasticsearch-curator
It all installed OK.
However now when I do the following
curator_cli --version
I get the following dependency warning.
/usr/local/lib/python2.7/dist-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
curator_cli, version 5.5.4
How do I either fix the warning or hide it?
So took a couple of things for me to get this working.
First I upgraded cyptography as per Mufeeds suggestion
sudo pip install --upgrade cryptography
This then gave me a new error everytime I did pip <any command>
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip._internal import main
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 42, in <module>
from pip._internal import cmdoptions
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cmdoptions.py", line 16, in <module>
from pip._internal.index import (
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 15, in <module>
from pip._vendor import html5lib, requests, six
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 86, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in <module>
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
Resolved this by resintalling PyOpenSSL
sudo python -m easy_install --upgrade pyOpenSSL
Curator is now working as expected without the warnings
curator_cli --version
> curator_cli, version 5.5.4
This 1st step below will update cryptography, but break pyopenssl.
sudo pip install --upgrade cryptography
We can fix that by removing the pyopennssl library and use pip to reinstall.
sudo rm -rf /usr/lib/python2.7/dist-packages/OpenSSL
sudo rm -rf /usr/lib/python2.7/dist-packages/pyOpenSSL-0.15.1.egg-info
sudo pip install pyopenssl --upgrade
sudo pip install cryptography --upgrade
The last line will produce an error if the open sll library were to still be broken, so this validates all should be well...
My preference is to avoid another package manage like easy install in the mix, so sharing this in case that is anyone else's preference as well.

Updating pip and setuptools in homebrew does not work

After brew install python, the following comes up:
Pip and setuptools have been installed. To update them
pip2 install --upgrade pip setuptools
Running pip2 install
pip2 install --upgrade pip setuptools
Traceback (most recent call last):
File "/usr/local/bin/pip2", line 11, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip2')()
File "/Users/user1/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 564, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/user1/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 2661, in load_entry_point
raise ImportError("Entry point %r not found" % ((group, name),))
ImportError: Entry point ('console_scripts', 'pip2') not found
I was running into this after upgrading from Python 2.7.13 to 2.7.14 using Homebrew. I used the suggestion found in this issue on GitHub: https://github.com/pyenv/pyenv/issues/739 and it worked for me. The actual command I ran was:
/usr/local/Cellar/python/2.7.14/bin/python2 -m pip install --upgrade --force-reinstall pip
Good luck.

Troubles installing mysqlclient with pip3

I'm trying to set up a python 3.6 environment with Django. The installation instructions say I should install mysqlclient to be able to connect to mySQL. I get this:
dennis#django:~$ sudo -H pip3 install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.10.tar.gz
Complete output from command python setup.py egg_info:
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-4jiw3hvk/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/tmp/pip-build-4jiw3hvk/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-build-4jiw3hvk/mysqlclient/setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-4jiw3hvk/mysqlclient/
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
mySQL is properly installed. What should be in the mysql_config file?
When I try to upgrade pip3 I get this:
dennis#django:~$ sudo -H pip3 install --upgrade pip3
Collecting pip3
Could not find a version that satisfies the requirement pip3 (from versions: )
No matching distribution found for pip3
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
After installing mysqlclient with pip3, I noticed that the module was installed in the python3.5 directory instead of in the python3.6 directory so when I tried to import the MySQLdb module running python3.6, it was not found
dennis#django:~/python_db$ python
Python 3.6.0+ (default, Feb 4 2017, 11:11:46)
[GCC 5.4.1 20161202] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'MySQLdb'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'MySQLdb'
>>>
I then reran using python 3.5 and it was found. How do I install modules using pip3 into the 3.6 directory?
If you're using Mac OS, try this:
brew install mysql
If you're using Ubuntu14/16, try this:
sudo apt install libmysqlclient-dev
and one more:
pip3 can be updated with sudo pip3 install -U pip
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient
In my case the issue was solved by doing the following:
sudo aptitude install libmysqlclient-dev
As I was using Python 3.x, the following was also necessary:
sudo aptitude install python3-dev
If you're running MAMP on OSX, do this:
export PATH=$PATH:/Applications/MAMP/Library/bin
In Debian Stretch the required package name seems to have changed to default-libmysqlclient-dev
https://packages.debian.org/stretch/default-libmysqlclient-dev
you can try this to install mysql to a particular python directory, for example w/ python 3.6
sudo python3.6 /usr/bin/pip3 install mysqlclient
Looking over this old question (while looking for something else), I observe that the problem could be that the directory containing mysql_config was not in the current $PATH. Apparently that's what the install script uses to try to find it. It's possible for "mysql to be installed," but not on the $PATH – or for the $PATH to refer to the wrong version.

Categories

Resources