Python Cannot Find Module Located in Sub-Directory when Importing QAxContainer from PyQt5 - import

Python appears to be unable to locate the module QAxContainer in PyQt5. The package was installed using Conda and is present in a sub-directory of PyQt5 but cannot be located. Additional testing with pip resulted in the same error.
Ubuntu 20.04
Python 3.8.5
conda list
pyqt5 5.15.2 pypi_0 pypi
from PyQt5 import QAxContainer
ImportError: cannot import name 'QAxContainer' from 'PyQt5' (/home/brian/anaconda3/lib/python3.8/site-packages/PyQt5/init.py)
However, qaxcontainer.py is present in /home/brian/anaconda3/lib/python3.8/site-packages/PyQt5/uic/widget-plugins

There should be QAxContainer.pyd and QAxContainer.pyi at /home/brian/anaconda3/lib/python3.8/site-packages/PyQt5/. If you dont have them maybe there's a problem with the package, try reinstalling PyQt5.

According to antonio2924, QAxContainer.pyd and QAxContainer.pyi should be located at /home/brian/anaconda3/lib/python3.8/site-packages/PyQt5/. The .pyd file extension is specific to Windows. Furthermore:
The QAxContainer module is a Windows-only extension for accessing
ActiveX controls and COM objects. See, https://doc.qt.io/qt-5/qaxcontainer-module.html
I am running Ubuntu 20.04, which explains why QAxContainer is not being installed.

Related

PyAudio import error : ImportError: DLL load failed: The specified module could not be found

I encountered an import problem by PyAudio.
I have a winodws 10, 64 bit, and use Anaconda and Spyder IDE with python 3.7.
I installed PyAudio in Ananconda, ran as administrator, with these commands :
cd
conda install -c conda-forge PyAudio
The installation ran without any problems.
I then restarted both Anaconda and SPYDER. PyAudio now shows up in Anaconda's list of installed packages.
When I try to import Pyaudio in Spyder (IPython console), I encounter this error message :
[1]: import pyaudio
Could not import the PyAudio C module '_portaudio'.
Traceback (most recent call last):
File "", line 1, in
import pyaudio
File "C:\ProgramData\Anaconda3\lib\site-packages\pyaudio.py", line 116, in
import _portaudio as pa
ImportError: DLL load failed: The specified module could not be found.
I tried to fix it by answers to similar ImportError message issued, while other users tried to import other packages like SKlearn ... , but with no success.
Your problem (and mine) are the same. The issue is, unfortunately, the version of python you're running (in tandem with your OS).
Check out this link:
https://people.csail.mit.edu/hubert/pyaudio/#:~:text=Note%3A%20As%20of%20this%20update,4.
Under the INSTALLATION section in the link for WINDOWS, PyAudio's latest version (0.2.11) is compatible with Python versions: 2.7, 3.4, 3.5, 3.6.
My current python is 3.8.5, so you (and I) could never use PyAudio unless they added compatibilities or we revert to an above python version.
I tried to install portaudio using
conda install portaudio
but it seems like it didn't work as it should be. However,
conda install -c anaconda portaudio
solved the problem.
see the official anaconda page

ImportError: No module named pytesseract on Jupiter lab and VSCode but not my local

I have tried running a ProcessImage.py file in which I import the package pytesseract in Jupiter Lab and VSCode.
This is the error that pops out :
import pytesseract
ImportError: No module named pytesseract
I already know that pytesseract is installed in my environment because with conda list:
pytesseract 0.3.2 py_0 conda-forge
pytest 5.3.5 py38_0 coda-forge
However, if I run my ProcessImage.py file on my local no error is prompted.
I know the error is related to paths in Jupiter Lab and VsCode but I can't seem to find a solution.
Have you tried to launch your python file using Ctrl+F5 command for run?
I had this same ImportError when trying to launch my python program using the .run extension. It persistently started python 2.7 while my environment was using Python3. I first thought that it was a VS code error but it wasn't.

wkhtmltopdf not working in Eclipse and/or Spyder

Trying to export a webpage as pdf in Eclipse or Spyder, I can successfully run the following script in the Mac terminal:
import pdfkit
import wkhtmltopdf
pdfkit.from_url('http://google.com', 'out.pdf')
But, this script does not work in either Eclipse PyDev or Anaconda Spyder giving the following error:
IOError: No wkhtmltopdf executable found: ""
If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf
ERROR: Module: xxxx could not be imported (file: /Users/MyMac/Documents/myproject/mwe.py).
Note that I am using Python 2.7 and it seems wkhtmltopdf does not work properly in Python 3.*
Also, I have added wkhtmltopdf's folder to PYTHONPATH.
You need to add the ..\wkhtmltopdf\bin to your PYTHONPATH.
In Eclipse go to project -> properties -> PyDev-PYTHONPATH and at the register External Libraries add your source folder (full path to ..\wkhtmltopdf\bin).

anaconda packages installed but not found

I have a new macbook air running yosemite and I have installed Anaconda.
I want to practise on making GUIs with either wxpython.
When I run " conda list" wxpython is there, but when I import it I get "No module named wxpython" .
Any ideas how to fix this? Anaconda is added to my path in the bash_profile.
Regards
According to this it looks like the correct way to import this package is import wx. Try that.
It's possible you might run into a cairo error like this:
ImportError: /usr/lib64/libpangocairo-1.0.so.0: undefined symbol: cairo_ft_font_options_substitute. I was able to get around this by installing the cairo package via conda install -c https://conda.anaconda.org/pmuller cairo.

ImportError: No module named zope.interface

I am trying to run server for iphone using http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server
My machine is mac 10.6.8
Python version : 2.7.3
I dont have any knowledge regarding python.
i have installed Twisted-12.1.0 additionally but still i am getting this error.
Traceback (most recent call last):
File "chatserver.py", line 1, in
from twisted.internet.protocol import Protocol, Factory
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twisted/internet/protocol.py", line 15, in
from zope.interface import implements
ImportError: No module named zope.interface
later i have downloaded zope.app.wsgi-3.15.0 4 but i dont know how to use it.
The problem is that an __init__.py file is not present under zope directory so this directory is not scanned for imports.
Creating a blank __init__.py file under zope directory will do the trick.
I solved this error in UNIX by browsing to the zope directory by executing:
$touch __init__.py
I can confirm that this works also with virtualenv pip installation of zope interface
Here's a solution
It says that installing a zope module through pip breaks your zope installation because pip installs it in another directory other than the original zope module directory.
From the link
After install a zope module using pip, for example z3c.password your
zope installation gets broken.
This is because pip have installed the module in
/usr/local/lib/python2.6/dist-packages/zope and the original module
zope.interface is in /usr/share/pyshared/zope/interface/ and has minor
relevance when importing.
What worked for me is (also given in the link):
cd /usr/local/lib/python2.7/dist-packages/zope
sudo ln -s /usr/share/pyshared/zope/interface/
Off the top of my head you can use easy_install for this.
You will need the python-setuptools then you should be able to use
easy_install zope.interface
If I remember correctly however twisted should be installed as part of OS X python install. Do a quick Google for installing zope.interface for Mac OS X. As twisted is such a widely used library there is plenty of information out there.