charbj / wiggle

Graphical user interface to integrate cryoEM flexibility analyses with ChimeraX
GNU General Public License v3.0
21 stars 4 forks source link

Opening Wiggle in ChimeraX gives the error "no module named 'pyqtgraph'" #10

Open cbeck22 opened 1 week ago

cbeck22 commented 1 week ago

Thank you for developing this tool! This looks incredibly useful and I'm looking forward to using it in my cryoDRGN workflow. However, I'm having issues with installing and running Wiggle in ChimeraX.

After installing Wiggle and its dependencies, I can see Wiggle in Tools -> General -> wiggle. However, when I try to start Wiggle, I get the following error message that ChimeraX can't find pyqtgraph. I'm confused, because I've checked that pyqtgraph was definitely installed successfully along with the rest of the dependencies. Do you have an idea of what might be happening?

Traceback (most recent call last):
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/toolshed/info.py", line 554, in start_tool
    ti = api._api_caller.start_tool(api, session, self, tool_info)
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/toolshed/__init__.py", line 1323, in start_tool
    return cls._get_func(api, "start_tool")(session, bi, ti)
  File "/home/cbeck/.local/share/ChimeraX/1.3/site-packages/chimerax/wiggle/__init__.py", line 29, in start_tool
    from . import tool
  File "/home/cbeck/.local/share/ChimeraX/1.3/site-packages/chimerax/wiggle/tool.py", line 16, in <module>
    import pyqtgraph as pg
