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
Related
Today I tried to install django CMS for a while on my Raspberry pi but it will not work. I Installed a fresh "RASPBIAN STRETCH LITE" then I entered following commands via an ssh connection:
sudo wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
sudo pip install Django==1.10
sudo pip install virtualenv
cd /srv
sudo mkdir django_cms
cd django_cms
sudo virtualenv env
source env/bin/activate
sudo pip install --upgrade pip
sudo pip install djangocms-installer
sudo mkdir django_site
cd django_site/
sudo djangocms -f -p . web_site
All this follows this guide
And this error get thrown after executing the last command above:
Creating the project
Please wait while I install dependencies
ERROR: cmd : [u'pip', u'install', u'-q', u'django-cms>=3.5,<3.6', u'djangocms-admin-style>=1.2,<1.3', u'django-treebeard>=4.0,<5.0', u'https://github.com/divio/djangocms-text-ckeditor/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-file/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-link/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-style/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-googlemap/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-snippet/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-picture/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-video/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-column/archive/master.zip?1520455195.14', u'easy_thumbnails', u'django-filer>=1.3', u'Django<2.0', u'pytz', u'django-classy-tags>=0.7', u'html5lib>=0.999999,<0.99999999', u'Pillow>=3.0', u'django-sekizai>=0.9', u'six'] :Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-FFzxtb/Pillow/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-CPB18v-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-FFzxtb/Pillow/
The installation has failed.
*****************************************************************
Check documentation at https://djangocms-installer.readthedocs.io
*****************************************************************
Traceback (most recent call last):
File "/usr/local/bin/djangocms", line 11, in <module>
sys.exit(execute())
File "/usr/local/lib/python2.7/dist-packages/djangocms_installer/main.py", line 33, in execute
verbose=config_data.verbose
File "/usr/local/lib/python2.7/dist-packages/djangocms_installer/install/__init__.py", line 95, in requirements
output = subprocess.check_output(['pip'] + args, stderr=subprocess.STDOUT)
File "/usr/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'pip', u'install', u'-q', u'django-cms>=3.5,<3.6', u'djangocms-admin-style>=1.2,<1.3', u'django-treebeard>=4.0,<5.0', u'https://github.com/divio/djangocms-text-ckeditor/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-file/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-link/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-style/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-googlemap/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-snippet/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-picture/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-video/archive/master.zip?1520455195.14', u'https://github.com/divio/djangocms-column/archive/master.zip?1520455195.14', u'easy_thumbnails', u'django-filer>=1.3', u'Django<2.0', u'pytz', u'django-classy-tags>=0.7', u'html5lib>=0.999999,<0.99999999', u'Pillow>=3.0', u'django-sekizai>=0.9', u'six']' returned non-zero exit status 1
Does anyone of you have an solution for this?
(My Python version: 2.7.13)
It looks like it is the Pillow installation that is failing. You need to install the python development libraries first
# Python 2
sudo apt-get install python-dev python-setuptools
# Python 3
sudo apt-get install python3-dev python3-setuptools
There are some other prerequisites you'll have to install as well. The Pillow docs give the following prerequisites for Ubuntu 14.04. I'm not sure what the equivalents are for Raspian Stretch
sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev \
tcl8.6-dev tk8.6-dev python-tk
See the Pillow docs for more information.
Since you're starting a new project, allow me to encourage you to use Python 3!
Instead of running the Django CMS installer, I would try to get Pillow to install by itself. If it fails, then the error message should be more obvious.
pip install Pillow
If the latest version fails, you could try 3.0, since that seems to be the minimum version for Django CMS.
pip install 'Pillow==3.0'
I am pretty new to python. I want to use KMean code, and I want to install scikit-learn or sklearn.
I used this code to attempt install these packages:
pip install -U sklearn
pip install -U scikit-learn
But I got this error:
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_reihaneh/sklearn/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-89YQB7-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_reihaneh/sklearn
Storing debug log for failure in /home/reihaneh/.pip/pip.log
What is the cause of the problem?
pip install -U <package>, short for pip install --upgrade <package>, will upgrade <package> to the most recent stable version in the pip repo.
pip install <package> will install the most recent stable version of <package> in the pip repo.
The difference is upgrading vs. installing. You want the latter.
scikit-learn requires scipy and numpy, so here are the commands you should issue:
pip install numpy
pip install scipy
pip install scikit-learn
If you already have any of the dependencies, just plug in a -U between pip install and the package name.
If you're using Python 3.x, replace pip with pip3.
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 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.
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