openSSL error in Scrapy while creating project - python

I have just installed scrapy and all the things along with it as per from scrapy tutorial site.
When I create project using Scrapy with such command
scrapy startproject [projectname]
so it gives me following error
Traceback (most recent call last):
File "c:\python\python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python\Python27\Scripts\scrapy.exe\__main__.py", line 9, in <module>
File "c:\python\python27\lib\site-packages\scrapy\cmdline.py", line 122, in execute
cmds = _get_commands_dict(settings, inproject)
File "c:\python\python27\lib\site-packages\scrapy\cmdline.py", line 46, in _get_commands_dict
cmds = _get_commands_from_module('scrapy.commands', inproject)
File "c:\python\python27\lib\site-packages\scrapy\cmdline.py", line 29, in _get_commands_from_module
for cmd in _iter_command_classes(module):
File "c:\python\python27\lib\site-packages\scrapy\cmdline.py", line 20, in _iter_command_classes
for module in walk_modules(module_name):
File "c:\python\python27\lib\site-packages\scrapy\utils\misc.py", line 71, in walk_modules
submod = import_module(fullpath)
File "c:\python\python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "c:\python\python27\lib\site-packages\scrapy\commands\version.py", line 6, in <module>
import OpenSSL
ImportError: No module named OpenSSL
After that even I tried to install openSSl manually using pip
but it saying that package is already installed
Help me with it.

You can satisfy the missing dependency by doing the following:
You need to install OpenSSL binaries on your system. Get binaries
from here: https://wiki.openssl.org/index.php/Binaries
Then you need to install pyOpenSSL, from here: https://pypi.python.org/pypi/pyOpenSSL/0.13

Related

Suddenly all virtual envs fail

