No log file
Aliefe02 opened this issue · comments
I am using ubuntu 22.4 and python 3.10. I am installing using quick installation. After installation program works and i can access it and add devices etc. However I have some problems.
1 - No log file is created at /var/www/pyscada/pyscadaserver/pyscada_debug.log. This file doesn't exist
2 - When i run migrations it gives error that there is no file pyscada.core.urls. When i manually copy the pyscada folder which is inside the github repo into the project folder where manage.py is located, that error is gone but i am not sure if it is the correct solution
3 -(venv) ubuntu@ubuntu:/var/www/pyscada/PyScadaServer$ sudo python3 manage.py makemigrations
Traceback (most recent call last):
File "/var/www/pyscada/PyScadaServer/manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.10/dist-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.10/dist-packages/django/core/management/init.py", line 416, in execute
django.setup()
File "/usr/local/lib/python3.10/dist-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.10/dist-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python3.10/dist-packages/django/apps/config.py", line 193, in create
import_module(entry)
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pyscada'
I am using ubuntu 22.4 and python 3.10. I am installing using quick installation. After installation program works and i can access it and add devices etc. However I have some problems. 1 - No log file is created at /var/www/pyscada/pyscadaserver/pyscada_debug.log. This file doesn't exist
The logs are in /var/log/pyscada
See here : https://github.com/pyscada/PyScada/blob/main/install_venv.sh#L28
2 - When i run migrations it gives error that there is no file pyscada.core.urls. When i manually copy the pyscada folder which is inside the github repo into the project folder where manage.py is located, that error is gone but i am not sure if it is the correct solution
The migrations are done using the install_venv.sh
script.
Do you have an error during the installation or after when you try to run the migrations manually ?
Please provide me more logs of the error (the command you run and the error you have).
Can you send me the logs of the installation ? (if you run the install.sh
file, it is the logs_install.txt
file created from where you execute the install.sh
)
3 -(venv) ubuntu@ubuntu:/var/www/pyscada/PyScadaServer$ sudo python3 manage.py makemigrations Traceback (most recent call last): File "/var/www/pyscada/PyScadaServer/manage.py", line 22, in execute_from_command_line(sys.argv) File "/usr/local/lib/python3.10/dist-packages/django/core/management/init.py", line 442, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.10/dist-packages/django/core/management/init.py", line 416, in execute django.setup() File "/usr/local/lib/python3.10/dist-packages/django/init.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/local/lib/python3.10/dist-packages/django/apps/registry.py", line 91, in populate app_config = AppConfig.create(entry) File "/usr/local/lib/python3.10/dist-packages/django/apps/config.py", line 193, in create import_module(entry) File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1004, in _find_and_load_unlocked ModuleNotFoundError: No module named 'pyscada'
Why do you try to make the migrations ?
Can you send me the result of sudo -u pyscada -E env PATH=${PATH} pip3 list
after activating the venv (source /home/pyscada/.venv/bin/activate
)?
Installation works without error. I get migration error when I manually go to '/var/www/pyscada/PyScadaServer' and say 'sudo python3 manage.py migrate'. I will need to migrate when I add a model to the project am I wrong.
Also about install_venv.sh, what is the difference between it and install.sh. I want to use venv, which one should I use. Just to be clear I want to tell you how I install this.
start venv, install this git repo, run install.sh
isn't this correct
Also there is another thing where i need to do migration. Adding plugins. I need to add pyscada-modbus and according to this guide "https://pyscada.readthedocs.io/en/main/plugin_install.html" I need to migrate. However it gives me the url error
Installation works without error. I get migration error when I manually go to '/var/www/pyscada/PyScadaServer' and say 'sudo python3 manage.py migrate'. I will need to migrate when I add a model to the project am I wrong.
You should be able to run the migration manually.
Please send me the log.
Which model do you want to add ? What do you want to do ?
Also about install_venv.sh, what is the difference between it and install.sh. I want to use venv, which one should I use. Just to be clear I want to tell you how I install this.
install.sh
let you choose between virtual environment install and docker install, and it create a log of the corresponding install. So the best is to run install.sh
to get the log file in case of an error.
start venv, install this git repo, run install.sh
isn't this correct
As explained here, the install process is :
- Download PyScada
- Install using the
install.sh
script - Connect to the web interface
Also there is another thing where i need to do migration. Adding plugins. I need to add pyscada-modbus and according to this guide "https://pyscada.readthedocs.io/en/main/plugin_install.html" I need to migrate. However it gives me the url error
Please send me the log of the commands you pass and the error you get.
@Aliefe02 Can you send me the result of sudo -u pyscada -E env PATH=${PATH} pip3 list
after activating the venv (source /home/pyscada/.venv/bin/activate
)?
(venv) ubuntu@ubuntu:~/Desktop/AGScada/PyScada-Modbus$ sudo -E env PATH=${PATH} pip3 install pyscada-modbus
WARNING: The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Collecting pyscada-modbus
Downloading pyscada_modbus-0.8.0-py3-none-any.whl (28 kB)
Collecting pymodbus>=1.2
Downloading pymodbus-3.6.6-py3-none-any.whl (185 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 185.4/185.4 KB 584.4 kB/s eta 0:00:00
Collecting pyscada>=0.8.0
Downloading PyScada-0.8.0-py3-none-any.whl (2.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.7/2.7 MB 1.2 MB/s eta 0:00:00
Collecting pyserial
Downloading pyserial-3.5-py2.py3-none-any.whl (90 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.6/90.6 KB 2.7 MB/s eta 0:00:00
Collecting pytz
Downloading pytz-2024.1-py2.py3-none-any.whl (505 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 505.5/505.5 KB 2.1 MB/s eta 0:00:00
Collecting asgiref
Downloading asgiref-3.7.2-py3-none-any.whl (24 kB)
Collecting python-daemon>=2.0.0
Downloading python_daemon-3.0.1-py3-none-any.whl (31 kB)
Collecting django<4.3,>=4.2
Downloading Django-4.2.11-py3-none-any.whl (8.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.0/8.0 MB 2.6 MB/s eta 0:00:00
Collecting python-dateutil
Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 229.9/229.9 KB 3.4 MB/s eta 0:00:00
Collecting numpy>=1.6.0
Downloading numpy-1.26.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.2/18.2 MB 4.3 MB/s eta 0:00:00
Collecting pillow
Downloading pillow-10.2.0-cp310-cp310-manylinux_2_28_x86_64.whl (4.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 5.8 MB/s eta 0:00:00
Collecting h5py>=2.2.1
Downloading h5py-3.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.8/4.8 MB 7.1 MB/s eta 0:00:00
Collecting monthdelta
Downloading MonthDelta-0.9.1.zip (3.0 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: concurrent-log-handler in /home/ubuntu/Desktop/AGScada/venv/lib/python3.10/site-packages (from pyscada>=0.8.0->pyscada-modbus) (0.9.25)
Collecting six
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting sqlparse>=0.3.1
Downloading sqlparse-0.4.4-py3-none-any.whl (41 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.2/41.2 KB 84.3 MB/s eta 0:00:00
Collecting typing-extensions>=4
Downloading typing_extensions-4.10.0-py3-none-any.whl (33 kB)
Collecting docutils
Downloading docutils-0.20.1-py3-none-any.whl (572 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 572.7/572.7 KB 8.0 MB/s eta 0:00:00
Collecting lockfile>=0.10
Downloading lockfile-0.12.2-py2.py3-none-any.whl (13 kB)
Collecting setuptools>=62.4.0
Downloading setuptools-69.1.1-py3-none-any.whl (819 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 819.3/819.3 KB 8.3 MB/s eta 0:00:00
Requirement already satisfied: portalocker>=1.6.0 in /home/ubuntu/Desktop/AGScada/venv/lib/python3.10/site-packages (from concurrent-log-handler->pyscada>=0.8.0->pyscada-modbus) (2.8.2)
Using legacy 'setup.py install' for monthdelta, since package 'wheel' is not installed.
Installing collected packages: pytz, pyserial, monthdelta, lockfile, typing-extensions, sqlparse, six, setuptools, pymodbus, pillow, numpy, docutils, python-dateutil, python-daemon, h5py, asgiref, django, pyscada, pyscada-modbus
Running setup.py install for monthdelta ... done
Attempting uninstall: setuptools
Found existing installation: setuptools 59.6.0
Uninstalling setuptools-59.6.0:
Successfully uninstalled setuptools-59.6.0
Successfully installed asgiref-3.7.2 django-4.2.11 docutils-0.20.1 h5py-3.10.0 lockfile-0.12.2 monthdelta-0.9.1 numpy-1.26.4 pillow-10.2.0 pymodbus-3.6.6 pyscada-0.8.0 pyscada-modbus-0.8.0 pyserial-3.5 python-daemon-3.0.1 python-dateutil-2.9.0.post0 pytz-2024.1 setuptools-69.1.1 six-1.16.0 sqlparse-0.4.4 typing-extensions-4.10.0
(venv) ubuntu@ubuntu:~/Desktop/AGScada/PyScada-Modbus$ sudo python3 /var/www/pyscada/PyScadaServer/manage.py migrate
Traceback (most recent call last):
File "/var/www/pyscada/PyScadaServer/manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.10/dist-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.10/dist-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/django/core/management/commands/migrate.py", line 100, in handle
self.check(databases=[database])
File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 485, in check
all_issues = checks.run_checks(
File "/usr/local/lib/python3.10/dist-packages/django/core/checks/registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/usr/local/lib/python3.10/dist-packages/django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python3.10/dist-packages/django/core/checks/urls.py", line 24, in check_resolver
return check_method()
File "/usr/local/lib/python3.10/dist-packages/django/urls/resolvers.py", line 494, in check
for pattern in self.url_patterns:
File "/usr/local/lib/python3.10/dist-packages/django/utils/functional.py", line 57, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/lib/python3.10/dist-packages/django/urls/resolvers.py", line 715, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python3.10/dist-packages/django/utils/functional.py", line 57, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/lib/python3.10/dist-packages/django/urls/resolvers.py", line 708, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/var/www/pyscada/PyScadaServer/PyScadaServer/urls.py", line 20, in
path('', include('pyscada.core.urls')),
File "/usr/local/lib/python3.10/dist-packages/django/urls/conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pyscada.core.urls'
(.venv) ubuntu@ubuntu:/var/www/pyscada/PyScadaServer$ sudo -E env PATH=${PATH} pip3 list
WARNING: The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Package Version
asgiref 3.7.2
async-timeout 4.0.3
cffi 1.16.0
channels 4.0.0
channels-redis 4.2.0
concurrent-log-handler 0.9.25
cryptography 3.4.6
Cython 3.0.9
Django 4.2.11
docutils 0.20.1
gunicorn 21.2.0
h5py 3.10.0
lockfile 0.12.2
lxml 5.1.0
MonthDelta 0.9.1
msgpack 1.0.8
mysqlclient 2.2.4
numpy 1.26.4
packaging 24.0
pillow 10.2.0
pip 22.0.2
portalocker 2.8.2
pycparser 2.21
PyScada 0.8.2
python-daemon 3.0.1
python-dateutil 2.9.0.post0
pytz 2024.1
redis 5.0.3
scipy 1.12.0
setuptools 69.1.1
six 1.16.0
sqlparse 0.4.4
typing_extensions 4.10.0
I copied this file "https://github.com/pyscada/PyScada/tree/main/pyscada" into the "/var/www/pyscada/PyScadaServer" folder because this folder is exaclty what is missing according to the error with pyscada.core.url. Then i run migration and there is no error, however on the application i still cant see modbus
Your pyscada-modbus installation is not working, it does not appear in the pip list.
You should not need to copy anything in the /var/www/pyscada/PyScadaServer
folder.
You should not run the migration using sudo as specified in https://pyscada.readthedocs.io/en/main/plugin_install.html
Please retry the PyScada-Modbus installation respecting the commands in https://pyscada.readthedocs.io/en/main/plugin_install.html and show me the logs of these commands :
sudo -u pyscada ...
for the pip install- no sudo for migrate
- ...
Oh okay now it works, thx a lot very helpful. By the way just as an advice, in the installation part it says debian and derivatives but I tried this in linux mint, linux mint debian and kali linux and the auto installation always gave error. Also the installation broke my mysql and i couldnt use mysql anymore, it just doesnt start and never respond. However in ubuntu it worked without an error. So if you could recommend using ubuntu that would make it easier for future installations
ok, strange that it broke you mysql installation. Do you have the error ?
Sorry, I formatted that installation.
All I can say is mysql runs perfect before starting installation. Installations gives bunch of errors, sometimes building wheel or python mysql connector library installation fails etc. I dont remember exaclty but there was a lot. After installation fails and exits, mysql stops running and systemctl start mysql doesnt work and it doesnt respond to anything