I am trying to install paramiko using pip. It shows the following long list of error messages after installation. The message here Details here.
Running pip freeze show the paramiko package on the installation list but it is not working.
Trying to run a simple paramiko program shows following error again
Traceback (most recent call last):
File "paramikoBasic.py", line 1, in <module>
import paramiko
File "/home/tara/taraproject/scripttest/paramiko_test/myenv/local/lib/python2.7/site-packages/paramiko/__init__.py", line 30, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/home/tara/taraproject/scripttest/paramiko_test/myenv/local/lib/python2.7/site-packages/paramiko/transport.py", line 33, in <module>
from cryptography.hazmat.backends import default_backend
ImportError: No module named cryptography.hazmat.backendsled
I even tried to install cryptography separately but that even didn't solve the problem. Installed libffi too but that also didn't work out.
I am guessing you are using ubuntu since it's a common problem
The cffi module is dependent on libffi and libffi-dev.
If you search for current version using
apt-cache search libffi
you should be able to get latest version.
Currently you can install as
sudo apt-get install libffi6 libffi-dev
Also you need to install python-dev and crypto packages as logs indicates.
Credit: https://gist.github.com/tchalvak/a230f8b759875748240d
Cheers
Related
While installing the socketio package for python using pip3 install socketio, I got the following results:
ERROR: launchpadlib 1.10.13 requires testresources, which is not installed.
WARNING: The scripts easy_install and easy_install-3.8 are installed in '/home/bill/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed netifaces-0.10.6 setuptools-3.3 socketio-0.2.1
Although I was able to import socketio successfully, pip3 seems corrupted(?).
Specifically, when trying to run anything including pip3, even pip3 by itself in the terminal, I get the same error:
Traceback (most recent call last):
File "/usr/bin/pip3", line 6, in <module>
from pkg_resources import load_entry_point
File "/home/<username>/.local/lib/python3.8/site-packages/pkg_resources.py", line 1479, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 144, in apport_excepthook
with os.fdopen(os.open(pr_filename,
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_bin_pip3.1000.crash'
Original exception was:
Traceback (most recent call last):
File "/usr/bin/pip3", line 6, in <module>
from pkg_resources import load_entry_point
File "/home/<username>/.local/lib/python3.8/site-packages/pkg_resources.py", line 1479, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
I tried reinstalling pip3 but it didn't help. I migrated from ubuntu to mint thinking it is something buggy with the distribution but same results. I also corrupted ubuntu when I tried to remove python and reinstall it since I couldn't use pip, but, you know what they say, live and learn.
Edit: Nothing on using pip3: module "importlib._bootstrap" has no attribute "SourceFileLoader" works for me.
I am currently using linux mint 20, but I experienced the same problem on ubuntu 20.04 and 20.04.1.
Any ideas would be appreciated!
Perhaps you meant this socketio instead?: https://pypi.org/project/python-socketio
python3 -m pip install python-socketio
The package literally named "socketio" seems like it may simply be old and unsupported1, while "python-socketio" seems alive and developed 2 3
To that end, it's often valuable to take a look at similar packages and also to watch out for typosquatting et al. when installing packages via pip!
Edit: Martijn Peters makes a good point that this is the socketio you are looking for: https://pypi.org/project/python-socketio
Read on if you need a solution for the original one you posted about.
Summary: pip3 install git+https://github.com/allenmcgehee/socketio-0.2.1-patched
I was able to reproduce this in a docker container running ubuntu:20.04 exactly as you described which gave me some hope that I could help out.
I found that socketio had a dependency for setuptools==3.3 which seemed odd to me, but lines up with why the core functionality of pip was breaking after installing socketio.
I am not sure where this package is maintained as there is no git repo referenced. I did find a Russion website in the PKG-INFO, but I wasn't sure where to go from there...
Here is a version of socketio with a requirement of setuptools>=42 so that nothing gets broken: https://github.com/allenmcgehee/socketio-0.2.1-patched
And finally, here is the single command that should install socketio for you without breaking pip:
pip3 install git+https://github.com/allenmcgehee/socketio-0.2.1-patched
**I am assuming you've already fixed pip.
This happened to me with a different module. My solution was to down-grade the version of pip and the version of the module. So, for you the answer would be to run:
python -m pip install pip== (previous version of your pip)
python -m pip uninstall socketio
python -m pip install socketio==0.2.0
I have Python 2.7.9 with azure-2.0.0rc4 and msrest-0.4.0. My code failed to import from msrest.authentication. I checked the two files from azure and msrest packages, and could not find any issues.
Appreciate any advice and direction.
John
Traceback (most recent call last):
File "getCredential.py", line 1, in <module>
from azure.common.credentials import ServicePrincipalCredentials
File "/usr/local/lib/python2.7/site-packages/azure/common/credentials.py", line 25, in <module>
raise ImportError("You need to install 'msrest' to use this feature")
ImportError: You need to install 'msrest' to use this feature
This seems to be a bug with the pip install --pre azure.
Running this command afterwards installs the necessary packages:
pip install msrestazure
I found the issue. When I sudo pip install, read permission was not set for the others group. Once I fixed that, the issue went away.
I'm getting this error when I try to install pip2.7.
I have python 2.7 as my default already, but I'm not sure why I'm getting this.
OS: CentOS 6.5
OpenSSL has been installed already.
I followed this guide to install Python 2.7:
http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/
[root#myservername arandomfolder]# python get-pip.py
Traceback (most recent call last):
File "get-pip.py", line 17474, in <module>
main()
File "get-pip.py", line 17466, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 17406, in bootstrap
import pip
File "/tmp/tmpXq2wUP/pip.zip/pip/__init__.py", line 10, in <module>
File "/tmp/tmpXq2wUP/pip.zip/pip/util.py", line 18, in <module>
File "/tmp/tmpXq2wUP/pip.zip/pip/_vendor/distlib/version.py", line 14, in <module>
File "/tmp/tmpXq2wUP/pip.zip/pip/_vendor/distlib/compat.py", line 31, in <module>
ImportError: cannot import name HTTPSHandler
You have a Python without SSL support compiled. Unfortunately, get-pip appears to require SSL support.
If you are using a Linux distribution, make sure OpenSSL is installed, including the headers when compiling Python from source.
So looks like i was missing the openssl-devel dependency
after I had installed that, i was able to install this.
I was having this issue on a Centos 6.5 machine even though I had openssl and openssl-devel installed. I was also using the steps from the site:
http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/
I removed python packages I had installed before: virtualenv, NetworkX, and pil:
pip uninstall virtualenv
pip uninstall NetworkX
pip uninstall pil
Then I compiled Python 2.7 again and no longer had this issue. After I followed the steps in the link below, I reinstalled the above packages using pip2.7:
pip2.7 install virtualenv
pip2.7 install NetworkX
pip2.7 install pil --allow-external pil --allow-unverified pil
I have meet the same problem. I solved it by install openssl-devel and reconfigure, make, make install python3:
yum install openssl-devel
then go to the python3 directory:
./configure --with-zlib --with-openssl
make
make install
I'm completely new to programming. I've been trying various ways to install NLTK on my Mac (running OS 10.5.8), and none of them is working. Please help! Here's what I've done so far.
Since at first I didn't realize that newer versions of Python required OS 10.6 or higher, I first tried to install the latest versions of both Python 3 and Python 2, but this obviously didn't work. I then cottoned on and found an older installation (the filename is python-2.7.6-macosx10.3.dmg), which installed successfully.
I then tried to follow the instructions on this page, which I copy below:
Install Setuptools: http://pypi.python.org/pypi/setuptools
Install Pip: run sudo easy_install pip
Install Numpy (optional): run sudo pip install -U numpy
Install PyYAML and NLTK: run sudo pip install -U pyyaml nltk
Test installation: run python then type import nltk
Steps 1 and 2 worked fine, but when I try steps 3 and 4, I get an error. The error is the same whether I try step 3 or step 4:
unknown0021E9E0E476:~ Tom$ sudo pip install -U numpy
Traceback (most recent call last):
File "/usr/local/bin/pip", line 8, in <module> load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 271, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2173, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 1906, in loadentry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.5/site-packages/pip-1.4.1-py2.5.egg/pip/__init__.py", line 10, in <module>
from pip.util import get_installed_distributions, get_prog
File "/Library/Python/2.5/site-packages/pip-1.4.1-py2.5.egg/pip/util.py", line 17, in <module>
from pip.vendor.distlib import version
File "/Library/Python/2.5/site-packages/pip-1.4.1-py2.5.egg/pip/vendor/distlib/version.py", line 13, in <module>
from .compat import string_types
File "/Library/Python/2.5/site-packages/pip-1.4.1-py2.5.egg/pip/vendor/distlib/compat.py", line 276
return b''
^
SyntaxError: invalid syntax
I then found a different set of instructions on this page. It first has you install Xcode and MacPorts, which I did (again finding older versions compatible with 10.5.8). I got through the next few steps successfully: installed python27, made it the system default (sudo port select --set python python27), and installed the dependencies py27-numpy, py27-yaml, and py27-scipy. However, I can't install one needed package, py27-matplotlib. Here's what happens when I try:
unknown0021E9E0E476:~ Tom$ sudo port install py27-matplotlib
---> Computing dependencies for py27-matplotlib
---> Dependencies to be installed: py27-pyobjc-cocoa py27-pyobjc py27-six py27-tkinter tk Xft2 tcl xorg-libXScrnSaver xorg-scrnsaverproto py27-tornado py27-backports-ssl_match_hostname py27-backports
---> Staging py27-pyobjc into destroot
Error: org.macports.destroot for port py27-pyobjc returned: command execution failed
Error: Failed to install py27-pyobjc
Please see the log file for port py27-pyobjc for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-pyobjc/py27-pyobjc/main.log
Error: The following dependencies were not installed: py27-pyobjc-cocoa py27-pyobjc py27-six py27-tkinter tk Xft2 tcl xorg-libXScrnSaver xorg-scrnsaverproto py27-tornado py27-backports-ssl_match_hostname py27-backports
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: Processing of port py27-matplotlib failed
Without this package, I can't go on to install NLTK.
I've also tried installing NLTK in PyCharm, but that didn't work either: see this question. I'm at my wits' end here, so any help would be much appreciated!
ETA: Problem solved! I downloaded the tar.gz file from https://pypi.python.org/pypi/nltk and followed the install instructions in the package, and now I can import NLTK in the Python shell. Is it possible that I was simply trying to install things while in the wrong directory? (I'd still like to use NLTK in PyCharm, so answers to that question will still be welcome.)
Try installing the scipy package which includes matplotlib and numpy, I was a TA on a course where we used numpy and matplotlib quite a lot and using the scipy package to install was a solution for a lot of people.
The individual binary and source packages are available from: scipy docs
sudo port install py27-numpy py27-scipy py27-matplotlib py27-ipython +notebook py27-pandas py27-sympy py27-nose
The entire return when running "sudo python ./mining_proxy.py" is:
Traceback (most recent call last):
File "./mining_proxy.py", line 67, in <module>
from twisted.internet import reactor, defer
File "/Library/Python/2.7/site-packages/Twisted-13.2.0-py2.7-macosx-10.8-intel.egg/twisted/__init__.py", line 53, in <module>
_checkRequirements()
File "/Library/Python/2.7/site-packages/Twisted-13.2.0-py2.7-macosx-10.8-intel.egg/twisted/__init__.py", line 51, in _checkRequirements
raise ImportError(required + ".")
ImportError: Twisted requires zope.interface 3.6.0 or later.
This leads me to believe that zope.interface is not installed. So I try to install it:
sudo easy_install zope.interface
Searching for zope.interface
Best match: zope.interface 4.1.1
Processing zope.interface-4.1.1-py2.7-macosx-10.8-intel.egg
zope.interface 4.1.1 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages/zope.interface-4.1.1-py2.7-macosx-10.8-intel.egg
Processing dependencies for zope.interface
Finished processing dependencies for zope.interface
I also find this post which says you basically need to put an init.py into the folder. So I do:
sudo touch /usr/local/lib/python2.7/site-packages/zope.interface-4.1.1/__init__.py
I try to run mining proxy again, same error. Please help.
I had the same error.
After googling around I found that the touch should be in a different place:
sudo touch /usr/local/lib/python2.7/site-packages/zope/__init__.py
however it didn't work.
I just fixed it using virtualenv
steps here:
pip install virtualenv virtualenvwrapper
mkvirtual stratum-proxy
pip install https://github.com/slush0/stratum-mining-proxy.git
pip install zope2
After those step inside the virtualenv stratum-proxy was working successfully.
hope it helps