I use vscode and I'm working with Jupyter in this particular example. Yesterday, I was doing my work fine. Today, my venv is broken, so I deleted and started again:
python -m venv venv
./venv/Scripts/Activate
Okay, so I have brand new venv now. So lets try updating pip:
python -m pip --upgrade pip
And I get this error:
Traceback (most recent call last):
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_internal\__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_vendor\urllib3\__init__.py", line 7, in <module>
from .connectionpool import (
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 11, in <module>
from .exceptions import (
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_vendor\urllib3\exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 203, in load_module
mod = mod._resolve()
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 115, in _resolve
return _import_module(self.mod)
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 82, in _import_module
__import__(name)
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 71, in <module>
import email.parser
ModuleNotFoundError: No module named 'email.parser'
Okay, lets try to ignore this an set up jupyter.
pip install wheel
pip install juypterlab
pip install ipykernel
Then when I try running a cell in that notebook in VSCode I get this error:
Kernel died (code: 1). ModuleNotFoundError: No module named 'email.parser',
Traceback (most recent call last):
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\ipykernel\kernelapp.py", line 22, in <module>
from IPython.core.application import (
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\IPython\__init__.py", line 56, in <module>
from .terminal.embed import embed
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\IPython\terminal\embed.py", line 17, in <module>
from IPython.terminal.ipapp import load_default_config
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\IPython\terminal\ipapp.py", line 28, in <module>
from IPython.core.magics import (
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\IPython\core\magics\__init__.py", line 18, in <module>
from .code import CodeMagics, MacroToEdit
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\IPython\core\magics\code.py", line 23, in <module>
from urllib.request import Request, urlopen
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 88, in <module>
import http.client
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 71, in <module>
import email.parser
ModuleNotFoundError: No module named 'email.parser'
What the heck is going on here?
Edit1
I've just proven it will error on the 3.8 global interpreter instance, even though I have other notebooks working on that. I've added a screenshot of the project.
You created a package named email, you need to rename it to some other names.

vitualenv does not work for my 2.7.9 python installation

After installing:
pip install virtualenv
Running it yells:
C:\programs\python\Python27\Scripts>virtualenv.exe
Traceback (most recent call last):
File "C:\programs\python\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\programs\python\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\programs\python\Python27\Scripts\virtualenv.exe\__main__.py", line 5, in <module>
File "C:\programs\python\Python27\lib\site-packages\virtualenv\__init__.py", line 3, in <module>
from .run import cli_run, session_via_cli
File "C:\programs\python\Python27\lib\site-packages\virtualenv\run\__init__.py", line 7, in <module>
from ..app_data import make_app_data
File "C:\programs\python\Python27\lib\site-packages\virtualenv\app_data\__init__.py", line 9, in <module>
from platformdirs import user_data_dir
ImportError: No module named platformdirs
Any ideas why this is happening ?
pip 1.5.6

Errors in installing django module for python

I've been trying to install django, looked around the internet but couldn't find possible solution for this.
I have tried looking for solutions. Some solutions told me to install conflict checker for pip but it still did not work because nothing seems to be getting installed using 'pip' keyword. It even gives me error when I try to find out my pip version
python -m pip install django
PS C:\Users\Fahad> python -m pip install django
Traceback (most recent call last):
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\__init__.py", line 19, in
from pip._vendor.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.urllib3
PS C:\Users\Fahad> python -m pip --version
Traceback (most recent call last):
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.urllib3'
So I tried downloading get-pip.py from here and hen I executed python get-pip.py then I tried re-installing django and it worked.

Problems upgrading Ipython (prompt_toolkit incompatibilities)

Trying to open a jupyter notebook file (.ipynb file)
with this command ipython notebook filename.ipynb then I am getting Below Error while using ipython..
Traceback (most recent call last):
File "c:\python\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python\Scripts\ipython.exe\__main__.py", line 5, in <module>
File "c:\python\lib\site-packages\IPython\__init__.py", line 55, in <module>
from .terminal.embed import embed
File "c:\python\lib\site-packages\IPython\terminal\embed.py", line 16, in
<module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "c:\python\lib\site-packages\IPython\terminal\interactiveshell.py",
line 18, in <module>
from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
ModuleNotFoundError: No module named 'prompt_toolkit'
Just got the same problem.
The solution for me was to pip uninstall prompt-toolkit and pip install prompt-toolkit. This uninstalled v1.0.5 and installed v2.0.4.

Win 7/Python 2.7 32bit: OSError: cannot load library pangocairo-1.0: error 0x7e

I want to test weasyprint but it has a problem with the installation of pangocairo.
I successfully installed weasyprint:
pip install weasyprint
I installed gtk using this tutorial, downloading it from here.
I also set up the path to gtk\bin.
$weasyprint
Traceback (most recent call last):
File "c:\root\python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\root\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "c:\root\python27\scripts\weasyprint.exe\__main__.py", line 5, in <module>
File "c:\root\python27\lib\site-packages\weasyprint\__init__.py", line 336, in <module>
from .css import PARSER, preprocess_stylesheet # noqa
File "c:\root\python27\lib\site-packages\weasyprint\css\__init__.py", line 30, in <module>
from . import computed_values
File "c:\root\python27\lib\site-packages\weasyprint\css\computed_values.py", line 18, in <module>
from .. import text
File "c:\root\python27\lib\site-packages\weasyprint\text.py", line 208, in <module>
'libpangocairo-1.0.so', 'libpangocairo-1.0.dylib')
File "c:\root\python27\lib\site-packages\weasyprint\text.py", line 200, in dlopen
return ffi.dlopen(names[0]) # pragma: no cover
File "c:\root\python27\lib\site-packages\cffi\api.py", line 139, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File "c:\root\python27\lib\site-packages\cffi\api.py", line 769, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
File "c:\root\python27\lib\site-packages\cffi\api.py", line 758, in _load_backend_lib
return backend.load_library(name, flags)
OSError: cannot load library pangocairo-1.0: error 0x7e
I was able to solve this issue by adding this dependency. Hope this works for you as well.
sudo apt-get install -y libpangocairo-1.0-0
For Macos (M1)
even after brew install pango it shows the same error
pip uninstall weasyprint
pip install weasyprint
Hope it helps !

Categories

Resources