I am using Ubuntu 24.04 with Python 3.12 installed on it. I am jsut trying to use the command pip install <package_name> inside the virutal environment but for some reason it uses the global one. I first created a virtual environment using the command: python3 -m venv .venv I then activated the virtual environment using the command: source ./.venv/bin/activate I then tried to check which python and pip it uses so I ran the following and got the following results: (.venv) $ which pip /usr/bin/pip (.venv) $ which python /mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/test/.venv/bin/python it uses the python in the virutal environment correctly but not pip. I tried to force run pip by using the following command: (.venv) $ ./.venv/bin/pip install numpy bash: ./.venv/bin/pip: Permission denied I ran it using sudo but it was also in vain. I checked the execte permission on the file by running the command: (.venv) $ ls -l ./.venv/bin/pip -rwxrwxr-x 1 ams ams 336 Jul 13 01:06 ./.venv/bin/pip (.venv) $ whoami ams it seems it has the correct permissions to run but why can't it run? I tried installing the packages using the command python -m pip install numpy and it was installed succesfully, but the problem the when I import that module in the code, I get the following error: (.venv) ams@ams-Alienware-m17-R3:/mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/Scripts$ python run_prediction.py Traceback (most recent call last): File "/mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/Scripts/.venv/lib/python3.12/site-packages/numpy/_core/__init__.py", line 23, in <module> from . import multiarray File "/mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/Scripts/.venv/lib/python3.12/site-packages/numpy/_core/multiarray.py", line 10, in <module> from . import overrides File "/mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/Scripts/.venv/lib/python3.12/site-packages/numpy/_core/overrides.py", line 7, in <module> from numpy._core._multiarray_umath import ( ImportError: /mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/Scripts/.venv/lib/python3.12/site-packages/numpy/_core/_multiarray_umath.cpython-312-x86_64-linux-gnu.so: failed to map segment from shared object During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/Scripts/.venv/lib/python3.12/site-packages/numpy/__init__.py", line 114, in <module> from numpy.__config__ import show_config File "/mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/Scripts/.venv/lib/python3.12/site-packages/numpy/__config__.py", line 4, in <module> from numpy._core._multiarray_umath import ( File "/mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/Scripts/.venv/lib/python3.12/site-packages/numpy/_core/__init__.py", line 49, in <module> raise ImportError(msg) ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.12 from "/mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/Scripts/.venv/bin/python" * The NumPy version is: "2.2.6" and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help. Original error was: /mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/Scripts/.venv/lib/python3.12/site-packages/numpy/_core/_multiarray_umath.cpython-312-x86_64-linux-gnu.so: failed to map segment from shared object The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/Scripts/run_prediction.py", line 2, in <module> import numpy as np File "/mnt/DATA/AUC/Research Assistant/Pedestrian-Estimation-Dataset-Annotation/Scripts/.venv/lib/python3.12/site-packages/numpy/__init__.py", line 119, in <module> raise ImportError(msg) from e ImportError: Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python interpreter from there. Continue reading...