Open PrometheusPi opened 3 years ago
Copying my note from internal chat here for publicity:
I wanted to run the same thing, but somehow my TUD VPN connection stopped working, so I can't access Taurus right now. Do you know if they changed something about that?
As for the error, I did not see that particular error yet, but import errors in Python very often have to do with wrong paths. (PATH
, LD_LIBRARY_PATH
, PYTHONPATH
) Can you check if there is something weird going on there? Can you also check if which python
and which ipython
point to the right binaries in the right versions? Can you check if you can import numpy successfully, and if you see the same import errors in a normal python
shell?
Sorry for the late reply @franzpoeschel - I am back in the office and will have a look at the issue today.
A general hint what you can try: conda
's dependency resolver is not that good for complex dependencies as present in the -c conda-forge
repository.
You could drop-in replace it with mamba: conda install -c conda-forge mamba
and then use mamba install -c conda-forge ...
for all further installation steps.
So in your original workflow:
conda create -n openpmd2 -c conda-forge openpmd-api mamba
conda activate openpmd2
mamba install -c conda-forge jupyter
# repeat `mamba install ...` at will :)
Alternatively, if you want to install solely with conda
, spin up the whole environment at once like this. That also works robustly:
conda create -n openpmd2 -c conda-forge openpmd-api jupyter # all at once
conda activate openpmd2
# do not add more software to this environment now
A perhaps related issue:
Instead of using conda
I tried to use python's virtualenv
directly. This is the alternative approach for user modules suggested by ZIH.
Te steps were as follows:
# get a x86 node:
srun --pty --ntasks=1 --cpus-per-task=2 --mem-per-cpu=2541 --time=08:00:00 bash -l
# make sure you are in the home directory
cd
# load python used by jupyterHub
module load Python/3.8.6-GCCcore-10.2.0
# setup own virtualenv
mkdir openPMD-api_kernel
cd openPMD-api_kernel/
virtualenv --system-site-packages openPMDapi-kernel
source openPMDapi-kernel/bin/activate
pip install ipykernel
pip install --upgrade pip
python -m ipykernel install --user --name openPMDapi-kernel --display-name="openPMD-api kernel"
pip install openpmd-api
On the terminal, I could run
import openpmd_api as io
without a problem.
But starting the kernel in jupyterHub caused the kernel to crash. Other (default) kernels worked fine.
The error in the log was not very specific (user and system related information are removed ...
):
[I 2021-11-02 11:25:36.515 SingleUserLabApp kernelmanager:179] Kernel started: ... , name: openpmdapi-kernel
[I 2021-11-02 11:25:36.517 SingleUserLabApp log:158] 201 POST /jupyter/user/.../api/sessions?... (...@::...:127.0.0.1) 42.24ms
/home/h3/.../openPMD-api_kernel/openPMDapi-kernel/bin/python: error while loading shared libraries: libpython3.8.so.1.0: cannot open shared object file: No such file or directory
Next, I will try mamba
.
@franzpoeschel as far as I know ZIH did not change anything with the TUD VPN.
@PrometheusPi in order to install your own kernels in Jupyter for HPC, you need to modify the startup script slightly. The rationale behind this is, that Jupyter needs to:
so it can start up the right Python interpreter and environment from Jupyter.
NERSC has a great document on this, all you need is a little helper script for the Jupyter kernel config file: https://docs.nersc.gov/services/jupyter/#conda-environments-as-kernels
They show it on conda, but it's equivalent for virtual envs. Your content of that kernel-helper.sh
script would be something like:
#!/bin/bash -l
module load Python/3.8.6-GCCcore-10.2.0
source $HOME/openPMDapi-kernel/bin/activate
exec python -m ipykernel_launcher "$@"
I also added a cross-link on this in the WarpX docs: https://warpx.readthedocs.io/en/latest/install/hpc/cori.html#post-processing
Maybe you could add a similiar sub-section in PIConGPU's Taurus docs to document process (unless ZIH has a place that you can link to).
Another side-note: for more robust installs, replace pip install
with python3 -m pip install ...
. That way, you are 100% sure which Python environment you are dealing with (the one from which python
) and this also works on systems where PATH
is not modified when pip
got installed.
Performed steps I freshly installed openPMD-api via conda as follows
This worked without any problems and due to its dependencies installed numpy alongside openPMD-api and ipython alongside juypter. However, when loading openPMD-api in ipython, the following error occurred:
(The same errors occurs when using python instead of ipython.)
System environment
Additional context none