To follow theJones and user5584, PyCharm 4 now stores the setting under "Project Interpreter" rather than "Python Interpreters."
With all projects closed, and PyCharm still open, go to "Configure" and then "Settings". "Project Interpreter" is under the "Default Project" menu on the left.
Click the settings gear in the upper-right, and then "Add Local." ...
I’ve found the solution of my main question with help of
If you need to add some external library, first of all check where it is placed (if it is possible of course). I opened Python console in QGIS and inserted:
from processing.core import AlgorithmProvider
I figure it out!
CALL %OSGEO4W_ROOT%\bin\o4w_env.bat called on all .bat files in %OSGEO4W_ROOT%\etc\ini\ and there is the file: python-core.bat
So by changing from python27 to python36 in C:\osgeo4w64\etc\ini\python-core.bat Pycharm find all dependencies :)
After a while away from qgis-master I went back today and had some problems with ...
There is a Help page entitled Importing ArcPy that explains this - I encourage you to visit that page which has more detail than I am quoting:
When using an import statement, Python looks for a module matching
that name in the following locations (and in the following order):
Paths specified in the PYTHONPATH system environment variable
A set ...
You can do this in the project Structure setting. Just add it as an sdk and it should work. I use intelliJ but pycharm should be the same.
Add this (Use your path) for the sdk path
Give it a name and you should be good. Adding it as a global sdk you should be done and get the code completion.
QgsVectorLayer class has a fields method for it.
Using the QGIS Python console you can try this code (the current layer should be a vector layer (instance of QgsVectorLayer)):
>>> layer = iface.activeLayer()
<qgis._core.QgsVectorLayer object at 0x7f5e031ccc18>
<qgis._core.QgsFields object at ...
I found it, it was just a small tricky approach.
in OsGeo4w website says you have to install QGIS by Osgeo4w setup which it sets all kinds of path variables for you ...
( it was NOT entirely true, in my case)
leave your PATH, Path, PYTHONPATH, PYTHONHOME to where it's functional for all modules unless qgis's.
I removed QGIS standalone and installed QGIS ...
Basile, as a P.S. to my comment, my batch file (pyqgis.cmd) looks like this:
If you look at step 23 in the tutorial you'll see
some lines in the run method:
if self.first_start == True:
self.first_start == False
self.dlg = SaveAttributeDialog()
You need to find those lines and make sure they are called before you try to use the dialog anywhere. Also check that the name matches the name of your dialog (probably something ...
The Python installation of ArcGIS is not "standard"
1) you need first to install pip
2) then in theory you can install SciPy but
SciPy is not a pure Python module, it needs compilation of C files and Windows has no compiler by default. You can try the Microsoft Visual C++ Compiler for Python 2.7 or a version of Christoph Gohlke Unofficial Windows ...
[I'm guessing based on available information]: Your problem is with what you're passing in when running it in a an IDE (outside the app)
The community edition doesn't support remote debugging, meaning you can't test your plugin while running in QGIS.
You can use Winpdb (cross platform despite the name) to remotely debug a QGIS plugin. See: http://winpdb.org/
From the PyQGIS Programmers Guide (http://locatepress.com/ppg):
In your code, add lines to enable debugging:
The batch script from the A Quick Guide to Getting Started with PyQGIS on Windows as described in the comments and by @PolyGeo maybe outdated. The SDK seems invalid appear in PyCharm 2016.3 by using the script.
I suspect it needs more paths to be included especially (maybe) pip.exe path that exist in %OSGEO4W_ROOT%\apps\Python27\Scripts. So I include that ...
From the comments it looked like the asker of this question was able to resolve their problem by reading a blog posting entitled A Quick Guide to Getting Started With PyQGIS on Windows.
In that blog the advice offered seemed to be:
We only changed the last line, adding the start statement with the
path to the IDE (PyCharm). If you save this to ...
SAGA has a command-line interface, so once you have it installed and on your system path, you can access the tools directly using a command line call from Python (I do this all the time with R, the process is very similar). Here's an example of calling the help function for SAGA:
from subprocess import call
and here's the help for ...
Try to use this .bat file to launch PyCharm:
A lot has changed since the recent update hence answering this to align with the PyCharm version 2018 interface:
Close all the projects by selecting File>Close projects
Select Configure gear icon>Settings
Select Project Interpreter and click on another gear icon next to Project Interpreter dropdown and select 'Add'
Select 'existing environment' and locate ...
You seem to have misinterpreted a suggestion offered in a comment.
inputOne = "C:\Users\DELL\AppData\Local\Temp\tmpA378\tmpA379.gdb\PerpendicularLine"
inPointElevations = inputOne
pathAfterJoin = os.path.join(inputOne)
inputOne = r"C:\...
As you can see at Terminology for distinguishing ArcPy installed with ArcGIS 10.x for Desktop from that which comes with ArcGIS Pro? there is a difference between the ArcPy functions available with ArcGIS Pro (Python 3.x) and ArcGIS 10.x for Desktop (Python 2.x).
It looks like you are trying to use the ArcGIS Pro tool named Split By Attributes in the ArcPy ...
QGis has installed it's own version of Python. So you have two installations. The PYTHONPATH is used to specify which directories to scan for source modules. In this case PyCharm appears to be confused as to which installation to use. But you should be able to configure it as needed.
sys.path is initialized from PYTHONPATH
Both versions of your PyCharm ...
Try editing your code with the following:
Replace app = QtGui.QApplication with app = QApplication(, True)
Move the above line after you have set your prefix path.
Add from PyQt4.QtGui import QApplication when importing PyQt4 modules
Remove 11 in the line window_frame = QtGui.QFrame(window) 11
Running the above works for me, here is the code I used:
After half a day I was able to sort out the issue by downloading a patch from ESRI website, which addresses this issue:
Anyway, problem is solved. It was driving me mad :)
At least i managed to start Pycharm with an OSGEO4W Environment. My PyCharm is 2017.3, 64bit-Edition. My OSGEO4W is 32bit and uses QGIS3/Python3. I think it will be easy to change it for QGIS2/Python2.7 or anything with 64bit.
I do start PyCharm with the batch-file in PyCharms bin directory, called by a custom Script to set the needed environment variables, ...
I would just call the command line argument via os.system. Here is an example of running SAGA's Gaussian Filter tool via Python and os.system:
input_file = "/some/raster.sgrd"
output_file = "/some/other_raster.sgrid"
os.system("saga_cmd grid_filter 1 -INPUT '" + input_file + "' -RESULT '" + output_file + "' -SIGMA 1.0 -MODE 1 -RADIUS 5")
I use such *.cmd file (different than yours) to start PyCharm. Try to use it.
On Arch Linux (but it should work on Ubuntu too), I use this python script that at the loading of QGIS checks if anyone is listening on port 53100. If so, it tries to import pydevd from the pycharm's directory and tries to connect to the remote debugger.
"""Return True if someone is listening on the ...
found what the problem was!
for using qgis python version in windows,
set PYTHONHOME = C:\Program Files\QGIS 2.18\apps\Python27
set PYTHONPATH to where the packaging is:
PYTHONPATH = C:\Program Files\QGIS 2.18\apps\Python27\Lib
***and most important is the system variable PATH which should point to both directories above as well as where the ...
I found a solution for my problem .
There is the code:
from qgis.core import *
# supply path to qgis install location
QgsApplication.setPrefixPath("C:\\Program Files\\QGIS Lyon\\apps\\qgis", True)
# create a reference to the QgsApplication, setting the
# second argument to False disables the GUI
qgs = QgsApplication(, True)
# load providers
what I have noticed is that its not working until the first run. Simply start your script with Import arcpy and run it... then you will have Autocomplete functionality enabled. Looks like, pycharm needs to load arcpy library first,