everybody.
Firstly,my OS is RHEL7.2,and I use python3.5.
I want to use pip to do something I want.And then ,after I install pip3 successfully,I want to use pip to install something,but it shows me ImportError: cannot import name 'HTTPSHandler'.And I follow the solution on website to yum install openssl-devel,but it shows the error :
Transaction check error:
file /usr/bin/sclient from install of krb5-devel-1.13.2-10.el7.x86_64 conflicts with file from package krb5-server-1.13.2-10.el7.x86_64
file /usr/sbin/sserver from install of krb5-devel-1.13.2-10.el7.x86_64 conflicts with file from package krb5-server-1.13.2-10.el7.x86_64
I can't solve it independently.I hope you can help me.Thanks.
PS:the whole error message is:
[fen#localhost Downloads]$ pip pip-8.0.2-py2.py3-none-any.whl install
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==8.1.1', 'console_scripts', 'pip')()
File "/usr/local/python3.5/lib/python3.5/site-packages/setuptools-20.3.1-py3.5.egg/pkg_resources/__init__.py", line 549, in load_entry_point
File "/usr/local/python3.5/lib/python3.5/site-packages/setuptools-20.3.1-py3.5.egg/pkg_resources/__init__.py", line 2542, in load_entry_point
File "/usr/local/python3.5/lib/python3.5/site-packages/setuptools-20.3.1-py3.5.egg/pkg_resources/__init__.py", line 2202, in load
File "/usr/local/python3.5/lib/python3.5/site-packages/setuptools-20.3.1-py3.5.egg/pkg_resources/__init__.py", line 2208, in resolve
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-8.1.1-py3.5.egg/pip/__init__.py", line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-8.1.1-py3.5.egg/pip/vcs/subversion.py", line 9, in <module>
from pip.index import Link
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-8.1.1-py3.5.egg/pip/index.py", line 30, in <module>
from pip.wheel import Wheel, wheel_ext
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-8.1.1-py3.5.egg/pip/wheel.py", line 39, in <module>
from pip._vendor.distlib.scripts import ScriptMaker
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-8.1.1-py3.5.egg/pip/_vendor/distlib/scripts.py", line 14, in <module>
from .compat import sysconfig, detect_encoding, ZipFile
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-8.1.1-py3.5.egg/pip/_vendor/distlib/compat.py", line 66, in <module>
from urllib.request import (urlopen, urlretrieve, Request, url2pathname,
ImportError: cannot import name 'HTTPSHandler'
I solved my problem.
I have so many repositories and some data in one repository conflict with another. So I follow the first suggestion: I reinstall krb5-server, and then I yum install openssl-devel and it works well.
After I solve the first problem, I use pip unsuccessfully and I follow the second suggestion: I recompile the python3.5 and the problem is solved.
First check wheather install openssl-develop
sudo apt-get install libssl-dev
or
yum install openssl-dev -y
Try another way to reinstall pip3 ,take Ubuntu for example
sudo apt-get install python3-setuptools
sudo easy_install3 pip
use setuptools to install pip may can solve the problem of dependency.
Try it on RHEL
sudo yum install -y python35-setuptools
sudo easy_install-3.5 pip
Related
$ sudo easy_install pip ( on mac high sierra)
Traceback (most recent call last):
File "/usr/bin/easy_install-2.7", line 11, in <module>
load_entry_point('setuptools==18.5', 'console_scripts', 'easy_install')()
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 484, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2707, in load_entry_point
return ep.load()
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2325, in load
return self.resolve()
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2331, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 46, in <module>
from setuptools.archive_util import unpack_archive
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/archive_util.py", line 15, in <module>
from pkg_resources import ensure_directory, ContextualZipFile
ImportError: cannot import name ContextualZipFile
$ which python
/usr/bin/python
$ which pip
/usr/local/bin/pip
$ which python3
/usr/local/bin/python3
You should try firstly installing pip by using these commands:
sudo apt update
sudo apt install python3-pip
If you are installing it for python2:
sudo apt update
sudo apt install python-pip
Then you can verify the version using:
pip3 --version
Hope this helps.
Here you are having two versions of python installed on your mac.
First is the Python 2.x (which is default) and Python 3.x.
This is a problem I too faced a lot earlier, so what I suggest is this
$sudo apt install python3-pip
This will explicitly install the pip for Python 3.x
And once completed use a virtual environment.
everytime i run this i face this problem
> sudo pip install pyperclip
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
File "/home/ot/.local/lib/python2.7/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/home/ot/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 22, in <module>
from pip.compat import console_to_str, expanduser, stdlib_pkgs
ImportError: No module named compat
ps: im using python 2.7 and this has been happening to me while trying to download other few packages as well
I'm on ubuntu 16.04
Thank you
problem solved i used these 2 lines :
sudo apt-get update
sudo apt-get install python-pyperclip
I'm on Lubuntu (a minimal build of Ubuntu). I installed Python 3.6.1 with:
sudo apt-get install python3.6
I want to use Twilio, so I tried this:
pip install twilio
It said pip wasn't recognized, so I ran this, followed by the above again:
sudo apt install python-pip
I fired up Python 3.6 and tried importing it, but that didn't work out:
>>> from twilio.rest import Client
ModuleNotFoundError: No module named 'twilio'
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 24, 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'
I'm new to python3 (which I want to use for the secrets module), Ubuntu, and twilio, so I'm not really sure what's going on here. I'd think if it was as simple as a module not being found, the stack trace would be much shorter... I'm not sure if the stack trace is so long because maybe Python 3 produces longer ones than 2 did, or Ubuntu is trying to do something weird because both Python 2 and 3 are installed (and perhaps two versions of 3 at that), or if maybe this is the work of twilio?
Try the following to download pip:
wget https://bootstrap.pypa.io/get-pip.py
Then install pip by running:
sudo python3 get-pip.py
Then you can install twilio with pip
sudo pip3 install twilio
I tried to install from pip and keep on getting similar type of errors.
$ pip install quandl
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/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2361, 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 53, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 53, in <module>
import OpenSSL.SSL
File "/home/ubuntu/.local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/home/ubuntu/.local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 112, in <module>
if _lib.Cryptography_HAS_SSL_ST:
AttributeError: 'module' object has no attribute 'Cryptography_HAS_SSL_ST'
Now even though i tried to install different pip modules iam getting same error.Is there any solution for this ? This was caused due to the unexpected killing of the process while a pip module is being downloaded.
Please help me with the necessary steps to rectify this error.
I tried to install this
$ pip install -U 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/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2361, 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 53, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 53, in <module>
import OpenSSL.SSL
File "/home/ubuntu/.local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/home/ubuntu/.local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 112, in <module>
if _lib.Cryptography_HAS_SSL_ST:
AttributeError: 'module' object has no attribute 'Cryptography_HAS_SSL_ST'
Ubuntu 16.04.3 here:
I think I have fixed this by removing the python-openssl package (and it's dependencies) with:
apt-get --auto-remove remove python-openssl
Then installing the latest version with pip:
pip install pyOpenSSL
Of course, if you install another apt package that depends on it, it'll pull it back in. I hope if you use pip for everything you can from now on instead of apt, it should be fine.
Edit: as of January 2019 this issue doesn't seem to exist any more.
I was able to resolve this by deleting the openssl python lib and reinstalling (purge before install did not work):
$ sudo rm -rf /usr/local/lib/python2.7/dist-packages/OpenSSL/
$ sudo apt install --reinstall python-openssl
If even pip is not working then try following:
sudo easy_install -U cffi
sudo easy_install -U cryptography
It works for me.
To fix it on RHEL/CentOS:
sudo rm -rf /usr/lib/python2.7/site-packages/OpenSSL/
sudo yum install pyOpenSSL
This did it for me on CentOS 7. Cheers!
I got this error and solved it by doing these steps (don't forget to put your own username):
rm -rf /home/<Your Username>/.local/lib/python2.7/site-packages/OpenSSL
sudo rm -rf usr/local/lib/python2.7/dist-packages/OpenSSL/
pip install pyOpenSSL
Try to do the following:
$ rm -rf /home/ubuntu/.local/lib/python2.7/site-packages/OpenSSL
$ rm -rf /home/ubuntu/.local/lib/python2.7/site-packages/pyOpenSSL-0.15.1.egg-info
In the last line, you might have another version of pyOpenSSL, specify yours.
Quick Fix
Move the OpenSSL folder to OpenSSLBAK (for instance) to avoid the error
# cd /usr/lib/python2.7/dist-packages
# mv OpenSSL OpenSSLBAK
It should be good
Try reinstalling python of which will fix many of your problems,do
sudo apt-get install --reinstall python2.7
and pip will be missing after reinstalling,do
sudo apt-get install python-pip
Try to download the suitable wheel file from here depending in your operating system and python version. Then add this file to Python/Scripts and use the code below to install it.
pip install nameofwheelfile.whl
The wheel file contains all the dependencies.
I am having a problem with pip just now, when I try to install something like pip install readline then I get an error:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 549, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2709, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2369, in load
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2375, in resolve
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 25, in <module>
from requests.compat import IncompleteRead
ImportError: cannot import name IncompleteRead
So I ran cat /usr/local/bin/pip which tells me pip==1.5.6. I tried to find a solution online regarding this and one solution told to cd /usr/local/lib/python2.7/site-packages && ls but for me I see that folder is also empty.
If upgrading pip doesn't work, you should try uninstalling it and reinstalling it. The error you're encountering is likely due to a mismatch in versions between pip and requests. First, I would remove pip and reinstall it from the source with python like this:
sudo apt-get remove python-pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
From the Ubuntu launchpad site
Just check If You have installed python-setuptools rpm, If this is installed You can use easy_install pip on Redhat Based System.
I would comment this but due to low reputation I can't. Did you try upgrading pip?
pip install --upgrade pip
And then try to do that again.
If you are using Debian flavor OS (like Ubuntu) try this
apt-get remove python-pip
Then try to install the latest version by easy_install
easy_install pip