This is a known issue as documented on KyngChaos
A workaround is available as follows
Go to Settings ... Options... System ... Environment Enable "Use Custom Variables "
First select "Prepend", under variable enter "PATH", under value enter
if you use the Kyng Chaos version:
1) First solution with the PYTHONPATH variable:
Add qgis to the PYTHONPATH (terminal)
$ export PYTHONPATH=/Applications/Qgis.app/Contents/Resources/python
You can add this line to your .bash_profile
Then in Python
# Import qgis
from qgis.core import *
When you look at the grass-70 recipe info from homebrew, you'll see:
Rainers-MacBook-Pro:~ rainerkrug$ brew info grass-70
osgeo/osgeo4mac/grass-70: stable 7.0.1
Geographic Resources Analysis Support System
/usr/local/Cellar/grass-70/7.0.1 (3708 files, 83M) *
Built from source with: --with-mysql --with-postgresql --with-liblas
I use both Macos Kyngchaos QGIS and Anaconda Python on my Mac with success.
To do this, you must set your Anaconda Python path in your QGIS variables environment.
Go to QGIS > Preferences > System
In the environment
Set PYTHONPATH as a new variable and add /Applications/anaconda2/bin as a value. Set it to overwrite.
Restart QGIS, you'll see the new ...
I had the same problem and figured it out. You did brew tap osgeo/osgeo4mac before and thereby expanded your brew with the osgeo-tap. The repository documentation mentions they are currently 'renaming' formulae. It turns out they're renaming formula postgresql to osgeo-postgresql etc. So my trick was to type on the shell:
for f in libgeotiff libspatialite ...
As already been mentioned in GS exchange, the QGIS version of Kyng Chaos uses the standard Apple Python and the version 2.x (and not the 3.x, nor others Python implementation, Homebrew, Anaconda, etc.)
As indicated in the documentation, you must first add PyQGIS to the PYTHONPATH
I use here the Terminal application:
For QGIS on Mac, the Kyngchaos.com installer package is built against the GDAL_Complete installer framework from the same site, as is noted under Requirements on the download page. It will not work with gdal from the Homebrew project.
If you want to go with a purely Homebrew approach, try the OSGeo4Mac project. First run brew unlink qgis, which is the ...
That solved my problem.
Further information and a tutorial can be found here http://gdal.org/1.11/ogr/ogr_apitut.html
A C++ version for GDAL 1.11:
poDS = OGRSFDriverRegistrar::Open( "data.shp", FALSE);
and so added
to my .bash_profile
it works! I'm still running OSX 10.7 and I haven't needed this in my profile before so why I should need it now I can't say by the whole issue with paths is ...
It is a recurrent question: the module is Shapely and it is a pure Python module and not a QGIS plugin. (Shapely.geometry is part of the Shapely module).
QGIS on Mac OS X use the default Apple install of Python (Mac OS X is a UNIX, like Linux)
Windows does not have Python installed by default, so QGIS must install its own version of Python where Shapely is ...
If you use the terminal (OSX):
Try fixing the GDAL Path.
If you use the GDAL Framework of KyngChaos, the complete Path of the command is /Library/Frameworks/GDAL.framework/Versions/1.10/Programs/gdal_rasterize or .../Versions/1.9/...or...
1) in the Terminal:
and you can use ...
So I figured it out!
gdal_translate -b 2 input_rgb.tiff output_green.tiff
gdaldem color-relief output_green.tiff green_colortable.txt output_green_rgb.tiff taking the colortable from QGIS.
I did this for both red and green bands. After that I combined them by using Mapnik!
There is a path problem in the Kyng Chaos SQLite installer (in GDAL 2.0, I don't know with the new 2.1)
The content of the sqlite-py2.7.pth is
import sys; sys.path.insert(0,'/Library/Frameworks/SQLite3.framework/Versions/C/Python/2.7')
It is a Python .pth file ( site), installed in /Library/Python/2.7/site-packages/sqlite-py2.7.pth and pointing to /...
First of all I had to show my User>Library directory as it was hidden on OSX. Then i deleted org.qgis.qgis2.plist from User>Library>Preferences> Relaunched QGIS and so far so good (but early days). WARNING This will delete preferences, but was worth it to get QGIS back up and running.
If you install the 2. version It will overwrite the 1.8 version (QGIS.app).
But,I use everyday versions 1.8, 2. and master on Mac OSX 10.6.8 without problem (often at the same time).
So, the only thing you need to do is to rename the version 1.8 in QGIS1.8.app , otherwise, it will be deleted (QGIS.app)
QGIS from KyngChaos and from Larry Shaffer's Nightly Mac Build of QGIS from 'master' Branch use exclusively the Apple Python because the developers are sure that it is installed (and not those from Python.org, from EPD, from Homebrew, from MacPorts, from Anaconda, from...).
So you must install the Python modules like matplotlib, Psycopg2,..., for the ...
The link only is not sufficient: all the archives of KyngChaos software and Frameworks are in Kyngchaos: Unix Port Download Archive.
But, if you want to have the 2 versions, you need to rename temporarily the installed version of QGIS.app into QGIS2.0.app, for example, otherwise it will be replaced by the 1.8 version. You can use them at the same time
One way to fix a whole slew of dependency problems is to just install everything via homebrew (http://brew.sh). Brew has a working qgis stable version available and it can also install a version of python to use for all its dependencies. Deleting the system python is bad, but you can mostly fix that by just installing the python 2.7 dmg from python.org. ...
UPDATE: This issue has been addressed with the following commit to QGIS master branch. The fix may soon be backported to the 2.0.x branch as well.
Since the issue stems from how many files an application can have open at once on a Mac, try moving your data to a database instead.
You can import your shapefiles into Spatialite or PostgreSQL/PostGIS databases ...
There are several solutions for retrieving accidentally 'hidden' Composer panels in QGIS 1.8, outlined here (checkout last one).
Panels in the main QGIS window are accessible via the View->Panels submenu.
This issue has been fixed in master branch. If you want to try the master branch, there are nightly builds available for 10.6.8 here.
There are a couple of things you may want to look at concerning your code:
If you are actually trying to load the shapefile from '/path/to/shapefile_folder/test.shp' then there is a high likelihood that a shapfile does not exist at that location.
Set the prefixPath to '/Applications/QGIS.app/Contents/MacOS'. Notice if you look inside the application bundle, ...
If you want to use the Kyngchaos's version of QGIS, you should use his version of GDAL/OGR (Framework in /Library/Frameworks/GDAL.framework). This version also installs the Python osgeo module (in /Library/Python/2.7/site-packages because QGIS use the Apple Python).
If you want to use the Homebrew version of GDAL/OGR (library in /usr/local/Cellar with ...