sical / app_iso

Development of an isochrones visualisation app
2 stars 0 forks source link

Installation python #2

Closed Fil closed 6 years ago

Fil commented 6 years ago

Can you help me with installing the python requirements?

I have tried several techniques:

1) conda install

> while read requirement; do conda install --yes $requirement; done < requirements.txt

but some packages are not found in conda

2) pip install

> pip install -r requirements.txt

(nope)

3) conda env create

> conda env create -f=requirements.txt -n isochrones
Using Anaconda API: https://api.anaconda.org
Solving environment: failed

ResolvePackageNotFound:
  - osmnx==0.7.3
  - geopy==1.12.0
  - shapely==1.6.4.post1
  - geojson==2.3.0

I'm running

> conda --version
conda 4.4.8
Fil commented 6 years ago

Looks like

conda install -c conda-forge geojson shapely osmnx geopy

is almost working.

But then I had an incompatibility between bokeh and tornado (ERROR:__init__() got an unexpected keyword argument 'io_loop', exactly like https://github.com/bokeh/bokeh/issues/7308 )

Forcing an update of bokeh… 0.12.13-py36h2f9c1c0_0 --> 0.12.15-py36_0

Now the application starts but

2018-05-02 14:01:44,027 Starting Bokeh server version 0.12.15 (running on Tornado 5.0.2)
2018-05-02 14:01:44,033 Bokeh app running at: http://localhost:5006/code
2018-05-02 14:01:44,033 Starting Bokeh server with process id: 51463
2018-05-02 14:02:27,836 Shell is not a LinearRing
2018-05-02 14:02:27,837 Shell is not a LinearRing
2018-05-02 14:02:27,838 Shell is not a LinearRing
2018-05-02 14:02:27,838 Shell is not a LinearRing
2018-05-02 14:02:27,838 Shell is not a LinearRing
2018-05-02 14:02:27,838 Shell is not a LinearRing
2018-05-02 14:02:27,839 Shell is not a LinearRing
2018-05-02 14:02:27,839 Shell is not a LinearRing
2018-05-02 14:02:27,839 Shell is not a LinearRing
2018-05-02 14:02:27,839 Shell is not a LinearRing
2018-05-02 14:02:27,840 Shell is not a LinearRing
2018-05-02 14:02:27,840 Shell is not a LinearRing
2018-05-02 14:02:27,840 Shell is not a LinearRing
2018-05-02 14:02:27,841 Shell is not a LinearRing
2018-05-02 14:02:27,841 Shell is not a LinearRing
2018-05-02 14:02:27,842 Shell is not a LinearRing
2018-05-02 14:02:27,842 Shell is not a LinearRing
2018-05-02 14:02:27,842 Shell is not a LinearRing
2018-05-02 14:02:27,843 IllegalArgumentException: geometries must not contain null elements

2018-05-02 14:02:27,844 Shell is not a LinearRing
2018-05-02 14:02:27,844 Shell is not a LinearRing
2018-05-02 14:02:27,845 Shell is not a LinearRing
2018-05-02 14:02:27,845 Shell is not a LinearRing
2018-05-02 14:02:27,845 IllegalArgumentException: geometries must not contain null elements

2018-05-02 14:02:27,846 Shell is not a LinearRing
2018-05-02 14:02:27,846 IllegalArgumentException: geometries must not contain null elements

2018-05-02 14:02:27,920 Error running application handler <bokeh.application.handlers.directory.DirectoryHandler object at 0x10a018550>: ('list index out of range', 'occurred at index 0')
File "functions.py", line 324, in _getGeometryCoords:
exterior = line[geom].geoms[0].exterior Traceback (most recent call last):
  File "/Users/fil/miniconda3/lib/python3.6/site-packages/bokeh/application/handlers/code_runner.py", line 173, in run
    exec(self._code, module.__dict__)
  File "/Users/fil/Sites/mi2/app_iso/code/main.py", line 93, in <module>
    data = get_iso(params_iso)
  File "/Users/fil/Sites/mi2/app_iso/code/get_iso.py", line 87, in get_iso
    datasource_poly = _convert_GeoPandas_to_Bokeh_format(gdf_poly, 'polygon')
  File "/Users/fil/Sites/mi2/app_iso/code/functions.py", line 278, in _convert_GeoPandas_to_Bokeh_format
    axis=1)
  File "/Users/fil/miniconda3/lib/python3.6/site-packages/pandas/core/frame.py", line 4877, in apply
    ignore_failures=ignore_failures)
  File "/Users/fil/miniconda3/lib/python3.6/site-packages/pandas/core/frame.py", line 4973, in _apply_standard
    results[i] = func(v)
  File "/Users/fil/miniconda3/lib/python3.6/site-packages/pandas/core/frame.py", line 4854, in f
    return func(x, *args, **kwds)
  File "/Users/fil/Sites/mi2/app_iso/code/functions.py", line 324, in _getGeometryCoords
    exterior = line[geom].geoms[0].exterior
IndexError: ('list index out of range', 'occurred at index 0')

2018-05-02 14:02:27,932 200 GET /code (::1) 6882.74ms
thomleysens commented 6 years ago

