python – How to install pytorch for cpu with conda from tar.gz2 sources on Windows?

There are many question related to pytorch installation, I am aware. So far none combines all my requirements and their solutions don’t work on that case :

I need to install torch on an isolated-Windows-with-cpu-only environment that can not access internet. Ideally the solution will use conda (or mamba or micromamba). So far I have tried using conda install --offline package_name.tar.gz2 after a download of the sources on anaconda.org.

Here is a reproducible failed attempt :

> conda create -n last_test
> conda activate last_test
> conda install -y python==3.10
> conda install -y --offline pytorch-1.13.1-py3.10_cpu_0.tar.bz2 torchvision-0.14.1-py310_cpu.tar.bz2 cpuonly-2.0-0.tar.bz2
> conda -V
conda 22.9.0
> python -V
3.10.0
> python -c "import torch;"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\$user\AppData\Local\mambaforge\envs\pytorch_test\lib\site-packages\torch\__init__.py", line 139, in <module>
    raise err
OSError: [WinError 126] Can't find specified module. Error loading "C:\Users\$user\AppData\Local\mambaforge\envs\pytorch_test\lib\site-packages\torch\lib\shm.dll" or one of its dependencies.

Read more here: Source link