Closed appukuttan-shailesh closed 3 years ago
Fixes installation problem on Windows systems.
Currently users might see the installation getting stuck on running pip install pyNN or locally python setup.py install
pip install pyNN
python setup.py install
Gets stuck at this stage:
This arises from this method in setup.py
def run_command(path, working_directory): p = subprocess.Popen(path, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, cwd=working_directory) result = p.wait() stdout = p.stdout.readlines() return result, stdout
On investigating, it was found that the execution gets stuck at result = p.wait()
result = p.wait()
The use of wait() is potentially problematic. As mentioned in the docs:
wait()
This PR takes the above suggestion of replacing wait() with communicate(), and making other related changes.
communicate()
An alernative workaround, that also I found working, was:
import tempfile def run_command(path, working_directory): with tempfile.NamedTemporaryFile(mode="w+") as tmp_out, tempfile.NamedTemporaryFile(mode="w+") as tmp_err: p = subprocess.Popen(path, shell=True, stdin=subprocess.PIPE, stdout=tmp_out, stderr=tmp_err, universal_newlines=True, cwd=working_directory) result = p.wait() tmp_out.seek(0) tmp_err.seek(0) stdout = tmp_out.readlines() return result, stdout
I would prefer the workaround in the PR more suitable, than the above option.
Fixes installation problem on Windows systems.
Currently users might see the installation getting stuck on running
pip install pyNN
or locallypython setup.py install
Gets stuck at this stage:
This arises from this method in setup.py
On investigating, it was found that the execution gets stuck at
result = p.wait()
The use of
wait()
is potentially problematic. As mentioned in the docs:This PR takes the above suggestion of replacing
wait()
withcommunicate()
, and making other related changes.An alernative workaround, that also I found working, was:
I would prefer the workaround in the PR more suitable, than the above option.