Closed donghyukPDSE closed 5 years ago
I believe this might be an issue with the way that parallel processing in Python differs between windows and Unix systems. I'm not sure if the flux_variability_analysis
function will work with the default arguments if you are using it interactively on windows, because the default settings will try to use more than one CPU.
If you are using the function in the python console, try to set processes=1
. If your model is small, processing in serial might be OK.
model = cobra.io.read_sbml_model( "iJO1366.xml")
fva = flux_variability_analysis(model, processes=1)
I think you might be able to run this code in parallel if you were to write a script and run the script from the command-line. I'm not sure if this will work, but it might :) Save the following code to a file called fva_test.py
and try python fva_test.py
from the command-line.
# fva_test.py
if __name__ == '__main__':
model = cobra.io.read_sbml_model( "iJO1366.xml")
fva = flux_variability_analysis(model, processes=2)
Thank you Soooooo MUCH!!!:) Oh and also the explanation of mulitprocessing. Thank you for helping me to figure it out.
Problem description
fva question!
I'm really first time to use cobrapy and python. While I'm trying to do fva, there is problem with invalid argument and " ImportError: No module named " I think I probably did not understand language of python, but I cannot fix it.. It would be pleasure to help me! Thank you!
Code Sample
model = cobra.io.read_sbml_model( "iJO1366.xml") fva = flux_variability_analysis(model)
by using pycharm, 2.7 python
Actual Output
Traceback (most recent call last): File "", line 1, in
File "C:\Python27\Lib\multiprocessing\forking.py", line 380, in main
prepare(preparation_data)
File "C:\Python27\Lib\multiprocessing\forking.py", line 504, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\cdh12\PycharmProjects\untitled3\venv\lib\site-packages\cobra\flux_analysis\variability.py", line 187, in flux_variability_analysis
initargs=(model, loopless, what[:3])
File "C:\Python27\Lib\multiprocessing__init.py", line 232, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild)
File "C:\Python27\Lib\multiprocessing\pool.py", line 161, in init__
self._repopulate_pool()
File "C:\Python27\Lib\multiprocessing\pool.py", line 225, in _repopulate_pool
w.start()
File "C:\Python27\Lib\multiprocessing\process.py", line 130, in start
self._popen = Popen(self)
File "C:\Python27\Lib\multiprocessing\forking.py", line 280, in init
to_child.close()
IOError: [Errno 22] Invalid argument