Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d7c9033
patching setup.py for installation without pip
ajaust Oct 28, 2020
5b35c3c
importing version from packaging
ajaust Oct 28, 2020
b72f5cc
show warning
ajaust Oct 28, 2020
2a4ef42
Warn, if pip is not used
BenjaminRodenberg Oct 28, 2020
22a3f51
Improve readability and check uses_pip, before warnings
BenjaminRodenberg Nov 6, 2020
e4ebfd8
Require pip >= 19.0.0, if installed via pip.
BenjaminRodenberg Nov 6, 2020
28ff859
Update documentation. pip3 19.0.0 is minimum requirement. Remove trou…
BenjaminRodenberg Nov 6, 2020
f6f6522
Make command in Exception consistent with README.md
BenjaminRodenberg Nov 6, 2020
7450a2a
Fix formatting.
BenjaminRodenberg Nov 6, 2020
8fd7854
Merge branch 'develop' into ajaust_develop
BenjaminRodenberg Nov 6, 2020
e1dfc03
Don't use bare except.
BenjaminRodenberg Nov 6, 2020
bc83654
Move imports to top and cleanup.
BenjaminRodenberg Nov 6, 2020
6bbdd81
Change order to reduce diff.
BenjaminRodenberg Nov 6, 2020
0195020
Fix formatting w.r.t blank lines.
BenjaminRodenberg Nov 6, 2020
73451b8
Make packaging optional for warnings, add note on https://github.com/…
BenjaminRodenberg Nov 20, 2020
e194d15
Merge branch 'develop' into ajaust_develop
BenjaminRodenberg Nov 20, 2020
1075d00
Merge branch 'develop' into ajaust_develop
BenjaminRodenberg Nov 20, 2020
687fbc4
Merge branch 'develop' into ajaust_develop
BenjaminRodenberg Nov 20, 2020
2b0c86f
Update CHANGELOG.md
BenjaminRodenberg Nov 20, 2020
233dc29
Merge branch 'develop' into ajaust_develop
BenjaminRodenberg Nov 20, 2020
9e2ba2a
Update setup.py
BenjaminRodenberg Nov 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.

## latest

* `packaging` and `pip` are now optional dependencies. https://github.com/precice/python-bindings/pull/63
* Feature: Bindings are now available via Spack. https://github.com/spack/spack/pull/19558
* Bugfix: Bindings also support empty read/write data for block read/write operations (like C++ preCICE API). https://github.com/precice/python-bindings/pull/69

