jvkersch / pyconcorde

Python wrapper around the Concorde TSP solver
BSD 3-Clause "New" or "Revised" License
347 stars 95 forks source link

Can not install by pip3 #47

Closed pyalgosilphf closed 1 year ago

pyalgosilphf commented 1 year ago

When I using the command to install pyconcorde on colab, that shows the error: command:

!pip install git+https://github.com/jvkersch/pyconcorde#egg=pyconcorde

error:

Building wheels for collected packages: pyconcorde Building editable for pyconcorde (pyproject.toml) ... error error: subprocess-exited-with-error

× Building editable for pyconcorde (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [57 lines of output] running editable_wheel creating /tmp/pip-wheel-9lcn34he/.tmp-zm92kdpt/pyconcorde.egg-info writing /tmp/pip-wheel-9lcn34he/.tmp-zm92kdpt/pyconcorde.egg-info/PKG-INFO writing dependency_links to /tmp/pip-wheel-9lcn34he/.tmp-zm92kdpt/pyconcorde.egg-info/dependency_links.txt writing requirements to /tmp/pip-wheel-9lcn34he/.tmp-zm92kdpt/pyconcorde.egg-info/requires.txt writing top-level names to /tmp/pip-wheel-9lcn34he/.tmp-zm92kdpt/pyconcorde.egg-info/top_level.txt writing manifest file '/tmp/pip-wheel-9lcn34he/.tmp-zm92kdpt/pyconcorde.egg-info/SOURCES.txt' reading manifest file '/tmp/pip-wheel-9lcn34he/.tmp-zm92kdpt/pyconcorde.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'COPYING' writing manifest file '/tmp/pip-wheel-9lcn34he/.tmp-zm92kdpt/pyconcorde.egg-info/SOURCES.txt' creating '/tmp/pip-wheel-9lcn34he/.tmp-zm92kdpt/pyconcorde-0.1.0.dist-info' creating /tmp/pip-wheel-9lcn34he/.tmp-zm92kdpt/pyconcorde-0.1.0.dist-info/WHEEL running build_py running build_ext Traceback (most recent call last): File "/tmp/pip-build-env-_g4eob_p/overlay/lib/python3.8/site-packages/setuptools/command/editable_wheel.py", line 140, in run self._create_wheel_file(bdist_wheel) File "/tmp/pip-build-env-_g4eob_p/overlay/lib/python3.8/site-packages/setuptools/command/editable_wheel.py", line 330, in _create_wheel_file files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp) File "/tmp/pip-build-env-_g4eob_p/overlay/lib/python3.8/site-packages/setuptools/command/editable_wheel.py", line 261, in _run_build_commands self._run_build_subcommands() File "/tmp/pip-build-env-_g4eob_p/overlay/lib/python3.8/site-packages/setuptools/command/editable_wheel.py", line 288, in _run_build_subcommands self.run_command(name) File "/tmp/pip-build-env-_g4eob_p/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command self.distribution.run_command(command) File "/tmp/pip-build-env-_g4eob_p/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 1208, in run_command super().run_command(command) File "/tmp/pip-build-env-_g4eob_p/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "", line 119, in run File "", line 77, in download_concorde_qsopt File "/usr/lib/python3.8/urllib/request.py", line 247, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.8/urllib/request.py", line 531, in open response = meth(req, response) File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response response = self.parent.error( File "/usr/lib/python3.8/urllib/request.py", line 569, in error return self._call_chain(args) File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain result = func(args) File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 308: Permanent Redirect qsopt is missing, downloading error: Support for editable installs via PEP 660 was recently introduced in setuptools. If you are seeing this error, please report to:

  https://github.com/pypa/setuptools/issues

  Meanwhile you can try the legacy behavior by setting an
  environment variable and trying to install again:

  SETUPTOOLS_ENABLE_FEATURES="legacy-editable"
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building editable for pyconcorde Failed to build pyconcorde ERROR: Could not build wheels for pyconcorde, which is required to install pyproject.toml-based projects

Can anyone help me?

pyalgosilphf commented 1 year ago

The problem caused by the urllib.request.urlretrieve

cm8908 commented 1 year ago

I got the same issue and resolved it but don't know how exactly I got it worked (perhaps it has something to do with your C compiler). Try installing the original concorde solver (https://www.math.uwaterloo.ca/tsp/concorde/downloads/downloads.htm) and putting the installed 'concorde' directory into 'pyconcorde/build/' and run pip install -e . again.

pyalgosilphf commented 1 year ago

I got the same issue and resolved it but don't know how exactly I got it worked (perhaps it has something to do with your C compiler). Try installing the original concorde solver (https://www.math.uwaterloo.ca/tsp/concorde/downloads/downloads.htm) and putting the installed 'concorde' directory into 'pyconcorde/build/' and run pip install -e . again.

Thank you for your answer! And I found a way to fix this problem simply, that is download the files in 'setup.py' link directly, and put them to 'pyconcorde/build/' folder manually. The 'setup.py' shows that if there is a correct file in the folder, skip the download step which cause the problem. So, we can avoid this problem!