Skip to content
Snippets Groups Projects
Commit b317d138 authored by mohanty's avatar mohanty
Browse files

Merge branch '78-ten-minute-rule-installation-Linux' into 'master'

Resolve ""ten-minute-rule" installation"

See merge request flatland/flatland!98
parents 3b46bd85 597d3ab3
No related branches found
No related tags found
No related merge requests found
# auto detect text files and perform LF normalization
* text=auto
# shell scripts will always have LF only (even in Windows environment)
*.sh text eol=lf
# perl scripts will always have LF only (even in Windows environment)
*.pl text eol=lf
# denote all files that are truly binary and should not be modified
*.png binary
*.jpg binary
...@@ -25,6 +25,9 @@ tests: ...@@ -25,6 +25,9 @@ tests:
script: script:
- apt update - apt update
- apt install -y libgl1-mesa-glx xvfb graphviz xdg-utils libcairo2-dev libjpeg-dev libgif-dev - apt install -y libgl1-mesa-glx xvfb graphviz xdg-utils libcairo2-dev libjpeg-dev libgif-dev
- wget -nv https://repo.anaconda.com/archive/Anaconda3-5.3.1-Linux-x86_64.sh -O /tmp/Anaconda3-5.3.1-Linux-x86_64.sh
- bash /tmp/Anaconda3-5.3.1-Linux-x86_64.sh -b -p /tmp/anaconda3
- export PATH=/tmp/anaconda3/bin:$PATH; bash getting_started/getting_started.sh
- pip install tox - pip install tox
- xvfb-run tox -v --recreate - xvfb-run tox -v --recreate
......
...@@ -73,6 +73,12 @@ Ready to contribute? Here's how to set up `flatland` for local development. ...@@ -73,6 +73,12 @@ Ready to contribute? Here's how to set up `flatland` for local development.
$ cd flatland $ cd flatland
$ pip install -e . $ pip install -e .
These steps are performed if you run
$ getting_started/getting_started.bat/.sh
from Anaconda prompt. Only prerequisites: git and Anaconda.
4. Create a branch for local development:: 4. Create a branch for local development::
......
@echo on @echo on
set PWD_BEFORE=%cd% set FLATLAND_BASEDIR=%~dp0\..
@echo off @echo off
echo "************ TESTING PREREQUISITES PYTHON3 + GIT *************************" echo "************ TESTING PREREQUISITES PYTHON3 + GIT + GIT *************************"
@echo on @echo on
git --version || goto :error git --version || goto :error
python3 --version || goto :error python --version || goto :error
rem deactivate in case we're in virtualenv
call conda deactivate || call deactivate
@echo off @echo off
echo "************ SETUP VIRTUAL ENVIRONMENT FLATLAND *************************" echo "************ SETUP VIRTUAL ENVIRONMENT FLATLAND *************************"
@echo on @echo on
(conda info --envs | findstr flatland-rl) || conda create python=3.6 -y --name flatland-rl || goto :error
set FLATLAND_BASEDIR=%~dp0\.. (call conda activate flatland-rl || call activate flatland-rl) || goto :error
set WORKON_HOME=%FLATLAND_BASEDIR%\getting_started\envs_win
if not exist "%WORKON_HOME%" md "%WORKON_HOME%" || goto :error
cd "%WORKON_HOME%"
rem use venv instead of virtualenv/virtualenv-wrapper because of https://github.com/pypa/virtualenv/issues/355
python3 -m venv flatland || goto :error
rem ignore activation error: https://stackoverflow.com/questions/51358202/python-3-7-activate-venv-error-parameter-format-not-correct-65001-windows
call "%WORKON_HOME%\flatland\Scripts\activate.bat" || true
@echo off @echo off
echo "************ INSTALL FLATLAND IN THE VIRTUALENV *************************" echo "************ INSTALL FLATLAND AND DEPENDENCIES IN THE VIRTUALENV *************************"
@echo on @echo on
python -m pip install --upgrade pip || goto :error rem TODO we should get rid of having to install these packages outside of setup.py with conda!
cd %FLATLAND_BASEDIR% || goto :error call conda install -y -c conda-forge cairosvg pycairo || goto :error
call conda install -y -c anaconda tk || goto :error
call python -m pip install --upgrade pip || goto :error
python setup.py install || goto :error python setup.py install || goto :error
REM ensure jupyter is installed in the virtualenv
pip install -r "%FLATLAND_BASEDIR%/requirements_dev.txt" -r "%FLATLAND_BASEDIR%\requirements_continuous_integration.txt" || goto :error # ensure jupyter is installed in the virtualenv
python -m pip install --upgrade -r %FLATLAND_BASEDIR%/requirements_dev.txt -r %FLATLAND_BASEDIR%/requirements_continuous_integration.txt || goto :error
@echo off @echo off
echo "************ INSTALL JUPYTER EXTENSION *************************" echo "************ INSTALL JUPYTER EXTENSION *************************"
...@@ -40,6 +39,11 @@ jupyter nbextension install --py --sys-prefix widgetsnbextension || goto :error ...@@ -40,6 +39,11 @@ jupyter nbextension install --py --sys-prefix widgetsnbextension || goto :error
jupyter nbextension enable --py --sys-prefix widgetsnbextension || goto :error jupyter nbextension enable --py --sys-prefix widgetsnbextension || goto :error
jupyter nbextension install --py --sys-prefix jpy_canvas || goto :error jupyter nbextension install --py --sys-prefix jpy_canvas || goto :error
jupyter nbextension enable --py --sys-prefix jpy_canvas || goto :error jupyter nbextension enable --py --sys-prefix jpy_canvas || goto :error
@echo off
echo "************ RUN JUPYTER NOTEBOOKS *************************"
@echo on
jupyter notebook || goto :error jupyter notebook || goto :error
...@@ -48,6 +52,4 @@ goto :EOF ...@@ -48,6 +52,4 @@ goto :EOF
:error :error
echo Failed with error #%errorlevel%. echo Failed with error #%errorlevel%.
cd "%PWD_BEFORE%" || true
deactivate || true
pause pause
#!/usr/bin/env bash #!/bin/bash
set -e # stop on error set -e # stop on error
set -x # echo commands set -x # echo commands
...@@ -12,27 +12,34 @@ set +x ...@@ -12,27 +12,34 @@ set +x
echo "************ TESTING PREREQUISITES PYTHON3 + GIT *************************" echo "************ TESTING PREREQUISITES PYTHON3 + GIT *************************"
set -x set -x
git --version
python --version
conda --version
echo $PATH
set +x set +x
echo "************ SETUP VIRTUAL ENVIRONMENT FLATLAND *************************" echo "************ SETUP VIRTUAL ENVIRONMENT FLATLAND *************************"
set -x set -x
source deactivate
(conda info --envs | fgrep flatland-rl) || conda create python=3.6 -y --name flatland-rl
source activate flatland-rl
export WORKON_HOME=${FLATLAND_BASEDIR}/getting_started/envs
echo WORKON_HOME=$WORKON_HOME
echo PWD=$PWD
mkdir -p ${WORKON_HOME}
# cannot work with virtualenvwrapper in script
cd ${WORKON_HOME}
python3 -m venv flatland
source flatland/bin/activate
set +x set +x
echo "************ INSTALL FLATLAND IN THE VIRTUALENV *************************" echo "************ INSTALL FLATLAND IN THE VIRTUALENV *************************"
set -x set -x
cd ${FLATLAND_BASEDIR}
python setup.py install # TODO we should get rid of having to install these packages outside of setup.py with conda!
conda install -y -c conda-forge cairosvg pycairo
conda install -y -c anaconda tk
python -m pip install --upgrade pip
python ${FLATLAND_BASEDIR}/setup.py install
# ensure jupyter is installed in the virtualenv # ensure jupyter is installed in the virtualenv
pip install -r ${FLATLAND_BASEDIR}/requirements_dev.txt -r requirements_continuous_integration.txt python -m pip install --upgrade -r ${FLATLAND_BASEDIR}/requirements_dev.txt -r requirements_continuous_integration.txt
set +x set +x
echo "************ INSTALL JUPYTER EXTENSION *************************" echo "************ INSTALL JUPYTER EXTENSION *************************"
...@@ -41,4 +48,9 @@ jupyter nbextension install --py --sys-prefix widgetsnbextension ...@@ -41,4 +48,9 @@ jupyter nbextension install --py --sys-prefix widgetsnbextension
jupyter nbextension enable --py --sys-prefix widgetsnbextension jupyter nbextension enable --py --sys-prefix widgetsnbextension
jupyter nbextension install --py --sys-prefix jpy_canvas jupyter nbextension install --py --sys-prefix jpy_canvas
jupyter nbextension enable --py --sys-prefix jpy_canvas jupyter nbextension enable --py --sys-prefix jpy_canvas
jupyter notebook
set +x
echo "************ RUN JUPYTER NOTEBOOKS *************************"
set -x
jupyter notebook &
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
{ {
"data": { "data": {
"application/vnd.jupyter.widget-view+json": { "application/vnd.jupyter.widget-view+json": {
"model_id": "0b92e7084e37450cbfb3855dc3a58543", "model_id": "86a323f55bb54ff78169a9c7ca63730f",
"version_major": 2, "version_major": 2,
"version_minor": 0 "version_minor": 0
}, },
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.6.5" "version": "3.6.8"
}, },
"latex_envs": { "latex_envs": {
"LaTeX_envs_menu_present": true, "LaTeX_envs_menu_present": true,
......
# contains all additional requirements to run the ```tox .``` in addition to requirements_dev.txt for ```tox -e py36,py37``` # contains all additional requirements to run the ```tox .``` in addition to requirements_dev.txt for ```tox -e py36,py37```
bumpversion==0.5.3 bumpversion>=0.5.3
wheel==0.32.1 wheel>=0.32.1
watchdog==0.9.0 watchdog>=0.9.0
benchmarker==4.0.1 benchmarker>=4.0.1
coverage==4.5.1 coverage>=4.5.1
Sphinx==1.8.1 Sphinx>=1.8.1
sphinx-rtd-theme==0.4.3 sphinx-rtd-theme>=0.4.3
flake8==3.7.7 flake8>=3.7.7
flake8-eradicate==0.2.0 flake8-eradicate>=0.2.0
twine==1.12.1 twine>=1.12.1
pydeps==1.7.2 pydeps>=1.7.2
jupyter==1.0.0 jupyter>=1.0.0
pytest-xvfb==1.2.0 jupyter-core>=4.5.0
notebook>=5.7.8
pytest-xvfb>=1.2.0
git+https://github.com/who8mylunch/Jupyter_Canvas_Widget.git@bd151ae1509c50b5809944dd3294f58b7b069c86 git+https://github.com/who8mylunch/Jupyter_Canvas_Widget.git@bd151ae1509c50b5809944dd3294f58b7b069c86
# contains all requirements to run the tests by running ```tox -e py36,py37``` # contains all requirements to run the tests by running ```tox -e py36,py37```
tox==3.5.2 tox>=3.5.2
twine==1.12.1 twine>=1.12.1
pytest==3.8.2 pytest>=3.8.2
pytest-runner==4.2 pytest-runner>=4.2
numpy==1.16.4 numpy>=1.16.4
recordtype==1.3 recordtype>=1.3
xarray==0.11.3 xarray>=0.11.3
matplotlib==3.0.2 matplotlib>=3.0.2
Pillow==5.4.1 Pillow>=5.4.1
# pycairo==1.18.1 is installed via setup.py since it needs special treatment under Windows CairoSVG>=2.3.1
CairoSVG==2.3.1 msgpack>=0.6.1
msgpack==0.6.1 svgutils>=0.3.1
svgutils==0.3.1 screeninfo>=0.3.1
screeninfo==0.3.1 pyarrow>=0.13.0
pyarrow==0.13.0 importlib-metadata>=0.17
importlib-metadata==0.17 importlib_resources>=1.0.2
importlib_resources==1.0.2
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
"""The setup script.""" """The setup script."""
import os import os
import platform
import sys import sys
from setuptools import setup, find_packages from setuptools import setup, find_packages
...@@ -12,51 +11,6 @@ assert sys.version_info >= (3, 6) ...@@ -12,51 +11,6 @@ assert sys.version_info >= (3, 6)
with open('README.rst') as readme_file: with open('README.rst') as readme_file:
readme = readme_file.read() readme = readme_file.read()
# install pycairo on Windows
if os.name == 'nt':
p = platform.architecture()
is64bit = p[0] == '64bit'
if sys.version[0:3] == '3.5':
if is64bit:
url = 'https://download.lfd.uci.edu/pythonlibs/t4jqbe6o/pycairo-1.18.1-cp35-cp35m-win_amd64.whl'
else:
url = 'https://download.lfd.uci.edu/pythonlibs/t4jqbe6o/pycairo-1.18.1-cp35-cp35m-win32.whl'
if sys.version[0:3] == '3.6':
if is64bit:
url = 'https://download.lfd.uci.edu/pythonlibs/t4jqbe6o/pycairo-1.18.1-cp36-cp36m-win_amd64.whl'
else:
url = 'https://download.lfd.uci.edu/pythonlibs/t4jqbe6o/pycairo-1.18.1-cp36-cp36m-win32.whl'
if sys.version[0:3] == '3.7':
if is64bit:
url = 'https://download.lfd.uci.edu/pythonlibs/t4jqbe6o/pycairo-1.18.1-cp37-cp37m-win_amd64.whl'
else:
url = 'https://download.lfd.uci.edu/pythonlibs/t4jqbe6o/pycairo-1.18.1-cp37-cp37m-win32.whl'
try:
import pycairo
except:
call_cmd = "pip install " + url
os.system(call_cmd)
import site
import ctypes.util
default_os_path = os.environ['PATH']
os.environ['PATH'] = ''
for s in site.getsitepackages():
os.environ['PATH'] = os.environ['PATH'] + ';' + s + '\\cairo'
os.environ['PATH'] = os.environ['PATH'] + ';' + default_os_path
print(os.environ['PATH'])
if ctypes.util.find_library('cairo') is not None:
print("cairo installed: OK")
else:
try:
import pycairo
except:
os.system("pip install pycairo==1.18.1")
def get_all_svg_files(directory='./svg/'): def get_all_svg_files(directory='./svg/'):
ret = [] ret = []
......
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