I use local python interpreter, pep8 work well and I see all warnings in my files.
Then I switch to remote python interpreter from Docker, all warnings disappeared.
Python on local and Docker: 2.7.12
Pycharm: PyCharm 2017.3.3 (Professional Edition) Build #PY-173.4301.16, built on January 11, 2018
As explained here, Pycharm needs a local interpreter in order to inspect the code. For me, the following worked:
Create a new (dummy) project
Configure a local Python interpreter for the dummy project
Close Pycharm
Open Pycharm and then open your original project that uses the remote interpreter
PEP8 inspection works! (granted that it is enabled in the settings)
Basically my understanding is that it needs a local interpreter to be configured for some project but not necessarily for the specific project you want to run the inspection on.
Related
I am working on setting up a debugging environment for a Docker application in PyCharm. The application happens to be anonlink-entity-service (https://github.com/data61/anonlink-entity-service) and I'm using the instructions here: https://anonlink-entity-service.readthedocs.io/en/stable/debugging.html. Python version is 3.9.7, Docker version is Docker Desktop 4-0-1, PyCharm version is 2021.2.3 (Professional Edition). I'm running on Windows.
I've set up the virtual environment as shown below:
docker-compose.yml is here: https://github.com/data61/anonlink-entity-service/blob/develop/tools/docker-compose.yml
The code I'm trying to debug is here:
And is referenced in the code like this (note the import is for entityservice and not for backend.entityservice):
With the workspace configured as described above I get errors indicating the import should be backend.entityservice and not entityservice. I can get around this by moving the entityservice folder to a top level folder (as shown below), however, this seems to be obviously not the intent of the creators of this code.
Is there a way I can configure the project so that the entityservice imports work as is and does not require me to move this module out to the root of the project?
This can be fixed in PyCharm by right clicking on the folder and then selecting "Mark Directory As --> Sources Root"
I want to use remote Python Interpreter in CLion, and I do not find corresponding config in Clion.
I have try to config in Preferences >> Build, Execution, Deployment >> Python Interpreter.
But I don't find where to config a remote Python Interpreter in CLion.Here is the config page for Python Interpreter but not where for remote interpreter.
CLion has Community Python plugin inside. That means it does not support remote Python Interpreter.
Is it possible to work with a Windows python interpreter from an OS X PyCharm instance?
I'm developing some python code for the Windows environment (uses Windows-specific packages) but would like to stay in the OS X environment for all the development. I was hoping PyCharm's Remote Interpreter option over SSH would allow this, but I keep getting the following error. It appears after connecting OS X PyCharm to a Windows 10 Anaconda interpreter (over SSH).
Couldn't refresh skeletons for remote interpreter
failed to run generator3.py for sftp://[username]#[host]:22/Users/[username]/AppData/Local/Continuum/anaconda2/python.exe, exit code 1, stderr:
-----
'env' is not recognized as an internal or external command,
operable program or batch file.~
-----
A few (possibly) helpful pieces of info:
SSH server is the Windows 10 built-in OpenSSH
I get the above error even when I try connecting to the same remote interpreter (via SSH) from Windows PyCharm. This suggests to me that the issue isn't caused by mixing platforms.
Finally, I can connect to and interact with the desired Windows Anaconda interpreter from OS X PyCharm using the built-in Start SSH session (in the Tools menu). This also works from Windows PyCharm. Things start going south when I try to use it as the project interpreter.
This is not possible as of version 2019.1.3 released 29 May 2019. Pycharm doesn't support Windows remote interpreter. See the link below to the JetBrains issue tracker page discussing the desired functionality.
https://youtrack.jetbrains.com/issue/PY-20952
I want to use Pycharm as IDE to upload my python code to a remote server. On this server I have a virtual environment with virtualenv. This interpreter is specified in the project interpreter settings and when I look at the installed packages, it finds all the packages, but when I program, all the imports I use are not found and hence autocomplete does not work and my whole code is full of errors which is quite annoying. I use Pycharm on a windows computer and the server runs on Ubuntu 14.04.
As can be seen on the figure, the project interpreter uses an ssh connection to the server, and my path to the python interpreter is set to the python interpreter of the virtual environment (not the default python on that server). All the installed packages are also shown. Should I configure something else to make Pycharm find these modules (allthough I think pycharm finds them as they show up in the picture, but it does not use them for imports)?
I had a similar problem, but not with a remote interpreter.
I found that the Run Configuration was set to use a different interpreter than the Project Settings.
Settings / Preferences > Project: untitled > Project Interpreter =>
~/project/venv/bin/python
All good. But:
Run Configuration > Python interpreter => /usr/local/bin/python3.7
The top choice on the drop-down list for the Run Configuration interpreters was Project Default which set it to the same as my project setting.
Run Configuration > Python interpreter => Project Default
(~/project/venv/bin/python)
I don't know if this is the cause of your problem, but it's something to check.
As discussed in PY-29551 PyCharm does not yet support remote virtual environments with remote interpreters (only global Python environments). Apparently they will add this any moment in PY-6002.
Until then I solved this with the workaround suggested in PY-29551:
For simply deploying and running code the workaround with adding a "pseudo" python executable that just loads the venv before running python worked for me:
#!/bin/sh
. /home/me/mypy/venv/bin/activate
exec python $*
Just add this to your remote venv and select it as Python executable instead.
For remote debugging this did not work for me, so for debugging I instead went for the Remote Debug Server approach described in the offical PyCharm docs on remote debugging.
I have a working Python project on my PC, which I am running from Pycharm.
It uses Pyroot (an interface to Root C++ library), whose C++ lib path I have added in Project Settings/Python Interpreter/Paths in Pycharm. It also needs to use the 2.7 Python interpreter, instead of 3., which is a default python in my terminal.
I want to run this project remotely on another desktop, so I need to be able to run it from terminal specifying the path to Root and the interpreter version.
Is there a way to easily extract from Pycharm the exact run command it is using when I'm running the code via run button?
Alternatively, if that's impossible, how should I specify the path to Root and the interpreter version when running from terminal?
I guess to best way is to create a virtualenv either in the terminal or in pycharm including the corrext python version 2.7 and install pyroot via pip into this virtualenv. Then you can simply ssh in the remote host, activate the venv and start your project from the terminal. Or you ssh into it with X-forwarding and start Pycharm itself from your client.
If you select the correct project and go to File > Settings, under the Project Settings you can see the Project Interpreter which tells you which interpreter is being used.
Hope this is what you are looking for.