2

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?

gipcu
  • 265
  • 2
  • 14
  • `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.) – h4z3 Feb 25 '20 at 12:04
  • @h4z3 because i get ``no module setuptools`` – gipcu Feb 25 '20 at 12:05
  • Okay. So another suggestion is: check your path and pythonpath on the originals system the package is from – h4z3 Feb 25 '20 at 12:09

1 Answers1

1

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.

Torben Klein
  • 2,943
  • 1
  • 19
  • 24
  • ok added path to libs but now with ``import requests`` attempt i get: ``ModuleNotFoundError: No module named 'urllib3'`` – gipcu Feb 25 '20 at 12:18
  • I would guess that ``requests`` depends on ``urllib3``. If it works on your "Build" system, you should be able to find and copy ``urllib3`` from somewhere there. – Torben Klein Feb 25 '20 at 12:20
  • On your Build machine, you can use ``pip install --install-option="--prefix=/some/path" requests --ignore-installed`` to have pip resolve all dependencies for you. See here https://stackoverflow.com/questions/2915471/install-a-python-package-into-a-different-directory-using-pip – Torben Klein Feb 25 '20 at 12:28
  • ``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! thanks – gipcu Feb 25 '20 at 13:50