Unable to setup sphinx on gitlab-ci
I'm trying to setup and run sphnix on gitlab-ci. It's installed on my local machine and server works fine. But not at gitlab-ci
Here's a part of my gitlab-ci:
before_script:
- apt-get update -qq && apt-get install -yqq [......] python-pip
- pip install sphinx
# ..........
- bundle exec rake ts:index
- bundle exec rake ts:start
The output of installing sphinx:
$ pip install sphinx
Downloading/unpacking sphinx
[................]
Installing collected packages: sphinx, babel, [.............]
Compiling /tmp/pip-build-V2Tzes/Jinja2/jinja2/asyncfilters.py ...
File "/tmp/pip-build-V2Tzes/Jinja2/jinja2/asyncfilters.py", line 7
async def auto_to_seq(value):
^
SyntaxError: invalid syntax
Compiling /tmp/pip-build-V2Tzes/Jinja2/jinja2/asyncsupport.py ...
File "/tmp/pip-build-V2Tzes/Jinja2/jinja2/asyncsupport.py", line 22
async def concat_async(async_gen):
^
SyntaxError: invalid syntax
Running setup.py install for MarkupSafe
building 'markupsafe._speedups' extension
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 markupsafe/_speedups.c -o build/temp.linux-x86_64-2.7/markupsafe/_speedups.o
markupsafe/_speedups.c:12:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
==========================================================================
WARNING: The C extension could not be compiled, speedups are not enabled.
Failure information, if any, is above.
Retrying the build without the C extension now.
==========================================================================
WARNING: The C extension could not be compiled, speedups are not enabled.
Plain-Python installation succeeded.
==========================================================================
Successfully installed sphinx babel sphinxcontrib-websupport Jinja2 alabaster imagesize Pygments snowballstemmer docutils packaging typing pytz MarkupSafe pyparsing
Cleaning up...
As you can see, it's successeded.
However, when it gets to this point, it fails:
$ bundle exec rake ts:index
Generating configuration to /builds/my_user/my_ap123/config/test.sphinx.conf
sh: 1: indexer: not found
The Sphinx indexing command failed:
Command: indexer --config "/builds/my_user/my_ap123/config/test.sphinx.conf" --all
Status: 127
Output: See above
Why is that? How to fix it?
pip install sphinx did not fully succeed. during installation, it is complaining about missing Python.h
fatal error: Python.h: No such file or directory
You need to install a development package of python as well.
For python3x use
sudo apt-get install python3-dev
For python2x use
sudo apt-get install python-dev
You can add it to before_script
before_script:
- apt-get update -qq && apt-get install -yqq [......] python-pip python3-dev
- pip install sphinx
Update:
To install sphinx search engine using gitlab ci update your before_script as follow
before_script:
- add-apt-repository ppa:builds/sphinxsearch-rel22 sphinxsearch
- apt-get update -qq && apt-get install -yqq [......] python-pip python3-dev mysql-client unixodbc libpq5
- pip install sphinxsearch
Related
kivy/graphics/svg.pyx:469:9: 'reload' already defined
building 'kivy.graphics.svg' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Ikivy/include -Ikivy/include -I/usr/include/python2.7 -c kivy/graphics/svg.c -o build/temp.linux- x86_64-2.7/kivy/graphics/svg.o
kivy/graphics/svg.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#error Do not use this file, it is the result of a failed Cython compilation.
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
I am trying to install kivy on ubuntu 16.04 . When I execute " python setup.py build_ext --inplace -f " this instruction shows above error please help me...
It is likely that you cython version is incorrect.
For the current version of kivy (1.10.0), I've had success with cython==0.26. Install failed with 0.27.1 and 0.27.3 with the same error as yours.
So in your relevant anaconda environment, uninstall the current cython:
pip uninstall cython==0.2x.x
(give the correct version of your installed cython)
or
conda uninstall cython
Install cython==0.26:
pip install cython==0.26
(there doesn't seem to be a 0.26 version of cython in the linux64 anaconda channel)
Then: pip install kivy
IMHO much easier is to use apt-get or pip.
pip install Cython #pip or pip3
pip install Kivy
EDIT:
Of course install gcc
What's your cython version? you might want to update it to 0.24 or 0.25 to build kivy.
pip install -U cython==0.25
I am using Kivy on Ubuntu 16.04 LTS and used the following installation steps. Kivy examples is optional:
$ sudo add-apt-repository ppa:kivy-team/kivy
$ sudo apt-get update
$ sudo apt-get install python3-kivy
$ sudo apt-get install python-kivy-examples
$ sudo pip install --upgrade cython==0.26
For kivy version 1.10.0, cython must be 0.26
When i am trying to install Snappy on alpine linux using:
pip install snappy
I am getting the following error when it tries to install a required package called cypari.
I installed snappy from "apk add snappy"
gcc -fno-strict-aliasing -Os -fomit-frame-pointer -g -DNDEBUG -Os -fomit-frame-pointer -g -fPIC -Ilibcache/pari64/include -I/usr/include/python2.7 -c cypari_src/_pari.c -o build/temp.linux-x86_64-2.7/cypari_src/_pari.o
In file included from cypari_src/_pari.c:460:0:
cypari_src/implementation.c:47:22: fatal error: execinfo.h: No such file or directory
#include <execinfo.h>
I solved this problem by running apk add libexecinfo libexecinfo-dev
Then using apk add snappy
Then using pip install python-snappy
if you use pip install snappy it installs a completely different library which is this
Combining previous answers, this minimal Dockerfile works for me
FROM python:3.6-alpine
RUN apk add --no-cache g++ snappy-dev && \
pip install --no-cache-dir --ignore-installed python-snappy
Installing execinfo-dev suffice, since execinfo.h is in that package.
You can check it here:
http://pkgs.alpinelinux.org/contents?file=execinfo.h&path=&name=&branch=&repo=&arch=
apk add snappy
will install the package, so you don't need to:
pip install snappy
To expand on the answer from #dwardu, I also had to install the snappy-dev package. That fixed this error I was getting from pip install:
snappy-c.h: No such file or directory
I need to install psycopg2 for openerp installation process, but I always faced that error. I've already used pip and easy_install and my gcc is the latest version. I really need your help to solve my problem.
This is my complete error with easy_install:
[root#server01 ~]# easy_install psycopg2
Searching for psycopg2
Reading http://pypi.python.org/simple/psycopg2/
Reading http://initd.org/psycopg/
Reading http://initd.org/projects/psycopg2
Best match: psycopg2 2.4.5
Downloading http://initd.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz
Processing psycopg2-2.4.5.tar.gz
Running psycopg2-2.4.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-anWVvJ/psycopg2-2.4.5/egg-dist-tmp-cZbdtn
no previously-included directories found matching 'doc/src/_build' In file included from psycopg/psycopgmodule.c:27:
./psycopg/psycopg.h:31:22: error: libpq-fe.h: No such file or directory In file included from psycopg/psycopgmodule.c:29:
...
error: Setup script exited with error: command 'gcc' failed with exit status 1
You'll need to install the development package for PostgreSQL, which for instance under Ubuntu is a sudo apt-get install libpq-dev... and for CentOS it's yum install postgresql-devel
For the case of CentOS, I had this very same problem, that I solved installing these packages:
sudo yum install postgresql-libs
sudo yum install postgresql-devel
sudo yum install python-devel
only then, I was able to perform successfully:
sudo easy_install psycopg2
May Your system is missing the Python headers. To fix this, run:
sudo apt-get install python-dev
or
sudo apt-get install python3-dev
On a fresh ubuntu 14.04.2 LTS on an EC2 instance, I was able to install psycopg2 after instaling the following packages:
sudo apt-get install gcc
sudo apt-get install postgres-xc-server-dev
sudo apt-get install libpq-dev
sudo apt-get install postgresql-client-common
sudo apt-get install postgresql-common
And on a fresh AMI linux (CentOS) instance:
sudo yum install postgresql-devel
sudo yum install gcc*
Hope it helps,
Erez
i had this problem but was solved by running:
pip install -Iv psycopg2==2.7.7
There is a problem installing the latest version + python3.7
I've been trying to install pgsql on a plain Amazon Linux EC2 instance, and have been getting this error. Per Nicolás answer, I installed his suggested list of packages, but I continued to get the error. Looking more closely at the error, I noticed that the gcc command was including pgsql93 files:
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.1 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x09030A -DHAVE_LO64=1 -I/usr/include/python2.7 -I. -I/usr/include/pgsql93 -I/usr/include/pgsql93/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
Looking in /usr/include/ I see pgsql92/ but not pgsql93/. So I took a look at what pgsql-related yum packages were installed and I noticed these:
postgresql92.x86_64
postgresql92-devel.x86_64
postgresql92-libs.x86_64
postgresql93.x86_64
postgresql93-libs.x86_64
Seemed to me like there ought to be a postgresql93-devel, so I tried:
sudo yum install postgresql93-devel
And that fixed the problem for me! So I guess the theme is: Look at the gcc call, and see what dir it's pulling in. Follow the crumbs from there.
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.
In centos 7. i'd use sudo yum install postgresql96-devel.x86_64 to solved my problem.
The invocation of gcc failed, gcc couldn't compile the source. Probably the cause is
./psycopg/psycopg.h:31:22: error: libpq-fe.h: No such file or directory In file included from psycopg/psycopgmodule.c:29:
that the header libpq-fe.h is nowhere in the search path if you have it at all.
This worked for me on Ubuntu Server 14.10 64-bit:
sudo apt-get install libpqxx-dev
For me, the missing package was
libpqxx-devel.x86_64
psycopg2 is also available on PyPI in the form of wheel packages for the most common platform (Linux, OSX, Windows): this should make you able to install a binary version of the module, not requiring the above build or runtime prerequisites.
You can use this command : pip install psycopg2-binary
Note The psycopg2-binary package is meant for beginners to start playing with Python and PostgreSQL without the need to meet the build requirements.
If you are the maintainer of a publish package depending on psycopg2 you shouldn’t use ‘psycopg2-binary’ as a module dependency. For production use you are advised to use the source distribution.
I was running 3.9-alpine for CICD and had to install these packages to get it working;
apk add postgresql-dev
apk add gcc
apk add musl-dev
Then I was able to run a pip install psycopg2 as normal.
I'm attempting to install PyQuery via pip but I'm getting an error I do not understand. The command I used was:
sudo pip install pyquery
I get the output below:
Requirement already satisfied (use --upgrade to upgrade): pyquery in /usr/local/lib/python2.7/dist-packages
Downloading/unpacking lxml>=2.1 (from pyquery)
Running setup.py egg_info for package lxml
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.3.0.
Building without Cython.
ERROR: /bin/sh: 1: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
Downloading/unpacking cssselect (from pyquery)
Running setup.py egg_info for package cssselect
no previously-included directories found matching 'docs/_build'
Installing collected packages: lxml, cssselect
Running setup.py install for lxml
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.3.0.
Building without Cython.
ERROR: /bin/sh: 1: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/imageek/scripts/facebook/build/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.7/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c:16:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/imageek/scripts/facebook/build/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-dyUZWZ-record/install-record.txt:
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.3.0.
Building without Cython.
ERROR: /bin/sh: 1: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
running install
running build
running build_py
copying src/lxml/includes/lxml-version.h -> build/lib.linux-i686-2.7/lxml/includes
running build_ext
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/imageek/scripts/facebook/build/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.7/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c:16:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/imageek/scripts/facebook/build/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-dyUZWZ-record/install-record.txt failed with error code 1
Storing complete log in /home/imageek/.pip/pip.log
I have a feeling it's something to do with dependencies, but should 'pip' not automatically install dependencies?
You have missing dependencies. Try running:
sudo apt-get install libxml2-dev libxslt1-dev python-dev
Put following lines in a file called pyquery.sh
#ADD SWAP FOR lxml COMPILATION
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
#ACTIVATE ENV
#Comment following line if you don't use virtualenv
#source /home/py3/bin/activate
#INSTALL ALL DEP
add-apt-repository -y ppa:ubuntu-toolchain-r/test
apt-get -y update
apt-get -y install gcc
apt-get -y install g++
apt-get -y install build-essential
apt-get -y install python-dev
apt-get -y install libxml2-dev
apt-get -y install libxslt-dev
apt-get -y install libxslt1-dev
apt-get -y install zlib1g-dev
apt-get -y install python3-setuptools
apt-get -y install python3-lxml
apt-get -y install python3-lxml-dbg
apt-get -y install python3-dev
pip install lxml
pip install pyquery
#REMOVE SWAP
swapoff /swapfile
rm -rf /swapfile
After this run this file by:
source pyquery.sh
I am trying to set up a virtualenv for a Django project. It needs MySQL-python. I'm trying to replicate the production environment, which uses Python 2.5. My Ubuntu desktop has Python 2.5. I can install the Python 2.5 virtualenv with virtualenv --python=/usr/bin/python2.5 .... However when I try to pip install MySQL-python, I get this output:
$ pip install MySQL-python
Downloading/unpacking MySQL-python
Running setup.py egg_info for package MySQL-python
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/include/python2.5 -c _mysql.c -o build/temp.linux-i686-2.5/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -DUNIV_LINUX -DUNIV_LINUX
In file included from _mysql.c:29:
pymemcompat.h:10: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
I have installed the python-dev Ubuntu deb package, but that's for Python 2.6.
How else can I get MySQL-python installed?
I had this same problem on an Ubuntu box. Prior to installing MySQL-python via pip, I needed to compile the module and dependencies from source using the following command:
sudo apt-get build-dep python-mysqldb
see this article - http://theviceprogrammer.com/?p=238
Actually, found a solution, I enabled the Dead Snakes - old python version repository, then I could aptitude install python2.5-dev, and then pip install MySQL-python worked
Instead of using pip or easy_install, you can use apt-get:
sudo apt-get install python-mysqldb
Requiring from source as per adam's reply wasn't require for me, on Ubuntu 12.04 w/ Python 2.5