Expand Down
36 changes: 2 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ This package provides python language bindings for the C++ library [preCICE](htt

# Installing the package

We recommend using pip3 (version 19.0 or newer) for the sake of simplicity. You can check your pip3 version via `pip3 --version`. To update pip3, use the following line:
We recommend using pip3 (version 19.0.0 or newer required) for the sake of simplicity. You can check your pip3 version via `pip3 --version`. To update pip3, use the following line:

```
$ pip3 install --upgrade pip
```
Expand Down Expand Up @@ -171,39 +172,6 @@ There are two possible reasons, why preCICE is not found:

In case the compilation fails with `shared_ptr.pxd not found` messages, check if you use the latest version of Cython.

### Version of pip3 is too old

If you see the following error
```
error: option --single-version-externally-managed not recognized
```
your version of pip might be too old. Please update pip and try again. One possible way for updating pip is to run the following commands:
```
wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py && python3 get-pip.py
```
*Be aware that `python3 get-pip.py` might require root privileges.*

Check your version of pip via `pip3 --version`. For version 8.1.1 and 9.0.1 we know that this problem occurs. *Remark:* you get versions 8.1.1 of pip if you use `sudo apt install python3-pip` on Ubuntu 16.04 (pip version 9.0.1 on Ubuntu 18.04)

### Build-time dependencies (Cython, numpy...) defined in `pyproject.toml` are not installed automatically

If you see the following error
```
Collecting pyprecice
Using cached https://files.pythonhosted.org/packages/a6/fb/66f78168394afa2adca62ecd9079a98e741fbf3c6a96845719641ea27912/pyprecice-2.0.0.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-ebyoc0sq/pyprecice/setup.py", line 7, in <module>
from Cython.Distutils.extension import Extension
ModuleNotFoundError: No module named 'Cython'
```
your pip might be too old and therefore it does not use the information from `pyproject.toml`. You can update your pip via
```
pip3 install --upgrade pip
```
then try to install `pyprecice`, again.

### `Python.h` missing

```
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
# PEP 518 - minimum build system requirements
requires = ["setuptools", "wheel", "Cython>=0.29", "packaging", "pip", "numpy", "mpi4py"]
requires = ["setuptools", "wheel", "Cython>=0.29", "packaging", "pip>=19.0.0", "numpy", "mpi4py"]
57 changes: 39 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,45 @@
import os
import sys
import warnings
from packaging import version
import versioneer
import pip

uses_pip = "pip" in __file__

# check whether pip is used for installation. If pip is not used, dependencies defined in pyproject.toml might be
# missing.
if not uses_pip:
warnings.warn("It looks like you are not using pip for installation. Installing the package via 'pip3 install "
"--user .' is recommended. You can still use 'python3 setup.py install --user', if you want and if "
"the bindings work correctly, you do not have to worry. However, if you face problems during "
"installation or running pyprecice, this means that you have to make sure that all dependencies are "
"installed correctly and repeat the installation of pyprecice. Refer to pyproject.toml for a list "
"of dependencies.")

if uses_pip:
# If installed with pip we need to check its version
try:
import pip
except ModuleNotFoundError:
raise Exception("It looks like you are trying to use pip for installation of the package, but pip is not "
"installed on your system (or cannot be found). This can lead to problems with missing "
"dependencies. Please make sure that pip is discoverable. Try python3 -c 'import pip'. "
"Alternatively, you can also run python3 setup.py install --user.")
try:
from packaging import version
except ModuleNotFoundError:
warnings.warn("It looks like you are trying to use pip for installation of the package. Please install, "
"the module packaging by running 'pip3 install --user packaging', since it is needed to perform "
"additional security checks. You can continue installation. However, if you face problems when "
"installing or running pyprecice, it might be a good idea to install packaging to enable "
"additional checks.")
if "pip" in sys.modules and "packaging" in sys.modules:
if version.parse(pip.__version__) < version.parse("19.0"):
# version 19.0 is required, since we are using pyproject.toml for definition of build-time depdendencies.
# See https://pip.pypa.io/en/stable/news/#id209
raise Exception("You are using pip version {}. However, pip version >= 19.0 is required. Please upgrade "
"your pip installation via 'pip3 install --upgrade pip'. You might have to add the --user"
" flag.".format(pip.__version__))

from setuptools import setup
from setuptools import Command
from setuptools.command.test import test
Expand All @@ -12,22 +49,6 @@
from Cython.Build import cythonize
import numpy

if version.parse(pip.__version__) < version.parse("19.0"):
# version 19.0 is required, since we are using pyproject.toml for definition of build-time depdendencies. See
# https://pip.pypa.io/en/stable/news/#id209
warnings.warn(
"You are using pip version {}. However, pip version > 19.0 is recommended. You can continue with the "
"installation, but installation problems can occour. Please refer to "
"https://github.com/precice/python-bindings#build-time-dependencies-cython-numpy-defined-in-pyprojecttoml-are"
"-not-installed-automatically for help.".format(
pip.__version__))

if version.parse(pip.__version__) < version.parse("10.0.1"):
warnings.warn(
"You are using pip version {}. However, pip version > 10.0.1 is required. If you continue with installation "
"it is likely that you will face an error. See "
"https://github.com/precice/python-bindings#version-of-pip3-is-too-old".format(
pip.__version__))

# name of Interfacing API
APPNAME = "pyprecice"
Expand Down