...
Different versions are available via loading a module
Code Block |
---|
[salexan5@mblog2 ~]$ module spider python
----------------------------------------------------------------------------
python:
----------------------------------------------------------------------------
Versions:
python/3.10.6
python/3.12.0
Other possible modules matches:
python2
[salexan5@mblog2 ~]$ module load gcc/13.2.0 python/3.10.6
[salexan5@mblog2 ~]$ python --version
Python 3.10.6
[salexan5@mblog2 ~]$ which pip
/apps/u/spack/gcc/13.2.0/python/3.10.6-jh3qs5v/bin/pip |
...
Code Block |
---|
# Using python/3.10.6
[salexan5@mblog2 ~]$ pip install numpy
Defaulting to user installation because normal site-packages is not writeable
Collecting numpy
Downloading numpy-2.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.9/60.9 kB 2.0 MB/s eta 0:00:00
Downloading numpy-2.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19.3/19.3 MB 131.3 MB/s eta 0:00:00
Installing collected packages: numpy
Successfully installed numpy-2.0.0
[notice] A new release of pip is available: 24.0 -> 24.1
[notice] To update, run: pip install --upgrade pip |
Expand |
---|
|
Code Block |
---|
import sys
import numpy
print("Python version: " + sys.version)
print("Numpy: " + str(numpy.version.version)) |
|
Code Block |
---|
[salexan5@mblog2 ~]$ python py_test.py
Python: 3.10.6 (main, Apr 30 2024, 11:23:04) [GCC 13.2.0]
Numpy: 2.0.0 |
...
Use Python 3.12.0 - Is numpy available?
Code Block |
---|
[salexan5@mblog2 ~]$ module purge
[salexan5@mblog2 ~]$ module load gcc/13.2.0 python/3.12.0
[salexan5@mblog2 ~]$ python --version
Python 3.12.0
[salexan5@mblog2 ~]$ which python
/apps/u/spack/gcc/13.2.0/python/3.12.0-ovfqpv2/bin/python
[salexan5@mblog2 ~]$ python py_test.py
Traceback (most recent call last):
File "/cluster/medbow/home/salexan5<username>/py_test.py", line 2, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy |
...
sysconfig: The sysconfig
module provides access to Python’s configuration information like the list of installation paths and the configuration variables relevant for the current platform.
Code Block |
---|
[salexan5@mblog2 ~]$ module purge
[salexan5@mblog2 ~]$ module load gcc/13.2.0 python/3.10.6
[salexan5@mblog2 ~]$ python -m sysconfig
Platform: "linux-x86_64"
Python version: "3.10"
Current installation scheme: "posix_prefix"
Paths:
...
scripts = "/apps/u/spack/gcc/13.2.0/python/3.10.6-jh3qs5v/bin"
stdlib = "/apps/u/spack/gcc/13.2.0/python/3.10.6-jh3qs5v/lib/python3.10"
...
Variables:
...
py_version = "3.10.6"
...
py_version_short = "3.10"
...
userbase = "/home/salexan5<username>/.local"
# Full list has over 700 lines! |
...
What is under the userbase?
Code Block |
---|
[salexan5@mblog2 ~]$ ls .local
bin lib share
[salexan5@mblog2 ~]$ ls -al .local/bin
total 1
drwxr-xr-x 2 salexan5<username> salexan5<username> 4096 Jun 24 11:16 .
drwxr-xr-x 2 salexan5<username> salexan5<username> 4096 Jun 24 11:16 ..
-rwxr-xr-x 1 salexan5<username> salexan5<username> 257 Jun 24 11:16 f2py
-rwxr-xr-x 1 salexan5<username> salexan5 <username> 257 Jun 24 11:16 numpy-config
[salexan5@mblog2 ~]$ ls .local/lib/
python3.10
[salexan5@mblog2 ~]$ ls .local/lib/python3.10/site-packages/
numpy numpy-2.0.0.dist-info numpy.libs
# ~/.local/lib/python3.10 |
...
Pip Install Numpy - Python 3.12.0
Code Block |
---|
[salexan5@mblog2 ~]$ module purge
[salexan5@mblog2 ~]$ module load gcc/13.2.0 python/3.12.0
[salexan5@mblog2 ~]$ pip install numpy==1.26.4
[salexan5@mblog2 ~]$ python py_test.py
Python: 3.12.0 (main, Apr 30 2024, 11:30:37) [GCC 13.2.0]
Numpy: 1.26.4
[salexan5@mblog2 ~]$ ls .local/lib/
python3.10 python3.12
[salexan5@mblog2 ~]$ ls .local/lib/python3.12/site-packages/
numpy numpy-1.26.4.dist-info numpy.libs |
...
Code Block |
---|
# Previously when installing numpy for python/3.10.6
[salexan5@mblog2 ~]$ ls -al .local/bin
total 1
-rwxr-xr-x 1 salexan5 salexan5 257 Jun 24 11:16 f2py
-rwxr-xr-x 1 salexan5 salexan5 257 Jun 24 11:16 numpy-config
[salexan5@mblog2 ~]$ cat .local/bin/f2py
#!/apps/u/spack/gcc/13.2.0/python/3.10.6-jh3qs5v/bin/python
...
# Now after installing numpy for python/3.12.0
[salexan5@mblog2 ~]$ ls -al .local/bin/
-rwxr-xr-x 1 salexan5 salexan5 257 Jun 24 11:45 f2py
-rwxr-xr-x 1 salexan5 salexan5 257 Jun 24 11:16 numpy-config
[salexan5@mblog2 ~]$ cat .local/bin/f2py
#!/apps/u/spack/gcc/13.2.0/python/3.12.0-ovfqpv2/bin/python
... |
...