problems installing scrapy on osx 10.10.3 using pip - python

I am unable to install Scrapy on osx 10.10.3. I ran pip install Scrapy and received the error message below indicating that twisted cannot be installed. I ran xcode-select --install to ensure that xcode tools are installed. I also tried running sudo pip install Scrapy. Any suggestions?
here is the error message I receive:
copying twisted/python/sendmsg.c -> build/lib.macosx-10.5-x86_64-2.7/twisted/python
copying twisted/runner/portmap.c -> build/lib.macosx-10.5-x86_64-2.7/twisted/runner
copying twisted/test/raiser.c -> build/lib.macosx-10.5-x86_64-2.7/twisted/test
running build_ext
gcc -fno-strict-aliasing -I/Applications/anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Applications/anaconda/include/python2.7 -c conftest.c -o conftest.o
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
building 'twisted.test.raiser' extension
creating build/temp.macosx-10.5-x86_64-2.7
creating build/temp.macosx-10.5-x86_64-2.7/twisted
creating build/temp.macosx-10.5-x86_64-2.7/twisted/test
gcc -fno-strict-aliasing -I/Applications/anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Applications/anaconda/include/python2.7 -c twisted/test/raiser.c -o build/temp.macosx-10.5-x86_64-2.7/twisted/test/raiser.o
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
error: command 'gcc' failed with exit status 69
----------------------------------------
Command "/Applications/anaconda/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/_1/4jqhq6xs6psby9hcm82k0w_h0000gn/T/pip-build-iVRJiH/Twisted/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/_1/4jqhq6xs6psby9hcm82k0w_h0000gn/T/pip-SWIIhy-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/_1/4jqhq6xs6psby9hcm82k0w_h0000gn/T/pip-build-iVRJiH/Twisted

The hint is right there in the error message:
Agreeing to the Xcode/iOS license requires admin privileges, please
re-run as root via sudo.
However, I would recommend against running the actual installation as root. Just accepting the XCode license once by doing
sudo xcodebuild -license
and then re-running the installation should do the trick.

Related

Mac OS: Catalina: unable to execute 'gcc': No such file or directory

MAC OS Catalina(10.15.1) seems to have created some problems for building code that uses gcc. I am trying to build a python application which is running into the following error.
Running setup.py install for pdftotext: started
Running setup.py install for pdftotext: finished with status 'error'
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yzaiz97e/pdftotext/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-67h0h5_9-record/install-record.txt --single-version-externally-managed --compile:
WARNING: pkg-config not found--guessing at poppler version.
If the build fails, install pkg-config and try again.
/usr/lib64/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running install
running build
running build_ext
building 'pdftotext' extension
creating build
creating build/temp.linux-x86_64-3.7
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -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 -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/usr/include/python3.7m -c pdftotext.cpp -o build/temp.linux-x86_64-3.7/pdftotext.o -Wall
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
gcc is definitely installed on the system but somehow not visible to pip installer.
which gcc
/usr/bin/gcc
packaging % gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Any help to debug the issue would be appreciated.

Problem with installing Charm-Crypto for Python3

Hello fellow Programmers,
currently I am trying to install Charm-Crypto 0.43 on my Ubuntu. Unfortunately nothing seems to work. I tried the linked manual install, as well as pip install charm-crypto
I always get this Error log:
[...]
running build_ext
building 'charm.core.math.pairing' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/charm
creating build/temp.linux-x86_64-3.6/charm/core
creating build/temp.linux-x86_64-3.6/charm/core/math
creating build/temp.linux-x86_64-3.6/charm/core/math/pairing
creating build/temp.linux-x86_64-3.6/charm/core/utilities
creating build/temp.linux-x86_64-3.6/charm/core/benchmark
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DBENCHMARK_ENABLED=1 -Icharm/core/utilities/ -Icharm/core/benchmark/ -I/usr/include/python3.6m -I/home/debbi/Documents/env/01_chainmed/include/python3.6m -c charm/core/math/pairing/pairingmodule.c -o build/temp.linux-x86_64-3.6/charm/core/math/pairing/pairingmodule.o
In file included from charm/core/math/pairing/pairingmodule.c:30:0:
charm/core/math/pairing/pairingmodule.h:38:10: fatal error: pbc/pbc.h: No such file or directory
#include <pbc/pbc.h>
^~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/debbi/Documents/env/01_chainmed/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-wfcawqbr/charm-crypto/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-record-pfeoo7we/install-record.txt --single-version-externally-managed --compile --install-headers /home/debbi/Documents/env/01_chainmed/include/site/python3.6/charm-crypto" failed with error code 1 in /tmp/pip-install-wfcawqbr/charm-crypto/
I tried every suggested install of python-dev and libssl etc. I could find by googling (this, and this, and this just to name a view). I also tried installing it using python2.7 and 3.6 Unfortunately nothing worked for me.
Maybe anyone knows this Problem?
Thank You for your time in advance.
There is this Website: http://pages.cs.wisc.edu/~ace/install-charm.html
Just follow the Instructions, but for me I had to manually check out the Charm-0.50 dev branch and then install this version.

Error occurs when Install scrapy in python virtualenv use pip

