Linux server offline installation of timm library

Because the server can only run in the internal network environment, it cannot connect to the external network.

The most basic "pip install" cannot be used

pip install timm

Then there are few installation packages for timm installed offline.

InPython timm project installation package (third-party library) download resources & installation guide page - PyPI - Python Chinese website (cnpython.com) Found the whl file of timm 0.3.1 version, copy it to the server and install it offline:

pip install timm-0.3.1-py3-none-any.whl

Still getting an error: ImportError: cannot import name 'container_abcs' from 'torch._six'

After collecting information online, there are two main solutions:

1. Modify the code of the error report specified file (.../site-packages/torch/_six.py):

Modify it as follows:

if TORCH_MAJOR == 1 and TORCH_MINOR < 8:
    from torch._six import container_abcs
else:
    import collections.abc as container_abcs

But I didn't find the error location, so this method gave up;

2. Upgrade the timm version. Most of the solutions are to solve the problem after upgrading to timm 0.4.12:

I searched a lot on the Internet but could not find the whl installation package of timm 0.4.12, so I had no choice but to give up;

Because the Linux server cannot be connected to the Internet, I thought about whether I could package the available timm whl installation file on a Linux server that is correctly installed on the server and can be connected to the Internet, and then install it on the server offline:

Here's how to do it:

1. Package timm library on the server side that can connect to the Internet

pip freeze > ./apk/timm.txt

ps: Be careful to delete everything except timm in this step, otherwise they will all be packaged;

Then download the corresponding file through this network-enabled server:

pip download -r ./apk/timm.txt -d ./pip_packages

There is still a little bit more data, if you can’t find it, you can ask me to share it with you;

2. Copy the ./pip_packages and ./apk/timm.txt obtained above to the offline host;

3.Offline installation

pip install --no-index --find-links=./site-packages -r ./apk/timm.txt

Finally the installation was successful:

The reason behind this may be that timm has many dependent libraries and needs to be installed. The file I copied is 1.7G.

Timm-0.6.12 was successfully installed and debugged successfully

Guess you like

Origin blog.csdn.net/zlbbme/article/details/128647059