Search code examples
pythonpyinstaller

How to install pyinstaller without internet connection?


I am trying to install Pyinstaller without an internet connection. I am trying to install inside virtual environment folder(venv) there it contains all the packages installed. I have installed all packages using '.whl' files.

Whenever I run this command in cmd:

pip install PyInstaller-3.5.tar.gz

I got this error:

Processing f:\test\venv\pyinstaller-3.5.tar.gz
  Installing build dependencies ... error
  Complete output from command f:\test\venv\scripts\python.exe f:\test\venv\lib\site-packages\pip install --ignore-installed --no-user --prefix C:
\Users\hello\AppData\Local\Temp\pip-build-env-e63w3s81\overlay --no-warn-script-l
ocation --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- se
tuptools>=40.2.0 wheel:
  Collecting setuptools>=40.2.0
    Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None
)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connecti
on.VerifiedHTTPSConnection object at 0x037D11D0>, 'Connection to pypi.org timed
out. (connect timeout=15)')': /simple/setuptools/
    Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None
)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connecti
on.VerifiedHTTPSConnection object at 0x037D1330>, 'Connection to pypi.org timed
out. (connect timeout=15)')': /simple/setuptools/
    Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None
)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connecti

on.VerifiedHTTPSConnection object at 0x037D17B0>, 'Connection to pypi.org timed
out. (connect timeout=15)')': /simple/setuptools/
    Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None
)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connecti
on.VerifiedHTTPSConnection object at 0x037D1590>, 'Connection to pypi.org timed
out. (connect timeout=15)')': /simple/setuptools/
    Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None
)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connecti
on.VerifiedHTTPSConnection object at 0x037D1F30>, 'Connection to pypi.org timed
out. (connect timeout=15)')': /simple/setuptools/
    Could not find a version that satisfies the requirement setuptools>=40.2.0 (
from versions: )
  No matching distribution found for setuptools>=40.2.0

  ----------------------------------------
Command "f:\test\venv\scripts\python.exe f:\test\venv\lib\site-pac
kages\pip install --ignore-installed --no-user --prefix C:\Users\hello\AppData\Lo
cal\Temp\pip-build-env-e63w3s81\overlay --no-warn-script-location --no-binary :n
one: --only-binary :none: -i https://pypi.org/simple -- setuptools>=40.2.0 wheel
" failed with error code 1 in None

I have got error regarding setuptools, but I have installed setuptools 40.6.3 inside venv How to fix this?


Solution

  • For installing a python package from a source you need to first extract it, change the current directory to extracted directory and then run python setup.py install inside the directory to build and install the package on your current environment.

    Anyway, PyInstaller needs some external packages that you need to install them by getting their source or using a wheel package. Here is the order you should install first (if you install them with source use the above command):

    future

    pefile

    pywin32_ctypes

    altgraph

    Finally, extract PyInstaller source zip file, change your current directory and run below command in terminal:

    python setup.py install
    

    To test it use:

    pyintaller script_name.py