Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install cartopy using pip #535

Closed
drorata opened this issue Feb 4, 2015 · 13 comments
Closed

Unable to install cartopy using pip #535

drorata opened this issue Feb 4, 2015 · 13 comments
Assignees

Comments

@drorata
Copy link

drorata commented Feb 4, 2015

[Cross posting from http://stackoverflow.com/questions/28307950/install-cratopy-using-pip-on-mac-os-and-macports]

I am trying to install cartopy on OS X 10.10 (Yosemite). My python is installed using macports and when I run:

sudo pip install cartopy

I get the following error:

/usr/bin/clang -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -pipe -Os -I/opt/local/Library/Frameworks/Python.framework/Versions/3.4/include -I./lib/cartopy -I/opt/local/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c lib/cartopy/trace.cpp -o build/temp.macosx-10.10-x86_64-3.4/lib/cartopy/trace.o

lib/cartopy/trace.cpp:236:10: fatal error: 'geos_c.h' file not found

#include "geos_c.h"

         ^

1 error generated.

error: command '/usr/bin/clang' failed with exit status 1

----------------------------------------
Command "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-hwrcv0a1/cartopy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ytar95bq-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-hwrcv0a1/cartopy

Note that I installed the dependencies as noted here and geos_c.h can be found in /opt/local/include. It seems like pip fails to find this dependency in the macports tree.

Did anyone experienced this kind of problem? How can I fix it?

@pelson
Copy link
Member

pelson commented Feb 4, 2015

The code which generates this error is setup at https://github.com/SciTools/cartopy/blob/master/setup.py#L169.

Though I've never tried it, it may be possible to pass the LIBDIR and INCLUDEDIR values at setup.py time:

LIBDIR="/opt/local/lib" INCLUDEDIR="/opt/local/include" python setup.py install

If that fails, perhaps http://stackoverflow.com/questions/18783390/python-pip-specify-a-library-directory-and-an-include-directory will be helpful.

As a heads up, the python3 support is still a little under tested - there is an outstanding PR to get py3 travis-ci testing which will give us much more confidence about maintaining compatibility with py2 and py3 simultaneously.

@drorata
Copy link
Author

drorata commented Feb 4, 2015

Sounds interesting but I don't know how to pass arguments to the pip install. Can I use pip and the variables you mentioned?

@QuLogic
Copy link
Member

QuLogic commented Feb 24, 2015

@drorata Do you have a geos-config that outputs the correct path?

@QuLogic QuLogic self-assigned this Feb 24, 2015
QuLogic added a commit to QuLogic/cartopy that referenced this issue Feb 24, 2015
@drorata
Copy link
Author

drorata commented Feb 28, 2015

@QuLogic I have this binary installed (/opt/local/bin/geos-config). What should I do with it?

@QuLogic
Copy link
Member

QuLogic commented Feb 28, 2015

I've opened a PR (#577) which should automatically determine paths using the geos-config binary. If you're able, maybe you can try installing via that branch. I'm pushing to get this applied before 0.12.0 it released and certainly some confirmation that it will work in cases such as yours will help the argument.

If you are unable to do that, that's fine. I don't know if @pelson's suggestion would work otherwise.

@QuLogic
Copy link
Member

QuLogic commented Feb 28, 2015

BTW, you don't need to (explicitly) clone the repo to test; you can install directly via pip install git+https://github.com/QuLogic/cartopy.git@requirements, though I think it still requires you to have git installed.

@drorata
Copy link
Author

drorata commented Feb 28, 2015

I just tried your suggestion, but it did not work:

Command "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools, tokenize;__file__='/tmp/pip-iNPm2B-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-zKQV6R-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-iNPm2B-build

@QuLogic
Copy link
Member

QuLogic commented Feb 28, 2015

You need to post the beginning of the error, not the end.

@QuLogic
Copy link
Member

QuLogic commented Mar 3, 2015

@drorata ping?

@drorata
Copy link
Author

drorata commented Mar 3, 2015

@QuLogic sorry --- I'm very busy. I'll post the complete error as soon as possible.

@pelson
Copy link
Member

pelson commented May 1, 2015

Found what looks like a solution. A ``.pydistutils.cfg` file may be an option. See http://stackoverflow.com/questions/15725869/pass-build-ext-options-to-pip-install.

@lkilcher
Copy link

I was getting the same error. I resolved it by upgrading goes from 3.5.0 to 3.6.1. On my OSX machine, I did: brew upgrade geos.

@wmwijaya
Copy link

wmwijaya commented Apr 3, 2023

I was getting the same error. I resolved it by upgrading goes from 3.5.0 to 3.6.1. On my OSX machine, I did: brew upgrade geos.

This way solved the problem in MacOS 12.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants