Zombie process running xlwings - xlwings

I get a python error when attempting to use xlwings. Just importing xlwings seems to be sufficient to trigger the problem.
Lewis-MacBook-Air:~ lewis$ python
Python 2.7.10 |Anaconda 2.3.0 (x86_64)| (default, Oct 19 2015, 18:31:17)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import xlwings
>>> xlwings.__version__
'0.6.0'
>>> exit()
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/Users/lewis/anaconda/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Users/lewis/anaconda/lib/python2.7/site-packages/xlwings/_xlmac.py", line 47, in clean_up
if is_excel_running():
File "/Users/lewis/anaconda/lib/python2.7/site-packages/xlwings/_xlmac.py", line 98, in is_excel_running
if proc.name() == 'Microsoft Excel':
File "/Users/lewis/anaconda/lib/python2.7/site-packages/psutil/__init__.py", line 539, in name
cmdline = self.cmdline()
File "/Users/lewis/anaconda/lib/python2.7/site-packages/psutil/__init__.py", line 592, in cmdline
return self._proc.cmdline()
File "/Users/lewis/anaconda/lib/python2.7/site-packages/psutil/_psosx.py", line 209, in wrapper
raise ZombieProcess(self.pid, self._name, self._ppid)
ZombieProcess: psutil.ZombieProcess process still exists but it's a zombie (pid=71)
Error in sys.exitfunc:
Traceback (most recent call last):
File "/Users/lewis/anaconda/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Users/lewis/anaconda/lib/python2.7/site-packages/xlwings/_xlmac.py", line 47, in clean_up
if is_excel_running():
File "/Users/lewis/anaconda/lib/python2.7/site-packages/xlwings/_xlmac.py", line 98, in is_excel_running
if proc.name() == 'Microsoft Excel':
File "/Users/lewis/anaconda/lib/python2.7/site-packages/psutil/__init__.py", line 539, in name
cmdline = self.cmdline()
File "/Users/lewis/anaconda/lib/python2.7/site-packages/psutil/__init__.py", line 592, in cmdline
return self._proc.cmdline()
File "/Users/lewis/anaconda/lib/python2.7/site-packages/psutil/_psosx.py", line 209, in wrapper
raise ZombieProcess(self.pid, self._name, self._ppid)
psutil.ZombieProcess: psutil.ZombieProcess process still exists but it's a zombie (pid=71)
Lewis-MacBook-Air:~ lewis$
Calling python from Excel using Workbook.caller() is working fine.
I am running El Capitan 10.11.2 (Beta 5).
Any advice appreciated.

It seems that the version 3.3.0 of psutil is causing this, as logged here.
At the moment, downgrading to pip install psutil==3.2.2 should help until this is fixed.
update:
This has been fixed with v0.6.1

Related

Cannot install opencv-python for PyPy2.7

I installed PyPy2.7 in the WSL (Ubuntu 18.04) following the official instructions. I then created a virtualenv and installed Numpy and Scipy with pip install. So far everything works:
$ python
Python 2.7.18 (63df5ef41012, Apr 04 2021, 10:19:14)
[PyPy 7.3.4 with GCC 7.3.1 20180303 (Red Hat 7.3.1-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> import numpy
>>>> import scipy
>>>>
Now I want to install opencv-python, which results in the error described here. This is to be expected. However the suggested solution, running pip install opencv-python==4.2.0.32, doesn't work either
ERROR: Could not find a version that satisfies the requirement opencv-python==4.2.0.32 (from versions: 3.4.10.37, 4.3.0.38)
ERROR: No matching distribution found for opencv-python==4.2.0.32
Somehow only two versions are available and 4.2.0.32 is not one of them. Running pip install opencv-python==3.4.10.37 (which should be old enough to support python2) again throws the original error
Collecting opencv-python==3.4.10.37
Using cached opencv-python-3.4.10.37.tar.gz (87.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /mnt/d/portProg/pbMoMa-master/my-pypy/bin/pypy /mnt/d/portProg/pbMoMa-master/my-pypy/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpNuRIPK
cwd: /tmp/pip-install-nj4gRx/opencv-python
Complete output (22 lines):
Traceback (most recent call last):
File "/mnt/d/portProg/pbMoMa-master/my-pypy/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/mnt/d/portProg/pbMoMa-master/my-pypy/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/mnt/d/portProg/pbMoMa-master/my-pypy/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-tZXZdx/overlay/site-packages/setuptools/build_meta.py", line 146, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/tmp/pip-build-env-tZXZdx/overlay/site-packages/setuptools/build_meta.py", line 127, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-tZXZdx/overlay/site-packages/setuptools/build_meta.py", line 243, in run_setup
self).run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-tZXZdx/overlay/site-packages/setuptools/build_meta.py", line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 448, in <module>
main()
File "setup.py", line 99, in main
% {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))}
File "/mnt/d/portProg/pbMoMa-master/my-pypy/lib-python/2.7/re.py", line 210, in escape
s = list(pattern)
TypeError: 'NoneType' object is not iterable
----------------------------------------
ERROR: Command errored out with exit status 1: /mnt/d/portProg/pbMoMa-master/my-pypy/bin/pypy /mnt/d/portProg/pbMoMa-master/my-pypy/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpNuRIPK Check the logs for full command output.

