1

I am getting the below issue when trying to create a folder using the scrapy command. I tried searching for this issue and found a solution at https://groups.google.com/forum/#!topic/scrapy-users/8N6V_OGUqtI I tried the steps provided there and still I am getting this issue.

Any help in getting this resolved would be appreciated.

(C:\Users\dell\Anaconda3) C:\Users\dell>activate scrapy-env

(scrapy-env) C:\Users\dell>scrapy startproject tutorial
Traceback (most recent call last):
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\Scripts\scrapy-script.py", line 5, in <module>
    sys.exit(scrapy.cmdline.execute())
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\scrapy\cmdline.py", line 128, in execute
    cmds = _get_commands_dict(settings, inproject)
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\scrapy\cmdline.py", line 46, in _get_commands_dict
    cmds = _get_commands_from_module('scrapy.commands', inproject)
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\scrapy\cmdline.py", line 29, in _get_commands_from_module
    for cmd in _iter_command_classes(module):
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\scrapy\cmdline.py", line 19, in _iter_command_classes
    for module in walk_modules(module_name):
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\scrapy\utils\misc.py", line 71, in walk_modules
    submod = import_module(fullpath)
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\scrapy\commands\version.py", line 6, in <module>
    import OpenSSL
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\OpenSSL\rand.py", line 10, in <module>
    from OpenSSL._util import (
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\OpenSSL\_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 13, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: DLL load failed: The operating system cannot run %1.
Sandeep
  • 11
  • 3

3 Answers3

2

Just In case someone else end up here this is what worked for me: I had same error while running scrapy from anaconda prompt. By seeing on process monitor, it caused by both dll files cannot be found inside Anaconda3\Lib\site-packages\cryptography\hazmat\bindings. Copy both files from Anaconda3\pkgs\openssl-1.0.2o-h8ea7d77_0\Library\bin into Anaconda3\Lib\site-packages\cryptography\hazmat\bindings, and it works

Julio
  • 21
  • 3
1

I had the same problem and found the solution at https://github.com/scrapy/scrapy/issues/3447

conda update -n base conda

And as it turns out, the error occured only within PyCharm and the solution was to install OpenSSL according to https://github.com/conda/conda/issues/8046#issuecomment-450515815

samwise
  • 1,907
  • 1
  • 21
  • 24
0

Make sure you installed the right library that matches your Python installation. If you're running Python 32-bit, install the library's 32-bit version. If you're Python x64, install the x64 version of the library. That's the most common cause of this error.

kichik
  • 33,220
  • 7
  • 94
  • 114
  • Thank you for providing the information. I checked and I am using a 64bit Python. I installed scrapy using pip and conda. Is there any way to install the x64 version of the library – Sandeep Nov 07 '17 at 17:56
  • Run `python` with no arguments at all. In the first line that describes the version you should see `64 bit (AMD64)` or `32 bit`. Ignore `win32` as it doesn't necessarily mean you're running on 32-bit. – kichik Nov 07 '17 at 17:57
  • I checked and I am using a 64bit Python. I installed scrapy using pip and conda. Is there any way to install the x64 version of the library – Sandeep Nov 07 '17 at 18:03
  • If you used (the right) pip, it should already be the right version. But it's not complaining about scrapy, it's complaining about `cryptography.hazmat.bindings._openssl`. Did you install that one using pip? Do you have `_openssl.pyd` somewhere in `C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages`? Try reinstalling the right `cryptography` package. – kichik Nov 07 '17 at 18:08
  • I have the file _openssl.pyd in the folder C:\Users\dell\Anaconda3\pkgs\cryptography-2.0.3-py36_0\Lib\site-packages\cryptography\hazmat\bindings – Sandeep Nov 07 '17 at 18:15
  • I uninstalled cryptography and reinstalled and still I am getting this issue – Sandeep Nov 07 '17 at 18:37