I am trying to run a Python script:
python main.py
obtaining this output:
Traceback (most recent call last):
File "main.py", line 8, in <module>
import stateful
File "/path/to/s.py", line 599, in <module>
import policy as offloading_policy
File "/path/to/p.py", line 2, in <module>
from pacsltk import perfmodel
ModuleNotFoundError: No module named 'pacsltk'
Process finished with exit code 1
... but not only pacsltk
is already installed: when I try to install it anyways (pip install pacsltk
), I obtain:
Defaulting to user installation because normal site-packages is not writeable
Collecting pacsltk
Downloading pacsltk-0.2.0-py3-none-any.whl.metadata (2.3 kB)
Collecting boto3>=1.11.5 (from pacsltk)
Downloading boto3-1.35.54-py3-none-any.whl.metadata (6.7 kB)
Requirement already satisfied: numpy>=1.18.1 in ./.local/lib/python3.8/site-packages (from pacsltk) (1.24.4)
Requirement already satisfied: scipy>=1.4.1 in ./.local/lib/python3.8/site-packages (from pacsltk) (1.10.1)
Collecting botocore<1.36.0,>=1.35.54 (from boto3>=1.11.5->pacsltk)
Downloading botocore-1.35.54-py3-none-any.whl.metadata (5.7 kB)
Requirement already satisfied: jmespath<2.0.0,>=0.7.1 in ./.local/lib/python3.8/site-packages (from boto3>=1.11.5->pacsltk) (1.0.1)
Collecting s3transfer<0.11.0,>=0.10.0 (from boto3>=1.11.5->pacsltk)
Downloading s3transfer-0.10.3-py3-none-any.whl.metadata (1.7 kB)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in ./.local/lib/python3.8/site-packages (from botocore<1.36.0,>=1.35.54->boto3>=1.11.5->pacsltk) (2.8.2)
Collecting urllib3<1.27,>=1.25.4 (from botocore<1.36.0,>=1.35.54->boto3>=1.11.5->pacsltk)
Downloading urllib3-1.26.20-py2.py3-none-any.whl.metadata (50 kB)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.36.0,>=1.35.54->boto3>=1.11.5->pacsltk) (1.14.0)
WARNING: No metadata found in ./.local/lib/python3.8/site-packages
Downloading pacsltk-0.2.0-py3-none-any.whl (9.6 kB)
Downloading boto3-1.35.54-py3-none-any.whl (139 kB)
Downloading botocore-1.35.54-py3-none-any.whl (12.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.7/12.7 MB 901.6 kB/s eta 0:00:00
Downloading s3transfer-0.10.3-py3-none-any.whl (82 kB)
Downloading urllib3-1.26.20-py2.py3-none-any.whl (144 kB)
WARNING: Error parsing dependencies of attrs: [Errno 2] File o directory non esistente: '/home/username/.local/lib/python3.8/site-packages/attrs-23.1.0.dist-info/METADATA'
WARNING: Error parsing dependencies of urllib3: [Errno 2] File o directory non esistente: '/home/username/.local/lib/python3.8/site-packages/urllib3-2.0.4.dist-info/METADATA'
Installing collected packages: urllib3, botocore, s3transfer, boto3, pacsltk
Attempting uninstall: urllib3
WARNING: No metadata found in ./.local/lib/python3.8/site-packages
Found existing installation: urllib3 2.0.4
error: uninstall-no-record-file
× Cannot uninstall urllib3 2.0.4
╰─> The package's contents are unknown: no RECORD file was found for urllib3.
hint: You might be able to recover from this via: pip install --force-reinstall --no-deps urllib3==2.0.4
Furthermore, when I try to run the suggested command pip install --force-reinstall --no-deps urllib3==2.0.4
, I am only able to obtain just the same error:
Defaulting to user installation because normal site-packages is not writeable
Collecting urllib3
Downloading urllib3-2.2.3-py3-none-any.whl.metadata (6.5 kB)
WARNING: No metadata found in ./.local/lib/python3.8/site-packages
Downloading urllib3-2.2.3-py3-none-any.whl (126 kB)
Installing collected packages: urllib3
Attempting uninstall: urllib3
WARNING: No metadata found in ./.local/lib/python3.8/site-packages
Found existing installation: urllib3 2.0.4
error: uninstall-no-record-file
× Cannot uninstall urllib3 2.0.4
╰─> The package's contents are unknown: no RECORD file was found for urllib3.
hint: You might be able to recover from this via: pip install --force-reinstall --no-deps urllib3==2.0.4
Similar error when trying to pip uninstall urllib3
.
Also, sudo apt-get autoremove
/purge
applied to python-urllib3
just says that the package is not installed.
The same error with urllib3
seems to be applied with whatever python package I want to install. I have looked to several other questions with this error without getting to solve this problem. What can I do?
EDIT
Tried @x1337Loser's answer: now everything runs smoothly, but I had the following output after the pip
command:
Defaulting to user installation because normal site-packages is not writeable
(... some `Requirement already satisfied` row...)
WARNING: Error parsing dependencies of attrs: [Errno 2] File o directory non esistente: '/home/username/.local/lib/python3.8/site-packages/attrs-23.1.0.dist-info/METADATA'`
I am glad my program is now running, but what is that warning?
A few days ago I faced a similar problem with python-requests
and these steps worked for me [Don't use sudo while installing, because this seems to work when you move to sudo but installing a package with sudo is harmful who knows what you're installing is a malware in a package form]:
Remove the package manually from the site-packages
directory:
cd ~/.local/lib/python3.8/site-packages/
rm -rf urllib3*
now install your package:
pip install pacsltk --upgrade
let me know if this solves your problem