Cryosparc installation error: ModuleNotFoundError: No module named 'pycuda'

cryosparcm installation seems successful, but I get the following error in the end of cryosparcw installation. I tried doing a reinstall of cryosparc, but get the same results like this:

******* CRYOSPARC WORKER INSTALLATION COMPLETE *******************

In order to run processing jobs, you will need to connect this
worker to a cryoSPARC master.



Connecting the cryoSPARC worker to the master…


CRYOSPARC CONNECT --------------------------------------------

Attempting to register worker exx2-US-Desktop-Aegis-RS to command exx2-US-Desktop-Aegis-RS:39002
Connecting as unix user exx2
Will register using ssh string: exx2@exx2-US-Desktop-Aegis-RS
If this is incorrect, you should re-run this command with the flag --sshstr

Connected to master.

Current connected workers:

Autodetecting available GPUs…
Traceback (most recent call last):
File “bin/connect.py”, line 221, in
gpu_devidxs = check_gpus()
File “bin/connect.py”, line 91, in check_gpus
num_devs = print_gpu_list()
File “bin/connect.py”, line 23, in print_gpu_list
import pycuda.driver as cudrv
ModuleNotFoundError: No module named ‘pycuda’

Thanks very much for your help!

Best,

Linxiang

Hi @linxiang,

What OS and version are you running? Which version of cryoSPARC are you trying to install? Do you have CUDA installed, and does nvidia-smi output GPU information? This seems familiar. If you scroll up the console output from the install, do you have errors during the install of pycuda?

I encountered a similar sounding issue recently, but some more information will be helpful in diagnosis.

Thanks very much for your help. I am installing the newest version of cryoSPARC. I also have CUDA installed. And yes, I do have errors during the install of pycuda. Please see the detailed information here:

nvidia-smi output GPU information:
​nvidia-smi
Mon Nov 14 10:17:58 2022
±----------------------------------------------------------------------------+
| NVIDIA-SMI 515.65.01 Driver Version: 515.65.01 CUDA Version: 11.7 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce … Off | 00000000:01:00.0 On | N/A |
| 0% 43C P8 34W / 350W | 370MiB / 12288MiB | 5% Default |
| | | N/A |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1307 G /usr/lib/xorg/Xorg 76MiB |
| 0 N/A N/A 1617 G /usr/bin/gnome-shell 118MiB |
| 0 N/A N/A 2522 G …9/usr/lib/firefox/firefox 148MiB |
| 0 N/A N/A 4853 G /usr/bin/nautilus 24MiB |
±----------------------------------------------------------------------------+

errors during the install of pycuda:

ERROR: Command errored out with exit status 1: /home/exx2/cryosparc/cryosparc_worker/deps/anaconda/envs/cryosparc_worker_env/bin/python3.7 -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-req-build-gg3ce3vd/setup.py’"’"’; file=’"’"’/tmp/pip-req-build-gg3ce3vd/setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-pp446suv/install-record.txt --single-version-externally-managed --compile --install-headers /home/exx2/cryosparc/cryosparc_worker/deps/anaconda/envs/cryosparc_worker_env/include/python3.7m/pycuda Check the logs for full command output.

Done.
pip packages installation successful.

Main dependency installation completed. Continuing…

Completed.
Currently checking hash for ctffind
Dependencies for ctffind have changed - reinstalling…

ctffind 4.1.10 installation successful.

Completed.
Currently checking hash for cudnn
Dependencies for cudnn have changed - reinstalling…

cudnn 8.1.0.77 for CUDA 11 installation successful.

Completed.
Currently checking hash for gctf
Dependencies for gctf have changed - reinstalling…

Gctf v1.06 installation successful.

Completed.
Completed dependency check.
Generating ‘/home/exx2/cryosparc/cryosparc_worker/deps/anaconda/envs/cryosparc_worker_env/lib/python3.7/site-packages/libtiff/tiff_h_4_4_0.py’ from ‘/home/exx2/cryosparc/cryosparc_worker/deps/anaconda/envs/cryosparc_worker_env/lib/…/include/tiff.h’

******* CRYOSPARC WORKER INSTALLATION COMPLETE *******************

In order to run processing jobs, you will need to connect this
worker to a cryoSPARC master.



Connecting the cryoSPARC worker to the master…


CRYOSPARC CONNECT --------------------------------------------

