Error when running conda raise ffiplatform.VerificationError(error) - python

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.

Related

"ImportError: dynamic module does not define module export function (PyInit__socket)" when using pip in a new conda envrionment

when I try to start a new conda environment using
conda create --name myenv
and then
conda install -n myenv pip
and then I try use
pip
I get the following error message:
Traceback (most recent call last):
File "C:\Users\ese\Miniconda3\envs\myenv\Scripts\pip-script.py", line 6, in <module>
from pip._internal.cli.main import main
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 24, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\configuration.py", line 20, in <module>
from pip._internal.exceptions import (
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_internal\exceptions.py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\requests\__init__.py", line 43, in <module>
from pip._vendor import urllib3
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\urllib3\__init__.py", line 11, in <module>
from . import exceptions
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\urllib3\exceptions.py", line 3, in <module>
from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 234, in create_module
return self.load_module(spec.name)
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 209, in load_module
mod = mod._resolve()
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 118, in _resolve
return _import_module(self.mod)
File "C:\Users\ese\Miniconda3\envs\myenv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 87, in _import_module
__import__(name)
File "C:\Users\ese\Miniconda3\envs\myenv\lib\http\client.py", line 71, in <module>
import email.parser
File "C:\Users\ese\Miniconda3\envs\myenv\lib\email\parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "C:\Users\ese\Miniconda3\envs\myenv\lib\email\feedparser.py", line 27, in <module>
from email._policybase import compat32
File "C:\Users\ese\Miniconda3\envs\myenv\lib\email\_policybase.py", line 9, in <module>
from email.utils import _has_surrogates
File "C:\Users\ese\Miniconda3\envs\myenv\lib\email\utils.py", line 29, in <module>
import socket
File "C:\Users\ese\Miniconda3\envs\myenv\lib\socket.py", line 51, in <module>
import _socket
ImportError: dynamic module does not define module export function (PyInit__socket)
I have tried reinstalling conda in my different versions and it keeps happening. I am actually having a feeling this might be related to having some weird restrictions on my company PC, but I am unsure. Anyone know how I could solve this? Thanks!

ImportError: cannot import name certificate_transparency after installing Pusher

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.

Why is pip not working properly on ubuntu?

Iv'e Looked and Looked and cannot figure out this problem. Pip will not work for anything at all and it is causing me much trouble. pip3 will work, but pip will not work at all. keeps spitting out this error having to do with cryptography module. other posts said to pip remove enum and pip install enum34, but the problem is that pip won't even allow me to do this. When I try to do anything with pip, it's spits out this error or similar.
Traceback (most recent call last):
File "/usr/local/bin/pip", line 11, in <module>
load_entry_point('pip==18.1.dev0', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 480, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2693, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2324, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2330, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/cli/cmdoptions.py", line 17, in <module>
from pip._internal.index import (
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_internal/index.py", line 14, in <module>
from pip._vendor import html5lib, requests, six
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_vendor/requests/__init__.py", line 97, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/pip-18.1.dev0-py2.7.egg/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 12, in <module>
from cryptography import x509
File "/usr/lib/python2.7/dist-packages/cryptography/x509/__init__.py", line 8, in <module>
from cryptography.x509.base import (
File "/usr/lib/python2.7/dist-packages/cryptography/x509/base.py", line 16, in <module>
from cryptography.x509.extensions import Extension, ExtensionType
File "/usr/lib/python2.7/dist-packages/cryptography/x509/extensions.py", line 24, in <module>
from cryptography.x509.general_name import GeneralName, IPAddress, OtherName
File "/usr/lib/python2.7/dist-packages/cryptography/x509/general_name.py", line 18, in <module>
from cryptography.x509.name import Name
File "/usr/lib/python2.7/dist-packages/cryptography/x509/name.py", line 28, in <module>
_ASN1_TYPE_TO_ENUM = dict((i.value, i) for i in _ASN1Type)
TypeError: 'type' object is not iterable
Thank You Very Much
Try:
curl 'https://bootstrap.pypa.io/get-pip.py' -o get-pip.py
python get-pip.py --force-reinstall

can not install scrapy on my mac

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

Unable to install Python pip or use easy_install

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

Categories

Resources