Pycharm Couldn't connect to console process exit code -1 remote interpreter - python

I'm trying to connect to a remote python interpreter but I'm getting the following error in the Python Console:
ssh://ubuntu#131.175.21.168:22/usr/bin/python3.6 -u /home/ubuntu/.pycharm_helpers/pydev/pydevconsole.py 0 0
Couldn't connect to console process.
Process finished with exit code -1
I'm using the following:
Pycharm version: Pycharm Professional 2017.3.4.
Project interpreter: Remote Python 3.6.5 (ssh connection to a remote virtual ubuntu 16.04 server built thru OpenStack).
Deployment: SFTP, auth type: Key pair with private key file.
The SFTP connection works fine, synchronization of the code to the remote server also works fine. But I can't seem to run any code in the Python Console.
Any ideas on how to solve this?
Thanks in advance for the help!

When I try to connect directly to port 22, I get an error like below.
ssh://keiichi.kuroyanagi#mygcp:22/home/keiichi.kuroyanagi/.pyenv/shims/python -u /home/keiichi.kuroyanagi/.pycharm_helpers/pydev/pydevconsole.py 0 0
Couldn't connect to console process.
Process finished with exit code -1
I now connect to remote console by configuring portforwarding in RoyalTSX as below.
The console is as follows.
ssh://keiichi.kuroyanagi#localhost:10022/home/keiichi.kuroyanagi/.pyenv/shims/python -u /home/keiichi.kuroyanagi/.pycharm_helpers/pydev/pydevconsole.py 0 0
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['/home/keiichi.kuroyanagi/tmp/pycharm_project_444', '/home/keiichi.kuroyanagi/tmp/pycharm_project_444'])
Python 3.6.7 |Anaconda, Inc.| (default, Oct 23 2018, 19:16:44)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.1.1 -- An enhanced Interactive Python. Type '?' for help.
PyDev console: using IPython 7.1.1
Python 3.6.7 |Anaconda, Inc.| (default, Oct 23 2018, 19:16:44)
[GCC 7.3.0] on linux
In[2]:
The following link may also be helpful.
Can't connect to remote interpreter python console : PY-18029
https://youtrack.jetbrains.com/issue/PY-18029
My pycharm version is as follows.
PyCharm 2018.2.4 (Professional Edition)
Build #PY-182.4505.26, built on September 19, 2018
Licensed to DeNA Co.,Ltd. / Keiichi Kuroyanagi
You have a perpetual fallback license for this version
Subscription is active until October 24, 2019
JRE: 1.8.0_152-release-1248-b8 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6

Related

How to update python in sql server?

I have a Python project that uses the keras Library.
Now I want to transfer this to sqlserver ml service, but the Python sqlserver version is 3.7.1.
Is there a way to update the built-in version of Python in sqlserver?
EXECUTE sp_execute_external_script
#language = N'Python'
, #script = N'
import sys
print(sys.version)'
result:
STDOUT message(s) from external script: 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64bit (AMD64)]

Ansible EC2 Region eu-central-1does not seem to be available for aws module boto.ec2

Im trying to do a simple Ansible script to attach a volume in EC2
- ec2_vol:
instance: XXXXXX
volume_size: 5
device_name: sdd
When running I get the following error
msg": "Region eu-central-1 does not seem to be available for aws
module boto.ec2. If the region definitely exists, you may need to
upgrade boto or extend with endpoints_path"
When I check that eu-central-1 is accesible via python boto... it is there:
$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto.ec2
>>> boto.ec2.regions()
[RegionInfo:us-west-1, RegionInfo:us-east-1, RegionInfo:ap-northeast-1, RegionInfo:ap-southeast-2, RegionInfo:sa-east-1, RegionInfo:ap-northeast-2, RegionInfo:us-east-2, RegionInfo:ap-southeast-1, RegionInfo:ca-central-1, RegionInfo:cn-north-1, RegionInfo:us-west-2, RegionInfo:us-gov-west-1, RegionInfo:ap-south-1, RegionInfo:eu-central-1, RegionInfo:eu-west-1, RegionInfo:eu-west-2]
Here are the versions of my tools
ansible 2.3.2.0
aws-cli 1.11.151
Python 2.7.12
Linux 4.4.0-93-generic
botocore 1.7.9
boto 2.48.0
pip 9.0.1
I already check most of the things I can think of and even reproduce it on another virtual machine with vagrant and it gives me the same error..what else can I check?
Do you run this with connection: local? – Konstantin Suvorov 6 hours
ago
Answer from the comments:
Do you run this with connection: local?
Cloud modules like ec2_vol are (usually) supposed to be executed from localhost (where all required libraries and credentials are stored).

