| 286 | # Installing a missing Python package # |
| 287 | |
| 288 | To install a missing python package you may need, you must install it from its sources. In this example we try to install a package we call 'super_package' |
| 289 | As IRENE has no http connexion to the internet, you must download it on you mesocentre account : |
| 290 | On ciclad : |
| 291 | {{{ |
| 292 | > wget <address of the source>.tar.gz |
| 293 | }}} |
| 294 | |
| 295 | Then you must scp it to IRENE, on your WORKDIR. For this, log in to irene and : |
| 296 | {{{ |
| 297 | > scp login@ciclad.address.fr:/path/to/your/archive $CCCWORKDIR/dossier_de_sources/super_package.tar.gz |
| 298 | }}} |
| 299 | From now on everything will be done on IRENE. |
| 300 | Uncompress the archive : |
| 301 | {{{ |
| 302 | > tar -xvzf $CCCWORKDIR/dossier_de_sources/super_package.tar.gz |
| 303 | }}} |
| 304 | We want to install the package for a usage with python3.7, thus, we load the module and add our source folder to the PYTHONPATH : |
| 305 | {{{ |
| 306 | > module load python3/3.7.5 |
| 307 | > export PYTHONPATH="${PYTHONPATH}:$CCCWORKDIR/dossier_de_sources/lib/python3.7/site-packages" |
| 308 | # You may need to do some mkdir to create lib/python3.7/site-packages |
| 309 | }}} |
| 310 | Now we install the package : |
| 311 | {{{ |
| 312 | > cd super_package |
| 313 | > python3 setup.py install --prefix=$CCCWORKDIR/dossier_de_sources |
| 314 | }}} |
| 315 | |
| 316 | |
| 317 | The package is now installed. |
| 318 | |
| 319 | To use it on a next session, we will have to load the module and update the PYTHONPATH : |
| 320 | {{{ |
| 321 | > module load python3/3.7.5 |
| 322 | > export PYTHONPATH="${PYTHONPATH}:$CCCWORKDIR/dossier_de_sources/lib/python3.7/site-packages" |
| 323 | }}} |
| 324 | |
| 325 | You can now import this package on your python scripts. |
| 326 | |