Python scrapy cant start a project - python-2.7

I failed to start a new project,but I don't know how to fix it.i inputscrapy startproject douban_new_movie,the result isImportError: dynamic module does not define init function (init_openssl)
i have uninstall scarpyonce , but it is not useful.
please tell me how to solve it,thank you.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/scrapy", line 11, in <module>
sys.exit(execute())
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scrapy/cmdline.py", line 121, in execute
cmds = _get_commands_dict(settings, inproject)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scrapy/cmdline.py", line 45, in _get_commands_dict
cmds = _get_commands_from_module('scrapy.commands', inproject)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scrapy/cmdline.py", line 28, in _get_commands_from_module
for cmd in _iter_command_classes(module):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scrapy/cmdline.py", line 19, in _iter_command_classes
for module in walk_modules(module_name):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/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 "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/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 15, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib

Related

Problem installing Django Tech Stack on Apples M1

I just got a new Mac with an M1 chip, but I have problems getting our stack to run.
Its a django project, with a few dependencies attached. Most of them being:
grpcio (1.43.0)
google-cloud-vision==2.1.0
googlemaps==4.4.2
firebase-admin==5.2.0
google-api-core[grpc]==1.31.5
via
firebase-admin
google-api-python-client
google-cloud-core
google-cloud-firestore
google-cloud-storage
google-cloud-vision
When installing on a fresh M1, using python 3.9.10, i get this error
Traceback (most recent call last):
File "/Users/tl/work/project/./manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/Users/tl/work/project/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
utility.execute()
File "/Users/tl/work/project/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute
django.setup()
File "/Users/tl/work/project/venv/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/tl/work/project/venv/lib/python3.9/site-packages/django/apps/registry.py", line 122, in populate
app_config.ready()
File "/Users/tl/work/project/image_analysis/apps.py", line 8, in ready
import image_analysis.signal_handlers
File "/Users/tl/work/project/image_analysis/signal_handlers.py", line 6, in <module>
from image_analysis.analyze import analyze_images
File "/Users/tl/work/project/image_analysis/analyze.py", line 8, in <module>
from google.cloud import vision
File "/Users/tl/work/project/venv/lib/python3.9/site-packages/google/cloud/vision/__init__.py", line 18, in <module>
from google.cloud.vision_v1.services.image_annotator.async_client import (
File "/Users/tl/work/project/venv/lib/python3.9/site-packages/google/cloud/vision_v1/__init__.py", line 21, in <module>
from .services.image_annotator import ImageAnnotatorClient as IacImageAnnotatorClient
File "/Users/tl/work/project/venv/lib/python3.9/site-packages/google/cloud/vision_v1/services/image_annotator/__init__.py", line 18, in <module>
from .client import ImageAnnotatorClient
File "/Users/tl/work/project/venv/lib/python3.9/site-packages/google/cloud/vision_v1/services/image_annotator/client.py", line 27, in <module>
from google.api_core import gapic_v1 # type: ignore
File "/Users/tl/work/project/venv/lib/python3.9/site-packages/google/api_core/gapic_v1/__init__.py", line 18, in <module>
from google.api_core.gapic_v1 import config
File "/Users/tl/work/project/venv/lib/python3.9/site-packages/google/api_core/gapic_v1/config.py", line 23, in <module>
import grpc
File "/Users/tl/work/project/venv/lib/python3.9/site-packages/grpc/__init__.py", line 22, in <module>
from grpc import _compression
File "/Users/tl/work/project/venv/lib/python3.9/site-packages/grpc/_compression.py", line 15, in <module>
from grpc._cython import cygrpc
ImportError: dlopen(/Users/tl/work/project/venv/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_EVP_DigestSignUpdate'
I tried googling this issue to no avail.
I am using brew to install most of my things, so also python.
I also have these settings set in my .zshrc file, to accomdate for other problems:
export CFLAGS="-I/opt/homebrew/opt/openssl/include"
export LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix zlib)/lib"
export CPPFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix zlib)/include"
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1

libcublas issue - tensorflow

