can not install scrapy on my mac - python

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

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!

Error when running conda raise ffiplatform.VerificationError(error)

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.

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

Getting a python error when running the EB command

I installed ec2 api tools and when I run the command I get this error:
Traceback (most recent call last):
File "/usr/local/bin/eb", line 9, in <module>
load_entry_point('awsebcli==3.9.0', 'console_scripts', 'eb')()
File "/Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 345, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2381, in load_entry_point
return ep.load()
File "/Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2087, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.7/site-packages/ebcli/core/ebcore.py", line 42, in <module>
from . import ebglobals, base, io, hooks
File "/Library/Python/2.7/site-packages/ebcli/core/hooks.py", line 21, in <module>
from ..lib import aws
File "/Library/Python/2.7/site-packages/ebcli/lib/aws.py", line 21, in <module>
import botocore.session
File "/Library/Python/2.7/site-packages/botocore/session.py", line 26, in <module>
import botocore.credentials
File "/Library/Python/2.7/site-packages/botocore/credentials.py", line 22, in <module>
from dateutil.parser import parse
File "/Library/Python/2.7/site-packages/dateutil/parser.py", line 43, in <module>
from . import tz
File "/Library/Python/2.7/site-packages/dateutil/tz/__init__.py", line 1, in <module>
from .tz import *
File "/Library/Python/2.7/site-packages/dateutil/tz/tz.py", line 23, in <module>
from ._common import tzname_in_python2, _tzinfo, _total_seconds
File "/Library/Python/2.7/site-packages/dateutil/tz/_common.py", line 2, in <module>
from six.moves import _thread
ImportError: cannot import name _thread
I installed it using:
sudo pip install --upgrade awsebcli

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