Python Error The _posixsubprocess module is not being used - python

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

Related

Python 3.6.x + Windows: Interpreter just shuts down for any external library

Due to external dependencies I need to run python 3.6.x (I know it is EOL) on Windows.
However, any external library causes the interpreter to just silently quit.
As an example I have installed numpy in the following way
py -m pip install numpy
And then running Python through PowerShell:
PS C:\Users\USER> py
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
PS C:\Users\USER>
As soon as I run import numpy the python interpreter simply silently returns.
I have tried to install every python 3.6.x available from Pythons official website, and the issue persists.
I fully removed old versions of python between each install.
I cannot find any error logs or anything.
What can be the issue here and how can I debug further?
Any internal library (that I have tried) works
I have tried with the following libraries:
Numpy
Tensorflow
Protobuf
matplotlib
scipy
pandas
nose
sympy

python module import error when running, while imported fine in interactive mode

I've created a clean python3.6 virtualenv in a native python2 environment via anaconda3, and I'm able to import some module in the interactive mode:
$ python
Python 3.6.3 |Anaconda, Inc.| (default, Oct 13 2017, 12:02:49)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from skimage.transform import resize
>>>
however, this seems to break when I run in a non-interactive mode by calling:
(py3)$ python filename.py
...
File "path_to_module.py", line 6, in <module>
from skimage.transform import resize
...
ImportError: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by path_to_pyenv/anaconda3/lib/python3.6/site-packages/matplotlib/_path.cpython-36m-x86_64-linux-gnu.so)
Note this error does not occur exclusively by importing this particular skimage module, so i guess this is a generic error.
Anyone has an idea how to fix this?
Thanks!
turns out that the native matplotlib coming with Anaconda was outdated, so i fixed this error by upgrading it:
pip install matplotlib --upgrade

Python 3.6.4 error: help('modules') and tornado pyzmq?

Strange error on python 3.6.4 :
C:\Python364>python.exe
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> help('modules')
Please wait a moment while I gather a list of all available modules...
C:\Python364\lib\site-packages\IPython\kernel\__init__.py:13: ShimWarning: The `
IPython.kernel` package has been deprecated since IPython 4.0.You should import
from ipykernel or jupyter_client instead.
"You should import from ipykernel or jupyter_client instead.", ShimWarning)
C:\Python364\lib\site-packages\qtawesome\iconic_font.py:268: UserWarning: You need to have a running QApplication to use QtAwesome!
warnings.warn("You need to have a running "
C:\Python364\lib\pkgutil.py:107: VisibleDeprecationWarning: zmq.eventloop.minitornado is deprecated in pyzmq 14.0 and will be removed.
Install tornado itself to use zmq with the tornado IOLoop.
yield from walk_packages(path, info.name+'.', onerror)
IPython bleach imghdr rope
The error is not show after I install nose python module and run again :
help('modules')
I don't think this error is not solved.
How to check and fix this error ?
You can ignore these warnings. Some of the packages you have installed contain deprecated modules that should not be used in new code but are still provided for backwards compatibility. help('modules') imports everything it can, so it looks like it's trying to use these deprecated modules and triggers the warning.
If you see these warnings anywhere other than help('modules'), action may be required.

import PySide results in a segmentation fault

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.

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).

Categories