How to import PyCrypto inside App Engine development server (OS X)? - python

My app.yaml include this lines:
libraries:
- name: pycrypto
version: "2.6"
I have the correct version of PyCrypto:
$ python
>>> import Crypto
>>> Crypto.__version__
'2.6'
But when I try evaluate import Crypto in GAE Development SDK interactive console, I get this:
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/request_handler.py", line 225, in handle_interactive_request
exec(compiled_code, self._command_globals)
File "<string>", line 12, in <module>
ImportError: No module named Crypto

Because pycrypto includes native compiled code, you need to install that yourself for your Python installation. Assuming you have pip installed:
pip install pycrypto

Related

Airflow: ImportError: No module named configparser

Environment: Python 2.7.5 & Centos 7
I have successfully installed airflow using:
pip install apache-airflow
But when I run
airflow initdb,
it says:
Traceback (most recent call last):
File "/usr/bin/airflow", line 21, in <module>
from airflow import configuration
File "/usr/lib/python2.7/site-packages/airflow/__init__.py", line 35, in <module>
from airflow import configuration as conf
File "/usr/lib/python2.7/site-packages/airflow/configuration.py", line 38, in <module>
from backports.configparser import ConfigParser
ImportError: No module named configparser
What am I missing?
The issue is you have installed a wrong package. airflow was renamed to apache-airflow from 1.8.1. The website you used has outdated docs.
Please install using the following command
export AIRFLOW_GPL_UNIDECODE=yes
pip install apache-airflow
This should install 1.10.0 which is the latest stable version and resolve your issues.

pycrypto : No module named strxor

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)

Unable to import ssl on linux

When I try to import ssl on any Python version I get
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: /lib/x86_64-linux-gnu/libssl.so.1.0.0: symbol X509_chain_up_ref, version
OPENSSL_1.0.2 not defined in file libcrypto.so.1.0.0 with link time reference
I have compiled Python 3.5 myself with libssl-dev version 1.0.2. According to aptitude I have libssl1.0.0.0 version 1.0.2 and openssl version 1.0.2 installed.
It seems to be a problem with the different version of libssl, openssl and libssl-dev but I have installed an reinstalled the newest version of all of them via the Package manager.
Im using Ubuntu 15.10 64-bit

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.

Installing PySide on OSX 10.6.8

Trying to get my feet wet with PySide development but having trouble
getting setup. I tried installing the binaries 1.0.4-r1 and 1.0.5 but
both of those produced the following message on import PySide
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/PySide/__init__.py", line 2,
in <module>
import private
File "/Library/Python/2.6/site-packages/PySide/private.py", line 2,
in <module>
from QtCore import __moduleShutdown
ImportError: dlopen(/Library/Python/2.6/site-packages/PySide/
QtCore.so, 2): Library not loaded: QtCore.framework/Versions/4/QtCore
Referenced from: /Library/Python/2.6/site-packages/PySide/QtCore.so
Reason: image not found
Then I tried doing the install from the gitorious build scripts. Using
sudo ./dependencies.osx.sh. After that completed I now get the
following error on import PySide.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/PySide/__init__.py", line 2,
in <module>
File "/Library/Python/2.6/site-packages/PySide/private.py", line 2,
in <module>
ImportError: No module named QtCore
Any advice is appreciated. I'm using QtCreator 2.2.1 and Qt SDK
1.1.2 / Qt Library 4.7.3. Thank you!
Try to install latest version MacPorts and python 2.7 first and set python2.7 as default python version:
sudo port install python27
port select --list python
sudo port select --set python python27
then re-install PySide again:
sudo port install py27-pyside
I just encountered exactly the same problem:
Library not loaded: QtCore.framework/Versions/4/QtCore
You need to find installed QT libraries and make them visible to the dynamic linker.
My Qt*.framework folders live in /usr/local/lib (Qt is installed with Homebrew package manager). So, I added
export DYLD_FRAMEWORK_PATH=/usr/local/lib:$DYLD_FRAMEWORK_PATH
to ~/.bash_profile and restarted the console.
That's it.
I just solved the same problem by using homebrew to install pyside.
$ sudo -H pip uninstall pyside
$ brew install pyside

Categories

Resources