"ImportError: No module named PyQt42 - python

I am trying to import spynner into my python program (import spynner) ... when I run the script, I receive the following error message:
Traceback (most recent call last):
File "C:\Users\Michael\Desktop\webscraper.py", line 2, in <module>
import spynner
File "build\bdist.win32\egg\spynner\__init__.py", line 2, in <module>
File "build\bdist.win32\egg\spynner\browser.py", line 52, in <module>
ImportError: No module named PyQt4
I then tried to install this module called PyQt4 (pip install PyQt4), which resulted in the following error message:
Could not find any downloads that satisfy the requirement Pyqt4
How can this problem be solved?

PyQt is available for download from Riverbank.
You can get PyQt4 here: http://www.riverbankcomputing.com/software/pyqt/download
They have links to both the source (so you can build it yourself) or binary packages.
If you need the PyQt documentation for the various classes the framework provides, you get get that from here

Related

My library isn't recognized by python 3 even though I am certain that it is installed

I'm certain that I have installed the library using pip and it has returned the confirmation that it has been installed. When the import command is run, it throws a ModuleNotFoundError.This problem is not exclusive to this particular library and none of the libraries that are not included in the python default package works.
The code is:
>>> from PyQt5 import Qwidgets Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'Qwidgets' from 'PyQt5' (C:\Users\Franklin Joe\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PyQt5\__init__.py)

Module method showing strange behavior

Guys I'm facing a problem on using this module which i install from pip currently my OS is Windows python36 64bit version is install. When i'm using and try to import this module
from drawtree import draw_level_order
draw_level_order('{3,9,20,#,#,15,7}')
Why python giving strange errors like this
Traceback (most recent call last):
File "C:/Users/Root/PycharmProjects/untitled/src/Test.py", line 1, in <module>
from drawtree import draw_level_order
File "C:\Python36-64\lib\site-packages\drawtree\__init__.py", line 7, in <module>
from drawtree import draw_bst, draw_random_bst, draw_level_order
ImportError: cannot import name 'draw_bst'
The version of drawtree on PyPI is not currently compatible with Python 3. There's a Python 3-compatible version on Github, if you really want to use drawtree on Python 3.

Python Path error - No Module Found error

I'm having issues running ortools on Linux. I downloaded it from google's site (https://developers.google.com/optimization/) and installed it using "make install," but when I go to use it in python I get the following:
Traceback (most recent call last):
File "regular.py", line 42, in <module>
from ortools.constraint_solver import pywrapcp
File "/home/m3/summer/ortools_examples/examples/python/ortools.py", line 2, in <module>
ImportError: No module named linear_solver
It looks like despite installing ortools, its still not in my python path correctly, so when I call it in the file, it doesn't find anything and returns an error, right? Any advice on how to solve this?

Python igraph import error on Windows

I've installed igraph form .whl file using pip install. When I was trying to test the correctness of installation
import igraph.test
igraph.test.test()
I got this error:
Traceback (most recent call last):
File "D:/Nauka/Praca-inzynierska/Barabasi-Albert.py", line 4, in <module>
import igraph.test
File "D:\Programy\Python 3.5\lib\site-packages\igraph\__init__.py", line 34, in <module>
from igraph._igraph import *
ImportError: No module named 'igraph._igraph'
(the same error pops out if I'm trying to import igraph not igraph.test).
I've tried adding path (I don't know if this is rigth):
import sys
sys.path.append ("D:/Programy/Python 3.5/Lib/site-packages/igraph")
but it didn't work.
One thing I discovered is that if I delete "__init__" file from igraph folder I can import igraph without error, but it doesn't work for igraph.test.
If it's relevant I have Python 2.7 installed on my machine alongside Python 3.5.
Thank you in advance for any help.

Selenium - no module named http.client

I just installed Selenium (from source) for Python 2.7.
When I try to import selenium, I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\selenium-2.25.0-py2.7.egg\selenium\__init__.py", line 16, in <module>
from .selenium import selenium
File "C:\Python27\lib\site-packages\selenium-2.25.0-py2.7.egg\selenium\selenium.py", line 19, in <module>
import http.client
ImportError: No module named http.client
What could be causing this? If I remember correctly, http.client is a python 3 module. Why is selenium trying to import it?
Thanks to the help of DSM, I figured it out. Because I had previously ran setup.py with a python3 executable by accident, the selenium build folder was populated with 2to3 converted code. When I later ran python27 setup.py install it ended up using the same build folder for the installation without overwriting its content. I ended up deleting the build folder and trying again, and it works.

Categories

Resources