jvkersch/pyconcorde

Installation works (Ubuntu 22.04) but simple test fails to import TSPSolver

Closed this issue · 5 comments

...
Building wheels for collected packages: pyconcorde
Building wheel for pyconcorde (pyproject.toml) ... done
Created wheel for pyconcorde: filename=pyconcorde-0.1.0-cp310-cp310-linux_x86_64.whl size=2576396 sha256=a0c47cf1f19ae8dd0bb0aaef6862a3850b0548b13b69e6ba23f9d4f3b8e82316
Stored in directory: /tmp/pip-ephem-wheel-cache-5sdpbltp/wheels/be/9f/eb/e4f95e06e62f057a045679e4940e536d1b251d1ab4859c6dcc
Successfully built pyconcorde
Installing collected packages: pyconcorde
Successfully installed pyconcorde-0.1.0

run:
from concorde.tsp import TPSolver
from concorde.tests.data_utils import get_dataset_path
fname = get_dataset_path("berlin52")
solver = TSPSolver.from_tspfile(fname)

result:
Traceback (most recent call last):
File "/home/blake/Ptmp/calibTSPconcorde/test1PC.py", line 1, in
from concorde.tsp import TPSolver
ImportError: cannot import name 'TPSolver' from 'concorde.tsp' (/home/blake/.local/lib/python3.10/site-packages/concorde/tsp.py)

Update: this issue resolved with another

pip install concorde
command. But new problem is:

File "/home/blake/Ptmp/calibTSPconcorde/test1PC.py", line 1, in
from concorde.tsp import TPSolver
File "/home/blake/.local/lib/python3.10/site-packages/concorde/init.py", line 8, in
from urlparse import urljoin
ModuleNotFoundError: No module named 'urlparse'

OK, I've got urlparse installed (pip install urlparse3), but now I'm back to

ImportError: cannot import name 'TPSolver' from 'concorde.tsp' (/home/blake/.local/lib/python3.10/site-packages/concorde/tsp.py)

@blake5634 I think there is a typo in the import command that you're running: it should be from concorde.tsp import TSPSolver.

I will close this for now but feel free to re-open if the problem persists.

Oops! Sorry for the noise. thanks for your response.
BH