system info :
Ubuntu 14.10
Linux vagrant-ubuntu-trusty 3.16.0-23-generic #31-Ubuntu SMP Tue Oct 21 17:56:17 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
I first install virtualenv in ubuntu
sudo pip install virtualenv
virtualenv scrapy-env
cd scrapy-env/
source bin/activate
pip install scrapy
then I get this error:
running build_ext
building 'twisted.test.raiser' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/twisted
creating build/temp.linux-x86_64-2.7/src/twisted/test
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/twisted/test/raiser.c -o build/temp.linux-x86_64-2.7/src/twisted/test/raiser.o
src/twisted/test/raiser.c:4:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/vagrant/pyenv/scrapy-env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-NJKTtN/Twisted/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-_i2ueH-record/install-record.txt --single-version-externally-managed --compile --install-headers /vagrant/pyenv/scrapy-env/include/site/python2.7/Twisted" failed with error code 1 in /tmp/pip-build-NJKTtN/Twisted/
Any suggestions that could help me fix it?
You don't have Python developer package installed. Try installing them
sudo apt-get install python-dev # for python2.x installs
sudo apt-get install python3-dev # for python3.x installs

How to install PyGreSQL using Virtualenv on Mac OS Sierra

I'm configuring a virtualenv to work with a legacy webservices application developed on python using flask microframework and PostgreSQLdatabase, this application use PyGreSQL 5.0.3 as a dependency to connect with the database.
I have installed the PostgreSQL 9.6.1, i installed it using:
brew install postgresql
I have installed and working with Python 2.7
When i run the
pip install -r requirements.txt
i'm gettin this error message:
Running setup.py install for PyGreSQL ... error
Complete output from command /Users/user/Development/Projects/flask/ws/myenv/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/t1/x7lrbmyd3lq0k8ngknwg1zx00000gn/T/pip-build-KjQgiU/PyGreSQL/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/t1/x7lrbmyd3lq0k8ngknwg1zx00000gn/T/pip-3lBp1N-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/user/Development/Projects/flask/ws/myenv/include/site/python2.7/PyGreSQL:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.12-intel-2.7
copying pg.py -> build/lib.macosx-10.12-intel-2.7
copying pgdb.py -> build/lib.macosx-10.12-intel-2.7
running build_ext
building '_pg' extension
creating build/temp.macosx-10.12-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPYGRESQL_VERSION=5.0.3 -DDIRECT_ACCESS -DLARGE_OBJECTS -DDEFAULT_VARS -DESCAPING_FUNCS -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/Cellar/postgresql/9.6.1/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pgmodule.c -o build/temp.macosx-10.12-intel-2.7/pgmodule.o -O2 -funsigned-char -Wall -Werror
pgmodule.c:4143:9: error: implicit conversion loses integer precision: 'long' to 'int' [-Werror,-Wshorten-64-to-32]
num = PyInt_AsLong(param);
~ ^~~~~~~~~~~~~~~~~~~
pgmodule.c:4448:12: error: implicit conversion loses integer precision: 'long' to 'int' [-Werror,-Wshorten-64-to-32]
pgport = PyInt_AsLong(pg_default_port);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
error: command 'cc' failed with exit status 1
----------------------------------------
As you can see, this error is derived from compile and build the package, but I have the postgresql library installed, which I see as the common problem in other cases. On the other hand I have installed the command line tools of mac, i changed my compiler from cc to gcc and i'm having the same error
Any idea how to solve it, thank you in advance
I wasn't able to install any version of this package normally. It's probably a problem with the package.
Workaround: If you turn off warn-as-error, it should compile fine.
export CFLAGS="-Wno-error"
pip install PyGreSQL

How to install python cairo?

I am new to python3. I have created the virtual environment. I try to install the pycairo package using pip command. I need install python cairo. Please see the below info
pip install git+http://anongit.freedesktop.org/git/pycairo
Downloading/unpacking git+http://anongit.freedesktop.org/git/pycairo
Cloning http://anongit.freedesktop.org/git/pycairo to /tmp/pip-0c_foz-build
Running setup.py egg_info for package from git+http://anongit.freedesktop.org/git/pycairo
cairo >= 1.10.2 Successful
Installing collected packages: pycairo
Running setup.py install for pycairo
cairo >= 1.10.2 Successful
building 'cairo._cairo' extension
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/python3.2mu -c src/cairomodule.c -o build/temp.linux-i686-3.2/src/cairomodule.o
src/cairomodule.c:22:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /home/nyros/Desktop/NewWeb/venv/bin/python3 -c "import setuptools;__file__='/tmp/pip-0c_foz-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lo0egc-record/install-record.txt --single-version-externally-managed --install-headers /home/nyros/Desktop/NewWeb/venv/include/site/python3.2:
cairo >= 1.10.2 Successful
creating py3cairo.pc
creating src/config.h
running install
running build
running build_ext
building 'cairo._cairo' extension
creating build
creating build/temp.linux-i686-3.2
creating build/temp.linux-i686-3.2/src
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/python3.2mu -c src/cairomodule.c -o build/temp.linux-i686-3.2/src/cairomodule.o
src/cairomodule.c:22:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /home/nyros/Desktop/NewWeb/venv/bin/python3 -c "import setuptools;__file__='/tmp/pip-0c_foz-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lo0egc-record/install-record.txt --single-version-externally-managed --install-headers /home/nyros/Desktop/NewWeb/venv/include/site/python3.2 failed with error code 1 in /tmp/pip-0c_foz-build
Storing complete log in /home/nyros/.pip/pip.log
But I got the error. Please solve my problem. Thanks
I think this may solve your problem:
sudo apt-get install python3-dev
But I cannot guarantee that this will work 100% :-)

Categories