How to properly download a Python module (xlwings) on mac terminal? - python

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.

Related

install pycrypto on python3.6

I am running Centos7 with Python 3.6. I am trying to install pycrypto with the command "pip3 install pycrypto". I also installed the dev tools, so gcc is installed. I am getting the following output.
What am I missing?
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash._MD2' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
gcc -pthread -Wno-unused-result -Wsign-compare -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python3.6m -c src/MD2.c -o build/temp.linux-x86_64-3.6/src/MD2.o
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-h6pl3s2f/pycrypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-9fjag3e5-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-h6pl3s2f/pycrypto/
That did not work, but I did find the answer in the article.
I ran "yum -y install python3-devel" and this fixed my issue. I was then able to install pycrypto.
I also had the same issue for CentOS.
However, it turned out I was missing one of the dependencies.
sudo yum install gcc
sudo yum install gcc-c++
sudo yum install python-devel
sudo pip install pycrypto

How to fix gcc error produced by pip install?

I tried to install a python package from PyPI with the following command
sudo pip3 install switcheo
The installation fails and show this error message:
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c scrypt-1.2.1/libcperciva/util/asprintf.c -o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/util/asprintf.o
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.7/src/scrypt.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/lib/crypto/crypto_scrypt_smix_sse2.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/lib/crypto/crypto_scrypt_smix.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/lib/crypto/crypto_scrypt.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/lib/scryptenc/scryptenc.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/lib/scryptenc/scryptenc_cpuperf.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/lib/util/memlimit.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/alg/sha256.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/crypto/crypto_aes_aesni.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/crypto/crypto_aes.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/crypto/crypto_aesctr.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/crypto/crypto_entropy.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/util/entropy.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/util/insecure_memzero.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/util/warnp.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/util/humansize.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/util/asprintf.o -lcrypto -o build/lib.macosx-10.9-x86_64-3.7/_scrypt.cpython-37m-darwin.so
ld: library not found for -lcrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-2cof4cvu/scrypt/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-1ecvxjh1/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-2cof4cvu/scrypt/
Install the libssl-dev package
On Ubuntu, it's as simple as sudo apt-get install libssl-dev
On mac, you need to install openssl: brew install openssl
If that doesn't work, you need to install Homebrew. You should use Homebrew, it makes installing much easier.
If that still doesn't work, you can install libssl-dev and make a symlink:
ln -s /usr/local/Cellar/openssl/1.0.2p/lib/libssl.dylib /usr/local/lib/

Install cartopy 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?
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

Build errors when trying to install pylibmc

Just got a new laptop, setting up my dev environment from scratch, and I'm getting this weird error that doesn't seem to be a result of missing dependencies (though I could be wrong). I'm working in a virtualenv with Python 2.7.3. Libevent, libmemcached and memcached were all installed with Homebrew earlier.
(grlli)Tylers-MacBook-Pro:grlli tyler$ pip install pylibmc
Downloading/unpacking pylibmc
Running setup.py egg_info for package pylibmc
Installing collected packages: pylibmc
Running setup.py install for pylibmc
building '_pylibmc' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -I/usr/local/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DUSE_ZLIB -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _pylibmcmodule.c -o build/temp.macosx-10.8-intel-2.7/_pylibmcmodule.o -fno-strict-aliasing
_pylibmcmodule.c:1895:33: error: member reference base type 'const void' is not a structure or union
svr->hostname, svr->port);
~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_stdio.h:56:62: note: expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
^
1 error generated.
error: command 'cc' failed with exit status 1
Complete output from command /Users/tyler/projects/envs/grlli/bin/python -c "import setuptools;__file__='/Users/tyler/projects/envs/grlli/build/pylibmc/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/1_/jkd0_x495gs0g8v7z2pgz3bc0000gn/T/pip-E_pLFk-record/install-record.txt --single-version-externally-managed --install-headers /Users/tyler/projects/envs/grlli/bin/../include/site/python2.7:
running install
running build
running build_py
running build_ext
building '_pylibmc' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -I/usr/local/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DUSE_ZLIB -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _pylibmcmodule.c -o build/temp.macosx-10.8-intel-2.7/_pylibmcmodule.o -fno-strict-aliasing
_pylibmcmodule.c:1895:33: error: member reference base type 'const void' is not a structure or union
svr->hostname, svr->port);
~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_stdio.h:56:62: note: expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
^
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command /Users/tyler/projects/envs/grlli/bin/python -c "import setuptools;__file__='/Users/tyler/projects/envs/grlli/build/pylibmc/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/1_/jkd0_x495gs0g8v7z2pgz3bc0000gn/T/pip-E_pLFk-record/install-record.txt --single-version-externally-managed --install-headers /Users/tyler/projects/envs/grlli/bin/../include/site/python2.7 failed with error code 1 in /Users/tyler/projects/envs/grlli/build/pylibmc
Storing complete log in /Users/tyler/.pip/pip.log
Any help is greatly appreciated!
I ran into the same issue. The one thing that fixed it for me was updating setuptools to the latest version.
pip install setuptools --upgrade
Try to install pylibmc 1.2.3, it helped me.

gcc: _mssql.c: No such file or directory

I'm trying to compile pymssql for python 2.5. I'm doing this because I think the version of pymssql I have is compiled for python 2.4. This is the error I get which makes me think that:
/home/username/lib/python2.5/pymssql.py:30: RuntimeWarning: Python C API version mismatch for module _mssql: This Python has API version 1013, module _mssql has version 1012.
import _mssql
Anyway I'm on Ubuntu 10.10 and have installed python2.5 and python2.5-dev via the deadsnakes ppa. I've created an virtualenv with using python2.5 like so
mkvirtualenv pymssql -p /usr/bin/python2.5
I've install cython from pip and am trying to install pymssql from pip but am getting this error
Downloading/unpacking pymssql
Running setup.py egg_info for package pymssql
Installing collected packages: pymssql
Running setup.py install for pymssql
building '_mssql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/neil/virtualenv/pymssql/build/pymssql/freetds/nix_32/include -I/usr/include/python2.5 -c _mssql.c -o build/temp.linux-i686-2.5/_mssql.o -DMSDBLIB
gcc: _mssql.c: No such file or directory
gcc: no input files
error: command 'gcc' failed with exit status 1
Complete output from command /home/neil/virtualenv/pymssql/bin/python2.5 -c "import setuptools;__file__='/home/neil/virtualenv/pymssql/build/pymssql/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-cEGXRy-record/install-record.txt --install-headers /home/neil/virtualenv/pymssql/include/site/python2.5:
running install
running build
running build_ext
building '_mssql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/neil/virtualenv/pymssql/build/pymssql/freetds/nix_32/include -I/usr/include/python2.5 -c _mssql.c -o build/temp.linux-i686-2.5/_mssql.o -DMSDBLIB
gcc: _mssql.c: No such file or directory
gcc: no input files
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /home/neil/virtualenv/pymssql/bin/python2.5 -c "import setuptools;__file__='/home/neil/virtualenv/pymssql/build/pymssql/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-cEGXRy-record/install-record.txt --install-headers /home/neil/virtualenv/pymssql/include/site/python2.5 failed with error code 1
Storing complete log in /home/neil/.pip/pip.log
Any ideas how to resolve this?
Turns out I needed to install pyrex from pip.
pip install pyrex

Categories

Resources