CellProfiler / CellProfiler-plugins

Community-contributed and experimental CellProfiler modules.
http://plugins.cellprofiler.org/
54 stars 65 forks source link

Error when running RunImageJScript on Windows #221

Open sugan89 opened 8 months ago

sugan89 commented 8 months ago

Beth and I were trying to run RunImageJScript on a Windows 10 laptop but we got the following error,

Unable to load native library: The specified procedure could not be found
Exception in thread Parse Parameters Thread:
Traceback (most recent call last):
  File "C:\Users\cimini\Anaconda3\envs\cellprofiler_imagejscript\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Users\cimini\Anaconda3\envs\cellprofiler_imagejscript\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\cimini\Project\CellProfiler-plugins\active_plugins\runimagejscript.py", line 377, in get_parameters_from_script
    self.init_pyimagej()
  File "C:\Users\cimini\Project\CellProfiler-plugins\active_plugins\runimagejscript.py", line 350, in init_pyimagej
    if ijbridge.init_pyimagej(init_string):
  File "C:\Users\cimini\Project\CellProfiler-plugins\active_plugins\cpij\bridge.py", line 86, in init_pyimagej
    result = from_imagej().get()
  File "<string>", line 2, in get
  File "C:\Users\cimini\Anaconda3\envs\cellprofiler_imagejscript\lib\multiprocessing\managers.py", line 835, in _callmethod
    kind, result = conn.recv()
  File "C:\Users\cimini\Anaconda3\envs\cellprofiler_imagejscript\lib\multiprocessing\connection.py", line 250, in recv
    buf = self._recv_bytes()
  File "C:\Users\cimini\Anaconda3\envs\cellprofiler_imagejscript\lib\multiprocessing\connection.py", line 414, in _recv_bytes
    buf = self._recv(4)
  File "C:\Users\cimini\Anaconda3\envs\cellprofiler_imagejscript\lib\multiprocessing\connection.py", line 379, in _recv
    chunk = read(handle, remaining)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
[1023/145603.131:ERROR:window_impl.cc(120)] Failed to unregister class Chrome_WidgetWin_0. Error = 0

And then we tried the following,

(cellprofiler_imagejscript) C:\Users\cimini>cd C:\Users\cimini\Project\CellProfiler-plugins\active_plugins

(cellprofiler_imagejscript) C:\Users\cimini\Project\CellProfiler-plugins\active_plugins>python
Python 3.8.17 | packaged by conda-forge | (default, Jun 16 2023, 07:01:59) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cpij.bridge as ijbridge, cpij.server as ijserver
>>> ijbridge.start_imagej_server()
>>> script_filepath = "C:\\Users\\cimini\\Project\\Project_2023_10_23"
>>> ijbridge.init_pyimagej()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: init_pyimagej() missing 1 required positional argument: 'init_string'
>>> ijbridge.init_pyimagej(init_string=None)

image

Could you help me with this or do you have ideas on making this work @hinerm ?

hinerm commented 8 months ago

@sugan89 What happens when you run java --version from the command line in the cellprofiler_imagejscript conda environment?

sugan89 commented 8 months ago

Thanks for looking into this! I got the following,

(cellprofiler_imagejscript) C:\Users\cimini>java --version
openjdk 11.0.20 2023-07-18 LTS
OpenJDK Runtime Environment Zulu11.66+15-CA (build 11.0.20+8-LTS)
OpenJDK 64-Bit Server VM Zulu11.66+15-CA (build 11.0.20+8-LTS, mixed mode)
hinerm commented 8 months ago

Can you double-check your PATH and JAVA_HOME environment variables? Do you have a separate non-JDK java being specified anywhere?

You could also share your pip list output from that conda environment.. though I don't think it's a python dependency problem.

Was this in a fresh conda environment? If not, can you try setting up a fresh environment and seeing if it also has this problem?

In my local CP-ImageJ environment on windows everything is working 😿