# Python environment error

**URL:** <https://cms-helpdesk.ncas.ac.uk/t/python-environment-error/1062>\
**Category:** Uncategorized\
**Tags:** ARCHER2\
**Created:** [20 July 2023 09:54 UTC](https://cms-helpdesk.ncas.ac.uk/t/python-environment-error/1062 "2023-07-20T09:54:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bk21486](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bk21486](https://cms-helpdesk.ncas.ac.uk/u/bk21486)\
**Post date:** [20 July 2023 09:54 UTC](https://cms-helpdesk.ncas.ac.uk/t/python-environment-error/1062/1 "2023-07-20T09:54:59Z")

</div>

Since the archer2 upgrade, I am getting an error to do with the python environment on archer2 in u-cu858:

I’ve tried adding the line #!/usr/bin/env python

at the top of the regrid\_NEMO4.2\_to\_BIKE.py script.

I’ve also tried changing the pythonpath to PYTHONPATH=/work/y07/shared/utils/core/python/miniconda2/bin/python

which is where the archer2 helpdesk said python2 can be found after the software upgrade:

They said:

To support NCAS users, my colleague Andy Turner has created a virtual environment that contains python 2 in /work/y07/shared/utils/core/python/miniconda2/ even though HPE no longer supports python2.

If I activate the environment, I get access to both python2 and python3:

rapostol@ln02:~\> source /work/y07/shared/utils/core/python/miniconda2/bin/activate  
(base) rapostol@ln02:~\> python --version  
Python 2.7.18 :: Anaconda, Inc.  
(base) rapostol@ln02:~\> python2 --version  
Python 2.7.18 :: Anaconda, Inc.  
(base) rapostol@ln02:~\> python3 --version  
Python 3.6.15

I’m wondering how I can set the python environment to python2 in my rose suite - I tried putting the line source /work/y07/shared/utils/core/python/miniconda2/bin/activate in my .bash\_profile on archer2 but this hasn’t made a difference.

The full error I’m getting is:

Lmod is automatically replacing “cce/15.0.0” with “gcc/11.2.0”.

Lmod is automatically replacing “PrgEnv-cray/8.3.3” with “PrgEnv-gnu/8.3.3”.

Due to MODULEPATH changes, the following have been reloaded:

1. cray-hdf5-parallel/1.12.2.1 3) cray-netcdf-hdf5parallel/4.9.0.1
2. cray-mpich/8.1.23

Currently Loaded Modules:

1. craype-x86-rome
2. libfabric/1.12.1.2.2.0.0
3. craype-network-ofi
4. perftools-base/22.12.0
5. xpmem/2.5.2-2.4\_3.30\_\_gd0f7936.shasta
6. bolt/0.8
7. epcc-setup-env
8. load-epcc-module
9. oasis3-mct/2.0/v1/2466
10. XIOS/2.0/v1/952
11. GC3-PrgEnv/v1
12. gcc/11.2.0
13. craype/2.7.19
14. cray-dsmml/0.2.2
15. cray-mpich/8.1.23
16. cray-libsci/22.12.1.1
17. PrgEnv-gnu/8.3.3
18. cray-hdf5-parallel/1.12.2.1
19. cray-netcdf-hdf5parallel/4.9.0.1
20. hypre/2.25.0
21. metis/5.1.0
22. parmetis/4.0.3
23. scotch/7.0.3
24. mumps/5.5.1
25. superlu/5.2.2
26. superlu-dist/8.1.2
27. petsc/3.18.5
28. nco/5.1.6

Traceback (most recent call last):  
File “/work/n02/n02/rutrns/cylc-run/u-cu858/share/fcm\_make\_unicicles/scripts/bin/regrid\_NEMO4.2\_to\_BIKE.py”, line 4, in   
import numpy as np  
ImportError: No module named numpy  
[FAIL] $PYTHON $ISCRIPDIR/regrid\_NEMO4.2\_to\_BIKE.py --input $PREICE\_OCOUPLE\_NC --output $PREICE\_NEMO\_REG\_HDF \<\<‘ **STDIN** ’  
[FAIL]  
[FAIL] ‘ **STDIN** ’ # return-code=1  
2023-07-20T09:22:54Z CRITICAL - failed/EXIT
