Home > Software design >  How can i install pygame on my internet not connected computer?
How can i install pygame on my internet not connected computer?

Time:02-08

i'm trying to install pygame package on my computer which one is not connected to internet.

(env : windows10, python 3.9(anaconda))

so i downloaded a "pygame-2.1.2.tar" file from www.pypi.org and then tried to install it

from cmd with "python setup.py install" commend.

then it shows error message like below

    ===============================================================================

    (base) C:\pythonpackage\pygame-2.1.2>python setup.py install
    
    
    WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
    Using WINDOWS configuration...

    Making dir :prebuilt_downloads:
    Downloading... https://www.libsdl.org/release/SDL2-devel-2.0.18-VC.zip        
    d561079ec622b0bab5a9e02976f5d540b0622da
    
    ---
    For help with compilation see:
        https://www.pygame.org/wiki/CompileWindows
    To contribute to pygame development see:
        https://www.pygame.org/contribute.html
    ---
    
    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 174, in         
    _new_conn
        conn = connection.create_connection(
      File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 73,         
    in create_connection
        for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
      File "C:\ProgramData\Anaconda3\lib\socket.py", line 954, in getaddrinfo
        for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
    socket.gaierror: [Errno 11002] getaddrinfo failed
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 699,         
    in urlopen
        httplib_response = self._make_request(
      File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 382, 
    in _make_request
        self._validate_conn(conn)
      File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 1010,         
    in _validate_conn
        conn.connect()
      File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 358, in 
    connect
        conn = self._new_conn()
      File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 186, in 
    _new_conn
        raise NewConnectionError(
    urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 
    0x00000237AF075250>: Failed to establish a new connection: [Errno 11002] getaddrinfo 
    failed

    

    During handling of the above exception, another exception occurred:

    

    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 439, in 
    send
        resp = conn.urlopen(
      File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 755, 
    in urlopen
        retries = retries.increment(
      File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\retry.py", line 574, in         
    increment
        raise MaxRetryError(_pool, url, error or ResponseError(cause))
    urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.libsdl.org', port=443):         
    Max retries exceeded with url: /release/SDL2-devel-2.0.18-VC.zip (Caused by 
    NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000237AF075250>: 
    Failed to establish a new connection: [Errno 11002] getaddrinfo failed'))

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\pythonpackage\pygame-2.1.2\setup.py", line 359, in <module>
        buildconfig.config.main(AUTO_CONFIG)
      File "C:\pythonpackage\pygame-2.1.2\buildconfig\config.py", line 225, in main
        deps = CFG.main(**kwds)
      File "C:\pythonpackage\pygame-2.1.2\buildconfig\config_win.py", line 497, in main
        and download_win_prebuilt.ask(**download_kwargs):
      File "C:\pythonpackage\pygame-2.1.2\buildconfig\download_win_prebuilt.py", line 290, in         
    ask
        update(x86=x86, x64=x64)
      File "C:\pythonpackage\pygame-2.1.2\buildconfig\download_win_prebuilt.py", line 273, in 
    update
        download_prebuilts(download_dir, x86=x86, x64=x64)
      File "C:\pythonpackage\pygame-2.1.2\buildconfig\download_win_prebuilt.py", line 124, in                         
    download_prebuilts
        download_sha1_unzip(url, checksum, temp_dir, 1)
      File "C:\pythonpackage\pygame-2.1.2\buildconfig\download_win_prebuilt.py", line 47, in         
    download_sha1_unzip
        response = requests.get(url)
      File "C:\ProgramData\Anaconda3\lib\site-packages\requests\api.py", line 75, in get
        return request('get', url, params=params, **kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\requests\api.py", line 61, in request
        return session.request(method=method, url=url, **kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 542, in 
    request
        resp = self.send(prep, **send_kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 655, in         
    send
        r = adapter.send(request, **kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 516, in 
    send
        raise ConnectionError(e, request=request)
    requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.libsdl.org', port=443):         
    Max retries exceeded with url: /release/SDL2-devel-2.0.18-VC.zip (Caused by 
    NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000237AF075250>: 
    Failed to establish a new connection: [Errno 11002] getaddrinfo failed'))
    
    ===============================================================================

please let me know how to install pygame on offline environment.

i need your help!! please~~

CodePudding user response:

you can run command: pip install pygame

CodePudding user response:

Solution 1 (It works for me; simple but tricky)

My first suggestion is just using .whl file. You can download pygame.whl, which is another type of installation file, from another computer and move the two files to the computer with no internect connection.

You can download the files here:

Actually, .whl is a zipfile. You can unzip the .whl file then you can see three folders: pygame, pygame-2.1.2.data, and pygame-2.1.2.dist-info. You just need pygame folder.

You can copy the folder and paste it to your python project. Then you can simply import pygame. I just tried this way and it works for me. (I even tried to run an example game)

Solution 2

Another suggestion is to download pip and pygame.whl from another computer and move the two files to the computer with no internect connection.

You can download the files here:

After downloading and moving the two files to the computer with no internect connection, you first unzip the pip-22.0.3.tar.gz and install pip by tying following command inside of the pip folder (pip also has setup.py file):

python setup.py install

Now, pip has been installed. Then, install using the .whl file using pip in the folder that .whl file exist.

python -m pip install pygame-2.1.2-cp39-cp39-win_amd64.whl

I hope it help you emjoy pygame.

  •  Tags:  
  • Related