Skip to content
Snippets Groups Projects
Commit 2d1a8c23 authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Resolve "Discontinue Python 2.7 support?": Bilby is now python3.5+

parent eb81daef
No related branches found
No related tags found
No related merge requests found
...@@ -35,11 +35,6 @@ stages: ...@@ -35,11 +35,6 @@ stages:
${script} --help; ${script} --help;
done done
# test basic setup on python2
basic-2.7:
<<: *test-python
image: python:2.7
# test basic setup on python3 # test basic setup on python3
basic-3.7: basic-3.7:
<<: *test-python <<: *test-python
......
...@@ -17,6 +17,7 @@ https://lscsoft.docs.ligo.org/bilby/installation.html. ...@@ -17,6 +17,7 @@ https://lscsoft.docs.ligo.org/bilby/installation.html.
from __future__ import absolute_import from __future__ import absolute_import
import sys
from . import core, gw, hyper from . import core, gw, hyper
...@@ -25,3 +26,25 @@ from .core.sampler import run_sampler ...@@ -25,3 +26,25 @@ from .core.sampler import run_sampler
from .core.likelihood import Likelihood from .core.likelihood import Likelihood
__version__ = utils.get_version_information() __version__ = utils.get_version_information()
if sys.version_info < (3,):
raise ImportError(
"""You are running bilby 0.6.4 on Python 2
Bilby 0.6.4 and above are no longer compatible with Python 2, and you still
ended up with this version installed. That's unfortunate; sorry about that.
It should not have happened. Make sure you have pip >= 9.0 to avoid this kind
of issue, as well as setuptools >= 24.2:
$ pip install pip setuptools --upgrade
Your choices:
- Upgrade to Python 3.
- Install an older version of bilby:
$ pip install 'bilby<0.6.4'
""")
...@@ -10,7 +10,7 @@ Installation ...@@ -10,7 +10,7 @@ Installation
$ conda install -c conda-forge bilby $ conda install -c conda-forge bilby
Supported python versions: 2.7, 3.5+. Supported python versions: 3.5+.
.. tab:: Pip .. tab:: Pip
...@@ -18,7 +18,7 @@ Installation ...@@ -18,7 +18,7 @@ Installation
$ pip install bilby $ pip install bilby
Supported python versions: 2.7, 3.5+. Supported python versions: 3.5+.
This will install all requirements for running :code:`bilby` for general This will install all requirements for running :code:`bilby` for general
...@@ -47,7 +47,7 @@ wave inference, please additionally run the following commands. ...@@ -47,7 +47,7 @@ wave inference, please additionally run the following commands.
Install bilby from source Install bilby from source
------------------------- -------------------------
:code:`bilby` is developed and tested with both Python 2.7+ and Python 3.7+. In the :code:`bilby` is developed and tested with Python 3.6+. In the
following, we assume you have a working python installation, `python pip following, we assume you have a working python installation, `python pip
<https://packaging.python.org/tutorials/installing-packages/#use-pip-for-installing)>`_, <https://packaging.python.org/tutorials/installing-packages/#use-pip-for-installing)>`_,
and `git <https://git-scm.com/>`_. See :ref:`installing-python` for our and `git <https://git-scm.com/>`_. See :ref:`installing-python` for our
...@@ -60,7 +60,7 @@ Clone the repository, install the requirements, and then install the software: ...@@ -60,7 +60,7 @@ Clone the repository, install the requirements, and then install the software:
$ git clone git@git.ligo.org:lscsoft/bilby.git $ git clone git@git.ligo.org:lscsoft/bilby.git
$ cd bilby/ $ cd bilby/
$ pip install -r requirements.txt $ pip install -r requirements.txt
$ python setup.py install $ pip install .
Once you have run these steps, you have :code:`bilby` installed. You can now Once you have run these steps, you have :code:`bilby` installed. You can now
try to run the examples. try to run the examples.
...@@ -79,6 +79,13 @@ try to run the examples. ...@@ -79,6 +79,13 @@ try to run the examples.
$ git clone https://git.ligo.org/lscsoft/bilby.git $ git clone https://git.ligo.org/lscsoft/bilby.git
.. note::
You may be use to using :code:`$ python setup.py install` to install software
from source. While it is possible to do this, current recommentations from
the python community (see, e.g. `this site <https://python3statement.org/practicalities/>`_
are to use :code:`pip`. For development install, the :code:`-e` flag can be
used.
Installing optional requirements Installing optional requirements
================================ ================================
......
...@@ -2,8 +2,15 @@ ...@@ -2,8 +2,15 @@
from setuptools import setup from setuptools import setup
import subprocess import subprocess
import sys
import os import os
# check that python version is 3.5 or above
python_version = sys.version_info
if python_version < (3, 5):
sys.exit("Python < 3.5 is not supported, aborting setup")
print("Confirmed Python version {}.{}.{} >= 3.5.0".format(*python_version[:3]))
def write_version_file(version): def write_version_file(version):
""" Writes a file with version information to be used at run time """ Writes a file with version information to be used at run time
...@@ -77,6 +84,7 @@ setup(name='bilby', ...@@ -77,6 +84,7 @@ setup(name='bilby',
package_data={'bilby.gw': ['prior_files/*'], package_data={'bilby.gw': ['prior_files/*'],
'bilby.gw.detector': ['noise_curves/*.txt', 'detectors/*'], 'bilby.gw.detector': ['noise_curves/*.txt', 'detectors/*'],
'bilby': [version_file]}, 'bilby': [version_file]},
python_requires='>=3.5',
install_requires=[ install_requires=[
'future', 'future',
'dynesty>=1.0.0', 'dynesty>=1.0.0',
...@@ -94,7 +102,7 @@ setup(name='bilby', ...@@ -94,7 +102,7 @@ setup(name='bilby',
'bilby_convert_resume=cli_bilby.resume:main'] 'bilby_convert_resume=cli_bilby.resume:main']
}, },
classifiers=[ classifiers=[
"Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.7",
"License :: OSI Approved :: MIT License", "License :: OSI Approved :: MIT License",
"Operating System :: OS Independent"]) "Operating System :: OS Independent"])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment