ImportError: DLL load failed - when trying to import spynner - python

When I run a code which imports spynner, I get the following error:
> python .\spynner-test.py
Traceback (most recent call last):
File ".\spynner-test.py", line 10, in <module>
import spynner
File "C:\Anaconda\lib\site-packages\spynner\__init__.py", line 2, in <module>
from browser import *
File "C:\Anaconda\lib\site-packages\spynner\browser.py", line 56, in <module>
from PyQt4.QtNetwork import QNetworkCookie, QNetworkAccessManager, QSslConfiguration, QSslCipher
ImportError: DLL load failed: The specified procedure could not be found.
A funny thing is that I can import those things in normal python shell without any problem:
> python
Python 2.7.5 |Anaconda 1.9.2 (64-bit)| (default, Jul 1 2013, 12:37:52) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtNetwork import QNetworkCookie, QNetworkAccessManager, QSslConfiguration, QSslCipher
>>>
But after import spynner fails,
> python
Python 2.7.5 |Anaconda 1.9.2 (64-bit)| (default, Jul 1 2013, 12:37:52) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import spynner
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda\lib\site-packages\spynner\__init__.py", line 2, in <module>
from browser import *
File "C:\Anaconda\lib\site-packages\spynner\browser.py", line 56, in <module>
from PyQt4.QtNetwork import QNetworkCookie, QNetworkAccessManager, QSslConfiguration, QSslCipher
ImportError: DLL load failed: The specified procedure could not be found.
>>> from PyQt4.QtNetwork import QNetworkCookie, QNetworkAccessManager, QSslConfiguration, QSslCipher
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified procedure could not be found.
>>>

Okay I figured it out. The problem is that spynner first tries to import PySide, and it gets an error in importing QSslConfiguration from PyQt4.QtNetwork. And then it switches to PyQt4, and apparently the previously imported PySide makes the PyQt4 import fail. When I remove the try: part in browser.py I could import spynner fine.

Related

tried a lot but can't solve it in python 2.7.14

Working on a project Control your Computer with Hand Gestures using Arduino
but pyautogui is not supporting me.
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pyautogui
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pyautogui
File "C:\Python27\lib\site-packages\pyautogui\__init__.py", line 80, in <module>
import pyscreeze
SyntaxError: 'return' with argument inside generator (__init__.py, line 168)
>>>

Python asyncio '_overlapped' is not imported

Could not import asyncio library in virtualenv.
Python 3.6.4 x32
Win 10 x64
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>import asyncio
Traceback (most recent call last):
File "C:\Python36\Lib\asyncio\__init__.py", line 16, in <module>
from . import _overlapped
ImportError: cannot import name '_overlapped'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python36\Lib\asyncio\__init__.py", line 18, in <module>
import _overlapped # Will also be exported.
OSError: [WinError 0] The operation completed successfully
There is no module _overlapped in asyncio folder "C:\Python36\Lib\asyncio\". Also I know that asyncio is a part of Python from version 3.4.
What is wrong and what should i do? Could it be due to x64 Win and not x64 Python?

Python 3.6, Wine and asyncio - ImportError: cannot import name '_overlapped'

I'm trying to install Flask inside Wine so that I can package with cx_freeze. I've had it working for a while, but I've just added Flask to the project.
However, I can't seem to import Flask due to a missing library required by the core asyncio library. The cause of this is an import that is only included in windows systems called _overlapped. The code can be seen here.
I can confirm that there is a library contained within the dlls folder:
root#375a857194f3:/src# find /root/.wine -iname *overlapped*
/root/.wine/drive_c/Python36/DLLs/_overlapped.pyd
An example import and error message can be found below.
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
Traceback (most recent call last):
File "C:\Python36\lib\asyncio\__init__.py", line 16, in <module>
from . import _overlapped
ImportError: cannot import name '_overlapped'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python36\lib\asyncio\__init__.py", line 18, in <module>
import _overlapped # Will also be exported.
OSError: [WinError 10045] Windows Error 0x273d

err:module:import_dll Library python34.dll (which is needed by L"C:\\Python27\\lib\\site-packages\\PyQt4\\QtCore.pyd") not found

I've installed wine on Ubuntu, python2.7 and pyqt4 install. But when I try to import pyqt4, it shows the error :
john#Ubuntu-python:~/.wine$ wine python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtCore import *
err:module:import_dll Library python34.dll (which is needed by L"C:\\Python27\\lib\\site-packages\\PyQt4\\QtCore.pyd") not found
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: Module not found.

Importing Matplotlib.pyplot: DLL load failed

When trying to import matplotlib.pyplot (in Spyder), I get the following error(s):
Python 3.5.1 |Anaconda 2.5.0 (64-bit)| (default, Jan 29 2016, 15:01:46) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sympy as sp
>>> import numpy as np
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\...\Anaconda3_1\lib\site-packages\matplotlib\pyplot.py", line 36, in <module>
from matplotlib.figure import Figure, figaspect
File "C:\Users\...\Anaconda3_1\lib\site-packages\matplotlib\figure.py", line 35, in <module>
from matplotlib import _image
ImportError: DLL load failed: Operation did not complete successfully because the file contains a virus or potentially unwanted software.
If I try to import it again, I get the following:
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\...\Anaconda3_1\lib\site-packages\matplotlib\pyplot.py", line 36, in <module>
from matplotlib.figure import Figure, figaspect
File "C:\Users\...\Anaconda3_1\lib\site-packages\matplotlib\figure.py", line 35, in <module>
from matplotlib import _image
File "C:\Users\...\Anaconda3_1\lib\site-packages\matplotlib\_image.py", line 7, in <module>
__bootstrap__()
File "C:\Users\...\Anaconda3_1\lib\site-packages\matplotlib\_image.py", line 6, in __bootstrap__
imp.load_dynamic(__name__,__file__)
File "C:\Users\...\Anaconda3_1\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
My version of Python is the following:
Python 3.5.1 |Anaconda 2.5.0 (64-bit)| (default, Jan 29 2016, 15:01:46) [MSC v.1900 64 bit (AMD64)]
I'm guessing this is a false positive by my antivirus (Avast), though I still get the second error after turning it off. Reinstalling the module or Anaconda did not work either.
Is it possible that my antivirus keeps deleting the DLL, and if so, is there a way to stop it from doing so? Or is my problem something else entirely?
Many thanks!
I had this exact same problem with Avast and matplotlib. My solution was to uninstall Anaconda, then reinstall the same version and add C:\Anaconda3 to the excepted scan directory in Avast.

Categories

Resources