smarthomeNG / smarthome

Device integration platform for your smart home
https://www.smarthomeNG.de
GNU General Public License v3.0
122 stars 91 forks source link

First start of shng problem: pip3 log can't be created (Windows 10) #377

Open onkelandy opened 3 years ago

onkelandy commented 3 years ago

Some minor issue when running shng in Windows 10 with python 3.8.7 the first time. The pip3_outout.log can't be created automatically and therefore installation of reqs fails. Not sure if it's a Windows only problem

E:\smarthome>python3 bin/smarthome.py

test_requirements: 'ephem' not installed. Minimum v3.7 needed
....

Installing core requirements for the current user, please wait...
python_bin_path=C:\Users\test\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0
> using PIP command: 'C:\Users\test\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\scripts\pip.exe'
Traceback (most recent call last):
  File "bin/smarthome.py", line 116, in <module>
    core_reqs = shpypi.test_core_requirements(logging=False, pip3_command=args.pip3_command)
  File "E:\smarthome\lib\shpypi.py", line 245, in test_core_requirements
    if self.install_requirements('core', logging, pip3_command):
  File "E:\smarthome\lib\shpypi.py", line 390, in install_requirements
    with open(pip_log_name, 'w', encoding='utf8') as outfile:
FileNotFoundError: [Errno 2] No such file or directory: 'E:\\smarthome\\var\\log\\pip3_outout.log'

After creating the dir manually everything runs as expected.. actuall the automatic pip3 path is wrong (for whatever reason)

E:\smarthome>python3 bin/smarthome.py

test_requirements: 'ephem' not installed. Minimum v3.7 needed
....

Installing core requirements for the current user, please wait...
python_bin_path=C:\Users\test\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0
> using PIP command: 'C:\Users\test\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\scripts\pip.exe'

ERROR:
The system cannot find the path specified.

ERROR: Unable to install core requirements
Use the commandline option --pip3_command to specify the path to the command

But using the parameter pip3_command makes things run.

msinn commented 3 years ago

You know that windows is not yet officially supported?

@bmxp Since you are working on Windows compatibility, this could be of interest for you.

bmxp commented 3 years ago

There is a main problem with the way SHNG is now handled in respect to restarts and install stuff. For windows there should be no such thing like daemonzing and unix magics, windows has services. But since @msinn was working very hard to make restarts possible with linux systemd settings I waited for further work at this field. The whole sequence of restarting to install the dependencies is not optimal for windows. I will see if I find some time for a solution after the next release...

bmxp commented 3 years ago

I fixed #377 in lib/shpypi.py with first creating the directories. This error might as well happen with a fresh install on Linux. Maybe we should execute the createdirectories function from lib/smarthome.py as well in lib/shpypi.py as well...?

onkelandy commented 9 months ago

Can we fix this issue and close it? Creating the dir whenever necessary is a useful approach I think. There should be a check whether the dir exists or not. @bmxp ?