Ssh Python Module Gives Error When Trying To Import - python

I've been trying to figure out how to ssh using python 2.7 on a 64-bit Windows 8 computer. I found a module called ssh, so I used pip to install it. But when I type,
>>> import ssh
It gives me this error,
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import ssh
File "C:\Python27\lib\site-packages\ssh\__init__.py", line 62, in <module>
from transport import SecurityOptions, Transport
File "C:\Python27\lib\site-packages\ssh\transport.py", line 33, in <module>
from ssh import util
File "C:\Python27\lib\site-packages\ssh\util.py", line 33, in <module>
from ssh.common import *
File "C:\Python27\lib\site-packages\ssh\common.py", line 98, in <module>
from Crypto import Random
File "c:\users\sethco~1\appdata\local\temp\easy_install-u7gyec\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\__init__.py", line 28, in <module>
File "c:\users\sethco~1\appdata\local\temp\easy_install-u7gyec\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\OSRNG\__init__.py", line 34, in <module>
File "c:\users\sethco~1\appdata\local\temp\easy_install-u7gyec\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\OSRNG\nt.py", line 28, in <module>
File "c:\users\sethco~1\appdata\local\temp\easy_install-u7gyec\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\OSRNG\winrandom.py", line 7, in <module>
File "c:\users\sethco~1\appdata\local\temp\easy_install-u7gyec\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\OSRNG\winrandom.py", line 6, in __bootstrap__
ImportError: DLL load failed: %1 is not a valid Win32 application.
I'm not sure what it means. Did I install it correctly? How do I fix this? Are there any alternatives? I would appreciate your help very much.

Related

I got the error After I installed ryu on my ubuntu

I'm trying to install Ryu controller on Ubuntu which I installed on my laptop. I don't understand where my mistake lies
Traceback (most recent call last):
File "/home/jeo/.local/bin/ryu-manager", line 5, in <module>
from ryu.cmd.manager import main
File "/home/jeo/.local/lib/python3.10/site-packages/ryu/cmd/manager.py", line 22, in <module>
from ryu.lib import hub
File "/home/jeo/.local/lib/python3.10/site-packages/ryu/lib/hub.py", line 30, in <module>
import eventlet
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/__init__.py", line 17, in <module>
from eventlet import convenience
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/convenience.py", line 7, in <module>
from eventlet.green import socket
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/green/socket.py", line 4, in <module>
__import__('eventlet.green._socket_nodns')
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/green/_socket_nodns.py", line 11, in <module>
from eventlet import greenio
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/greenio/__init__.py", line 3, in <module>
from eventlet.greenio.base import * # noqa
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/greenio/base.py", line 32, in <module>
socket_timeout = eventlet.timeout.wrap_is_timeout(socket.timeout)
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/timeout.py", line 166, in wrap_is_timeout
base.is_timeout = property(lambda _: True)
TypeError: cannot set 'is_timeout' attribute of immutable type 'TimeoutError'
This could be due to the python version installed in your system. Try downgrading to a lower version between 2.7 and 3.7 if you are using one of the newer ones.

python TypeError: 'type' object is not iterable error