Hi Philippe, sorry for the delay but I didn't see your issue (forgot to assign myself so didn't get the notifications). Need to develop some unit tests. Seems you have a weird geometry.

I need to check default.json and params.json files.

Your default.json file does look like this, right ?

{
    "from_place":"48.842021, 2.349900",
    "adress":"79 Rue Mouffetard, 75005 Paris",
    "time_":"08:00",
    "modes":"TRANSIT,WALK",
    "max_dist":"800",
    "step":600,
    "nb_iter":"3",
    "year_min":2018,
    "month_min":4,
    "day_min":4,
    "year_max":2018,
    "month_max":4,
    "day_max":29
}
Fil commented 6 years ago

{ "fromplace":"48.842021, 2.349900", "adress":"79 Rue Mouffetard, 75005 Paris", "time":"08:00", "modes":"TRANSIT,WALK", "max_dist":"800", "step":600, "nb_iter":"3", "year_min":2018, "month_min":4, "day_min":4, "year_max":2018, "month_max":4, "day_max":29 } ./code/params/default.json

-- Fil

On Fri, May 4, 2018 at 10:25 AM, thomleysens notifications@github.com wrote:

Hi Philippe, sorry for the delay but I didn't see your issue (forgot to assign myself so didn't get the notifications). Need to develop some unit tests. Seems you have a weird geometry.

I need to check default.json and params.json files.

Your default.json file does look like this, right ?

{ "fromplace":"48.842021, 2.349900", "adress":"79 Rue Mouffetard, 75005 Paris https://maps.google.com/?q=79+Rue+Mouffetard,+75005+Paris&entry=gmail&source=g", "time":"08:00", "modes":"TRANSIT,WALK", "max_dist":"800", "step":600, "nb_iter":"3", "year_min":2018, "month_min":4, "day_min":4, "year_max":2018, "month_max":4, "day_max":29 }

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sical/app_iso/issues/2#issuecomment-386535761, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAbWdtkAFNGwBlLDYhUatPhYc6RZrg7ks5tvBCUgaJpZM4TvUjf .

thomleysens commented 6 years ago

Ok. I need to investigate further.

Fil commented 6 years ago

Maintenant j'ai un autre type d'erreur…

en traçant un peu ce qui se passe dans get_iso.py je vois que mon otp ne répond pas…

ERROR: 404 http://localhost:8080/otp/routers/Paris/isochrone?fromPlace=48.842021, 2.349900&mode=TRANSIT,WALK&date=2018-04-04&time=TextInput(id='5adb0f69-136c-4531-9ce5-b2bb9358c6e0', ...)&maxWalkDistance=800&cutoffSec=600&cutoffSec=1200&cutoffSec=1800
thomleysens commented 6 years ago

Je vois un gros bug que j'étais sensé avoir corrigé (le TextInput), faut que je switch de branche pour corriger et mettre à jour. Je te tiens au courant.

thomleysens commented 6 years ago

C'est corrigé. Le problème, c'est que j'ai un pb récurrent avec osmnx qui passe par l'api d'overpass et les requêtes qui passaient avant ne semblent plus passer (même les plus simples en utilisant des exemples de la librairie osmnx, donc problématique puisque c'est par là que je récupère les bâtiments et le réseau). Faut que je trouve une alternative, en attendant ça reste délicat concernant ces 2 points. @Fil Je vais essayer de désactiver les options avant de pusher.

thomleysens commented 6 years ago

@Fil Je viens de désactiver les couches Bâtiments et Réseaux (pour le moment, histoire que ça passe, car je dois chercher un peu plus pour identifier l'erreur) et j'ai poussé une nouvelle version de la branche master (de mon côté ça passe) avec le mini bug corrigé également. Je travaille sur une version avec Navitia et j'essaierais de tout refondre pour avoir une seule version avec un switch possible entre OTP et Navitia.

Fil commented 6 years ago

Je suis sur 338cc0cbe48dc11ea866d015eedaaed31721a3dd et j'ai toujours

source_polys = data['poly'] Traceback (most recent call last):
  File "/Users/fil/miniconda3/lib/python3.6/site-packages/bokeh/application/handlers/code_runner.py", line 173, in run
    exec(self._code, module.__dict__)
  File "/Users/fil/Sites/mi2/app_iso/code/main.py", line 95, in <module>
    source_polys = data['poly']
TypeError: 'NoneType' object is not subscriptable
Fil commented 6 years ago

Cela dit dès lors que c'est OTP qui ne répond plus, il faut plutôt rouvrir https://github.com/sical/app_iso/issues/1

Fil commented 6 years ago

Maintenant OTP répond bien sur l'URL citée en https://github.com/sical/app_iso/issues/2#issuecomment-386544623 (j'obtiens un joli geojson).

bokeh ne plante plus sur NoneType (car il a bien reçu le geojson), mais je reviens sur l'erreur observée il y a 2 jours https://github.com/sical/app_iso/issues/2#issuecomment-385954622

