import PySide results in a segmentation fault - python

I've been searching for quite a while and haven't found any questions addressing this specific scenario.
I used pip to successfully build and install PySide (and a bunch of other packages) in python3.4.4 using RedHat 6.6 and GCC 4.4.5. However, python seg faults when I import PySide:
> python3.4
Python 3.4.4 (default, Mar 1 2016, 15:30:00)
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import PySide
Segmentation fault
>
The same thing happens if I do "from PySide import QtCore".
Does anyone know of an issue in this regard?
Can anyone suggest a method of debugging this?
Note: python was built on this same node with the same compiler, and seems to otherwise work fine. It was installed with "make altinstall" because python2.7.11 and python3.5.1 are also installed (all with "make altinstall").
Thanks much for any help.

Related

PyQt5.QtWidgets.QApplication crashes after update to mojave with missing cocoa plugin error

Since updating my macbook to mojave I am unable to create a QApplication object in python2.7
Python 2.7.15 (default, Jan 9 2019, 18:18:40)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5 import QtWidgets
>>> _app = QtWidgets.QApplication(['any'])
qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Abort trap: 6
I've tried reinstalling python and pyqt (using homebrew), I made sure homebrew was up to date and fixed all the missing dependencies in brew doctor (there were a few warnings but they seem unrelated).
I guess I'm missing this cocoa plugin (I don't know what it's for) but I'm not sure where to install it from. I've found a few similar issues but they seem to relate to building an application - I'm not sure how I apply the fixes to running QApplication inside python.

Is it possible to use ipython based on a builtin python

I am using paraview 4.3.1 in Centos 7. There is a built-in python named pvpython:
Python 2.7.2 (default, Jan 15 2015, 09:36:49)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys;sys.path
['', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/vtk', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python27.zip', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python2.7', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python2.7/plat-linux2', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python2.7/lib-tk', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python2.7/lib-old', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python2.7/lib-dynload', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python2.7/site-packages']
>>>
The problem is, original pvpython do not support many useful features such as code completion. And there is no setup_tools in the pvpython, so I cannot install new modules to the built-in python.
Could anyone help me to install ipython on this built-in python?
See the install instructions for get-pip:
https://pip.pypa.io/en/latest/installing.html
However, you must use the pvpython instead of python when using the install instructions.
Depending on how you install it, you may end up with more than one easy_install or pip on your path. Just make sure you're using the one associated with pvpython - look at the script you're running to find out (it's just a shell script).
Once you've done that, installing ipython should be the same as installing it with any other version of python (assuming that pvpython doesn't break anything that ipython needs).

Multiple Python Version Multiple Modules

I have installed on Mac OS X 10.10:
I have installed Python 2.7.6 default apple
2.7.9 python mac ports
and
Pypy.
When i type pip freeze there a lot of modules installed.
However i can import some modules on one python and not the other one, because not everybody finds all modules.
Can someone explain me how can i achieve that every python version find every installed module?
(and does pip show all installed modules?)
As far as i can tell all modules are at : /Library/Python/2.7/sites-packages. But i don't know why not every python looks there.
How about using virtualenv to manage multiple python? https://virtualenv.pypa.io/en/latest/
If you are not sure about which module you are importing, you could try to print the file of the module ( if the module has this attribute). eg:
macbook:~ mac$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4 as f
>>> print f.__file__
/Library/Python/2.7/site-packages/PyQt4/__init__.pyc
python will search the PYTHONPATH setting and try to load the module, if there are multiple python module with same name, it actually loads the 1st one.

I cannot import igraph on python 2.6 after installation

I installed igraph for python 2.6 on OSX 10.7, but I cannot import igraph library.
It shows a import error:no module name igraph.
I have no idea. Please help me out.
Thanks.
However, I cannot run code with python. I make a code, and tried to run, such as, 'python ex.py'
OK, even though you didn't answer most of my questions, I'm pretty sure I can guess your problem. Your question title is "I cannot import igraph on python 2.6 after installation", but you're not trying to import it on python 2.6, you're trying on 2.7.
$ python
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import igraph
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named igraph
>>>
$ python2.6
Python 2.6.7 (r267:88850, Jun 20 2012, 16:23:38)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import igraph
>>>
See the difference? OS X 10.7 (and 10.8) comes with three versions of Python: 2.5, 2.6, and 2.7. They're entirely independent installations, so when you installed igraph for Python 2.6, that didn't install it for your 2.5 or 2.7 installations.
The default, the one you get when you just run python, is 2.7. If you want a specific version, you have to run python2.6 instead.
So, you either need to run python2.6, or install igraph for 2.7.
As a side note, if you've installed any third-party Python installations, you're going to get yourself even more confused, so please, don't do that (or uninstall if you already have) until you really know what you're doing.

Python Error The _posixsubprocess module is not being used

Hi im running a subprocess with threads trough a python wrapper and I get the following warning when I use the subprocess module.
"The _posixsubprocess module is not being used, Child process reliability may suffer if your program uses threads."
What dose this mean?
How can I get rid of it?
check if you can import _posixsubprocess manually, subprocess tries to import this in it's code, if it produces an exception this warning is produced.
unsetting PYTHONHOME has fixed this issue for me.
I had the same issue with a tool that was installed with conda. Turned out that there was kind of a conflicting version of subprocess32 that came from pip. Running this did the trick:
pip uninstall subprocess32
conda install -c conda-forge subprocess32
The solution for me was to do the following:
pip uninstall subprocess32
pip install -U subprocess32
Intially, I was getting a warning when I tried to import matplotlib:
Python 2.7.13 (default, May 16 2017, 12:02:12)
[GCC 6.2.0 20160901] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
/home/methuselah/.local/lib/python2.7/site-packages/subprocess32.py:472: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
"program uses threads.", RuntimeWarning)
>>>
After reinstalling subprocess32, the warning goes away:
Python 2.7.13 (default, May 16 2017, 12:02:12)
[GCC 6.2.0 20160901] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>>
It could be if you have more than a version of Python in use.
you need to specify the correct version of python to use for each programme.
For example, I need python 3.7 for miniconda, but mendeleydesktop claims for trouble with this version:
also problem with _posixsubproces and its location
so instead of run the program in a phyton enviroment only I use python2.7, and it solve the problem.
Hope it helps.
Cheers,
Flor

Categories