Docutils Building Wheels
Contact : docutils-develop@lists.sourceforge.net Date : 2015-05-06 Revision : 7887 Copyright : This document has been placed in the public domain.
Abstract
This document documents trials to build python wheels from Docutils. Once it is finished it might be driven into distribution or release documentation.
Requests
There is feature request 43 : Make setup.py build wheels.
Just add this to setup.cfg:
[bdist_wheel] universal = 1
Warning
Docutils is not fit for Universal Wheels. It supports both Python 2 and 3, but with different code (we use “2to3”). This makes it a candidate for Pure Python wheels.
As «universal» is false by default, no change to setup.cfg is required. The wheel builder detects that the package is pure Python and generates wheels for Py2 and Py3 depending under which python version it runs.
and bugs275 : Upload wheels to pypi
Currently docutils does not publish any wheels on pypi. Wheels make docutils faster to install (no need to run setup.py, which for a large number of packages can take some time), and is no more difficult than uploading an sdist (see https://packaging.python.org/en/latest/distributing.html#wheels for instructions).
Logbook
error: invalid command 'bdist_wheel'
python2.7 wheel-0.24.0/wheel install setuptools-15.0-py2.py3-none-any.whl
$ python2.7 setup.py --version 0.12
Logbook: with setuptools branch
gitpull/setuptools sandbox branch introduces setuptools in setup.py .
As of 2015-04-16: Not working yet, import docutils will raise an ImportError . Need to get packages detected correctly.
$ svn checkout svn://svn.code.sf.net/p/docutils/code/trunk/sandbox/gitpull/setuptools docutils-setuptools $ cd setuptools # create a virtualenv (however you like) $ pip install -e .
This includes support for generate python setup.py bdist_wheel :
$ python setup.py bdist_wheel running bdist_wheel running build running build_scripts installing to build/bdist.linux-x86_64/wheel running install running install_egg_info running egg_info writing docutils.egg-info/PKG-INFO writing top-level names to docutils.egg-info/top_level.txt writing dependency_links to docutils.egg-info/dependency_links.txt reading manifest file 'docutils.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'MANIFEST' warning: no files found matching '*' under directory 'extras' warning: no previously-included files matching '.cvsignore' found under directory '*' warning: no previously-included files matching '*~' found under directory '*' warning: no previously-included files matching '.DS_Store' found under directory '*' writing manifest file 'docutils.egg-info/SOURCES.txt' Copying docutils.egg-info to build/bdist.linux-x86_64/wheel/docutils-0.13.data/purelib/docutils-0.13-py2.7.egg-info running install_scripts creating build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts copying build/scripts-2.7/rst2pseudoxml.py -> build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts copying build/scripts-2.7/rst2man.py -> build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts copying build/scripts-2.7/rst2odt.py -> build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts copying build/scripts-2.7/rst2latex.py -> build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts copying build/scripts-2.7/rstpep2html.py -> build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts copying build/scripts-2.7/rst2s5.py -> build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts copying build/scripts-2.7/rst2odt_prepstyles.py -> build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts copying build/scripts-2.7/rst2html.py -> build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts copying build/scripts-2.7/rst2html5.py -> build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts copying build/scripts-2.7/rst2xml.py -> build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts copying build/scripts-2.7/rst2xetex.py -> build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts changing mode of build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts/rst2pseudoxml.py to 755 changing mode of build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts/rst2man.py to 755 changing mode of build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts/rst2odt.py to 755 changing mode of build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts/rst2latex.py to 755 changing mode of build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts/rstpep2html.py to 755 changing mode of build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts/rst2s5.py to 755 changing mode of build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts/rst2odt_prepstyles.py to 755 changing mode of build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts/rst2html.py to 755 changing mode of build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts/rst2html5.py to 755 changing mode of build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts/rst2xml.py to 755 changing mode of build/bdist.linux-x86_64/wheel/docutils-0.13.data/scripts/rst2xetex.py to 755 creating build/bdist.linux-x86_64/wheel/docutils-0.13.dist-info/WHEEL
# create a fresh virtualenv $ pip install -U dist/docutils-0.13-cp27-none-linux_x86_64.whl Processing ./dist/docutils-0.13-cp27-none-linux_x86_64.whl Installing collected packages: docutils Found existing installation: docutils 0.13 Uninstalling docutils-0.13: Successfully uninstalled docutils-0.13 Successfully installed docutils-0.13
Logbook with «pip»
Docutils’ «setup.py» imports from the stdlib’s «distutils» module instead of the 3rd party «setuptools». «distutils» cannot build wheels. [ 1 ]
OTOH, pip internally uses «setuptools» instead of «distutils». This way, it can generate wheels without changes to «setup.py».
- Install «pip» and «wheels» Under Debian Gnu/Linux: aptitude install python-pip python3-pip
- In the repository root directory, run
#> pip wheel ./docutils/ Unpacking ./docutils Running setup.py (path:/tmp/pip-Ym9hKL-build/setup.py) egg_info for package from file:///[. ]docutils-svn/docutils warning: no previously-included files matching '.DS_Store' found under directory '*' Building wheels for collected packages: docutils Running setup.py bdist_wheel for docutils Destination directory: /home/milde/Code/Python/docutils-svn/wheelhouse Successfully built docutils Cleaning up.
You can also generate wheels for Docutils 0.12 with pip wheel docutils and pip3 wheel docutils . The 0.12 archive is downloaded from PIP and re-packed as wheel. With «pip3» this includes the 2to3 conversion.
With the «pip» utility, it is possible to generate wheels for Python 2 and 3 for both, the released and the repository version of Docutils without changes to the code base.
The generated wheel can be installed. Installing the Py3k version happens «instantaneously».
Docutils uses the batteries included with Python and avoids external dependencies.
View document source. Generated on: 2021-07-07 11:50 UTC. Generated by Docutils from reStructuredText source.
Build C++ code on Linux¶
BigARTM is hosted at github repository, with two branches — stable and master . stable contains latest stable release, while master is the latest version of the code. Normally master is also quite stable, so do not hesitate to try this branch.
Build is built via CMake, as in the following script.
cd ~ git clone --branch=stable https://github.com/bigartm/bigartm.git cd bigartm mkdir build && cd build cmake .. make
Note for Linux users: By default building binary executable bigartm requiers static versions of Boost, C and C++ libraries. To alter it, run cmake command with option -DBUILD_BIGARTM_CLI_STATIC=OFF .
System-wide installation¶
To install command-line utility, shared library module and Python interface for BigARTM, you can type:
Normally this will install:
- bigartm utility into folder /usr/local/bin/ ;
- shared library libartm.so ( artm.dylib for Max OS-X) into folder /usr/local/lib/ ;
- Python interface for BigARTM into Python-specific system directories, along with necessary dependencies.
If you want to alter target folders for binary and shared library objects, you may specify common prefix while running cmake command via option -DCMAKE_INSTALL_PREFIX=path_to_folder . By default CMAKE_INSTALL_PREFIX=/usr/local/ .
Configure BigARTM Python API¶
Python’s interface of BigARTM is normally configured by running make install . As an alternative you may configure it manually as described below, however you still need to build native code of BigARTM with make .
# Step 1 - install Google Protobuf as dependency # (this can be replaced by "pip install protobuf") cd ~/bigartm/3rdparty/protobuf/python sudo python setup.py install # Step 2 - install Python interface for BigARTM cd ~/bigartm/python sudo python setup.py install # Step 3 - point ARTM_SHARED_LIBRARY variable to libartm.so (libartm.dylib) location export ARTM_SHARED_LIBRARY=~/bigartm/build/lib/libartm.so # for linux export ARTM_SHARED_LIBRARY=~/bigartm/build/lib/libartm.dylib # for Mac OS X
We strongly recommend system-wide installation (e.g. make install ) as there is no need to keep BigARTM code after it, so you may safely remove folder ~/bigartm/ .
Troubleshooting¶
If you build BigARTM in existing folder build (e.g. you built BigARTM before) and encounter any errors, it may be due to out-of-date file CMakeCache.txt in folder build . In that case we strongly recommend to delete this file and try to build again.
Using BigARTM Python API you can encounter this error:
Traceback (most recent call last): File "", line 1, in File "build/bdist.linux-x86_64/egg/artm/wrapper/api.py", line 19, in __init__ File "build/bdist.linux-x86_64/egg/artm/wrapper/api.py", line 53, in _load_cdll OSError: libartm.so: cannot open shared object file: No such file or directory Failed to load artm shared library. Try to add the location of `libartm.so` file into your LD_LIBRARY_PATH system variable, or to set ARTM_SHARED_LIBRARY - a specific system variable which may point to `libartm.so` file, including the full path.
This error indicates that BigARTM’s python interface can not locate libartm.so (libartm.dylib) files. In such case type export ARTM_SHARED_LIBRARY=path_to_artm_shared_library .
BigARTM on Travis-CI¶
To get a live usage example of BigARTM you may check BigARTM’s .travis.yml script and the latest continuous integration build.
© Copyright 2015, Konstantin Vorontsov Revision 14c93c20 .