I am very new to tensorflow, struggling on its installation. I use ubuntu 16.04. I obviously installed the Nvidia dependencies.
Whenever I type in:
import tensorflow as tf
I get:
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile
builtins.execfile(filename, *where)
File "/media/as/KINGSTON/SIEC NEURONOWA/NETWORK.py", line 3, in <module>
from keras.models import Sequential
File "/usr/local/lib/python2.7/dist-packages/keras/__init__.py", line 3, in <module>
from . import activations
File "/usr/local/lib/python2.7/dist-packages/keras/activations.py", line 4, in <module>
from . import backend as K
File "/usr/local/lib/python2.7/dist-packages/keras/backend/__init__.py", line 73, in <module>
from .tensorflow_backend import *
File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 1, in <module>
import tensorflow as tf
File "/home/as/.local/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/as/.local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/as/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/as/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/as/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/as/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
I tried many solutions, but the effect remains the same. Many thanks for help!
I had this same problem when installing gputools in R. After hundreds of tries, the command which worked for me is:
sudo ln -s /usr/local/cuda/lib64/libcublas.so.8.0 /usr/lib/libcublas.so.8.0
OR
sudo ln -s /usr/local/cuda-8.0/lib64/libcublas.so.8.0 /usr/lib/libcublas.so.8.0

Runtime error when trying to use pip

