pycrypto : No module named strxor - python

I got this error :
Traceback (most recent call last):
File "test.py", line 8, in <module>
from Crypto.Cipher import PKCS1_OAEP
File "C:\Users\Mokhles\Downloads\google-api-python-client-1.5.3\Crypto \Cipher\PKCS1_OAEP.py", line 57, in <module>
import Crypto.Signature.PKCS1_PSS
File "C:\Users\Mokhles\Downloads\google-api-python-client-1.5.3\Crypto \Signature\PKCS1_PSS.py", line 74, in <module>
from Crypto.Util.strxor import strxor
ImportError: No module named strxor
any idea how to solve it?
ENV:
-windows 10
-python 2.7

It looks like you're simply copied pyCrypto into your project. PyCrypto is library which depends on some native library/code (like libtomcrypt). You have to install it properly. You can do this for example through pip:
pip2 install pycrypto
or
pip3 install pycrypto
depending on which Python version you want to make it available.

try conda install pydotplus (may need to install tqdm first)

Related

'ModuleNotFoundError: No module named nltk.metrics' on 'import nltk'

I am working on Ubuntu and installed NLTK via apt-get for Python 3.6.
Here's my problem:
>>> import nltk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/wizard/.local/lib/python3.6/site-packages/nltk/__init__.py", line 128, in <module>
from nltk.collocations import *
File "/wizard/.local/lib/python3.6/site-packages/nltk/collocations.py", line 39, in <module>
from nltk.metrics import (
ModuleNotFoundError: No module named 'nltk.metrics'
I am a beginner on Ubuntu so I don't know how to solve this. I assume that the metrics module didn't get installed with the rest?
Python librairies shouldn't be installed with apt-get but with pip.
In your case, you should install it with pip install nltk.
If you are new to Python and does not know about the package managing module Pip, check this website.
I advice you to use virtual environments aswell when working with Python, check info here.

Error importing tensorflow in Python 3 on Ubuntu 16.04 SyntaxError: l.append("%s=%s" % (attr, `value`))

I have python 3.5 installed on my Linux Mint (Ubuntu 16.04 Xenial)
I also had installed protobuf installed using pip3 install protobuf
I installed tensorflow using pip3 install tensorflow
Then I tried to import tensorflow in python 3 it failed with error presented below:
Traceback (most recent call last):
File "/home/abdullah/face_recognition/tensorflow_test.py", line 1, in <module>
import tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 83, in <module>
from tensorflow.python.estimator import estimator_lib as estimator
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/estimator_lib.py", line 35, in <module>
from tensorflow.python.estimator.inputs import inputs
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/inputs/inputs.py", line 22, in <module>
from tensorflow.python.estimator.inputs.numpy_io import numpy_input_fn
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/inputs/numpy_io.py", line 22, in <module>
from tensorflow.python.estimator.inputs.queues import feeding_functions
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/inputs/queues/feeding_functions.py", line 40, in <module>
import pandas as pd
File "/usr/local/lib/python3.5/dist-packages/pandas/__init__.py", line 23, in <module>
from pandas.compat.numpy import *
File "/usr/local/lib/python3.5/dist-packages/pandas/compat/__init__.py", line 361, in <module>
from dateutil import parser as _date_parser
File "/usr/local/lib/python3.5/dist-packages/dateutil/parser.py", line 158
l.append("%s=%s" % (attr, `value`))
^
SyntaxError: invalid syntax
Consulting through many questions posted on SO and other forums, I tried uninstalling protobuf then I encountered following error.
Traceback (most recent call last):
File "/home/abdullah/face_recognition/tensorflow_test.py", line 1, in <module>
import tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/core/framework/graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
ImportError: No module named 'google.protobuf'
At the moment I'm just a beginner for all of this. I don't why protobuf is required why do all this hassle? I just wanted to get tensorflow installed on my system and try to learn something.
I was also facing the same problem. The problem I think is this is using pandas from system(apt-get) repository which is not compatible with other libraries. Updating pandas do the trick.
pip3 install --upgrade pandas
Also in your case, if only doing above fails, you can also try to reinstall tensorflow and protobuf with upgrade option.
pip3 install --upgrade protobuf
pip3 install --upgrade tensorflow
I just installed TensorFlow on my system today (Ubuntu 16.04 LTS) using VirtualEnv.
Did you run$ sudo apt-get install python3-pip python3-dev
If so, then try $ pip3 install -upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp35-cp35m-linux_x86_64.whl
Worst comes to worse, you could simply uninstall TensorFlow using $ sudo pip3 uninstall tensorflow and then try reinstalling to see if it corrects any errors.

Tensorflow pip built from source fails on 'import tensorflow'

Built tensorflow 0.7 from source on Ubuntu 15.10, Cuda 7.5, cudnn 4.0, python 2.7. Bazel build and pip package generation OK. pip install ok. Python script "import tensorflow" fails:
Traceback (most recent call last):
File "/home/keith/Desktop/tf1.py", line 8, in <module>
import tensorflow as tf
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 35, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/core/framework/graph_pb2.py", line 16, in <module>
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "/usr/local/lib/python2.7/dist-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "/usr/local/lib/python2.7/dist-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
File "/usr/local/lib/python2.7/dist-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 22, in <module>
serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"z\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x12\x14\n\x0cunknown_rank\x18\x03 \x01(\x08\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tB/\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01\x62\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'
Any thoughts?
Thanks
This does look like a protobuf library versioning error. There's a long thread on similar issues here:
https://github.com/tensorflow/tensorflow/issues/11
Towards the end there are some suggested solutions that might help.
I succeed in running TensorFlow 0.7 on a manjaro linux laptop using cuda acceleration by running python with optirun:
$optirun python
However, I had problem with protobuf and I had to uninstall/reinstall previous version of protobuf and tensorflow with pip. http://bit.ly/1RHApU5
This is because of protobuf version conflict:
for me i had python-protobuf v2.6.1 installed from apt-get package manager
and while installing tensorflow it installed protobuf v3.3.0 from pip manager
so i uninstalled both:
sudo pip uninstall protobuf
sudo apt-get remove python-protobuf
Reinstalled using pip and it solved the issue!!!
sudo pip install protobuf
Hope this helps..

Having trouble installing buildslave on Windows 7

I finally got pip install buildbot-slave to work on Win7 (thanks to another answer on this site), and now when I attempt to create a build slave via:
buildslave create-slave slavefolder blah.blah.com:9989 buildslave password
It kicks back the following error:
Traceback (most recent call last):
File "C:\Python27\Scripts\buildslave", line 3, in <module>
from buildslave.scripts import runner
File "C:\Python27\lib\site-packages\buildslave\scripts\runner.py", line 22, in <module>
from twisted.python import reflect
File "C:\Python27\lib\site-packages\twisted\__init__.py", line 53, in <module>
_checkRequirements()
File "C:\Python27\lib\site-packages\twisted\__init__.py", line 37, in _checkRequirements
raise ImportError(required + ": no module named zope.interface.")
ImportError: Twisted requires zope.interface 3.6.0 or later: no module named zope.interface.
I've got it all installed here is my pip freeze:
Twisted==14.0.0
argparse==1.2.1
buildbot-slave==0.8.9
stevedore==0.15
virtualenv==1.9.1
virtualenv-clone==0.2.5
virtualenvwrapper==4.3.1
virtualenvwrapper-win==1.1.5
zope.interface==4.1.1
Any recommendations would be greatly appreciated.
Try to uninstall zope.interface and reinstall the version 3.6.0 using the command
pip uninstall zope.interface
pip install zope.interface==3.6.0
Hope this helps.

Python module ecdsa errors while running paramiko

I am trying to install paramiko module..it fails with the below error
python ./test.py
Traceback (most recent call last):
File "./test.py", line 30, in <module>
import paramiko
File "/tmp/build-paramiko/paramiko-1.12.0/paramiko/__init__.py", line 64, in <module>
from transport import SecurityOptions, Transport
File "/tmp/build-paramiko/paramiko-1.12.0/paramiko/transport.py", line 45, in <module>
from paramiko.ecdsakey import ECDSAKey
File "/tmp/build-paramiko/paramiko-1.12.0/paramiko/ecdsakey.py", line 24, in <module>
from ecdsa import SigningKey, VerifyingKey, der, curves
ImportError: No module named ecdsa
Any suggestions on how to proceed with the paramiko installation ?
Download the package from 'https://github.com/warner/python-ecdsa' and install it using command
python setup.py install
Your problem will be solved.
You can use easy_install to install the lost module "ecdsa" ,which like: easy_install ecdsa,
but you have to ready easy_install first!
this:
from ecdsa import SigningKey, VerifyingKey, der, curves
ImportError: No module named ecdsa
suggests that the python-ecdsa package is missing, you can install it with
pip install ecdsa
Though in general, you shouldn't need to install paramiko from sources. You can install it with
pip install paramiko
that has the benefit of automatically resolving the dependencies of a package

Categories

Resources