2018-05-04 14:35:45,669 Shell is not a LinearRing
2018-05-04 14:35:45,670 Shell is not a LinearRing
2018-05-04 14:35:45,671 Shell is not a LinearRing
2018-05-04 14:35:45,671 Shell is not a LinearRing
2018-05-04 14:35:45,671 Shell is not a LinearRing
2018-05-04 14:35:45,671 Shell is not a LinearRing
2018-05-04 14:35:45,671 Shell is not a LinearRing
2018-05-04 14:35:45,671 Shell is not a LinearRing
2018-05-04 14:35:45,671 Shell is not a LinearRing
2018-05-04 14:35:45,672 Shell is not a LinearRing
2018-05-04 14:35:45,672 Shell is not a LinearRing
2018-05-04 14:35:45,672 Shell is not a LinearRing
2018-05-04 14:35:45,672 Shell is not a LinearRing
2018-05-04 14:35:45,672 Shell is not a LinearRing
2018-05-04 14:35:45,673 Shell is not a LinearRing
2018-05-04 14:35:45,673 Shell is not a LinearRing
2018-05-04 14:35:45,685 IllegalArgumentException: geometries must not contain null elements

Comme les logs n'indiquent pas dans quelle librairie ça se produit, c'est un peu pénible à creuser :)

Fil commented 6 years ago

LMGTFY

on est bien sur un problème d'installation de libraries (geopandas) https://github.com/conda-forge/shapely-feedstock/issues/34#issuecomment-381893351

quand je réinstalle de zéro j'ai des plaintes sur gcc etc. Quand ça veut pas !

Fil commented 6 years ago

bon j'arrive pas à installer ces !#&**$ de librairies, un mode d'emploi serait nécessaire :)

fil:app_iso [ master | ✚ 1 ⚑ 1 ] ➭ conda info -a

     active environment : None
       user config file : /Users/fil/.condarc
 populated config files :
          conda version : 4.5.2
    conda-build version : not installed
         python version : 3.6.5.final.0
       base environment : /Users/fil/miniconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/osx-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/osx-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /Users/fil/miniconda3/pkgs
                          /Users/fil/.conda/pkgs
       envs directories : /Users/fil/miniconda3/envs
                          /Users/fil/.conda/envs
               platform : osx-64
             user-agent : conda/4.5.2 requests/2.18.4 CPython/3.6.5 Darwin/17.5.0 OSX/10.13.4
                UID:GID : 501:20
             netrc file : None
           offline mode : False

# conda environments:
#
base                  *  /Users/fil/miniconda3
psyplot                  /Users/fil/miniconda3/envs/psyplot

sys.version: 3.6.5 |Anaconda, Inc.| (default, Apr 26 ...
sys.prefix: /Users/fil/miniconda3
sys.executable: /Users/fil/miniconda3/bin/python
conda location: /Users/fil/miniconda3/lib/python3.6/site-packages/conda
conda-build: None
conda-env: /Users/fil/miniconda3/bin/conda-env
conda-server: /Users/fil/miniconda3/bin/conda-server
user site dirs: ~/.local/lib/python3.6

CIO_TEST: <not set>
CONDA_ROOT: /Users/fil/miniconda3
GOPATH: /usr/local/go
PATH: /Users/fil/miniconda3/bin:/usr/local/opt/gdal2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/usr/local/go/bin:/usr/local/sbin
REQUESTS_CA_BUNDLE: <not set>
SSL_CERT_FILE: <not set>
thomleysens commented 6 years ago

Alors cela ne me pose aucun problème de faire une explication plus détaillée de l'installation des librairies mais les librairies spatiales peuvent parfois être délicates à installer et peuvent demander des procédures spécifiques pour chaque OS. Donc je me pencherais sur la question mais malheureusement pas aujourd'hui car j'ai quelques tâches à terminer.

Fil commented 6 years ago

SOLUTION

conda create -n isochrones
source activate isochrones
conda config --add channels conda-forge
conda install -n isochrones geopandas ipython bokeh requests osmnx jsonschema pandas pyproj geojson geopy Shapely numpy

👍 capture d ecran 2018-05-04 a 16 59 47

Fil commented 6 years ago

Je ne sais pas si la solution est spécifique conda/macos et mérite éventuellement d'être mise dans la doc d'installation ?

thomleysens commented 6 years ago

@Fil Aaaaah cooool ! ;-) Merci d'avoir passé du temps sur la question et désolé de l'absence de précisions sur les éventuelles difficultés pour l'installation de libs spatiales. Ah ben je pense que ça vaut le coup de commit le README. Je le fais ou tu préfères le faire ?

Fil commented 6 years ago

Je m'en occupe

-- Fil

2018-05-04 17:23 GMT+02:00 thomleysens notifications@github.com:

@Fil https://github.com/Fil Aaaaah cooool ! ;-) Merci d'avoir passé du temps sur la question et désolé de l'absence de précisions sur les éventuelles difficultés pour l'installation de libs spatiales. Ah ben je pense que ça vaut le coup de commit le README. Je le fais ou tu préfères le faire ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sical/app_iso/issues/2#issuecomment-386634471, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAbWTFFFVnkTF2izXbR6pqrsRil3zsHks5tvHJtgaJpZM4TvUjf .

thomleysens commented 6 years ago

Ok ça marche. ;-)