I need some advise here. I've installed ipython (sudo pip install ipython[all])
I've python 2.7, mac osx 10.9 64bits.
I'm trying to lunch qtconsole
camilo-mbp:mvc cami$ ipython qtconsole
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 8, in <module>
load_entry_point('ipython==2.2.0', 'console_scripts', 'ipython')()
File "/Library/Python/2.7/site-packages/IPython/__init__.py", line 120, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 563, in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/IPython/terminal/ipapp.py", line 321, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/IPython/core/application.py", line 381, in initialize
self.parse_command_line(argv)
File "/Library/Python/2.7/site-packages/IPython/terminal/ipapp.py", line 316, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<string>", line 2, in parse_command_line
File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 475, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<string>", line 2, in initialize_subcommand
File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 406, in initialize_subcommand
subapp = import_item(subapp)
File "/Library/Python/2.7/site-packages/IPython/utils/importstring.py", line 42, in import_item
module = __import__(package, fromlist=[obj])
File "/Library/Python/2.7/site-packages/IPython/qt/console/qtconsoleapp.py", line 58, in <module>
from IPython.external.qt import QtCore, QtGui
File "/Library/Python/2.7/site-packages/IPython/external/qt.py", line 23, in <module>
QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
File "/Library/Python/2.7/site-packages/IPython/external/qt_loaders.py", line 258, in load_qt
api_options))
ImportError:
Could not load requested Qt binding. Please ensure that
PyQt4 >= 4.7 or PySide >= 1.0.3 is available,
and only one is imported per session.
Currently-imported Qt library: None
PyQt4 installed: False
PySide >= 1.0.3 installed: False
Tried to load: ['pyside']
I've done the following command to set pyQt4 installed to True and is working ok
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
Now, I want to install pyside but a I've some errors:
camilo-mbp:mvc cami$ pip install pyside
Downloading/unpacking pyside
Downloading PySide-1.2.2.tar.gz (9.3MB): 9.3MB downloaded
Running setup.py egg_info for package pyside
Removing /private/var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip_build_cami/pyside/pyside_package
package init file 'pyside_package/PySide/__init__.py' not found (or not a regular file)
package init file 'pyside_package/pysideuic/__init__.py' not found (or not a regular file)
warning: no previously-included files matching '**' found under directory 'sources/pyside-examples/examples/hyperui'
warning: no previously-included files matching '**' found under directory 'sources/pyside-examples/mobility'
warning: no previously-included files matching '**' found under directory 'sources/shiboken/.git'
warning: no previously-included files matching '**' found under directory 'sources/pyside/.git'
warning: no previously-included files matching '**' found under directory 'sources/pyside-tools/.git'
warning: no previously-included files matching '**' found under directory 'sources/pyside-examples/.git'
warning: no files found matching '**' under directory 'pyside_package/PySide'
warning: no files found matching '**' under directory 'pyside_package/PySide/docs'
warning: no files found matching '**' under directory 'pyside_package/PySide/plugins'
warning: no files found matching '**' under directory 'pyside_package/PySide/imports'
warning: no files found matching '**' under directory 'pyside_package/PySide/translations'
warning: no files found matching '**' under directory 'pyside_package/PySide/include'
warning: no files found matching '**' under directory 'pyside_package/PySide/typesystems'
warning: no files found matching '**' under directory 'pyside_package/PySide/examples'
warning: no files found matching '**' under directory 'pyside_package/pysideuic'
warning: no files found matching '**' under directory 'pyside_package/pysideuic/Compiler'
warning: no files found matching '**' under directory 'pyside_package/pysideuic/port_v2'
warning: no files found matching '**' under directory 'pyside_package/pysideuic/port_v3'
warning: no files found matching '**' under directory 'pyside_package/pysideuic/widget-plugins'
Installing collected packages: pyside
Running setup.py install for pyside
Removing /private/var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip_build_cami/pyside/pyside_package
Python architecture is 64bit
error: Failed to find cmake. Please specify the path to cmake with --cmake parameter.
Complete output from command /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/private/var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip_build_cami/pyside/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip-AjpsAb-record/install-record.txt --single-version-externally-managed:
Removing /private/var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip_build_cami/pyside/pyside_package
running install
running build
Python architecture is 64bit
error: Failed to find cmake. Please specify the path to cmake with --cmake parameter.
----------------------------------------
Cleaning up...
Command /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python - c "import setuptools;__file__='/private/var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip_build_cami/pyside/s etup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install -- record /var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip-AjpsAb-record/install-record.txt -- single-version-externally-managed failed with error code 1 in /private/var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip_build_cami/pyside
Storing complete log in /Users/cami/Library/Logs/pip.log
I tried to install cmake
camilo-mbp:mvc cami$ pip install cmake
Downloading/unpacking cmake
Could not find any downloads that satisfy the requirement cmake
Cleaning up...
No distributions at all found for cmake
Storing complete log in /Users/cami/Library/Logs/pip.log
camilo-mbp:mvc cami$
What else should I do ?
Thanks in advance
Since I know, cmake is not a python package. It is a build tool. So, all you have to do is install it. You can get it from here: CMake site
Also, you should check if the Apple development tools does have cmake already.
The documentation about building and installing PySide on MacOSX is here http://pyside.readthedocs.org/en/latest/building/macosx.html
Problem statement Qtconsole import error or conflict.
This is the exact error message I was getting
File "uikit/ipython.py", line 5, in <module>
ImportError: No module named qt.console.rich_ipython_widget
[28603] Failed to execute script bosetap
Currently-imported Qt library: 'pyqt'
PyQt4 installed: False
PyQt5 installed: False
PySide >= 1.0.3 installed: False
PySide2 installed: False
Tried to load: ['pyqt']
you can dig into uikit/ipython.py and see there is an try catch block around the import of new vs old libraries and the following.
QT_API = os.environ.get('QT_API', None)
if QT_API not in [QT_API_PYSIDE, QT_API_PYSIDE2, QT_API_PYQT, QT_API_PYQT5, None]:
raise RuntimeError("Invalid Qt API %r, valid values are: %r, %r, %r, %r" %
(QT_API, QT_API_PYSIDE, QT_API_PYSIDE2, QT_API_PYQT, QT_API_PYQT5))
if QT_API is None:
api_opts = [QT_API_PYQT5, QT_API_PYSIDE2, QT_API_PYSIDE, QT_API_PYQT]
else:
api_opts = [QT_API]
step 1) I started running things by hand at a python prompt and I convinced myself that qt.console was installed correctly. If you find you can not do this. Install the missing module.
pip install qtconsole
Step 2) if you are using pyqt4 make sure you exclude pyqt5, pyside, and pyside2 modules in your pyinstaller spec file. It might look something like this. This goes in the analysis section
excludes=['pyqtgraph.graphicsItems.PlotItem.plotConfigTemplate_pyqt5',
'pyqtgraph.graphicsItems.PlotItem.plotConfigTemplate_pyqt5',
'pyqtgraph.graphicsItems.ViewBox.axisCtrlTemplate_pyqt5',
'pyqtgraph.GraphicsScene.exportDialogTemplate_pyqt5',
'PyQt5',' PyQt5.QtCore','PyQt5.QtGui','PyQt5.QtPrintSupport',
'PyQt5.QtSvg','PySide','PySide2'],
This might have been overkill. Once I got it working, I didn’t want to touch it. The optimization is left as an exercise for the reader.
Step3) I’m going to tell you the solution first and then how to get there. The problem was that pyinstaller was putting my pyqt4 executables at the top level in the package. Qtconsole was looking for them in a PyQt4 directory. The following goes in the exe section of your spec file.
a.binaries + [('PyQt4/QtCore.so','/usr/lib/python2.7/dist-packages
PyQt/QtCore.so','BINARY'), ('PyQt4/QtGui.so','/usr/lib/python2.7/dist-packages
/PyQt4/QtGui.so','BINARY'), ('PyQt4/QtOpenGL.so','/usr/lib/python2.7/dist-packages
/PyQt4/QtOpenGL.so','BINARY'), ('PyQt4/QtSvg.so','/usr/lib/python2.7/dist-packages
/PyQt4/QtSvg.so','BINARY'), ('PyQt4/QtTest.so','/usr/lib/python2.7/dist-packages
/PyQt4/QtTest.so','BINARY'), ('PyQt4/QtXml.so','/usr/lib/python2.7/dist-packages
/PyQt4/QtXml.so','BINARY') ],
So, the bad part about this solution is we now get warnings that we have the same executable in two places. The optimization is left as an exercise for the reader. Honestly, I haven’t figured out how to resolve this yet. So, if you do… it would be nice to hear from you. This is how I got to step 3. I think this part is important. I added this to my spec file just for development, not for the customer’s package. The problem with developing the package was it was failing to run and then the tmp/ directory would remove itself. I couldn’t see what the problem was. I knew I had pyqt4 installed and that the application ran by hand. It was very frustrating. So, if you do the below to your spec file you will get a directory built instead of an executable. That directory stays and you can peak inside and see what is going on. Then, you are armed and dangerous to enable the solution. Then when you have it working, you revert this to develop an executable for your customer.
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='bosetap',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='bosetap')
Special thanks to my boss as I banged my head against this for 1 week. Happy Trails.
来源:https://stackoverflow.com/questions/25752315/error-loading-ipython-qtconsole