google / or-tools

Google's Operations Research tools:
https://developers.google.com/optimization/
Apache License 2.0
10.97k stars 2.1k forks source link

cannot import name 'pywrapcp' from 'ortools' #1939

Closed victor510295 closed 4 years ago

victor510295 commented 4 years ago

I've already download the package "ortools" from ortools import pywrapcp and trying to use "pywrapcp" this function.

manager = pywrapcp.RoutingIndexManager(len(data['distance_matrix']),
                                       data['num_vehicles'], data['depot'])

But it shows error: ImportError: cannot import name 'pywrapcp' from 'ortools'

How can I solve it?

lperron commented 4 years ago

which platform? Laurent Perron | Operations Research | lperron@google.com | (33) 1 42 68 53 00

Le ven. 27 mars 2020 à 11:15, victor510295 notifications@github.com a écrit :

I've already download the package "ortools" from ortools import pywrapcp and trying to use "pywrapcp" this function.

manager = pywrapcp.RoutingIndexManager(len(data['distance_matrix']), data['num_vehicles'], data['depot'])

But it shows error: ImportError: cannot import name 'pywrapcp' from 'ortools'

How can I solve it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/1939, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUPL3OTU53LNBHX46LJFBDRJR4EHANCNFSM4LU4QUYA .

pointer commented 4 years ago

windows 10, nodejs

lperron commented 4 years ago

Make sure you have visual studio 2019 redistributables installed

Le lun. 1 juin 2020 à 13:49, Kateb Ghemari notifications@github.com a écrit :

windows 10, nodejs

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/1939#issuecomment-636811424, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUPL3O4AHXSOOYGSESLYEDRUOIV5ANCNFSM4LU4QUYA .

jha-vineet69 commented 3 years ago

Hey @victor510295 pywrapcp is available under ortools.constraint_solver. Use "from ortools.constraint_solver import pywrapcp" instead.

sannicosan commented 1 year ago

OR-Tools really needs proper documentation to understand what is the parent modules of the subclasses you import.. Even in the guides, the imports are missing so you can't possibly know where they come from..

lperron commented 1 year ago

This is vague and not helping. Especially in python, all classes are prefixed by the name of the module

Doc is as good as possible, and clearly lacking. So sweeping statements are just not useful.

Thanks

Le mar. 31 janv. 2023, 18:39, Nicolás Sánchez @.***> a écrit :

OR-Tools really needs proper documentation to understand what is the parent modules of the subclasses you import.. Even in the guides, the imports are missing so you can't possibly know where they come from..

— Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/1939#issuecomment-1410800783, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUPL3JPCJZT5CQ5Z4NLXG3WVFE45ANCNFSM4LU4QUYA . You are receiving this because you commented.Message ID: @.***>

Mizux commented 1 year ago

OR-Tools really needs proper documentation to understand what is the parent modules of the subclasses you import.. Even in the guides, the imports are missing so you can't possibly know where they come from..

Which page ? https://developers.google.com/optimization/routing/vrp#complete_programs here you can see them...

Ng-Cho-Yin commented 10 months ago

try from ortools.constraint_solver import pywrapcp