I'm using
Mac OSX High Sierra
anaconda3 python (virtual environment with python=3.6)
Matlab R2018a.
Steps to reproduce:
Create a new python 3.6 environment. Activate the environment
Go to Matlab/extern/engines/python and run python setup.py install.
Run the following script.
import matlab.engine
matlab.engine.start_matlab()
Segmentation fault happen at the start_matlab() line (not the import line).
I had no trouble before using matlab engine this way. How could I debug this? (mostly is just linking problem).
======================
I uninstalled Anaconda3, and used Python 2.7 system. I met with the same problem, and the problem is with libwmvm.dylib of Matlab.
Process: Python [5124]
Path: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: 2.7.10 (2.7.10)
Code Type: X86-64 (Native)
Parent Process: bash [2183]
Responsible: Python [5124]
User ID: 501
PlugIn Path: /Applications/MATLAB_R2018a.app/bin/maci64/libmwmvm.dylib
PlugIn Identifier: libmwmvm.dylib
PlugIn Version: ??? (0)
Date/Time: 2018-04-27 23:27:03.250 +0700
OS Version: Mac OS X 10.13.4 (17E199)
Report Version: 12
Anonymous UUID: 885790DC-B32C-0363-903C-837A7C285AF3
Sleep/Wake UUID: 14FBD560-D2B9-4A59-89F1-DABA878FCA70
Time Awake Since Boot: 10000 seconds
Time Since Wake: 3700 seconds
System Integrity Protection: enabled
Crashed Thread: 3
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000090
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]
VM Regions Near 0x90:
-->
__TEXT 000000010e1c6000-000000010e1c8000 [ 8K] r-x/rwx SM=COW p [/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python]
Thread 0:: Dispatch queue: com.apple.main-thread
Matlab engine is not supported by python 3.6, you can use python 3.5.
I have anaconda, python 2.7, 3.5 and 3.6 also.
You can easily differentiate between them by renaming the python.exe to python35.exe for instance. Than you can call you py srcipt like this:
python35 example.py
And it will call it with python35.
Hint:
pip install and conda install won't work after the renaming, since it's searching for python.exe, so you don't have to rename the anaconda and the python version what you are using in most of the case.
Related
I use remote-ssh extension to connect to remove linux server. From there I do development.
All of a sudden, I got this Invalid Version Python error when loading conda env. It had been working fine. I have reinstalled vs code and Python interpreter. This error still persists. Python Interpreter also disappeared from the menu bar at the bottom.
Version information:
Anyone know the root cause of this is? Thanks in advance.
Error Log:
Error 2021-04-09 10:43:13: Failed to parse version from path: /research/anaconda3/envs/poc_test_env/bin/python [Error: invalid version python
at u (/home/test/.vscode-server/extensions/ms-python.python-2021.3.680753044/out/client/extension.js:9:198256)
at Object.c [as parseVersion] (/home/test/.vscode-server/extensions/ms-python.python-2021.3.680753044/out/client/extension.js:9:197565)
at p.buildPathEnvInfo (/home/test/.vscode-server/extensions/ms-python.python-2021.3.680753044/out/client/extension.js:80:29369)
at p.resolveEnv (/home/test/.vscode-server/extensions/ms-python.python-2021.3.680753044/out/client/extension.js:80:29309)
at E.resolveEnv (/home/test/.vscode-server/extensions/ms-python.python-2021.3.680753044/out/client/extension.js:29:4121)
at t.PythonEnvsReducer.resolveEnv (/home/test/.vscode-server/extensions/ms-python.python-2021.3.680753044/out/client/extension.js:61:762313)
at async t.PythonEnvsResolver.resolveEnv (/home/test/.vscode-server/extensions/ms-python.python-2021.3.680753044/out/client/extension.js:61:763669)
at async u.doResolveEnv (/home/test/.vscode-server/extensions/ms-python.python-2021.3.680753044/out/client/extension.js:61:757654)
at async q.getInterpreterDetails (/home/test/.vscode-server/extensions/ms-python.python-2021.3.680753044/out/client/extension.js:80:38813)
at async C.getInterpreterDetails (/home/test/.vscode-server/extensions/ms-python.python-2021.3.680753044/out/client/extension.js:61:741545)
at async f.updateDisplay (/home/test/.vscode-server/extensions/ms-python.python-2021.3.680753044/out/client/extension.js:61:729765)
at async f.refresh (/home/test/.vscode-server/extensions/ms-python.python-2021.3.680753044/out/client/extension.js:61:729292)]
VS code version info:
Version: 1.55.0 (user setup)
Commit: c185983a683d14c396952dd432459097bc7f757f
Date: 2021-03-30T16:01:55.261Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.18363
I have 2 python interpreters installed on a windows 10 computer. Python 3.6 from ArcGIS pro 2.2 and Python 2.7 from ArcMap 10.6, using the cmd on Windows:
"C:/Program Files/ArcGIS/Pro/bin/Python/Scripts/propy" -c "import arcpy;print(arcpy.__path__)"
The output is:
'C:\\Program Files\\ArcGIS\\Pro\\Resources\\ArcPy\\arcpy'
This is the intended result, but I need to do the same using subprocess.Popen from Python2.7 and also need to use shell=True
cmd = """ "C:/Program Files/ArcGIS/Pro/bin/Python/Scripts/propy" -c "import arcpy;print(arcpy.__path__)" """
subprocess.Popen(cmd, shell=True,stdout = subprocess.PIPE)
process.stdout.read()
This will raise the error:
Fatal Python error: Py_Initialize: unable to load the file system codec
File "C:\Python27\ArcGIS10.5\lib\encodings\__init__.py", line 123
raise CodecRegistryError,\
Basically the interpreter being used is Python2.7, I have tried to set %PYYHONPATH% to Python3.6 but still the same problem
Just a note, propy is a .bat that activates Python's virtualenv and therefore should be setting everything properly
How could I have the proper output using subprocess.Popen ?
We had a similar problem when trying to run python scripts within ArcGIS Workflow Manager within ArcGIS Pro. The problem is ArcGIS Workflow Manager loads up Python 2.X but we needed Python 3.X
To resolve the problem we added the following in our __init__.py
import sys
if sys.version_info[0] >= 3:
# When run through Workflow Manager 10.5, the PYTHONPATH environment
# variable is being set to the Python 2 environment, and that needs to be removed
# when running in the Python 3 environment.
sys.path = list(filter(lambda p: 'arcgis\\desktop' not in p, sys.path))
I used Ubunto 16.04, Lttng 2.8.1 and python3.5.2. I also installed python3-babeltrace package. The first step was I recorded some logs exactly based on Lttng documents with lttng create, evenet-enable, start, stop, destroy. In the second step I write a very simple python program to read lttng events, some thing like this:
from collections import Counter
import babeltrace
import sys
print("Start")
trace_path = sys.argv[1]
print("1-Get Path")
col = babeltrace.TraceCollection()
print("2-TraceCollection")
# (LTTng traces always have the 'ctf' format)
if col.add_trace(trace_path, 'ctf') is None:
raise RuntimeError('Cannot add trace')
print("3-Add trace by ctf")
for event in col.events:
print(event.name)
print("4-Get all events")
then I debug the program with gdb and after this outputs:
Start
1-Get Path
2-TraceCollection
3-Add trace by ctf
I got the error:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff565d97f in bt_iter_add_trace ()
from /usr/lib/x86_64-linux-gnu/libbabeltrace.so.1
Does any one have any idea about this?
I uninstall all of the packages, also uninstall ubuntu and then installed again but each time I got the same error.
I also try to install Ubuntu 16.10 but with that one I got another error in lttng-module package installation.
Update:
I found that none of babeltrace command and lttng view not worked, and caused the segmentation fault error.
In Alias mode, this fails.
Here's what I'm running:
OSX 10.11.1 (El Capitan)
Python 3.5 via Anaconda (with the Jupyter 4.1.0 Notebook)
py2app is the newest version (0.9)
Here's what I'm doing:
Create script and save as APP_OSX.py
Enter the following commands in terminal:
py2applet --make-setup APP_OSX.py
rm -rf build dist
python setup.py py2app -A
This is after I installed a regular version of Python 3.5.1 from python.org (because there was an issue with using py2app and my Anaconda Python 3.5.1 version).
Then I find the bundled app under the 'dist' folder and open it and a box pops up with the name of my app and "error".
From the console, I get this:
3/30/16 7:37:18.972 PM APP_OSX[5819]: 2016-03-30 19:37:18.971 APP_OSX[5819:746261] APP_OSX Error
3/30/16 7:37:21.511 PM sharedfilelistd[242]: SecTaskLoadEntitlements failed error=22
3/30/16 7:37:21.585 PM Console[5822]: Failed to connect (_consoleX) outlet from (NSApplication) to (ConsoleX): missing setter or instance variable
3/30/16 7:37:25.893 PM WindowServer[161]: send_datagram_available_ping: pid 349 failed to act on a ping it dequeued before timing out.
3/30/16 7:37:51.601 PM Console[5822]: Persistent UI failed to open file file:///Users/mi/Library/Saved%20Application%20State/com.apple.Console.savedState/window_3.data: Permission denied (13)
Not sure if this helps, but the script uses the following libraries:
Numpy
Pandas
Easygui
Thanks in advance!
I am running python 2.7 on MacOSX, and started to get a segmentation fault when running anything related to ctypes. E.g.
>>> import ctypes
Segmentation fault
The error message being: "Python quit unexpectedly while using the _ctypes.so plugin." I use modules with ctype components on a daily basis, and haven't made any major changes to my python installation recently. The actually _ctypes.so file looks normal:
$ ls -l _ctypes.so
-rwxr-xr-x 1 root wheel 148720 Nov 12 22:12 _ctypes.so
This is a known bug in read only filesystems, in this thread you can find a patch along with more information.