pythondjangoiisserveroffline

Why I can't install django offline?



I have to install django on a company server that does not have Internet access. After downloading and installing ***pytz-2023.3.post1-py2.py3-none-any.whl*** I am able to install ***django*** from the .zip file.

You might ask what's the point if I'm able to install it? Well, I can install django and the necessary libraries from the downloaded files only when the server is connected to the Internet.

It turned out that the following libraries are necessary during installation: - asgiref-3.7.2-py3-none-any.whl - tzdata-2023.3-py2.py3-none-any.whl - sqlparse-0.4.4-py3-none-any.whl

Of course, I downloaded and installed them without any problems. However, I still get an error when installing django.

Below is the error code.

C:\Users\Administrator\Downloads>py -m pip install django-stable-4.2.x.zip
Processing c:\users\administrator\downloads\django-stable-4.2.x.zip
Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [7 lines of output]
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x00000221F9E73C10>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x00000221F9E7B4D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x00000221F9E84250>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x00000221F9E84D90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x00000221F9E857D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/
  ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
  ERROR: No matching distribution found for setuptools>=40.8.0
  [end of output]

 note: This error originates from a subprocess, and is likely not a problem with pip.
 error: subprocess-exited-with-error

 × pip subprocess to install build dependencies did not run successfully.
 │ exit code: 1
 ╰─> See above for output.

 note: This error originates from a subprocess, and is likely not a problem with pip.

The installation stops at the step Installing build dependencies... error

When I connect the server to the Internet, the installation proceeds correctly. This may mean that something else is being downloaded from the Internet.

For offline testing, I use a server installed on VirtualBox and therefore can access the Internet at any time. I won't have this option on the company server.

Please let me know how I can install djano offline on the server without the above error.

Thank you for any help and advice


Solution

  • you need to download dependencies and install them on the offline system to do that you need to create a requirements.txt on the system that has access to internet

    pip freeze > requirements.txt

    then you should download the dependencies in a directory:

    pip download -r requirements.txt -d path_to_the_directory

    copy requirements.txt to the directory

    move the directory to the offline server then install packages:

    pip install -r path_to_the_directory/requirements.txt --no-index --find-links path_to_the_directory

    I hope this helps you.