Attempting to register worker exx2-US-Desktop-Aegis-RS to command exx2-US-Desktop-Aegis-RS:39002
Connecting as unix user exx2
Will register using ssh string: exx2@exx2-US-Desktop-Aegis-RS
If this is incorrect, you should re-run this command with the flag --sshstr

Connected to master.

Current connected workers:

Autodetecting available GPUs…
Traceback (most recent call last):
File “bin/connect.py”, line 221, in
gpu_devidxs = check_gpus()
File “bin/connect.py”, line 91, in check_gpus
num_devs = print_gpu_list()
File “bin/connect.py”, line 23, in print_gpu_list
import pycuda.driver as cudrv
ModuleNotFoundError: No module named ‘pycuda’

Thanks!

Best,

Linxiang

@linxiang Please can you post the complete installation command that prompted the error?

Is the OS Ubuntu? 20.04, 22.04? RedHat derivative?

I had a similar sounding pycuda error on Arch. No guarantee this will help or fix it, but the worst that happens is you delete the install directory and try again…

cd into the cryosparc_worker/bin directory, and run eval $(./cryosparcw env) to enter the work environment, then conda install pycuda -c conda-forge

If that installs correctly, then ./cryosparcw connect --worker [hostname] --master [hostname] --[otherFlags, e.g. --nossd]. Then start cryoSPARC and if there are no errors, please run through the T20S workflow to make sure everything is working.

@wtempel I used the command:
cd cryosparc_master

sudo ./install.sh --standalone \

–license $LICENSE_ID \

–worker_path /home/exx2/cryosparc/cryosparc_worker \

–cudapath /usr/local/cuda \

–nossd \

–initial_email “yinlinxiang8@gmail.com” \

–initial_password 7516 \

–initial_username “Linxiang Yin” \

–initial_firstname “Linxiang” \

–initial_lastname “Yin” \

Thanks!

Linxiang

@rbs_sci
Oh, seems the pycuda install is working as you suggested!
It’s Ubuntu 22.10 OS.
This works for me in this step:
cd into the cryosparc_worker/bin directory, and run eval $(./cryosparcw env) to enter the work environment, then conda install pycuda -c conda-forge

Then ./cryosparcw connect --worker [hostname] --master [hostname] --[otherFlags, e.g. --nossd]. showed some errors.
Because now I am not sure of the hostname, I tried various hostnames or no host name like below but all didn’t quite work somehow:

./cryosparcw connect --worker exx2-US-Desktop-Aegis-RS --master exx2-US-Desktop-Aegis-RS --nossd

./cryosparcw connect --worker --master --nossd

Thanks very much,

Linxiang

You absolutely need the hostname of both the master and worker nodes for it to work, or it can’t connect them. hostname should tell you the hostname of the box you’re logged in to. If the master and worker nodes are different, you’ll need to find out both separately.

@rbs_sci
I typed hostname in the terminal and find the hostname: exx2-US-Desktop-Aegis-RS, I tried this hostname like below but still didn’t quite work somehow:

./cryosparcw connect --worker exx2-US-Desktop-Aegis-RS --master exx2-US-Desktop-Aegis-RS --nossd

Thanks!

Linxiang

The complicated hostname with the hyphens and mixed case in might be causing a problem. Not sure. Never used such a long hostname before. I try to use a single text string, all lowercase.

If I remember systemd syntax correctly, hostname can be changed with: sudo hostnamectl set -hostname newNameHere and rebooting (if using Ubuntu 20.04, for example)…

@rbs_sci Thanks very much for your help. I fixed the problem finally!

----Linxiang

Good to hear. Would you provide more details for future reference? It’s nice to know of potential solutions before problems arise!

@rbs_sci Actually it still showed some errors like:ERROR: Command errored out with exit status 1: /home/exx2/cryosparc/cryosparc_worker/deps/anaconda/envs/cryosparc_worker_env/bin/python3.7 -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-req-build-gg3ce3vd/setup.py’"’"’; file=’"’"’/tmp/pip-req-build-gg3ce3vd/setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-pp446suv/install-record.txt --single-version-externally-managed --compile --install-headers /home/exx2/cryosparc/cryosparc_worker/deps/anaconda/envs/cryosparc_worker_env/include/python3.7m/pycuda Check the logs for full command output.

I then just reinstalled the Ubuntu20.04 and the drive as well as the software and it worked.

Thanks!

Best,

Linxiang