CERTIFICATE_VERIFY_FAILED in urllib2 but not requests, on Python 2.7.18

My longstanding Python 2.7.17 environment got corrupted, and so I installed Python 2.7.18 using the macOS 64-bit installer downloadable from python.org. Now I get errors when loading HTTPS sites using urllib2 but not requests.
Here is the environment, running macOS Mojave:
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 19 2020, 20:48:48)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Works fine with requests:
>>> import requests
>>> url='https://github.com'
>>> requests.get(url)
<Response [200]>
Fails with urllib2:
>>> import urllib2
>>> urllib2.urlopen(url)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 429, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 447, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1241, in https_open
context=self._context)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1198, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)>
This occurs in both the plain 2.7.18 I installed and in virtual environments created from it. The problem is bigger than just urllib2, as certain database modules fail, too, that do not use urllib2. Moving to Python3 is not currently an option.
I tried pip install --upgrade certifi but that did not help.
Per [1] monkey-patching fixes the problem, but that is not a viable solution because this is destined to be production code.
Per [1] explicitly setting a non-verifying SSL context sometimes works, but again, it is not viable, plus it fails in certain third-party database interface code.
The answer may be in PEPP [2] or PEPP 493 [3], but the sun will swallow the earth before I understand those.
[1] urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error
[2] https://www.python.org/dev/peps/pep-0476/
[3] https://www.python.org/dev/peps/pep-0493/

python3 django-admin syntax error

trying to learn python/django.
after installing all the bits and pieces getting this error (see list). please point into right direction. thank you!
$ django-admin startproject test1
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/bin/django-admin", line 11, in <module>
load_entry_point('Django==2.1', 'console_scripts', 'django-admin')()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 561, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2627, in load_entry_point
return ep.load()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2287, in load
return self.resolve()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2293, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/management/__init__.py", line 11, in <module>
from django.conf import settings
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/conf/__init__.py", line 18, in <module>
from django.utils.functional import LazyObject, empty
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/utils/functional.py", line 12
return _curried_func(*args, *moreargs, **{**kwargs, **morekwargs})
^
SyntaxError: invalid syntax
Python 3.5.0a4 (v3.5.0a4:413e0e0004f4, Apr 19 2015, 14:18:20)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
2.1
You're using an alpha version of Python 3.5 - update your Python to the latest stable 3.5 release.

Pygsheets, can't find client_secret.json

I try to use pygsheet to interact with googlesheet, I have downloaded that client_secret.json file and saved it in the same folder as where my py file is, but I kept getting the following error message!!
I promise I have saved that Jason file in multiple places (where the py file is, where the pysheet is installed.).
Please help me!!!
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)]
Type "help", "copyright", "credits" or "license" for more information.
[evaluate untitled-2.py]
Traceback (most recent call last):
File "C:\Program Files (x86)\Wing IDE 101 4.1\src\debug\tserver\_sandbox.py", line 3, in <module>
pass
File "c:\Users\mimi\.windows-build-tools\python27\Lib\site-packages\pygsheets\client.py", line 549, in authorize
outh_nonlocal=outh_nonlocal)
File "c:\Users\mimi\.windows-build-tools\python27\Lib\site-packages\pygsheets\client.py", line 505, in get_outh_credentials
raise IOError(2, "Client secret file does not exist.",
client_secret_file) IOError: [Errno 2] Client secret file does not
exist.: 'client_secret.json'
Also, I checked the client.py file and noted the current setting is
def authorize(outh_file='client_secret.json', outh_creds_store=None, outh_nonlocal=False, service_file=None, credentials=None, **client_kwargs):
EDIT :
I realized I should put that file in Scripts folder. Fixed!.
But now I have the following error.
`[evaluate untitled-2.py] Traceback (most recent call last): File "C:\Program Files (x86)\Wing IDE 101 4.1\src\debug\tserver_sandbox.py", line 6, in <module> File "c:\Users\mimi\.windows-build-tools\python27\Lib\site-packag‌​es\pygsheets\client.‌​py", line 173, in open raise SpreadsheetNotFound(title) pygsheets.exceptions.SpreadsheetNotFound:`
I used the code sh = gc.open('xxx') , and I think I used the right google spreadsheet name!!

