Core() ImportError: sys.meta_path is None, Python is likely shutting down
SebastianVivoverse opened this issue · 7 comments
Error when verifying Pycromanager installation. Appears to be same as this issue
Code
from pycromanager import Core
core = Core()
print(core)
Error
PS C:\Users\Newormics\PycharmProjects\vivoImager\ManualControl> python .\main.py
<pycromanager.zmq_bridge.bridge.mmcorej_CMMCore object at 0x000001C05F60E690>
Traceback (most recent call last):
File "C:\Users\Newormics\AppData\Local\Programs\Python\Python311\Lib\site-packages\pycromanager\zmq_bridge\bridge.py", line 655, in __del__
self._close()
File "C:\Users\Newormics\AppData\Local\Programs\Python\Python311\Lib\site-packages\pycromanager\zmq_bridge\bridge.py", line 577, in _close
reply_json = self._get_bridge()._receive(timeout=self._timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Newormics\AppData\Local\Programs\Python\Python311\Lib\site-packages\pycromanager\zmq_bridge\bridge.py", line 340, in _receive
return self._main_socket.receive(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Newormics\AppData\Local\Programs\Python\Python311\Lib\site-packages\pycromanager\zmq_bridge\bridge.py", line 166, in receive
reply = self._socket.recv_multipart(flags=zmq.NOBLOCK)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Newormics\AppData\Local\Programs\Python\Python311\Lib\site-packages\zmq\sugar\socket.py", line 805, in recv_multipart
parts = [self.recv(flags, copy=copy, track=track)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "zmq\\backend\\cython\\socket.pyx", line 805, in zmq.backend.cython.socket.Socket.recv
File "zmq\\backend\\cython\\socket.pyx", line 841, in zmq.backend.cython.socket.Socket.recv
File "zmq\\backend\\cython\\socket.pyx", line 199, in zmq.backend.cython.socket._recv_copy
File "zmq\\backend\\cython\\socket.pyx", line 194, in zmq.backend.cython.socket._recv_copy
File "zmq\\backend\\cython\\checkrc.pxd", line 21, in zmq.backend.cython.checkrc._check_rc
ImportError: sys.meta_path is None, Python is likely shutting down
Exception in destructor for <pycromanager.zmq_bridge.bridge.mmcorej_CMMCore object at 0x000001C05F60E690> on thread MainThread
Environment
OS: Windows 10
Pycromanager==0.29.9
Micro-Manager==2.0.3 20231018
jre==1.8.0_391-613
The weird thing is that Pycromanager works just fine on my Windows 11 pc with the exact same specs.
Just checked on my windows 10 machine where it doesn't happen. I was almost sure I had finally fixed this bug, but it keeps cropping back up. 2 possibilities:
- This is a python version thing. Which python version are you running?
- Somehow you have an older version of the ZMQ server running (in your java libraries). Best way to test this would be to make a fresh install of the latest nightly build in a new directory, run that build, and see if you see the error.
Regardless, this is just a cleanup bug when the python process exits, so its hard to imagine this causing any practical issues
I am on Python version 3.11, sorry I meant to include that in my original post.
I would check out your second suggestion but I was just exploring Pycromanager as a potential library to use at work. I don't have the time to run the new build :(
Hopefully this will be helpful for someone in the future. Looking back through the issues this seems to be a tough bug to get rid of!
I have the exactly same error message with:
OS: Windows 10
Pycromanager==0.29.9
Micro-Manager==2.0.3 20231211
jre==1.8.0_322-b6
Python = 3.10
It doesn't seem to affect the running though.
Where are you running python? Script from terminal, IDE, jupyter notebook, etc?
I am running a scripts from the terminal.
Same error on my side:
OS : Windows 7 Pro SP1
Pycromanager==0.29.9
Micro-Manager==2.0.3 20240217
jre==1.8.0_152-b16
Python==3.8.18
Running from a Conda terminal. The module works fine though, but just throws the same error as discussed here at the closing.
I'll try later with a more recent version of both Windows and Python (3.8 was the last V compatible with Win7).
I think this is finally fixed by #740
Thanks all for your reports!