gtfspy icon indicating copy to clipboard operation
gtfspy copied to clipboard

Cannot import LabelTimeBoardingsAndRoute

Open leoferres opened this issue 7 years ago • 3 comments

Hi! Thanks for your software. I was wondering why I cannot import

from gtfspy.routing.node_profile_analyzer_time_and_veh_legs import NodeProfileAnalyzerTimeAndVehLegs

it gives me a

ImportError: cannot import name 'LabelTimeBoardingsAndRoute'

Any idea what I may be doing wrong? The complete traceback is as follows:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-132-606c8e7069fa> in <module>()
      1 from gtfspy.routing.helpers import get_transit_connections
----> 2 from gtfspy.routing.node_profile_analyzer_time_and_veh_legs import NodeProfileAnalyzerTimeAndVehLegs
      3 from gtfspy.routing.multi_objective_pseudo_connection_scan_profiler import MultiObjectivePseudoCSAProfiler

~/anaconda3/envs/gis/lib/python3.6/site-packages/gtfspy/routing/node_profile_analyzer_time_and_veh_legs.py in <module>()
     15 
     16 from gtfspy.routing.fastest_path_analyzer import FastestPathAnalyzer
---> 17 from gtfspy.routing.node_profile_multiobjective import NodeProfileMultiObjective
     18 from gtfspy.routing.label import LabelTimeWithBoardingsCount, compute_pareto_front, LabelTimeSimple
     19 from gtfspy.routing.node_profile_analyzer_time import NodeProfileAnalyzerTime

~/anaconda3/envs/gis/lib/python3.6/site-packages/gtfspy/routing/node_profile_multiobjective.py in <module>()
      1 import numpy
      2 
----> 3 from gtfspy.routing.label import LabelTimeWithBoardingsCount, merge_pareto_frontiers, compute_pareto_front, \
      4     LabelVehLegCount, LabelTime, LabelTimeBoardingsAndRoute, LabelTimeAndRoute
      5 from gtfspy.routing.connection import Connection

ImportError: cannot import name 'LabelTimeBoardingsAndRoute'

leoferres avatar Oct 21 '17 22:10 leoferres

Hi and thanks for testing out our code!

I was able to replicate this bug. For some reason I found that the import failed when using Python 3.6, but succeeded when using Python 3.5. So if using Python 3.5 is an option for you, that would probably be a quick fix for this.

I have no clear idea why the import does not work with Python 3.6, and unfortunately can not promise when I would have the time to dwell into this problem.

For the time being, I changed the recommended Python version to Python 3.5 in the package README file (in commit a5e1e0b ).

rmkujala avatar Oct 23 '17 08:10 rmkujala

Great! Meanwhile, I tried it with py3.5 and it worked fine. Thanks!

leoferres avatar Oct 24 '17 00:10 leoferres

Great! Let us know if you encounter further problems or something is unclear, as the package has not yet had that many users.

rmkujala avatar Oct 24 '17 06:10 rmkujala