Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation python #2

Closed
Fil opened this issue May 2, 2018 · 19 comments
Closed

Installation python #2

Fil opened this issue May 2, 2018 · 19 comments
Assignees

Comments

@Fil
Copy link
Contributor

Fil commented May 2, 2018

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

  1. pip install
> pip install -r requirements.txt

(nope)

  1. 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
Copy link
Contributor Author

Fil commented May 2, 2018

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 bokeh/bokeh#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 thomleysens self-assigned this May 4, 2018
@thomleysens
Copy link
Contributor

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
Copy link
Contributor Author

Fil commented May 4, 2018 via email

@thomleysens
Copy link
Contributor

Ok. I need to investigate further.

@Fil
Copy link
Contributor Author

Fil commented May 4, 2018

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

@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
Copy link
Contributor Author

Fil commented May 4, 2018

Je suis sur 338cc0c 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
Copy link
Contributor Author

Fil commented May 4, 2018

Cela dit dès lors que c'est OTP qui ne répond plus, il faut plutôt rouvrir #1

@Fil
Copy link
Contributor Author

Fil commented May 4, 2018

Maintenant OTP répond bien sur l'URL citée en #2 (comment) (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 #2 (comment)

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
Copy link
Contributor Author

Fil commented May 4, 2018

LMGTFY

on est bien sur un problème d'installation de libraries (geopandas)
conda-forge/shapely-feedstock#34 (comment)

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

@Fil
Copy link
Contributor Author

Fil commented May 4, 2018

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
Copy link
Contributor

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
Copy link
Contributor Author

Fil commented May 4, 2018

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
Copy link
Contributor Author

Fil commented May 4, 2018

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

@Fil Fil closed this as completed May 4, 2018
@thomleysens
Copy link
Contributor

@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
Copy link
Contributor Author

Fil commented May 4, 2018 via email

@thomleysens
Copy link
Contributor

Ok ça marche. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants