Closed mertall closed 4 years ago
The Qiskit code tries to take advantage of multiprocessing, where its going though parts that can run in parallel, with a goal of speeding up things overall. This seems to be failing under WSL in the area of multiprocessing. Now we do test under Windows directly and support that as a platform, same for Linux directly. One thing you might like to try is to set num_processes to 1 in aqua_globals and see if restricting computation to a single process will allow it to run for you.
I did so but none of my graphs are coming up. It seems like it is terminating early? good news is the error code is gone... not sure if that is because it isn't executing everything.
You need to add a plt.show()
at the end to make sure the graph appears when you run this outside of a notebook as python script.
I am not sure what you expect to see in the plot since you are plotting the electronic energy part of the problem, which is what the algorithm is solving. To see the 'normal' sort of dissociation curve you need to add in the nuclear repulsion energy and also the frozen energy from the core orbitals done via freeze_core. You can call process_algorithm_result from the Hamiltonian class, from which you got the qubit_op in order to compute a full result. The energy field in that result will plot like the curve you maybe expecting.
I was able to run it and show the graph under WSL-2 Ubuntu 20.04 and python 3.8.3 (Anaconda env.) in vs code. plt.show() at the end.
Very important: You need a XServer running, please look at: https://stackoverflow.com/questions/43397162/show-matplotlib-plots-in-ubuntu-windows-subsystem-for-linux-wsl1-wsl2
First I added to my .bashrc: export DISPLAY=grep -oP "(?<=nameserver ).+" /etc/resolv.conf
:0.0
Once it ran I got in my case DISPLAY=172.27.32.1:0.0
Then I installed VcXsrv on Windows, enabled private/public firewall access and started it with "Disable access control" ticked.
I was able to show the graph with plt.show() at the end. I never got the multiprocess error you mentioned. My Windows is Windows Version 2004 (OS Build 19041.388) running on a VMWare Fusion VM.
thank you @manoelmarques @woodsp-ibm ... I added plt.show() but forgot to include the updated script in this issue. I will take both suggestions into consideration and will update this issue tomorrow with my results. again, thank you for the help so far!
@mertall Did the information help you? If the issue is solved for you then please feel free to close this issue off.
Information
What is the current behavior?
Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/usr/lib/python3.8/concurrent/futures/process.py", line 102, in _python_exit thread_wakeup.wakeup() File "/usr/lib/python3.8/concurrent/futures/process.py", line 90, in wakeup self._writer.send_bytes(b"") File "/usr/lib/python3.8/multiprocessing/connection.py", line 183, in send_bytes self._check_closed() File "/usr/lib/python3.8/multiprocessing/connection.py", line 136, in _check_closed raise OSError("handle is closed") OSError: handle is closed
Steps to reproduce the problem
I have attached the file I am using. I am simply running the program with WSL Ubuntu 20.04 and python 3.8.2 in vs code
What is the expected behavior?
It should be returning graphs of the VQE energy and Exact Energy.
Suggested solutions
I think maybe this has to do with the optimizer? or maybe the program is running out of memory?