...
Code Block | ||
---|---|---|
| ||
mfk8@login01:~$ which python /usr/bin/python mfk8@login01:~$ module load gcc/6.2.0 mfk8@login01:~$ module avail python --------------- /n/app/lmod/lmod/modulefiles/Compiler/gcc/6.2.0 ---------------- python/2.7.12 (E) python/3.6.0 (E,D) python/3.7.4 Where: E: Experimental D: Default Module Use "module spider" to find all possible modules. Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys". mfk8@login01:~$ module load python/3.7.4 mfk8@login01:~$ which python3 /n/app/python/3.7.4/bin/python3 mfk8@login01:~$ which virtualenv /n/app/python/2.7.12/bin/virtualenv mfk8@login01:~$ mkdir mypythonfolder && cd mypythonfolder mfk8@login01:~/mypythonfolder$ virtualenv myvirtualenv (truncated) mfk8@login01:~/mypythonfolder$ source myvirtualenv/bin/activate (myvirtualenv)mfk8@login01:~/mypythonfolder$ pip3 install numpy (truncated) (myvirtualenv)mfk8@login01:~/mypythonfolder$ echo "print 'hello world'" > myscript.py (myvirtualenv)mfk8@login01:~/mypythonfolder$ python3 myscript.py hello world (myvirtualenv)mfk8@login01:~/mypythonfolder$ deactivate mfk8@login01:~/mypythonfolder$ |
Troubleshooting
Errors resembling python3: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
This error might arise if you have not loaded the corresponding python module prior to invoking the python executable in your virtual environment. Due to the nature of virtualenv, it is necessary (on O2) for the parent installation to be present in your session when your virtual environment is activated. This must be done in the correct order as well.
Solution: As an example, the error shown above points to a problem with (presumably) an environment based on the python/3.7.4 module, so the proper procedure would be to
1) deactivate the current virtual environment,
2) make sure the python/3.7.4 module is loaded,
3) re-activate the virtual environment
If it still fails, then it is unlikely that your virtual environment was created from one of the existing modules, and you may need to re-create it from scratch (or debug with whatever source the environment was from). Note that copying python environments, virtual or otherwise, from a local machine to the cluster will likely fail to work as intended. If an existing python module does not fit your needs, you will need to supply your own version of python, either via (ana)conda or installing it yourself. For further/directed guidance on this option, feel free to send a ticket to rchelp@hms.harvard.edu.
Any errors related to setuptools.build_meta
...