I am new to coding and trying to run a .py. I am using Koopatlas and Koopuzzle to create NSMBW Maps. I have installed PyQt4 (I checked brew list) and Python but when I run it it says this:
Traceback (most recent call last):
File "Koopuzzle.py", line 10, in <module>
from PyQt4 import QtCore, QtGui
ImportError: No module named PyQt4
They're both in .py format, and they both give the same results.
I've checked online sources but I've found nothing. Does someone know how to solve?
Thanks, Gunner
Related
I have been coding an python application in PyCharm and I have had an issue when trying to run to program on other devices. When cloning the repo on my laptop I keep getting this error:
Traceback (most recent call last):
File "/home/matthew/PycharmProjects/HealthTrackerForRachel/Main.py", line 4, in <module>
from PyQt5 import QtWidgets
ModuleNotFoundError: No module named 'PyQt5'
I have done pip install PyQt5 on my current computer so it should have the module. I am also using venv so could this be causing an issue?
I think the problem has to do with installing PyQts5. here the question was answered already ImportError: No module named PytQt5.
I'm trying to work out how to use pyqtgraph so that I can use it.
I've tried to run this block of code which I found on the pyqtgraph website
import pyqtgraph.examples
pyqtgraph.examples.run()
But it always throws this error
Traceback (most recent call last):
File "/Users/willemhandreck/Code/Misc.Projects/heater_alert/python/plotly_test.py", line 1, in <module>
import pyqtgraph.examples
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyqtgraph/__init__.py", line 13, in <module>
from .Qt import QtGui
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyqtgraph/Qt.py", line 35, in <module>
from PySide import QtGui, QtCore, QtOpenGL, QtSvg
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PySide/QtGui.so, 2): Library not loaded: libpyside-python2.7.1.2.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PySide/QtGui.so
Reason: image not found
How would I fix this?
Yep, same problem here if I try to use the built-in python on the mac.
My solution is to use the anaconda python distribution:
1) Download & install Anaconda python, which already has all the right scientific modules installed. http://continuum.io/downloads#all
2) Restart your terminal and ensure you have anaconda as your python:
$ which python
/Users/caleb/anaconda/bin/python
3) Then install pyqtgraph:
$ pip install pyqtgraph
...
Successfully installed pyqtgraph-0.9.10
4) Run the examples from the command line:
$ python -m pyqtgraph.examples
or use your import... run method above.
-Caleb
This is actually a good thing.
The system python ships installed and configured to run system utilities. It's a good idea to have a separate playpen for special packages, tweaks, upgrades, experiments.
Anaconda makes it autoeasy by containing itself and its packages all within its own directory and prevents messing up anything else.
http://www.reddit.com/r/Python/comments/39qeq6/anaconda_pros_cons_mac_os_x/cs5mxwk
I am trying to use the pyside tool on Windows to make a python file out of a .ui
I've installed pyside version 1.2.1-6 from the canopy distribution.
C:\Users\nick\Desktop\pump_project>pyside-uic.exe history_dialog.ui -o kalimera.py
Traceback (most recent call last):
File "c:\users\nick\appdata\local\enthought\canopy\user\scripts\pyside-uic-scr
ipt.py", line 8, in <module>
from PySide.scripts.uic import main
ImportError: No module named scripts.uic
Perhaps an error in your .ui?
pyside-uic apparently works fine for me, at least doesn't fail (using Canopy 1.4.1) compiling this example .ui -- https://qt.gitorious.org/pyside/pyside-examples/source/d4e4c7fdf71ab52083e49ffdea1b7daeff6c8d8d:examples/pyuic/demo.ui
Hi everyone and thanks for reading. I'm packaging my python code in a single file using pyinstaller, but when I run my packaged file I get the following error:
Traceback (most recent call last):
File "<string>", line 21, in <module>
File "C:\Users\****\Desktop\pyinstaller-2.0\pyinstaller-2.0\PyInstaller\loader\iu.py", line 409, in importHook
ImportError: No module named PyQt4.QtCore
I don't know what this error is telling me, especially since there is no dir name pyinstaller-2.0 on my desktop and I did not use PyQt4 at all.
Imported modules: Tkinter, tkFileDialog, tkMessageBox, multiprocessing, os, sys, time, numpy, scipy.weave, pywt, matplotlib.pyplot
I think the problem is related to multiprocessing, since I did not experience this error before. I used this recipe to implement the multiprocessing module correctly.
If you were using PyQt then the only way to import the modules with PyInstaller is to use
from PyQt4 import QtCore, QtGui
rather than
import PyQt4.QtCore, PyQt4.QtGui
which your error implies. However, you say that you're not using PyQt.
PyQt is an optional dependency of matplotlib so there is a chance that PyInstaller is checking the matplotlib module and consequently including PyQt.
I would suggest excluding the PyQt module from the build; in your .spec file, search out the line for the Analysis class - something like
Analysis( ..., excludes=['PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui'])
and edit the excludes keyword arg as suggested above.
I want to use PyQt4 from a network location.
I installed Python 2.6.4 x32 in a client and kept PyQt4 x32 module in a network share (for Ex: "\share\Pyton_Modules\x32").
when opened python i did as below and it worked
import sys
sys.path.append(r'\\share\Pyton_Modules\x32')
from PyQt4 import QtGui
everything worked fine.
But i tested the same way for python 2.6.4 x64 in a client and keeping PyQt4 x64 in a network share (for Ex : "\share\Pyton_Modules\x64")
when opened python i did as below and it didn't worked
import sys
sys.path.append(r'\\share\Pyton_Modules\x64')
from PyQt4 import QtGui
i get below error
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
from PyQt4 import QtGui
ImportError: DLL load failed: The specified module could not be found.
I found a solution to overcome my situation.
I moved all the files from PyQt4\bin to PyQt4 and it worked without any issue...
Hope this could help someone.