import theano results in ImportError

I'm trying to use theano but I get an error when I import it.
I've installed cuda_6.5.14_linux_64.run, and passed all the recommended test in Chapter 6 of this NVIDIA PDF.
Ultimately I want to be able to install pylearn2, but I get the exact same error as below when I try to compile it.
EDIT1: My theanorc looks like:
[cuda]
root = /usr/local/cuda-6.5
[global]
device = gpu
floatX=float32
If I replace gpu with cpu, the command import theano succeeds.
Python 2.7.8 |Anaconda 1.9.0 (64-bit)| (default, Aug 21 2014, 18:22:21)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
Imported NumPy 1.9.1, SciPy 0.14.0, Matplotlib 1.3.1
Type "scientific" for more details.
>>> import theano
Using gpu device 0: GeForce GTX 750 Ti
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/g/anaconda/lib/python2.7/site-packages/theano/__init__.py", line 92, in <module>
theano.sandbox.cuda.tests.test_driver.test_nvidia_driver1()
File "/home/g/anaconda/lib/python2.7/site-packages/theano/sandbox/cuda/tests/test_driver.py", line 28, in test_nvidia_driver1
profile=False)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/compile/function.py", line 223, in function
profile=profile)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/compile/pfunc.py", line 512, in pfunc
on_unused_input=on_unused_input)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/compile/function_module.py", line 1312, in orig_function
defaults)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/compile/function_module.py", line 1181, in create
_fn, _i, _o = self.linker.make_thunk(input_storage=input_storage_lists)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/gof/link.py", line 434, in make_thunk
output_storage=output_storage)[:3]
File "/home/g/anaconda/lib/python2.7/site-packages/theano/gof/vm.py", line 847, in make_all
no_recycling))
File "/home/g/anaconda/lib/python2.7/site-packages/theano/sandbox/cuda/__init__.py", line 237, in make_thunk
compute_map, no_recycling)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/gof/op.py", line 606, in make_thunk
output_storage=node_output_storage)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/gof/cc.py", line 948, in make_thunk
keep_lock=keep_lock)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/gof/cc.py", line 891, in __compile__
keep_lock=keep_lock)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/gof/cc.py", line 1322, in cthunk_factory
key=key, fn=self.compile_cmodule_by_step, keep_lock=keep_lock)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/gof/cmodule.py", line 996, in module_from_key
module = next(compile_steps)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/gof/cc.py", line 1237, in compile_cmodule_by_step
preargs=preargs)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/sandbox/cuda/nvcc_compiler.py", line 444, in compile_str
return dlimport(lib_filename)
File "/home/g/anaconda/lib/python2.7/site-packages/theano/gof/cmodule.py", line 284, in dlimport
rval = __import__(module_name, {}, {}, [module_name])
ImportError: ('The following error happened while compiling the node', GpuCAReduce{add}{1}(<CudaNdarrayType(float32, vector)>), '\n', '/home/g/.theano/compiledir_Linux-3.11.0-26-generic-x86_64-with-debian-wheezy-sid-x86_64-2.7.8-64/tmpWYqQw5/7173b40d34b57da0645a57198c96dbcc.so: undefined symbol: __fatbinwrap_66_tmpxft_00004bf1_00000000_12_cuda_device_runtime_compute_50_cpp1_ii_5f6993ef', '[GpuCAReduce{add}{1}(<CudaNdarrayType(float32, vector)>)]')
I encountered exactly the same question.
My solution is to replace cuda-6.5 with cuda-5.5, and everything works fine.
We also saw this error. We found that putting /usr/local/cuda-6.5/bin in $PATH seemed to fix it (even with the root = ... line in .theanorc).