bowang-lab / MedSAMSlicer

3D Slicer Plugin for Segment anything in medical images
https://www.nature.com/articles/s41467-024-44824-z
173 stars 20 forks source link

After clicking on Install dependencies, ModuleNotFoundError: No module named 'torch' #33

Closed sagan114 closed 1 month ago

sagan114 commented 3 months ago

PyTorch Python package is required. Installing... (it may take several minutes) Looking in indexes: http://mirrors.aliyun.com/pypi/simple, http://mirrors.aliyun.com/pypi/simple Collecting torch>=2.0.1 Downloading https://download.pytorch.org/whl/cu118/torch-2.4.0%2Bcu118-cp39-cp39-win_amd64.whl (2692.7 MB) 0.0/2.7 GB 2.2 kB/s eta 336:40:03 ERROR: Exception: Traceback (most recent call last): File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_vendor\urllib3\response.py", line 438, in _error_catcher yield File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_vendor\urllib3\response.py", line 561, in read data = self._fp_read(amt) if not fp_closed else b"" File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_vendor\urllib3\response.py", line 519, in _fp_read data = self._fp.read(chunk_amt) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_vendor\cachecontrol\filewrapper.py", line 90, in read data = self.__fp.read(amt) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\http\client.py", line 463, in read n = self.readinto(b) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\http\client.py", line 507, in readinto n = self.fp.readinto(b) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\socket.py", line 704, in readinto return self._sock.recv_into(b) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\ssl.py", line 1241, in recv_into return self.read(nbytes, buffer) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\ssl.py", line 1099, in read return self._sslobj.read(len, buffer) socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\cli\base_command.py", line 180, in exc_logging_wrapper status = run_func(args) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\cli\req_command.py", line 248, in wrapper return func(self, options, args) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\commands\install.py", line 377, in run requirement_set = resolver.resolve( File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\light_the_torch_utils.py", line 103, in new output = fn(args, **kwargs) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\resolver.py", line 92, in resolve result = self._result = resolver.resolve( File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 546, in resolve state = resolution.resolve(requirements, max_rounds=max_rounds) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 397, in resolve self._add_to_criteria(self.state.criteria, r, parent=None) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 173, in _add_to_criteria if not criterion.candidates: File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_vendor\resolvelib\structs.py", line 156, in bool return bool(self._sequence) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 155, in bool return any(self) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 143, in return (c for c in iterator if id(c) not in self._incompatible_ids) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 47, in _iter_built candidate = func() File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\factory.py", line 206, in _make_candidate_from_link self._link_candidate_cache[link] = LinkCandidate( File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 293, in init super().init( File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 156, in init self.dist = self._prepare() File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 225, in _prepare dist = self._prepare_distribution() File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 304, in _prepare_distribution return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\operations\prepare.py", line 538, in prepare_linked_requirement return self._prepare_linked_requirement(req, parallel_builds) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\operations\prepare.py", line 609, in _prepare_linked_requirement local_file = unpack_url( File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\operations\prepare.py", line 166, in unpack_url file = get_http_url( File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\operations\prepare.py", line 107, in get_http_url from_path, content_type = download(link, temp_dir.path) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\network\download.py", line 147, in call for chunk in chunks: File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\cli\progress_bars.py", line 53, in _rich_progress_bar for chunk in iterable: File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_internal\network\utils.py", line 63, in response_chunks for chunk in response.raw.stream( File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_vendor\urllib3\response.py", line 622, in stream data = self.read(amt=amt, decode_content=decode_content) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_vendor\urllib3\response.py", line 587, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\contextlib.py", line 137, in exit self.gen.throw(typ, value, traceback) File "F:\PyMed\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\pip_vendor\urllib3\response.py", line 443, in _error_catcher raise ReadTimeoutError(self._pool, None, "Read timed out.") pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='download.pytorch.org', port=443): Read timed out. Traceback (most recent call last): File "F:/PyMed/MedSAMSlicer-0.1/MedSAMSlicer-0.1/MedSAM/MedSAMLite/MedSAMLite.py", line 535, in install_dependencies self.installTorch(dependencies[dependency]) File "F:/PyMed/MedSAMSlicer-0.1/MedSAMSlicer-0.1/MedSAM/MedSAMLite/MedSAMLite.py", line 495, in installTorch torch = torchLogic.installTorch(askConfirmation=True, torchVersionRequirement = f">={minTorch}", torchvisionVersionRequirement=f">={minTorchVision}") File "F:/PyMed/3D Slicer/Slicer 5.6.1/slicer.org/Extensions-32438/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py", line 225, in installTorch import torch ModuleNotFoundError: No module named 'torch'

rasakereh commented 2 months ago

it seems that you have a network problem while installing the dependencies. could you make sure that you have a stable connection and are not behind any firewalls?