Vs code Python Interpreter Invalid Version Python error - python

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

Related

VS code not loading Python Interpreter

Here is my VS code infor:
Version: 1.43.2 (user setup)
Commit: 0ba0ca52957102ca3527cf479571617f0de6ed50
Date: 2020-03-24T07:38:38.248Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.17763
My python path is here:
/auto/energymdl2/anaconda3/envs/commod_py3_20200921/bin/python
But VS codes keeps saying Select Python Interpreter in the status bar even after I selected.
But when I try to select, it says it is already being selected. At moment, due to this, I am unable to use Python linter Flake8.
When I check the console log. I got the following.
Error Python Extension: 2020-09-23 05:02:01: Failed to parse interpreter information for /auto/energymdl2/anaconda3/envs/commod_py3_20200921/bin/python,/home/test/.vscode-server/extensions/ms-python.python-2020.5.86806/pythonFiles/pyvsc-run-isolated.py,/home/test/.vscode-server/extensions/ms-python.python-2020.5.86806/pythonFiles/interpreterInfo.py stderr: Error in sitecustomize; set PYTHONVERBOSE for traceback:ModuleNotFoundError: No module named 'sdlc'
But when I go into Python and import sdlc. I am able to.
Python/iPython path:
/auto/energymdl2/anaconda3/envs/commod_py3_20200921/bin/python
Here is what I have in my setting.json
{
"python.linting.pycodestyleEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.linting.flake8Args": [
"--ignore=W605",
"--ignore=W503",
"--ignore=W605",
"--max-line-length=120"
],
"python.linting.banditEnabled": false,
"python.pythonPath": "/auto/energymdl2/anaconda3/envs/commod_py3_20200921/bin/python",
// "python.condaPath": "/auto/energymdl2/anaconda3/envs/commod_py3_20200727/bin/python"
}
It turned out that there is some logic goes into $your_conda_env_path/lib/python3.6/site-packages/sitecustomize.py that imports user-defined packages in working repo. But the working directory env variable was not set properly. I created a .env file under repo root dir and added relevant env variables. It resolved the issue.
So in fact all the conda envs were detected. It is just when it tries to load them, it hits ModuleNotFoundError.

Atom [Linter] Error running Flake8 Error: spawn EACCES

The package linter-flake8 popped up an error message
[Linter] Error running Flake8 Error: spawn
/Users/apple/Library/Python/2.7/bin EACCES.
The detailed info Atom gave me is:
/Users/apple/.atom/packages/linter/lib/linter-registry.js:154 [Linter]
Error running Flake8 Error: spawn /Users/apple/Library/Python/2.7/bin
EACCES at Process.ChildProcess._handle.onexit
(internal/child_process.js:246) at onErrorNT
(internal/child_process.js:429) at processTicksAndRejections
(internal/process/task_queues.js:81) (anonymous) #
/Users/apple/.atom/packages/linter/lib/linter-registry.js:154
I use the Mac OS system now, and I double-checked that both flake8 and linter-flake8 are installed through the terminal (the path that the terminal showed for flake8 is /Users/apple/Library/Python/2.7/bin, and I used this address for the executable path in the linter-flake8 settings). I've been dealing with this error for two days but nothing has been solved yet. I really appreciate it if someone can help. Thanks a lot!

Segmentation fault when running start_matlab in matlab engine

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.

py2app Error OSX El Capitan

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!

python.exe was crashed when I run python **.py from windows cmd

if I type python in win cmd, it's ok.But when I run python main.py from cmd it crashed.
The message is:
python.exe has stopped working.
Problem signature:
Problem Event Name: APPCRASH
Application Name: python.exe
Application Version: 0.0.0.0
Application Timestamp: 4c73f7b6
Fault Module Name: python26.dll
Fault Module Version: 2.6.6150.1013
Fault Module Timestamp: 4c73f79a
Exception Code: c0000090
Exception Offset: 000c30a2
OS Version: 6.1.7600.2.0.0.256.48
Locale ID: 2052
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt
Post-mortem: the problem was solved inside question comments (re-installing Python fixed the problem; I suspect the Python installation had somehow gotten corrupted).

Categories