After I run pip and install any Python library e.g. pip install {some-library} etc
…and this ends up at C:/Python37/Lib/site-packages/{some-library}
am I right in assuming essentially pip has just unpacked here and thats it, as in there are no other operations taking place like writing to Windows registry etc, so I could in theory after running all my pip installs lift the folder C:/Python37 to another machine and it will all work as long as the environment is the same?
From my understanding pip downloads the packages from https://pypi.org/ so to emulate that you could download manually the whl and zip files for all the packages you need then pip might be able to install from a local folder. I’ve never tried it but it might help in your situation.
Could it work? Potentially. Will it be a huge pain to figure out if it doesn’t? Most definitely.
I would strongly suggest looking into proper Python environment and package management. You could start here:
My personal recommendation would be to take it a step further and also use virtual environments. My preferred tool at present for Python project configuration is https://python-poetry.org.
You may not fully understand all that’s going on under the hood when you start with poetry, but that’ll come in time and if you just follow the documentation on the site, you’ll avoid a lot of headaches.
The problem Brendan is facing (he mentioned it in another thread) is that the machine he is trying to run robotframework on has no internet access, so installing libraries has been a bit of a challenge for him.
I don’t know where he is working, but having worked for several financial institutions and law enforcement departments myself, I have experienced this situation before so I understand his pain.
I was looking at something like ProGet Package management system to get all the required dependencies online but when I come to do the install in the offline environment something tells me i’ll just have the same problem…
Following that thread there seems to be a few different approaches, but this is the one I think will work best for you
On the machine with internet access
first try pip --version and check your pip command is using python 3.? if not switch to using pip3
pip install the packages you want on this machine and make sure they run how you want.
–Ride
–robotframework
–robotframework-seleniumlibrary
–robotframework-requests
– anything else
next run pip freeze > requirements.txt to generate a requirements.txt with all the packages installed on this machine (the packages you want and their dependancies)
next review the generated requirements.txt and add/remove anything you think will or wont need (don’t be too agressive in removing stuff, better to have the package and not need it than need it and not have it)
then create a directory for pip to download packages to for example i’ll pretend you called this directory pip-offline
now run pip download -r requirements.txt -d pip-offline, this should download all the packages in requirements.txt to the pip-offline directory (you may need to use the full path c:\path\to\pip-offline)
check the pip-offline has all the python packages your are expecting
copy requirements.txt into pip-offline and then create a zip file of this folder (pip-offline.zip)
copy pip-offline.zip to a USB key or external hdd
On the machine with no internet access
copy pip-offline.zip from the a USB key or external hdd
extract pip-offline
pip install -r pip-offline/requirements.txt --no-index --find-links pip-offline (again you may need to use the full path c:\path\to\pip-offline)
Hopefully with that you should have what you need installed.
if it doesn’t work show me the the output of these commands from both machines and i’ll try to figure out why for you.