I created a virtualenv with virtualenv env, and then (after sourcing env/bin/activate) installed pusher with pip. However, whenever I try to run my module, I get this error:
Traceback (most recent call last):
File "/home/proc-daemon/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/home/proc-daemon/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/home/proc-daemon/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/home/proc-daemon/supachat/supachat.py", line 31, in <module>
ssl=True
File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/pusher/pusher.py", line 52, in __init__
json_encoder, json_decoder, backend, **backend_options)
File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/pusher/pusher_client.py", line 34, in __init__
json_encoder, json_decoder, backend, **backend_options)
File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/pusher/client.py", line 20, in __init__
from .requests import RequestsBackend
File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/pusher/requests.py", line 17, in <module>
import urllib3.contrib.pyopenssl
File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/OpenSSL/crypto.py", line 12, in <module>
from cryptography import x509
File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/cryptography/x509/__init__.py", line 7, in <module>
from cryptography.x509 import certificate_transparency
ImportError: cannot import name certificate_transparency
All the dependencies installed correctly, and ls env/lib/python2.7/site-packages/cryptography/x509 shows (among others) certificate_transparency.pyc (and .py).
Is there a different way to install pusher that I am not realizing?
So, this doesn't explain the problem, but it solves it.
I was using the wrong backend. Importing pusher.gae and setting backend=pusher.gae.GAEBackend solved the problem.
Related
After creating an environment in anaconda and installing tensorflow, I could not open Jupyter notebook, do I have to switch to base environment to open the notebook or I have done something wrong
D:\Anaconda3\lib\site-packages\zmq\backend\cffi\__pycache__\_cffi_ext.c(213): fatal error C1083: Cannot open include file: 'sys/un.h': No such file or directory
Traceback (most recent call last):
File "D:\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "D:\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 47, in <module>
from zmq.eventloop import ioloop
File "D:\Anaconda3\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "D:\Anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "D:\Anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "D:\Anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "D:\Anaconda3\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "D:\Anaconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
I am working on computer with Ubuntu 16.04.
I have anaconda installed and was using the jupyter notebook just fine both for julia and python a couple of hours while ago. I installed/reinstalled some packages but nothing out of the ordinary.
However, after closing notebooks and then trying to open them again I get error:
jupyter notebook
Traceback (most recent call last):
File "/home/user/anaconda2/bin/jupyter-notebook", line 4, in <module>
import notebook.notebookapp
File "/home/user/anaconda2/lib/python2.7/site-packages/notebook/notebookapp.py", line 60, in <module>
from .services.contents.manager import ContentsManager
File "/home/user/anaconda2/lib/python2.7/site-packages/notebook/services/contents/manager.py", line 16, in <module>
from nbformat import sign, validate, ValidationError
File "/home/user/anaconda2/lib/python2.7/site-packages/nbformat/__init__.py", line 33, in <module>
from .validator import validate, ValidationError
File "/home/user/anaconda2/lib/python2.7/site-packages/nbformat/validator.py", line 12, in <module>
from jsonschema import ValidationError
File "/home/user/anaconda2/lib/python2.7/site-packages/jsonschema/__init__.py", line 18, in <module>
from jsonschema.validators import (
File "/home/user/anaconda2/lib/python2.7/site-packages/jsonschema/validators.py", line 8, in <module>
import requests
File "/home/user/anaconda2/lib/python2.7/site-packages/requests/__init__.py", line 52, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/home/user/anaconda2/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/home/user/anaconda2/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/home/user/anaconda2/lib/python2.7/site-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/home/user/anaconda2/lib/python2.7/site-packages/OpenSSL/_util.py", line 7, in <module>
binding = Binding()
File "/home/user/anaconda2/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 89, in __init__
self._ensure_ffi_initialized()
File "/home/user/anaconda2/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 109, in _ensure_ffi_initialized
libraries=libraries,
File "/home/user/anaconda2/lib/python2.7/site-packages/cryptography/hazmat/bindings/utils.py", line 80, in build_ffi
extra_link_args=extra_link_args,
File "/home/user/anaconda2/lib/python2.7/site-packages/cffi/api.py", line 437, in verify
lib = self.verifier.load_library()
File "/home/user/anaconda2/lib/python2.7/site-packages/cffi/verifier.py", line 114, in load_library
return self._load_library()
File "/home/user/anaconda2/lib/python2.7/site-packages/cffi/verifier.py", line 225, in _load_library
return self._vengine.load_library()
File "/home/user/anaconda2/lib/python2.7/site-packages/cffi/vengine_cpy.py", line 158, in load_library
raise ffiplatform.VerificationError(error)
cffi.ffiplatform.VerificationError: importing '/home/user/anaconda2/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_4ed9e37dx4000d087.so': /home/user/anaconda2/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_4ed9e37dx4000d087.so: undefined symbol: SSLv2_client_method
I think this has to do with anaconda since the following comands will trigger the same error.
conda install jupyter
pip install jupyter
pip install python-igraph
I have already installed the libraries suggested by the answers to this question (meet cffi.ffiplatform.VerificationError when install pyopenssl). But it hasn't worked.
I was trying to use celery, but ran into some compilation errors. As such, I tried to uninstall/reinstall Numpy and Skimage in an attempt to fix it.
I did not fix it, instead, I made it worse.
When I now use pip to install, uninstall or --upgrade it returns the following error.
rootadmin#annotatie01:/data_nfs/opensurfaces/venv/lib/python2.7/site-packages/numpy$ sudo -H python -m pip install pandas
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 151, in _run_module_as_main
mod_name, loader, code, fname = _get_module_details(mod_name)
File "/usr/lib/python2.7/runpy.py", line 109, in _get_module_details
return _get_module_details(pkg_main_name)
File "/usr/lib/python2.7/runpy.py", line 101, in _get_module_details
loader = get_loader(mod_name)
File "/usr/lib/python2.7/pkgutil.py", line 464, in get_loader
return find_loader(fullname)
File "/usr/lib/python2.7/pkgutil.py", line 474, in find_loader
for importer in iter_importers(fullname):
File "/usr/lib/python2.7/pkgutil.py", line 430, in iter_importers
__import__(pkg)
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 62, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/__init__.py", line 29, in <module>
import urllib3
File "/usr/lib/python2.7/dist-packages/urllib3/__init__.py", line 16, in <module>
from .connectionpool import (
File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 17, in <module>
from httplib import HTTPConnection, HTTPException
File "/usr/lib/python2.7/httplib.py", line 80, in <module>
import mimetools
File "/usr/lib/python2.7/mimetools.py", line 6, in <module>
import tempfile
File "/usr/lib/python2.7/tempfile.py", line 35, in <module>
from random import Random as _Random
File "random/__init__.py", line 102, in <module>
ranf = random = sample = random_sample
NameError: name 'random_sample' is not defined
The same error is returned if i run python -m pip.__main__. I'm using a remote server running ubuntu 14.04
For some reason your current working directory is
/data_nfs/opensurfaces/venv/lib/python2.7/site-packages/numpy
which is inside the numpy package, so import random results in importing not the standard library random module, but the numpy.random package. Just cd out of that directory (in general don't run Python from inside packages under site-packages).
Even if you didn't know there were a numpy.random module you can glean this from the traceback:
File "/usr/lib/python2.7/tempfile.py", line 35, in <module>
from random import Random as _Random
File "random/__init__.py", line 102, in <module>
ranf = random = sample = random_sample
You can see that while tempfile was imported from an absolute path /usr/lib/python2.7/ (where the standard library is), random was imported from a relative path, that is, relative to your current directory.
I have tried to install scrapy on my mac(10.12.3)but failed. In fact, I can import scrapy in pycharm and there is no error, however, when I try to use in my terminal, error happened.
loohazeMacBook-Pro:~ loohaze$ scrapy
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/scrapy", line 11, in <module>
load_entry_point('Scrapy==1.3.2', 'console_scripts', 'scrapy')()
File "/Users/loohaze/Library/Python/2.7/lib/python/site-packages/scrapy/cmdline.py", line 121, in execute
cmds = _get_commands_dict(settings, inproject)
File "/Users/loohaze/Library/Python/2.7/lib/python/site-packages/scrapy/cmdline.py", line 45, in _get_commands_dict
cmds = _get_commands_from_module('scrapy.commands', inproject)
File "/Users/loohaze/Library/Python/2.7/lib/python/site-packages/scrapy/cmdline.py", line 28, in _get_commands_from_module
for cmd in _iter_command_classes(module):
File "/Users/loohaze/Library/Python/2.7/lib/python/site-packages/scrapy/cmdline.py", line 19, in _iter_command_classes
for module in walk_modules(module_name):
File "/Users/loohaze/Library/Python/2.7/lib/python/site-packages/scrapy/utils/misc.py", line 71, in walk_modules
submod = import_module(fullpath)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/loohaze/Library/Python/2.7/lib/python/site-packages/scrapy/commands/version.py", line 6, in <module>
import OpenSSL
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/rand.py", line 12, in <module>
from OpenSSL._util import (
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: dynamic module does not define init function (init_openssl)
I'm new to python, please help! thanks
Try to do:
xcode-select --install
There are known issues in the installation guide of scrapy - https://doc.scrapy.org/en/latest/intro/install.html
I am on OSX 10.10.3 with Python 2.7.6 as my main Python. I suddenly ran into trouble using pip, and tried to fix it. The solution proposed elsewhere on StackOverflow was to remove installations of pip and reinstall it either using their official installer or using easy_install.
Running the installation script (https://bootstrap.pypa.io/get-pip.py) gives:
Traceback (most recent call last):
File "pip.py", line 17767, in <module>
main()
File "pip.py", line 162, in main
bootstrap(tmpdir=tmpdir)
File "pip.py", line 82, in bootstrap
import pip
File "/tmp/tmpDnRtQK/pip.zip/pip/__init__.py", line 6, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/optparse.py", line 90, in <module>
from gettext import gettext
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gettext.py", line 49, in <module>
import locale, copy, os, re, struct, sys
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 110, in <module>
#functools.wraps(_localeconv)
AttributeError: 'module' object has no attribute 'wraps'
and running "sudo easy_install pip" gives
Traceback (most recent call last):
File "/usr/bin/easy_install-2.7", line 7, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2793, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 673, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 581, in resolve
requirements.extend(dist.requires(req.extras)[::-1])
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2323, in requires
dm = self._dep_map
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2374, in __getattr__
raise AttributeError(attr)
AttributeError: _dep_map
I am not really sure where to go next.
I am also in the situation that I can't import various modules, for example Flask, since I get the following error:
Traceback (most recent call last):
File "/Users/dawi/git/friends/run.py", line 2, in <module>
from application import app
File "/Users/dawi/git/friends/application/__init__.py", line 3, in <module>
from flask import Flask
File "/Library/Python/2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/__init__.py", line 17, in <module>
from werkzeug.exceptions import abort
File "/Library/Python/2.7/site-packages/Werkzeug-0.9.6-py2.7.egg/werkzeug/__init__.py", line 154, in <module>
__import__('werkzeug.exceptions')
File "/Library/Python/2.7/site-packages/Werkzeug-0.9.6-py2.7.egg/werkzeug/exceptions.py", line 71, in <module>
from werkzeug.wrappers import Response
File "/Library/Python/2.7/site-packages/Werkzeug-0.9.6-py2.7.egg/werkzeug/wrappers.py", line 23, in <module>
from functools import update_wrapper
ImportError: cannot import name update_wrapper