Issue
Note: My first attempt at asking a question was confusing PyQt and pyqt_fit. I've preserved my first attempt below for archival purposes. It seems clear that PyQt should be a prerequisite to getting pyqt_fit working.
I installed PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x64.exe, available here. I see pyqt-4.10.4-py27_1.tar in \Anaconda\pkgs, and if I run the installer again, it tells me it's installed.
Unfortunately, it seems that iPython still isn't finding it:
In [5]: from PyQt4 import QtCore, QtGui
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-5-5a7197379ef6> in <module>()
----> 1 from PyQt4 import QtCore, QtGui
ImportError: No module named PyQt4
How can I troubleshoot why it's not finding this?
System specs
- Python 2.7.9 :: Anaconda 2.2.0 (64-bit)
- OS Name: Microsoft Windows 8.1
- OS Version: 6.3.9600 N/A Build 9600
- OS Configuration: Standalone Workstation
- OS Build Type: Multiprocessor Free
- System Manufacturer: Dell Inc.
- System Model: Inspiron 5547
First attempt at question
I installed PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x64.exe, available here, in the understanding that it would give me "everything needed for PyQt4 development except for Python itself." Instead, though, I'm finding that importing pyqt_fit and pyqt_fit1d is giving me errors seemingly related to compilation.
Summary
I'm trying to import these through the iPython prompt and iPython Notebook, and I have a hunch they're looking at somewhat different instances of pyqt*, but I don't know how to confirm this intuition.
When I tried to import pyqt_fit or pyqt_fit1d, I got a "DistutilsPlatformError: Unable to find vcvarsall.bat". I installed the Microsoft Visual C++ Compiler for Python 2.7, and hacked the registry a bit to get it to not complain about not finding vcvarsall.bat, but the compilation still fails.
It seems like working at the compiler level shouldn't be necessary if the installer worked. What am I not understanding?
Observed behavior from an iPython prompt
Typing "import pyqt[Tab]" suggests only pyqt_fit1d and pyqtconfig.
import pyqtconfig
fails withImportError: No module named sipconfig
. (I believe this used to work only at the iPython prompt before I installed the VC++ stuff.)import pyqt_fit1d
fails the first time withImportError: Building module pyqt_fit._kernels failed: ["CompileError: command 'C:\\\\Users\\\\<username>\\\\AppData\\\\Local\\\\Programs\\\\Common\\\Microsoft\\\\Visual C++ for Python\\\\9.0\\\\VC\\\\Bin\\\\amd64\\\\cl.exe' failed with exit status 2\n"]
. Complete backtrace here.On subsequent attempts, it fails with
ImportError: cannot import name functions
in C:\Anaconda\lib\site-packages\pyqt_fit__init__.py.import pyqt_fit
behaves exactly the same.
Observed behavior from an iPython notebook
Typing "import pyqt[Tab]" in a new notebook suggests only pyqtconfig.
import pyqtconfig
getsImportError: No module named sipconfig
, as at iPython prompt.import pyqt_fit1d
fails withImportError: No module named pyqt_fit1d
-- Note difference from iPython prompt aboveimport pyqt_fit
fails with the same ```ImportError: Building module pyqt_fit._kernels failed: ["CompileError: command 'C:\\Users\\\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2\n"]
Solution
pyqt_fit
appears to be a completely separate package, not maintained by the PyQt developers.
To use PyQt4, you want to try from PyQt4 import QtCore, QtGui
. I suspect the auto-completion of your python terminal just doesn't know about the PyQt package you installed.
Answered By - three_pineapples
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.