I have managed to royally screw myself over by doing something which seemed innocuous.
i was getting the following error from my python script (brand['feed'] = the URL i'm making the request to):
**C:\Python27\lib\site-packages\requests\packages\urllib3\util\ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Traceback (most recent call last):
File "D:\Phocas\Phocas-Automation\analytics\download_feed_cats.py", line 18, in <module>
data = requests.get(brand['feed'])
File "C:\Python27\lib\site-packages\requests\api.py", line 69, in get
return request('get', url, params=params, **kwargs)
File "C:\Python27\lib\site-packages\requests\api.py", line 50, in request
response = session.request(method=method, url=url, **kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 594, in send
history = [resp for resp in gen] if allow_redirects else []
File "C:\Python27\lib\site-packages\requests\sessions.py", line 196, in resolve_redirects
**adapter_kwargs
File "C:\Python27\lib\site-packages\requests\sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "C:\Python27\lib\site-packages\requests\adapters.py", line 431, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:507: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed**
So i asked the internet and the internet said do this:
pip install --upgrade ndg-httpsclient
So i did that and now i keep getting a RuntimeError when i run the same script, what's crazy is even if i just try and run pip in the shell, i get the same error!!
Phocas_Tommy#p3303386 MINGW64 /c/Python27
$ pip
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pip.exe\__main__.py", line 5, in <module>
File "C:\Python27\lib\site-packages\pip\__init__.py", line 11, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "C:\Python27\lib\site-packages\pip\vcs\mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "C:\Python27\lib\site-packages\pip\download.py", line 22, in <module>
from pip._vendor import requests, six
File "C:\Python27\lib\site-packages\pip\_vendor\requests\__init__.py", line 53, in <module>
from .packages.urllib3.contrib import pyopenssl
File "C:\Python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\contrib\pyopenssl.py", line 43, in <module>
import OpenSSL.SSL
File "C:\Python27\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "C:\Python27\lib\site-packages\OpenSSL\rand.py", line 12, in <module>
from OpenSSL._util import (
File "C:\Python27\lib\site-packages\OpenSSL\_util.py", line 9, in <module>
binding = Binding()
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 114, in __init__
self._ensure_ffi_initialized()
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 126, in _ensure_ffi_initialized
cls._modules,
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\utils.py", line 31, in load_library_for_binding
lib = ffi.verifier.load_library()
File "C:\Python27\lib\site-packages\cffi\verifier.py", line 96, in load_library
self._compile_module()
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\utils.py", line 127, in _compile_module
"Attempted implicit compile of a cffi module. All cffi modules should "
RuntimeError: Attempted implicit compile of a cffi module. All cffi modules should be pre-compiled at installation time.
I have searched this error and can't seem to find anything which helps. I'm using python 2.7.6 on Windows Server 2008 R2 Standard 64-bit
Re-installing Python fixed this problem

with open(fn, 'rb') as f: IOError: [Errno 2] No such file or directory: '/widgy/page_builder/html.scss'

I encounter, at all times, when i try to bind, scss and widgy, the same error.
With any django version, since 1.6.8 to 1.7.3,the last release, and django_pyscss any version, and finally django-widgy to 0.3.3 or other, always the same issue.
There my stack trace on PyDev :
Traceback (most recent call last):
File "C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\projects\workspace\MezzaTest2\manage.py", line 32, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\olive\Environnements\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line
utility.execute()
File "C:\Users\olive\Environnements\lib\site-packages\django\core\management\__init__.py", line 354, in execute
django.setup()
File "C:\Users\olive\Environnements\lib\site-packages\django\__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\olive\Environnements\lib\site-packages\django\apps\registry.py", line 108, in populate
app_config.import_models(all_models)
File "C:\Users\olive\Environnements\lib\site-packages\django\apps\config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "C:\Python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Users\olive\Environnements\lib\site-packages\widgy\contrib\page_builder\models.py", line 16, in <module>
from widgy.contrib.page_builder.db.fields import MarkdownField, VideoField, ImageField
File "C:\Users\olive\Environnements\lib\site-packages\widgy\contrib\page_builder\db\fields.py", line 13, in <module>
from widgy.contrib.page_builder.forms import MarkdownField as MarkdownFormField, MarkdownWidget
File "C:\Users\olive\Environnements\lib\site-packages\widgy\contrib\page_builder\forms\__init__.py", line 42, in <module>
class CKEditorWidget(forms.Textarea):
File "C:\Users\olive\Environnements\lib\site-packages\widgy\contrib\page_builder\forms\__init__.py", line 80, in CKEditorWidget
'contentsCss': scss_compile('/widgy/page_builder/html.scss'),
File "C:\Users\olive\Environnements\lib\site-packages\widgy\contrib\page_builder\forms\__init__.py", line 22, in scss_compile
css_content = scss.compile(scss_file=scss_filename)
File "C:\Users\olive\Environnements\lib\site-packages\pyscss-1.3.0.a1-py2.7.egg\scss\legacy.py", line 163, in compile
is_sass=is_sass,
File "C:\Users\olive\Environnements\lib\site-packages\pyscss-1.3.0.a1-py2.7.egg\scss\source.py", line 100, in from_filename
with open(fn, 'rb') as f:
IOError: [Errno 2] No such file or directory: '/widgy/page_builder/html.scss'
It seems that you are running the 1.3.0a1 version of PyScss. Widgy depends on django-pyscss, which currently only supports the 1.2.1 version of PyScss currently. I know that you tried a lot of different versions, but did you try to install PyScss==1.2.1?

py2exe no module named lgamma

I am trying to create an exe file for a python file. py2exe creates the executable, but when I run the executable, I get the following traceback:
C:\Users\gkumar7\Desktop\AL_gui-master\AL_gui-master\dist>app.exe
Traceback (most recent call last):
File "app.py", line 5, in <module>
File "learning_curve.pyc", line 13, in <module>
File "sklearn\metrics\__init__.pyc", line 34, in <module>
File "sklearn\metrics\scorer.pyc", line 30, in <module>
File "sklearn\metrics\cluster\__init__.pyc", line 8, in <module>
File "sklearn\metrics\cluster\supervised.pyc", line 18, in <module>
File "sklearn\metrics\cluster\expected_mutual_info_fast.pyc", line 12, in <mod
ule>
File "sklearn\metrics\cluster\expected_mutual_info_fast.pyc", line 10, in __lo
ad
File "expected_mutual_info_fast.pyx", line 1, in init sklearn.metrics.cluster.
expected_mutual_info_fast (sklearn\metrics\cluster\expected_mutual_info_fast.c:5
007)
ImportError: No module named lgamma
Here is my setup.py file:
dll_excludes = ['MSVCP90.dll', 'OLEAUT32.dll', 'USER32.dll', 'IMM32.dll', 'SHELL32.dll',
'ole32.dll', 'COMDLG32.dll', 'COMCTL32.dll', 'ADVAPI32.dll', 'mfc90.dll', 'msvcrt.dll',
'WS2_32.dll', 'WINSPOOL.DRV', 'GDI32.dll', 'VERSION.dll', 'KERNEL32.dll', 'ntdll.dll']
from distutils.core import setup
import py2exe, matplotlib, numpy
setup(console=['app.py'],
data_files=matplotlib.get_py2exe_datafiles(),
options = {"py2exe": {
"dll_excludes": dll_excludes,
"includes": ['scipy.sparse.csgraph._validation',
'scipy.special._ufuncs_cxx']
}
}, )
I have also tried cx_freeze, but kept receiving similar errors. Any help would be much appreciated.
Include sklearn.utils.lgamma in your py2exe setup file.