ModuleNotFoundError: No module named 'pyqtgraph'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/ui/gui.py", line 1659, in <lambda>
    run(ses, "ui tool show %s" % StringArg.unparse(tool_name)))
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/run.py", line 36, in run
    results = command.run(text, log=log, return_json=return_json)
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/cli.py", line 2856, in run
    result = ci.function(session, **kw_args)
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/ui/cmd.py", line 219, in ui_tool_show
    bi.start_tool(session, name)
  File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/toolshed/info.py", line 559, in start_tool
    raise ToolshedError(
chimerax.core.toolshed.ToolshedError: start_tool() failed for tool wiggle in bundle wiggle:
No module named 'pyqtgraph'

chimerax.core.toolshed.ToolshedError: start_tool() failed for tool wiggle in bundle wiggle:
No module named 'pyqtgraph'

File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/toolshed/info.py", line 559, in start_tool
raise ToolshedError(

It may be relevant that after running "devel install wiggle", instead of the short "Successfully installed wiggle" message you had in your video tutorial, I had the following longer message:

[toolshed install](help:user/commands/toolshed.html#install)
wiggle/dist/wiggle-0.2.2-py3-none-any.whl

[toolshed install wiggle/dist/wiggle-0.2.2-py3-none-any.whl](cxcmd:toolshed
install wiggle/dist/wiggle-0.2.2-py3-none-any.whl)

Errors may have occurred when running pip:
pip standard error:
---
WARNING: Value for scheme.platlib does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
distutils: /home/cbeck/.local/share/ChimeraX/1.3/site-packages
sysconfig: /home/cbeck/.local/lib/python3.9/site-packages
WARNING: Value for scheme.purelib does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
distutils: /home/cbeck/.local/share/ChimeraX/1.3/site-packages
sysconfig: /home/cbeck/.local/lib/python3.9/site-packages
WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
distutils: /home/cbeck/.local/share/ChimeraX/include/python3.9/wiggle
sysconfig: /home/cbeck/.local/include/python3.9/wiggle
WARNING: Value for scheme.scripts does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
distutils: /home/cbeck/.local/share/ChimeraX/bin
sysconfig: /home/cbeck/.local/bin
WARNING: Value for scheme.data does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
distutils: /home/cbeck/.local/share/ChimeraX
sysconfig: /home/cbeck/.local
WARNING: Additional context:
user = True
home = None
root = None
prefix = None
WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
distutils: /home/cbeck/.local/share/ChimeraX/include/python3.9/UNKNOWN
sysconfig: /home/cbeck/.local/include/python3.9/UNKNOWN
WARNING: You are using pip version 21.2.4; however, version 24.2 is available.
You should consider upgrading via the '/usr/bin/chimerax -m pip install --upgrade pip' command.
---
pip standard output:
---
Looking in indexes: https://pypi.org/simple, https://cxtoolshed.rbvi.ucsf.edu/pypi/
Processing ./wiggle/dist/wiggle-0.2.2-py3-none-any.whl
Requirement already satisfied: ChimeraX-UI~=1.0 in /usr/lib/ucsf-chimerax/lib/python3.9/site-packages (from wiggle==0.2.2) (1.13.7)
Requirement already satisfied: ChimeraX-Core~=1.1 in /usr/lib/ucsf-chimerax/lib/python3.9/site-packages (from wiggle==0.2.2) (1.3)
Requirement already satisfied: ChimeraX-Graphics~=1.0 in /usr/lib/ucsf-chimerax/lib/python3.9/site-packages (from ChimeraX-UI~=1.0->wiggle==0.2.2) (1.1)
Requirement already satisfied: ChimeraX-SelInspector~=1.0 in /usr/lib/ucsf-chimerax/lib/python3.9/site-packages (from ChimeraX-UI~=1.0->wiggle==0.2.2) (1.0)
Requirement already satisfied: ChimeraX-MouseModes~=1.0 in /usr/lib/ucsf-chimerax/lib/python3.9/site-packages (from ChimeraX-UI~=1.0->wiggle==0.2.2) (1.1)
Requirement already satisfied: ChimeraX-Arrays~=1.0 in /usr/lib/ucsf-chimerax/lib/python3.9/site-packages (from ChimeraX-Graphics~=1.0->ChimeraX-UI~=1.0->wiggle==0.2.2) (1.0)
Requirement already satisfied: ChimeraX-Geometry~=1.0 in /usr/lib/ucsf-chimerax/lib/python3.9/site-packages (from ChimeraX-Graphics~=1.0->ChimeraX-UI~=1.0->wiggle==0.2.2) (1.1)
Requirement already satisfied: ChimeraX-ItemsInspection~=1.0 in /usr/lib/ucsf-chimerax/lib/python3.9/site-packages (from ChimeraX-SelInspector~=1.0->ChimeraX-UI~=1.0->wiggle==0.2.2) (1.0)
Installing collected packages: wiggle
Successfully installed wiggle-0.2.2
---
Successfully installed wiggle-0.2.2
Installed wiggle (0.2.2)
tomgoddard commented 1 week ago

You say "I've checked that pyqtgraph was definitely installed successfully". How? Obviously ChimeraX doesn't think pyqtgraph is installed and none of your text in this issue shows how you installed pyqtgraph or how you checked that it was installed. You should show how you installed pyqtgraph, both the command you used and its output.

That said, the wiggle .whl file should really list all the dependencies and install them (except maybe for CUDA where you need it to match your system version). Also you'd be much better off if Wiggle could use a current ChimeraX version (1.8) instead of the quite old ChimeraX version 1.3. Those are issues for the wiggle developer.

cbeck22 commented 1 week ago

Hi Tom,

Thanks for your feedback on providing more detailed information for these sort of questions. This is my first time posting in this kind of forum, so I'll keep your advice in mind going forward.

I ended up solving the issue. I "confirmed" that pyqtgraph was installed using the command /path/to/chimerax/bin/python 3.9 -m pip show pyqtgraph, which returned the version and other information. However, I initially didn't notice that instead of installing to the path/to/chimerax/lib/python3.9/site-packages directory, it actually installed pyqtgraph (and all of the other packages) to my own python3.9/site-packages directory.

I wasn't sure what to do, but the solution described in this post ended up solving the issue. For reasons I still don't understand, installing the packages using /path/to/chimerax/bin/ChimeraX instead of /path/to/chimerax/bin/python3.9 finally installed the packages to the correct path/to/chimerax/lib/python3.9/site-packages directory.

As for why I'm using ChimeraX v1.3 instead of v1.8, the cupy-cuda package just would not install with ChimeraX v1.8, and I don't know why. With ChimeraX v1.8, running either /path/to/chimerax/bin/python3.9 -m pip install cupy-cuda101 or /path/to/chimerax/bin/ChimeraX -m pip install cupy-cuda101 resulted in the following error:

ERROR: Could not find a version that satisfies the requirement cupy-cuda101 (from versions: none)
ERROR: No matching distribution found for cupy-cuda101

I found that if I was using python 3.11 (my default python), the command pip install cupy-cuda101 would give the same error, but would install properly if I was using python 3.9. Since I noticed that ChimeraX v1.8 uses python 3.11 while ChimeraX v1.3 uses python 3.9, I just tried installing ChimeraX v1.3, and cupy-cuda101 finally installed properly. As you might have been able to tell, I'm still very much a novice with Linux, so a lot of these package installation/management situations go way over my head. If you have any insights on what might be happening, I'd appreciate any advice you can give.

Cheers, cbeck

tomgoddard commented 1 week ago

Glad you figured out the pyqtgraph install problem. If Wiggle has only been tested for ChimeraX 1.3 then you probably should stick with that. You are right that cupy-cuda101 is not available for newer Python 3.11 as you can see by searching for PyPi cupy

https://pypi.org/project/cupy/

which shows only cuda 11 and cuda 12 versions. I guess cuda 10 is too old and no longer supported by cupy. Using all these old versions of software (ChimeraX 1.3, cuda 10, and apparently from your issue #11 you may need an older cryoDRGN) required by Wiggle is unfortunate. Although Wiggle was nice when I tried it a few years ago if it is not being maintained it may not be usable now.

charbj commented 1 week ago

Hi cbeck,

Glad you fixed the issue with pygtgraph. I'm glad you're trying out WIGGLE. I admit installation is still a problem that I have yet to fully address.

Regarding the requirement for cupy-cuda101, this implies that you have CUDA 10 on your workstation. Is that so? It seems that if you want to use a newer version of ChimeraX (and therefore python 3.11) you may need to update your CUDA and Nvidia driver. It's a shame that python 3.11 no longer supports a CUDA from only a few years ago. With respect to WIGGLE, it should run with any version of cupy. I have also tested it on ChimeraX 1.4 and ChimeraX 1.6 today, without issues (but I have CUDA 12).

So I guess you have two options:

  1. Consider upgrading your CUDA, that way you can use a newer version of ChimeraX and install cupy alongside python 3.11
  2. Downgrade to a lower ChimeraX (as you seem to have done), which will allow you to install an older cupy to suit your CUDA and Nvidia driver.

In the meantime, I am making some modifications to my dev branch of WIGGLE so that it will run with pyqt6, which means you should be able to run WIGGLE with the most up to date ChimeraX. Hopefully this will only take me a couple of days (between wet lab work).

HTH, Charles

tomgoddard commented 1 week ago

Hi Charles,

Glad to hear WIGGLE can work with newer ChimeraX. ChimeraX 1.3 uses Qt 5 while newer ChimeraX uses Qt 6. Fortunately there are not too many differences between Qt 6 and Qt 5. Thanks for updating WIGGLE!

Tom