When executing python3 (Python 3.6.8) script on a local directory, it works well, but when running sbatch job in slurm, complains about certifi.
JavaScript
x
5
1
python3 -m pip install certifi
2
3
Defaulting to user installation because normal site-packages is not writeable
4
Requirement already satisfied: certifi in /usr/local/lib/python3.6/site-packages (2020.12.5)
5
After adding to the python code this:
JavaScript
1
4
1
import sys
2
import os
3
sys.path.append(os.getcwd())
4
or this:
JavaScript
1
8
1
import sys
2
import os
3
module_path = os.path.abspath(os.getcwd())
4
5
if module_path not in sys.path:
6
7
sys.path.append(module_path)
8
the same error occurs. It seems that certifi is installed.
JavaScript
1
13
13
1
pip show certifi
2
3
Name: certifi
4
Version: 2020.12.5
5
Summary: Python package for providing Mozilla's CA Bundle.
6
Home-page: https://certifiio.readthedocs.io/en/latest/
7
Author: Kenneth Reitz
8
Author-email: me@kennethreitz.com
9
License: MPL-2.0
10
Location: /usr/local/lib/python3.6/site-packages
11
Requires:
12
Required-by: requests
13
The error after running python code (without having the line ‘import certifi’ in python code):
JavaScript
1
23
23
1
Traceback (most recent call last):
2
File "/home/username/test/test.py", line 19, in <module>
3
from textattack.augmentation import WordNetAugmenter, EmbeddingAugmenter, EasyDataAugmenter, CharSwapAugmenter
4
File "/home/username/.local/lib/python3.6/site-packages/textattack/__init__.py", line 12, in <module>
5
from . import (
6
File "/home/username/.local/lib/python3.6/site-packages/textattack/attack_recipes/__init__.py", line 21, in <module>
7
from .attack_recipe import AttackRecipe
8
File "/home/username/.local/lib/python3.6/site-packages/textattack/attack_recipes/attack_recipe.py", line 9, in <module>
9
from textattack.shared import Attack
10
File "/home/username/.local/lib/python3.6/site-packages/textattack/shared/__init__.py", line 11, in <module>
11
from . import utils
12
File "/home/username/.local/lib/python3.6/site-packages/textattack/shared/utils/__init__.py", line 1, in <module>
13
from .install import *
14
File "/home/username/.local/lib/python3.6/site-packages/textattack/shared/utils/install.py", line 9, in <module>
15
import requests
16
File "/home/username/.local/lib/python3.6/site-packages/requests/__init__.py", line 118, in <module>
17
from . import utils
18
File "/home/username/.local/lib/python3.6/site-packages/requests/utils.py", line 25, in <module>
19
from . import certs
20
File "/home/username/.local/lib/python3.6/site-packages/requests/certs.py", line 15, in <module>
21
from certifi import where
22
ModuleNotFoundError: No module named 'certifi'
23
The error (with having the line ‘import certifi’ in python code):
JavaScript
1
5
1
Traceback (most recent call last):
2
File "/home/username/projecttest_LR_attack/LR_attack.py", line 17, in <module>
3
import certifi
4
ModuleNotFoundError: No module named 'certifi'
5
What could be the solution to the issue?
Advertisement
Answer
Are the same modules installed on the compute nodes as locally? You may need to check with the Slurm admins.