-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run python script in Linux with error - internet restriction, try out these options #403
Comments
Hi @vegaviazhang thanks for sharing these detail information. I think the root cause is network policy (maybe from company, or from China), that is blocking automated downloading of required files from GitHub. One way is to run on a computer with no internet restriction and use pack() to generate the zip file to copy to your PC. Another way is to manually download the required files and set them up. See this link for detailed step by step instructions - #376 (comment) |
Surprised! Kensoh .I have a try refer this link Today.#376 (comment).[download the required files and set them up.].
r.init(vega_firenlp_super) zhangx@pve-gpu:~/a_project/z_temp_rpa$ python
Python 3.7.11 (default, Jul 27 2021, 14:32:16)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpa as r
>>> r.init()
[RPA][ERROR] - following happens when starting TagUI...
The following command is executed to start TagUI -
"/home/zhangx/.tagui/src/tagui" rpa_python chrome
It leads to following output when starting TagUI -
/home/zhangx/.tagui/src/tagui: line 256: php: command not found
Auto configuration failed
140531240742528:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory
140531240742528:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
140531240742528:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf
140531240742528:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf
[RPA][ERROR] - unknown error encountered
False
>>> My computer introduce
(vega_firenlp_super) zhangx@pve-gpu:~$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/" My confusion
|
Ubuntu Linux does not have PHP installed, you can install it and try again. See this Ubuntu Colab notebook for example to install PHP - https://colab.research.google.com/drive/13bQO6G_hzE1teX35a3NZ4T5K-ICFFdB5?usp=sharing |
Year.I'll try it today and fill in the results later. ^.^ |
This comment was marked as duplicate.
This comment was marked as duplicate.
Hi.Kensoh.According to the above tips, I feel that success is only one step away 1 pull ubuntu images/install python/create container$ docker run -d --name vega_rpa ubuntu_python:20.04_3.8.3_sh tail -f /dev/null
$ # enter container
$ docker exec -it vega_rpa /bin/bash 2.install php/chromium-browser/rpa$ apt-get update
$ apt install php -y
$ apt install chromium-browser -y
$ pip3 install rpa -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn All the above codes were executed successfully 3.rpa.setuproot@be0f3a0acb74:/# python3
Python 3.8.10 (default, Sep 28 2021, 16:10:42)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>>
>>> os.environ['http_proxy'] = "http://192.168.200.18:3128" # 访问代理
>>> os.environ['https_proxy'] = "https://192.168.200.18:3128"
>>> import rpa as r
>>> r.setup()
[RPA][INFO] - setting up TagUI for use in your Python environment
[RPA][INFO] - downloading TagUI (~200MB) and unzipping to below folder...
[RPA][INFO] - /root
[RPA][INFO] - done. syncing TagUI with stable cutting edge version
[RPA][INFO] - TagUI now ready for use in your Python environment
[RPA][INFO] - visual automation (optional) requires special setup on Linux,
[RPA][INFO] - see the link below to install OpenCV and Tesseract libraries
[RPA][INFO] - https://sikulix-2014.readthedocs.io/en/latest/newslinux.html
True
>>> r.dump(r.load('/root/.tagui/src/tagui').replace('"google-chrome"', '"chromium-browser"').replace('$headless_switch', '--no-sandbox'), '/root/.tagui/src/tagui')
True
>>> exit()
root@be0f3a0acb74:/# apt install xvfb -y All the above codes were executed successfully 4.install xvfb and pyvirtualdisplay$ apt install xvfb -y
$ pip3 install pyvirtualdisplay -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn 5. Test r.init()root@be0f3a0acb74:/# python3
Python 3.8.10 (default, Sep 28 2021, 16:10:42)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpa as r
>>> r.init()
^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/tagui.py", line 584, in init
tagui_out = _tagui_read()
File "/usr/local/lib/python3.8/dist-packages/tagui.py", line 130, in _tagui_read
global _process; return _py23_decode(_process.stdout.readline())
KeyboardInterrupt
>>> r.debug(True)
True
>>> r.init() 6.Refer-Version
root@be0f3a0acb74:/# pip3 install rpa==1.48.1
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
...
Successfully built rpa tagui
Installing collected packages: tagui, rpa
Successfully installed rpa-1.48.1 tagui-1.48.1
|
Hi @vegaviazhang thanks for sharing these details, they are very helpful! Normally when init() is stuck, the most common reason is that it cannot connect to the Chromium process. This may be due to port 9222 not opened or restricted for the tool to make a websocket connection to Chromium process, or could be other reasons with initialising Chromium. Can you try to run following command from your terminal and see what happens?
After that, run the following command in the terminal to see if Chromium process websocket connection is opened up
If it is opened successfully, there will be some result with |
Also, I notice you did not initialise the virtual display. Before you do r.init(), you have to do the following (from the Colab example). It is initialise the virtual display for Chromium browser to be able to run without a real display.
|
Hi, kensoh. Today I have a try. Reslut are as follows. 1.repeated the problem that init() did not respond
root@426a5eaa37f2:/# python3
Python 3.6.9 (default, Mar 15 2022, 13:55:28)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpa as r
>>> import pyvirtualdisplay
>>> display = pyvirtualdisplay.Display()
>>> display.start()
<pyvirtualdisplay.display.Display object at 0x7f63b79c3320>
>>> r.debug(True)
True
>>> from datetime import datetime
>>> datetime.now()
datetime.datetime(2022, 7, 8, 11, 18, 37, 930608)
>>> r.init()
^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/tagui.py", line 584, in init
tagui_out = _tagui_read()
File "/usr/local/lib/python3.6/dist-packages/tagui.py", line 130, in _tagui_read
global _process; return _py23_decode(_process.stdout.readline())
KeyboardInterrupt
>>> datetime.now()
datetime.datetime(2022, 7, 8, 11, 39, 6, 890309)
>>> exit() 2.Run
|
Thanks for the details! Can you try below from the terminal to see what happens? Below will run using headless mode browser, see if that can load and
|
Yes, I run the command using headless mode browser, it can return some result. chromium-browserroot@426a5eaa37f2:/# chromium-browser --user-data-dir="~/.tagui/src/chrome/tagui_user_profile" --remote-debugging-port=9222 about:blank --window-size=1366,768 --no-sandbox --headless --disable-gpu
[0711/092410.960971:ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[0711/092410.961075:ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
DevTools listening on ws://127.0.0.1:9222/devtools/browser/1ff51bff-21b2-457a-8272-c5e7797833a9
[0711/092411.414866:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
[0711/092411.890598:WARNING:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process. curlroot@426a5eaa37f2:/# curl -s localhost:9222/json
[ {
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/9D71AC29DAE17785EFC38416069D480C",
"id": "9D71AC29DAE17785EFC38416069D480C",
"title": "about:blank",
"type": "page",
"url": "about:blank",
"webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/9D71AC29DAE17785EFC38416069D480C"
} ]
root@426a5eaa37f2:/# |
From above so far, it looks like headless mode can return a websocket connection, however it is not working for virtual display. Maybe there is some unknown reason why the virtual display method is not working. You can try the following -
Above will try to isolate the issue to see if headless mode works for you and if the root cause is in the upstream TagUI RPA engine. So far, I haven't come across any user raising this issue, other than the recent similar issue at #404 |
Hi kensoh, Your RPA work is very attractive.Thanks a lot for this projects.
I encounter problem in run python script in Linux.I really hope you can help me solve the problem.
Following is my step to try:
1.install package in Linux
2.write python script
*Here I hear from issues of this project for reference. I am using proxy to download https://github.com/tebelorg/Tump/releases/download/v1.0.0/TagUI_Linux.zip in python script.
3.Run the script
3.1 My attempt
4.I delete the unziped file.
5.Rerun the script in step 2.
6.This is another error.
7.Try third.Repeat step 4,step 5.
I have no way to deal with it.0.0
The text was updated successfully, but these errors were encountered: