I have an isolated Wintel host not able to pip or etc, which equals to have network opened to 'internet'.
I downloaded python embedded form python.org (on other machine), copied and unzipped it to O:\xip\Python on isolated machine.
Now it looks like:
libcrypto-1_1.dll
libffi-7.dll
libssl-1_1.dll
LICENSE.txt
pyexpat.pyd
python.cat
python.exe
python3.dll
python38.dll
python38.zip
python38._pth
pythonw.exe
select.pyd
sqlite3.dll
unicodedata.pyd
vcruntime140.dll
winsound.pyd
_asyncio.pyd
_bz2.pyd
_ctypes.pyd
_decimal.pyd
_elementtree.pyd
_hashlib.pyd
_lzma.pyd
_msi.pyd
_multiprocessing.pyd
_overlapped.pyd
_queue.pyd
_socket.pyd
_sqlite3.pyd
_ssl.pyd
i have PyPI requests package, did python setup.py install it on other machine and i copied \build\lib\ directory (which appears) into isolated machine O:\xip\Python\build\lib\requests\
my PATH have O:\xip\Python;O:\xip\Python\build\lib
my PYTHONPATH have O:\xip\Python\python38.zip;O:\xip\Python\build\lib;O:\xip\Python\build\lib\requests
When i go to python console and run import requests i get no module named 'requests'
1. Should I unzip this python38.zip?
2. should i have something more in PATH or PYTHONPATH?
3. Should i copy something more from machine where i did install of request package?
Any ideas what is wrong here?
2 Answers 2
The embedded distribution does not use environment vars. See here: Python Issue 28245
You should edit the python._pth file and put your additional paths there.
Alternatively, you could also extend sys.path before attempting the import.
4 Comments
import requests attempt i get: ModuleNotFoundError: No module named 'urllib3'requests depends on urllib3. If it works on your "Build" system, you should be able to find and copy urllib3 from somewhere there.pip install --install-option="--prefix=/some/path" requests --ignore-installed to have pip resolve all dependencies for you. See here stackoverflow.com/questions/2915471/… python._pth was the core of my problems alongside all dependencies which modules need. Now i just copy installed modules with all dependand modules and all works fine! thanksThe embed.zip Windows Python distribution requires some tweaks. It does not run correctly "out of the box". I created a PowerShell script, PythonEmbed4Win.ps1, to install the embed.zip Python distribution downloaded from the Internet, and then tweak the installation so it will run without errors. The script will modify python._pth among other files.
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/jtmoon79/PythonEmbed4Win/main/PythonEmbed4Win.ps1" -OutFile "PythonEmbed4Win.ps1"
.\PythonEmbed4Win.ps1 -Version 3.8
I have an isolated Wintel host not able to pip or etc
Run .\PythonEmbed4Win.ps1 on a host with Internet access then zip the contents and then transfer and unzip on your isolated host.
Comments
Explore related questions
See similar questions with these tags.
python setup.py install it on other machine- why didn't you do this in your target machine? You didn't use pip in this command. (Also, if you had pip, you can install local wheels, you don't have to access the internet.)no module setuptools