I am getting an error message when I try to run a python script, the python script I am attempting to run is https://raw.githubusercontent.com/orangetw/awesome-jenkins-rce-2019/master/exp.py I don't think that this is an issue with the script as I am able to run this on my host OS (having run the script in as OS)
Traceback (most recent call last):
File "exp.py", line 7, in <module>
import requests
File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 84, in <module>
from urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/home/kali/.local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/home/kali/.local/lib/python2.7/site-packages/OpenSSL/crypto.py", line 12, in <module>
from cryptography import x509
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/__init__.py", line 8, in <module>
from cryptography.x509.base import (
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/base.py", line 18, in <module>
from cryptography.x509.extensions import Extension, ExtensionType
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/extensions.py", line 26, in <module>
from cryptography.x509.general_name import GeneralName, IPAddress, OtherName
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/general_name.py", line 16, in <module>
from cryptography.x509.name import Name
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/name.py", line 28, in <module>
_ASN1_TYPE_TO_ENUM = {i.value: i for i in _ASN1Type}
TypeError: 'type' object is not iterable
line 7 is
import requests
Help appreciated

Resolve AttributeError: module 'pandas' has no attribute 'core' using command-prompt or pycharm

I am struggling because of the error
AttributeError: module 'pandas' has no attribute 'core'
since quite a long time please refer the output of "import pandas" below. I have searched for this error on the net and searched at many places tried many things but was unable to resolve it. The problem was the solutions provided were more realted to other operating systems like Mac and Linux while I am using Windows 7 Professional.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\__init__.py", line 42, in <module>
from pandas.core.api import *
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\api.py", line 10, in <module>
from pandas.core.groupby.groupby import Grouper
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
from pandas.core.groupby.groupby import (
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\frame.py", line 74, in <module>
from pandas.core.series import Series
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\series.py", line 66, in <module>
import pandas.core.ops as ops
AttributeError: module 'pandas' has no attribute 'core'
Please do ask if you need any other details. I will be really gratified if you help me through this.
Thankyou
P.S if you can suggest a solution which does not use internet using terminal such as in case of "pip install pandas" as the company's network access is restricted. So, I installed all the dependencies of pandas through whl files which are downloadable through the access the company has provided.
Edit: The first time I execute pandas it shows and rest it shows the error shown above
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\__init__.py", line 42, in <module>
from pandas.core.api import *
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\api.py", line 10, in <module>
from pandas.core.groupby.groupby import Grouper
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
from pandas.core.groupby.groupby import (
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\frame.py", line 74, in <module>
from pandas.core.series import Series
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\series.py", line 3978, in <module>
Series._add_series_or_dataframe_operations()
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\generic.py", line 8891, in _add_series_or_dataframe_operations
from pandas.core import window as rwindow
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\window.py", line 36, in <module>
import pandas._libs.window as _window
ImportError: DLL load failed: The specified module could not be found.
conda upgrade --all
Upgrade your library and restart your notebook.This will do the work.

Trouble with Python Libraries Between Different Nodes

I am trying to run a python script on a linux box with a specific version of python and I'm having some trouble. Every time I try to run the script on the linux box I get the traceback pasted below. The box has an Isilon storage system mounted where the script is stored. When I try to run the script on the head node of the Isilon, it runs fine. I can't figure out what would be different between the two systems, because I am using the same version of python in both places. To make it even more confusing, some of the linux boxes run the script just fine. All the linux boxes seemingly have the same version everything, I installed all the software at the same time from the same disk. Any feedback would be greatly appreciated. I'm happy to provide more explanation if necessary, I'm sure this is confusing.
I replaced the full path the scripts with "PATH".
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
File "PATH/libexec/python/lib/python2.7/hashlib.py", line 139, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "PATH/libexec/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
File "diskLoader/DiskLoaderMonitoring.py", line 12, in <module>
from WasabiClient import WasabiClient
File "PATH/lib/WasabiClient.py", line 13, in <module>
from ServiceClient import ServiceClient
File "PATH/lib/ServiceClient.py", line 6, in <module>
import requests
File "PATH/libexec/python/lib/python2.7/site-packages/requests-2.0.0-py2.7.egg/requests/__init__.py", line 58, in <module>
from . import utils
File "PATH/libexec/python/lib/python2.7/site-packages/requests-2.0.0-py2.7.egg/requests/utils.py", line 23, in <module>
from .compat import parse_http_list as _parse_list_header
File "PATH/libexec/python/lib/python2.7/site-packages/requests-2.0.0-py2.7.egg/requests/compat.py", line 7, in <module>
from .packages import charade as chardet
File "PATH/libexec/python/lib/python2.7/site-packages/requests-2.0.0-py2.7.egg/requests/packages/__init__.py", line 3, in <module>
from . import urllib3
File "PATH/libexec/python/lib/python2.7/site-packages/requests-2.0.0-py2.7.egg/requests/packages/urllib3/__init__.py", line 16, in <module>
from .connectionpool import (
File "PATH/libexec/python/lib/python2.7/site-packages/requests-2.0.0-py2.7.egg/requests/packages/urllib3/connectionpool.py", line 60, in <module>
from .response import HTTPResponse
File "PATH/libexec/python/lib/python2.7/site-packages/requests-2.0.0-py2.7.egg/requests/packages/urllib3/response.py", line 14, in <module>
from .util import is_fp_closed
File "PATH/libexec/python/lib/python2.7/site-packages/requests-2.0.0-py2.7.egg/requests/packages/urllib3/util.py", line 11, in <module>
from hashlib import md5, sha1
ImportError: cannot import name md5

Error while importing paramiko in python script

I'm trying to build a python script which has the line "import paramiko" and I get this error:
Traceback (most recent call last):
File "script.py", line 3, in <module>
import paramiko
File "/home/FBML7HR/.local/lib/python3.4/site-packages/paramiko-1.15.1-py3.4.egg/paramiko/__init__.py", line 30, in <module>
File "/home/FBML7HR/.local/lib/python3.4/site-packages/paramiko-1.15.1-py3.4.egg/paramiko/transport.py", line 49, in <module>
File "/home/FBML7HR/.local/lib/python3.4/site-packages/paramiko-1.15.1-py3.4.egg/paramiko/dsskey.py", line 26, in <module>
File "/home/FBML7HR/.local/lib/python3.4/site-packages/Crypto/PublicKey/DSA.py", line 89, in <module>
from Crypto import Random
File "/home/FBML7HR/.local/lib/python3.4/site-packages/Crypto/Random/__init__.py", line 29, in <module>
from Crypto.Random import _UserFriendlyRNG
File "/home/FBML7HR/.local/lib/python3.4/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
from Crypto.Random.Fortuna import FortunaAccumulator
File "/home/FBML7HR/.local/lib/python3.4/site-packages/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
from . import FortunaGenerator
File "/home/FBML7HR/.local/lib/python3.4/site-packages/Crypto/Random/Fortuna/FortunaGenerator.py", line 36, in <module>
from Crypto.Cipher import AES
File "/home/FBML7HR/.local/lib/python3.4/site-packages/Crypto/Cipher/AES.py", line 50, in <module>
from Crypto.Cipher import _AES
ImportError: /home/FBML7HR/.local/lib/python3.4/site-packages/Crypto/Cipher/_AES.cpython-34m.so: undefined symbol: rpl_malloc
I've installed pycrypto and paramiko modules. Any idea what could be the problem here?
somebody had a similar issue with pycrypto and fixed by setting an env and doing a re-install. Check out http://github.com/jtriley/StarCluster/issues/138

Categories

Resources