How to use uwsgi when its built monolithic (with plugins baked in) and installed via dnf on Fedora?

I've been trying to work through the dreaded no site error on uWSGI.
What's happening is that when I specify python3 as a plugin, it always seems to want to load python 2.7 instead.
When I run uwsgi --plugins-list`, I get back:
$ uwsgi --plugins-list
*** uWSGI loaded generic plugins ***
gevent
nagios
rrdtool
carbon
corerouter
fastrouter
http
ugreen
syslog
rsyslog
logsocket
router_uwsgi
router_redirect
router_basicauth
zergpool
redislog
mongodblog
router_rewrite
router_http
logfile
router_cache
rawrouter
router_static
sslrouter
cheaper_busyness
transformation_tofile
transformation_gzip
transformation_chunked
transformation_offload
router_memcached
router_redis
router_hash
router_expires
router_metrics
transformation_template
stats_pusher_socket
*** uWSGI loaded request plugins ***
0: python
17: spooler
18: symcall
100: ping
110: signal
111: cache
173: rpc
--- end of plugins list ---
On a working CentOS server when I run uwsgi --plugins-list, I get back:
# uwsgi --plugins-list
*** uWSGI loaded generic plugins ***
corerouter
*** uWSGI loaded request plugins ***
100: ping
101: echo
--- end of plugins list ---
*** Starting uWSGI 2.0.14 (64bit) on [Sun Jan 8 11:42:22 2017] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-4) on 05 October 2016 20:03:58
os: Linux-3.10.0-327.36.3.el7.x86_64 #1 SMP Mon Oct 24 16:09:20 UTC 2016
I got uwsgi installed on Fedora using dnf. On CentOS it came down from yum. I'll be very surprised if the answer to this is to install via pip because that means that the Fedroa stocked version has limited use because it was compiled monolithic.
The uwsgi packages in Fedora and EPEL (for CentOS) are built in a way that most plugins (python, ruby, psgi, php, etc) have to be explicitly loaded. When you install uwsgi from PyPI, it is built to default to the python plugin. So in order for it to work when installed via RPM, run it like this:
uwsgi --plugin python <then the rest of your normal arguments>
or
uwsgi --plugin python3 <then the rest of your normal arguments>

mod_wsgi (with anaconda python on mac os x) uses wrong libpython library

I try to use mod_wsgi with a non-system python installation (anaconda). But mod_wsgi always uses the libpython provided by the system python. How can i change the configuration to use entirely anaconda python?
Setup:
Mac OS X 10.10.3
Python 2.7.9 :: Anaconda 2.2.0 (x86_64)
system provided Apache/2.4.10 (Unix)
mod_wsgi-4.4.11 src
I installed mod_wsgi with:
./configure --with-python=/opt/anaconda/bin/python2.7
make
sudo make install
--the with-python option points to the anaconda python binary. Normally this should be sufficient to use anaconda python.
apache configuration
LoadModule wsgi_module /usr/libexec/apache2/mod_wsgi.so
...
WSGIPythonHome /opt/anaconda
WSGIScriptAlias /~dlangenk/wsgi/test /Users/dlangenk/Sites/wsgi/test.wsgi
test wsgi application
import sys
def application(environ, start_response):
status = '200 OK'
output = ''
output += 'sys.version = %s\n' % repr(sys.version)
output += 'sys.prefix = %s\n' % repr(sys.prefix)
output += 'sys.path = %s\n' % repr(sys.path)
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
output of test script
# if everything would work sys.version should point to the 2.7.9 python version of anaconda
sys.version = '2.7.6 (default, Sep 9 2014, 15:04:36) \n[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]'
sys.prefix = '/opt/anaconda'
sys.path = ['/opt/anaconda/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-macosx-10.5-x86_64.egg', '/opt/anaconda/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg', '/opt/anaconda/lib/python2.7/site-packages/mod_wsgi_metrics-1.1.0-py2.7.egg', '/opt/anaconda/lib/python27.zip', '/opt/anaconda/lib/python2.7', '/opt/anaconda/lib/python2.7/plat-darwin', '/opt/anaconda/lib/python2.7/plat-mac', '/opt/anaconda/lib/python2.7/plat-mac/lib-scriptpackages', '/opt/anaconda/Extras/lib/python', '/opt/anaconda/lib/python2.7/lib-tk', '/opt/anaconda/lib/python2.7/lib-old', '/opt/anaconda/lib/python2.7/lib-dynload', '/opt/anaconda/lib/python2.7/site-packages', '/opt/anaconda/lib/python2.7/site-packages/PIL', '/opt/anaconda/lib/python2.7/site-packages/Sphinx-1.2.3-py2.7.egg', '/opt/anaconda/lib/python2.7/site-packages/aeosa', '/opt/anaconda/lib/python2.7/site-packages/cryptography-0.8-py2.7-macosx-10.5-x86_64.egg', '/opt/anaconda/lib/python2.7/site-packages/setuptools-15.2-py2.7.egg']
output of apache error log
[Mon May 18 10:41:11.656749 2015] [wsgi:warn] [pid 18114] mod_wsgi: Compiled for Python/2.7.9.
[Mon May 18 10:41:11.656929 2015] [wsgi:warn] [pid 18114] mod_wsgi: Runtime using Python/2.7.6.
What i already tried:
1)
When using mod_wsgi-express to setup a new apache installation bundled with mod_wsgi the anaconda python library is picked up correctly. But for different reasons I want to use the system apache.
2)
If i remove /usr/lib/libpython-2.7.dylib and replace it with /opt/anaconda/lib/libpython-2.7.dylib the output of sys.version is correctly shown as 2.7.9 |Anaconda 2.2.0 (x86_64)|... . But I cannot remove the system libpython library because the system python is used by Mac OSX.
3)
As suggested by the official Documentation although stated that it is fixed I modified the makefile to link against the libpython in /opt/anaconda/lib and further set the runpath to /opt/anaconda/lib. Nothing worked

Flask+Nginx+uWSGI : ImportError: No module named site

I installed as the http://www.reinbach.com/uwsgi-nginx-flask-virtualenv-mac-os-x.html link's tutorial and when executing the command uwsgi --ini deploy/deploy.ini, the terminal says there was an import error:
Set PYTHONHOME to /virtualenv/sample/
ImportError: No module named site
I have set my PYTHONHOME and PYTHONPATH as
export PYTHONPATH=$PYTHONPATH:/Library/Python/2.7/site-packages
export PYTHONHOME=$PYTHONHOME:/Library/Python/2.7
I cannot figure out what wrong with it.
Could someone help me with the problem?
The whole info in the terminal is shown as below if it is helpful:
(env)ios-devmatoMacBook-Pro:hello ios_dev$ uwsgi --ini deploy/deploy.ini
[uWSGI] getting INI configuration from deploy/deploy.ini
*** Starting uWSGI 1.9.10 (64bit) on [Fri May 17 16:42:22 2013] ***
compiled with version: 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) on 17 May 2013 12:41:07
os: Darwin-11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-
1699.32.7~1/RELEASE_X86_64
nodename: ios-devmatoMacBook-Pro.local
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /Users/ios_dev/Desktop/sample/hello
detected binary path: /Users/ios_dev/Documents/little/little-web/little_web_dev/env/bin/uwsgi
your processes number limit is 709
your memory page size is 4096 bytes
detected max file descriptor number: 256
lock engine: OSX spinlocks
uwsgi socket 0 bound to TCP address 127.0.0.1:3031 fd 3
Python version: 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
Set PYTHONHOME to /virtualenv/sample/
ImportError: No module named site
Here's how I resolved the same error message (ImportError: No module named site) that I got while trying the Django and NGINX tutorial — uWSGI 2.0 documentation.
Deactivate the virtualenv:
deactivate
Install uWSGI system-wide (if not already installed system-wide)
sudo pip install uwsgi
Edit the uwsgi.ini file. I commented out the line with the:
home = /path/to/virtualenv
Run uWSGI --ini mysite_uwsgi.ini.
I read a lot of document about the question, but get no answer.
By coincidentally, I fix this problem by edit uid and gid as root.
It seem like a permissions problem. I don't know why, but it just work. Remember, it is very unsafe to run a product environment as root.
1、active the virtual you used
2、 pip install uwsgi
this the key action,then the
command -v wsgi
show this
/virtual-path/bin/uwsgi
3、use current user to run uwsgi, because other user is not active the virtualenv
Im My case I wasn't using virtualEnv. Just using django + ngnix. My solution was removing HOME variable into the *.ini configuration file:
sudo nano /etc/uwsgi/sites/c_app.ini
[uwsgi]
project = c_app
uid = ubuntu
base = /home/%(uid)
chdir = %(base)/%(project)
**home = %(base)/%(project)** (REMOVED IT)
module = %(project).wsgi:application
master = true
processes = 5
socket = /run/uwsgi/%(project).sock
chown-socket = %(uid):www-data
chmod-socket = 660
vacuum = true
then it works.

Categories

Resources