I have python 3.4 compiled from sources on my debian 7.8.
I have already installed some Python packages using pip and virtualenv (django, pillow etc), but i have an error installing python-phonenumbers (https://github.com/daviddrysdale/python-phonenumbers).
I tried it using virtualenv and without, running pip3 install phonenumbers and manually downloading archive and running python3 setup.py install. Every time I get same error:
Command "/usr/local/bin/python3.4 -c "import setuptools, tokenize;
__file__='/tmp/pip-build-ogsbxm_d/phonenumbers/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__)
.read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record /tmp/pip-98gunm55-record/install-record.txt
--single-version-externally-managed --compile"
failed with error code -9 in /tmp/pip-build-ogsbxm_d/phonenumbers
I tried it on my windows and ubuntu 14.04 - everything ok. How can i fix it?
For Ubuntu 14.04, from Docker image python:3.4.3-slim this combination worked for me:
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y python3.4-dev
sudo apt-get install -y libpq-dev
pip3 install psycopg2
Note build-essential package. It was crucial in my case. Maybe it will help you too.
Related
I am running a dockerfile on a ubuntu base image as follows :
FROM ubuntu:14.04
# Install dependencies
RUN apt-get update
RUN apt-get install -y \
software-properties-common
RUN add-apt-repository universe
RUN apt-get install -y python3.5 \
python3-pip
RUN apt-get install libav-tools -y
RUN apt-get update
RUN apt-get upgrade
#RUN apt-get install google-cloud-sdk
RUN pip3 install --upgrade pip
RUN pip3 install pandas
RUN pip3 install glob3
RUN pip3 install --upgrade pip
#RUN pip3 install pandas
RUN pip3 install glob3
#RUN pip3 install json
RUN pip3 install numpy
RUN pip3 install fuzzywuzzy
RUN pip3 install gensim
I have python 3.5 installed on this machine, but still I am getting the error as follows :
Collecting gensim
Downloading https://files.pythonhosted.org/packages/3a/bc/1415be59292a23ff123298b4b46ec4be80b3bfe72c8d188b58ab2653dee4/gensim-3.8.0.tar.gz (23.4MB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-klg_2vmh/gensim/setup.py'"'"'; __file__='"'"'/tmp/pip-install-klg_2vmh/gensim/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /tmp/pip-install-klg_2vmh/gensim/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-klg_2vmh/gensim/setup.py", line 23, in <module>
raise Exception('This version of gensim needs Python 2.7, 3.5 or later.')
Exception: This version of gensim needs Python 2.7, 3.5 or later.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Is there some specific version of Gensim that i need to download or this is some different error.
use python:3.5:
FROM python:3.5
RUN pip install gensim glob3 ....
that will save you a lot of space and steps ....
If you want to still using ubuntu:14.04 then you need to use this:
apt-get install -y python-dev && python3.5 -m pip install gensim
since python3.4 is the default on the image
I tried to install matplotlib ( third party lib) on gcp vm and failed.
gcp vm python documantation says use pip install -t lib/ <library_name> but actually, what they really mean: i.g. use pip install matplotlib -t lib/ <library_name> And it didn't work
I tried:
sudo pip install matplotlib -t env/gcplib
result:
"**Failed building wheel for subprocess32**"
"Command "/usr/bin/python -u -c "import setuptools,
tokenize;__file__='/tmp/pip-install-Rpkv8i/subprocess32/setup.py
';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __fi
le__, 'exec'))" install --record /tmp/pip-record-x4Y1E4/install-record.txt --single-version-externally-managed --co
mpile" **failed with error code 1** in /tmp/pip-install-Rpkv8i/subprocess32/"
I will very appreciate any help
Before attempting to install matplotlib, you need to install python-dev. You didn't mention what OS your VM was, but if it's Ubuntu, you would do that with:
sudo apt-get install python-dev
I am running ubuntu 16. I have both python 2.7 and 3.5 installed. I want to install cx_freeze latest version for python3. I downloaded the package from their website but couldn't run the setup.py file as it always gave me errors. Also i have installed pip3, but it still doesn't work for me. all the answers online are for older version of cx_freeze so a fresh answer for the new version will be helpful.
I install and upgrade pip3 with:
sudo -H install --upgrade pip
then I try to install cx_freeze with:
pip3 install cx_Freeze .
then i get the following errors:
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ngco46uq/cx-Freeze/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-q3n3cd2r-record/install-record.txt --single-version-externally-managed --compile"
failed with error code 1 in /tmp/pip-build-ngco46uq/cx-Freeze/
also anyone can tell me any other method to do so ?
Try installing Pip3 using :
sudo apt-get install python3-pip
If you have Python 2.7, you can try alternatives like py2exe
Not sure whats going on here but I am getting an error every time I try to install something using pip I get the following error:
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/b0/5843zgyj1yz3b8q2l7wrtj8h0000gn/T/pip-build-V4hy8S/PySocks/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/b0/5843zgyj1yz3b8q2l7wrtj8h0000gn/T/pip-bIOl7C-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/b0/5843zgyj1yz3b8q2l7wrtj8h0000gn/T/pip-build-V4hy8S/PySocks
Try
sudo pip install -U setuptools
If this doesn't solve your problem then
Firstly, you need the python-dev package because Pillow needs compile headers defined.
sudo apt-get install python-dev
On Ubuntu 14.04 you need few extra packages to get pillow working. Install all of them with the command:
sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
Seems that your PiP can't access Setuptools as per the "import setuptools" in the error. Try the below first then try running your pip install again.
sudo pip install -U setuptools
Solution from Github Issue
Launch the command prompt with 'run as administrator' rights before installing.
then try the script -
pip install package_name_here
if error is thrown,then import setup tools
pip install -U setuptools
if again error thrown then upgrade your pip installer using this script(personally worked for me)
python -m pip install --upgrade pip
I had the same problem on Windows Git Bash but installing setuptools did not fix it. Then I noticed another error message further up:
building 'twisted.test.raiser' extension error: Microsoft Visual C++ 14.0 is
required. Get it with "Microsoft Visual C++ Build Tools":
http://landinghub.visualstudio.com/visual-cpp-build-tools
That link was dead but ultimately this page had a link to the correct download: https://wiki.python.org/moin/WindowsCompilers
I installed Microsoft Build Tools for Visual Studio 2017 and that resolved it.
It majorly depends on the type of packages you suppose to install.
Frequently its failing due to the missing of
libsasl2-dev a package for authentication abstraction library which use in the Ubuntu version
First, install:
sudo apt-get install libsasl2-dev
then run:
pip install <<\package_name>>
first run as superuser:
sudo su
then :
pip install PyOpenGL PyOpenGL_accelerate
If you get this error on Windows, like I did, then just run the command-line tool (cmd.exe or Powershell) as Administrator and try again.
I made a program in Python3 which uses the package netifaces, I installed it with pip3 in two computers which had Ubuntu 13.04 and Ubuntu 13.10. However, I need to install it in other computer which has Ubuntu 12.04, and here I cannot install pip3 (python3-pip) because it is not on the repositories.
What I did was the next steps:
sudo aptitude install python3-setuptools
sudo easy_install3 pip
And then I had pip3 available. The problem is when I tried to install netifaces with pip3, which gives me next error:
error: command 'gcc' failed with exit status 1
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/netifaces/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-gkaftl-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/netifaces
Storing debug log for failure in /home/anubia/.pip/pip.log
If I install netifaces with pip or aptitude or apt-get the program does not recognise the library, because its documents are installed in python2 folders. I even tried to do a symbolic link from python3 folders to them, but it did not work.
Any ideas, please?
Solved!
I had to install the package python3-dev too, then the installation of netifaces from pip3 did not give me an error and now I can use it.
So the whole process (in my case) was:
sudo aptitude install python3-setuptools
sudo easy_install3 pip
sudo aptitude install python3-dev
sudo pip3 install netifaces