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?
This question was also raised as an issue at https://github.com/SciTools/cartopy/issues/535.
There was recently a bit of work to improve the pip install cartopy experience. Would you mind trying it again with cartopy v0.12.0.
See https://github.com/SciTools/cartopy/issues/610 for reference.
This is to answer the last question from Dror, since I am using macports and "pip install cartopy" failed to find "proj_api.h". To solve this:
You need to make sure that the proj port is installed: sudo port install proj
Help pip to locate the header in "/opt/local/include": CFLAGS="-I/opt/local/include" pip install cartopy
Cheers and HTH
Related
I have been trying to install xlwings module (on python 3.7) from terminal and getting some errors. At the last try I have reached a point that when I type pip3 install xlwings I receive below error.
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=550 -DPSUTIL_OSX=1 -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c psutil/_psutil_common.c -o build/temp.macosx-10.9-x86_64-3.7/psutil/_psutil_common.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;file='/private/var/folders/b_/kf3zc0xx3f51rbjcj5gcd9lh0000gn/T/pip-install-qo2pickz/psutil/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/var/folders/b_/kf3zc0xx3f51rbjcj5gcd9lh0000gn/T/pip-record-vpk41akr/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/b_/kf3zc0xx3f51rbjcj5gcd9lh0000gn/T/pip-install-qo2pickz/psutil/
I don't know anything about terminal but open to learn. Do you have any suggestions?
Thanks in advance!
I beleive you need to download and install the xcode developer tools (you don't need the full xcode install). It should fix the problem. See this answer on a related question for more details.
This question already has an answer here:
Error on "pip install -U channels" command using for otree (Running setup.py bdist_wheel for twisted ... error)
(1 answer)
Closed 4 years ago.
I am running virtualenv with python 3.6 and am trying to load test a django app. I get the following error after all dependencies install successfully before it.
Installing collected packages: greenlet, gevent, locustio
Running setup.py install for greenlet ... error
Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/3t/_nx5hykn0hsfs5v1x_svhdym0000gn/T/pip-install-lrm7ibd5/greenlet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/3t/_nx5hykn0hsfs5v1x_svhdym0000gn/T/pip-record-77exz0iu/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'greenlet' extension
creating build
creating build/temp.macosx-10.6-intel-3.6
gcc -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c greenlet.c -o build/temp.macosx-10.6-intel-3.6/greenlet.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/3t/_nx5hykn0hsfs5v1x_svhdym0000gn/T/pip-install-lrm7ibd5/greenlet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/3t/_nx5hykn0hsfs5v1x_svhdym0000gn/T/pip-record-77exz0iu/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/3t/_nx5hykn0hsfs5v1x_svhdym0000gn/T/pip-install-lrm7ibd5/greenlet/
run in terminal xcode-select --install this will install the xcode comand line tools (not xcode itself), you will be asked for a password and to agree to a license.
This happens because one (or more) of the packages include C extensions that need compilation, and to compile the xcode command line tools are needed.
A separate solution would be to install Anaconda python, miniconda if you don't need packages for scientific python, this python distribution includes a package manager (conda) that work much like pip but with the advantage of having precompiled packages
When trying to install the python wrapper of kenlm from pip within an anaconda environment, I get the error:
(lm_1b) adamg:lm_1b adamg$ pip install https://github.com/kpu/kenlm/archive/master.zip
Collecting https://github.com/kpu/kenlm/archive/master.zip
Cache entry deserialization failed, entry ignored
Downloading https://github.com/kpu/kenlm/archive/master.zip
- 4.4MB 51.1MB/s
Installing collected packages: kenlm
Running setup.py install for kenlm ... error
Complete output from command /Users/adamg/anaconda2/envs/lm_1b/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/2l/hd8b8vx566ld71lfd8hjglbc0000gn/T/pip-9yzty3hd-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/2l/hd8b8vx566ld71lfd8hjglbc0000gn/T/pip-aff_d2b8-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'kenlm' extension
creating build
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/util
creating build/temp.macosx-10.9-x86_64-3.6/lm
creating build/temp.macosx-10.9-x86_64-3.6/util/double-conversion
creating build/temp.macosx-10.9-x86_64-3.6/python
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/adamg/anaconda2/envs/lm_1b/include -arch x86_64 -I/Users/adamg/anaconda2/envs/lm_1b/include -arch x86_64 -I. -I/Users/adamg/anaconda2/envs/lm_1b/include/python3.6m -c util/pool.cc -o build/temp.macosx-10.9-x86_64-3.6/util/pool.o -O3 -DNDEBUG -DKENLM_MAX_ORDER=6 -std=c++11
In file included from util/pool.cc:1:
In file included from ./util/pool.hh:4:
/Users/adamg/anaconda2/envs/lm_1b/bin/../include/c++/v1/cassert:21:10: fatal error: 'assert.h' file not found
#include <assert.h>
^~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/Users/adamg/anaconda2/envs/lm_1b/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/2l/hd8b8vx566ld71lfd8hjglbc0000gn/T/pip-9yzty3hd-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/2l/hd8b8vx566ld71lfd8hjglbc0000gn/T/pip-aff_d2b8-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/2l/hd8b8vx566ld71lfd8hjglbc0000gn/T/pip-9yzty3hd-build/
The pip command works outside a conda environment, but then kenlm is not active within the environment. I was also able to run this from an AWS ec2 instance running linux, so maybe it's a Mac OSX issue. Any idea how can this be solved?
On Mac usually there is a problem on clang with different libraries that are missing. In most of this cases install Xcode will solve the problem. Also, in case this does not, you can also run in terminal xcode-select --install
Hope this helps!
I am running mysql#8.x version on my MacOS, I have installed mysql and mysql-connector-o with brew. Currently brew link with mysql.
Running Django project on my python3 virtual env I am receiving following error -
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'.
Did you install mysqlclient or MySQL-python?
and on installing the mysqlclient using pip, I am reciving following error
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -Dversion_info=(1,3,13,'final',0) -D__version__=1.3.13 -I/usr/local/Cellar/mysql/8.0.12/include/mysql -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c _mysql.c -o build/temp.macosx-10.13-x86_64-3.6/_mysql.o
clang -bundle -undefined dynamic_lookup -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk build/temp.macosx-10.13-x86_64-3.6/_mysql.o -L/usr/local/Cellar/mysql/8.0.12/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.13-x86_64-3.6/_mysql.cpython-36m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/Volumes/Samsung_T5/Work/python/repos/venv3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-kf2fkhtc/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-qwpjjw3e/install-record.txt --single-version-externally-managed --compile --install-headers /Volumes/Samsung_T5/Work/python/repos/venv3/bin/../include/site/python3.6/mysqlclient" failed with error code 1 in /private/tmp/pip-install-kf2fkhtc/mysqlclient/
As jordanm pointed it out, the issue was exactly with the missing openssl libraries, for which I followed these steps to fix my issue -
Installing openssl
brew install openssl
Now
pip install mysqlclient should work.
If it doesn't and still shows the same error library not found for -lssl, you could also try to link against brew's openssl:
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install mysqlclient
if this still does not work, you might need to use the --no-cache option of pip, e.g.
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip --no-cache install mysqlclient
After installing openssl via Homebrew I placed
export PATH="/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
in my .bash_profile and ran
source .bash_profile
and then
pip install mysqlclient
I need to install scipy. However, after about 5-7minutes of compilation time I am getting the follwing error on Ubuntu 14.04.3 LTS:
sudo pip3 install scipy
...
error: Command "x86_64-linux-gnu-g++ -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -D__STDC_FORMAT_MACROS=1 -Iscipy/sparse/sparsetools -I/usr/local/lib/python3.4/dist-packages/numpy/core/include -I/usr/include/python3.4m -c scipy/sparse/sparsetools/csc.cxx -o build/temp.linux-x86_64-3.4/scipy/sparse/sparsetools/csc.o" failed with exit status 4
In file included from /usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1777:0,
from /usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from scipy/sparse/sparsetools/sparsetools.h:5,
from scipy/sparse/sparsetools/csc.cxx:4:
/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by " \
^
x86_64-linux-gnu-g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-e3q7ek8f-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/scipy
Storing debug log for failure in /home/ubuntu/.pip/pip.log
Does anybody have an idea how to fix this?
It seems your numpy was installed using the distro package manager (i.e. by running apt-get install python3-numpy) since the numpy package is in the dist-packages directory of your python libs. Why don't you install scipy this way too? You can just run
sudo apt-get install python3-scipy
If you want to use pip, I suggest installing packages in virtualenv instances (or, even better, virtualenvwrapper) so that you avoid such conflicts. Otherwise, you should be using a systemwide version of pip, rather than a user installed one (the output says your pip belongs to user ubuntu), so you could first install it using apt-get and then make sure to use this new pip to install scipy.
Installing setuptools made it work for me on ubuntu 14.04