pythonlinuxselenium-webdriver

Installing python selenium on linux for a local network without internet access


Good afternoon! I need to write a Python script for my Linux server (RedOS), which will log into the browser automatically, perform certain settings on the site and close the browser window. I use the Selenium library for this. The script for Windows works without problems.

However, for it to work, I also have to install the necessary libraries on the server. The server does not have internet access. I did the installation via packages offline.

Python 3.8.18 is running on the server. I used the selenium-4.23.1.tar file.gz
selenium-4.23.1.tar.gz

I used a file selenium-4.23.1.tar.gz and I installed it using the pip3 install --no-index command selenium-4.23.1.tar.gz

And I get the following error:

Processing ./selenium-4.23.1.tar.gz
  Installing build dependencies ... error
  ERROR: Complete output from command /usr/bin/python3 /usr/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-vl02ygz6/overlay --no-warn-script-location --no-binary :none: --only-binary :none: --no-index -- setuptools setuptools-rust:
  ERROR: Collecting setuptools
    ERROR: Could not find a version that satisfies the requirement setuptools (from versions: none)
  ERROR: No matching distribution found for setuptools
  ----------------------------------------
ERROR: Command "/usr/bin/python3 /usr/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-vl02ygz6/overlay --no-warn-script-location --no-binary :none: --only-binary :none: --no-index -- setuptools setuptools-rust" failed with error code 1 in None

To run, I need to install setuptolls-rust. I am trying to install this package via a file setuptools_rust-1.10.1.tar.gz I use the command: pip3 install --no-index setuptools_rust-1.10.1.tar.gz And I get the following error:

Processing ./setuptools_rust-1.10.1.tar.gz
  Installing build dependencies ... error
  ERROR: Complete output from command /usr/bin/python3 /usr/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-gzdkukcg/overlay --no-warn-script-location --no-binary :none: --only-binary :none: --no-index -- 'setuptools>=62.4' setuptools_scm:
  ERROR: Collecting setuptools>=62.4
    ERROR: Could not find a version that satisfies the requirement setuptools>=62.4 (from versions: none)
  ERROR: No matching distribution found for setuptools>=62.4
  ----------------------------------------
ERROR: Command "/usr/bin/python3 /usr/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-gzdkukcg/overlay --no-warn-script-location --no-binary :none: --only-binary :none: --no-index -- 'setuptools>=62.4' setuptools_scm" failed with error code 1 in None
This package requires setuptools version >=62.4.

However, I already have setuptools version 73.0.0 installed (I tried earlier ones, for example 62.5.0) Calling the "pip3 list" command:

Package                 Version
----------------------- ---------
Babel                   2.3.4
blivet                  3.5.0
blivet-gui              2.4.2
Brlapi                  0.7.0
cairocffi               1.1.0
CairoSVG                2.7.0
caja-extensions-redsoft 1.2
certifi                 2020.6.20
cffi                    1.13.2
charset-normalizer      2.0.7
configobj               5.0.6
configshell-fb          1.1.28
cryptography            37.0.2
cssselect2              0.3.0
cupshelpers             1.0
dasbus                  1.3
decorator               4.4.0
defusedxml              0.7.1
distro                  1.5.0
dnspython               2.2.1
gssapi                  1.7.3
idna                    2.10
initial-setup           0.3.84
ipaclient               4.10.1
ipalib                  4.10.1
ipaplatform             4.10.1
ipapython               4.10.1
Jinja2                  3.0.3
jwcrypto                0.6.0
kmod                    0.1
langtable               0.0.53
libcomps                0.1.15
MarkupSafe              2.1.1
netaddr                 0.7.19
netifaces               0.10.4
nftables                0.1
olefile                 0.45.1
onboard                 1.4.1
perf                    0.1
pid                     2.2.3
Pillow                  9.4.0
pip                     19.1.1
ply                     3.11
productmd               1.33
psutil                  5.9.1
pwquality               1.4.3
pyasn1                  0.4.8
pyasn1-modules          0.2.8
pycairo                 1.15.3
pycparser               2.14
pycups                  2.0.1
pycurl                  7.43.0.2
pydbus                  0.6.0
PyGObject               3.36.1
pykickstart             3.30
pyOpenSSL               21.0.0
pyparsing               2.4.7
pyparted                3.11.0
PyQt5                   5.15.0
PyQt5-sip               4.19.23
pysmbc                  1.0.23
PySocks                 1.7.1
pystray                 0.17.1
python-augeas           0.5.0
python-dateutil         2.8.1
python-gettext          4.0
python-ldap             3.1.0
python-linux-procfs     0.6.1
python-manatools        0.0.3
python-meh              0.48
python-xlib             0.19
python-yubico           1.3.2
pytz                    2022.1
pyudev                  0.21.0
pyusb                   1.0.0b1
pyxdg                   0.25
PyYAML                  5.4.1
qrcode                  7.3.1
redoswelcome            1.13.4
reportlab               3.4.0
requests                2.26.0
requests-file           1.4.3
requests-ftp            0.3.1
rpm                     4.17.0
rtslib-fb               2.1.74
schedutils              0.6
selinux                 2.9
sepolicy                1.1
setools                 4.1.1
setproctitle            1.1.10
setroubleshoot          1.1
setuptools              73.0.0
share-directory         6.3
simpleline              1.6
six                     1.15.0
slip                    0.6.4
slip.dbus               0.6.4
SSSDConfig              2.8.2
systemd-python          232
targetcli-fb            2.1.53
terminator              2.0.1
tinycss2                1.0.2
urllib3                 1.26.5
urwid                   2.0.1
webencodings            0.5.1
xcffib                  0.9.0

I saw the following topic on the forum: https://translated.turbopages.org/proxy_u/en-ru.ru.692e55ab-66c48e59-1c01acfd-74722d776562/https/stackoverflow.com/questions/65712539/pip-install-is-not-recognizing-a-previously-installed-package

In this case, to install another package, you needed the version setuptools>= 40.8.0, which was already installed. The --no-build-isolation flag was used for this.

When calling this command: pip3 install --no-index setuptools_rust-1.10.1.tar.gz --no-build-isolation

Which leads to the following error:

Processing ./setuptools_rust-1.10.1.tar.gz
    Preparing wheel metadata ... done
Collecting semantic-version<3,>=2.8.2 (from setuptools-rust==1.10.1)
  ERROR: Could not find a version that satisfies the requirement semantic-version<3,>=2.8.2 (from setuptools-rust==1.10.1) (from versions: none)
ERROR: No matching distribution found for semantic-version<3,>=2.8.2 (from setuptools-rust==1.10.1)

I tried to install subsequent packages by dependencies, but this leads to further errors, some package is always required.

Dear colleagues, please tell me, who has faced a similar problem? I have been struggling with this problem for the second day, but I am sure that there is definitely a solution for this.


Solution

  • I was able to solve this problem by installing all packages in a virtual environment, and not in the Python root directory. Perhaps the problem was due to the fact that the libraries for the root Python were not correctly installed on the server, or because setuptools-rust can only be installed in the virtual environment directory.